/* ── Reset & Tokens ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brown-dark:   #3B1F0E;
  --brown-mid:    #7A4020;
  --brown-light:  #C88B50;
  --brown-pale:   #EDD5A8;
  --gold:         #C9A227;
  --gold-light:   #F5D57A;
  --green-felt:   #2D6A4F;
  --green-dark:   #1B4332;
  --danger:       #C0392B;
  --success:      #27AE60;
  --info:         #2980B9;
  --text-light:   #FFF8EE;
  --text-dark:    #1A0D00;
  --shadow-card:  0 6px 24px rgba(0,0,0,0.55);
  --radius-card:  12px;
  --font-game:    'Cinzel', 'Palatino Linotype', serif;
}

body {
  font-family: var(--font-game);
  background: radial-gradient(ellipse at top, #4A2800 0%, #1A0A00 100%);
  min-height: 100vh;
  color: var(--text-light);
  overflow: hidden;
}

/* ── Screens ── */
.screen { display: none; width: 100%; height: 100vh; }
.screen.active { display: flex; align-items: center; justify-content: center; }
.screen.active { animation: fadeUp 0.3s ease; }

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

/* ── Menu Panel ── */
.menu-panel {
  background: linear-gradient(160deg, #2C1505 0%, #1A0A00 100%);
  border: 2px solid var(--brown-light);
  border-radius: 20px;
  padding: 48px 52px;
  min-width: 360px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.06);
  text-align: center;
}

.game-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 3.6rem;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(201,162,39,0.6), 0 2px 4px rgba(0,0,0,0.8);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.game-sub {
  color: var(--brown-pale);
  font-size: 0.95rem;
  margin-bottom: 36px;
  letter-spacing: 0.06em;
  opacity: 0.85;
}

