/* Soft 17 — after-hours card room. */

:root {
  --ink: #0a1411;
  --ink-2: #0f1c18;
  --ink-3: #15251f;
  --felt: #12543f;
  --felt-deep: #0a3127;
  --rail: #23170f;
  --brass: #d9b46c;
  --brass-hi: #f0d595;
  --brass-lo: #a8823f;
  --ivory: #f5efe2;
  --text: #ebe5d6;
  --muted: #93a39a;
  --line: rgba(217, 180, 108, 0.2);
  --line-2: rgba(235, 229, 214, 0.1);
  --good: #5fd39a;
  --bad: #ff6a58;
  --warn: #f2c14e;

  --c-H: #ec8563;
  --c-S: #f1d49b;
  --c-D: #84c0e3;
  --c-P: #c6a8ea;
  --c-R: #b3b6c2;

  --display: 'Instrument Serif', 'Times New Roman', serif;
  --body: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;

  --cw: clamp(58px, 17vw, 96px);
  --radius: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 78% -12%, rgba(26, 104, 80, 0.38), transparent 62%),
    radial-gradient(900px 520px at -15% 115%, rgba(217, 180, 108, 0.07), transparent 60%),
    var(--ink);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--noise);
  opacity: 0.05;
  pointer-events: none;
  z-index: 100;
}
::selection { background: var(--brass); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 3px; border-radius: 8px; }
em { font-style: italic; }

kbd {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 5px;
  border: 1px solid currentColor;
  opacity: 0.45;
}
@media (hover: none) { kbd { display: none; } }

/* ---------- shell ---------- */

/* clip, not hidden: dealt cards fly in from off-screen without creating sideways scroll, and sticky still works */
.shell { min-height: 100dvh; display: flex; flex-direction: column; overflow-x: clip; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
  padding: 0 max(20px, env(safe-area-inset-left));
  background: rgba(10, 20, 17, 0.72);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { position: relative; width: 30px; height: 34px; }
.bm-card {
  position: absolute;
  width: 21px;
  height: 29px;
  border-radius: 4px;
  background: var(--ivory);
  color: var(--ink);
  font: italic 15px/29px var(--display);
  text-align: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}
.bm-a { left: 0; top: 2px; transform: rotate(-12deg); }
.bm-b { left: 9px; top: 3px; transform: rotate(9deg); color: #b3261e; outline: 1px solid var(--brass); outline-offset: -3px; }
.brand-word { font: 26px/1 var(--display); letter-spacing: -0.01em; }
.brand-word em { color: var(--brass); margin-left: 2px; }

.topnav { display: flex; gap: 4px; }
.topnav a {
  position: relative;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}
.topnav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.topnav a.is-on { color: var(--ink); background: var(--ivory); }
.topbar-note {
  margin-left: auto;
  font: 500 11px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 24px 72px;
  flex: 1;
}

.tabbar { display: none; }

@media (max-width: 760px) {
  .topnav, .topbar-note { display: none; }
  .topbar { height: 56px; justify-content: center; }
  .main { padding: 22px 16px calc(96px + env(safe-area-inset-bottom)); }
  /* play-screen padding lives after the play-layout rules below, so it isn't overridden */
  /* play screens: the tab bar is the nav, so the brand bar gives its height to the table */
  .shell:has(.stage) .topbar { display: none; }
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(10, 20, 17, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    border-radius: 12px;
  }
  .tabbar a.is-on { color: var(--brass-hi); background: rgba(217, 180, 108, 0.08); }
}

/* ---------- type & generic ---------- */

.eyebrow {
  margin: 0 0 14px;
  font: 500 11px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brass);
}
.lede { max-width: 58ch; margin: 0; font-size: 18px; color: #c9cfc4; font-weight: 300; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.gold { color: var(--brass-hi); }
.page-head { margin-bottom: 40px; }
.page-title {
  margin: 0 0 18px;
  font: 400 clamp(40px, 6.2vw, 72px)/0.98 var(--display);
  letter-spacing: -0.02em;
}
.page-title em, h1 em, .section-title em { color: var(--brass); }
.page-title.compact { font-size: clamp(30px, 4.4vw, 44px); margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s, opacity 0.2s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.35; }
.btn-brass {
  color: #1d1406;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 55%, var(--brass-lo));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset, 0 10px 26px -10px rgba(217, 180, 108, 0.7);
}
.btn-brass:hover:not(:disabled) { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset, 0 14px 34px -10px rgba(217, 180, 108, 0.9); }
.btn-ghost { border-color: var(--line); color: var(--text); background: rgba(255, 255, 255, 0.02); }
.btn-ghost:hover:not(:disabled) { border-color: rgba(217, 180, 108, 0.5); background: rgba(217, 180, 108, 0.06); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-lg { height: 58px; padding: 0 36px; font-size: 17px; }

.link {
  background: none;
  border: 0;
  padding: 6px 2px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}
.link:hover { color: var(--brass-hi); text-decoration-color: currentColor; }

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font: 600 10px/1 var(--mono);
}

.seg {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.03);
}
.seg button {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--ivory); color: var(--ink); }
.seg-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-scroll::-webkit-scrollbar { display: none; }

.toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line-2);
  transition: background 0.2s;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.25s var(--ease), background 0.2s;
}
.toggle input:checked + .toggle-track { background: rgba(217, 180, 108, 0.3); border-color: var(--brass-lo); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); background: var(--brass-hi); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--brass-hi); outline-offset: 2px; }

