/* =========================================================
   Jacks or Better — Modern UI
   Design direction: editorial-tech. Dark slate base with a
   single warm amber accent. Depth through layering, not gloss.
   ========================================================= */

:root {
  /* Base palette */
  --bg-0: #0a0b0d;
  --bg-1: #0f1115;
  --bg-2: #14171c;
  --bg-3: #1b1f26;
  --surface: #16191f;
  --surface-2: #1d2128;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Text */
  --text: #e6e8ec;
  --text-dim: #9aa0aa;
  --text-faint: #7a7f8a;

  /* Accents */
  --accent: #f5a524;
  --accent-hi: #ffc257;
  --accent-lo: #b87a13;
  --accent-soft: rgba(245, 165, 36, 0.14);
  --accent-ring: rgba(245, 165, 36, 0.35);

  --success: #4ade80;
  --danger: #ef4444;

  /* Playing-card face colors */
  --card-face: #fafafa;
  --card-face-2: #f0f0f1;
  --card-red: #dc2626;
  --card-black: #0a0b0d;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Elevation */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-2: 0 8px 20px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-3: 0 20px 48px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35);

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ---------- Fluid tokens ----------
     Each clamp(min, vw-based, max) blends between a 360px viewport (phone)
     and a ~1600px viewport (large desktop). The middle term uses vw so the
     value grows linearly with screen width.

     Numbers chosen via: clamp(MIN, calc(A + B*100vw), MAX)
     where A = (MIN - (MAX - MIN) * 360/1240)  and  B = (MAX - MIN) / 1240.
     We use hand-tuned round values rather than exact math for readability.
  */

  /* Spacing — 8 steps that grow ~1.3x at max viewport */
  --s-1:   clamp(2px,  0.2vw + 1px,  4px);
  --s-2:   clamp(4px,  0.35vw + 2px, 8px);
  --s-3:   clamp(6px,  0.55vw + 3px, 12px);
  --s-4:   clamp(8px,  0.8vw + 4px,  16px);
  --s-5:   clamp(12px, 1.1vw + 6px,  22px);
  --s-6:   clamp(16px, 1.4vw + 8px,  28px);
  --s-7:   clamp(20px, 1.8vw + 10px, 36px);
  --s-8:   clamp(28px, 2.5vw + 14px, 52px);

  /* Typography — each size grows with viewport within sensible bounds.
     base body text scales from 14px on phone to 17px on large desktop. */
  --fs-xs:   clamp(10px, 0.2vw + 9px,  12px);   /* labels, kbd */
  --fs-sm:   clamp(11px, 0.25vw + 10px, 14px);  /* small meta */
  --fs-base: clamp(14px, 0.3vw + 13px, 17px);   /* body */
  --fs-md:   clamp(15px, 0.4vw + 14px, 19px);   /* button text */
  --fs-lg:   clamp(17px, 0.6vw + 15px, 22px);   /* stat values */
  --fs-xl:   clamp(20px, 1.0vw + 16px, 30px);   /* headline stats */
  --fs-2xl:  clamp(24px, 1.8vw + 18px, 42px);   /* brand title */

  /* Card scaling */
  --card-gap: clamp(6px, 0.9vw + 2px, 16px);

  /* Min tap target for interactive elements (mobile) */
  --tap: 44px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100dvh;
}

/* Ambient background — subtle radial glow + fine noise */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(245, 165, 36, 0.06), transparent 60%),
    radial-gradient(ellipse 60% 50% at 10% 110%, rgba(99, 102, 241, 0.05), transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 90%, rgba(245, 165, 36, 0.04), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .12 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.5;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 0;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--bg-0);
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* Default focus ring — catches any interactive control that doesn't define
   its own. Individual components (buttons, cards) override this with
   tailored styling. Using :focus-visible keeps the ring off mouse clicks. */
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Shell */
.shell {
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--s-5) var(--s-6) var(--s-6);
  z-index: 1;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-width: 0;
}

