/* ============================================================
   CYBER SALOON — TOP TRUMPS
   Dystopian-primary / western-accent tokens
   bg          #04070a  void behind the blast doors
   panel       #0a141c  control-room steel panel
   panel-edge  #16232e  lit panel seam
   neon-cyan   #2ce8ff  primary HUD accent
   neon-red    #ff2b3f  alert / dealer glow
   amber       #ffb545  hazard-lamp glow (old lantern, new wattage)
   term-grn    #39ff8c  terminal accent / win state
   glass       rgba(10,20,28,.86)  card body (holo-glass, not parchment)
   card-ink    #dff3ff  card text on dark glass
   brass       #b5895a  the one warm, western material left in the room
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

:root {
  --bg: #04070a;
  --panel: #0a141c;
  --panel-edge: #16232e;
  --neon-cyan: #2ce8ff;
  --neon-red: #ff2b3f;
  --amber: #ffb545;
  --term-grn: #39ff8c;
  --glass: rgba(10, 20, 28, 0.86);
  --glass-edge: rgba(44, 232, 255, 0.35);
  --card-ink: #dff3ff;
  --text: #cfe3ee;
  --text-dim: #7f95a3;
  --brass: #b5895a;

  --font-display: "Orbitron", sans-serif;
  --font-mono: "Share Tech Mono", monospace;
  --font-data: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  overflow-x: hidden;
}

/* ---------- ambient overlays ---------- */
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.0) 0px,
    rgba(0,0,0,0.10) 1px,
    rgba(0,0,0,0.0) 3px
  );
  mix-blend-mode: multiply;
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 49;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.82) 100%);
}

/* ---------- control-room shell ----------
   A faint ghost of plank siding sits *under* the tech grid at very low
   opacity — a saloon that got retrofitted into a surveillance post,
   not demolished for one. */
.saloon {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(44,232,255,0.09), transparent 55%),
    repeating-linear-gradient(90deg, rgba(181,137,90,0.05) 0 78px, rgba(0,0,0,0.12) 78px 84px),
    repeating-linear-gradient(0deg, rgba(44,232,255,0.035) 0 2px, transparent 2px 48px),
    repeating-linear-gradient(90deg, rgba(44,232,255,0.035) 0 2px, transparent 2px 48px),
    linear-gradient(var(--bg), #060a0e 60%, var(--bg));
  padding: 24px 16px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.signboard {
  text-align: center;
  margin: 8px 0 20px;
}
.signboard h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, 6.4vw, 3.8rem);
  color: var(--neon-cyan);
  letter-spacing: 4px;
  margin: 0;
  text-transform: uppercase;
  text-shadow:
    0 0 8px rgba(44,232,255,0.85),
    0 0 26px rgba(44,232,255,0.45),
    0 2px 0 #012;
}
.signboard .tagline {
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: 4px;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin: 8px 0 0;
}

/* ---------- blast-door intro (saloon swing, dystopian skin) ----------
   The western nod: the doors still split down the centreline and swing
   open on a hinge, exactly like a saloon. Everything else — the
   gunmetal panelling, hazard stripe, rivets — is control-room hardware. */
