/* Poker Gym trainer — "Deal Me In" design (Nov 2026).
 * Loads after site.css and uses its tokens: Inter / Inter Tight, paper
 * surfaces, a felt table and gold actions. Class names and ids are unchanged
 * so app.js keeps working. Phones get one column; at >=1024px the play screen
 * becomes a wide felt table with a right-hand column. */

:root {
  /* Trainer aliases onto the shared site.css tokens. */
  --text: var(--ink);
  --dim: var(--muted);
  --border: var(--line);
  --border-strong: #CFC7B5;
  --surface-2: var(--paper-2);
  --surface-3: #E3DDCE;
  --border-gold: rgba(201, 147, 42, 0.6);
  --gold-bright: #F2C455;
  --gold-dim: var(--gold-2);
  --on-felt: #F6F4EE;
  --green: var(--good);
  --red: var(--card-red);
  --danger: var(--bad);
  --radius: 20px;
  --radius-sm: 12px;
  --font-display: var(--display);
  --font-body: var(--body);
  --shadow: 0 1px 0 rgba(15, 26, 20, 0.03), 0 10px 28px -18px rgba(15, 61, 46, 0.35);
  --felt-bg: radial-gradient(120% 90% at 50% 0%, var(--felt-hi) 0%, var(--felt) 55%, var(--felt-lo) 100%);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body, img, canvas { image-rendering: auto; }

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-transform: none;
  margin: 0;
}
h2 { font-size: 18px; }

.shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
           max(28px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

/* ---------- slim header (top bar) ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 60px;
  padding: 8px 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.brand {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
}
.brand:hover { color: var(--ink); }
.brand-spade {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--felt);
  color: var(--gold);
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  flex: none;
}
.brand-copy { display: flex; flex-direction: column; }
.brand-copy b {
  font: 800 16px/1.1 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}
.topnav { display: flex; gap: 4px 18px; font-size: 14px; font-weight: 600; }
.topnav a {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.topnav a:hover { color: var(--ink); text-decoration: underline; }
.topbar button,
.pill-btn {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  box-shadow: none;
}
.topbar button[aria-pressed='true'] { border-color: var(--felt); }
.topbar button[aria-pressed='false'] { color: var(--muted); }

/* ---------- buttons ---------- */
button {
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-height: 48px;
  padding: 10px 16px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 1px 0 rgba(15, 26, 20, 0.04);
  transition: transform 100ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
}
button:hover:not(:disabled) { border-color: var(--ink); }
button:active:not(:disabled) { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
button.primary {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold-2);
  font-family: var(--font-display);
  font-weight: 800;
  box-shadow: 0 6px 16px -8px rgba(201, 147, 42, 0.8);
}
button.primary:hover:not(:disabled) { background: var(--gold-bright); border-color: var(--gold-2); }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.row > button { flex: 1 1 0; min-width: 0; }

select, textarea, input {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 48px;
}
select:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
textarea { width: 100%; resize: vertical; }
label { color: var(--ink-2); font-size: 14px; font-weight: 600; }

/* ---------- surfaces ---------- */
.window {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.window > h2,
.section-header > h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 10px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.section-header > h2 { margin: 0; }
.section-sub { font-size: 12px; color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; line-height: 1.55; }
.hint a, .tip-link a { color: var(--felt); font-weight: 600; }
.hint a:hover, .tip-link a:hover { color: var(--ink); }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 8px;
}
.skip:focus { left: 12px; top: 12px; z-index: 100; }
#main:focus { outline: none; }

/* ---------- title ---------- */
#scr-title { display: flex; flex-direction: column; gap: 12px; }
.title-art {
  position: relative;
  height: 204px;
  border-radius: var(--r-lg);
  background: var(--felt-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 24px 50px -30px rgba(10, 44, 33, 0.7);
}
.title-art > canvas#titleWorld { display: none; }
.title-art > span:not(.title-league) { display: none; }
.title-art > .title-gym { display: none; }
.title-art > .title-league {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.title-art canvas.title-trainer {
  width: 128px;
  height: 128px;
  margin-bottom: 18px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}
.title-menu { text-align: center; padding: 24px 18px; }
.title-menu h1 {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.035em;
  margin: 0 0 8px;
}
.title-menu h1 span:first-child { color: var(--ink); }
.title-menu h1 span:last-child { color: var(--felt); }
.title-menu > .hint { margin: 0 0 16px; font-size: 15px; }
#trainerCard {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.6;
}

/* ---------- class select ---------- */
.class-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.class-card {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  min-height: 48px;
}
.class-card[aria-pressed='true'] {
  border-color: var(--felt);
  box-shadow: 0 0 0 3px rgba(232, 181, 58, 0.55);
}
.class-portrait {
  display: block;
  width: 88px;
  height: 88px;
  margin: 0 auto 8px;
  border-radius: 14px;
  background: var(--felt-bg);
}
.class-card .nm { display: block; font: 800 15px/1.2 var(--font-display); color: var(--felt); margin-bottom: 4px; }
.class-card .bl { display: block; font-size: 12px; font-weight: 500; color: var(--muted); line-height: 1.5; }

/* ---------- map / home screen ---------- */
.today-hero {
  background: var(--felt-bg);
  color: var(--felt-text);
  border: 0;
  padding: 22px 18px;
  box-shadow: 0 24px 50px -30px rgba(10, 44, 33, 0.7);
}
.today-hero-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.today-hero-copy { flex: 1; min-width: 0; }
.today-hero-copy > h2 {
  font: 700 12px/1.3 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
}
.today-hero-title {
  font-family: var(--font-display);
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--on-felt);
}
.today-hero .hint { color: var(--felt-muted); }
.today-hero .hint a, .today-hero a { color: var(--gold); }
.today-hero-copy > .hint { margin: 0; }
.today-hero-art {
  display: flex;
  align-items: center;
  padding-top: 2px;
  flex-shrink: 0;
}
.mini-card {
  width: 40px;
  height: 56px;
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid #D9D2C2;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font: 800 14px/1 var(--font-display);
}
.mini-card i { font-style: normal; font-size: 16px; margin-top: 2px; }
.mini-card.suit-red { color: var(--card-red); }
.mini-card-back { transform: rotate(-8deg) translateX(6px); }
.mini-card-front { transform: rotate(7deg); }

/* secondary controls on felt: outlined, light text */
.today-hero button:not(.primary),
.hand-panel button:not(.primary):not(.card),
.scene button:not(.primary) {
  background: transparent;
  color: var(--on-felt);
  border: 2px solid rgba(246, 244, 238, 0.55);
  box-shadow: none;
}
.today-hero button:not(.primary):hover:not(:disabled),
.hand-panel button:not(.primary):not(.card):hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.06);
}
.today-hero button.primary, .hand-panel button.primary { border-color: var(--gold); box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.6); }
.today-hero textarea { border-color: transparent; }