.brand-mark {
  position: relative;
  width: clamp(36px, 2.5vw + 28px, 56px);
  height: clamp(36px, 2.5vw + 28px, 56px);
  flex-shrink: 0;
}
.brand-mark__chip {
  position: absolute;
  inset: 0;
  border-radius: 14%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-lo) 100%);
  box-shadow: var(--shadow-2), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  transform: rotate(-8deg);
}
.brand-mark__chip--2 {
  background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border-strong);
  transform: rotate(6deg) translate(4px, -2px);
  z-index: 1;
}
.brand-mark__chip--2::after {
  content: "J";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(16px, 1.2vw + 12px, 28px);
  font-style: italic;
  color: var(--accent);
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-2xl);
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--text);
}

.brand-sub {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* Stats */
.stats {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  flex-wrap: wrap;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px var(--s-4);
  min-width: 72px;
}
.stat__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.stat__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--text);
}
.stat--accent .stat__value {
  color: var(--accent);
}
.stat--divider {
  width: 1px;
  min-width: 1px;
  align-self: stretch;
  background: var(--border);
  padding: 0;
}
.stat__value.ticking {
  animation: tick 0.45s var(--ease-spring);
}
@keyframes tick {
  0% { transform: translateY(6px) scale(0.9); opacity: 0.5; }
  60% { transform: translateY(-2px) scale(1.08); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- Two-column layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(280px, 26vw, 420px);
  gap: var(--s-5);
  align-items: start;
  margin-bottom: var(--s-3);
}
.layout__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.layout__aside {
  position: sticky;
  top: var(--s-4);
}
.layout__main > * {
  margin-bottom: 0;
}

/* Paytable inside aside takes full height of its column */
.layout__aside .paytable-wrap {
  margin-bottom: 0;
}

/* ---------- Pay table ---------- */
.paytable-wrap {
  margin-bottom: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.paytable-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--border);
  gap: var(--s-4);
  flex-wrap: wrap;
}
.paytable-title {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}
.paytable-hint {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.paytable-scroll {
  overflow-x: auto;
}
.paytable {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.paytable th,
.paytable td {
  padding: var(--s-2) var(--s-3);
  text-align: center;
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border);
  line-height: 1.3;
}
.paytable tbody tr:last-child th,
.paytable tbody tr:last-child td {
  border-bottom: none;
}
.paytable th {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg-1);
  padding: var(--s-3) var(--s-3);
}
.paytable th.paytable__hand {
  text-align: left;
  padding-left: var(--s-4);
  width: 45%;
}
.paytable td.paytable__hand {
  text-align: left;
  padding-left: var(--s-4);
  color: var(--text);
  font-weight: 500;
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.paytable td {
  color: var(--text-dim);
}
.paytable th.col-active,
.paytable td.col-active {
  background: var(--accent-soft);
  color: var(--text);
}
.paytable th.col-active {
  color: var(--accent);
}
.paytable tr.row-winning td {
  color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent 80%);
}
.paytable tr.row-winning td.paytable__hand {
  color: var(--accent-hi);
  font-weight: 600;
}
.paytable tr.row-winning td.col-active {
  background: rgba(245, 165, 36, 0.22);
  color: var(--accent-hi);
}

/* ---------- Result bar ---------- */
.result-bar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  margin-bottom: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color 0.3s var(--ease-out), background 0.3s var(--ease-out);
  min-height: 48px;
}
.result-bar__kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-right: var(--s-4);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.result-bar__text {
  flex: 1;
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.005em;
  color: var(--text);
  min-width: 0;
}
.result-bar__amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  flex-shrink: 0;
}
.result-bar.is-win {
  border-color: var(--accent-ring);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 60%);
}
.result-bar.is-win .result-bar__text {
  color: var(--accent-hi);
}
.result-bar.is-error {
  border-color: rgba(239, 68, 68, 0.4);
}
.result-bar.is-error .result-bar__text {
  color: #fca5a5;
}

/* ---------- Table / hand ---------- */
.table {
  padding: var(--s-2) 0;
  margin-bottom: var(--s-3);
}
.hand {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--card-gap);
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s-2);
}

