/* ── DESIGN TOKENS ─────────────────────────────────── */
:root {
  --bg:           #080d0a;
  --felt:         #1d6b40;            /* vivid casino green base */
  --felt-hi:      #379a59;            /* lit center of the felt */
  --felt-shadow:  #0b3a21;            /* darkened toward the rail */
  --felt-line:    rgba(150,225,180,.22); /* betting line ring near edge — faint sheen */
  --rim:          #161616;            /* black padded rail */
  --rim-hi:       #353535;            /* rail top highlight */
  --panel:        #0d1510;
  --panel-border: rgba(255,255,255,.06);
  --gold:         #c9a84c;
  --gold-hi:      #e8c97a;
  --gold-dim:     rgba(201,168,76,.15);
  --text:         #dceae1;
  --text-dim:     #5a7a65;
  --text-mid:     #9ab8a4;
  --correct:      #27ae60;
  --correct-bg:   rgba(39,174,96,.12);
  --wrong:        #c0392b;
  --wrong-bg:     rgba(192,57,43,.12);
  --r:            10px;

  --c-fold:  #161c18;
  --c-call:  #0b2d52;
  --c-open:  #0c3a1a;
  --c-3bet:  #3a0c18;
  --c-4bet:  #2a0c3a;

  --font-ui:   'Oxanium', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── TOPBAR ─────────────────────────────────────────── */
.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(0,0,0,.5);
  border-bottom: 1px solid rgba(201,168,76,.18);
  flex-shrink: 0;
}
.logo {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--gold);
}
.mode-tabs { display: flex; gap: 4px; }
.mode-tab {
  padding: 6px 18px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: .15s;
}
.mode-tab:hover { color: var(--text); border-color: var(--panel-border); }
.mode-tab.active { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }
.session-pill {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  letter-spacing: 1px;
}

/* ── MAIN LAYOUT ────────────────────────────────────── */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 190px 1fr 200px;
  gap: 0;
  min-height: 0;
}

/* ── PANELS ─────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}
.panel-right { border-right: none; border-left: 1px solid var(--panel-border); }

.control-group { display: flex; flex-direction: column; gap: 8px; }
.control-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--panel-border);
}

/* Segmented spot buttons */
.seg-buttons { display: flex; flex-direction: column; gap: 4px; }
.seg {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  transition: .15s;
}
.seg:hover { background: rgba(255,255,255,.04); color: var(--text); }
.seg.active { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }

/* Position grid buttons */
.pos-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.pos-btn {
  padding: 7px 4px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  text-align: center;
  transition: .15s;
}
.pos-btn:hover:not(:disabled) { background: rgba(255,255,255,.05); color: var(--text); }
.pos-btn.active { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }
/* P-011: spot/position with no data in the loaded pack — greyed, unclickable. */
.pos-btn:disabled, .seg:disabled { opacity: .3; cursor: default; }
.seg:disabled:hover { background: transparent; }

/* Mode row */
.mode-row { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.mode-label { font-size: 11px; color: var(--text-dim); font-weight: 500; }
.mini-select {
  background: #111;
  color: var(--text-mid);
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 11px;
  font-family: var(--font-body);
  cursor: pointer;
}

/* Toggles */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle-row input { display: none; }
.toggle-track {
  width: 34px; height: 18px;
  border-radius: 9px;
  background: #1a2a20;
  border: 1px solid #2a3a2a;
  position: relative;
  flex-shrink: 0;
  transition: .2s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: .2s;
}
.toggle-row input:checked + .toggle-track { background: var(--gold-dim); border-color: var(--gold); }
.toggle-row input:checked + .toggle-track::after { left: 18px; background: var(--gold); }
.toggle-text { font-size: 12px; color: var(--text-mid); font-weight: 500; }

/* Deal button */
.deal-btn {
  width: 100%;
  padding: 12px;
  margin-top: auto;
  border-radius: 8px;
  border: 1px solid var(--gold);
  background: var(--gold-dim);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: .15s;
}
.deal-btn:hover { background: rgba(201,168,76,.28); }
.deal-btn:active { transform: scale(.98); }

/* ── TABLE SECTION ──────────────────────────────────── */
.table-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 24px 20px;
  gap: 14px;
  min-width: 0;
}