.rise { animation: rise 0.7s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- playing cards ---------- */

.pcard {
  flex: none;
  width: var(--cw);
  aspect-ratio: 5 / 7;
  perspective: 900px;
  animation: deal 0.5s var(--ease) both;
}
@keyframes deal {
  from { opacity: 0; transform: translate(34vw, -28vh) rotate(28deg) scale(0.9); }
  55% { opacity: 1; }
}
.pcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.35, 0.8, 0.25, 1);
}
.pcard.is-down .pcard-inner { transform: rotateY(180deg); }
.pcard-face, .pcard-back {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--cw) * 0.085);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.pcard-face {
  background: linear-gradient(155deg, #fffbf2 0%, #f3ead7 60%, #e9dec6 100%);
  color: #1b1916;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    0 14px 26px -12px rgba(0, 0, 0, 0.75),
    0 2px 4px rgba(0, 0, 0, 0.35);
}
.pcard-face.red { color: #b3261e; }
.pc-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.92;
}
.pc-corner b { font: 400 calc(var(--cw) * 0.25) / 0.9 var(--display); letter-spacing: -0.04em; }
.pc-corner i { font-style: normal; font-size: calc(var(--cw) * 0.15); }
.pc-corner.tl { top: 6%; left: 8%; }
.pc-corner.br { bottom: 6%; right: 8%; transform: rotate(180deg); }
.pc-mid {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--cw) * 0.44);
}
.pc-mid.is-ace { font-size: calc(var(--cw) * 0.6); }
.pc-mid.is-face { font: italic 400 calc(var(--cw) * 0.62) / 1 var(--display); }
.pc-mid.is-face::before {
  content: '';
  position: absolute;
  inset: 17% 20%;
  border: 1px solid currentColor;
  border-radius: calc(var(--cw) * 0.05);
  opacity: 0.22;
}
.pcard-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 50% 50%, rgba(217, 180, 108, 0.35) 0 9%, transparent 9.5%),
    repeating-linear-gradient(45deg, #15523f 0 3px, #0d3a2d 3px 7px),
    #0d3a2d;
  border: calc(var(--cw) * 0.045) solid #f2ead8;
  box-shadow: 0 14px 26px -12px rgba(0, 0, 0, 0.75), 0 2px 4px rgba(0, 0, 0, 0.35);
}
.pcard-back::after {
  content: '';
  position: absolute;
  inset: 6%;
  border: 1px solid rgba(217, 180, 108, 0.6);
  border-radius: calc(var(--cw) * 0.05);
}

/* ---------- hands ---------- */