.card {
  aspect-ratio: 5 / 7;
  width: 100%;
  position: relative;
  perspective: 1200px;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  border-radius: var(--r-md);
  transition: transform 0.25s var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
}
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: var(--r-md);
}
.card:hover:not(:disabled) {
  transform: translateY(-3px);
}
.card:disabled {
  cursor: default;
}

.card__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.7, 0.05, 0.3, 1);
}
.card.is-flipped .card__inner {
  transform: rotateY(180deg);
}

.card__face,
.card__back {
  position: absolute;
  inset: 0;
  border-radius: var(--r-md);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-2);
}

/* Card back */
.card__back {
  background:
    linear-gradient(135deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card__back::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: calc(var(--r-md) - 6px);
  border: 1px solid var(--border);
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0 10px,
      rgba(245, 165, 36, 0.06) 10px 11px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent 0 10px,
      rgba(245, 165, 36, 0.06) 10px 11px
    );
}
.card__back::after {
  content: "";
  position: absolute;
  width: 36%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, var(--accent-lo) 60%, transparent 70%);
  opacity: 0.4;
  filter: blur(4px);
}

/* Card face — the white card body. The <img.card__img> child fills
   the box with the rendered SVG card image. Box-shadow halos for
   is-held / is-winning / is-suggested render on this element. */
.card__face {
  transform: rotateY(180deg);
  background: var(--card-face);
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: block;
}

/* Card image — fills the face. The source SVGs ship at the same 5/7
   aspect as the slot, so no letterboxing. */
.card__img {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Hold button under each card */
.hold-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-faint);
  padding: var(--s-2) 0;
  min-height: 32px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.hold-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  color: var(--text-dim);
}
.hold-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.slot.is-held .hold-btn {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-1);
}
.slot.is-held .card__face {
  box-shadow: 0 0 0 2px var(--accent), 0 0 24px var(--accent-soft), var(--shadow-2);
}

.card.is-winning .card__face {
  animation: winningCard 1.4s var(--ease-out) infinite;
  box-shadow: 0 0 0 2px var(--accent-hi), 0 0 32px var(--accent-ring), var(--shadow-3);
}
@keyframes winningCard {
  0%, 100% { transform: translateY(0) rotateY(180deg); }
  50% { transform: translateY(-5px) rotateY(180deg); }
}

.card.is-dealing .card__inner {
  animation: dealIn 0.5s var(--ease-spring) both;
}
@keyframes dealIn {
  from {
    transform: translateY(-40px) rotate(-8deg);
    opacity: 0;
  }
  to {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
}

/* ---------- Controls ---------- */
.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-3);
}

.bet-controls {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  justify-self: start;
}

.bet-display {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  min-width: 112px;
  min-height: var(--tap);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  justify-content: center;
}
.bet-display__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.bet-display__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.bet-display__max {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-faint);
}

.side-controls {
  display: flex;
  gap: var(--s-3);
  justify-self: end;
}

/* Buttons */
.btn {
  appearance: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--fs-base);
  letter-spacing: -0.005em;
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-5);
  min-height: var(--tap);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s var(--ease-out);
  box-shadow: var(--shadow-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn--ghost {
  background: transparent;
  box-shadow: none;
}

.btn--icon {
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  color: var(--text-dim);
  flex-shrink: 0;
}
.btn--icon svg {
  width: 18px;
  height: 18px;
}

.btn--primary {
  padding: var(--s-4) var(--s-7);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent) 55%, var(--accent-lo) 100%);
  color: var(--bg-0);
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 8px 22px rgba(245, 165, 36, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.35);
  min-width: clamp(140px, 14vw, 220px);
  min-height: clamp(48px, 3.5vw + 40px, 64px);
}
.btn--primary:hover:not(:disabled) {
  /* Re-declare the gradient so .btn:hover's shorthand `background` doesn't
     wipe out .btn--primary's gradient and leave just the dark fallback. */
  background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent) 55%, var(--accent-lo) 100%);
  border-color: var(--accent);
  filter: brightness(1.05);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.15) inset,
    0 10px 28px rgba(245, 165, 36, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}
