:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, sans-serif;
  --color-red: #d23a3a;
  --color-yellow: #d6b51b;
  --color-green: #2f9648;
  --color-blue: #2b6ad1;
  --color-white: #e8e8e8;
  --color-rainbow: linear-gradient(135deg, #d23a3a, #d6b51b, #2f9648, #2b6ad1, #b14de0);
  --color-black: #2c2c2c;
  --card-text-light: #fff;
  --card-text-dark: #111;
  --border: rgba(127, 127, 127, 0.4);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

header h1 {
  margin: 0;
  font-size: 1.05rem;
}

#me {
  flex: 1;
  font-size: 0.85rem;
  opacity: 0.8;
}
#me button {
  padding: 0 0.4rem;
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

#size-controls {
  display: flex;
  gap: 2px;
}
#size-controls button {
  padding: 0 0.4rem;
  font-size: 0.75rem;
  line-height: 1.5;
  min-width: 30px;
}
#size-controls button.active {
  background: rgba(43, 106, 209, 0.25);
  border-color: rgba(43, 106, 209, 0.6);
}

#status {
  font-size: 0.8rem;
  opacity: 0.6;
}

main {
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.screen { display: grid; gap: 1rem; }

form, fieldset {
  display: grid;
  gap: 0.5rem;
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: 6px;
}

label { display: grid; gap: 0.25rem; font-size: 0.9rem; }
label.checkbox { display: flex; gap: 0.5rem; align-items: center; }

button {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
}
button:hover:not(:disabled) { background: rgba(127,127,127,0.1); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

input, select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  border-radius: 4px;
  font: inherit;
}

.game-toprow {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.game-toprow #game-meta { flex: 1; }
.game-toprow #undo-button {
  align-self: stretch;
  padding: 0.4rem 1rem;
  font-weight: 600;
  border-color: #2b6ad1;
  color: #2b6ad1;
}
.game-toprow #undo-button:hover { background: rgba(43, 106, 209, 0.1); }

#game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

#game-meta .meta-item strong { display: block; opacity: 0.7; font-weight: normal; font-size: 0.75rem; text-transform: uppercase; }
#game-meta .meta-toggle { cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; }
#game-meta .meta-toggle input { margin: 0; }

.board-row {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

#game-piles {
  flex: 1;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  padding: 0.5rem 0;
}

#latest-action {
  flex: 0 0 240px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
}
#latest-action h3 { margin: 0; font-size: 0.8rem; opacity: 0.7; font-weight: normal; text-transform: uppercase; }
#latest-action .latest-empty { opacity: 0.6; font-style: italic; }
#latest-action .latest-body { display: flex; flex-direction: column; gap: 0.55rem; }
#latest-action .latest-line { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
#latest-action .latest-highlight {
  background: #d6b51b;
  color: #111;
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  font-weight: bold;
  font-size: 0.8rem;
  align-self: flex-start;
}

.card-symbol {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 36px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: bold;
}