.daily-squares {
  display: flex;
  gap: 8px;
  margin: 16px 0 4px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  justify-content: center;
}
.daily-squares .sq {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
}
.daily-squares .sq-green { background: #2E9A5B; border: 1px solid #5BC78A; }
.daily-squares .sq-red { background: #C2491A; border: 1px solid #E8784A; }
.daily-squares .sq-empty {
  /* on the felt hero: an open slot, not a filled square */
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(246, 244, 238, 0.35);
}

#dailyHistory {
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 8px;
}
#dailyHistory > summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--felt-muted);
  padding: 0;
}
#dailyHistoryContent { color: var(--felt-text); }

/* ---------- game choice grid ---------- */
.world-panel { margin-bottom: 14px; }
.world-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 6px 2px 10px;
}
.world-heading h2 { font-size: 20px; font-weight: 800; color: var(--ink); }
.world-heading span { font-size: 12px; color: var(--muted); }
.overworld { position: relative; padding: 0; }
.overworld > canvas { display: none; }
#gymList {
  position: static;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
#gymList button,
#gymList a.gym-link {
  position: static;
  width: auto;
  min-height: 112px;
  padding: 16px;
  text-align: left;
  font-size: 15px;
  font-weight: 800;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  box-shadow: var(--shadow);
  text-decoration: none;
}
#gymList button > span,
#gymList a.gym-link > span {
  font: 800 17px/1.15 var(--font-display);
  color: var(--ink);
  letter-spacing: -0.01em;
}
#gymList button:hover:not(:disabled) { border-color: var(--felt); }
#gymList button.primary {
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--felt);
  box-shadow: 0 0 0 3px rgba(232, 181, 58, 0.45), var(--shadow);
}
#gymList button.primary small:last-child,
#gymList a.gym-link small:last-child {
  color: var(--kicker);
  font-weight: 800;
  margin-top: 4px;
}
#gymList button:disabled {
  background: var(--paper-2);
  color: var(--muted);
  border-color: var(--line);
  box-shadow: none;
  opacity: 0.8;
}
#gymList a.gym-link { background: var(--paper-2); box-shadow: none; }
#gymList small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}
.map-caption { display: none; }
#shortSessions > button {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#shortSessions > button::after {
  content: '›';
  font-size: 20px;
  color: var(--felt);
  font-weight: 800;
}