.btn--primary:active:not(:disabled) {
  transform: translateY(0);
}

/* ---------- Footer ---------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-3) 0 var(--s-1);
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.foot__dot { color: var(--text-faint); opacity: 0.5; }
.foot kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- Training stats ---------- */
.training {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.training__stat {
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
/* When a stat card is itself a <button> (e.g. Return percentage opens an
   info dialog), reset button defaults so it visually matches a div card. */
button.training__stat {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
button.training__stat:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
button.training__stat:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.training__info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-family: var(--font-display);
  font-size: 9px;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-faint);
  vertical-align: 1px;
  line-height: 1;
}
button.training__stat:hover .training__info {
  color: var(--accent);
}
.training__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.training__value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
}
.training__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-xl);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.01em;
}
.training__sub {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.training__bar {
  height: 4px;
  border-radius: 2px;
  background: var(--bg-1);
  overflow: hidden;
}
.training__bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--success) 0%, #86efac 100%);
  border-radius: 2px;
  transition: width 0.6s var(--ease-out);
}
.training__bar-fill--accent {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hi) 100%);
}
.training__bar-fill.is-low {
  background: linear-gradient(90deg, var(--danger) 0%, #fca5a5 100%);
}
.training__bar-fill.is-mid {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hi) 100%);
}
.training__reset {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}
.training__reset:hover:not(:disabled) {
  color: var(--text-dim);
  border-color: var(--border-strong);
}
.training__reset:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Coach panel ---------- */
.coach {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all 0.3s var(--ease-out);
  animation: coachIn 0.4s var(--ease-spring);
}
@keyframes coachIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.coach[hidden] { display: none; }

.coach__main {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
}

.coach__icon {
  width: clamp(28px, 2vw + 22px, 40px);
  height: clamp(28px, 2vw + 22px, 40px);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
}
.coach.is-correct { border-color: rgba(74, 222, 128, 0.35); }
.coach.is-correct .coach__icon {
  background: rgba(74, 222, 128, 0.15);
  border-color: rgba(74, 222, 128, 0.5);
  color: var(--success);
}
.coach.is-incorrect { border-color: var(--accent-ring); }
.coach.is-incorrect .coach__icon {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--accent);
}

.coach__body {
  flex: 1;
  min-width: 0;
}
.coach__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.coach__kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.coach__verdict {
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: var(--fs-md);
  letter-spacing: -0.005em;
}
.coach.is-correct .coach__verdict { color: var(--success); }
.coach.is-incorrect .coach__verdict { color: var(--accent-hi); }
.coach__severity {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.coach__severity[data-level="minor"]   { color: #facc15; }
.coach__severity[data-level="notable"] { color: #fb923c; }
.coach__severity[data-level="costly"]  { color: #f87171; }
.coach__severity[data-level="blunder"] { color: #ef4444; background: rgba(239,68,68,0.12); }

.coach__message {
  margin: 0;
  font-size: var(--fs-base);
  color: var(--text);
  line-height: 1.4;
}
.coach__sub {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-faint);
  letter-spacing: 0.02em;
}
.coach__dismiss {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: var(--s-2);
  border-radius: 4px;
  transition: color 0.15s var(--ease-out);
  flex-shrink: 0;
  min-width: var(--tap);
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: center;
}
.coach__dismiss:hover { color: var(--text-dim); }

/* Side-by-side comparison */
.coach__compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.coach__compare[hidden] { display: none; }
.coach__compare-arrow {
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-hand {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}
.mini-hand__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
}
.mini-hand__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.mini-hand__label--accent { color: var(--accent); }
.mini-hand__ev {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.mini-hand__cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(4px, 0.4vw + 2px, 8px);
}

/* Coach-panel mini cards. The visual is the same .card__img used on
   the main table, just shrunk into a 5/7 box. */
.mini-card {
  aspect-ratio: 5 / 7;
  border-radius: 6px;
  background: var(--card-face);
  border: 1px solid rgba(0, 0, 0, 0.1);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: opacity 0.2s var(--ease-out);
  position: relative;
}
.mini-card .card__img {
  width: 100%;
  height: 100%;
}
.mini-card.is-dimmed {
  opacity: 0.28;
  filter: grayscale(0.8);
}
.mini-card.is-dimmed::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 4px,
    rgba(0,0,0,0.18) 4px 5px
  );
}


/* Highlight cards the coach thinks should have been held */
.slot.is-suggested .card__face {
  box-shadow:
    0 0 0 2px var(--accent-hi),
    0 0 0 4px rgba(245, 165, 36, 0.2),
    var(--shadow-2);
  animation: suggestedPulse 1.8s var(--ease-out) infinite;
}
@keyframes suggestedPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent-hi), 0 0 0 4px rgba(245, 165, 36, 0.2), var(--shadow-2); }
  50%      { box-shadow: 0 0 0 2px var(--accent-hi), 0 0 0 8px rgba(245, 165, 36, 0.35), var(--shadow-2); }
}

