/* Raid — game.css
   theme.css supplies the design tokens (--bg, --surface-1, --accent,
   etc.) — same base every other game here uses. Header/room-pill/
   player-rail/confirm-dialog/toast below are Reporter's own patterns,
   reused near-verbatim since Raid is architecturally the same shape
   (room-based rounds, not a seats-around-a-table casino layout like
   poker/blackjack/31/4pointpitch) — everything from the pile board down
   is new, specific to Raid's own mechanic. */

.game-subtitle {
  text-align: center;
  color: var(--text-mid);
  font-size: 0.9rem;
  margin: -1.25rem 0 1.5rem;
}

/* --raid-up/--raid-up-deep (green) are also used elsewhere for
   unrelated "win" indicators (turn highlight, scoreboard/dashboard
   outcome tags) — kept as-is. --raid-down is new: black for the Lower
   guess button below, replacing the old red. Higher now reuses the
   shared --accent/--on-accent tokens directly instead of --raid-up, so
   this pairing is scoped the same way its predecessor was, since no
   other game needs an up/down guess button pairing. */
:root {
  --raid-up: #3FA34D;
  --raid-up-deep: #2F7D3A;
  --raid-down: #1C1C1C;
  --raid-down-deep: #2E2E2E;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.game-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
/* Settings+Share sit together as one right-aligned group rather than
   being spread apart by justify-content: space-between. See the
   identical comment in every other card game's game.css. */
.game-header .tbl-icon-row { margin-left: auto; }
/* Leave link — same bordered-chip look as every other card game's
   Leave button (.tbl-header-back in the shared table-header.css),
   using Raid's own --border/--text-mid/--accent/--text tokens since
   Raid keeps its own self-contained copy of the design tokens rather
   than depending on games.lightlol.com/shared cross-origin (see this
   game's theme.css header comment). Replaces the old plain-text
   .back-home-link this button used to carry (that class, and the
   scoped .game-header override that actually styled it, have both
   been removed — the join screen's own separate fixed pill-shaped
   back link in theme.css is untouched and still called that). */
.tbl-header-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-mid);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.tbl-header-back:hover { border-color: var(--accent); color: var(--text); }
.tbl-header-back .tbl-icon { width: 16px; height: 16px; }
.room-code-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-mid);
}
/* Was --accent-hover (yellow) text directly on this pill's surface
   color — fine against the dark theme's own surface, but yellow-on-
   near-white in light mode (the actual default before the dark-theme
   wiring fix above existed) was nearly unreadable. A solid badge
   guarantees good contrast regardless of which theme is active or
   which surface color it happens to sit on, since the badge carries
   its own fixed background+text pairing rather than depending on the
   surrounding page. */
.room-code-pill span {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.2rem;
}
/* Header icon buttons (.tbl-icon-btn/.tbl-icon/.tbl-icon-row) now come
   from the shared games.lightlol.com/shared/table-header.css, same as
   every other card game — the local copy that used to live here is gone. */

/* ── Player rail ────────────────────────────────────────────────────── */
.player-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.player-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem 0.3rem 0.4rem;
  font-size: 0.8rem;
  color: var(--text-mid);
}
.player-chip.is-me { border-color: var(--accent); color: var(--text); }
.player-chip.is-disconnected { opacity: 0.4; }
.player-chip.is-turn { border-color: var(--raid-up); box-shadow: 0 0 0 2px rgba(63, 163, 77, 0.25); }
.player-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.player-name { font-weight: 600; }

/* ── Main round area ────────────────────────────────────────────────── */
#main-area {
  display: flex;
  justify-content: center;
  padding: 1.5rem 1rem 3rem;
}
.round-panel {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.status-line {
  color: var(--text-mid);
  font-size: 0.95rem;
  text-align: center;
}
.turn-banner {
  width: 100%;
  text-align: center;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}
.turn-banner.is-me {
  background: rgba(63, 163, 77, 0.1);
  border-color: var(--raid-up);
  color: var(--raid-up-deep);
}
.turn-stuck-note {
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-mid);
  margin-top: -0.6rem;
}
.stock-counter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-mid);
  font-weight: 600;
}
.stock-counter strong { color: var(--text); }