.hand { display: flex; flex-direction: column; align-items: center; gap: 10px; transition: opacity 0.4s; }
.hand-cards { display: flex; align-items: flex-start; }
.hand-cards .pcard + .pcard { margin-left: calc(var(--cw) * -0.5); }
.hand-cards .pcard:nth-child(n + 3) { margin-top: calc(var(--cw) * 0.08); }
.hand-meta { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.total {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(5, 14, 11, 0.6);
  border: 1px solid rgba(217, 180, 108, 0.4);
  font: 600 14px/1.3 var(--mono);
  color: var(--ivory);
  animation: pop 0.35s var(--ease);
}
.total small { font-size: 10px; font-weight: 500; color: var(--brass); text-transform: uppercase; letter-spacing: 0.06em; }
.total.is-bust { border-color: var(--bad); color: var(--bad); }
.hand-bet {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brass);
  color: #1d1406;
  font: 600 12px/1.3 var(--mono);
}
.hand-label { font-size: 12px; color: var(--muted); }
.hand.is-active .hand-cards { filter: drop-shadow(0 0 16px rgba(240, 213, 149, 0.45)); }
.hand.is-active .total { background: var(--brass-hi); color: #1d1406; }
.hand.o-lose, .hand.o-bust, .hand.o-surrender { opacity: 0.55; }
.hand.o-win .total, .hand.o-blackjack .total { background: var(--good); color: #052014; border-color: var(--good); }
.hand.o-blackjack .hand-cards { filter: drop-shadow(0 0 22px rgba(240, 213, 149, 0.6)); }
.hand-ghost { height: calc(var(--cw) * 1.4 + 36px); }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }

/* ---------- felt ---------- */

.felt {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  flex: 1 1 0;
  min-width: 0;
  /* size container: cards scale to the felt's height (see .seat) */
  container-type: size;
  padding: 24px 16px 30px;
  border-radius: 34px 34px 50% 50% / 34px 34px 26% 26%;
  background:
    radial-gradient(ellipse 70% 60% at 50% 38%, #1a6a50 0%, var(--felt) 45%, var(--felt-deep) 100%);
  box-shadow:
    0 0 0 9px var(--rail),
    0 0 0 10px rgba(217, 180, 108, 0.55),
    0 40px 70px -30px rgba(0, 0, 0, 0.9),
    inset 0 2px 40px rgba(0, 0, 0, 0.45);
  margin: 10px;
  transition: box-shadow 0.3s;
}
.felt::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--noise);
  opacity: 0.22;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: -1;
}
.felt::after {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: inherit;
  border: 1px solid rgba(217, 180, 108, 0.18);
  pointer-events: none;
  z-index: -1;
}
.felt-arc {
  position: absolute;
  left: 50%;
  top: 54%;
  width: min(480px, 92%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
}
.arc-main { font: 400 25px var(--display); letter-spacing: 0.16em; fill: rgba(240, 213, 149, 0.42); }
.arc-sub { font: 500 10.5px var(--mono); letter-spacing: 0.22em; text-transform: uppercase; fill: rgba(240, 213, 149, 0.3); }
.felt.flash-good { animation: flashGood 0.7s ease-out; }
.felt.flash-bad { animation: flashBad 0.7s ease-out; }
@keyframes flashGood {
  0% { box-shadow: 0 0 0 9px var(--rail), 0 0 0 10px var(--good), 0 0 60px 8px rgba(95, 211, 154, 0.45), inset 0 2px 40px rgba(0, 0, 0, 0.45); }
}
@keyframes flashBad {
  0% { box-shadow: 0 0 0 9px var(--rail), 0 0 0 10px var(--bad), 0 0 60px 8px rgba(255, 106, 88, 0.45), inset 0 2px 40px rgba(0, 0, 0, 0.45); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
}
.seat {
  /* two hands stacked in the felt's content box: 2 × (1.4 × card + label + total) */
  --cw: clamp(34px, min(17vw, calc((100cqh - 125px) / 2.8)), 100px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.is-many .seat { --cw: clamp(28px, min(calc((100cqh - 125px) / 2.8), calc((100cqw - 90px) / 9)), 80px); }
@container (max-height: 300px) { .felt-arc { display: none; } }

/* ---------- play layout: fill the viewport, never scroll the page ---------- */

.main:has(> .stage) { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; padding-bottom: 16px; }
.main:has(> .stage) > * { flex: none; margin-top: 0; margin-bottom: 0; }
.main:has(> .stage) > .stage { position: relative; flex: 1 1 0; min-height: 250px; display: flex; gap: 20px; }
@media (max-width: 760px) {
  /* bottom padding keeps the action bar and toggles above the fixed tab bar */
  .main:has(> .stage) { padding: calc(10px + env(safe-area-inset-top)) 12px calc(76px + env(safe-area-inset-bottom)); gap: 10px; }
  .main:has(> .stage) > .stage { min-height: 180px; }
}
.main:has(> .blitz-intro) { display: flex; flex-direction: column; justify-content: center; }
.seat-label {
  font: 500 10px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: rgba(240, 213, 149, 0.55);
}

/* ---------- action bar ---------- */

.actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
}
.act {
  --c: var(--c-H);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 66px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  transition: transform 0.12s var(--ease), background 0.2s, border-color 0.2s, opacity 0.2s;
}
.act::before {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--c);
  transition: left 0.2s, right 0.2s;
}
.act-S { --c: var(--c-S); }
.act-D { --c: var(--c-D); }
.act-P { --c: var(--c-P); }
.act-R { --c: var(--c-R); }
.act:hover:not(:disabled) { border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); }
.act:hover:not(:disabled)::before { left: 0; right: 0; }
.act:active:not(:disabled) { transform: scale(0.96); }
.act:disabled { opacity: 0.28; }
.act kbd { font-size: 9px; }
.act-keys { display: inline-flex; gap: 4px; }
.act.is-best { background: var(--good); color: #052014; border-color: var(--good); opacity: 1; }
.act.is-best::before { background: #052014; }
.act.is-wrong { background: var(--bad); color: #2a0703; border-color: var(--bad); opacity: 1; }
.act.is-dim { opacity: 0.25; }
.act.is-hint { animation: hint 1.1s ease-in-out infinite; border-color: var(--brass-hi); }
@keyframes hint { 50% { box-shadow: 0 0 0 4px rgba(240, 213, 149, 0.35), 0 0 30px rgba(240, 213, 149, 0.35); } }

@media (max-width: 480px) {
  .actions { gap: 6px; }
  .act { height: 60px; font-size: 13px; border-radius: 14px; }
}

/* ---------- chart ---------- */

.cell {
  display: grid;
  place-items: center;
  height: 34px;
  border-radius: 6px;
  border: 0;
  padding: 0;
  font: 600 13px/1 var(--mono);
  color: #17120b;
  transition: transform 0.15s var(--ease), box-shadow 0.15s, opacity 0.2s;
}
button.cell:hover { transform: scale(1.08); z-index: 2; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }
.code-H { background: var(--c-H); }
.code-S { background: var(--c-S); }
.code-D { background: var(--c-D); }
.code-Ds { background: linear-gradient(135deg, var(--c-D) 0 52%, var(--c-S) 52%); }
.code-P { background: var(--c-P); }
.code-Rh { background: linear-gradient(135deg, var(--c-R) 0 52%, var(--c-H) 52%); }
.cell.is-hl { position: relative; z-index: 3; transform: scale(1.12); box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--ivory), 0 8px 20px rgba(0, 0, 0, 0.5); }
.cell.m-none { opacity: 0.22; }
.cell.m-bad { box-shadow: inset 0 0 0 3px var(--bad); }
.cell.m-mid { box-shadow: inset 0 0 0 3px #e5a93c; }
.cell.m-good { box-shadow: inset 0 0 0 3px #1f9e62; }
.cell.m-good.is-hl, .cell.m-bad.is-hl, .cell.m-mid.is-hl { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--ivory); }
.code-H-text { color: var(--c-H); }
.code-S-text { color: var(--c-S); }
.code-D-text, .code-Ds-text { color: var(--c-D); }
.code-P-text { color: var(--c-P); }
.code-Rh-text { color: var(--c-R); }

.chart-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.chart { display: flex; flex-direction: column; gap: 4px; }
.chart-head, .chart-line { display: grid; grid-template-columns: 56px repeat(10, minmax(0, 1fr)); gap: 4px; }
.chart-head span {
  display: grid;
  place-items: center;
  height: 30px;
  font: 600 13px/1 var(--mono);
  color: var(--brass);
}
.chart-head .corner { font: 500 9px/1.1 var(--mono); color: var(--muted); text-align: center; letter-spacing: 0.04em; }
.row-label { display: grid; place-items: center start; padding-left: 6px; font: 600 13px/1 var(--mono); color: var(--text); }

.detail {
  position: sticky;
  top: 88px;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--ink-3), var(--ink-2));
  animation: rise 0.4s var(--ease);
  --cw: 62px;
}
.detail-cards { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line-2); }
.detail-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.detail-side .hand-meta { min-height: 0; }
.mini-label { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted); }
.detail-sit { margin: 16px 0 2px; font-size: 14px; color: var(--muted); }
.detail-move { margin: 0 0 10px; font: 400 36px/1.05 var(--display); }
.detail-why { margin: 0; font-size: 15px; color: #d3d8cf; }
.detail-you { margin: 14px 0 0; font: 500 12px var(--mono); color: var(--brass); }

.legend { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 22px; font-size: 13px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 8px; }
.legend .cell { width: 30px; height: 24px; font-size: 11px; }
.legend-break { padding-left: 20px; border-left: 1px solid var(--line-2); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.dot.good { background: #1f9e62; }
.dot.mid { background: #e5a93c; }
.dot.bad { background: var(--bad); }

.chart-row { margin-top: 16px; }
.chart-row-head, .chart-row-cells { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.chart-row-head span { text-align: center; font: 600 11px/1.8 var(--mono); color: var(--muted); }
.chart-row-head span.is-hl { color: var(--ivory); }
.chart-row .cell { height: 30px; font-size: 12px; }

@media (max-width: 860px) {
  .chart-wrap { grid-template-columns: 1fr; }
  .detail { position: static; }
}
@media (max-width: 480px) {
  .chart-head, .chart-line { grid-template-columns: 40px repeat(10, minmax(0, 1fr)); gap: 3px; }
  .cell { height: 28px; font-size: 11px; border-radius: 5px; }
  .chart-head span { font-size: 11px; }
  .chart-head .corner { font-size: 7px; }
  .row-label { font-size: 11px; padding-left: 2px; }
  .chart-row-head, .chart-row-cells { gap: 3px; }
}

/* ---------- home ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
  padding: 28px 0 64px;
}
.hero h1 {
  margin: 0 0 24px;
  font: 400 clamp(46px, 7.2vw, 92px)/0.94 var(--display);
  letter-spacing: -0.025em;
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-ctas.center { justify-content: center; }
.hero-art { display: grid; place-items: center; }
.hero-felt {
  --cw: clamp(78px, 11vw, 112px);
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1 / 1.05;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 26px;
  border-radius: 50% 50% 46% 46% / 44% 44% 56% 56%;
  background: radial-gradient(ellipse at 50% 40%, #1b6d52, var(--felt) 50%, var(--felt-deep));
  box-shadow: 0 0 0 9px var(--rail), 0 0 0 10px rgba(217, 180, 108, 0.55), 0 50px 80px -30px rgba(0, 0, 0, 0.9), inset 0 2px 40px rgba(0, 0, 0, 0.45);
  transform: rotate(-3deg);
}
.hero-felt::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--noise);
  opacity: 0.22;
  mix-blend-mode: overlay;
}
.hero-dealer, .hero-player { position: relative; display: flex; align-items: center; gap: 12px; }
.hero-player .pcard:first-child { transform: rotate(-8deg); }
.hero-player .pcard + .pcard { margin-left: calc(var(--cw) * -0.42); transform: rotate(7deg) translateY(4px); }
.hero-tag { font: 500 10px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: rgba(240, 213, 149, 0.6); }
.hero-answer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 18px;
  border-radius: 999px;
  background: rgba(5, 14, 11, 0.7);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  animation: rise 0.6s 0.9s var(--ease) both;
}
.hero-answer b { padding: 6px 14px; border-radius: 999px; background: var(--c-D); color: #0b1a24; font-weight: 600; }

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.mode {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  padding: 26px 22px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--ink-3), var(--ink-2));
  overflow: hidden;
  transition: transform 0.35s var(--ease), border-color 0.3s;
}
.mode::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(400px 220px at 100% 0%, rgba(217, 180, 108, 0.13), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s;
}
.mode:hover { transform: translateY(-4px); border-color: var(--line); }
.mode:hover::after { opacity: 1; }
.mode-num { font: italic 400 54px/0.9 var(--display); color: var(--brass); margin-bottom: 24px; }
.mode h2 { margin: 0 0 10px; font: 400 30px/1 var(--display); }
.mode p { margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.mode-stat { margin-top: auto; font: 500 11px/1.4 var(--mono); color: #c9cfc4; letter-spacing: 0.04em; }
.mode-cta { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); font-size: 14px; font-weight: 600; color: var(--brass-hi); }
.mode-cta span { display: inline-block; transition: transform 0.3s var(--ease); }
.mode:hover .mode-cta span, .session:hover .mode-cta span { transform: translateX(5px); }

.progress {
  margin-top: 56px;
  padding: 32px;
  border-radius: 24px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(21, 37, 31, 0.8), rgba(15, 28, 24, 0.6));
}
.progress-head { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: end; margin-bottom: 28px; }
.progress-head .muted { max-width: 52ch; margin: 0; font-size: 14px; }
.section-title { margin: 0 0 12px; font: 400 clamp(40px, 5vw, 60px)/1 var(--display); }
.section-title .unit { font-size: 0.55em; color: var(--muted); margin-left: 2px; }
.progress-stats { display: grid; grid-template-columns: repeat(4, auto); gap: 28px; }
.progress-stats div, .result-grid div { display: flex; flex-direction: column; gap: 4px; }
.progress-stats b, .result-grid b { font: 500 26px/1 var(--mono); color: var(--ivory); }
.progress-stats span, .result-grid span { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }

.memmap { --sq: 20px; display: flex; flex-wrap: wrap; gap: 28px 48px; align-items: flex-start; }
.memmap-group { display: flex; flex-direction: column; gap: 10px; }
.memmap-name { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted); }
.memmap-grid { display: grid; grid-template-columns: repeat(10, var(--sq)); grid-auto-rows: var(--sq); gap: 4px; }
.mm { display: block; width: var(--sq); aspect-ratio: 1; border-radius: 4px; background: rgba(255, 255, 255, 0.06); transition: transform 0.2s; }
.memmap-grid .mm:hover { transform: scale(1.5); }
.mm.l1 { background: #c4473a; }
.mm.l2 { background: #8a6d36; }
.mm.l3 { background: var(--brass-hi); box-shadow: 0 0 8px rgba(240, 213, 149, 0.4); }
.memmap-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 22px; font-size: 12px; color: var(--muted); }
.memmap-legend span { display: inline-flex; align-items: center; gap: 8px; }
.memmap-legend .mm { width: 12px; border-radius: 3px; }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--line-2);
  font: 500 11px/1.6 var(--mono);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.foot p { margin: 0; }
.progress-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 2px 18px; }
.tools-msg { width: 100%; margin: 4px 0 0; text-align: right; font: 500 12px/1.4 var(--body); letter-spacing: 0; }
.tools-msg.is-good { color: var(--good); }
.tools-msg.is-bad { color: var(--bad); }
@media (max-width: 560px) { .progress-tools { justify-content: flex-start; } .tools-msg { text-align: left; } }

@media (max-width: 980px) {
  .modes { grid-template-columns: repeat(2, 1fr); }
  .progress-head { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 8px 0 44px; }
  .hero-felt { width: min(88%, 340px); }
  .memmap { --sq: min(20px, calc((100vw - 110px) / 10 - 4px)); gap: 22px 28px; }
  .progress { padding: 22px 18px; }
  .progress-stats { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}
@media (max-width: 520px) {
  .modes { grid-template-columns: 1fr; }
  .mode { min-height: 0; }
  .mode-num { font-size: 42px; margin-bottom: 14px; }
}

/* ---------- learn ---------- */

.block {
  margin-bottom: 28px;
  padding: 30px;
  border-radius: 24px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(21, 37, 31, 0.7), rgba(15, 28, 24, 0.5));
}
.block-title { margin: 0 0 22px; font: 400 32px/1.05 var(--display); }
.block-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; margin-bottom: 22px; }
.block-bar .block-title { margin: 0 auto 0 0; }
.block > .muted.small { margin: 18px 0 0; max-width: 80ch; }

.moves { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.move-tile {
  position: relative;
  padding: 18px 16px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line-2);
  overflow: hidden;
}
.move-tile::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; }
.code-H-edge::before { background: var(--c-H); }
.code-S-edge::before { background: var(--c-S); }
.code-D-edge::before { background: var(--c-D); }
.code-P-edge::before { background: var(--c-P); }
.code-Rh-edge::before { background: var(--c-R); }
.move-tile kbd { position: absolute; top: 14px; right: 14px; }
.move-tile h3 { margin: 0 0 6px; font: 400 26px/1 var(--display); }
.move-tile p { margin: 0; font-size: 13px; color: var(--muted); }

.rules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.rule-group h3 { margin: 0 0 12px; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.18em; color: var(--brass); }
.rule-group ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.rule-group li { position: relative; padding-left: 16px; font-size: 14px; color: #d3d8cf; }
.rule-group li::before { content: '♠'; position: absolute; left: 0; top: 1px; font-size: 9px; color: var(--brass-lo); }

.hilo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 640px; }
.hilo-tile { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 14px; border: 1px solid var(--line-2); }
.hilo-tile b { font: 400 44px/1 var(--display); }
.hilo-tile span { font: 500 13px var(--mono); color: var(--muted); letter-spacing: 0.08em; }
.hilo-tile.plus b { color: var(--good); }
.hilo-tile.zero b { color: var(--muted); }
.hilo-tile.minus b { color: var(--bad); }

.cta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 30px;
  border-radius: 24px;
  background: linear-gradient(110deg, rgba(217, 180, 108, 0.16), rgba(217, 180, 108, 0.03));
  border: 1px solid var(--line);
}
.cta-strip p { margin: 0; font: 400 30px/1.1 var(--display); }

@media (max-width: 980px) {
  .moves { grid-template-columns: repeat(3, 1fr); }
  .rules { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .block { padding: 22px 14px; border-radius: 20px; }
  .moves { grid-template-columns: 1fr 1fr; }
  .rules { grid-template-columns: 1fr; }
  .hilo-tile { padding: 14px 10px; }
  .hilo-tile b { font-size: 34px; }
  .hilo-tile span { font-size: 11px; letter-spacing: 0; }
  .legend-break { padding-left: 0; border-left: 0; }
}

/* ---------- drill ---------- */

.play-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.play-head .eyebrow { margin-bottom: 10px; }

.scoreboard { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.streak { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.streak-num { font: 400 64px/0.9 var(--display); color: var(--ivory); animation: pop 0.4s var(--ease); }
.streak-label { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); }
.streak.is-record .streak-num { color: var(--brass-hi); text-shadow: 0 0 30px rgba(240, 213, 149, 0.45); }
.streak.is-record .streak-label { color: var(--brass); }
.score-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 78px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.02);
}
.score-mini b { font: 500 18px/1 var(--mono); }
.score-mini span { font: 500 9px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }

.verdict {
  flex: none;
  align-self: center;
  width: 340px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: var(--ink-2);
  animation: rise 0.35s var(--ease);
}
.verdict-idle { animation: none; background: transparent; border-style: dashed; }
.verdict-idle .verdict-title { color: var(--muted); }
.verdict-idle .verdict-why { color: var(--muted); font-size: 14px; }
.verdict-top .verdict-title { white-space: nowrap; }

/* Narrow screens: the verdict is a bottom sheet over the felt instead of taking space. */
@media (max-width: 999px) {
  .verdict {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;
    z-index: 10;
    width: auto;
    max-height: calc(100% - 12px);
    overflow-y: auto;
    padding: 14px 16px;
    background: rgba(13, 24, 20, 0.97);
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    animation: sheet 0.3s var(--ease);
  }
  .verdict.is-bad { background: linear-gradient(180deg, rgba(58, 22, 18, 0.97), rgba(13, 24, 20, 0.97)); }
  .verdict-idle { display: none; }
  .verdict.is-good .chart-row, .verdict.is-good .verdict-why { display: none; }
  .verdict-why { margin-top: 10px; font-size: 14px; }
  .verdict .chart-row { margin-top: 10px; }
}
@keyframes sheet { from { opacity: 0; transform: translateY(24px); } }
.verdict.is-good { border-color: rgba(95, 211, 154, 0.35); }
.verdict.is-bad { border-color: rgba(255, 106, 88, 0.45); background: linear-gradient(180deg, rgba(255, 106, 88, 0.07), var(--ink-2)); }
.verdict-top { display: flex; align-items: center; gap: 14px; }
.verdict-top .btn { margin-left: auto; }
.verdict-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
}
.is-good .verdict-mark { background: var(--good); color: #052014; }
.is-bad .verdict-mark { background: var(--bad); color: #2a0703; }
.verdict-title { margin: 0; font: 400 26px/1.1 var(--display); }
.verdict-sit { margin: 2px 0 0; font: 500 12px var(--mono); color: var(--muted); }
.verdict-why { margin: 14px 0 0; font-size: 15px; color: #d3d8cf; }

.play-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 24px; }
@media (hover: none) { .play-foot .muted { display: none; } }

.empty { padding: 60px 20px; text-align: center; }
.empty h2 { margin: 0 0 8px; font: 400 36px/1.1 var(--display); }
.empty .btn { margin-top: 18px; }

.drill-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.drill-top .scoreboard { margin: 0; }
.drill-top .streak { margin-right: 10px; }
.verdict-idle .eyebrow { margin-bottom: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 760px) {
  .drill-top .seg { order: -1; width: 100%; }
  .drill-top .scoreboard { width: 100%; }
  .drill-top .streak { margin-right: auto; }
}
@media (max-width: 560px) {
  .scoreboard { gap: 6px; }
  .streak-num { font-size: 40px; }
  .score-mini { min-width: 0; flex: 1; padding: 7px 4px; }
  .streak { margin-right: 6px; flex-direction: column; gap: 2px; align-items: center; }
  .felt { padding: 18px 8px 24px; margin: 9px 7px; }
  .verdict-title { font-size: 22px; }
}

/* ---------- blitz ---------- */

.blitz-intro { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 0; }
.giant { margin: 0 0 24px; font: 400 clamp(96px, 18vw, 180px)/0.85 var(--display); letter-spacing: -0.04em; }
.giant em { display: block; font-size: 0.32em; letter-spacing: -0.01em; color: var(--brass); }
.giant.is-record { color: var(--brass-hi); text-shadow: 0 0 60px rgba(240, 213, 149, 0.4); }
.blitz-rules { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 0 22px; padding: 0; list-style: none; }
.blitz-rules li { padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 14px; color: var(--muted); }
.blitz-rules b { font-family: var(--mono); color: var(--ivory); margin-right: 4px; }
.blitz-intro > .btn-lg { margin-top: 18px; }
.hero-ctas { align-items: center; }
.result-grid { display: grid; grid-template-columns: repeat(4, auto); gap: 32px; justify-content: center; margin: 8px 0 22px; }

.route-blitz .pcard { animation-duration: 0.28s; }
.blitz-hud { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; margin-bottom: 14px; }
.clock { display: flex; align-items: baseline; min-width: 76px; }
.clock-num { font: 400 56px/0.9 var(--display); font-variant-numeric: tabular-nums; }
.clock-unit { font: 500 14px var(--mono); color: var(--muted); margin-left: 3px; }
.clock.is-low .clock-num { color: var(--bad); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.timebar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.timebar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brass-lo), var(--brass-hi)); transform-origin: left; }
.hud-score { display: flex; align-items: center; gap: 10px; }
.hud-score b { font: 500 30px/1 var(--mono); min-width: 3ch; text-align: right; }
.combo {
  padding: 5px 10px;
  border-radius: 999px;
  font: 600 13px/1 var(--mono);
  color: var(--muted);
  border: 1px solid var(--line-2);
  animation: pop 0.3s var(--ease);
}
.combo.is-on { color: #1d1406; background: var(--brass-hi); border-color: var(--brass-hi); box-shadow: 0 0 24px rgba(240, 213, 149, 0.5); }
.miss-pop {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 22px;
  border-radius: 16px;
  background: rgba(10, 6, 5, 0.85);
  border: 1px solid var(--bad);
  transform: translate(-50%, -50%);
  animation: pop 0.25s var(--ease);
}
.miss-pop span { font: 500 11px var(--mono); color: var(--muted); }
.miss-pop b { font: 400 30px/1 var(--display); color: var(--good); }

@media (max-width: 560px) {
  .blitz-hud { gap: 12px; }
  .clock-num { font-size: 44px; }
  .hud-score b { font-size: 24px; }
  .result-grid { grid-template-columns: repeat(2, auto); gap: 20px 40px; }
}

/* ---------- table ---------- */

.resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-bottom: 16px;
  padding: 18px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--brass-lo);
  background: linear-gradient(110deg, rgba(217, 180, 108, 0.18), rgba(217, 180, 108, 0.04));
  text-align: left;
  font-size: 15px;
}
.resume b { color: var(--brass-hi); }