/* ---------- Auth bar (above topbar) ---------- */
.authbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex-wrap: wrap;
  min-height: 48px;
}
.authbar__status {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.authbar__mode {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.authbar__mode--active {
  color: var(--accent);
}
.authbar__hint {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  color: var(--text-dim);
  line-height: 1.3;
}
.authbar__actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-shrink: 0;
}
.authbar__mount {
  display: flex;
  align-items: center;
  min-height: 32px;
  /* Clerk injects its own UserButton here — keep enough room */
}

/* Small button variant for authbar + modal */
.btn--small {
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-sm);
  min-height: 36px;
  min-width: 0;
  gap: 6px;
}
.btn--small svg {
  width: 14px;
  height: 14px;
}

/* ---------- Leaderboard modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 9, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: backdropIn 0.2s var(--ease-out);
}
@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: min(80vh, 720px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: panelIn 0.28s var(--ease-spring);
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  gap: var(--s-4);
}
.modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: var(--fs-xl);
  letter-spacing: -0.01em;
  color: var(--text);
}
.modal__close {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease-out);
}
.modal__close:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-2);
}

.modal__tabs {
  display: flex;
  gap: 4px;
  padding: var(--s-3) var(--s-4) 0;
  border-bottom: 1px solid var(--border);
}
.modal__tab {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  position: relative;
  transition: color 0.15s var(--ease-out);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.modal__tab:hover {
  color: var(--text);
}
.modal__tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.modal__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4) var(--s-5) var(--s-5);
  min-height: 200px;
}
.modal__placeholder {
  margin: var(--s-6) 0;
  text-align: center;
  color: var(--text-faint);
  font-style: italic;
  font-family: var(--font-display);
  font-size: var(--fs-base);
}

/* Leaderboard list rows */
.lb-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.lb-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  grid-template-rows: auto auto;
  column-gap: var(--s-4);
  row-gap: 2px;
  align-items: center;
  padding: var(--s-3) var(--s-4);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color 0.15s var(--ease-out);
}
.lb-row:hover {
  border-color: var(--border-strong);
}
.lb-row:nth-child(1) {
  background: linear-gradient(90deg, var(--accent-soft), var(--bg-1) 70%);
  border-color: var(--accent-ring);
}
.lb-row:nth-child(1) .lb-row__rank {
  color: var(--accent-hi);
}
.lb-row:nth-child(2) .lb-row__rank,
.lb-row:nth-child(3) .lb-row__rank {
  color: var(--text);
}
.lb-row__rank {
  grid-column: 1;
  grid-row: 1 / span 2;
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: var(--fs-lg);
  color: var(--text-faint);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.lb-row__name {
  grid-column: 2;
  grid-row: 1;
  font-weight: 600;
  color: var(--text);
  font-size: var(--fs-base);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-row__value {
  grid-column: 3;
  grid-row: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.lb-row__detail {
  grid-column: 2 / span 2;
  grid-row: 2;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* ---------- Drill-mode banner ---------- */
.drill-banner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  margin-bottom: var(--s-3);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-md);
  color: var(--accent-hi);
  font-size: var(--fs-sm);
  flex-wrap: wrap;
}
.drill-banner[hidden] { display: none; }
.drill-banner__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: drill-pulse 2s infinite;
}
@keyframes drill-pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-ring); }
  70%  { box-shadow: 0 0 0 6px rgba(245, 165, 36, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 165, 36, 0); }
}
.drill-banner__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.drill-banner__type {
  color: var(--text);
  font-weight: 600;
  flex: 1;
  min-width: 0;
}
.drill-banner__stop {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 4px 10px;
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.15s, border-color 0.15s;
}
.drill-banner__stop:hover {
  background: var(--surface);
  border-color: var(--accent);
}