.panel-title {
  font-size: 1.8rem;
  color: var(--gold-light);
  margin-bottom: 28px;
  letter-spacing: 0.05em;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 14px 28px;
  font-family: var(--font-game);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  width: 100%;
}
.btn:hover   { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.btn:active  { transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary   { background: linear-gradient(135deg, #C9A227, #8B6914); color: #1A0A00; }
.btn-secondary { background: linear-gradient(135deg, #6B3A1E, #3D1A08); color: var(--brown-pale); border: 1px solid var(--brown-light); }
.btn-ghost     { background: transparent; color: var(--brown-pale); border: 1px solid rgba(255,255,255,0.2); }
.btn-ghost:hover { background: rgba(255,255,255,0.06); }
.btn-danger    { background: linear-gradient(135deg, #C0392B, #7B241C); color: #fff; }

.btn-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.btn-row   { display: flex; gap: 12px; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.hidden { display: none !important; }

/* ── Inputs ── */
.text-input {
  width: 100%;
  padding: 13px 16px;
  font-family: var(--font-game);
  font-size: 1rem;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(200,139,80,0.4);
  border-radius: 10px;
  color: var(--text-light);
  margin-bottom: 14px;
  transition: border-color 0.2s;
}
.text-input::placeholder { color: rgba(255,255,255,0.3); }
.text-input:focus { outline: none; border-color: var(--gold); }
.code-input { text-transform: uppercase; letter-spacing: 0.2em; font-size: 1.2rem; text-align: center; }

/* ── Difficulty grid ── */
.diff-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.diff-btn {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(200,139,80,0.3);
  border-radius: 14px;
  color: var(--brown-pale);
  padding: 18px 8px;
  cursor: pointer;
  font-family: var(--font-game);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: all 0.2s ease;
}
.diff-btn:hover    { border-color: var(--gold); background: rgba(201,162,39,0.08); }
.diff-btn.selected { border-color: var(--gold); background: rgba(201,162,39,0.16); box-shadow: 0 0 16px rgba(201,162,39,0.3); }
.diff-icon { font-size: 2rem; }
.diff-name { font-size: 0.9rem; font-weight: 600; color: var(--gold-light); letter-spacing: 0.04em; }
.diff-desc { font-size: 0.65rem; color: var(--brown-pale); opacity: 0.75; }

/* ── Lobby ── */
.room-code-box { margin-bottom: 16px; }
.room-code-label { display: block; font-size: 0.7rem; letter-spacing: 0.12em; color: var(--brown-pale); opacity: 0.6; margin-bottom: 4px; text-transform: uppercase; }
.room-code-value { font-family: 'Cinzel Decorative', serif; font-size: 2.4rem; color: var(--gold); letter-spacing: 0.2em; text-shadow: 0 0 20px rgba(201,162,39,0.5); }
.lobby-diff-badge { display: inline-block; background: rgba(201,162,39,0.15); border: 1px solid var(--gold); border-radius: 20px; padding: 4px 14px; font-size: 0.8rem; color: var(--gold-light); margin-bottom: 18px; }
.lobby-players { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.lobby-player { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 10px 16px; font-size: 0.95rem; text-align: left; }
.lobby-host { border-color: var(--gold); background: rgba(201,162,39,0.1); }
.waiting-msg { color: var(--brown-pale); opacity: 0.6; font-size: 0.85rem; font-style: italic; }

/* ════════════════════════════════════════════
   GAME SCREEN
   ════════════════════════════════════════════ */
.screen.game-screen {
  position: fixed;
  inset: 0;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
  background-image: url('/cards/playfield.webp');
  background-size: cover;
  background-position: center;
}

/* ── HUD ── */
.hud {
  height: 58px;
  background: rgba(15, 6, 0, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1.5px solid rgba(201,162,39,0.3);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
}
.hud-left   { display: flex; gap: 8px; align-items: center; flex: 1; }
.hud-center { flex: 1; display: flex; justify-content: center; }
.hud-right  { flex: 1; display: flex; justify-content: flex-end; }

.hud-chip {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 0.75rem;
  color: var(--brown-pale);
  white-space: nowrap;
}
.diff-chip { border-color: rgba(201,162,39,0.3); color: var(--gold-light); }

.turn-banner {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 20px;
  border-radius: 20px;
  white-space: nowrap;
}
.turn-mine  { background: rgba(39,174,96,0.25); color: #6EEB94; border: 1.5px solid #27AE60; box-shadow: 0 0 16px rgba(39,174,96,0.3); }
.turn-other { background: rgba(192,57,43,0.2); color: #F1948A; border: 1.5px solid #C0392B; }

.game-menu-btn { padding: 6px 12px; font-size: 1.1rem; letter-spacing: 0; }

/* ── Game menu dropdown ── */
.game-menu-dropdown {
  position: absolute;
  top: 58px;
  left: 0;
  background: rgba(10, 4, 0, 0.97);
  border: 1.5px solid rgba(201,162,39,0.3);
  border-top: none;
  border-radius: 0 0 14px 0;
  min-width: 230px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 4px 4px 24px rgba(0,0,0,0.7);
  animation: fadeIn 0.15s ease;
}
.game-menu-dropdown.hidden { display: none; }

.menu-item {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--brown-pale);
  font-family: var(--font-game);
  font-size: 0.85rem;
  padding: 14px 20px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.04em;
  width: 100%;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: rgba(255,255,255,0.07); }
.menu-item-danger { color: #F1948A; }
.menu-item-danger:hover { background: rgba(192,57,43,0.2); }
.menu-item-send { color: var(--gold-light); }
.menu-item-send:hover { background: rgba(201,162,39,0.15); }

.menu-chat-section { display: flex; flex-direction: column; }
.menu-chat-section.hidden { display: none; }
.menu-chat-input {
  background: rgba(255,255,255,0.05);
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: var(--text-light);
  font-family: var(--font-game);
  font-size: 0.82rem;
  padding: 10px 16px;
  outline: none;
}
.menu-chat-input:focus { background: rgba(255,255,255,0.09); }
.menu-chat-input::placeholder { color: rgba(255,255,255,0.28); }

.hud-btn {
  background: rgba(201,162,39,0.18);
  border: 1.5px solid var(--gold);
  border-radius: 20px;
  color: var(--gold-light);
  font-family: var(--font-game);
  font-size: 0.78rem;
  padding: 6px 16px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: all 0.2s;
}
.hud-btn:hover { background: rgba(201,162,39,0.35); }

/* ── Game content layout ── */
.game-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Playfield view ── */
.playfield-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 8px;
  gap: 10px;
  transition: flex 0.4s ease;
  overflow: hidden;
}
.playfield-view.pf-minimized {
  flex: 0 0 90px;
}

/* Opponents row */
.opponents-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.opponent-chip {
  background: rgba(10,5,0,0.7);
  border: 1.5px solid rgba(200,139,80,0.4);
  border-radius: 14px;
  padding: 8px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 90px;
  backdrop-filter: blur(4px);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.opponent-chip.opp-active {
  border-color: #6EEB94;
  box-shadow: 0 0 18px rgba(39,174,96,0.4);
}
.opponent-chip.opp-dead {
  opacity: 0.4;
  border-color: rgba(192,57,43,0.3);
}
.opp-name { font-size: 0.8rem; color: var(--brown-pale); font-weight: 600; }
.opp-cards { font-size: 0.7rem; color: var(--gold-light); }

/* Center zone */
.center-zone {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  flex: 1;
}
.pile-zone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.zone-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.45);
  background: rgba(0,0,0,0.4);
  padding: 3px 10px;
  border-radius: 10px;
}
.pile-slot {
  width: 42vh;
  min-height: 60vh;
  display: flex; align-items: center; justify-content: center;
}
.empty-pile {
  width: 42vh; height: 60vh;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-card);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.2);
  font-size: 1.5rem;
}
.pile-card { width: 42vh !important; }
.pile-card .card-canvas { width: 42vh; }

.deck-zone { cursor: pointer; }
.deck-zone:hover .deck-pile-visual { filter: brightness(1.15); transform: translateY(-3px); }
.deck-pile-visual { transition: transform 0.2s, filter 0.2s; }
.deck-card { box-shadow: 4px 4px 0 rgba(0,0,0,0.5), 8px 8px 0 rgba(0,0,0,0.3) !important; }

/* Deck corner widget — small, top-right below HUD */
.deck-corner {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 6;
  align-items: center;
}
.deck-corner .pile-slot {
  width: 9vh;
  min-height: 13vh;
}
.deck-corner .pile-card { width: 9vh !important; }
.deck-corner .pile-card .card-canvas-wrapper { width: 9vh !important; }
.deck-corner .pile-card .card-canvas { width: 9vh !important; height: auto !important; }
.deck-corner .empty-pile { width: 9vh; height: 13vh; font-size: 0.8rem; }
.deck-count-badge {
  background: var(--gold);
  color: var(--brown-dark);
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 20px;
  padding: 3px 12px;
  min-width: 40px;
  text-align: center;
}

/* Action log — default (mobile / solo): compact strip at bottom of column */
.action-log {
  flex: 0 0 auto;
  max-height: 80px;
  overflow-y: auto;
  background: rgba(0,0,0,0.5);
  border-radius: 10px;
  padding: 6px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--brown-mid) transparent;
  display: none;
}
.action-log:not(:empty) {
  display: block;
}
.log-entry {
  font-size: 0.7rem;
  color: var(--brown-pale);
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  opacity: 0.85;
}
.log-entry:last-child { border-bottom: none; opacity: 1; color: var(--gold-light); }

/* ── Desktop multiplayer: grid layout with log as left sidebar ── */
@media (min-width: 768px) {
  .game-screen.is-multiplayer .game-content {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: 1fr auto;
    grid-template-areas:
      "log playfield"
      "log hand";
  }
  .game-screen.is-multiplayer .action-log {
    grid-area: log;
    display: block; /* always visible as sidebar regardless of content */
    max-height: none;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.72);
    border-right: 1.5px solid rgba(201,162,39,0.2);
    border-radius: 0;
    padding: 10px 8px 12px;
    z-index: 3;
  }
  .game-screen.is-multiplayer .playfield-view {
    grid-area: playfield;
  }
  .game-screen.is-multiplayer .hand-view {
    grid-area: hand;
  }
  /* "Game Log" header pinned at top of sidebar */
  .game-screen.is-multiplayer .action-log::before {
    content: 'Game Log';
    display: block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(201,162,39,0.55);
    padding: 0 2px 6px 2px;
    border-bottom: 1px solid rgba(201,162,39,0.15);
    margin-bottom: 6px;
  }
  /* Log entries: slightly larger, full-width in sidebar */
  .game-screen.is-multiplayer .log-entry {
    font-size: 0.68rem;
    padding: 3px 2px;
    line-height: 1.35;
    word-break: break-word;
  }
  .game-screen #drawCardBtn{
    display: none;
  }
}

/* ── Hand view ── */
.hand-view {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  background: rgba(10, 5, 0, 0.78);
  border-top: 2px solid rgba(201,162,39,0.35);
  backdrop-filter: blur(10px);
  padding: 10px 16px 14px;
  transition: height 0.4s ease, flex 0.4s ease;
  overflow: hidden;
}
/* Let the selected card pop out above the hand panel */
.hand-view.has-selected-card {
  overflow: visible;
}
.hand-view.hv-focused {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65vh;
  flex: none;
  z-index: 5;
  border-top: 2px solid rgba(201,162,39,0.6);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.7);
  animation: handExpandUp 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.hand-view.hv-collapsing {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65vh;
  flex: none;
  z-index: 5;
  border-top: 2px solid rgba(201,162,39,0.6);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.7);
  animation: handCollapseDown 0.38s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
}
@keyframes handExpandUp {
  from { transform: translateY(22%); opacity: 0.55; }
  to   { transform: translateY(0);   opacity: 1; }
}
@keyframes handCollapseDown {
  from { transform: translateY(0);   opacity: 1; }
  to   { transform: translateY(22%); opacity: 0.55; }
}

.hand-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.hand-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

/* ── Card Fan ── */
.card-fan {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: visible;
}
.empty-hand-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.25);
  font-size: 0.85rem;
}

/* Fan card positioning */
.fan-card {
  position: absolute;
  transform: rotate(var(--fan-angle, 0deg));
  transform-origin: bottom center;
  transition:
    left 0.35s ease-out,
    transform 0.35s ease-out,
    filter 0.2s ease,
    z-index 0s;
  cursor: pointer;
}
.fan-card .card-canvas {
  width: 130px;
  height: auto;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: block;
}
.hv-focused .fan-card .card-canvas { width: 160px; }
.fan-card:hover {
  transform: rotate(0deg) translateY(-22px) scale(1.07) !important;
  z-index: 200 !important;
}
/* In the expanded hand, hover to ~70% of the 65vh panel height */
.hv-focused .fan-card:hover {
  transform: rotate(0deg) translateY(-12vh) scale(1) !important;
  z-index: 200 !important;
}
.hv-focused .fan-card:hover .card-canvas {
  width: 32vh !important;
}
.fan-card.fan-dragged {
  transform: rotate(0deg) translateY(-60px) scale(1.22) !important;
  z-index: 200 !important;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.3));
}
.hv-focused .fan-card.fan-center .card-canvas { width: 200px; }
.hv-focused .card-fan.fan-has-hover .fan-card.fan-center:not(:hover) .card-canvas { width: 160px; }
.fan-card.fan-selected {
  transform: rotate(0deg) translateX(var(--fan-center-x, 0px)) translateY(-62px) scale(1.22) !important;
  z-index: 201 !important;
  filter: drop-shadow(0 0 14px var(--gold)) drop-shadow(0 0 6px rgba(201,162,39,0.8));
}

/* ════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

.modal-box {
  background: linear-gradient(160deg, #2C1505 0%, #1A0A00 100%);
  border: 2px solid var(--brown-light);
  border-radius: 20px;
  padding: 36px 40px;
  max-width: 520px;
  width: 92%;
  box-shadow: 0 30px 80px rgba(0,0,0,0.8);
  text-align: center;
  animation: popIn 0.25s cubic-bezier(0.34,1.2,0.64,1);
}
.modal-box--wide { max-width: 700px; }

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-title { font-size: 1.3rem; color: var(--gold-light); margin-bottom: 20px; }

/* Bomb modal */
.bomb-modal-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.bomb-icon { font-size: 3rem; }
.bomb-modal-inner h3 { font-size: 1.4rem; color: var(--gold-light); }
.bomb-modal-inner p  { color: var(--brown-pale); font-size: 0.9rem; }
.bomb-label { font-size: 0.85rem; color: var(--brown-pale); }
.bomb-placement-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}
.bomb-place-btn {
  flex: 1;
  min-width: 80px;
  font-size: 0.95rem;
  padding: 10px 8px;
  border: 1px solid rgba(255,255,255,0.2);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.bomb-place-btn:hover {
  border-color: var(--gold-light);
  background: rgba(255,255,255,0.08);
  transform: translateY(-2px);
}

/* Wild Capy mimic modal */
.wild-capy-modal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.wild-capy-modal-inner h3 { font-size: 1.3rem; color: var(--gold-light); }
.wild-capy-modal-inner p  { color: var(--brown-pale); font-size: 0.9rem; }
.wild-capy-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}
.wild-capy-grid::-webkit-scrollbar { width: 6px; }
.wild-capy-grid::-webkit-scrollbar-track { background: transparent; }
.wild-capy-grid::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }
.wild-capy-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border-radius: 10px;
  padding: 6px 4px;
  border: 1.5px solid transparent;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.wild-capy-item:hover {
  border-color: var(--gold);
  background: rgba(201,162,39,0.18);
  transform: translateY(-3px);
}
.wild-capy-card-el .card-canvas { width: 72px; pointer-events: none; }
.wild-capy-item-label {
  font-size: 0.6rem;
  color: var(--brown-pale);
  text-align: center;
  line-height: 1.2;
  font-family: var(--font-game);
  letter-spacing: 0.02em;
}