.sessions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.session {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px;
  min-height: 280px;
  border-radius: 24px;
  border: 1px solid var(--line-2);
  background:
    radial-gradient(500px 260px at 100% 0%, rgba(26, 104, 80, 0.35), transparent 70%),
    linear-gradient(180deg, var(--ink-3), var(--ink-2));
  text-align: left;
  transition: transform 0.35s var(--ease), border-color 0.3s;
}
.session:hover { transform: translateY(-4px); border-color: var(--line); }
.session h2 { margin: 0 0 10px; font: 400 44px/1 var(--display); }
.session p { margin: 0 0 22px; max-width: 36ch; color: var(--muted); font-size: 15px; }
.session .mode-cta { width: 100%; margin-top: auto; }
.session-chip {
  position: absolute;
  top: 24px;
  right: 24px;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font: 600 13px/1 var(--mono);
  color: var(--ivory);
  background:
    radial-gradient(circle, #1c1c1c 0 52%, transparent 53%),
    repeating-conic-gradient(#1c1c1c 0 20deg, var(--ivory) 20deg 40deg);
  box-shadow: 0 0 0 2px var(--brass-lo), 0 10px 20px rgba(0, 0, 0, 0.5);
}
.session-rec { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; font: 500 12px var(--mono); color: var(--muted); }
.session-rec b { color: var(--brass-hi); font-size: 15px; }
.foot-rules { margin: 24px 0 0; text-align: center; font: 500 11px/1.7 var(--mono); color: var(--muted); letter-spacing: 0.04em; }

.table-bar { display: flex; align-items: center; gap: 22px; margin-bottom: 8px; }
.bankroll { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 4px 10px; }
.bankroll-label { grid-column: 1 / -1; }
.bankroll-label { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted); }
.bankroll-num { font: 500 36px/1 var(--mono); color: var(--brass-hi); animation: pop 0.35s var(--ease); font-variant-numeric: tabular-nums; }
.table-info { display: flex; flex-wrap: wrap; gap: 6px; margin-right: auto; }
.table-info span { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); font: 500 12px/1 var(--mono); color: var(--muted); }
.table-info b { color: var(--text); font-weight: 600; }