/* ---------- Accuracy modal ---------- */
.acc__note {
  margin: 0 0 var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.acc__footer {
  margin: var(--s-4) 0 0;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  line-height: 1.5;
}
.acc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.acc-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: var(--s-4);
  row-gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color 0.15s;
}
.acc-row:hover { border-color: var(--border-strong); }
.acc-row__label {
  grid-column: 1;
  grid-row: 1;
  font-weight: 600;
  color: var(--text);
  font-size: var(--fs-sm);
}
.acc-row__meta {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.acc-row__pct {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--accent);
  line-height: 1;
}
.acc-row__count {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-faint);
}
.acc-row__empty {
  font-style: italic;
  color: var(--text-faint);
  font-size: var(--fs-xs);
}
.acc-row__bar {
  grid-column: 1 / span 2;
  grid-row: 2;
  height: 4px;
  background: var(--bg-2);
  border-radius: 2px;
  overflow: hidden;
}
.acc-row__bar-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.4s var(--ease-out);
}
.acc-row__bar-fill.is-low { background: var(--danger); }
.acc-row__bar-fill.is-mid { background: var(--accent); }
.acc-row__actions {
  grid-column: 2;
  grid-row: 3;
  justify-self: end;
}
.acc-row__drill { padding: 4px 10px !important; }
.acc-row__note {
  grid-column: 1 / span 2;
  grid-row: 3;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  line-height: 1.4;
  align-self: center;
}

/* When the drill button takes up column 2 row 3, push the note into column 1 only */
.acc-row:has(.acc-row__actions) .acc-row__note {
  grid-column: 1;
}