.latest-hint-chip {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: bold;
  color: #fff;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.latest-hint-chip.number { background: #555; }
.latest-hint-chip.color[data-color="red"]     { background: var(--color-red); }
.latest-hint-chip.color[data-color="yellow"]  { background: var(--color-yellow); color: var(--card-text-dark); }
.latest-hint-chip.color[data-color="green"]   { background: var(--color-green); }
.latest-hint-chip.color[data-color="blue"]    { background: var(--color-blue); }
.latest-hint-chip.color[data-color="white"]   { background: var(--color-white); color: var(--card-text-dark); }
.latest-hint-chip.color[data-color="rainbow"] { background: var(--color-rainbow); }
.latest-hint-chip.color[data-color="black"]   { background: var(--color-black); box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(0, 0, 0, 0.5); }

.action-bubble {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  background: #d6b51b;
  color: #111;
  border-radius: 99px;
  font-weight: bold;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.meta-timer #game-timer {
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.tokens-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.fuse-tokens {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.04);
}

.fuse-token {
  width: 22px;
  height: 22px;
  border-radius: 99px;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 35%),
    radial-gradient(circle at 65% 70%, #b13d20 0%, #d96340 45%, #f29671 100%);
  box-shadow:
    inset 0 -2px 4px rgba(0, 0, 0, 0.25),
    0 1px 2px rgba(0, 0, 0, 0.35);
  position: relative;
}

.fuse-token::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background:
    linear-gradient(45deg, transparent 46%, rgba(255, 255, 255, 0.55) 49%, rgba(255, 255, 255, 0.55) 51%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, rgba(255, 255, 255, 0.55) 49%, rgba(255, 255, 255, 0.55) 51%, transparent 54%);
  mask: radial-gradient(circle, #000 0%, #000 28%, transparent 32%);
  -webkit-mask: radial-gradient(circle, #000 0%, #000 28%, transparent 32%);
  opacity: 0.85;
}

.fuse-token.empty {
  background: transparent;
  border: 1px dashed rgba(127, 127, 127, 0.45);
  box-shadow: none;
}
.fuse-token.empty::after { display: none; }

.hint-tokens {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.04);
}

.hint-token {
  width: 22px;
  height: 22px;
  border-radius: 99px;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 35%),
    radial-gradient(circle at 65% 70%, #1e4fa3 0%, #3d82e0 45%, #79b1f5 100%);
  box-shadow:
    inset 0 -2px 4px rgba(0, 0, 0, 0.25),
    0 1px 2px rgba(0, 0, 0, 0.35);
  position: relative;
}

.hint-token::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background:
    linear-gradient(45deg, transparent 46%, rgba(255, 255, 255, 0.55) 49%, rgba(255, 255, 255, 0.55) 51%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, rgba(255, 255, 255, 0.55) 49%, rgba(255, 255, 255, 0.55) 51%, transparent 54%);
  mask: radial-gradient(circle, #000 0%, #000 28%, transparent 32%);
  -webkit-mask: radial-gradient(circle, #000 0%, #000 28%, transparent 32%);
  opacity: 0.85;
}

.hint-token.empty {
  background: transparent;
  border: 1px dashed rgba(127, 127, 127, 0.45);
  box-shadow: none;
}
.hint-token.empty::after { display: none; }

.pile-group {
  display: flex;
  gap: 1rem;
  /* auto margins inside a flex parent absorb leftover space evenly on both
     sides, centering the pile group between the tokens box and the
     latest-action panel. */
  margin: 0 auto;
}

.pile-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 80px;
}

.pile {
  width: 60px;
  height: 90px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  display: grid;
  place-items: center;
  position: relative;
  font-weight: bold;
  font-size: 1.4rem;
}

.discard-summary {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  justify-content: center;
  min-height: 22px;
  align-items: center;
}

.discard-summary .num {
  width: 14px;
  height: 20px;
  border-radius: 3px;
  background: rgba(127, 127, 127, 0.18);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

.pile[data-direction="down"]::after {
  content: '↓';
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.7rem;
  opacity: 0.7;
}

/* A pile is "done" when its count reached its cap — either a perfect 5 or
   capped lower by critical discards. A diagonal mesh sits over the pile so
   the top card stays readable underneath. */
.pile.done::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    repeating-linear-gradient(45deg,
      rgba(255, 255, 255, 0.35) 0 2px,
      transparent 2px 7px),
    repeating-linear-gradient(-45deg,
      rgba(0, 0, 0, 0.25) 0 2px,
      transparent 2px 7px);
  pointer-events: none;
}
.pile.done {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45) inset, 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.pile[data-color="red"]    { background: var(--color-red); color: var(--card-text-light); }
.pile[data-color="yellow"] { background: var(--color-yellow); color: var(--card-text-dark); }
.pile[data-color="green"]  { background: var(--color-green); color: var(--card-text-light); }
.pile[data-color="blue"]   { background: var(--color-blue); color: var(--card-text-light); }
.pile[data-color="white"]  { background: var(--color-white); color: var(--card-text-dark); }
.pile[data-color="rainbow"]{ background: var(--color-rainbow); color: var(--card-text-light); }
.pile[data-color="black"]  { background: var(--color-black); color: var(--card-text-light); }

#game-hands {
  display: grid;
  gap: 0.75rem;
}

/* 2 players: a single vertical column, but cap each row to roughly six card
   widths so the turn / notable bubbles in the header sit near the cards
   instead of out at the right edge of the page. */
#game-hands[data-count="2"] { grid-template-areas: "p0" "p1"; }
#game-hands[data-count="2"] .player-row {
  width: 100%;
  max-width: 660px;
  justify-self: start;
}