.spot-line {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Table — stadium / racetrack shape (elongated ~2:1, not a circle).
   border-radius:9999px makes CSS cap the radius at half the height → clean
   stadium at any box size (handy for future responsive scaling). */
.table-wrap {
  position: relative;
  width: 680px;
  height: 330px;
  flex-shrink: 0;
}
/* Black padded rail — volumetric: lit at the top edge, dark and shadowed
   at the bottom, with an outer drop shadow that lifts the table off the bg. */
.table-rim {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background:
    linear-gradient(to bottom, var(--rim-hi) 0%, var(--rim) 42%, #050505 100%);
  box-shadow:
    0 14px 44px rgba(0,0,0,.75),            /* table lifts off the page */
    0 0 0 1px #000,                         /* crisp outer edge */
    inset 0 2px 2px rgba(255,255,255,.14),  /* top highlight on the rail */
    inset 0 -4px 8px rgba(0,0,0,.65);       /* rail rounds away at the bottom */
}
/* Vivid casino felt: lit in the center, falling off to a dark vignette near
   the rail. A dark seam at the very edge separates felt from the black rail. */
.table-felt {
  position: absolute;
  inset: 16px;
  border-radius: 9999px;
  background:
    radial-gradient(ellipse 76% 92% at 50% 40%,
      var(--felt-hi)     0%,
      var(--felt)        46%,
      var(--felt-shadow) 100%);
  box-shadow:
    inset 0 0 70px rgba(0,0,0,.45),         /* soft vignette toward the rail */
    inset 0 2px 5px rgba(0,0,0,.55),        /* shadow cast by the rail above */
    0 0 0 2px rgba(0,0,0,.45);              /* dark seam at the felt edge */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Betting line — the lit ring just inside the rail, like a real casino table.
   (Replaces the old grid-texture placeholder.) */
.table-felt::before {
  content: '';
  position: absolute;
  inset: 13px;
  border-radius: 9999px;
  border: 1px solid var(--felt-line);
  box-shadow: 0 1px 1px rgba(0,0,0,.25);    /* line sits in the felt */
  pointer-events: none;
}

/* Action log sits just above the pot in open felt — clear of the top seats,
   which used to collide with it when it was pinned to the felt's top edge. */
.action-log {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 500;
  color: rgba(220,230,220,.45);
  letter-spacing: .5px;
  white-space: nowrap;
  z-index: 2;
  max-width: 460px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pot-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 3;
  background: rgba(0,0,0,.28);
  border-radius: 8px;
  padding: 6px 14px;
}
.pot-label { font-family: var(--font-ui); font-size: 9px; letter-spacing: 2px; color: var(--text-dim); }
.pot-value { font-family: var(--font-ui); font-size: 18px; font-weight: 700; color: var(--gold-hi); }

/* P-011 empty-state banner — centred in the felt when a spot has no data. */
.drill-empty {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 70%;
  text-align: center;
  background: rgba(0,0,0,.42);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 10px;
  padding: 14px 20px;
}
.drill-empty .de-title {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-hi);
}
.drill-empty .de-hint {
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-mid);
}

/* Timer ring SVG */
.timer-ring {
  position: absolute;
  inset: 16px;
  pointer-events: none;
  z-index: 5;
}
#timerArc { transition: stroke-dashoffset .1s linear, stroke .3s; }

/* ── SEATS ──────────────────────────────────────────── */
.seats { position: absolute; inset: 0; pointer-events: none; }
.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  z-index: 6;
}

/* Seat positions are set dynamically in JS (hero always at bottom center) */

/* Folded player: cards hidden (via JS) + whole seat dims */
.seat.is-folded { opacity: .34; filter: grayscale(.6); }

/* Hole cards tucked BEHIND the avatar, peeking out toward the board — like GG.
   Hero shows real cards in the separate .hero-cards element, so hero has none. */
.seat-avatar { position: relative; }
.seat-cards {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  z-index: 0;            /* behind the avatar token (circle is z-index 1) */
}
/* Universal: cards always above the position token, stack always below it. */
.seat-cards { bottom: 30px; }
.seat.is-folded .seat-cards { visibility: hidden; }
.mini-back {
  width: 28px; height: 39px;
  border-radius: 5px;
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,.18) 0 3px, rgba(255,255,255,.05) 3px 6px),
    linear-gradient(135deg, #1d3a6e 0%, #0a1428 100%);
  border: 1px solid rgba(120,160,220,.38);
  box-shadow: 0 2px 8px rgba(0,0,0,.55);
  position: relative;
}
.mini-back::after {
  content: '';
  position: absolute; inset: 3px;
  border-radius: 3px;
  border: 1px solid rgba(150,185,235,.30);
}
.mini-back.b1 { transform: rotate(-8deg) translateX(5px); }
.mini-back.b2 { transform: rotate(8deg) translateX(-5px); margin-left: -9px; }

