/* ============ MATEO — Retro UI ============ */
:root {
  --bg: #0d0221;
  --felt: #1a0b3b;
  --felt-edge: #ff2a6d;
  --neon-pink: #ff2a6d;
  --neon-cyan: #05d9e8;
  --neon-yellow: #f9f002;
  --neon-green: #39ff14;
  /* Cards scale with the smaller viewport side so they always fit the table
     circle (which is sized in vmin). Capped at the desktop size. */
  --card-w: clamp(32px, 8.5vmin, 58px);
  --card-h: calc(var(--card-w) * 1.414);
  --white: #f4f4f8;
  /* Card-back pattern. Overridden per deck theme on #table (host's deck) and
     on your own seat (your equipped deck). */
  --deck-bg: repeating-conic-gradient(#1c4fd1 0% 25%, #2e6bff 0% 50%) 0 0 / 12px 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--white);
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
  user-select: none;
}

/* CRT scanlines + vignette */
#crt-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.18) 0px, rgba(0,0,0,0.18) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
  animation: flicker 4s infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.85; }
  94% { opacity: 1; }
}

/* 100dvh tracks the REAL visible height on mobile Safari/Chrome (the
   classic 100vh hides the bottom of the page behind the browser bar) */
.screen { display: none; height: 100vh; height: 100dvh; width: 100vw; position: relative; }
.screen.active { display: flex; align-items: center; justify-content: center; flex-direction: column; }
.hidden { display: none !important; }

