:root {
  color-scheme: dark;
  --void: #050a11;
  --void-soft: #09121c;
  --panel: rgba(13, 23, 34, 0.94);
  --panel-raised: rgba(20, 34, 48, 0.96);
  --panel-lift: rgba(29, 47, 63, 0.96);
  --line: rgba(165, 204, 220, 0.18);
  --line-strong: rgba(199, 228, 235, 0.36);
  --text: #edf5f2;
  --text-soft: #a9bbb9;
  --text-dim: #708583;
  --gold: #eec86d;
  --gold-bright: #ffe5a2;
  --cyan: #5edfd4;
  --cyan-soft: #a1fff3;
  --blue: #6aabff;
  --violet: #9c8cf0;
  --coral: #ff758f;
  --danger: #ff5d69;
  --ivory: #f3ecd9;
  --card-ink: #101b25;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
  --font-ui: "Segoe UI Variable Text", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-display: "Bahnschrift SemiBold", "Segoe UI Variable Display", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--void);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  font-feature-settings: "kern" 1, "tnum" 1;
  background:
    radial-gradient(circle at 18% 0%, rgba(26, 91, 102, 0.24), transparent 32%),
    radial-gradient(circle at 100% 18%, rgba(78, 59, 123, 0.22), transparent 30%),
    linear-gradient(145deg, #07111a 0%, #050a11 48%, #0c1018 100%);
  font-family: var(--font-ui);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  background:
    linear-gradient(rgba(117, 173, 186, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 173, 186, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

/* Inline sprite icons must stay square: an SVG without width/height attributes
   would otherwise fall back to the 300x150 replaced-element default. */
svg:not(.icon-sprite) {
  height: var(--icon-size, 1em);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.star-field {
  position: absolute;
  inset: -50%;
  background-repeat: repeat;
  opacity: 0.7;
  animation: drift 80s linear infinite;
}

.star-field--far {
  background-image:
    radial-gradient(circle, rgba(225, 248, 255, 0.75) 0 0.7px, transparent 0.9px),
    radial-gradient(circle, rgba(115, 217, 219, 0.55) 0 0.8px, transparent 1px);
  background-position: 0 0, 29px 41px;
  background-size: 77px 77px, 113px 113px;
  opacity: 0.4;
}

.star-field--near {
  background-image:
    radial-gradient(circle, rgba(255, 224, 157, 0.86) 0 0.9px, transparent 1.2px),
    radial-gradient(circle, rgba(196, 225, 255, 0.78) 0 0.7px, transparent 1px);
  background-position: 13px 17px, 54px 72px;
  background-size: 151px 151px, 191px 191px;
  animation-direction: reverse;
  animation-duration: 130s;
  opacity: 0.5;
}

.orbital-grid {
  position: absolute;
  top: -28%;
  right: -18%;
  width: min(72vw, 1050px);
  aspect-ratio: 1;
  border: 1px solid rgba(117, 216, 213, 0.08);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 78px, rgba(105, 191, 199, 0.07) 80px 81px),
    conic-gradient(from 20deg, transparent 0 12%, rgba(238, 200, 109, 0.1) 12.2% 12.5%, transparent 12.7% 37%, rgba(94, 223, 212, 0.09) 37.2% 37.5%, transparent 37.7%);
  mask-image: radial-gradient(circle, black 20%, transparent 70%);
  transform: rotate(-12deg);
}

.scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 0 48%, rgba(116, 234, 230, 0.035) 50%, transparent 52%);
  background-size: 100% 14px;
  opacity: 0.5;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 70px;
  padding: 10px clamp(16px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 15, 23, 0.94), rgba(7, 15, 23, 0.76));
  backdrop-filter: blur(18px);
}

.topbar::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  width: 18%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--gold));
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 44px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(238, 200, 109, 0.72);
  background: linear-gradient(145deg, rgba(238, 200, 109, 0.12), rgba(94, 223, 212, 0.04));
  clip-path: polygon(50% 0, 94% 24%, 94% 76%, 50% 100%, 6% 76%, 6% 24%);
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
}

.brand-mark__orbit {
  position: absolute;
  width: 32px;
  aspect-ratio: 1;
  border: 1px solid rgba(94, 223, 212, 0.42);
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-33deg);
}

.brand-mark__core {
  position: relative;
  z-index: 1;
}

.brand-copy {
  display: grid;
  line-height: 1;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
}

.brand-copy small {
  margin-top: 5px;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 0;
}

.round-monitor {
  display: flex;
  align-items: stretch;
  gap: 13px;
  margin-inline: auto;
  padding: 7px 16px;
  border: 1px solid var(--line);
  background: rgba(6, 13, 21, 0.62);
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
}

.monitor-item {
  display: grid;
  min-width: 44px;
  text-align: center;
}

.monitor-item b {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.monitor-item small {
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: 0;
}

.monitor-divider {
  width: 1px;
  background: var(--line);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  aspect-ratio: 1;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(17, 31, 43, 0.7);
  cursor: pointer;
  transition: 160ms ease;
}

.icon-button:hover {
  border-color: rgba(238, 200, 109, 0.6);
  background: rgba(238, 200, 109, 0.1);
  color: var(--gold-bright);
}

.icon-button svg {
  --icon-size: 17px;
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.game-view {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 342px;
  gap: clamp(14px, 2vw, 24px);
  height: calc(100vh - 118px);
  height: calc(100dvh - 118px);
  min-height: 520px;
  padding: 18px clamp(16px, 3vw, 38px) 14px;
}

.players-zone {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  margin-bottom: 8px;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-index {
  color: var(--gold);
  font-size: 9px;
}

.section-label h2 {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}

.section-line {
  width: clamp(24px, 8vw, 90px);
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

#activeCountLabel {
  margin-left: auto;
  font-size: 9px;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 248px), 1fr));
  gap: 10px;
  min-height: 0;
  padding: 1px 4px 16px 1px;
  align-content: start;
  overflow: auto;
  scrollbar-color: rgba(94, 223, 212, 0.35) transparent;
  scrollbar-width: thin;
}

.player-grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  align-content: center;
}

.player-grid[data-count="3"],
.player-grid[data-count="4"] {
  grid-template-columns: repeat(2, minmax(250px, 1fr));
  align-content: center;
}

.player-grid[data-count="5"],
.player-grid[data-count="6"] {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  align-content: center;
}

.player-grid[data-count="7"],
.player-grid[data-count="8"],
.player-grid[data-count="9"] {
  grid-template-columns: repeat(3, minmax(200px, 1fr));
}

.player-grid[data-count="10"],
.player-grid[data-count="11"],
.player-grid[data-count="12"] {
  grid-template-columns: repeat(4, minmax(175px, 1fr));
}