/* ---------- Strategy modal ---------- */
.strategy__intro {
  margin: 0 0 var(--s-4);
  color: var(--text-dim);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.strategy__list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: strategy;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.strategy__row {
  counter-increment: strategy;
  position: relative;
  padding: var(--s-3) var(--s-4) var(--s-3) calc(var(--s-4) + 28px);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.strategy__row::before {
  content: counter(strategy);
  position: absolute;
  left: var(--s-3);
  top: var(--s-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: var(--fs-sm);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  width: 22px;
  text-align: right;
}
.strategy__rule {
  font-weight: 600;
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.35;
}
.strategy__detail {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.strategy__note {
  margin: var(--s-4) 0 0;
  padding: var(--s-3) var(--s-4);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* ---------- Confirm dialog ----------
   Compact modal with a title, a single message paragraph, and a
   right-aligned Cancel + Confirm pair. Reuses .modal / .modal__panel
   for the overlay + animation; adds its own padding and tighter sizing. */
.modal__panel--confirm {
  max-width: 380px;
  padding: var(--s-5) var(--s-5) var(--s-4);
  display: block;
  overflow: visible;
}
.modal__title--confirm {
  margin: 0 0 var(--s-3);
  font-style: normal;
}
.modal__message {
  margin: 0 0 var(--s-5);
  color: var(--text-dim);
  font-size: var(--fs-base);
  line-height: 1.5;
}
.modal__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--s-3);
}
.modal__actions .btn--small {
  padding: var(--s-2) var(--s-4);
  font-weight: 600;
}
/* Confirm-button color variants. .btn--accent matches the brand accent
   (used for non-destructive actions like "Cash in"). .btn--danger uses
   the danger token for destructive actions like "Reset stats". */
.btn--accent {
  color: var(--accent);
  border-color: var(--border);
  background: transparent;
}
.btn--accent:hover:not(:disabled) {
  color: var(--accent-hi);
  border-color: var(--accent-ring);
  background: var(--accent-soft);
}
.btn--danger {
  color: var(--danger);
  border-color: var(--border);
  background: transparent;
}
.btn--danger:hover:not(:disabled) {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
}

/* ---------- Info-section modal body ----------
   Used by the Return-percentage info dialog. Each section is a heading
   plus body text, with optional bullet list and footer paragraph. */
.info-section + .info-section {
  margin-top: var(--s-4);
}
.info-section__heading {
  margin: 0 0 var(--s-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: var(--fs-md);
  letter-spacing: -0.005em;
  color: var(--accent-hi);
}
.info-section__body {
  margin: 0;
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
.info-section__body + .info-section__body {
  margin-top: var(--s-3);
}
.info-section__list {
  margin: var(--s-2) 0 0;
  padding-left: var(--s-5);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
.info-section__list li + li {
  margin-top: 2px;
}
.info-section__list + .info-section__body {
  margin-top: var(--s-3);
}

/* ---------- Responsive layout breakpoints ----------
   With fluid scaling, these only handle structural reflow,
   not size adjustments.
*/

/* Collapse two-column layout when sidebar would be too tight */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }
  .layout__aside {
    position: static;
  }
}

/* Tablet and narrow desktop */
@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
    gap: var(--s-3);
  }
  .stats {
    width: 100%;
    justify-content: space-between;
  }
  .stat:not(.stat--divider) {
    flex: 1;
    min-width: 0;
  }
  .stat--divider {
    flex: 0 0 1px;
  }
  .training {
    grid-template-columns: 1fr 1fr;
  }
  .training__stat:last-child {
    grid-column: 1 / -1;
  }
}

/* Phone */
@media (max-width: 560px) {
  /* Tighten overall shell padding */
  .shell {
    padding: var(--s-3) var(--s-4) var(--s-4);
  }
  /* Pull sections closer together to show more content above the fold */
  .authbar {
    margin-bottom: var(--s-3);
  }
  .topbar {
    margin-bottom: var(--s-3);
  }
  .hand {
    gap: var(--s-2);
  }
  .controls {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }
  .bet-controls {
    justify-self: stretch;
    justify-content: center;
    flex-wrap: wrap;
  }
  .side-controls {
    justify-self: stretch;
    justify-content: center;
  }
  .btn--primary {
    width: 100%;
    order: -1; /* Deal button goes on top on mobile */
  }
  .result-bar {
    padding: var(--s-3);
    flex-wrap: wrap;
  }
  .result-bar__kicker {
    padding-right: var(--s-3);
  }
  .coach__compare {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }
  .coach__compare-arrow {
    transform: rotate(90deg);
  }
  /* Hide keyboard hints on phones */
  .foot__item:nth-child(3),
  .foot__item:nth-child(5),
  .foot__dot {
    display: none;
  }
  /* Drop the verbose sign-in hint on phones — the mode label stays */
  .authbar__hint {
    display: none;
  }
  .authbar {
    gap: var(--s-3);
    padding: var(--s-2) var(--s-3);
    min-height: 40px;
  }
  .authbar__actions {
    gap: var(--s-2);
  }
  /* Smaller brand mark so the topbar doesn't dominate */
  .brand {
    gap: var(--s-3);
  }
  .brand-mark {
    width: 36px;
    height: 36px;
  }
  .brand-sub { display: none; }
  /* Stats row tighter */
  .stats {
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-md);
  }
  /* Training grid — stay 3-wide but compact the padding */
  .training {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-2);
    margin-bottom: var(--s-3);
  }
  .training__stat {
    padding: var(--s-2) var(--s-3);
    gap: 4px;
  }
  .training__stat:last-child {
    grid-column: auto;
  }
  .training__label {
    font-size: 9px;
    letter-spacing: 0.1em;
  }
  /* Tighter paytable cells so the sidebar fits below the table */
  .paytable th,
  .paytable td {
    padding: 6px 4px;
  }
  /* Modal goes edge-to-edge on small screens */
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  .modal__panel {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: none;
  }
  .modal__head {
    padding: var(--s-3) var(--s-4);
  }
  .modal__body {
    padding: var(--s-3) var(--s-4) var(--s-4);
  }
  .lb-row {
    padding: var(--s-2) var(--s-3);
  }
  .strategy__row {
    padding: var(--s-2) var(--s-3) var(--s-2) calc(var(--s-3) + 24px);
  }
  .strategy__row::before {
    left: var(--s-2);
    top: var(--s-2);
  }
}