/* ---------- trainer card / progress ---------- */
.trainer-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #FBF1D6;
  border: 1px solid rgba(201, 147, 42, 0.45);
  font-size: 12px;
  color: var(--kicker);
}
.trainer-streak-badge small { font-size: 11px; font-weight: 700; color: var(--kicker); }
.trainer-streak-badge b { font-size: 14px; font-weight: 900; color: var(--ink); }
.trainer-card .dlg { display: flex; align-items: center; gap: 14px; }
.trainer-card .sprite {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--felt-bg);
}
.trainer-main { flex: 1; min-width: 0; }
.trainer-level-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.trainer-name { margin: 0; font: 800 17px/1.2 var(--font-display); color: var(--ink); }
.trainer-xp { margin: 0; font-size: 12px; font-weight: 700; color: var(--kicker); }
.trainer-score-line { margin: 4px 0 0; font-size: 13px; }
.trainer-score-line b { color: var(--ink); }
.meter {
  height: 10px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-top: 8px;
}
.meter > div {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
  border-radius: 999px;
  transition: width 240ms ease;
}

/* ---------- badges ---------- */
.badge-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.badge {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}
img.badge { padding: 4px; background: var(--felt); }
.badge.locked { opacity: 0.38; filter: grayscale(0.4); }
.badge:not(.locked) { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232, 181, 58, 0.35); }

/* ---------- practice summary ---------- */
#practiceSummary p.hint {
  margin: 0;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
#practiceSummary p.hint + p.hint { margin-top: 6px; }