.player-grid[data-count="13"],
.player-grid[data-count="14"],
.player-grid[data-count="15"],
.player-grid[data-count="16"],
.player-grid[data-count="17"],
.player-grid[data-count="18"] {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.player-grid[data-count="10"] .player-panel,
.player-grid[data-count="11"] .player-panel,
.player-grid[data-count="12"] .player-panel,
.player-grid[data-count="13"] .player-panel,
.player-grid[data-count="14"] .player-panel,
.player-grid[data-count="15"] .player-panel,
.player-grid[data-count="16"] .player-panel,
.player-grid[data-count="17"] .player-panel,
.player-grid[data-count="18"] .player-panel {
  min-height: 132px;
}

.player-grid[data-count="10"] .game-card,
.player-grid[data-count="11"] .game-card,
.player-grid[data-count="12"] .game-card,
.player-grid[data-count="13"] .game-card,
.player-grid[data-count="14"] .game-card,
.player-grid[data-count="15"] .game-card,
.player-grid[data-count="16"] .game-card,
.player-grid[data-count="17"] .game-card,
.player-grid[data-count="18"] .game-card {
  flex-basis: 54px;
  width: 54px;
  margin-right: 0;
}

.player-grid[data-count="10"] .game-card--modifier,
.player-grid[data-count="11"] .game-card--modifier,
.player-grid[data-count="12"] .game-card--modifier,
.player-grid[data-count="13"] .game-card--modifier,
.player-grid[data-count="14"] .game-card--modifier,
.player-grid[data-count="15"] .game-card--modifier,
.player-grid[data-count="16"] .game-card--modifier,
.player-grid[data-count="17"] .game-card--modifier,
.player-grid[data-count="18"] .game-card--modifier {
  flex-basis: 48px;
  width: 48px;
}

.player-panel {
  position: relative;
  min-width: 0;
  min-height: 150px;
  padding: 11px 12px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.025), transparent 35%),
    linear-gradient(180deg, rgba(20, 34, 48, 0.94), rgba(10, 19, 29, 0.96));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.17);
  isolation: isolate;
  transition: border-color 220ms ease, box-shadow 220ms ease, opacity 220ms ease;
}

.player-panel::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  content: "";
  background: var(--accent, var(--cyan));
  opacity: 0.45;
}

.player-panel::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 46px;
  height: 10px;
  content: "";
  border-top: 1px solid color-mix(in srgb, var(--accent, var(--cyan)) 50%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--accent, var(--cyan)) 50%, transparent);
  transform: skewX(-26deg) translateX(9px);
}