.hands { display: flex; justify-content: center; align-items: flex-end; gap: 16px; }
.shoe {
  position: absolute;
  top: 22px;
  right: 26px;
  width: 34px;
  height: 48px;
  border-radius: 6px 6px 4px 4px;
  border: 1px solid rgba(217, 180, 108, 0.45);
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transform: skewX(-8deg);
}
.shoe span {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: calc((100% - 6px) * var(--fill));
  border-radius: 3px;
  background: repeating-linear-gradient(0deg, #f2ead8 0 1px, #d9cfb6 1px 3px);
  transition: height 0.4s;
}
.count-hud {
  position: absolute;
  top: 20px;
  left: 22px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(5, 14, 11, 0.65);
  border: 1px solid var(--line);
  font: 500 11px/1.3 var(--mono);
  color: var(--muted);
}
.count-hud b { color: var(--brass-hi); }
.shuffle-note {
  position: absolute;
  top: 78px;
  right: 14px;
  font: 500 9px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brass);
  animation: rise 0.5s var(--ease);
}
.bet-spot {
  display: grid;
  place-items: center;
  width: calc(var(--cw) * 1.5);
  height: calc(var(--cw) * 1.5);
  margin-bottom: 8px;
  border-radius: 50%;
  border: 2px dashed rgba(240, 213, 149, 0.45);
  text-align: center;
  transition: background 0.3s, border-color 0.3s;
}
.bet-spot.has-bet {
  border-style: solid;
  border-color: var(--brass);
  background: radial-gradient(circle, rgba(217, 180, 108, 0.22), transparent 70%);
}
.bet-amount { font: 500 15px/1.2 var(--mono); color: var(--ivory); padding: 0 8px; }
.has-bet .bet-amount { font-size: 22px; color: var(--brass-hi); }