/* 3+ players use a 2-column grid; player rows below shrink to fit their cards
   (instead of stretching across the page) so the border hugs the hand. */
#game-hands[data-count="3"] {
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "p0 p1"
    "p2 p2";
}
#game-hands[data-count="4"] {
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "p0 p1"
    "p3 p2";
}
#game-hands[data-count="5"] {
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "p0 p1"
    "p4 p2"
    "p3 p3";
}

#game-hands:not([data-count="2"]) .player-row { width: fit-content; }

#game-hands[data-count="3"] .player-row[data-seat="0"] { grid-area: p0; justify-self: start; }
#game-hands[data-count="3"] .player-row[data-seat="1"] { grid-area: p1; justify-self: end; }
#game-hands[data-count="3"] .player-row[data-seat="2"] { grid-area: p2; justify-self: center; }

#game-hands[data-count="4"] .player-row[data-seat="0"] { grid-area: p0; justify-self: start; }
#game-hands[data-count="4"] .player-row[data-seat="1"] { grid-area: p1; justify-self: end; }
#game-hands[data-count="4"] .player-row[data-seat="2"] { grid-area: p2; justify-self: end; }
#game-hands[data-count="4"] .player-row[data-seat="3"] { grid-area: p3; justify-self: start; }

#game-hands[data-count="5"] .player-row[data-seat="0"] { grid-area: p0; justify-self: start; }
#game-hands[data-count="5"] .player-row[data-seat="1"] { grid-area: p1; justify-self: end; }
#game-hands[data-count="5"] .player-row[data-seat="2"] { grid-area: p2; justify-self: end; }
#game-hands[data-count="5"] .player-row[data-seat="3"] { grid-area: p3; justify-self: center; }
#game-hands[data-count="5"] .player-row[data-seat="4"] { grid-area: p4; justify-self: start; }

.player-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}

#import-deck-row { display: grid; gap: 0.25rem; }
#import-deck-row .import-label { gap: 0.35rem; }
#import-deck-status {
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  background: rgba(43, 106, 209, 0.12);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
#import-deck-status button { padding: 0.15rem 0.5rem; font-size: 0.8rem; }