.player-panel[data-accent="0"] { --accent: #5edfd4; }
.player-panel[data-accent="1"] { --accent: #eec86d; }
.player-panel[data-accent="2"] { --accent: #75a8ff; }
.player-panel[data-accent="3"] { --accent: #ff8299; }
.player-panel[data-accent="4"] { --accent: #b69bff; }
.player-panel[data-accent="5"] { --accent: #79d79d; }
.player-panel[data-accent="6"] { --accent: #f3a764; }
.player-panel[data-accent="7"] { --accent: #7ed3e8; }

.player-panel[data-status="busted"] {
  opacity: 0.64;
  border-color: rgba(255, 93, 105, 0.32);
}

.player-panel[data-status="stayed"],
.player-panel[data-status="frozen"] {
  border-color: rgba(94, 223, 212, 0.27);
}

.player-panel.is-current {
  border-color: color-mix(in srgb, var(--accent) 72%, white);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent),
    0 0 32px color-mix(in srgb, var(--accent) 13%, transparent),
    0 18px 45px rgba(0, 0, 0, 0.25);
}

.player-panel.is-current .player-sigil {
  animation: currentPulse 1.8s ease-in-out infinite;
}

.player-panel.is-targetable {
  cursor: pointer;
  animation: targetPulse 1.35s ease-in-out infinite;
}

.player-panel.is-targetable:hover {
  border-color: var(--gold-bright);
  box-shadow: 0 0 28px rgba(238, 200, 109, 0.19);
}

.player-header {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.player-sigil {
  position: relative;
  display: grid;
  width: 34px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 62%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 17%, transparent), transparent),
    rgba(4, 10, 16, 0.65);
  clip-path: polygon(50% 0, 91% 25%, 91% 75%, 50% 100%, 9% 75%, 9% 25%);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
}

.player-sigil::after {
  position: absolute;
  width: 21px;
  aspect-ratio: 1;
  content: "";
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 50%;
}

.player-nameplate {
  min-width: 0;
}

.player-nameplate h3 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-nameplate p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dealer-tag {
  padding: 2px 5px;
  border: 1px solid rgba(238, 200, 109, 0.34);
  color: var(--gold);
  font-size: 7px;
}

.score-lockup {
  display: grid;
  min-width: 48px;
  text-align: right;
}

.score-lockup b {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.score-lockup small {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 7px;
  letter-spacing: 0;
}

.player-score-delta {
  color: var(--cyan) !important;
}

.card-rail {
  display: flex;
  min-height: 76px;
  margin-top: 10px;
  padding: 4px 2px 6px;
  align-items: flex-start;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 8px 5px;
  overflow: visible;
}

.card-rail:empty::after {
  display: grid;
  width: 100%;
  min-height: 62px;
  place-items: center;
  border: 1px dashed rgba(169, 187, 185, 0.14);
  color: rgba(169, 187, 185, 0.42);
  content: "NO DATA";
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: 0;
}

.game-card {
  position: relative;
  flex: 0 0 66px;
  width: 66px;
  aspect-ratio: 0.7;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 5px;
  background: var(--ivory);
  box-shadow: -5px 6px 15px rgba(0, 0, 0, 0.25);
  color: var(--card-ink);
  transform-origin: 50% 90%;
  transition: transform 180ms ease, box-shadow 180ms ease;
  will-change: transform;
}


.game-card::before {
  position: absolute;
  inset: 4px;
  content: "";
  border: 1px solid rgba(16, 27, 37, 0.16);
  border-radius: 3px;
  pointer-events: none;
}

.game-card::after {
  position: absolute;
  right: 6px;
  bottom: 5px;
  width: 12px;
  aspect-ratio: 1;
  content: "";
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.26;
}

.game-card--number {
  background:
    radial-gradient(circle at 70% 22%, rgba(94, 223, 212, 0.2), transparent 22%),
    linear-gradient(145deg, #fff9e8, #dbe8df);
}

.game-card--freeze {
  background: linear-gradient(145deg, #dff9ff, #89c8e9);
  color: #0e3d5b;
}

.game-card--flipThree {
  background: linear-gradient(145deg, #fff0ba, #e6b95f);
  color: #49330c;
}

.game-card--secondChance {
  background: linear-gradient(145deg, #e7ffe7, #8ed7b0);
  color: #123f2c;
}

.game-card--bonus,
.game-card--multiplier {
  background: linear-gradient(145deg, #f8e9bd, #d8a94f);
  color: #3f2b07;
}

.game-card--modifier {
  flex-basis: 56px;
  width: 56px;
  aspect-ratio: 0.76;
}

.card-corner {
  position: absolute;
  display: grid;
  line-height: 1;
}

.card-corner--top {
  top: 8px;
  left: 8px;
}

.card-corner--bottom {
  right: 8px;
  bottom: 8px;
  transform: rotate(180deg);
}

.card-corner b {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
}

.card-corner small {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 5px;
  letter-spacing: 0;
  opacity: 0.55;
}

.card-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}

.card-center strong {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 800;
  line-height: 0.9;
}

.game-card--bonus .card-center strong,
.game-card--multiplier .card-center strong {
  font-size: 21px;
}

.game-card--freeze .card-center strong,
.game-card--flipThree .card-center strong,
.game-card--secondChance .card-center strong {
  max-width: 48px;
  font-size: 12px;
  line-height: 1.15;
}

.card-center i {
  position: absolute;
  width: 38px;
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.22;
}

.card-center i::before,
.card-center i::after {
  position: absolute;
  top: 50%;
  left: -5px;
  width: calc(100% + 10px);
  height: 1px;
  content: "";
  background: currentColor;
  opacity: 0.45;
}

.card-center i::after {
  transform: rotate(90deg);
}

.action-glyph {
  display: grid;
  width: 28px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
}

.player-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: var(--font-display);
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-pill::before {
  width: 4px;
  aspect-ratio: 1;
  content: "";
  border-radius: 50%;
  background: currentColor;
}

.status-pill--active { color: var(--cyan); }
.status-pill--stayed { color: var(--blue); }
.status-pill--frozen { color: #a8e9ff; }
.status-pill--busted { color: var(--danger); }

.second-chance-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #85e5a9;
}

.second-chance-mark svg {
  --icon-size: 11px;
  width: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.command-deck {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(94, 223, 212, 0.06), transparent 22%),
    linear-gradient(315deg, rgba(238, 200, 109, 0.05), transparent 28%),
    var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.command-deck::before,
.command-deck::after {
  position: absolute;
  width: 34px;
  height: 34px;
  content: "";
  pointer-events: none;
}

.command-deck::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
}

.command-deck::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid var(--cyan);
  border-bottom: 1px solid var(--cyan);
}

.deck-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: 0;
}

.deck-header h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 750;
}

.phase-badge {
  padding: 4px 7px;
  border: 1px solid rgba(94, 223, 212, 0.34);
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: 0;
}

.deck-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-height: 174px;
  padding: 19px 0 12px;
  place-items: center;
}

.deck-stack {
  position: relative;
  width: 94px;
  aspect-ratio: 0.7;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.3));
}

.deck-card {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(238, 200, 109, 0.62);
  border-radius: 6px;
  background:
    linear-gradient(45deg, transparent 46%, rgba(238, 200, 109, 0.22) 47% 50%, transparent 51%),
    linear-gradient(-45deg, transparent 46%, rgba(94, 223, 212, 0.16) 47% 50%, transparent 51%),
    #0c1d28;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.26);
}

.deck-card--back1 {
  transform: translate(-5px, 5px) rotate(-3deg);
  opacity: 0.42;
}

.deck-card--back2 {
  transform: translate(4px, 2px) rotate(3deg);
  opacity: 0.58;
}

.deck-card--top {
  transform: translateY(-3px);
}

.deck-emblem {
  display: grid;
  width: 52px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(238, 200, 109, 0.56);
  clip-path: polygon(50% 0, 91% 25%, 91% 75%, 50% 100%, 9% 75%, 9% 25%);
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
}

.drawn-slot {
  display: grid;
  width: 104px;
  aspect-ratio: 0.7;
  place-items: center;
  perspective: 900px;
}

.empty-card-frame {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 1px dashed rgba(169, 187, 185, 0.23);
  color: rgba(169, 187, 185, 0.43);
  text-align: center;
}

.empty-card-frame svg {
  --icon-size: 25px;
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.empty-card-frame span {
  margin-top: -26px;
  font-size: 8px;
}

.reveal-card {
  width: 94px;
  margin: 0;
  animation: revealCard 560ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.turn-readout {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 75px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(6, 14, 22, 0.45);
}

.turn-sigil {
  position: relative;
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(94, 223, 212, 0.35);
  border-radius: 50%;
}

.turn-sigil::before,
.turn-sigil::after {
  position: absolute;
  width: 51px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(94, 223, 212, 0.48), transparent);
}

.turn-sigil::after {
  transform: rotate(90deg);
}

.turn-sigil span {
  width: 13px;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  background: rgba(238, 200, 109, 0.16);
  transform: rotate(45deg);
}

.turn-readout strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.turn-readout p {
  min-height: 30px;
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.45;
}

.target-panel {
  margin-top: 10px;
  padding: 11px;
  border: 1px solid rgba(238, 200, 109, 0.4);
  background: rgba(238, 200, 109, 0.055);
}

.target-copy {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
}

.target-copy__icon {
  display: grid;
  width: 32px;
  aspect-ratio: 1;
  flex: 0 0 32px;
  place-items: center;
  border: 1px solid rgba(238, 200, 109, 0.45);
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 9px;
}

.target-copy strong {
  display: block;
  font-size: 12px;
}

.target-copy p {
  margin: 3px 0 0;
  color: var(--text-soft);
  font-size: 9px;
}

.target-options {
  display: flex;
  gap: 6px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.target-option {
  display: inline-flex;
  min-width: max-content;
  padding: 6px 8px;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(10, 20, 29, 0.78);
  color: var(--text-soft);
  font-size: 9px;
  cursor: pointer;
}

.target-option:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.target-option i {
  width: 5px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--cyan);
}

.action-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.primary-action,
.secondary-action {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  min-height: 58px;
  padding: 9px;
  align-items: center;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  transition: 170ms ease;
}

.primary-action {
  border: 1px solid rgba(94, 223, 212, 0.52);
  background: linear-gradient(135deg, rgba(94, 223, 212, 0.2), rgba(94, 223, 212, 0.05));
}

.primary-action:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(94, 223, 212, 0.31), rgba(94, 223, 212, 0.08));
  box-shadow: 0 0 24px rgba(94, 223, 212, 0.12);
}

.secondary-action {
  border: 1px solid rgba(238, 200, 109, 0.45);
  background: linear-gradient(135deg, rgba(238, 200, 109, 0.16), rgba(238, 200, 109, 0.035));
}

.secondary-action:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(238, 200, 109, 0.26), rgba(238, 200, 109, 0.06));
}

.primary-action:disabled,
.secondary-action:disabled {
  border-color: var(--line);
  background: rgba(23, 34, 43, 0.38);
  color: var(--text-dim);
  opacity: 0.58;
}

.action-icon {
  display: grid;
  width: 32px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.action-icon svg {
  --icon-size: 15px;
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.action-stack b,
.action-stack small {
  display: block;
}

.action-stack b {
  font-size: 11px;
}

.action-stack small {
  margin-top: 3px;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: 0;
}

.probability-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.probability-strip > div {
  display: grid;
  text-align: center;
}

.probability-strip > div + div {
  border-left: 1px solid var(--line);
}

.probability-strip span {
  color: var(--text-dim);
  font-size: 8px;
}

.probability-strip b {
  margin-top: 5px;
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.event-console {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 135px minmax(0, 1fr);
  gap: 12px;
  min-height: 44px;
  padding: 8px clamp(16px, 3vw, 38px);
  align-items: center;
  border-top: 1px solid var(--line);
  background: rgba(5, 11, 18, 0.88);
  backdrop-filter: blur(14px);
}

.console-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.live-dot {
  width: 5px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: blink 1.8s ease-in-out infinite;
}

.event-feed {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 22px;
  overflow: hidden;
  white-space: nowrap;
}

.event-line {
  margin: 0;
  color: var(--text-soft);
  font-size: 9px;
  animation: eventIn 300ms ease both;
}

.event-line::before {
  margin-right: 6px;
  color: var(--gold);
  content: "›";
}

.event-line--muted {
  color: var(--text-dim);
}

.event-line--danger {
  color: #ff9ca7;
}

.event-line--good {
  color: #8ee8bd;
}

.game-dialog {
  width: min(94vw, 1060px);
  max-height: 94dvh;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.58);
}

.game-dialog::backdrop {
  background:
    radial-gradient(circle at 50% 45%, rgba(26, 64, 72, 0.24), transparent 40%),
    rgba(1, 5, 9, 0.82);
  backdrop-filter: blur(10px);
}

.dialog-shell {
  position: relative;
  max-height: 94dvh;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(94, 223, 212, 0.06), transparent 23%),
    linear-gradient(315deg, rgba(238, 200, 109, 0.05), transparent 27%),
    #0b151f;
}

.dialog-shell::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 140px;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--gold), transparent);
}