/* Target modal */
.target-modal-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.target-modal-inner h3 { font-size: 1.3rem; color: var(--gold-light); }
.target-modal-inner p  { color: var(--brown-pale); font-size: 0.9rem; }
.target-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.target-btn {
  background: rgba(201,162,39,0.15);
  border: 2px solid var(--gold);
  border-radius: 10px;
  color: var(--gold-light);
  font-family: var(--font-game);
  font-size: 0.9rem;
  padding: 10px 22px;
  cursor: pointer;
  transition: all 0.2s;
}
.target-btn:hover { background: rgba(201,162,39,0.35); transform: translateY(-2px); }

/* Game over modal */
.gameover-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.gameover-icon  { font-size: 4rem; }
.gameover-title { font-size: 2rem; color: var(--gold-light); }
.gameover-inner p { color: var(--brown-pale); }

/* Peek modal */
.peek-box { max-width: 700px; }
.peek-card-row { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.peek-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform 0.2s; }
.peek-slot-selected { outline: 3px solid var(--gold); border-radius: var(--radius-card); box-shadow: 0 0 18px rgba(201,162,39,0.6); }
.peek-pos-lbl { font-size: 0.68rem; letter-spacing: 0.1em; color: var(--brown-pale); text-transform: uppercase; }
.peek-card-el .card-canvas { width: 100px; }
.peek-card-fallback { width: 100px; height: 140px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.05); border-radius: var(--radius-card); font-size: 0.7rem; color: var(--brown-pale); text-align: center; padding: 8px; }