.table-prompt, .round-result {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
}
.table-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(92%, 380px);
  padding: 18px;
  border-radius: 18px;
  background: rgba(5, 14, 11, 0.88);
  border: 1px solid var(--line);
  text-align: center;
  backdrop-filter: blur(6px);
}
.table-prompt p { margin: 0; font-size: 15px; }
.prompt-btns { display: flex; gap: 10px; }
.hand-result {
  padding: 3px 10px;
  border-radius: 999px;
  font: 600 12px/1.3 var(--mono);
  white-space: nowrap;
  background: rgba(5, 14, 11, 0.7);
  border: 1px solid var(--line-2);
  color: var(--muted);
  animation: pop 0.4s 0.2s var(--ease) both;
}
.o-win .hand-result, .o-blackjack .hand-result { color: var(--good); border-color: rgba(95, 211, 154, 0.5); }
.o-lose .hand-result, .o-bust .hand-result, .o-surrender .hand-result { color: var(--bad); border-color: rgba(255, 106, 88, 0.5); }
.round-net { font: 600 16px/1 var(--mono); color: var(--muted); animation: pop 0.4s 0.2s var(--ease) both; }
.round-net.is-up { color: var(--good); }
.round-net.is-down { color: var(--bad); }

/* Fixed height so feedback appearing never shifts the table. */
.coach-slot { height: 46px; display: flex; justify-content: center; }
.coach-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.coach {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 720px;
  height: 100%;
  padding: 0 16px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.35;
  border: 1px solid var(--line-2);
  background: var(--ink-2);
  animation: rise 0.3s var(--ease);
}
.coach.is-bad { border-color: rgba(255, 106, 88, 0.5); background: linear-gradient(90deg, rgba(255, 106, 88, 0.1), var(--ink-2)); }
.coach.is-good { color: var(--muted); }
.coach-mark { flex: none; font-weight: 700; }
.coach.is-good .coach-mark { color: var(--good); }
.coach.is-bad .coach-mark { color: var(--bad); }