.setup-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(460px, 1.25fr);
  min-height: 620px;
}

.setup-visual {
  position: relative;
  display: flex;
  min-height: 620px;
  padding: clamp(32px, 5vw, 64px);
  justify-content: flex-end;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(5, 11, 18, 0.15), rgba(5, 11, 18, 0.92)),
    linear-gradient(135deg, #102a34, #111a2a 58%, #1d1825);
}

.setup-visual::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(rgba(121, 195, 201, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 195, 201, 0.055) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.setup-visual > *:not(.setup-emblem) {
  position: relative;
  z-index: 1;
}

.setup-visual h1 {
  margin: 8px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(48px, 6vw, 76px);
  font-weight: 850;
  line-height: 0.95;
}

.setup-visual p {
  max-width: 340px;
  margin: 0;
  color: #bdcecc;
  font-size: 13px;
  line-height: 1.8;
}

.setup-emblem {
  position: absolute;
  top: 12%;
  left: 50%;
  display: grid;
  width: min(76%, 310px);
  aspect-ratio: 1;
  place-items: center;
  transform: translateX(-50%);
}

.setup-emblem strong {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: clamp(64px, 8vw, 110px);
  text-shadow: 0 0 35px rgba(238, 200, 109, 0.24);
}

.setup-emblem__ring {
  position: absolute;
  border: 1px solid rgba(94, 223, 212, 0.33);
  border-radius: 50%;
}

.setup-emblem__ring--outer {
  inset: 2%;
  border-top-color: var(--gold);
  border-bottom-color: transparent;
  animation: orbitSpin 18s linear infinite;
}

.setup-emblem__ring--inner {
  inset: 21%;
  border-right-color: var(--gold);
  border-left-color: transparent;
  animation: orbitSpin 11s linear infinite reverse;
}

.setup-emblem__axis {
  position: absolute;
  inset: 10%;
  border: 1px solid rgba(238, 200, 109, 0.12);
  transform: rotate(45deg);
}

.setup-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 26px;
  border: 1px solid var(--line);
  background: var(--line);
}

.setup-facts > span {
  display: grid;
  padding: 12px 8px;
  background: rgba(7, 14, 21, 0.86);
  text-align: center;
}

.setup-facts b {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 17px;
}

.setup-facts small {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 8px;
}

.setup-controls {
  display: flex;
  min-width: 0;
  padding: clamp(24px, 4vw, 48px);
  flex-direction: column;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.dialog-heading h2 {
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-size: 27px;
}

.player-count-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 15px;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(6, 14, 22, 0.5);
}

.count-copy span,
.count-copy small {
  display: block;
}

.count-copy span {
  font-size: 12px;
  font-weight: 650;
}

.count-copy small {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 9px;
}

.stepper {
  display: grid;
  grid-template-columns: 36px 48px 36px;
  align-items: center;
}

.stepper button {
  display: grid;
  width: 34px;
  aspect-ratio: 1;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: rgba(20, 34, 48, 0.8);
  cursor: pointer;
}

.stepper button:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.stepper svg {
  --icon-size: 14px;
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stepper output {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 800;
  text-align: center;
}

#playerCountRange {
  grid-column: 1 / -1;
  width: 100%;
  height: 3px;
  margin: 5px 0 0;
  border-radius: 0;
  appearance: none;
  background: linear-gradient(90deg, var(--cyan) 0 var(--range-progress, 12.5%), rgba(169, 187, 185, 0.18) var(--range-progress, 12.5%) 100%);
}

#playerCountRange::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  border: 1px solid var(--gold-bright);
  border-radius: 50%;
  appearance: none;
  background: #10222d;
  box-shadow: 0 0 0 4px rgba(238, 200, 109, 0.1);
  cursor: pointer;
}

#playerCountRange::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 1px solid var(--gold-bright);
  border-radius: 50%;
  background: #10222d;
  cursor: pointer;
}

.name-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 300px;
  margin: 16px 0;
  padding: 2px 5px 2px 2px;
  overflow: auto;
  scrollbar-color: rgba(94, 223, 212, 0.35) transparent;
  scrollbar-width: thin;
}

.name-field {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  background: rgba(14, 26, 38, 0.72);
}

.name-field__index {
  display: grid;
  width: 30px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--field-accent) 55%, transparent);
  color: var(--field-accent);
  font-family: var(--font-display);
  font-size: 10px;
}

.name-field input {
  width: 100%;
  min-width: 0;
  padding: 7px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 11px;
}

.name-field input:focus {
  border-color: var(--gold);
  outline: 0;
}

.launch-button {
  display: flex;
  min-height: 56px;
  margin-top: auto;
  padding: 0 20px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(238, 200, 109, 0.62);
  border-radius: 4px;
  background: linear-gradient(110deg, rgba(238, 200, 109, 0.23), rgba(94, 223, 212, 0.1));
  color: var(--gold-bright);
  font-weight: 700;
  cursor: pointer;
  transition: 170ms ease;
}

.launch-button:hover {
  background: linear-gradient(110deg, rgba(238, 200, 109, 0.34), rgba(94, 223, 212, 0.14));
  box-shadow: 0 0 30px rgba(238, 200, 109, 0.1);
}

.launch-button svg {
  --icon-size: 19px;
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.rules-shell {
  width: min(92vw, 860px);
  padding: clamp(24px, 4vw, 44px);
}

.dialog-close {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(20, 34, 48, 0.7);
  color: var(--text-soft);
  cursor: pointer;
}

.dialog-close:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.rule-block {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(9, 18, 27, 0.64);
}

.rule-block--goal {
  border-color: rgba(238, 200, 109, 0.36);
  background: rgba(238, 200, 109, 0.055);
}

.rule-block--wide {
  grid-column: 1 / -1;
}

.rule-index {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 9px;
}

.rule-block h3 {
  margin: 8px 0;
  font-family: var(--font-display);
  font-size: 16px;
}

.rule-block p {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.7;
}

.effect-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.effect-list > div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 10px;
  align-items: start;
  border: 1px solid var(--line);
  background: rgba(15, 28, 40, 0.7);
}