/* ============ LOBBY ============ */
.lobby-box { text-align: center; animation: rise 0.5s ease-out; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.game-title {
  font-size: 52px;
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink), 0 0 24px var(--neon-pink), 4px 4px 0 #000;
  margin-bottom: 16px;
  animation: pulse-title 2s ease-in-out infinite;
}
@keyframes pulse-title {
  0%, 100% { text-shadow: 0 0 8px var(--neon-pink), 0 0 24px var(--neon-pink), 4px 4px 0 #000; }
  50% { text-shadow: 0 0 16px var(--neon-pink), 0 0 48px var(--neon-pink), 4px 4px 0 #000; }
}

.subtitle { font-size: 10px; color: var(--neon-cyan); margin-bottom: 16px; letter-spacing: 2px; }

.seo-intro {
  font-size: 7px;
  color: rgba(5,217,232,0.65);
  line-height: 1.9;
  max-width: 320px;
  margin: 0 auto 24px;
  letter-spacing: 0.5px;
}

.name-field {
  font-size: 8px; color: var(--neon-yellow);
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 auto 26px; max-width: 280px;
}
.name-field input, .code-field input {
  font-family: inherit; font-size: 12px;
  background: #000; color: var(--neon-green);
  border: 3px solid var(--neon-cyan);
  padding: 10px; outline: none; text-align: center;
  box-shadow: 0 0 6px rgba(5,217,232,0.5);
  width: 100%;
}
.name-field input:focus, .code-field input:focus { border-color: var(--neon-pink); }

.code-field {
  font-size: 8px; color: var(--neon-yellow);
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 auto; max-width: 280px; width: 100%;
}
.code-field input {
  font-size: 20px;
  padding: 14px 10px;
  text-transform: uppercase;
  letter-spacing: 10px;
}

.lobby-actions { display: flex; flex-direction: column; gap: 14px; align-items: center; margin-bottom: 18px; width: 100%; max-width: 280px; margin-inline: auto; }
.join-divider { font-size: 7px; color: rgba(5,217,232,0.55); letter-spacing: 1px; margin: 4px 0; }
.btn-join { width: 100%; font-size: 12px; padding: 14px 20px; margin: 0; }
.lobby-error { font-size: 8px; color: #ff3b3b; min-height: 14px; margin-bottom: 10px; }

/* waiting room */
.room-code {
  font-family: inherit;
  font-size: 44px;
  color: var(--neon-yellow);
  letter-spacing: 14px;
  text-shadow: 0 0 12px var(--neon-yellow), 4px 4px 0 #000;
  margin: 10px 0 6px;
  animation: pulse-title 2s ease-in-out infinite;
  cursor: pointer;
  background: none;
  border: 3px dashed transparent;
  padding: 8px 16px;
  transition: transform 0.1s, border-color 0.15s, color 0.15s;
}
.room-code:hover {
  border-color: rgba(249,240,2,0.35);
  transform: scale(1.03);
}
.room-code:active { transform: scale(0.97); }
.room-code.copied {
  color: var(--neon-green);
  border-color: var(--neon-green);
  text-shadow: 0 0 12px var(--neon-green), 4px 4px 0 #000;
  animation: none;
}
.wait-share { font-size: 8px; color: var(--neon-cyan); margin-bottom: 10px; }
.btn-share-url {
  font-size: 8px;
  padding: 8px 16px;
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
  background: rgba(0,255,255,0.07);
  margin-bottom: 18px;
  letter-spacing: 1px;
}
.btn-share-url:hover { background: rgba(0,255,255,0.15); }
.btn-share-url.copied {
  color: var(--neon-green);
  border-color: var(--neon-green);
  background: rgba(0,255,100,0.1);
}
.wait-list { list-style: none; margin: 0 auto 24px; max-width: 320px; text-align: left; }
.wait-list li {
  font-size: 10px; color: var(--neon-green);
  border: 2px solid var(--neon-cyan);
  background: rgba(0,0,0,0.5);
  padding: 10px 14px; margin-bottom: 8px;
}
.wait-list li.empty { color: rgba(255,255,255,0.25); border-style: dashed; }
.wait-hint { font-size: 8px; color: var(--neon-cyan); margin-top: 12px; line-height: 1.8; }

/* ============ BUTTONS ============ */
.btn {
  font-family: inherit; font-size: 11px;
  background: var(--neon-pink); color: #000;
  border: none; padding: 12px 20px;
  cursor: pointer;
  box-shadow: 0 5px 0 #8f0f3c, 0 0 12px rgba(255,42,109,0.6);
  image-rendering: pixelated;
  transition: transform 0.05s;
  margin: 4px;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #8f0f3c; }
.btn-big { font-size: 14px; padding: 16px 32px; }
.btn-small { font-size: 8px; padding: 8px 14px; background: var(--neon-cyan); box-shadow: 0 4px 0 #036e75, 0 0 10px rgba(5,217,232,0.5); }
.btn-warn { background: var(--neon-yellow); box-shadow: 0 4px 0 #99940a, 0 0 10px rgba(249,240,2,0.5); }
.btn-danger { background: #ff3b3b; box-shadow: 0 4px 0 #7a1010, 0 0 10px rgba(255,59,59,0.6); }
.btn-success { background: var(--neon-green); box-shadow: 0 4px 0 #128706, 0 0 10px rgba(57,255,20,0.5); }
.btn:disabled { filter: grayscale(1) brightness(0.6); cursor: not-allowed; }
/* Keyboard-shortcut hint keycap on action buttons. Only added by JS on desktop
   (mouse + hover); touch devices never see it. */
.key-hint {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 5px;
  font-size: 0.72em;
  line-height: 1.2;
  color: #fff;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 3px;
  vertical-align: middle;
}
.btn-cpu { background: var(--neon-cyan); color: #000; box-shadow: 0 5px 0 #036e75, 0 0 12px rgba(5,217,232,0.6); margin-top: 8px; }

/* vs-CPU setup modal */
.cpu-box { max-width: 420px; }
.cpu-label { font-size: 8px; color: var(--neon-yellow); margin: 14px 0 10px; letter-spacing: 1px; }
.cpu-options { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.cpu-opt { font-size: 9px; padding: 10px 14px; background: #111; color: var(--neon-cyan); border: 2px solid var(--neon-cyan); box-shadow: none; }
.cpu-opt.active {
  background: var(--neon-green); color: #000; border-color: var(--neon-green);
  box-shadow: 0 0 12px rgba(57,255,20,0.6);
}
.cpu-box .modal-actions { margin-top: 22px; }

/* ============ TABLE ============ */
#screen-game.active { justify-content: flex-start; }

#table {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}

#screen-game .table-circle {
  position: relative;
  width: min(72vmin, 580px);
  height: min(72vmin, 580px);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #2a1660 0%, var(--felt) 65%);
  border: 6px solid var(--felt-edge);
  box-shadow: 0 0 30px rgba(255,42,109,0.45), inset 0 0 60px rgba(0,0,0,0.6);
}

/* More players → side seats appear and the circle gets crowded, so shrink the
   cards a notch as seats fill up. (--card-h follows --card-w automatically.) */
#table[data-players="3"] { --card-w: clamp(30px, 7.6vmin, 56px); }
#table[data-players="4"] { --card-w: clamp(27px, 7vmin, 52px); }

/* Seats around the circle */
.seat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.seat[data-pos="bottom"] { bottom: 2%; left: 50%; transform: translateX(-50%); }
.seat[data-pos="top"]    { top: 2%;    left: 50%; transform: translateX(-50%); flex-direction: column-reverse; }
.seat[data-pos="left"]   { left: 1%;   top: 50%;  transform: translateY(-50%); }
.seat[data-pos="right"]  { right: 1%;  top: 50%;  transform: translateY(-50%); }

.player-label {
  font-size: 9px;
  background: rgba(0,0,0,0.7);
  border: 2px solid var(--neon-cyan);
  padding: 6px 10px;
  display: flex; gap: 10px; align-items: center;
  white-space: nowrap;
  position: relative; z-index: 3; /* never let cards cover the name */
}
.player-name { color: var(--white); }
.player-score { color: var(--neon-yellow); font-size: 8px; }

/* All four names sit OUTSIDE the circle (cards stay at the edge), so a long
   name never covers the cards or the central piles. */
.seat .player-label { position: absolute; z-index: 4; }
.seat[data-pos="top"] .player-label,
.seat[data-pos="bottom"] .player-label { left: 50%; transform: translateX(-50%); }
.seat[data-pos="top"] .player-label    { bottom: 100%; margin-bottom: 8px; }
.seat[data-pos="bottom"] .player-label { top: 100%;    margin-top: 8px; }
.seat[data-pos="left"] .player-label,
.seat[data-pos="right"] .player-label  { top: 50%; transform: translateY(-50%); }
.seat[data-pos="left"] .player-label   { right: 100%; margin-right: 8px; }
.seat[data-pos="right"] .player-label  { left: 100%;  margin-left: 8px; }

.seat.active-turn .player-label {
  border-color: var(--neon-green);
  color: var(--neon-green);
  box-shadow: 0 0 14px var(--neon-green);
  animation: glow-seat 1s ease-in-out infinite;
}
@keyframes glow-seat {
  0%, 100% { box-shadow: 0 0 8px var(--neon-green); }
  50% { box-shadow: 0 0 20px var(--neon-green); }
}

.seat-actions { min-height: 26px; display: flex; gap: 4px; }
.seat-actions .btn { font-size: 7px; padding: 6px 8px; margin: 0; }

/* ============ CARDS ============ */
.hand { display: flex; gap: clamp(2px, 1.2vmin, 6px); justify-content: center; }
.seat[data-pos="left"] .hand, .seat[data-pos="right"] .hand { flex-direction: column; align-items: center; }

/* Hands with penalty cards (5+) would overflow the circle, so fan them with a
   slight overlap instead. Normal hands (≤4) keep their full gap and never touch. */
.hand.crowded { gap: 0; }
.hand.crowded .card:not(:first-child) { margin-left: calc(var(--card-w) * -0.34); }
.seat[data-pos="left"] .hand.crowded .card:not(:first-child),
.seat[data-pos="right"] .hand.crowded .card:not(:first-child) {
  margin-left: 0; margin-top: calc(var(--card-h) * -0.42);
}
/* In a fanned hand, lift the focused card above its neighbours */
.hand.crowded .card.selectable:hover,
.hand.crowded .card.selected { z-index: 5; }

.card {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 5px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1);
  cursor: default;
}
.card.flipped { transform: rotateY(180deg); }

/* Empty slot left where a card was burned/combined — keeps positions stable */
.card.gap {
  border: 2px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: none;
}

.card .face, .card .back {
  position: absolute; inset: 0;
  border-radius: 5px;
  backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.card .back {
  background: var(--deck-bg);
  border: 3px solid var(--white);
  box-shadow: 0 3px 0 rgba(0,0,0,0.5);
}
.card .face {
  background: var(--white);
  border: 3px solid #222;
  color: #111;
  transform: rotateY(180deg);
  /* Glyphs scale with the card so small cards don't overflow their face */
  font-size: calc(var(--card-w) * 0.22);
  gap: 2px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.5);
}
.card .face .rank { font-size: calc(var(--card-w) * 0.26); }
.card .face .suit { font-size: calc(var(--card-w) * 0.3); }
.card .face.red { color: #d11a2a; }
.card .face .corner { position: absolute; top: 3px; left: 4px; font-size: calc(var(--card-w) * 0.15); line-height: 1.2; }
.card .face .corner-b { position: absolute; bottom: 3px; right: 4px; font-size: calc(var(--card-w) * 0.15); line-height: 1.2; transform: rotate(180deg); }

.card.selectable { cursor: pointer; }
.card.selectable:hover { transform: translateY(-7px); }
.card.selectable.flipped:hover { transform: rotateY(180deg) translateY(-7px); }
.card.selectable::after {
  content: '';
  position: absolute; inset: -5px;
  border: 2px dashed var(--neon-yellow);
  border-radius: 8px;
  animation: dash-pulse 0.9s linear infinite;
}
@keyframes dash-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.card.selected::after {
  content: '';
  position: absolute; inset: -5px;
  border: 3px solid var(--neon-green);
  border-radius: 8px;
}

.card.dealing { animation: deal-in 0.4s ease-out backwards; }
@keyframes deal-in {
  from { transform: translate(0, -180px) rotate(540deg) scale(0.3); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* tilt: wiggle the card being peeked (power 7 / 8). A flipped (revealed) card
   keeps its rotateY so the face stays visible while it wiggles. */
.card.tilt { animation: card-tilt 0.7s ease-in-out; z-index: 6; }
.card.flipped.tilt { animation: card-tilt-flip 0.7s ease-in-out; }
@keyframes card-tilt {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg) scale(1.12); }
  55% { transform: rotate(9deg) scale(1.12); }
  80% { transform: rotate(-4deg) scale(1.06); }
}
@keyframes card-tilt-flip {
  0%, 100% { transform: rotateY(180deg) rotate(0); }
  25% { transform: rotateY(180deg) rotate(-12deg) scale(1.12); }
  55% { transform: rotateY(180deg) rotate(9deg) scale(1.12); }
  80% { transform: rotateY(180deg) rotate(-4deg) scale(1.06); }
}

.center-announce {
  position: fixed; top: 42%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1600;
  font-size: clamp(10px, 3.4vmin, 15px);
  line-height: 1.6;
  text-align: center;
  color: var(--neon-cyan);
  background: rgba(0, 0, 0, 0.88);
  border: 3px solid var(--neon-cyan);
  box-shadow: 0 0 22px rgba(5, 217, 232, 0.6);
  padding: 16px 22px;
  max-width: 80vw;
  pointer-events: none;
  animation: center-announce 2.2s ease-out forwards;
}
@keyframes center-announce {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  20% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

.card.shake { animation: shake 0.45s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.card.burn-out { animation: burn-out 0.6s ease-in forwards; }
@keyframes burn-out {
  to { transform: scale(0.1) rotate(360deg); opacity: 0; filter: brightness(3) hue-rotate(60deg); }
}

/* ============ CENTER PILES ============ */
.table-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; gap: clamp(8px, 4vmin, 28px); align-items: center;
  justify-content: center; flex-wrap: wrap;
  max-width: 86%;
}
.pile { display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
/* Fixed-size card slot inside each pile, so empty piles keep their place and
   the row never reflows toward the center. */
.pile-cards { display: flex; align-items: center; justify-content: center; width: var(--card-w); height: var(--card-h); }
.pile-label { font-size: 7px; color: var(--neon-cyan); }
.pile-empty {
  width: var(--card-w); height: var(--card-h);
  border: 3px dashed rgba(255,255,255,0.25);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 6px; color: rgba(255,255,255,0.35);
  text-align: center;
}
#deck-pile .card-back {
  width: var(--card-w); height: var(--card-h);
  border-radius: 5px;
  background: var(--deck-bg);
  border: 3px solid var(--white);
  box-shadow: 2px 2px 0 #0a1f55, 4px 4px 0 #0a1f55, 0 0 12px rgba(46,107,255,0.5);
  cursor: pointer;
}
#deck-pile.clickable .card-back { animation: glow-deck 1s ease-in-out infinite; }
@keyframes glow-deck {
  0%, 100% { box-shadow: 2px 2px 0 #0a1f55, 4px 4px 0 #0a1f55, 0 0 8px var(--neon-yellow); }
  50% { box-shadow: 2px 2px 0 #0a1f55, 4px 4px 0 #0a1f55, 0 0 22px var(--neon-yellow); }
}
#discard-pile .card { cursor: default; }
#discard-pile .card.fresh-glow .face { box-shadow: 0 0 14px var(--neon-yellow), 0 3px 0 rgba(0,0,0,0.5); }
#discard-pile .card.stale { filter: grayscale(0.7) brightness(0.55); }
#burned-pile .card.burn-glow .face {
  box-shadow: 0 0 14px #ff5722, 0 3px 0 rgba(0,0,0,0.5);
  border-color: #ff5722;
}
.burned-stack {
  width: var(--card-w); height: var(--card-h);
  border: 3px dashed #ff5722; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: rgba(255,87,34,0.08);
  box-shadow: 0 0 10px rgba(255,87,34,0.35);
}
#discard-pile .card.slam { animation: slam 0.3s ease-out; }
@keyframes slam {
  from { transform: scale(1.7) rotate(-12deg); }
  to { transform: scale(1) rotate(0); }
}

/* ---- card movement: a temporary card flies between two spots ---- */
.fly-wrap { will-change: transform; }
.fly-wrap .card { box-shadow: 0 12px 24px rgba(0,0,0,0.6); }
/* deck gives a little kick when a card is drawn from it */
#deck-pile .card-back.draw-pop { animation: draw-pop 0.24s ease-out; }
@keyframes draw-pop {
  0% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-10px) scale(1.07); }
  100% { transform: translateY(0) scale(1); }
}

/* a hand that grabs and drags a stolen card (power 9) */
.steal-hand {
  position: absolute;
  left: 50%; top: -38%;
  transform: translateX(-50%) rotate(-12deg);
  font-size: clamp(22px, 7vmin, 40px);
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6));
  animation: steal-grab 0.45s ease-in-out;
}
@keyframes steal-grab {
  0% { transform: translateX(-50%) rotate(-12deg) scale(0.4); opacity: 0; }
  35% { transform: translateX(-50%) rotate(-4deg) scale(1.25); opacity: 1; }
  100% { transform: translateX(-50%) rotate(-12deg) scale(1); opacity: 1; }
}

/* ============ BANNERS & BARS ============ */
.turn-banner {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 50;
  font-size: 13px;
  color: #000;
  background: var(--neon-green);
  padding: 10px 22px;
  box-shadow: 0 0 18px var(--neon-green), 0 4px 0 #128706;
  animation: banner-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes banner-pop { from { transform: translateX(-50%) scale(0); } to { transform: translateX(-50%) scale(1); } }

.turn-banner.other-turn {
  background: rgba(0,0,0,0.75);
  color: var(--neon-cyan);
  font-size: 9px;
  box-shadow: 0 0 10px rgba(5,217,232,0.4);
  border: 2px solid var(--neon-cyan);
  animation: none;
}

.round-indicator {
  position: fixed; top: 16px; right: 16px;
  font-size: 9px; color: var(--neon-yellow);
  text-shadow: 0 0 6px var(--neon-yellow);
}

.game-footer {
  flex-shrink: 0;
  width: 100%;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 75%, transparent);
  border-top: 2px solid rgba(255,42,109,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 40;
}

.message-bar {
  pointer-events: none;
  font-size: 8px;
  color: var(--neon-cyan);
  text-align: center;
  max-width: min(520px, 92vw);
  line-height: 1.8;
  text-shadow: 0 0 4px var(--neon-cyan);
  background: rgba(0,0,0,0.72);
  border: 2px solid rgba(5,217,232,0.35);
  padding: 8px 14px;
  min-height: 2.8em;
}

.action-bar {
  pointer-events: none;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 44px;
}
.action-bar .btn { pointer-events: auto; margin: 0; }

/* ============ MODALS ============ */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--felt);
  border: 4px solid var(--neon-pink);
  box-shadow: 0 0 30px rgba(255,42,109,0.5);
  padding: 26px;
  text-align: center;
  animation: rise 0.3s ease-out;
  max-width: 90vw;
}
.modal-title { font-size: 12px; color: var(--neon-yellow); margin-bottom: 18px; }
.modal-hint { font-size: 8px; color: var(--neon-cyan); margin: 14px 0; line-height: 1.8; }
.modal-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#drawn-card-slot { display: flex; justify-content: center; }
#drawn-card-slot .card { transform: rotateY(180deg) scale(1.4); margin: 14px 0 22px; }

.rules-box { max-width: 560px; text-align: left; }
.rules-text p { font-size: 8px; line-height: 1.9; margin-bottom: 10px; color: var(--white); }

/* ============ MATEO CINEMATIC (shout → drum roll → winner) ============ */
.mateo-cine {
  position: fixed; inset: 0; z-index: 200;
  display: none;
  align-items: center; justify-content: center;
  background: radial-gradient(circle at center, rgba(40,0,20,0.92), rgba(0,0,0,0.97));
  text-align: center;
  padding: 24px;
}
.mateo-cine.show { display: flex; }
.cine-stage { max-width: 92vw; }
.cine-emoji { font-size: 72px; line-height: 1; margin-bottom: 18px; }
.cine-big {
  font-size: 22px; line-height: 1.5; color: var(--neon-yellow);
  text-shadow: 0 0 14px var(--neon-yellow);
}
.cine-yell { color: var(--neon-pink); text-shadow: 0 0 16px var(--neon-pink); }
.cine-sub { font-size: 11px; color: var(--neon-cyan); margin-top: 16px; line-height: 1.7; }
.cine-pop { animation: cine-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes cine-pop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}
.cine-shake { animation: cine-shake 0.18s linear infinite; }
@keyframes cine-shake {
  0%, 100% { transform: translateX(-6px) rotate(-7deg); }
  50% { transform: translateX(6px) rotate(7deg); }
}

/* ============ SCORE SCREEN ============ */
.score-box { text-align: center; animation: rise 0.4s ease-out; }
#score-title { font-size: 24px; color: var(--neon-yellow); text-shadow: 0 0 12px var(--neon-yellow); margin-bottom: 12px; }
#score-table { margin: 24px auto; border-collapse: collapse; }
#score-table th, #score-table td { font-size: 10px; padding: 10px 18px; border: 2px solid var(--neon-cyan); }
#score-table th { color: var(--neon-pink); }
#score-table tr.winner td { color: var(--neon-green); text-shadow: 0 0 6px var(--neon-green); }
#score-table tr.loser td { color: #ff3b3b; text-shadow: 0 0 6px #ff3b3b; }

/* ============ RESPONSIVE ============ */
@media (max-width: 700px) {
  /* card size now comes from the vmin clamp in :root — no fixed override */
  .game-title { font-size: 32px; }
  .player-label { font-size: 7px; padding: 4px 7px; gap: 6px; }
  .player-score { font-size: 7px; }
  .turn-banner { font-size: 9px; }
  .seat { gap: 3px; }
  .seat[data-pos="left"]  { left: 0; }
  .seat[data-pos="right"] { right: 0; }
  /* No room in the side margins on phones: anchor side names to the visible
     edge and let them wrap so they never run off-screen. */
  .seat[data-pos="left"] .player-label  { right: auto; left: 0; margin: 0; }
  .seat[data-pos="right"] .player-label { left: auto; right: 0; margin: 0; }
  .seat[data-pos="left"] .player-label,
  .seat[data-pos="right"] .player-label { white-space: normal; max-width: 40vw; }
}

/* Narrow phones: give the circle a touch more room and keep labels tight */
@media (max-width: 430px) {
  #screen-game .table-circle { width: min(82vmin, 580px); height: min(82vmin, 580px); }
  .player-label { font-size: 6px; padding: 3px 6px; gap: 5px; }
  .pile-label { font-size: 6px; }
}

/* Landscape phones / very short windows: the circle is height-bound, so let it
   use more of the available height to keep the seats from colliding. */
@media (max-height: 520px) {
  #screen-game .table-circle { width: min(88vmin, 580px); height: min(88vmin, 580px); }
  #table { padding: 2px 0; }
}

/* ============ ECONOMY: coins, shop, dances, themes ============ */
.lobby-footer { display: flex; gap: 10px; justify-content: center; }
.btn-shop { border-color: var(--neon-yellow); color: var(--neon-yellow); }
.btn-shop .coin-balance { color: var(--neon-yellow); }
.shop-news {
  margin: 10px 0 0;
  font-size: 7px;
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink);
  animation: shop-news-blink 1.1s steps(2, end) infinite;
}
@keyframes shop-news-blink {
  50% { opacity: 0.25; }
}

.coin-toast {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  font-size: 12px;
  color: var(--neon-yellow);
  background: rgba(0,0,0,0.85);
  border: 3px solid var(--neon-yellow);
  box-shadow: 0 0 14px rgba(249,240,2,0.6);
  padding: 12px 18px;
  animation: coin-pop 2.6s ease-out forwards;
  pointer-events: none;
}
@keyframes coin-pop {
  0% { transform: translateX(-50%) translateY(16px) scale(0.6); opacity: 0; }
  12% { transform: translateX(-50%) translateY(0) scale(1.08); opacity: 1; }
  18% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { transform: translateX(-50%) translateY(-22px); opacity: 0; }
}

/* shop screen */
.shop-box {
  text-align: center;
  width: min(92vw, 560px);
  /* Fixed height (not max-height) so the centered box never resizes when the
     tab rows or grid height change — keeps the header pinned in place. */
  height: 92dvh;
  display: flex;
  flex-direction: column;
  animation: rise 0.4s ease-out;
}
.shop-header { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 6px; }
.shop-title {
  font-size: 22px;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px var(--neon-yellow), 3px 3px 0 #000;
}
.shop-coins { font-size: 12px; color: var(--neon-yellow); }
.shop-earn-hint { font-size: 7px; color: var(--neon-cyan); margin-bottom: 12px; }

.shop-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 12px; }
.shop-tab {
  font-family: inherit; font-size: 7px;
  background: #000; color: var(--neon-cyan);
  border: 2px solid var(--neon-cyan);
  padding: 7px 9px; cursor: pointer;
}
.shop-tab.active {
  color: #000; background: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(5,217,232,0.7);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 14px;
  flex: 1;
  min-height: 0;
}
.shop-item {
  border: 3px solid var(--neon-cyan);
  background: rgba(0,0,0,0.55);
  padding: 12px 8px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.shop-item.equipped {
  border-color: var(--neon-green);
  box-shadow: 0 0 12px rgba(57,255,20,0.45);
}
.shop-emoji { font-size: 30px; min-height: 36px; }
.shop-name { font-size: 6px; color: var(--white); line-height: 1.5; }
.shop-btn { font-size: 7px; padding: 7px 9px; margin: 0; }
.shop-btn.cant-afford { opacity: 0.45; }

/* dance taunt animation */
.btn-dance.cooling { opacity: 0.4; pointer-events: none; }

/* always-on taunt button + dance/tomato menu */
.btn-taunt {
  position: fixed; right: 14px; bottom: 78px; z-index: 70;
  width: 52px; height: 52px; border-radius: 50%;
  font-size: 24px; line-height: 1; cursor: pointer;
  background: var(--neon-pink); color: #000; border: 3px solid #000;
  box-shadow: 0 4px 0 #8f0f3c, 0 0 14px rgba(255,42,109,0.6);
  image-rendering: pixelated;
}
.btn-taunt:active { transform: translateY(3px); }
.key-hint-corner { position: absolute; top: -7px; right: -7px; margin: 0; font-size: 9px; }
.btn-taunt.cooling { opacity: 0.4; pointer-events: none; }
.taunt-menu {
  position: fixed; right: 14px; bottom: 138px; z-index: 71;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--felt); border: 3px solid var(--neon-pink);
  box-shadow: 0 0 20px rgba(255,42,109,0.5);
  padding: 10px; max-width: 78vw; max-height: 56vh; overflow-y: auto;
  animation: rise 0.2s ease-out;
}
.taunt-opt { margin: 0; text-align: left; white-space: nowrap; }
.btn-tomato { background: #ff3b3b; box-shadow: 0 4px 0 #7a1010, 0 0 10px rgba(255,59,59,0.6); }
.taunt-empty { font-size: 7px; color: var(--neon-cyan); line-height: 1.7; max-width: 160px; }

/* tomato projectile */
.tomato-fly {
  position: fixed; z-index: 2300; font-size: 36px; pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(255,59,59,0.7));
}
.tomato-fly.splat { font-size: 52px; transition: none; }
.dance-float {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex; align-items: center; gap: 4px;
  pointer-events: none;
}
.dance-emoji {
  font-size: 44px;
  animation: dance-bounce 0.5s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 8px var(--neon-pink));
}
.dance-note {
  font-size: 18px;
  color: var(--neon-yellow);
  animation: note-rise 1s ease-out infinite;
}
.dance-note.delayed { animation-delay: 0.5s; }
@keyframes dance-bounce {
  from { transform: rotate(-14deg) translateY(0); }
  to { transform: rotate(14deg) translateY(-10px); }
}
@keyframes note-rise {
  0% { transform: translateY(6px); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(-16px); opacity: 0; }
}

/* eye that floats over a card being peeked (👁 own / 👀 other) */
.eye-float {
  position: fixed;
  z-index: 2200;
  font-size: 30px;
  pointer-events: none;
  filter: drop-shadow(0 0 8px var(--neon-cyan));
  animation: eye-peek 2.6s ease-out forwards;
}
@keyframes eye-peek {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  14% { transform: translate(-50%, -90%) scale(1.15); opacity: 1; }
  80% { transform: translate(-50%, -90%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -120%) scale(0.9); opacity: 0; }
}

/* table themes (host's pick dresses the room) */
#table[data-theme="table-ocean"] .table-circle {
  background: radial-gradient(circle at 50% 38%, #0a3d62 0%, #051c30 65%);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 30px rgba(5,217,232,0.5), inset 0 0 60px rgba(0,0,0,0.6);
}
#table[data-theme="table-matrix"] .table-circle {
  background: radial-gradient(circle at 50% 38%, #06360e 0%, #021505 65%);
  border-color: var(--neon-green);
  box-shadow: 0 0 30px rgba(57,255,20,0.45), inset 0 0 60px rgba(0,0,0,0.65);
}
#table[data-theme="table-gold"] .table-circle {
  background: radial-gradient(circle at 50% 38%, #4a3505 0%, #1d1502 65%);
  border-color: #ffd700;
  box-shadow: 0 0 32px rgba(255,215,0,0.5), inset 0 0 60px rgba(0,0,0,0.6);
}
#table[data-theme="table-blood"] .table-circle {
  background: radial-gradient(circle at 50% 38%, #4a0505 0%, #1a0202 65%);
  border-color: #ff1a1a;
  box-shadow: 0 0 30px rgba(255,26,26,0.5), inset 0 0 60px rgba(0,0,0,0.65);
}
#table[data-theme="table-pink"] .table-circle {
  background: radial-gradient(circle at 50% 38%, #6b1248 0%, #210317 65%);
  border-color: #ff8bd1;
  box-shadow: 0 0 34px rgba(255,42,157,0.55), inset 0 0 60px rgba(0,0,0,0.62);
}

/* Card-back themes via --deck-bg. The host's deck (#table) dresses the table
   and piles; your own seat overrides it with YOUR equipped deck, so the back
   you bought always shows on your own cards. */
#table[data-deck="cards-default"], .seat[data-deck="cards-default"] {
  --deck-bg: repeating-conic-gradient(#1c4fd1 0% 25%, #2e6bff 0% 50%) 0 0 / 12px 12px;
}
#table[data-deck="cards-red"], .seat[data-deck="cards-red"] {
  --deck-bg: repeating-conic-gradient(#a31621 0% 25%, #e6394a 0% 50%) 0 0 / 12px 12px;
}
#table[data-deck="cards-gold"], .seat[data-deck="cards-gold"] {
  --deck-bg: repeating-conic-gradient(#8a6d00 0% 25%, #d4af37 0% 50%) 0 0 / 12px 12px;
}
#table[data-deck="cards-matrix"], .seat[data-deck="cards-matrix"] {
  --deck-bg: repeating-conic-gradient(#063d10 0% 25%, #0fa830 0% 50%) 0 0 / 12px 12px;
}
#table[data-deck="cards-purple"], .seat[data-deck="cards-purple"] {
  --deck-bg: repeating-conic-gradient(#4b1a78 0% 25%, #8a3ddb 0% 50%) 0 0 / 12px 12px;
}
#table[data-deck="cards-pink"], .seat[data-deck="cards-pink"] {
  --deck-bg: repeating-conic-gradient(#ff2a9d 0% 25%, #ff8bd1 0% 50%) 0 0 / 12px 12px;
}