/* ---------- lesson ---------- */
.tutbar { display: flex; gap: 6px; margin-bottom: 12px; }
.tutbar i { flex: 1; height: 5px; border-radius: 999px; background: var(--paper-2); }
.tutbar i.on { background: var(--felt); }
.statusbox {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.statusbox .row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}
.statusbox .row1 span:last-child { color: var(--kicker); }
.gauge {
  height: 8px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.gauge > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--bad), var(--gold), var(--good));
  border-radius: 999px;
  transition: width 200ms ease;
}
.gauge.mid > i { background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.gauge.high > i { background: linear-gradient(90deg, #2E9A5B, var(--good)); }
.gauge.low > i { background: linear-gradient(90deg, #9C3A10, var(--bad)); }

.dialogue {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
  color: var(--ink);
  min-height: 76px;
}
.dialogue[role='button'] { cursor: pointer; }
.dialogue p { margin: 6px 0 0; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.coach-eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--kicker);
  margin-bottom: 2px;
}
.nameplate {
  display: inline-block;
  font: 800 19px/1.2 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--ink);
}
.prompt {
  position: absolute; right: 12px; bottom: 8px;
  color: var(--felt); font-size: 12px;
  animation: bob .9s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .prompt { animation: none; } }
.dealer { float: right; width: 84px; height: 84px; margin: 0 0 8px 12px; border-radius: 12px; background: var(--felt-bg); }

/* ---------- battle (Play screen) ---------- */
#scr-battle { display: flex; flex-direction: column; gap: 0; }

/* Keep the decision buttons reachable on phones: pin the active action row to
   the bottom of the viewport so a new player can act without scrolling. */
@media (max-width: 640px) {
  .battle-action-bar,
  #rowActions:not([hidden]),
  #rowBet:not([hidden]),
  #rowPick:not([hidden]),
  #battleEndRow:not([hidden]) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    margin: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(10, 44, 33, 0.97);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
  }
  #scr-battle { padding-bottom: 72px; }
}
.scene {
  position: relative;
  min-height: 86px;
  padding: 16px 104px 16px 18px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--felt-bg);
  color: var(--felt-text);
  overflow: hidden;
  margin-bottom: 0;
  display: flex;
  align-items: center;
}
.scene-progress { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.battle-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.battle-pips { display: flex; gap: 6px; max-width: 240px; }
.battle-pips i {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.battle-pips i.done { background: #3DB873; border-color: #6FD79C; }
.master {
  position: absolute;
  right: 8px;
  bottom: 0;
  width: 84px;
  height: 84px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}
.player { display: none; }
.table-felt { display: none; }

.master-coach-card {
  padding: 16px 18px;
  margin-bottom: 14px;
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}
.master-coach-card .dialogue {
  background: transparent;
  border: 0;
  padding: 0 0 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  min-height: 0;
}
.master-coach-card .dialogue p { font-size: 15px; line-height: 1.5; margin-top: 4px; }
.master-coach-card .statusbox { margin-bottom: 0; padding: 10px 12px; }
#rowVariant {
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.variant-label { font-size: 13px; font-weight: 700; color: var(--muted); }
#variantSelect { flex: 1; }

#tipBox { border-left: 4px solid var(--gold); }

/* ---------- the table: playing cards & hand panel ---------- */
.hand-panel {
  padding: 20px 14px;
  background: var(--felt-bg);
  color: var(--felt-text);
  border: 0;
  box-shadow: 0 30px 60px -30px rgba(10, 44, 33, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.hand-panel > h2 {
  font: 700 12px/1.3 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
  margin-bottom: 14px;
}
.hand-panel .hint { color: var(--felt-muted); }
.hand-panel .hint a { color: var(--gold); }
.hand {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.card {
  width: 68px;
  height: 98px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  background: var(--card);
  color: var(--ink);
  border: 1px solid #D9D2C2;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}
.card .rank { font-size: 24px; line-height: 1; letter-spacing: -0.02em; }
.card .pip { font-size: 26px; line-height: 1; }
.card.suit-red { color: var(--card-red); }
.card.suit-black { color: var(--ink); }
.card[data-held='true'], .card[data-picked='true'] {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold), 0 12px 22px rgba(0, 0, 0, 0.4);
  transform: translateY(-8px);
}
.card[data-held='true']::after,
.card[data-picked='true']::after {
  content: 'HELD';
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--gold);
  color: var(--ink);
  font: 800 9px/1.2 var(--font-body);
  letter-spacing: 0.1em;
}
.card[data-picked='true']::after { content: 'PICK'; }
.card[data-down='true'] {
  background: repeating-linear-gradient(45deg, var(--gold) 0 6px, var(--gold-2) 6px 12px);
  color: var(--ink);
  border: 4px solid var(--card);
}
.card:hover:not(:disabled) { transform: translateY(-2px); }
.card:active:not(:disabled), .card[aria-pressed='true'] { transform: translateY(-4px) scale(0.98); }
.card[data-held='true']:hover:not(:disabled), .card[data-picked='true']:hover:not(:disabled) { transform: translateY(-8px); }
.card:disabled { opacity: 1; }
.card:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.zone { margin-bottom: 14px; }
.zone:last-child { margin-bottom: 0; }
.zone-head {
  margin: 0 0 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--felt-muted);
}
.hand-panel .zone-head { color: var(--felt-muted); }
.zone-head b { color: var(--gold); }

/* ---------- coach / paytable ---------- */
#coachPanel { border: 2px solid var(--gold); }
#coachPanel > h2 { color: var(--felt); }
#coachPanel .dialogue { margin-bottom: 10px; }
.paytable {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  font-size: 14px;
  padding-top: 8px;
}
.paytable .amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.paytable .won { color: var(--kicker); font-weight: 800; }
.payout-panel { padding: 10px 18px; margin-top: 0; }
.payout-panel summary, #mapMore > summary, #saveBackup > summary {
  cursor: pointer;
  min-height: 44px;
  padding: 6px 0;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--felt);
}
summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
#mapMore[open] > summary { margin-bottom: 8px; }
#mapMore > h2 { font-size: 18px; margin: 12px 0 6px; }
#mapMore .window { box-shadow: none; background: var(--paper); }

/* related guides (right column on desktop, bottom of the play screen on phones) */
.related-guides > h2 { font-size: 16px; }
.guide-links { list-style: none; margin: 0; padding: 0; }
.guide-links li { border-top: 1px solid var(--line); }
.guide-links li:first-child { border-top: 0; }
.guide-links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  text-decoration: none;
}
.guide-links a::after { content: '→'; margin-left: auto; padding-left: 10px; color: var(--felt); }
.guide-links a:hover { color: var(--felt); text-decoration: underline; }
.related-guides .hint { margin: 8px 0 0; font-size: 13px; }

/* ---------- recap ---------- */
#sessionSummary {
  border: 2px solid var(--gold);
  background: radial-gradient(circle at 90% 0%, rgba(232, 181, 58, 0.14), transparent 50%), var(--surface);
}
.session-grid {
  font-size: 26px;
  letter-spacing: 6px;
  margin: 10px 0 12px;
  line-height: 1.2;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
}

/* Two reminder choices with different outcomes: one browser notification,
   one downloaded calendar file. The push action is the only gold button here. */
.recap-reminders {
  margin: 16px 0 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.recap-reminders h3 { font-size: 18px; font-weight: 800; color: var(--ink); margin: 0 0 6px; }
.recap-reminders > .hint { margin: 0 0 12px; }
.reminder-option {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 10px;
  background: var(--paper);
}
.reminder-option h4 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 4px;
}
.reminder-option .hint { margin: 0 0 10px; }
.reminder-push { border-color: var(--border-gold); background: #FCF4DE; }
.reminder-push-button { width: 100%; font-size: 15px; }
.reminder-push-button.is-on { background: var(--good); color: #fff; border-color: var(--good); }
.reminder-status {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.reminder-status.is-on { border-color: rgba(30, 122, 69, 0.5); background: rgba(30, 122, 69, 0.1); }
.reminder-status.is-error { border-color: rgba(180, 64, 12, 0.5); background: rgba(180, 64, 12, 0.08); }
.calendar-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}
.calendar-download:hover { border-color: var(--ink); color: var(--ink); }
.calendar-download:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- review ---------- */
.review-entry { border-bottom: 1px solid var(--line); padding: 14px 0; }
.review-entry:last-child { border-bottom: 0; }
.mistake-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mistake-choices button { flex: 0 1 auto; }
.mistake-answer {
  background: var(--paper);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 10px;
}
/* cards shown in review entries sit on a small felt strip */
#reviewCard .hand { background: var(--felt-bg); border-radius: 14px; padding: 12px 8px; }

/* ---------- motion / feedback ---------- */
@keyframes deal-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.hand.deal .card { animation: deal-in 180ms ease-out both; }
.hand.deal .card:nth-child(2) { animation-delay: 35ms; }
.hand.deal .card:nth-child(3) { animation-delay: 70ms; }
.hand.deal .card:nth-child(4) { animation-delay: 105ms; }
.hand.deal .card:nth-child(n+5) { animation-delay: 140ms; }
@keyframes flip-in { from { transform: rotateY(90deg); } to { transform: rotateY(0); } }
.card.flip-in { animation: flip-in 220ms ease-out; }
@keyframes scene-shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-4px); } 40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(3px); }
}
.scene.shake { animation: scene-shake 320ms ease-in-out; }
@keyframes scene-flash {
  0%,100% { box-shadow: 0 0 0 0 rgba(61, 184, 115, 0); }
  40% { box-shadow: 0 0 0 3px rgba(61, 184, 115, .85); }
}
.scene.flash-ok { animation: scene-flash 420ms ease-out; }
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(.9); }
  20% { opacity: 1; transform: translate(-50%, -4px) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -28px) scale(1); }
}
.gain-float, .xp-float {
  position: absolute; left: 50%; top: 36%;
  font-size: 14px; font-weight: 800; color: var(--gold);
  pointer-events: none; white-space: nowrap;
  animation: float-up 900ms ease-out forwards;
}
.next-unlocked { animation: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- phones ---------- */
@media (max-width: 420px) {
  /* icon-only brand on small phones so the site links and controls share one row */
  .brand-copy { display: none; }
  .topbar { gap: 8px; }
  .topbar button, .pill-btn { padding: 8px 10px; }
}
@media (max-width: 395px) {
  .shell { padding-left: 12px; padding-right: 12px; }
  .card { width: 58px; height: 86px; font-size: 20px; }
  .card .rank { font-size: 20px; }
  .card .pip { font-size: 22px; }
  #gymList button, #gymList a.gym-link { min-height: 100px; padding: 12px; font-size: 13px; }
  .title-menu h1 { font-size: 32px; }
}
@media (max-width: 350px) {
  .card { width: 50px; height: 76px; font-size: 18px; }
  .card .rank { font-size: 18px; }
  .card .pip { font-size: 19px; }
}

/* ---------- tablets: a little more room ---------- */
@media (min-width: 760px) and (max-width: 1023.98px) {
  .shell { max-width: 640px; }
}

/* ---------- desktop: wide felt table + right-hand column ---------- */
@media (min-width: 1024px) {
  .shell {
    max-width: var(--max);
    padding: 0 32px 56px;
  }
  .topbar { min-height: 72px; margin-bottom: 28px; gap: 12px 24px; }
  .brand-spade { width: 40px; height: 40px; }
  .brand-copy b { font-size: 19px; }
  .topnav { font-size: 15px; margin-right: 8px; }

  /* title: felt art on the left, menu on the right */
  #scr-title:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 12px 40px;
    align-items: start;
  }
  #scr-title > * { grid-column: 2; margin: 0; }
  #scr-title > .title-art { grid-column: 1; grid-row: 1 / span 8; height: auto; min-height: 480px; align-self: stretch; }
  .title-art canvas.title-trainer { width: 192px; height: 192px; }
  .title-menu { padding: 36px 32px; text-align: left; }
  .title-menu h1 { font-size: 56px; }
  .title-menu .row { align-items: stretch; }
  #scr-title > .hint, #scr-title > div:not(.title-art):not(.window) { text-align: left !important; }

  /* class select: grid of styles + detail panel */
  #scr-class:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
    gap: 24px;
    align-items: start;
  }
  .class-grid { grid-template-columns: repeat(3, 1fr); }
  #classDetail { position: sticky; top: 24px; }

  /* home: main column + side column */
  #scr-map:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
    gap: 24px;
    align-items: start;
  }
  .today-hero { padding: 32px; }
  .today-hero-title { font-size: 40px; }
  .today-hero .row { max-width: 560px; }
  #gymList { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  #gymList button, #gymList a.gym-link { min-height: 140px; }

  /* play screen: the table on the left, progress / coach / guides on the right */
  #scr-battle:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-rows: repeat(4, auto) 1fr;
    gap: 0 28px;
    align-items: start;
  }
  #scr-battle > .battle-table { grid-column: 1; grid-row: 1 / span 5; position: sticky; top: 24px; }
  #scr-battle > .battle-stage,
  #scr-battle > .battle-talk,
  #scr-battle > .battle-side,
  #scr-battle > .related-guides { grid-column: 2; }
  #scr-battle > .battle-stage { grid-row: 1; }
  #scr-battle > .battle-talk { grid-row: 2; }
  #scr-battle > .battle-side { grid-row: 3; }
  #scr-battle > .related-guides { grid-row: 4; }
  .hand-panel {
    min-height: 560px;
    padding: 36px 32px 32px;
    border-radius: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 40px 80px -40px rgba(10, 44, 33, 0.75), inset 0 0 0 10px var(--felt-lo), inset 0 0 0 12px rgba(232, 181, 58, 0.45);
  }
  .hand-panel > h2 { font-size: 13px; margin-bottom: 22px; }
  .hand { gap: 14px; }
  .card { width: 96px; height: 136px; border-radius: 12px; }
  .card .rank { font-size: 32px; }
  .card .pip { font-size: 36px; }
  .card[data-held='true']::after, .card[data-picked='true']::after { font-size: 11px; }
  .zone { margin-bottom: 26px; }
  .zone-head { font-size: 13px; margin-bottom: 12px; }
  .hand-panel .row { max-width: 640px; width: 100%; margin-left: auto; margin-right: auto; margin-top: 24px; }
  .hand-panel .row > button { min-height: 56px; font-size: 17px; }
  #pays, #holdHint, .first-nudge { font-size: 15px; }

  /* review: two columns of cards and controls */
  #scr-review:not([hidden]) { max-width: 860px; margin: 0 auto; }
  #scr-lesson:not([hidden]) { max-width: 760px; margin: 0 auto; }
}

/* First-hand nudge: a one-time pulse on the controls that are already legal.
   Shown at most once per device, 6s after hand 1 is dealt with no decision. */
.first-nudge { margin: 8px 0 0; text-align: center; color: var(--gold); font-weight: 700; }
.row.nudge button:not(:disabled), button.nudge:not(:disabled) { animation: nudgePulse 1.1s ease-in-out 3; }
@keyframes nudgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 181, 58, 0); }
  50% { box-shadow: 0 0 0 4px rgba(232, 181, 58, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .row.nudge button:not(:disabled), button.nudge:not(:disabled) { animation: none; outline: 3px solid var(--gold); outline-offset: 2px; }
}

/* First visit: one primary action; offline/install chatter stays quiet below it. */
#offlineStatus { font-size: 11px; opacity: .7; margin-top: 4px; }
#scr-title.first-visit .title-menu .row button.primary { font-size: 1.1em; padding-top: 14px; padding-bottom: 14px; }
#scr-title.first-visit #btnDaily { opacity: .9; }