.seat-circle {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: #0e1a12;
  border: 2px solid #2a3a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  color: #4a6a54;
  letter-spacing: .5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
  position: relative;
  z-index: 1;            /* sits on top of the tucked-in hole cards */
}
.seat-circle.is-hero {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 18px rgba(201,168,76,.25), 0 2px 8px rgba(0,0,0,.5);
}
.seat-circle.is-villain {
  border-color: #c0392b;
  color: #e74c3c;
  box-shadow: 0 0 14px rgba(192,57,43,.25), 0 2px 8px rgba(0,0,0,.5);
}
.seat-circle.is-dealer::after {
  content: 'D';
  position: absolute;
  top: -5px; right: -5px;
  width: 16px; height: 16px;
  background: var(--gold);
  color: #111;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.seat-name {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.seat-name.is-hero { color: var(--gold); }
/* Stack reads on any felt color: light text on a subtle dark pill (same
   language as .pot-block). The opaque pill also masks the betting line
   passing behind it, so the ring no longer "cuts" the number. */
.seat-stack {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .3px;
  background: rgba(0,0,0,.45);
  padding: 1px 8px;
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(0,0,0,.45);
}

/* ── LEGACY bet chips (flat tokens) ──────────────────────────────────
   Kept for the FROZEN postflop module (postflop.js still uses
   .bet-chip .chip-open). Drill/Learn now use the denominated chip-stack
   system below. Don't extend these — see docs/design.md "Фишки". */
.bet-chip {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 800;
  z-index: 7;
  box-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.chip-sb   { background: #666; border: 2px solid #999; color: #fff; }
.chip-bb   { background: #8b6914; border: 2px solid var(--gold); color: var(--gold); }
.chip-open { background: #0d3560; border: 2px solid #3a80c0; color: #7ec8ff; }
.chip-3bet { background: #4a0d18; border: 2px solid #c0392b; color: #ff7a8a; }

/* ── DENOMINATED CHIP STACKS ──────────────────────────────────────────
   Cash model: a bet is a stack of denominated discs (colour = denom,
   all discs one diameter). The pot is the same discs grouped per denom
   into stacks side by side. Built in JS (renderChips, drill.js); see the
   reference prototype static/chips_preview.html and docs/design.md.   */
.chip-stack, .chip-pot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.chip-stack { z-index: 7; }          /* player bets sit above seats (z 6) */
.chip-pot   { z-index: 4; gap: 5px; } /* collected pot, just under POT text */

.coins { position: relative; }
.coin {
  position: absolute; left: 0;
  width: var(--cw, 19px); height: var(--ch, 8px);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255,255,255,.30), rgba(255,255,255,0) 55%),
    repeating-conic-gradient(from var(--rot,0deg),
      var(--edge) 0deg 16deg, var(--body) 16deg 60deg);
  box-shadow:
    inset 0 1.5px 1px rgba(255,255,255,.30),
    inset 0 -2.5px 2.5px rgba(0,0,0,.55),
    0 1px 1px rgba(0,0,0,.6);
  border: 1px solid rgba(0,0,0,.5);
}
/* inlay + denomination, only on the top (fully visible) disc */
.coin.top::after {
  content: attr(data-d);
  position: absolute; inset: 13% 15%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255,255,255,.30), rgba(255,255,255,0) 60%),
    var(--inlay);
  border: 1px solid var(--ring);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-weight: 800; color: var(--ink);
  font-size: 5.5px; letter-spacing: -.2px;
}
/* denomination palettes (anchors: white=1, red=5, green=25) */
.d-01 { --body:#54606a; --edge:#aab4bd; --inlay:#3f4a53; --ink:#e6edf2; --ring:#cfd8df; }
.d-05 { --body:#1d5a8a; --edge:#6cc0f0; --inlay:#16466f; --ink:#e3f4ff; --ring:#8fd2ff; }
.d-1  { --body:#d8d8d8; --edge:#7c7c7c; --inlay:#f4f4f4; --ink:#222;    --ring:#ffffff; }
.d-5  { --body:#a3182a; --edge:#ec5a6e; --inlay:#7e1320; --ink:#ffe2e6; --ring:#ff8a98; }
.d-25 { --body:#15743a; --edge:#56c47e; --inlay:#0e5a2c; --ink:#dcffe8; --ring:#7fe0a2; }

.pot-row { display: flex; gap: 4px; align-items: flex-end; }
/* amount pill under a player bet stack */
.chip-amt {
  margin-top: 5px;
  font-family: var(--font-ui); font-size: 11px; font-weight: 700;
  color: var(--text); letter-spacing: .3px;
  background: rgba(0,0,0,.5); border-radius: 9999px;
  padding: 1px 8px; box-shadow: 0 1px 3px rgba(0,0,0,.5); white-space: nowrap;
}

/* ── HERO CARDS ─────────────────────────────────────── */
.hero-cards {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.card {
  width: 64px;
  height: 92px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: var(--font-ui);
  font-weight: 800;
  user-select: none;
  transition: transform .2s;
}
.card-back {
  background: linear-gradient(135deg, #152240 0%, #0a1428 100%);
  border: 1px solid #2a3a5a;
}
.card-back::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 4px;
  background: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(255,255,255,.03) 4px, rgba(255,255,255,.03) 5px);
}
.card-front {
  background: #fff;
}
/* SVG-asset face (recolored 4-color deck). The SVG carries its own white face,
   border and rounded corners, so the .card box just clips and shadows it. */
.card-svg {
  background: transparent;
  overflow: hidden;
}
.card-svg img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
}
.card-front.red { color: #cc1111; }
.card-front.black { color: #111; }
.card-corner {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 13px;
  line-height: 1.1;
  text-align: center;
}
.card-center {
  font-size: 32px;
  line-height: 1;
}
.card.deal-in {
  animation: deal .3s cubic-bezier(.34,1.56,.64,1) both;
}
.card.deal-in:nth-child(2) { animation-delay: .08s; }
@keyframes deal {
  from { transform: translateY(-24px) scale(.85); opacity: 0; }
  to   { transform: translateY(0)     scale(1);   opacity: 1; }
}

/* ── ACTION BAR ─────────────────────────────────────── */
.action-bar {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.action-btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  transition: .15s;
  min-width: 90px;
}
.action-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.25); }
.action-btn:active:not(:disabled) { transform: translateY(0); }
.action-btn:disabled { opacity: .35; cursor: not-allowed; }

.action-btn.btn-fold  { background: var(--c-fold); border-color: #333; color: #aaa; }
.action-btn.btn-call  { background: var(--c-call); border-color: #1a5090; color: #7ec8ff; }
.action-btn.btn-open  { background: var(--c-open); border-color: #1a6030; color: #7effa8; }
.action-btn.btn-3bet  { background: var(--c-3bet); border-color: #6a1828; color: #ffb3c0; }
.action-btn.btn-4bet  { background: var(--c-4bet); border-color: #4a1a6a; color: #e0b3ff; }

/* ── FEEDBACK STRIP ─────────────────────────────────── */
.feedback-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  width: 560px;
  flex-shrink: 0;
}
.feedback-strip.correct {
  background: var(--correct-bg);
  border-color: rgba(39,174,96,.3);
  color: var(--text);
}
.feedback-strip.wrong {
  background: var(--wrong-bg);
  border-color: rgba(192,57,43,.3);
  color: var(--text);
}
.fb-icon { font-size: 18px; flex-shrink: 0; }
.fb-msg  { flex: 1; line-height: 1.4; }
.fb-ev {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: .5px;
}
.fb-ev.pos { color: var(--correct); }
.fb-ev.neg { color: var(--wrong); }
.fb-next {
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--gold);
  background: var(--gold-dim);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  flex-shrink: 0;
  transition: .15s;
}
.fb-next:hover { background: rgba(201,168,76,.3); }

/* ── STATS PANEL ─────────────────────────────────────── */
.stats-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: rgba(255,255,255,.03);
  border-radius: 6px;
  border: 1px solid var(--panel-border);
}
.stat-key {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-ui);
}
.stat-val {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.stat-val.good { color: var(--correct); }
.stat-val.bad  { color: var(--wrong); }

.stats-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  border-radius: 5px;
  border: 1px solid var(--panel-border);
}
.bd-key  { font-size: 10px; color: var(--text-mid); font-family: var(--font-ui); letter-spacing: .5px; }
.bd-val  { font-family: var(--font-ui); font-size: 13px; font-weight: 700; }
.bd-val.good { color: var(--correct); }
.bd-val.bad  { color: var(--wrong); }
.bd-bar {
  height: 2px;
  border-radius: 1px;
  background: var(--correct);
  margin-top: 3px;
  transition: width .3s;
}

.reset-btn {
  width: 100%;
  padding: 8px;
  margin-top: auto;
  background: transparent;
  border: 1px solid rgba(192,57,43,.3);
  border-radius: 6px;
  color: #c0392b;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: .15s;
}
.reset-btn:hover { background: rgba(192,57,43,.1); }

/* ── RIGHT PANEL TABS ────────────────────────────────── */
.right-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}
.right-tab {
  flex: 1;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: .15s;
}
.right-tab:hover { color: var(--text); }
.right-tab.active { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }

/* ── HISTORY LIST ────────────────────────────────────── */
.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.history-entry {
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,.02);
  cursor: default;
}
.history-entry.h-correct { border-left: 2px solid var(--correct); }
.history-entry.h-wrong   { border-left: 2px solid var(--wrong); }
.history-entry.h-timeout { border-left: 2px solid #e67e22; }
.h-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}
.h-hand {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.h-ev {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
}
.h-ev.pos { color: var(--correct); }
.h-ev.neg { color: var(--wrong); }
.h-detail {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: .3px;
}
.h-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  align-items: center;
}
.h-action-badge {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}
.badge-correct-action { background: rgba(39,174,96,.2);  color: #2ecc71; }
.badge-player-action  { background: rgba(192,57,43,.2);  color: #e74c3c; }
.badge-match          { background: rgba(39,174,96,.15); color: #27ae60; }

/* ── VISUALIZER LAYOUT ───────────────────────────────── */
.viz-layout {
  grid-template-columns: 190px 1fr 180px;
}

.viz-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 16px 20px;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.viz-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 600px;
}

.viz-status {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.viz-hover {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 1px;
}

/* ── MATRIX ─────────────────────────────────────────── */
.matrix-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.matrix {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 2px;
  width: min(620px, calc(100vw - 420px));
  aspect-ratio: 1;
}

.matrix-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: filter .1s, transform .1s;
  background: #1e2a22;
  /* P-013: no native text selection of hand labels during drag-paint. */
  -webkit-user-select: none;
  user-select: none;
  /* Clip background to padding-box so the `to right` frequency gradient does
     not bleed a 1px green sliver under the semi-transparent border at the
     right edge (Chromium gradient+border edge artifact = the "green tail").
     !important: JS sets the `background` shorthand inline, which would reset
     background-clip to border-box and re-introduce the artifact. */
  background-clip: padding-box !important;
  overflow: hidden;
  position: relative;
}

.matrix-cell:hover {
  filter: brightness(1.35);
  transform: scale(1.08);
  z-index: 2;
  border-color: var(--gold);
}

.cell-label {
  font-family: var(--font-ui);
  font-size: clamp(7px, 1vw, 11px);
  font-weight: 700;
  letter-spacing: .3px;
  color: inherit;
  pointer-events: none;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
}

/* ── VISUALIZER LEGEND PANEL ─────────────────────────── */
.viz-legend-panel {
  gap: 6px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-mid);
  font-family: var(--font-body);
}

.legend-swatch {
  width: 28px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── COMING SOON PLACEHOLDER ─────────────────────────── */
.coming-soon {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.cs-title {
  font-family: var(--font-ui);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.cs-sub {
  font-size: 14px;
  color: var(--text-dim);
}

/* ── EDITOR LAYOUT ───────────────────────────────────── */
.editor-layout {
  grid-template-columns: 200px 1fr 220px;
}

.editor-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 16px 20px;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.editor-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 640px;
}

.editor-status {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Editor matrix — same as visualizer but with pointer cursor */
.editor-matrix-wrap { display: flex; align-items: center; justify-content: center; flex: 1; }

.editor-matrix {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 2px;
  width: min(620px, calc(100vw - 460px));
  aspect-ratio: 1;
}

.editor-matrix .matrix-cell { cursor: crosshair; }
.editor-matrix .matrix-cell:hover { filter: brightness(1.5); transform: scale(1.1); z-index: 2; border-color: #fff; }

/* ── PAINT TOOLS (right panel) ───────────────────────── */
.paint-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.paint-btn {
  padding: 8px 6px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.08);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
  transition: .15s;
  color: #ccc;
  background: rgba(255,255,255,.04);
}
.paint-btn:hover { filter: brightness(1.3); }
.paint-btn.active { border-width: 2px; filter: brightness(1.2); }

.paint-btn[data-action="open"]  { color: #7effa8; }
.paint-btn[data-action="3bet"]  { color: #ffb3c0; }
.paint-btn[data-action="call"]  { color: #7ec8ff; }
.paint-btn[data-action="4bet"]  { color: #e0b3ff; }
/* P-014: Clear is the trash button — full-width below the 2×2 action grid.
   Larger font for the 🗑 glyph; no letter-spacing (irrelevant for an emoji). */
.paint-btn[data-action="clear"] { color: #e67e22; grid-column: span 2; font-size: 16px; letter-spacing: 0; }

.paint-btn.active[data-action="open"]  { background: rgba(14,60,26,.6);  border-color: #7effa8; }
.paint-btn.active[data-action="3bet"]  { background: rgba(122,26,46,.6); border-color: #ffb3c0; }
.paint-btn.active[data-action="call"]  { background: rgba(26,74,122,.6); border-color: #7ec8ff; }
.paint-btn.active[data-action="4bet"]  { background: rgba(106,13,173,.4);border-color: #e0b3ff; }

/* Frequency slider */
.freq-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.freq-slider {
  flex: 1;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: #2a3a2a;
  outline: none;
  cursor: pointer;
}
.freq-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
}
.freq-num {
  display: flex;
  align-items: baseline;
  gap: 1px;
}
.freq-pct {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
}
/* P-017: editable frequency field — looks like the old static value but
   accepts keyboard input. Spinners hidden; clamp/sync handled in editor.js. */
.freq-val {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  width: 30px;
  text-align: right;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0;
  outline: none;
  -moz-appearance: textfield;
}
.freq-val::-webkit-outer-spin-button,
.freq-val::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.freq-val:hover { border-bottom-color: var(--panel-border); }
.freq-val:focus { border-bottom-color: var(--gold); }

/* Quick freq buttons */
.quick-freqs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.qf-btn {
  padding: 5px 4px;
  border-radius: 5px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: .12s;
}
.qf-btn:hover, .qf-btn.active { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }

/* Save section */
.save-section { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.save-input {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
}
.save-input:focus { border-color: var(--gold); }
.save-btn {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid var(--gold);
  background: var(--gold-dim);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: .15s;
}
.save-btn:hover { background: rgba(201,168,76,.28); }
.save-btn:disabled { opacity: .45; cursor: default; }
.save-btn:disabled:hover { background: var(--gold-dim); }   /* P-015: stay muted when clean */

/* Secondary save-as-new button — muted gold outline */
.save-btn-secondary {
  border-color: rgba(201,168,76,.4);
  background: transparent;
  color: rgba(201,168,76,.7);
  font-size: 11px;
  letter-spacing: 1.5px;
  padding: 8px;
}
.save-btn-secondary:hover { background: rgba(201,168,76,.12); border-color: var(--gold); color: var(--gold); }

/* Separator between overwrite and save-as-new */
.save-copy-sep {
  font-family: var(--font-ui);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  margin: 8px 0 6px;
  position: relative;
}
.save-copy-sep::before,
.save-copy-sep::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 22%;
  height: 1px;
  background: rgba(255,255,255,.08);
}
.save-copy-sep::before { left: 0; }
.save-copy-sep::after  { right: 0; }

/* Load status message */
.load-status {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: .5px;
  min-height: 14px;
  text-align: center;
  transition: opacity .3s;
}
.load-status.ok   { color: #27ae60; }
.load-status.err  { color: #e74c3c; }

/* depth/format selectors reuse mini-select */
.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.meta-row .mode-label { font-size: 11px; white-space: nowrap; }
.meta-row .mini-select { flex: 1; }

/* ── QUICK SELECT POPUP ──────────────────────────────── */
.qs-trigger {
  width: 100%;
  padding: 8px 12px;
  border-radius: 7px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,.04);
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  transition: .15s;
}
.qs-trigger:hover { background: rgba(255,255,255,.08); color: var(--text); }
.qs-trigger.open  { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }

.qs-popup {
  position: fixed;
  z-index: 200;
  background: #0e1810;
  border: 1px solid rgba(201,168,76,.3);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.7);
  min-width: 420px;
}

.qs-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.qs-heading {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 2px;
}

.qs-btn {
  padding: 6px 8px;
  border-radius: 5px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,.03);
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  cursor: pointer;
  text-align: left;
  transition: .12s;
  white-space: nowrap;
}
.qs-btn:hover {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

/* ── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3a2a; border-radius: 2px; }
/* ── POSTFLOP BOARD CARDS (smaller, fit inside table oval) ─ */
#pfBoard { gap: 8px; }
#pfBoard .card { width: 48px; height: 68px; }
#pfBoard .card-corner { font-size: 11px; }
#pfBoard .card-center { font-size: 24px; }

/* ── POSTFLOP BREAKDOWN (equity.poker-style range composition) ─ */
.pf-break { display: flex; flex-direction: column; gap: 3px; }
.pf-break-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  position: relative;
  padding: 3px 6px;
  border-radius: 4px;
  overflow: hidden;
}
.pf-break-row .pf-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--gold-dim);
  z-index: 0;
}
.pf-break-row.is-draw .pf-bar { background: rgba(63,127,181,.18); }
.pf-break-row .pf-lbl,
.pf-break-row .pf-num { position: relative; z-index: 1; }
.pf-break-row .pf-lbl { color: var(--text); }
.pf-break-row .pf-num {
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 10px;
  white-space: nowrap;
}
.pf-break-empty {
  font-size: 11px;
  color: var(--text-dim);
  padding: 3px 6px;
}
/* ── SHOW RANGE BUTTON (feedback strip) ─────────────────── */
.fb-hint {
  padding: 5px 16px;
  border-radius: 6px;
  border: 1.5px solid rgba(201,168,76,.55);
  background: rgba(201,168,76,.12);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  flex-shrink: 0;
}
.fb-hint:hover {
  background: rgba(201,168,76,.25);
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(201,168,76,.3);
}

/* ── HINT MODAL ──────────────────────────────────────────── */
#hintOverlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#hintOverlay.open { display: flex; }
#hintBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.82);
  cursor: pointer;
}
#hintBox {
  position: relative;
  background: #060d08;
  border: 1px solid rgba(201,168,76,.28);
  border-radius: 16px;
  padding: 16px 18px 16px;
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-shadow: 0 28px 90px rgba(0,0,0,.98);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Title row — compact, with close btn overlaid top-right */
.hint-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
}
#hintTitle {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
}
#hintCloseBtn {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  width: 28px; height: 28px;
  border-radius: 8px;
  transition: .15s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
#hintCloseBtn:hover { color: #fff; background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); }

/* 13×13 grid — dominant element */
.hint-grid,
#hintGrid {
  display: grid !important;
  grid-template-columns: repeat(13, 1fr) !important;
  grid-template-rows: repeat(13, 1fr) !important;
  gap: 3px !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  background: #050a07;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.04);
  box-sizing: border-box;
}
/* Reuse .matrix-cell; disable hover effects in hint context */
#hintGrid .matrix-cell {
  cursor: default;
  border-radius: 4px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  background: #1e2a22;
  border: 1px solid rgba(255,255,255,.06);
  overflow: hidden;
  position: relative;
}
#hintGrid .matrix-cell:hover {
  filter: brightness(1.15);
  transform: none;
  border-color: rgba(255,255,255,.18);
  z-index: 2;
}
#hintGrid .matrix-cell .cell-label {
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: clamp(8px, 0.95vw, 12px);
  font-weight: 700;
  letter-spacing: .2px;
  pointer-events: none;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
}

/* Red glow on the dealt hand */
.hint-cell-current {
  outline: 2.5px solid #e74c3c !important;
  outline-offset: -1px;
  box-shadow: 0 0 14px rgba(231,76,60,.8), 0 0 28px rgba(231,76,60,.4) !important;
  z-index: 2;
  border-color: #e74c3c !important;
}

/* Legend row — compact, below the grid */
.hint-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.hint-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-mid);
  font-family: var(--font-ui);
  letter-spacing: .5px;
}
.hint-legend-swatch {
  width: 11px; height: 11px;
  border-radius: 2px;
  flex-shrink: 0;
}
.hint-hand-note {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-mid);
  text-align: center;
}

/* ── LEARN MODE ──────────────────────────────────────────
   Learn uses .layout (for the flex-1 fill-the-viewport behaviour) but
   overrides its 3-column grid: Stage 1 just centers a placeholder, and
   Stages 2+ will toggle one of three full-width sections (entry/card/
   reveal). Sections become flex columns so their inner .coming-soon /
   future content can use flex:1 + center the way Analyzer does. */
#learnMode {
  grid-template-columns: 1fr;
}
#learnMode > section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  align-items: center;
  justify-content: center;
}

/* Entry screen — centered card with deck picker, scope, counters, actions */
.learn-entry-card {
  background: var(--panel-bg, #1a1a1a);
  border: 1px solid var(--panel-border, #2a2a2a);
  border-radius: 10px;
  padding: 24px 28px;
  min-width: 420px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.learn-entry-title {
  margin: 0 0 4px;
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
  text-align: center;
}
.learn-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.learn-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-mid);
  text-transform: uppercase;
}
.learn-scope-locked-hint {
  font-size: 11px;
  color: var(--text-mid);
  font-style: italic;
  margin-top: 2px;
}
.learn-counters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 2px;
}
.learn-counter {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  padding: 10px 4px;
  text-align: center;
}
.lc-num {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-bright, #e7e2c5);
  line-height: 1;
}
.lc-label {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-mid);
  text-transform: uppercase;
  margin-top: 4px;
}
.learn-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.learn-start-btn {
  padding: 12px 16px;
  border-radius: 6px;
  border: 1px solid #c9a84c;
  background: rgba(201, 168, 76, 0.12);
  color: #c9a84c;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.learn-start-btn:hover:not(:disabled) {
  background: rgba(201, 168, 76, 0.22);
}
.learn-start-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.learn-reset-btn {
  padding: 6px 12px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
}
.learn-reset-btn:hover {
  border-color: rgba(255, 80, 80, 0.5);
  color: #ff8080;
}
.learn-status-msg {
  font-size: 11px;
  color: var(--text-mid);
  text-align: center;
  min-height: 14px;
}
.learn-status-msg.error {
  color: #ff8080;
}

/* Card-screen footer: Back button on the left, queue badge on the right. */
.learn-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  width: 560px;        /* matches .table-wrap width so it looks aligned */
  max-width: 100%;
}
.learn-back-btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
}
.learn-back-btn:hover {
  border-color: var(--text-dim);
  color: var(--text-dim);
}
.learn-queue-badge {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-mid);
  text-transform: uppercase;
}