/* ── Toasts ── */
.toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 1000; pointer-events: none; }
.toast {
  background: rgba(30, 14, 2, 0.92);
  border: 1.5px solid rgba(201,162,39,0.4);
  border-radius: 20px;
  padding: 10px 22px;
  color: var(--brown-pale);
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}
.toast.toast-visible { opacity: 1; transform: translateY(0); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .menu-panel { padding: 32px 24px; min-width: unset; }
  .game-title  { font-size: 2.6rem; }
  .diff-grid   { grid-template-columns: 1fr; }
  .center-zone { gap: 12px; }
  .pile-slot { width: 36vh; min-height: 51vh; }
  .empty-pile { width: 36vh; height: 51vh; }
  .pile-card { width: 36vh !important; }
  .pile-card .card-canvas { width: 36vh; }
  .fan-card .card-canvas { width: 100px; }
  .hud-chip:not(#hudRoom) { display: none; }
  /* fan-selected centering is now universal via --fan-center-x on all screen sizes */
}

/* ── Floating action buttons (bottom of game screen) ── */
.game-fab {
  position: fixed;
  bottom: 16px;
  font-family: var(--font-game);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 10px 20px;
  border-radius: 24px;
  border: 1.5px solid var(--gold);
  background: rgba(201,162,39,0.22);
  color: var(--gold-light);
  cursor: pointer;
  z-index: 20;
  transition: background 0.2s, transform 0.15s;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.5);
}
.game-fab:hover { background: rgba(201,162,39,0.4); transform: translateY(-2px); }
.game-fab:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.game-fab:disabled:hover { background: rgba(201,162,39,0.22); transform: none; }
.game-fab-right { right: 16px; }
.game-fab-left  { left: 16px; }

/* ── Turn Countdown Overlay ── */
.turn-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 300;
  pointer-events: all;
  gap: 12px;
}
.turn-countdown.hidden { display: none; }

.countdown-number {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(5rem, 20vw, 10rem);
  color: var(--gold);
  text-shadow: 0 0 40px rgba(201,162,39,0.9), 0 0 80px rgba(201,162,39,0.4);
  line-height: 1;
}

.countdown-label {
  font-family: var(--font-game);
  font-size: clamp(1.2rem, 4vw, 2rem);
  color: var(--text-light);
  letter-spacing: 0.12em;
  opacity: 0.9;
}

@keyframes countdown-pop {
  0%   { transform: scale(2.2); opacity: 0; }
  25%  { transform: scale(1.05); opacity: 1; }
  75%  { transform: scale(1);   opacity: 1; }
  100% { transform: scale(0.6); opacity: 0; }
}

.countdown-number.pop {
  animation: countdown-pop 0.9s ease-in-out forwards;
}