.table-controls { min-height: 66px; }
.bet-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px 32px; }
.chips { display: flex; gap: 12px; }
.chip {
  --chip: #b23a3a;
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--chip) 0 50%, transparent 51%),
    repeating-conic-gradient(var(--chip) 0 22.5deg, #f4eee1 22.5deg 45deg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 6px 0 -1px color-mix(in srgb, var(--chip) 55%, #000), 0 10px 18px rgba(0, 0, 0, 0.55);
  transition: transform 0.18s var(--ease), opacity 0.2s;
}
.chip::after {
  content: '';
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.55);
}
.chip span { position: relative; z-index: 1; font: 600 14px/1 var(--mono); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.chip:hover:not(:disabled) { transform: translateY(-4px); }
.chip:active:not(:disabled) { transform: translateY(1px) scale(0.95); }
.chip:disabled { opacity: 0.3; }
.chip-25 { --chip: #2f7d55; }
.chip-100 { --chip: #222; }
.chip-500 { --chip: #6c3fa3; }
.bet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bet-actions.center { justify-content: center; }

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 8, 6, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade 0.25s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(100%, 380px);
  padding: 28px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--ink-3), var(--ink-2));
  text-align: center;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
  animation: rise 0.4s var(--ease);
}
.modal h2 { margin: 0; font: 400 34px/1 var(--display); }
.modal .muted { margin: 0; }
.modal-wide { width: min(100%, 560px); padding: 34px 28px; }
.summary-title { font-size: clamp(56px, 12vw, 84px) !important; }
.summary-title em { color: var(--brass); font-size: 0.45em; }
.record-badge {
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--brass-hi);
  color: #1d1406;
  font: 600 11px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.count-input {
  width: 140px;
  height: 64px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ivory);
  text-align: center;
  font: 500 32px var(--mono);
}
.count-input:focus { outline: 2px solid var(--brass); }
.count-res { display: flex; flex-direction: column; gap: 6px; }
.count-res b { font: 400 30px/1 var(--display); }
.count-res.is-good b { color: var(--good); }
.count-res.is-bad b { color: var(--bad); }
.count-res span { font: 500 12px var(--mono); color: var(--muted); }

@media (max-width: 760px) {
  .sessions { grid-template-columns: 1fr; }
  .session { min-height: 0; padding: 24px 20px; }
  .session h2 { font-size: 36px; }
  .session-chip { width: 52px; height: 52px; font-size: 11px; top: 20px; right: 20px; }
}
@media (max-width: 560px) {
  .table-bar { gap: 6px 12px; flex-wrap: wrap; }
  .bankroll { grid-template-columns: auto auto auto; margin-right: auto; }
  .bankroll-label { grid-column: auto; }
  .bankroll-num { font-size: 26px; }
  .table-info { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .table-info span { flex: none; font-size: 11px; padding: 4px 8px; }
  .bet-row { gap: 10px; }
  .chips { gap: 10px; }
  .chip { width: 50px; height: 50px; }
  .chip::after { inset: 10px; }
  .chip span { font-size: 12px; }
  .coach-slot { height: 50px; }
  .coach { padding: 0 12px; font-size: 12.5px; }
  .shoe { top: 18px; right: 18px; width: 26px; height: 38px; }
  .count-hud { top: 14px; left: 14px; font-size: 10px; padding: 6px 9px; }
  .modal-wide .result-grid { grid-template-columns: repeat(2, auto); gap: 18px 40px; }
}

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