/* ── Lobby / mode select ────────────────────────────────────────────── */
.lobby-card { max-width: 560px; }
/* This used to reuse theme.css's .auth-form wrapper purely for its
   "stack children with a gap" layout. The trouble: theme.css also has
   `.auth-form button:not(.icon-btn):hover { background: var(--accent-hover) }`
   — a rule meant for a plain login/register submit button — and that
   selector's specificity (a class + a :not(class) + a pseudo-class,
   plus the `button` element itself) is high enough to beat
   `.mode-option`'s own styling below. Any button in there — including
   these mode cards — got painted solid yellow on hover/tap, which
   swallowed the `.selected` state's own (more subtle) yellow ring
   entirely. On touch devices that "hover" sticks after a tap instead of
   clearing right away, so every option a person had tapped stayed lit
   up yellow — several yellow buttons at once, indistinguishable from
   each other, with no visible sign of which one was actually selected.
   Renamed wrapper + this rule below reproduces the same layout with no
   shared selector to fight over. */
.lobby-controls { display: flex; flex-direction: column; gap: 1.1rem; }
.mode-select {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}
.mode-option {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: left;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--text);
}
.mode-option.selected { border-color: var(--accent); background: var(--surface-1); box-shadow: 0 0 0 2px rgba(255, 228, 56, 0.35); }
.mode-option-title { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; }
.mode-option-desc { font-size: 0.8rem; color: var(--text-mid); line-height: 1.4; }
.mode-preview {
  text-align: center;
  color: var(--text-mid);
  font-size: 0.85rem;
}