/* Reveal feedback strip — verdict + Easy + Next, shown after an answer. */
.learn-feedback-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 560px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.lfb-verdict {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.lfb-verdict.correct { color: #5ab070; }
.lfb-verdict.wrong   { color: #ff8080; }
.learn-easy-btn,
.learn-next-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.learn-easy-btn {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: var(--text-mid);
}
.learn-easy-btn:hover:not(:disabled) {
  border-color: #5ab070;
  color: #5ab070;
}
.learn-next-btn {
  border: 1px solid #c9a84c;
  background: rgba(201, 168, 76, 0.12);
  color: #c9a84c;
}
.learn-next-btn:hover:not(:disabled) {
  background: rgba(201, 168, 76, 0.22);
}
.learn-easy-btn:disabled,
.learn-next-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* End-of-session summary — sits inside the existing .learn-entry-card. */
.learn-summary-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-mid);
  text-align: center;
  padding: 4px 8px;
}

/* Bottom-sheet scaffolding (Track B.4, Stage 2). These elements exist in the
   DOM on every viewport but are inert/hidden on desktop — the grab handle is
   display:none and the backdrop is transparent+non-interactive until a sheet
   opens, which only happens under the mobile breakpoint below. */
.sheet-handle { display: none; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }

/* Floating "Deal" button (Track B.4, Stage 3). On mobile the real Deal Hand
   button lives inside the settings sheet; this FAB proxies clicks to it so the
   core action stays reachable without opening the sheet. Hidden by default —
   mobile.js shows it only in Drill on a narrow viewport. z-index sits BELOW the
   sheet backdrop (150) so it dims out while the sheet is open. */
.mobile-deal-fab {
  display: none;
  position: fixed;
  right: 14px;
  bottom: 60px;
  z-index: 120;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  border-radius: 9999px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #1a1209;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
  cursor: pointer;
}
.mobile-deal-fab:active { filter: brightness(1.1); }

/* ════════════════════════════════════════════════════════════════════
   MOBILE ADAPTATION — Track B.4 / P-002
   ════════════════════════════════════════════════════════════════════
   Everything mobile-specific lives below this line, gated behind a single
   breakpoint. Desktop rules above are never touched — this block only
   ADDS overrides when the viewport is narrow, so the desktop layout is
   guaranteed unchanged. Stage 1 (this block): scrollable top tabs, a
   single-column stacked layout (table on top, panels flow below), and a
   fluid table whose %-based seats scale automatically.
   Stage 2 will turn the stacked panels into off-canvas drawers.
   ──────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* — TOPBAR: let the 6 tabs scroll horizontally instead of overflowing.
       Sits above the sheet backdrop (z-index 150) so tabs stay tappable while
       a sheet is open — tapping a tab switches mode AND closes the sheet. — */
  .topbar { padding: 0 10px; gap: 8px; position: relative; z-index: 250; }
  .logo { display: none; }                 /* reclaim width for the tabs */
  .mode-tabs {
    flex: 1;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;                  /* Firefox: hide scrollbar */
  }
  .mode-tabs::-webkit-scrollbar { display: none; }   /* WebKit: hide */
  .mode-tab { flex-shrink: 0; padding: 6px 12px; }
  .session-pill { flex-shrink: 0; font-size: 11px; }

  /* — LAYOUT: 3-column grid → single column. The center section (table or
       matrix) is reordered to the top. The RIGHT panel (stats / history /
       legend) flows below the table and the page scrolls. The LEFT panel
       (settings) is lifted out of flow into a bottom sheet (below).
       Bottom padding leaves room for the peeking sheet handle. — */
  .layout { grid-template-columns: 1fr; padding-bottom: 52px; }
  .table-section, .viz-section, .editor-section { order: -1; }
  .panel-right {
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--panel-border);
    padding: 14px 14px;
    gap: 14px;
  }

  /* — SETTINGS BOTTOM SHEET (Stage 2) — the left panel becomes a sheet pinned
       to the bottom edge. By default only a 46px grab handle peeks above the
       edge; swiping up (or tapping the handle) slides the full panel in.
       Positions are fixed so the sheet floats over the table. JS (mobile.js)
       toggles .sheet-open and manages the backdrop + swipe gestures. — */
  .panel-left {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: auto;
    max-height: 82vh;
    border: none;
    border-top: 1px solid var(--border-default, rgba(255,255,255,.12));
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 34px rgba(0,0,0,.6);
    padding: 0 14px 18px;
    gap: 14px;
    transform: translateY(calc(100% - 46px));
    transition: transform .32s cubic-bezier(.16,1,.3,1);
    z-index: 200;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .panel-left.sheet-open { transform: translateY(0); }

  /* Grab handle — sticky so it stays visible while the sheet content scrolls.
       The pill + label signal "pull me up". The whole bar is the tap target. */
  .sheet-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 46px;
    position: sticky;
    top: 0;
    margin: 0 -14px 4px;
    background: var(--panel);
    border-bottom: 1px solid var(--panel-border);
    cursor: pointer;
    touch-action: none;          /* let JS own the vertical swipe on the handle */
    user-select: none;
    z-index: 1;
  }
  .sheet-handle::before {
    content: '';
    width: 38px; height: 4px;
    border-radius: 2px;
    background: var(--text-dim);
  }
  .sheet-handle-label {
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-dim);
  }

  /* — TABLE: fluid width, fixed 680:330 stadium ratio. Seats are positioned
       in % (see SLOT_POS in drill.js) so they follow the box automatically.
       Only the fixed-px seat contents need shrinking, below. — */
  .table-section { padding: 10px 8px 14px; gap: 10px; }
  .table-wrap {
    width: min(94vw, 680px);
    height: auto;
    aspect-ratio: 680 / 330;
  }
  .table-felt   { inset: 10px; }
  .table-felt::before { inset: 8px; }
  .timer-ring   { inset: 10px; }

  /* Seat contents (fixed px) scaled down to match the smaller table */
  .seat-circle  { width: 34px; height: 34px; font-size: 10px; }
  .seat-cards   { bottom: 22px; }
  .mini-back    { width: 19px; height: 27px; border-radius: 4px; }
  .seat-name    { font-size: 8px; }
  .seat-stack   { font-size: 10px; padding: 1px 6px; }
  .pot-block    { padding: 4px 10px; }
  .pot-value    { font-size: 14px; }
  .pot-label    { font-size: 8px; }
  .action-log   { font-size: 9px; max-width: 80%; }

  /* Blind / raise chips: shrink while keeping the JS-set centering transform */
  .bet-chip            { transform: translate(-50%, -50%) scale(.82); }
  .chip-stack, .chip-pot { transform: translate(-50%, -50%) scale(.82); }

  /* Hero hole cards below the table */
  .hero-cards   { gap: 8px; }
  .card         { width: 48px; height: 69px; border-radius: 6px; }
  .card-center  { font-size: 24px; }
  .card-corner  { top: 4px; left: 5px; }

  /* Action buttons: wrap instead of overflowing the narrow table area, and
     hit the 44px touch-target minimum (Apple HIG / Material 48dp). */
  .action-bar   { flex-wrap: wrap; justify-content: center; }
  .action-btn   { min-height: 48px; padding: 12px 20px; }

  /* Touch targets inside the settings sheet and pickers */
  .seg          { min-height: 44px; }
  .pos-buttons .seg { min-height: 44px; }
  .mini-select  { min-height: 40px; }
  .fb-next, .fb-hint, .learn-next-btn, .learn-easy-btn { min-height: 44px; }
  .right-tab    { min-height: 40px; }

  /* Feedback strip can wrap on narrow screens */
  .feedback-strip, .learn-feedback-strip { flex-wrap: wrap; }

  /* — VISUALIZER MATRIX: the desktop width uses calc(100vw - 420px) which
       goes negative on phones and collapses the grid. Override to a simple
       fluid width. (.cell-label already uses clamp() so labels scale.) — */
  .matrix { width: min(94vw, 520px); }
  .viz-section, .editor-section { padding: 10px 8px; }

  .spot-line { font-size: 11px; }
}