.effect-chip {
  padding: 4px 6px;
  border: 1px solid currentColor;
  font-size: 8px;
  white-space: nowrap;
}

.effect-chip--freeze { color: #9ce7ff; }
.effect-chip--flip { color: #f2cd77; }
.effect-chip--chance { color: #8de5ad; }
.effect-chip--modifier { color: #c7b8ff; }

.result-dialog {
  width: min(92vw, 720px);
}

.result-shell {
  padding: clamp(24px, 4vw, 44px);
}

.result-hero {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}

.result-emblem {
  display: grid;
  width: 70px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(238, 200, 109, 0.5);
  clip-path: polygon(50% 0, 91% 25%, 91% 75%, 50% 100%, 9% 75%, 9% 25%);
  background: rgba(238, 200, 109, 0.08);
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
}

.result-hero h2 {
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-size: clamp(25px, 5vw, 40px);
}

.result-hero p {
  margin: 7px 0 0;
  color: var(--text-soft);
  font-size: 11px;
}

.score-table {
  border: 1px solid var(--line);
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 80px;
  min-height: 44px;
  padding: 0 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.score-row:last-child {
  border-bottom: 0;
}

.score-row--head {
  min-height: 35px;
  background: rgba(94, 223, 212, 0.045);
  color: var(--text-dim);
  font-size: 8px;
}

.score-row--winner {
  background: rgba(238, 200, 109, 0.07);
}

.score-row span:nth-child(n + 2) {
  font-family: var(--font-display);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.score-player {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.score-player i {
  width: 6px;
  aspect-ratio: 1;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--row-accent, var(--cyan));
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.result-actions button {
  display: inline-flex;
  min-height: 44px;
  padding: 0 18px;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(238, 200, 109, 0.56);
  border-radius: 4px;
  background: rgba(238, 200, 109, 0.12);
  color: var(--gold-bright);
  cursor: pointer;
}

.result-actions svg,
.result-actions use {
  --icon-size: 16px;
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.card-flying {
  position: fixed;
  z-index: 100;
  width: 66px;
  aspect-ratio: 0.7;
  margin: 0;
  pointer-events: none;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.48);
}

.card-hidden-for-flight {
  visibility: hidden !important;
}

.player-panel.is-entering {
  animation: panelIn 360ms ease both;
}

.player-panel.is-busting {
  animation: panelShake 420ms ease both;
}

.player-panel.is-freezing {
  animation: freezeFlash 650ms ease both;
}

.drawn-slot.is-revealing {
  animation: slotFlash 620ms ease both;
}

@keyframes drift {
  to { transform: translate3d(8%, 5%, 0); }
}

@keyframes currentPulse {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); }
  50% { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 55%, transparent)); }
}

@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(238, 200, 109, 0.04); }
  50% { box-shadow: 0 0 24px 2px rgba(238, 200, 109, 0.16); }
}

@keyframes blink {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@keyframes eventIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes orbitSpin {
  to { transform: rotate(360deg); }
}

@keyframes revealCard {
  0% {
    opacity: 0;
    transform: translate(0, -26px) rotateY(90deg) scale(0.7);
  }
  62% {
    opacity: 1;
    transform: translate(0, 0) rotateY(-8deg) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0) rotateY(0) scale(1);
  }
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panelShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

@keyframes freezeFlash {
  0%, 100% { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.17); }
  45% { box-shadow: 0 0 38px rgba(142, 223, 255, 0.3); }
}

@keyframes slotFlash {
  0%, 100% { filter: none; }
  45% { filter: drop-shadow(0 0 18px rgba(238, 200, 109, 0.32)); }
}

@media (max-width: 1100px) {
  .game-view {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .player-grid[data-count="10"],
  .player-grid[data-count="11"],
  .player-grid[data-count="12"],
  .player-grid[data-count="13"],
  .player-grid[data-count="14"],
  .player-grid[data-count="15"],
  .player-grid[data-count="16"],
  .player-grid[data-count="17"],
  .player-grid[data-count="18"] {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }

  .game-card {
    flex-basis: 58px;
    width: 58px;
    margin-right: 0;
  }

  .game-card--modifier {
    flex-basis: 52px;
    width: 52px;
  }
}

@media (max-width: 860px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .topbar {
    min-height: 62px;
    padding: 9px 14px;
  }

  .brand-lockup {
    min-width: 0;
  }

  .brand-copy small {
    display: none;
  }

  .round-monitor {
    margin-left: auto;
    padding: 6px 10px;
  }

  .monitor-item {
    min-width: 36px;
  }

  .monitor-item b {
    font-size: 13px;
  }

  .game-view {
    display: flex;
    height: auto;
    min-height: 0;
    padding: 14px 12px;
    flex-direction: column;
  }

  .players-zone {
    order: 1;
  }

  .player-grid {
    overflow: visible;
  }

  .player-grid[data-count] {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    align-content: start;
  }

  .command-deck {
    position: sticky;
    z-index: 15;
    bottom: max(8px, env(safe-area-inset-bottom));
    order: 2;
    padding: 11px;
    background:
      linear-gradient(135deg, rgba(94, 223, 212, 0.08), transparent 22%),
      rgba(10, 20, 30, 0.97);
    backdrop-filter: blur(18px);
  }

  .deck-header {
    padding-bottom: 8px;
  }

  .deck-header h2 {
    font-size: 15px;
  }

  .deck-stage {
    position: absolute;
    top: 44px;
    right: 13px;
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 0;
    pointer-events: none;
  }

  .deck-stack {
    width: 50px;
    opacity: 0.7;
  }

  .deck-emblem {
    width: 28px;
    font-size: 14px;
  }

  .drawn-slot {
    position: absolute;
    top: 0;
    right: 57px;
    width: 54px;
  }

  .empty-card-frame span {
    display: none;
  }

  .empty-card-frame svg {
    --icon-size: 18px;
    width: 18px;
  }

  .turn-readout {
    grid-template-columns: 34px minmax(0, 1fr);
    min-height: 62px;
    padding: 9px;
    padding-right: 118px;
  }

  .turn-sigil {
    width: 32px;
  }

  .turn-sigil::before,
  .turn-sigil::after {
    width: 39px;
  }

  .turn-readout p {
    min-height: 0;
  }

  .action-stack {
    grid-template-columns: 1fr 1fr;
  }

  .primary-action,
  .secondary-action {
    min-height: 50px;
  }

  .probability-strip {
    margin-top: 10px;
  }

  .event-console {
    display: none;
  }

  .setup-shell {
    grid-template-columns: 1fr;
  }

  .setup-visual {
    min-height: 250px;
    padding: 128px 24px 24px;
  }

  .setup-emblem {
    top: 8px;
    left: 25%;
    width: 190px;
  }

  .setup-emblem strong {
    font-size: 64px;
  }

  .setup-visual h1 {
    margin-top: 5px;
    font-size: 44px;
  }

  .setup-visual p {
    display: none;
  }

  .setup-facts {
    margin-top: 16px;
  }

  .setup-controls {
    padding: 22px;
  }

  .name-editor {
    max-height: none;
  }

  .rules-grid {
    grid-template-columns: 1fr;
  }

  .rule-block--wide {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 8px;
  }

  .brand-mark {
    width: 36px;
    font-size: 16px;
  }

  .brand-mark__orbit {
    width: 27px;
  }

  .brand-copy strong {
    font-size: 16px;
  }

  .round-monitor {
    gap: 7px;
    padding-inline: 8px;
  }

  .monitor-item:last-of-type,
  .monitor-divider:last-of-type {
    display: none;
  }

  .topbar-actions {
    gap: 5px;
  }

  .icon-button {
    width: 34px;
  }

  #restartButton {
    display: none;
  }

  .player-grid[data-count] {
    grid-template-columns: 1fr;
  }

  .player-panel {
    min-height: 126px;
  }

  .card-rail {
    min-height: 66px;
  }

  .game-card {
    flex-basis: 52px;
    width: 52px;
    margin-right: 0;
  }

  .game-card--modifier {
    flex-basis: 46px;
    width: 46px;
  }

  .card-center strong {
    font-size: 25px;
  }

  .card-center strong {
    font-size: 25px;
  }

  .card-center i {
    width: 31px;
  }

  .score-lockup b {
    font-size: 19px;
  }

  .command-deck {
    bottom: max(4px, env(safe-area-inset-bottom));
  }

  .turn-readout {
    padding-right: 105px;
  }

  .turn-readout p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .drawn-slot {
    right: 54px;
    width: 48px;
  }

  .deck-stack {
    width: 44px;
  }

  .action-stack {
    gap: 6px;
  }

  .primary-action,
  .secondary-action {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 6px;
    min-height: 48px;
    padding: 7px;
  }

  .action-icon {
    width: 26px;
  }

  .action-stack b {
    font-size: 10px;
  }

  .probability-strip b {
    font-size: 14px;
  }

  .name-editor {
    grid-template-columns: 1fr;
  }

  .setup-visual {
    min-height: 220px;
    padding-top: 110px;
  }

  .setup-visual h1 {
    font-size: 38px;
  }

  .setup-facts b {
    font-size: 14px;
  }

  .effect-list {
    grid-template-columns: 1fr;
  }

  .score-row {
    grid-template-columns: minmax(0, 1fr) 62px 70px;
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Refined card system and state language. */
.game-card {
  border-radius: 6px;
  isolation: isolate;
}

.game-card::before {
  inset: 5px;
  border-color: rgba(16, 27, 37, 0.22);
  z-index: 0;
}

.game-card::after {
  display: none;
}

.game-card--number {
  background:
    radial-gradient(circle at 50% 43%, rgba(255, 255, 255, 0.9) 0 9%, transparent 10%),
    linear-gradient(145deg, #fffaf0 0%, #e7f0e8 62%, #cadfd8 100%);
  color: #10232b;
}

.number-card__grid {
  position: absolute;
  inset: 7px;
  z-index: 1;
  border: 1px solid rgba(16, 35, 43, 0.16);
  clip-path: polygon(0 0, 34% 0, 34% 8%, 66% 8%, 66% 0, 100% 0, 100% 100%, 66% 100%, 66% 92%, 34% 92%, 34% 100%, 0 100%);
}

.number-card__axis {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 45px;
  aspect-ratio: 1;
  border: 1px solid rgba(16, 35, 43, 0.16);
  background: linear-gradient(135deg, rgba(94, 223, 212, 0.12), rgba(238, 200, 109, 0.12));
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.24);
  transform: translate(-50%, -50%) rotate(45deg);
}

.number-card__value {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  color: #0c2730;
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px 0 #ffffff;
  transform: translate(-50%, -50%);
}

.number-card__caption {
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  z-index: 2;
  color: rgba(16, 35, 43, 0.5);
  font-family: var(--font-display);
  font-size: 5px;
  font-weight: 700;
  text-align: center;
}

.game-card--freeze {
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.72), transparent 26%),
    linear-gradient(150deg, #e9fcff, #8ed9f0 62%, #60a9d4);
  color: #0a3d59;
}

.game-card--flipThree {
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.58), transparent 26%),
    linear-gradient(150deg, #fff5c8, #efc66f 62%, #c79234);
  color: #4c3106;
}

.game-card--secondChance {
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.7), transparent 26%),
    linear-gradient(150deg, #edffec, #9ee2b6 62%, #62bd88);
  color: #113d2b;
}