/* Very small phones */
@media (max-width: 400px) {
  /* Collapse Strategy + Leaderboards buttons to icon-only
     so they sit cleanly next to the Clerk user button. */
  .authbar .btn--small .btn__label {
    display: none;
  }
  .authbar .btn--small {
    padding: 6px 8px;
    min-width: var(--tap);
    justify-content: center;
  }
  /* Hide the "Status" kicker label to save space */
  .result-bar__kicker {
    display: none;
  }
  .result-bar {
    gap: var(--s-3);
  }
  .training__reset {
    font-size: 9px;
    padding: 3px 6px;
  }
  .stat__label {
    font-size: 9px;
  }
}

/* XL displays — slightly larger max spacing */
@media (min-width: 1600px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 420px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- SEO content section ----------
   Substantial reader-facing content below the play surface. Primarily
   for search-engine indexing — the JS-rendered game shell above is
   too thin to rank well on its own — but designed to read like a
   genuine "About this trainer" panel for visitors who scroll down.

   Visual design rules:
     - Slightly contrast-lifted background so it's clearly its own
       section, not part of the play surface.
     - Long-form typography: wider line-height, narrower max-width
       than the game shell, larger body font for comfortable reading.
     - Plays nicely with the dark theme — reuses the existing color
       tokens.
   ---------- */
.seo-content {
  /* Spans full viewport width but the inner block is centered + capped
     so reading line-length stays in the comfortable 60-80ch range. */
  width: 100%;
  background: var(--bg-2, #14171c);
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  padding: 56px 16px 80px;
  margin-top: 32px;
  color: var(--text-1, #e6e8ec);
}

.seo-content__inner {
  max-width: 720px;
  margin: 0 auto;
}

.seo-content__title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  margin: 0 0 16px;
  color: #ffffff;
}

.seo-content__lead {
  font-family: 'Manrope', sans-serif;
  font-size: 17px;
  line-height: 1.55;
  font-weight: 500;
  color: var(--text-1, #e6e8ec);
  margin: 0 0 32px;
}

.seo-content h2 {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: clamp(20px, 2.5vw, 26px);
  line-height: 1.25;
  margin: 32px 0 12px;
  color: #ffffff;
}

.seo-content p {
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  font-weight: 500;
  color: var(--text-1, #e6e8ec);
  margin: 0 0 14px;
}

.seo-content strong {
  /* Subtle accent on the bolded statistics ("99.54%", etc.) — same
     orange the in-app accent ring uses. Anchors the eye to the key
     numbers without making the paragraph read like ad copy. */
  color: var(--accent, #f5a524);
  font-weight: 700;
}

.seo-content code {
  /* Used once for `engine-fixtures.json`. Mono + tinted background
     so it's visually distinct from inline prose without being loud. */
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
}

.seo-content ul {
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  font-weight: 500;
  color: var(--text-1, #e6e8ec);
  padding-left: 22px;
  margin: 0 0 16px;
}

.seo-content li {
  margin-bottom: 8px;
}

.seo-content__cta {
  margin-top: 32px;
  padding: 14px 18px;
  border-left: 3px solid var(--accent, #f5a524);
  background: rgba(245, 165, 36, 0.06);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}