.lobby-player {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0;
}
.lobby-player button {
  padding: 0 0.4rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.player-row.active { border-color: #2b6ad1; box-shadow: 0 0 0 2px rgba(43,106,209,0.25); }
.player-row header { padding: 0; border: 0; display: flex; gap: 0.5rem; align-items: center; }
.player-row .player-name { font-weight: bold; }
.player-row .offline { opacity: 0.5; font-size: 0.8rem; }
.player-row .turn-marker { font-size: 0.75rem; padding: 0.1rem 0.4rem; background: #2b6ad1; color: white; border-radius: 99px; }

.hand {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.card {
  width: 96px;
  min-height: 144px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
  background: rgba(127,127,127,0.06);
  background-size: cover;
  background-position: center;
}

.card .card-face {
  flex: 1;
  display: grid;
  place-items: center;
  border-radius: 4px;
  font-size: 1.8rem;
  font-weight: bold;
}
.card[data-color="red"]    .card-face { background: var(--color-red); color: var(--card-text-light); }
.card[data-color="yellow"] .card-face { background: var(--color-yellow); color: var(--card-text-dark); }
.card[data-color="green"]  .card-face { background: var(--color-green); color: var(--card-text-light); }
.card[data-color="blue"]   .card-face { background: var(--color-blue); color: var(--card-text-light); }
.card[data-color="white"]  .card-face { background: var(--color-white); color: var(--card-text-dark); }
.card[data-color="rainbow"].card .card-face { background: var(--color-rainbow); color: var(--card-text-light); }
.card[data-color="black"]  .card-face { background: var(--color-black); color: var(--card-text-light); }
.card.face-down:not(.art) .card-face {
  background: repeating-linear-gradient(45deg, #444, #444 6px, #555 6px, #555 12px);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
.card.face-down.art .card-face { background: transparent; }

.card.clued {
  border: 2px solid #f0f0f0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.latest-hint {
  position: absolute;
  top: -8px;
  left: 50%;
  --hint-offset: 0;
  /* Newest sits centered; each older mark shifts 15px further right (about
     five-sixths of the 18px disk width — enough to read all four, with the
     newer one clearly on top). */
  transform: translateX(calc(-50% + var(--hint-offset) * 15px));
  width: 18px;
  height: 18px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  z-index: 2;
}
.latest-hint.number { background: #555; }
.latest-hint.color[data-color="red"]     { background: var(--color-red); }
.latest-hint.color[data-color="yellow"]  { background: var(--color-yellow); }
.latest-hint.color[data-color="green"]   { background: var(--color-green); }
.latest-hint.color[data-color="blue"]    { background: var(--color-blue); }
.latest-hint.color[data-color="white"]   { background: var(--color-white); }
.latest-hint.color[data-color="rainbow"] { background: var(--color-rainbow); }
.latest-hint.color[data-color="black"]   { background: var(--color-black); box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(0, 0, 0, 0.5); }

.possible {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 14px;
}
.possible .swatch {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  border: 1px solid rgba(127,127,127,0.3);
}
.possible .num {
  font-size: 9px;
  padding: 0 3px;
  border: 1px solid rgba(127,127,127,0.3);
  border-radius: 3px;
  line-height: 1.2;
}
.guard-dot {
  position: absolute;
  top: -6px;
  left: 6px;
  width: 14px;
  height: 14px;
  border-radius: 99px;
  background: #d23a3a;
  color: #fff;
  font-size: 0.6rem;
  font-weight: bold;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  z-index: 2;
}
.guard-dot::after { content: 'G'; }

.no-info {
  font-size: 0.65rem;
  font-style: italic;
  text-align: center;
  color: rgba(127, 127, 127, 0.65);
  letter-spacing: 0.05em;
  min-height: 14px;
  padding: 1px 0;
}

/* When card art is on, the underlying image swamps the small UI bits at the
   bottom — give them an opaque black sheet that bleeds slightly past the
   card padding so the swatches/numbers/note read cleanly. */
.card.art .possible,
.card.art .no-info,
.card.art .card-note {
  background: #111;
  border-radius: 4px;
  padding: 4px 6px;
  margin-left: -0.35rem;
  margin-right: -0.35rem;
}
.card.art .possible:last-child,
.card.art .no-info:last-child,
.card.art .card-note:last-child {
  margin-bottom: -0.35rem;
  padding-bottom: 8px;
  border-radius: 0 0 6px 6px;
}
.card.art .possible .num,
.card.art .no-info,
.card.art .card-note {
  color: rgba(255, 255, 255, 0.96);
}
.card.art .possible .num {
  border-color: rgba(255, 255, 255, 0.45);
}

.swatch[data-color="red"]    { background: var(--color-red); }
.swatch[data-color="yellow"] { background: var(--color-yellow); }
.swatch[data-color="green"]  { background: var(--color-green); }
.swatch[data-color="blue"]   { background: var(--color-blue); }
.swatch[data-color="white"]  { background: var(--color-white); }
.swatch[data-color="rainbow"]{ background: var(--color-rainbow); }
.swatch[data-color="black"]  { background: var(--color-black); box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(0,0,0,0.5); border-color: transparent; }

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.card-actions .row {
  display: flex;
  gap: 3px;
}
.card-actions button {
  flex: 1;
  font-size: 0.72rem;
  padding: 2px 4px;
  min-width: 0;
}
.card-actions .row .edit-btn {
  flex: 0 0 auto;
  width: 24px;
}

.card-note {
  font-size: 0.7rem;
  font-style: italic;
  opacity: 0.8;
  word-break: break-word;
}

.hint-controls {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.hint-controls .chip {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: transparent;
}
.hint-controls .chip.color { color: white; }
.hint-controls .chip[data-color="yellow"], .hint-controls .chip[data-color="white"] { color: var(--card-text-dark); }

#game-log {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}
.log-entry { padding: 0.15rem 0; border-bottom: 1px dotted rgba(127,127,127,0.2); }
.log-entry:last-child { border-bottom: 0; }

#game-discard {
  display: grid;
  gap: 0.25rem;
}
#game-discard h3 { margin: 0; font-size: 0.9rem; }
.discard-pile {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.card.tap-target {
  cursor: pointer;
}
.card.tap-target:hover { box-shadow: 0 0 0 2px rgba(43, 106, 209, 0.45); }

#card-action-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  z-index: 60;
}
#card-action-popover {
  background: Canvas;
  color: CanvasText;
  border-radius: 12px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 240px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
#card-action-popover .popover-title {
  font-weight: bold;
  text-align: center;
  margin-bottom: 0.25rem;
  opacity: 0.75;
}
#card-action-popover .big-action {
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  min-height: 52px;
  border-radius: 8px;
}
#card-action-popover .play    { background: rgba(47, 150, 72, 0.18); border-color: rgba(47, 150, 72, 0.6); }
#card-action-popover .discard { background: rgba(210, 58, 58, 0.18); border-color: rgba(210, 58, 58, 0.6); }
#card-action-popover .annotate { background: rgba(43, 106, 209, 0.18); border-color: rgba(43, 106, 209, 0.6); }
#card-action-popover .cancel { margin-top: 0.35rem; background: transparent; opacity: 0.85; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: grid;
  place-items: center;
  z-index: 10;
}
.modal-body {
  background: Canvas;
  color: CanvasText;
  padding: 1rem;
  border-radius: 8px;
  max-width: 360px;
  width: 90%;
  display: grid;
  gap: 0.75rem;
}
.modal-body h3 { margin: 0; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip-row .toggle {
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: transparent;
  font-size: 0.8rem;
}
.chip-row .toggle.on { background: #2b6ad1; color: white; border-color: #2b6ad1; }

.banner {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: #2b6ad1;
  color: white;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.banner.win { background: #2f9648; }
.banner.loss { background: #d23a3a; }
.banner .banner-text { flex: 1; min-width: 0; }
.banner-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.banner-actions button {
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  border-color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
}
.banner-actions button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.32); }

.game-footer {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card.ghost-leave {
  position: fixed;
  width: 96px;
  min-height: 144px;
  pointer-events: none;
  z-index: 95;
  animation: ghost-leave 1.2s linear forwards;
  transform-origin: 50% 50%;
}
.card.ghost-leave.misplay {
  box-shadow: 0 0 0 2px #d23a3a, 0 4px 12px rgba(0, 0, 0, 0.35);
}
@keyframes ghost-leave {
  0%   { transform: translate(0, 0)     scale(1.00); opacity: 1.00; }
  6%   { transform: translate(0, -7px)  scale(1.03); opacity: 1.00; }
  12%  { transform: translate(0, -14px) scale(1.06); opacity: 1.00; }
  18%  { transform: translate(0, -22px) scale(1.10); opacity: 1.00; }
  24%  { transform: translate(0, -30px) scale(1.14); opacity: 1.00; }
  30%  { transform: translate(0, -38px) scale(1.18); opacity: 1.00; }
  36%  { transform: translate(0, -46px) scale(1.22); opacity: 1.00; }
  42%  { transform: translate(0, -54px) scale(1.26); opacity: 0.96; }
  48%  { transform: translate(0, -62px) scale(1.30); opacity: 0.92; }
  54%  { transform: translate(0, -70px) scale(1.34); opacity: 0.86; }
  60%  { transform: translate(0, -78px) scale(1.38); opacity: 0.78; }
  66%  { transform: translate(0, -85px) scale(1.41); opacity: 0.68; }
  72%  { transform: translate(0, -92px) scale(1.44); opacity: 0.56; }
  78%  { transform: translate(0, -98px) scale(1.46); opacity: 0.42; }
  84%  { transform: translate(0, -103px) scale(1.48); opacity: 0.28; }
  90%  { transform: translate(0, -107px) scale(1.49); opacity: 0.14; }
  100% { transform: translate(0, -110px) scale(1.50); opacity: 0.00; }
}

#fireworks {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 100;
}
#fireworks:empty { display: none; }
.firework-burst {
  position: absolute;
  width: 0;
  height: 0;
}
.firework-particle {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: var(--fw-color, #fff);
  box-shadow: 0 0 16px var(--fw-color, #fff), 0 0 34px var(--fw-color, #fff);
  animation: firework-particle 1.3s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}
@keyframes firework-particle {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 1; }
  20%  { opacity: 1; }
  100% { transform: translate(var(--fw-dx), var(--fw-dy)) scale(0.3); opacity: 0; }
}

#abandon-button.voted {
  border-color: #d23a3a;
  color: #d23a3a;
}