/* ── The board — 8 piles ────────────────────────────────────────────── */
.raid-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
  width: 100%;
}
@media (min-width: 520px) {
  .raid-board { grid-template-columns: repeat(4, 1fr); gap: 0.9rem; }
}
.raid-pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.raid-card {
  width: 100%;
  aspect-ratio: 2 / 3;
  max-width: 90px;
  background: #f4f1ea;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(16px, 5vw, 22px);
  color: #1a1a1a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.raid-card.red { color: var(--danger); }
.raid-card .raid-card-suit { font-size: 1.1em; line-height: 1; margin-top: -2px; }
.raid-pile.alive .raid-card { cursor: pointer; }
.raid-pile.alive .raid-card:active { transform: scale(0.94); }
.raid-pile.is-tappable .raid-card:hover { box-shadow: 0 0 0 3px rgba(255, 228, 56, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3); }
/* "Nautical" — the DEFAULT back — spelled out explicitly. Every game used
   to leave the default as its own unqualified face-down rule (yellow
   stripes here, grey in 5 Crowns, navy in poker), so the picker's
   Nautical swatch never matched what the cards actually drew, in any
   game. shared/table-theme.js always writes a valid id to
   [data-deck-style], so this rule is what a fresh visitor sees. */
[data-deck-style="nautical"] .raid-card.face-down {
  background: radial-gradient(circle at 50% 42%, #234b6e 0%, #0f2438 100%);
  border: 1px solid #3f6f99;
  color: #ffd700; font-size: 18px;
}
[data-deck-style="nautical"] .raid-card.face-down::after { content: '✦'; }
[data-deck-style="emerald"] .raid-card.face-down {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.08) 0, rgba(255,255,255,0.08) 3px, transparent 3px, transparent 14px),
    linear-gradient(160deg, #0f4a3a, #06261e);
  border: 1px solid #c9a227;
  color: #c9a227; font-size: 18px;
}
[data-deck-style="emerald"] .raid-card.face-down::after { content: '✦'; }
[data-deck-style="geo"] .raid-card.face-down {
  background-color: #101114;
  background-image:
    linear-gradient(135deg, #1c1e24 25%, transparent 25%),
    linear-gradient(225deg, #1c1e24 25%, transparent 25%),
    linear-gradient(45deg, #1c1e24 25%, transparent 25%),
    linear-gradient(315deg, #1c1e24 25%, transparent 25%);
  background-position: 0 0, 8px 0, 8px -8px, 0 8px;
  background-size: 16px 16px;
  border-color: #565b66;
  color: #9aa4b8; font-size: 18px;
}
[data-deck-style="geo"] .raid-card.face-down::after { content: '◇'; }
[data-deck-style="sunset"] .raid-card.face-down {
  background: radial-gradient(circle at 50% 60%, #ffb35c 0%, #e8586b 45%, #5a2a6e 100%);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff4dc; font-size: 18px;
}
[data-deck-style="sunset"] .raid-card.face-down::after { content: '●'; }
[data-deck-style="deco"] .raid-card.face-down {
  background-color: #17140f;
  background-image: repeating-conic-gradient(from 0deg at 50% 120%, #17140f 0deg 8deg, #8a5a2a 8deg 10deg);
  border: 2px solid #b9812f;
  color: #e2b45a; font-size: 18px;
}
[data-deck-style="deco"] .raid-card.face-down::after { content: '▲'; }
[data-deck-style="frost"] .raid-card.face-down {
  background:
    repeating-linear-gradient(60deg, rgba(255,255,255,0.5) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(-60deg, rgba(255,255,255,0.5) 0 1px, transparent 1px 10px),
    linear-gradient(160deg, #cfe8f5, #8fb9d6);
  border: 1px solid #ffffff;
  color: #ffffff; font-size: 18px;
}
[data-deck-style="frost"] .raid-card.face-down::after { content: '❄'; }
[data-deck-style="velvet"] .raid-card.face-down {
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.25) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,0.25) 0 1px, transparent 1px 10px),
    radial-gradient(circle at 50% 45%, #8a1a2a, #4a0d16);
  border: 1px solid #d4af37;
  color: #d4af37; font-size: 18px;
}
[data-deck-style="velvet"] .raid-card.face-down::after { content: '◆'; }
[data-deck-style="slate"] .raid-card.face-down {
  background: linear-gradient(160deg, #2b2f36, #16181c);
  border-color: #4a4f58;
  color: #c7a55a; font-family: Georgia, serif; font-weight: bold; font-size: 18px;
}
[data-deck-style="slate"] .raid-card.face-down::after { content: 'L'; }
[data-deck-style="camo"] .raid-card.face-down {
  background-color: #24361f;
  background-image:
    radial-gradient(ellipse 14px 9px at 20% 30%, #3c5230 40%, transparent 41%),
    radial-gradient(ellipse 17px 10px at 75% 20%, #17240f 40%, transparent 41%),
    radial-gradient(ellipse 15px 10px at 30% 75%, #17240f 40%, transparent 41%),
    radial-gradient(ellipse 18px 12px at 80% 70%, #3c5230 40%, transparent 41%);
  border-color: rgba(0, 0, 0, 0.3);
  color: #d8d8b0; font-size: 18px;
}
[data-deck-style="camo"] .raid-card.face-down::after { content: '★'; }
.raid-card.face-down {
  background: repeating-linear-gradient(45deg, var(--accent) 0, var(--accent) 5px, #b9791f 5px, #b9791f 10px);
  border: 1px solid rgba(0, 0, 0, 0.35);
  color: transparent;
}
.raid-pile-index {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.raid-pile.dead .raid-pile-index { opacity: 0.4; }

/* ── Higher/Lower guess prompt ──────────────────────────────────────── */
.guess-prompt-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.guess-prompt-overlay.show { display: flex; }
.guess-prompt-box {
  width: 100%;
  max-width: 300px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.guess-prompt-box .raid-card { width: 90px; }
.guess-prompt-label { font-size: 0.85rem; color: var(--text-mid); }
.guess-prompt-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}
.guess-btn {
  flex: 1;
  padding: 14px 8px;
  border-radius: 10px;
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.guess-btn .arrow { font-size: 1.3rem; line-height: 1; }
.guess-btn.lower { background: var(--raid-down); }
.guess-btn.lower:hover { background: var(--raid-down-deep); }
.guess-btn.higher { background: var(--accent); color: var(--on-accent); }
.guess-btn.higher:hover { background: var(--accent-hover); }
.guess-prompt-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px;
}

/* ── In-place guess reveal — plays right on the pile that was just
   guessed instead of a separate popup elsewhere on screen. See
   playPileReveal() in game.html: the drawn card gets dealt in on top of
   whatever render() already settled the pile into, holds a beat, then
   either confirms in place (correct — it already IS the pile's new
   card) or slips away to reveal the face-down back underneath (wrong).
   ────────────────────────────────────────────────────────────────── */
@keyframes raid-deal-in {
  from { transform: translateY(-16px) scale(0.85); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.raid-card.dealing-in {
  animation: raid-deal-in 0.2s ease-out;
}
@keyframes raid-confirm-glow {
  0%, 100% { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(63, 163, 77, 0.55), 0 2px 4px rgba(0, 0, 0, 0.3); }
}
.raid-card.confirm-correct {
  animation: raid-confirm-glow 0.2s ease-in-out;
}
.raid-card.slip-away {
  transition: transform 0.25s ease-in, opacity 0.25s ease-in;
  transform: translateX(28px) translateY(8px) rotate(12deg);
  opacity: 0;
}

/* ── Score badges (shared across all three modes) ───────────────────
   Was plain yellow text (var(--accent-hover)) directly on the page's own
   background in the Hot Seat tally — legible enough against this game's
   own dark-leaning surfaces, but "just colored text" is exactly the kind
   of thing that reads poorly the moment it sits on a lighter surface or
   a different theme (same root problem the room-code pill up in the
   header already ran into — see its own comment). A solid badge fixes
   that the same way: its own background+text pairing is guaranteed
   legible regardless of what it's sitting on, so the score doesn't
   quietly depend on staying on exactly this one surface forever. Reused
   everywhere a single number is the actual thing you're looking for
   at a glance — Hot Seat's live tally, Parallel's live "piles still
   alive" count, and every mode's own key number on the Results screen —
   so scores read the same way no matter which mode produced them. */
.stat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7em;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 0.85em;
  line-height: 1.5;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
}

/* ── Dashboard (Parallel) ───────────────────────────────────────────── */
.dashboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dashboard-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
}
.dashboard-row.is-me { border-color: var(--accent); }
.dashboard-row .player-name { flex: 1; }
.dashboard-piles { color: var(--text-mid); }
.dashboard-stock { color: var(--text-mid); min-width: 70px; text-align: right; }
.dashboard-outcome {
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  min-width: 54px;
  text-align: center;
}
.dashboard-outcome.win { background: rgba(63, 163, 77, 0.15); color: var(--raid-up-deep); }
.dashboard-outcome.loss { background: rgba(209, 69, 58, 0.12); color: var(--danger-deep); }
.dashboard-outcome.playing { background: var(--surface-2); color: var(--text-muted); }

/* ── Tally list (Hot Seat) ──────────────────────────────────────────── */
.tally-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.tally-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-mid);
}
.tally-row .player-name { flex: 1; color: var(--text); }

/* ── Results screen (all three modes end here) ─────────────────────── */
.scoreboard { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.scoreboard-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
}
.scoreboard-row.is-winner { border: 1px solid var(--accent); }
.scoreboard-rank { width: 1.5rem; color: var(--text-muted); font-weight: 700; }
.scoreboard-name { flex: 1; font-weight: 600; }
.scoreboard-detail { font-size: 0.8rem; color: var(--text-mid); }
.scoreboard-outcome-tag {
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.scoreboard-outcome-tag.win { background: rgba(63, 163, 77, 0.15); color: var(--raid-up-deep); }
.scoreboard-outcome-tag.loss { background: rgba(209, 69, 58, 0.12); color: var(--danger-deep); }

/* ── Buttons (shared look for all primary actions) ─────────────────── */
.raid-btn {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.4rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.raid-btn:hover:not(:disabled) { background: var(--accent-hover); }
.raid-btn:active:not(:disabled) { transform: scale(0.98); }
.raid-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Confirm dialogs — Leave Game / End Game for Everyone. Ported
   verbatim from Reporter's own version. ──────────────────────────────── */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 600;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.confirm-overlay.show { display: flex; }
.confirm-box {
  width: 100%;
  max-width: 340px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.confirm-title {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 18px;
  margin: 0 0 10px;
}
.confirm-body {
  color: var(--text-mid);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 24px;
}
.confirm-actions { display: flex; gap: 10px; }
.confirm-btn {
  flex: 1;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.confirm-btn.cancel { background: var(--surface-2); color: var(--text-mid); }
.confirm-btn.danger { background: var(--danger); color: #fff; }
.confirm-btn.danger:hover { background: var(--danger-deep); }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 420px) {
  .raid-card { font-size: clamp(14px, 4.5vw, 18px); }
}