.game-card--bonus,
.game-card--multiplier {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.55), transparent 32%),
    linear-gradient(150deg, #fff2c7, #e6b958 64%, #c48b31);
  color: #402804;
}

.action-card__icon {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 2;
  display: grid;
  width: 24px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.16);
  transform: translateX(-50%) rotate(45deg);
}

.action-card__icon > * {
  transform: rotate(-45deg);
}

.action-card__icon svg {
  --icon-size: 15px;
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.action-card__icon--flip b {
  font-family: var(--font-display);
  font-size: 13px;
}

.action-card__title {
  position: absolute;
  top: 54%;
  left: 50%;
  z-index: 2;
  width: calc(100% - 8px);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  transform: translate(-50%, -50%);
}

.action-card__title--small {
  font-size: 7px;
  line-height: 1.05;
}

.action-card__hint {
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 4.5px;
  font-weight: 700;
  text-align: center;
  opacity: 0.72;
}

.modifier-card__halo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.2;
  transform: translate(-50%, -50%);
}

.modifier-card__value {
  position: absolute;
  top: 47%;
  left: 50%;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 850;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.modifier-card__caption {
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 5px;
  font-weight: 700;
  text-align: center;
  opacity: 0.62;
}

.game-card.is-latest {
  z-index: 8;
  transform: translateY(-4px) scale(1.05);
  border-color: #ffe4a1;
  box-shadow:
    0 0 0 2px rgba(255, 228, 161, 0.62),
    0 0 22px rgba(238, 200, 109, 0.62),
    -7px 10px 20px rgba(0, 0, 0, 0.32);
  animation: latestCardPulse 1.6s ease-in-out infinite;
}

.game-card.is-bust-match {
  border-color: #ff7e89;
  box-shadow: 0 0 18px rgba(255, 87, 105, 0.55);
}

.game-card.is-bust-card {
  z-index: 12;
  margin-right: 0;
  margin-left: 4px;
  border-color: #ff5368;
  filter: saturate(0.72);
  box-shadow:
    0 0 0 2px rgba(255, 83, 104, 0.55),
    0 0 26px rgba(255, 57, 82, 0.72);
  /* Held back until the panel shows is-busting, so the card lands on beat. */
  animation: none;
}

.card-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 9;
  padding: 3px 5px;
  border: 2px solid #c8283c;
  background: rgba(255, 239, 235, 0.88);
  color: #c8283c;
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 900;
  transform: translate(-50%, -50%) rotate(-12deg);
}

.player-panel.is-current {
  z-index: 5;
  border-color: color-mix(in srgb, var(--accent) 82%, white);
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 42%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 22%, #172a3a), #0b1722 72%);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 52%, transparent),
    0 0 38px color-mix(in srgb, var(--accent) 30%, transparent),
    0 20px 42px rgba(0, 0, 0, 0.34);
  transform: translateY(-2px);
}