.doors {
  position: fixed; inset: 0; z-index: 60;
  display: flex;
  pointer-events: auto;
}
.door {
  flex: 1;
  background:
    repeating-linear-gradient(135deg, rgba(0,0,0,0.25) 0 3px, transparent 3px 26px),
    linear-gradient(160deg, #222d36, #131b21 45%, #0b1116 100%);
  box-shadow: inset 0 0 80px rgba(0,0,0,0.75);
  transition: transform 1.1s cubic-bezier(.65,-0.15,.3,1.4);
  border: 2px solid #0c1418;
  position: relative;
}
.door::before {
  /* hazard edge stripe, a control-room reflex, not a decoration */
  content: "";
  position: absolute; top: 0; bottom: 0; width: 10px;
  background: repeating-linear-gradient(45deg, var(--amber) 0 8px, #1a1206 8px 16px);
  opacity: 0.85;
}
.door::after {
  /* small brass rivets — the one deliberately warm, western material left */
  content: "";
  position: absolute; top: 14%; bottom: 14%; width: 6px;
  background: repeating-linear-gradient(to bottom, var(--brass) 0 6px, transparent 6px 46px);
  border-radius: 3px;
  opacity: 0.9;
}
.door-left { transform-origin: left center; }
.door-left::before { right: 0; }
.door-left::after { right: 22px; }
.door-right { transform-origin: right center; }
.door-right::before { left: 0; }
.door-right::after { left: 22px; }
.doors.open .door-left { transform: rotateY(-108deg) translateX(-4%); }
.doors.open .door-right { transform: rotateY(108deg) translateX(4%); }
.doors.hidden { display: none; }

.enter-btn {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 61;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 2px;
  color: #01161c;
  background: var(--neon-cyan);
  border: 3px solid #0a5766;
  padding: 18px 30px;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 0 24px rgba(44,232,255,0.7);
  animation: pulse 1.8s ease-in-out infinite;
}
.enter-btn:hover { background: #7ff2ff; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 14px rgba(44,232,255,0.5); }
  50% { box-shadow: 0 0 32px rgba(44,232,255,0.9); }
}

/* ---------- table layout ---------- */
.table {
  width: 100%;
  max-width: 1080px;
  display: grid;
  grid-template-columns: 1fr minmax(260px, 320px) 1fr;
  gap: 20px;
  align-items: start;
  margin-top: 10px;
}
@media (max-width: 820px) {
  .table { grid-template-columns: 1fr; }
}

.seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.seat-label {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 1.1rem;
  margin: 0;
  text-shadow: 0 0 10px rgba(255,181,69,0.5);
}

/* ---------- dealer figure ----------
   A low tactical cowl replaces the ten-gallon hat; a segmented,
   glowing gorget replaces the bandana; the two eyes become a single
   scanning visor bar. The silhouette still reads as "the dealer in
   the hood at the table," which is the western part worth keeping. */
.dealer-figure {
  width: 92px; height: 92px;
  position: relative;
  filter: drop-shadow(0 0 14px rgba(44,232,255,0.35));
}
.dealer-figure .hat {
  position: absolute; top: -6px; left: 10px; width: 72px; height: 26px;
  background: linear-gradient(180deg, #1c2731, #0c1318);
  border-radius: 50% 50% 6px 6px / 100% 100% 4px 4px;
  box-shadow: 0 4px 0 -1px #060a0d;
}
.dealer-figure .face {
  position: absolute; top: 20px; left: 16px; width: 60px; height: 50px;
  background: linear-gradient(180deg, #182129, #0d1418);
  border-radius: 8px;
}
.dealer-figure .eye {
  position: absolute; top: 20px; width: 12px; height: 4px;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan), 0 0 18px var(--neon-cyan);
  animation: scan 3.2s infinite;
}
.eye-l { left: 10px; } .eye-r { right: 10px; }
@keyframes scan {
  0%, 88%, 100% { opacity: 1; box-shadow: 0 0 8px var(--neon-cyan), 0 0 18px var(--neon-cyan); }
  92% { opacity: 0.15; box-shadow: none; }
}
.dealer-figure .bandana {
  position: absolute; bottom: 2px; left: 6px; width: 80px; height: 16px;
  background: repeating-linear-gradient(90deg, var(--neon-red) 0 6px, #2a0209 6px 12px);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
  opacity: 0.9;
}

/* ---------- player figure ----------
   Same 92x92 footprint as .dealer-figure so both seats sit at identical
   heights and the two decks line up at the bottom, not just the top. */
.player-figure {
  width: 92px; height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 14px rgba(44,232,255,0.35));
}
.player-figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- cards ----------
   Holo-glass terminal cards. The red top ribbon is the one deliberate
   callback to the original WatchGuard card set's banner shape. */
.card-slot { perspective: 1200px; }
.card {
  width: 220px;
  min-height: 300px;
  border-radius: 10px;
  background: var(--glass);
  color: var(--card-ink);
  position: relative;
  box-shadow: 0 10px 34px rgba(0,0,0,0.65), 0 0 0 1px var(--glass-edge), 0 0 22px rgba(44,232,255,0.12);
  transform-style: preserve-3d;
  overflow: hidden;
  backdrop-filter: blur(1px);
}
.card.empty { background: transparent; box-shadow: none; border: 2px dashed rgba(207,227,238,0.2); }

/* Only the two inner faces rotate — the outer .card box never transforms.
   This avoids double-rotating the same axis (which mirrored the text)
   and avoids a flat, untransformed parent fighting a transformed child
   for click hit-testing. */
.card-back {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(45deg, #081018 0 8px, #0c1a24 8px 16px);
  display: flex; align-items: center; justify-content: center;
  backface-visibility: hidden;
  pointer-events: none;
  transform: rotateY(0deg);
  transition: transform 0.6s cubic-bezier(.2,.9,.25,1);
}
.card-back-mark {
  font-size: 3rem;
  color: var(--neon-cyan);
  text-shadow: 0 0 16px var(--neon-cyan);
}

.card-face {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  backface-visibility: hidden;
  transform: rotateY(180deg);
  transition: transform 0.6s cubic-bezier(.2,.9,.25,1);
}

.card.flip .card-back { transform: rotateY(180deg); }
.card.flip .card-face { transform: rotateY(0deg); }

.card-ribbon {
  background: linear-gradient(90deg, #7a0010, var(--neon-red) 55%, #7a0010);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  text-align: center;
  padding: 9px 6px 7px;
  font-size: 0.82rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.2;
  border-bottom: 1px solid rgba(44,232,255,0.4);
}
.card-icon {
  text-align: center;
  font-size: 2.4rem;
  padding: 12px 0 4px;
  filter: drop-shadow(0 0 8px rgba(44,232,255,0.25));
}
.card-blurb {
  font-size: 0.62rem;
  text-align: center;
  padding: 0 12px;
  color: var(--text-dim);
  min-height: 34px;
  line-height: 1.25;
}
.card-stats { padding: 6px 12px 12px; margin-top: auto; }
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(44,232,255,0.28);
  border-radius: 5px;
  padding: 3px 8px;
  margin-bottom: 4px;
  background: rgba(44,232,255,0.06);
  font-family: var(--font-data);
  font-size: 0.72rem;
  color: var(--card-ink);
}
.stat-row .stat-name { letter-spacing: 0.5px; text-transform: uppercase; font-size: 0.6rem; color: var(--text-dim); }
.stat-row .stat-val { font-weight: 700; font-size: 0.9rem; color: var(--neon-cyan); }
.stat-row.picked { background: rgba(255,181,69,0.18); box-shadow: 0 0 0 2px var(--amber) inset; }
.stat-row.picked .stat-val { color: var(--amber); }
.stat-row.win { background: rgba(57,255,140,0.18); box-shadow: 0 0 0 2px var(--term-grn) inset; }
.stat-row.win .stat-val { color: var(--term-grn); }
.stat-row.lose { background: rgba(255,43,63,0.18); box-shadow: 0 0 0 2px var(--neon-red) inset; }
.stat-row.lose .stat-val { color: var(--neon-red); }

/* clickable stat rows on the player's face-up card */
.stat-row.clickable { cursor: pointer; transition: transform 0.15s ease, background 0.15s ease; }
.stat-row.clickable:hover { transform: translateX(3px); background: rgba(44,232,255,0.16); }
.stat-row.clickable:focus-visible { outline: 2px solid var(--term-grn); outline-offset: 2px; }

/* ---------- center console ---------- */
.center-console {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 320px;
  width: 100%;
}
.round-banner {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--glass-edge);
  padding: 6px 18px;
  border-radius: 4px;
  letter-spacing: 3px;
  font-size: 0.9rem;
  text-transform: uppercase;
  box-shadow: 0 0 14px rgba(44,232,255,0.15);
}
.log {
  width: 100%;
  max-width: 320px;
  min-height: 200px;
  background: rgba(2,6,9,0.7);
  border: 1px solid rgba(57,255,140,0.28);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--term-grn);
  overflow-y: auto;
  max-height: 260px;
}
.log p { margin: 0 0 8px; opacity: 0; animation: typeIn 0.4s ease forwards; }
.log p.dim { color: var(--text-dim); }
.log p.win { color: var(--term-grn); font-weight: 700; }
.log p.lose { color: var(--neon-red); font-weight: 700; }
@keyframes typeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.pile-count {
  font-family: var(--font-data);
  color: var(--text-dim);
  font-size: 0.85rem;
  letter-spacing: 1px;
}

/* ---------- game over ---------- */
.game-over-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(2,4,6,0.9);
  display: flex; align-items: center; justify-content: center;
}
.game-over-box {
  text-align: center;
  background: var(--panel);
  border: 2px solid var(--neon-cyan);
  padding: 36px 40px;
  border-radius: 8px;
  box-shadow: 0 0 44px rgba(44,232,255,0.4);
}
.game-over-box h2 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--neon-cyan);
  font-size: 2rem;
  letter-spacing: 3px;
  margin: 0 0 12px;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(44,232,255,0.7);
}
.game-over-box p { font-family: var(--font-mono); color: var(--text); margin-bottom: 20px; }

/* The intro "enter" button is absolutely centered on the whole viewport
   (needed for the doors overlay). The restart button reuses its look but
   must flow normally inside the game-over box, or it centers over the
   text instead of sitting below it. */
.game-over-box .enter-btn {
  position: static;
  transform: none;
  animation: none;
  display: inline-block;
}

[hidden] { display: none !important; }