.current-tag {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 8;
  display: none;
  padding: 3px 7px;
  border-left: 1px solid rgba(255, 255, 255, 0.38);
  border-bottom: 1px solid rgba(255, 255, 255, 0.38);
  background: color-mix(in srgb, var(--accent) 76%, #10202c);
  color: #08121a;
  font-family: var(--font-display);
  font-size: 6px;
  font-weight: 900;
}

.player-panel.is-current .current-tag {
  display: block;
}

.ai-tag {
  padding: 2px 5px;
  border: 1px solid rgba(182, 155, 255, 0.45);
  color: #c8b9ff;
  font-family: var(--font-display);
  font-size: 7px;
}

.player-panel[data-status="busted"] {
  border-color: rgba(255, 75, 95, 0.72);
  background:
    linear-gradient(125deg, rgba(255, 51, 76, 0.14), transparent 34%),
    repeating-linear-gradient(135deg, rgba(255, 70, 85, 0.04) 0 8px, transparent 8px 18px),
    linear-gradient(180deg, rgba(52, 23, 31, 0.97), rgba(18, 15, 23, 0.98));
  box-shadow: inset 0 0 42px rgba(255, 52, 76, 0.1), 0 0 18px rgba(255, 52, 76, 0.16);
  opacity: 1;
}

.player-panel[data-status="frozen"] {
  border-color: rgba(137, 226, 255, 0.7);
  background:
    linear-gradient(145deg, rgba(123, 211, 240, 0.2), transparent 45%),
    repeating-linear-gradient(58deg, rgba(196, 244, 255, 0.05) 0 2px, transparent 2px 13px),
    linear-gradient(180deg, rgba(19, 47, 63, 0.97), rgba(10, 24, 35, 0.98));
  box-shadow: inset 0 0 48px rgba(132, 224, 255, 0.12), 0 0 22px rgba(95, 207, 240, 0.16);
}

.player-panel[data-status="stayed"] {
  border-color: rgba(238, 200, 109, 0.7);
  background:
    linear-gradient(145deg, rgba(238, 200, 109, 0.18), transparent 46%),
    repeating-linear-gradient(90deg, rgba(238, 200, 109, 0.035) 0 1px, transparent 1px 18px),
    linear-gradient(180deg, rgba(42, 40, 30, 0.97), rgba(18, 20, 24, 0.98));
  box-shadow: inset 0 0 44px rgba(238, 200, 109, 0.09), 0 0 18px rgba(238, 200, 109, 0.11);
}

/* Reserve the floating status badge column so it never covers a card. */
.player-panel[data-status="busted"] .card-rail,
.player-panel[data-status="frozen"] .card-rail,
.player-panel[data-status="stayed"] .card-rail {
  padding-right: 142px;
}

.status-effect {
  position: absolute;
  right: 9px;
  bottom: 27px;
  z-index: 7;
  display: flex;
  min-width: 108px;
  padding: 5px 7px;
  align-items: center;
  gap: 6px;
  border: 1px solid currentColor;
  background: rgba(6, 13, 20, 0.86);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.status-effect__icon {
  display: grid;
  width: 22px;
  aspect-ratio: 1;
  flex: 0 0 22px;
  place-items: center;
  border: 1px solid currentColor;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
}

.status-effect__icon svg {
  --icon-size: 14px;
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.status-effect strong,
.status-effect small {
  display: block;
  line-height: 1.1;
}

.status-effect strong {
  font-family: var(--font-display);
  font-size: 8px;
}

.status-effect small {
  margin-top: 3px;
  color: rgba(237, 245, 242, 0.7);
  font-size: 6px;
}

.status-effect--frozen {
  color: #a7eaff;
  border-color: rgba(142, 226, 255, 0.64);
  box-shadow: 0 0 24px rgba(86, 201, 241, 0.24);
}

.status-effect--stayed {
  color: #ffe4a1;
  border-color: rgba(238, 200, 109, 0.62);
  box-shadow: 0 0 24px rgba(238, 200, 109, 0.2);
}

.status-effect--busted {
  min-width: 126px;
  color: #ff8391;
  border-color: rgba(255, 83, 104, 0.78);
  background: rgba(47, 11, 19, 0.9);
  box-shadow: 0 0 30px rgba(255, 63, 88, 0.34);
  /* Driven by .is-busting instead of render time. */
  animation: none;
}

.player-panel.is-staying {
  animation: lockPulse 700ms ease both;
}

.player-panel.is-freezing {
  animation: freezeState 700ms ease both;
}

.player-panel.is-busting {
  animation: bustPanel 820ms cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

/* The bust card and badge wait for the panel beat above. */
.player-panel.is-busting .game-card.is-bust-card {
  animation: bustCardIn 720ms cubic-bezier(0.18, 0.9, 0.2, 1) both;
}

.player-panel.is-busting .status-effect--busted {
  animation: bustBadge 820ms cubic-bezier(0.18, 0.86, 0.24, 1) both;
}

/* Second Chance shield flash, fired from the matching event. */
.player-panel.is-shielding {
  animation: shieldFlash 640ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.player-panel.is-shielding::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 30%, rgba(145, 255, 231, 0.28), transparent 62%);
  box-shadow: inset 0 0 0 2px rgba(145, 255, 231, 0.62);
  animation: shieldSweep 640ms ease both;
  pointer-events: none;
}

@keyframes shieldFlash {
  0% { filter: brightness(1.32); }
  100% { filter: brightness(1); }
}

@keyframes shieldSweep {
  0% { opacity: 0; }
  35% { opacity: 1; }
  100% { opacity: 0; }
}

/* Floating target-selection modal. */
.target-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  pointer-events: none;
}

.target-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 7, 12, 0.74);
  backdrop-filter: blur(7px);
  pointer-events: auto;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.target-modal__card {
  position: relative;
  z-index: 1;
  width: min(92vw, 590px);
  max-height: min(82dvh, 680px);
  padding: 22px;
  overflow: auto;
  border: 1px solid rgba(238, 200, 109, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(94, 223, 212, 0.08), transparent 27%),
    linear-gradient(315deg, rgba(238, 200, 109, 0.07), transparent 32%),
    #0b161f;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  pointer-events: auto;
  animation: targetModalIn 280ms cubic-bezier(0.18, 0.8, 0.2, 1) both;
  transition: opacity 220ms ease, transform 220ms ease;
}

.target-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-right: 0;
}

.target-modal__header h3 {
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-size: 21px;
}

.peek-toggle {
  position: fixed;
  top: 82px;
  right: 24px;
  bottom: auto;
  z-index: 83;
  display: inline-flex;
  height: 38px;
  padding: 0 12px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(94, 223, 212, 0.56);
  border-radius: 4px;
  background: rgba(8, 24, 33, 0.94);
  color: #b8fff7;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.peek-toggle:hover {
  border-color: rgba(238, 200, 109, 0.72);
  color: #ffe39b;
  background: rgba(38, 32, 20, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(238, 200, 109, 0.24);
}

/* Table view is pinned: keep the active state unmistakable. */
.peek-toggle[aria-pressed="true"] {
  border-color: #ffe9b6;
  background: linear-gradient(118deg, #ffe6a8, #e5b955 62%, #cfa23f);
  color: #221806;
  font-weight: 700;
  box-shadow:
    0 0 0 2px rgba(255, 228, 161, 0.34),
    0 0 28px rgba(238, 200, 109, 0.46),
    0 12px 30px rgba(0, 0, 0, 0.38);
  animation: peekActive 1.9s ease-in-out infinite;
}

.peek-toggle[aria-pressed="true"] svg {
  stroke-width: 2.2;
}

@keyframes peekActive {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(255, 228, 161, 0.34),
      0 0 24px rgba(238, 200, 109, 0.4),
      0 12px 30px rgba(0, 0, 0, 0.38);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(255, 228, 161, 0.5),
      0 0 38px rgba(238, 200, 109, 0.62),
      0 12px 30px rgba(0, 0, 0, 0.38);
  }
}

.peek-toggle svg {
  --icon-size: 15px;
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.target-copy {
  margin: 18px 0 14px;
  padding: 12px;
  border: 1px solid rgba(238, 200, 109, 0.24);
  background: rgba(238, 200, 109, 0.055);
}

.target-copy__icon {
  width: 36px;
  flex-basis: 36px;
  border-color: rgba(238, 200, 109, 0.52);
  font-size: 13px;
}

.target-copy strong {
  font-family: var(--font-display);
  font-size: 13px;
}

.target-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: min(48dvh, 360px);
  padding: 1px;
  overflow: auto;
}

.target-option {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 58px;
  padding: 8px 9px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(12, 26, 38, 0.86);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.target-option:hover {
  border-color: rgba(238, 200, 109, 0.72);
  background: rgba(238, 200, 109, 0.1);
  color: #ffe8ac;
  transform: translateY(-1px);
}

.target-option__index {
  display: grid;
  width: 30px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(94, 223, 212, 0.34);
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 9px;
}

.target-option__copy {
  min-width: 0;
}

.target-option__copy b,
.target-option__copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-option__copy b {
  font-size: 11px;
}

.target-option__copy small {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 7px;
}

.target-option__arrow {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 15px;
}

.target-modal__hint {
  margin: 13px 0 0;
  color: var(--text-dim);
  font-size: 8px;
}

.target-panel.is-peeking .target-modal__backdrop {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.target-panel.is-peeking .target-modal__card {
  width: auto;
  height: 0;
  padding: 0;
  overflow: visible;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.target-panel.is-peeking .target-modal__header > div,
.target-panel.is-peeking .target-copy,
.target-panel.is-peeking .target-options,
.target-panel.is-peeking .target-modal__hint {
  visibility: hidden;
  opacity: 0;
}

.target-panel.is-peeking .peek-toggle {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.has-target-peek .command-deck {
  opacity: 0.48;
}

.has-target-peek .player-panel.is-targetable {
  outline: 2px solid rgba(255, 227, 153, 0.8);
  outline-offset: 2px;
  background-color: rgba(72, 55, 20, 0.35);
  box-shadow: 0 0 0 4px rgba(238, 200, 109, 0.08), 0 0 34px rgba(238, 200, 109, 0.34);
  transform: translateY(-4px) scale(1.012);
}

/* Setup: per-player local AI switch. */
.name-field {
  grid-template-columns: 32px minmax(0, 1fr) auto;
}

.name-field.is-ai {
  border-color: rgba(182, 155, 255, 0.48);
  background: rgba(125, 99, 190, 0.1);
}

.ai-toggle {
  display: inline-flex;
  min-width: 54px;
  min-height: 30px;
  padding: 0 7px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(9, 18, 27, 0.72);
  color: var(--text-dim);
  font-size: 8px;
  cursor: pointer;
}

.ai-toggle:hover {
  border-color: rgba(182, 155, 255, 0.6);
  color: #d4c8ff;
}

.ai-toggle.is-active {
  border-color: rgba(182, 155, 255, 0.82);
  background: linear-gradient(135deg, rgba(182, 155, 255, 0.23), rgba(94, 223, 212, 0.08));
  color: #e7e0ff;
}

.ai-toggle svg {
  --icon-size: 12px;
  width: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

@keyframes latestCardPulse {
  0%, 100% { transform: translateY(-3px) scale(1.035); }
  50% { transform: translateY(-5px) scale(1.075); }
}

@keyframes bustCardIn {
  0% { opacity: 0; transform: translateY(-34px) rotate(-13deg) scale(0.62); }
  58% { opacity: 1; transform: translateY(5px) rotate(5deg) scale(1.13); }
  76% { transform: translateY(-2px) rotate(-3deg) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}

@keyframes bustBadge {
  0% { opacity: 0; transform: scale(1.7) rotate(-7deg); }
  42% { opacity: 1; transform: scale(0.92) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes bustPanel {
  0%, 100% { filter: none; transform: translateX(0); }
  12% { filter: brightness(1.7) saturate(1.4); transform: translateX(-7px); }
  24% { transform: translateX(7px); }
  38% { transform: translateX(-5px); }
  52% { transform: translateX(4px); }
  68% { transform: translateX(-2px); }
}

@keyframes freezeState {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.8) saturate(0.7); box-shadow: 0 0 48px rgba(150, 232, 255, 0.55); }
  100% { filter: brightness(1); }
}

@keyframes lockPulse {
  0% { filter: brightness(1); }
  38% { filter: brightness(1.55); box-shadow: 0 0 42px rgba(238, 200, 109, 0.38); }
  100% { filter: brightness(1); }
}

@keyframes targetModalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 860px) {
  .deck-stage {
    min-height: 0;
  }

  .target-modal__card {
    width: min(94vw, 590px);
    max-height: 86dvh;
    padding: 16px;
  }

  .target-modal__header {
    padding-right: 0;
  }

  .peek-toggle {
    top: 72px;
    right: 12px;
  }

  .target-options {
    grid-template-columns: 1fr;
    max-height: 52dvh;
  }
}

@media (max-width: 560px) {
  .number-card__value {
    font-size: 31px;
  }

  .number-card__axis {
    width: 37px;
  }

  .action-card__icon {
    top: 9px;
    width: 20px;
  }

  .action-card__icon svg {
    --icon-size: 12px;
    width: 12px;
  }

  .action-card__title {
    font-size: 8px;
  }

  .action-card__title--small {
    font-size: 5.8px;
  }

  .action-card__hint,
  .modifier-card__caption,
  .number-card__caption {
    font-size: 4px;
  }

  .modifier-card__value {
    font-size: 22px;
  }

  /* Status sits in flow on phones, so the rail keeps its normal padding. */
  .player-panel[data-status="busted"] .card-rail,
  .player-panel[data-status="frozen"] .card-rail,
  .player-panel[data-status="stayed"] .card-rail {
    padding-right: 2px;
  }

  .status-effect {
    position: static;
    margin-top: 8px;
    width: 100%;
    justify-content: flex-start;
    min-width: 0;
    padding: 4px 5px;
  }

  .status-effect__icon {
    width: 19px;
    flex-basis: 19px;
  }

  .status-effect small {
    display: none;
  }

  .target-modal__header h3 {
    font-size: 18px;
  }

  .name-field {
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }

  .ai-toggle {
    min-width: 48px;
  }
}
