/* ============================================================
   Poker Trainer — design system
   ============================================================ */

:root {
  /* ------------------------------------------------------------------
   * A private card room, lit low.
   *
   * The palette this replaces was slate and navy — the dark theme every
   * generated interface arrives in — with a yellow gold on top. Nothing in
   * it belonged to poker. The ground here is felt seen in poor light, the
   * edges are the wood of the rail, the accent is brass rather than yellow,
   * and the text is bone rather than blue-white. One accent, used for the
   * thing that matters on a screen and nothing else.
   * ------------------------------------------------------------------ */

  /* Ground: black with a green cast, the way felt reads in low light. */
  --bg: #080d0a;
  --bg-raised: #0f1712;
  --bg-card: #141f18;
  --bg-hover: #1b2a20;

  /* Edges: the rail, and a brass hairline for the things that matter. */
  --border: #24352a;
  --border-bright: #354a3b;
  --brass-line: #6b5423;

  /* Ink: bone and warm greys. Blue-white on a warm ground reads as a screen;
     bone reads as a printed card. */
  --text: #f4efe3;
  --text-dim: #b9b09c;
  --text-faint: #8f8878;

  /* One accent. Brass, not yellow: metal has a green-brown in it. */
  --gold: #d9b44a;
  --gold-dim: #8a6f23;

  --green: #58c68b;
  --red: #f2717a;
  --blue: #6aa9e8;
  --purple: #b39ae8;
  --orange: #e8a33d;

  /* The table itself, richer than the ground it sits on. */
  --felt-1: #1d6b46;
  --felt-2: #0c3a25;
  --felt-rail: #2b1d12;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.45);

  /* Bodoni for anything that announces itself — the engraved register of a
     chip plaque and a table sign. Archivo does the interface work; it has a
     grotesque's spine rather than a system font's neutrality. */
  /* One family. A display serif was tried for headings and it was wrong:
     high-contrast didone strokes go spindly on short words like "Nit" and
     read as a fashion masthead rather than a card room. */
  --font-display: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;

  --t-xs: 0.75rem;
  --t-sm: 0.8125rem;
  --t-base: 0.9375rem;
  --t-md: 1.0625rem;
  --t-lg: 1.3125rem;
  --t-xl: 1.75rem;
  --t-2xl: 2.25rem;
  --t-3xl: 3rem;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  --tracking-tight: -0.01em;
  --tracking-label: 0.14em;
}

/* Numbers are the content of this app, not decoration around it. Every
   figure it prints sits in tabular, lining figures so a column of equities
   or pot sizes reads as a column rather than as ragged text. */
.mono, .badge, .metric-value, td, th, input[type='number'] {
  font-variant-numeric: tabular-nums lining-nums;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 700px at 15% -10%, #14304a 0%, transparent 55%),
    radial-gradient(900px 600px at 90% 0%, #2a1a3d 0%, transparent 50%),
    var(--bg);
  background-attachment: fixed;
}

h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: var(--t-xl); }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-md); }
p { margin: 0 0 0.9em; }
a { color: var(--blue); }

/* ---------------- layout ---------------- */

#app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  background: rgba(11, 15, 20, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand {
  font-weight: 800;
  font-size: var(--t-md);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.brand .pip { color: var(--gold); font-size: var(--t-lg); }

.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: var(--t-base);
  font-weight: 550;
  padding: 7px 13px;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.tab:hover { background: var(--bg-hover); color: var(--text); }
.tab.active { background: var(--gold); color: #23180a; }

main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 64px;
}

.screen { animation: rise 0.25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- rank chip ---------------- */

.rank-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 14px 5px 8px;
  cursor: pointer;
  /* It is a button so it is reachable by keyboard and reads as clickable,
     but it should keep looking exactly like the chip it replaced. */
  color: inherit;
  font: inherit;
  text-align: left;
}
.rank-chip:hover { border-color: var(--border-bright); }
.rank-chip .emoji { font-size: var(--t-lg); }
.rank-chip .meta { display: flex; flex-direction: column; line-height: 1.15; }
.rank-chip .name { font-weight: 650; font-size: var(--t-sm); }
.rank-chip .xp { font-size: var(--t-xs); color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* ---------------- cards & panels ---------------- */

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.panel + .panel { margin-top: 16px; }
.panel-title {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.panel-title h2, .panel-title h3 { margin: 0; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: var(--t-sm); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack-sm > * + * { margin-top: 8px; }

/* ---------------- buttons ---------------- */

.btn {
  appearance: none;
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
  background: var(--bg-hover);
  color: var(--text);
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover:not(:disabled) { background: #2a3846; border-color: #4a5c72; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.primary { background: var(--gold); border-color: var(--gold); color: #23180a; }
.btn.primary:hover:not(:disabled) { background: #f0c455; border-color: #f0c455; }
.btn.danger { background: #3a1a1d; border-color: #6b2a30; color: #ff9ea2; }
.btn.danger:hover:not(:disabled) { background: #4d2226; }
.btn.success { background: #123a2a; border-color: #1f6b4d; color: #6ee7b7; }
.btn.success:hover:not(:disabled) { background: #174b36; }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.lg { padding: 13px 26px; font-size: var(--t-base); }
.btn.sm { padding: 6px 12px; font-size: var(--t-sm); }
.btn.block { width: 100%; }

/* ---------------- progress ---------------- */

.bar {
  height: 8px;
  background: #0c1219;
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bar.green > span { background: linear-gradient(90deg, #1f7a55, var(--green)); }
.bar.red > span { background: linear-gradient(90deg, #8f2b2f, var(--red)); }

/* ---------------- module tiles ---------------- */

.module-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}
.module-tile:hover:not(.locked) { transform: translateY(-2px); border-color: var(--gold-dim); background: var(--bg-hover); }
.module-tile.locked { opacity: 0.45; cursor: not-allowed; }
.module-tile .icon { font-size: var(--t-xl); }
.module-tile .name { font-weight: 650; }
.module-tile .tagline { font-size: var(--t-sm); color: var(--text-dim); }
.module-tile .mastery { font-size: var(--t-xs); color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* ---------------- stat tiles ---------------- */

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); }
.stat .value { font-size: var(--t-lg); font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .sub { font-size: var(--t-xs); color: var(--text-dim); }
.stat .value.good { color: var(--green); }
.stat .value.bad { color: var(--red); }

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

.question {
  font-size: var(--t-md);
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 16px;
}

.options { display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--bg-raised);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.08s;
}
.option:hover:not(:disabled) { border-color: var(--border-bright); background: var(--bg-hover); }
.option:active:not(:disabled) { transform: translateY(1px); }
.option .key {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: 6px;
  background: #0e1620;
  border: 1px solid var(--border);
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--text-faint);
}
.option.correct { border-color: var(--green); background: rgba(62, 207, 142, 0.12); }
.option.correct .key { background: var(--green); color: #06281a; border-color: var(--green); }
.option.wrong { border-color: var(--red); background: rgba(242, 85, 90, 0.12); }
.option.wrong .key { background: var(--red); color: #2a0a0c; border-color: var(--red); }
.option:disabled { cursor: default; }

.feedback {
  margin-top: 16px;
  padding: 15px 17px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border-bright);
  background: var(--bg-raised);
  animation: rise 0.2s ease;
  white-space: pre-line;
}
.feedback.correct { border-left-color: var(--green); }
.feedback.wrong { border-left-color: var(--red); }
.feedback .verdict { font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.feedback.correct .verdict { color: var(--green); }
.feedback.wrong .verdict { color: var(--red); }

.streak-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 12px; font-size: var(--t-sm); font-weight: 600;
}
.streak-pill.hot { border-color: var(--orange); color: var(--orange); }

/* ---------------- lesson ---------------- */

.lesson-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 11px; }
.lesson-points li {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.lesson-points li::before {
  content: '';
  flex: none; width: 7px; height: 7px; margin-top: 8px;
  border-radius: 99px; background: var(--gold);
}

/* ---------------- toasts ---------------- */

#toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  display: flex; gap: 12px; align-items: center;
  max-width: 340px;
  animation: toastIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.toast .icon { font-size: var(--t-lg); }
.toast .title { font-weight: 700; font-size: var(--t-base); }
.toast .desc { font-size: var(--t-sm); color: var(--text-dim); }
.toast.leaving { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ---------------- misc ---------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 3px 8px; border-radius: 5px;
  background: var(--bg-hover); color: var(--text-dim); border: 1px solid var(--border);
}
.badge.gold { background: rgba(227, 178, 60, 0.15); color: var(--gold); border-color: var(--gold-dim); }
.badge.green { background: rgba(62, 207, 142, 0.14); color: var(--green); border-color: #1f6b4d; }
.badge.red { background: rgba(242, 85, 90, 0.14); color: var(--red); border-color: #6b2a30; }

.achievement {
  display: flex; gap: 12px; align-items: center;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.achievement.locked { opacity: 0.35; }
.achievement .icon { font-size: var(--t-xl); }
.achievement .name { font-weight: 650; font-size: var(--t-base); }
.achievement .desc { font-size: var(--t-xs); color: var(--text-dim); }

.empty { text-align: center; padding: 40px 20px; color: var(--text-faint); }

.sparkline { width: 100%; height: 90px; display: block; }

.notice {
  background: rgba(77, 159, 255, 0.08);
  border: 1px solid rgba(77, 159, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  font-size: var(--t-base);
}
.notice.warn { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.35); }





/* ============================================================
   Guided lessons
   ============================================================ */

.lesson-body p {
  font-size: var(--t-base);
  line-height: 1.68;
  color: var(--text);
  margin: 0 0 14px;
}
.lesson-body strong { color: var(--gold); font-weight: 650; }

.inline-code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: #0c1219;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--green);
  white-space: nowrap;
}

.visual {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 18px 0;
}
.visual-caption {
  margin-top: 12px;
  font-size: var(--t-base);
  color: var(--text-dim);
  line-height: 1.55;
}
.visual-caption strong { color: var(--gold); }

/* Proportional stacked bar */
.stack-bar {
  display: flex;
  height: 46px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.stack-seg {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: var(--t-base);
  min-width: 0;
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.stack-seg > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.stack-seg.gold { background: linear-gradient(180deg, #e3b23c, #b98c1f); color: #23180a; }
.stack-seg.blue { background: linear-gradient(180deg, #4d9fff, #2f6dbd); color: #06121f; }
.stack-seg.green { background: linear-gradient(180deg, #3ecf8e, #22996a); color: #04220f; }

.stack-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: var(--t-sm); color: var(--text-dim); }
.stack-key { display: inline-flex; align-items: center; gap: 7px; }
.stack-key .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.stack-key .swatch.gold { background: var(--gold); }
.stack-key .swatch.blue { background: var(--blue); }
.stack-key .swatch.green { background: var(--green); }

/* Need-vs-have comparison */
.gauge-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.gauge-label { width: 130px; flex: none; font-size: var(--t-sm); color: var(--text-dim); }
.gauge-track { flex: 1; height: 22px; background: #0c1219; border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 99px; transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.gauge-fill.need { background: linear-gradient(90deg, #8f6a1a, var(--gold)); }
.gauge-fill.have { background: linear-gradient(90deg, #1f7a55, var(--green)); }
.gauge-value { width: 52px; flex: none; text-align: right; font-family: var(--mono); font-weight: 700; font-size: var(--t-base); }

/* Reference tables inside lessons */
.lesson-table { width: 100%; border-collapse: collapse; font-size: var(--t-base); }
.lesson-table th {
  text-align: left;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.lesson-table td {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.lesson-table tr:last-child td { border-bottom: 0; }
.lesson-table td:first-child { color: var(--text); font-weight: 550; }
.lesson-table td:not(:first-child) { color: var(--gold); font-weight: 650; }



.lesson-body em, .feedback em, .visual-caption em { color: var(--text); font-style: italic; opacity: 0.92; }

.version-chip {
  appearance: none;
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  color: var(--text-faint);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 7px;
  margin-left: 8px;
  cursor: pointer;
  vertical-align: middle;
  transition: color 0.15s, border-color 0.15s;
}
.version-chip:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ============================================================
   The Lab — interactive spots
   ============================================================ */

.lab-felt {
  background: radial-gradient(ellipse at 50% 40%, var(--felt-1) 0%, var(--felt-2) 78%);
  border: 8px solid var(--felt-rail);
  border-radius: 20px;
  padding: 20px 18px;
  display: grid;
  gap: 16px;
  justify-items: center;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.45);
}

.lab-pot {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 99px;
  padding: 6px 18px;
  font-weight: 700;
  font-size: var(--t-md);
  font-variant-numeric: tabular-nums;
}
.lab-pot .label { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.6); font-weight: 700; }
.lab-bet { font-size: var(--t-xs); font-weight: 600; color: var(--gold); }

.lab-board { min-height: 78px; display: flex; align-items: center; }
.lab-hands { display: flex; gap: 32px; flex-wrap: wrap; justify-content: center; }
.lab-hand { display: grid; gap: 5px; justify-items: center; }

.lab-entry {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 16px 0 10px;
}
.lab-input {
  width: 130px;
  font-family: var(--mono);
  font-size: var(--t-xl);
  font-weight: 700;
  text-align: right;
  color: var(--gold);
  background: var(--bg-raised);
  border: 2px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.lab-input:focus { outline: none; border-color: var(--gold); }
.lab-unit { font-size: var(--t-lg); font-weight: 700; color: var(--gold); }
.lab-amount {
  font-family: var(--mono);
  font-size: var(--t-xl);
  font-weight: 700;
  color: var(--gold);
  min-width: 92px;
}

.lab-slider { width: 100%; accent-color: var(--gold); height: 8px; }

.confidence {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
/* An armed answer, waiting on "how sure are you?" to send it. */
.action-buttons .btn.chosen {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.confidence-btn { border-color: var(--gold-dim); }
.confidence-btn:hover:not(:disabled) { background: var(--gold); color: #23180a; border-color: var(--gold); }

/* Calibration table on the Progress page */
.calib-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.calib-row:last-child { border-bottom: 0; }
.calib-label { width: 110px; flex: none; font-size: var(--t-base); }
.calib-track { flex: 1; height: 18px; background: #0c1219; border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.calib-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #1f7a55, var(--green)); }
.calib-fill.low { background: linear-gradient(90deg, #8f2b2f, var(--red)); }
.calib-value { width: 96px; flex: none; text-align: right; font-family: var(--mono); font-size: var(--t-sm); font-weight: 700; }



/* Glossary terms embedded in lesson prose */
.term {
  appearance: none;
  font: inherit;
  color: var(--blue);
  background: none;
  border: 0;
  border-bottom: 1px dashed var(--blue);
  padding: 0;
  cursor: pointer;
  line-height: inherit;
}
.term:hover { color: #7fbcff; border-bottom-style: solid; }
.term::after { content: '?'; font-size: 0.62em; vertical-align: super; margin-left: 1px; opacity: 0.75; }
.term.open { color: var(--gold); border-bottom-color: var(--gold); }

.term-def {
  background: var(--bg-raised);
  border: 1px solid var(--blue);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 10px 0 14px;
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--text-dim);
  animation: rise 0.18s ease;
}
.term-def-head { font-weight: 700; color: var(--text); margin-bottom: 4px; }

.glossary-entry {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.glossary-entry:last-child { border-bottom: 0; }
.glossary-term { font-weight: 700; font-size: var(--t-base); color: var(--gold); }
.glossary-short { font-size: var(--t-base); color: var(--text); margin: 2px 0 6px; }
.glossary-full { font-size: var(--t-base); color: var(--text-dim); line-height: 1.6; }

/* Told-you-you-are-behind banner */
.update-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 20px;
  background: linear-gradient(180deg, #3a2c08, #2a2006);
  border-bottom: 1px solid var(--gold-dim);
  font-size: var(--t-base);
}
.update-banner strong { color: var(--gold); }
.update-banner .faint { max-width: 70ch; }



/* ============================================================
   Responsive layer
   ------------------------------------------------------------
   Built around how this actually gets used: iPad most of the
   time, iPhone next, desktop least. So the touch layouts are
   the considered ones rather than a shrunken desktop.

   Two rules throughout:
     - Anything you tap is at least 44px tall (Apple's guidance;
       below that people miss).
     - Any focusable input is at least 16px, because iOS Safari
       zooms the whole page when you focus something smaller and
       does not zoom back out.
   ============================================================ */

/* Respect the notch and home indicator rather than sitting under them. */
.topbar { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
main { padding-bottom: max(64px, calc(48px + env(safe-area-inset-bottom))); }

/* iOS zooms the page on focus if a field is under 16px, and never zooms back. */
input, textarea, select { font-size: max(16px, 1rem); }
.lab-input { font-size: var(--t-xl); }

/* Comfortable touch targets everywhere it matters. */
@media (pointer: coarse) {
  .tab { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 15px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 44px; }
  .option { min-height: 52px; }
  .term { padding: 3px 0; }
  .rank-chip { min-height: 44px; }
  input[type="range"] { height: 34px; }

  /* Small chips and inline links keep their look but get a full-size hit
     area, so they are not the one thing on the page you have to aim at. */
  .version-chip { min-height: 44px; padding: 5px 12px; }
  .panel a, .lesson-body a, .glossary-full a { display: inline-block; padding: 11px 0; min-height: 44px; }
}

/* ---- Tablet and phone: one scrolling row of tabs, never a wrapped block ---- */
@media (max-width: 1023px) {
  .topbar { padding-top: 8px; padding-bottom: 8px; gap: 10px; }
  /* Explicit order for every direct child: an unordered one defaults to 0
     and jumps ahead of the brand, which is how the language switch first
     landed to the left of the logo. */
  .brand { order: 1; font-size: var(--t-base); }
  .lang-switch { order: 2; margin-left: auto; }
  .rank-chip { order: 3; margin-left: 0; }
  .tabs {
    order: 4;
    width: 100%;
    flex: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }

  main { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .panel { padding: 15px; }
  h1 { font-size: var(--t-xl); }
}

/* ---- Phone ---- */
@media (max-width: 700px) {
  main { padding-top: 14px; }
  .panel { padding: 13px; }
  h1 { font-size: var(--t-lg); }
  h2 { font-size: var(--t-md); }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .stat .value { font-size: var(--t-lg); }
  .lesson-body p { font-size: var(--t-base); line-height: 1.62; }
  .question { font-size: var(--t-md); }

  /* Stacked, full-width actions beat three cramped ones in a row. */
  .action-buttons .btn { min-width: 0; flex: 1 1 100%; }
  .row > .btn, .action-buttons > .btn { flex: 1 1 auto; }

  .gauge-label { width: 88px; font-size: var(--t-xs); }
  .calib-label { width: 84px; font-size: var(--t-sm); }
  .calib-value { width: 74px; font-size: var(--t-xs); }
  .lab-input, .lab-amount { font-size: var(--t-xl); }

  /* 169 cells across a phone: let it scroll rather than crush each one. */
  .range-grid { min-width: 430px; }
  .range-grid-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .range-cell { font-size: var(--t-xs); }

  #toasts { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
}

/* Landscape phone: very little height, so trim the vertical furniture. */
@media (max-height: 460px) and (orientation: landscape) {
  .topbar { position: static; }
  main { padding-top: 10px; }
  .panel { padding: 11px; }
}

/* Language switch: a pair of chips rather than a dropdown, so the other
   language is one tap away and visibly exists. */
.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
}
.lang-chip {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
}
.lang-chip:hover { color: var(--text); }
.lang-chip.active { background: var(--bg-raised); color: var(--text); }

@media (pointer: coarse) {
  .lang-chip { min-height: 40px; padding: 6px 12px; }
}


/* ---- Hands-on lesson exercises ------------------------------------ *
   Real cards inside a lesson. The outs grid is the important one: after
   grading it marks the cards you found, the ones you missed and the ones
   that never won, so the correction lands on the cards themselves rather
   than on a number in a sentence.                                      */
.practice {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  background: rgba(214, 168, 63, 0.04);
}
.practice-prompt { font-weight: 600; margin-bottom: 14px; }
.practice-label {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 5px;
}
.practice-table { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.practice-seat.villain { opacity: 0.9; }
.practice-board { margin-bottom: 14px; }
.practice-hands { display: flex; flex-wrap: wrap; gap: 12px; }
.practice-hand {
  flex: 1 1 150px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}
.practice-hand:hover:not(:disabled) { border-color: var(--border-bright); }
.practice-hand.correct { border-color: var(--green); background: rgba(62, 207, 142, 0.1); }
.practice-hand.wrong { border-color: var(--red); background: rgba(242, 85, 90, 0.1); }
.practice-hand:disabled { cursor: default; }

.practice-money { display: flex; flex-wrap: wrap; gap: 10px; }
.practice-money-tile {
  flex: 1 1 90px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.practice-input {
  width: 110px;
  font-size: max(16px, 1rem);
  font-family: var(--mono);
  padding: 10px 12px;
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* The deck as a real matrix: a suit per row, a rank per column, so finding
   a card is reading a coordinate rather than scanning 45 tiles. Cards already
   on the table are left as gaps, which keeps the columns honest. */
.out-deck {
  display: grid;
  grid-template-columns: 1.6rem repeat(13, minmax(0, 1fr));
  gap: 4px;
  align-items: center;
}
.out-corner { }
.out-heading {
  text-align: center;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--text-faint);
  font-family: var(--mono);
}
.out-suit {
  text-align: center;
  font-size: var(--t-md);
  color: var(--text-dim);
}
.out-suit.red { color: #e2646a; }
.out-gap {
  aspect-ratio: 3 / 4;
  max-height: 54px;
  border-radius: 5px;
  border: 1px dashed var(--border);
  opacity: 0.25;
}
.out-cell {
  aspect-ratio: 3 / 4;
  /* On a wide screen the columns get generous and a 3:4 tile grows tall
     enough to push the grid off the fold. The rank is the only thing inside
     it, so the extra height buys nothing. */
  max-height: 54px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: var(--t-base);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.out-cell.red { color: #e2646a; }
.out-cell:hover:not(:disabled) { border-color: var(--border-bright); color: var(--text); }
.out-cell.picked { background: rgba(214, 168, 63, 0.24); border-color: var(--gold); color: var(--text); }
.out-cell.hit { background: rgba(62, 207, 142, 0.28); border-color: var(--green); color: var(--text); }
.out-cell.missed { border-color: var(--gold); border-width: 2px; background: rgba(214, 168, 63, 0.12); }
.out-cell.wrong { background: rgba(242, 85, 90, 0.22); border-color: var(--red); }
.out-cell:disabled { cursor: default; }

@media (pointer: coarse) {
  .out-cell { min-height: 38px; }
  .practice-input { min-height: 44px; }
}
@media (max-width: 700px) {
  .practice { padding: 12px; }
  .practice-table { gap: 12px; }
  .out-deck { grid-template-columns: 1.1rem repeat(13, minmax(0, 1fr)); gap: 2px; }
  .out-cell { font-size: var(--t-xs); }
  .out-heading { font-size: var(--t-xs); }
  .out-suit { font-size: var(--t-sm); }
}

/* Where the hand stands before you start tapping outs. */
.practice-standing {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--gold-dim);
  background: var(--bg-raised);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--t-base);
}

/* Action buttons for the choice exercises. */
.practice-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.practice-choice {
  flex: 1 1 180px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
}
.practice-choice:hover:not(:disabled) { border-color: var(--border-bright); }
.practice-choice.correct { border-color: var(--green); background: rgba(62, 207, 142, 0.12); }
.practice-choice.wrong { border-color: var(--red); background: rgba(242, 85, 90, 0.12); }
.practice-choice:disabled { cursor: default; }
@media (pointer: coarse) { .practice-choice { min-height: 52px; } }

/* The learning report: a big readable block of text meant to be copied. */
.report-box {
  width: 100%;
  font-family: var(--mono);
  font-size: 16px;          /* iOS zooms the page below this on focus */
  line-height: 1.5;
  resize: vertical;
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

/* Collapsed background inside a lesson. Explicitly tagged optional, because
   a derivation printed inline reads as one more thing to memorise. */
.aside {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}
.aside-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.aside-toggle:hover { color: var(--text); }
.aside-caret { font-size: var(--t-sm); }
.aside-tag {
  margin-left: auto;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 8px;
}
.aside-body { padding: 0 14px 12px; color: var(--text-dim); }
.aside-body p { margin: 0 0 10px; }
@media (pointer: coarse) { .aside-toggle { min-height: 48px; } }

/* ---- exercises asked over a real felt ---- */

.felt.spot-felt {
  /* The game's felt is 16:10 and 420px tall because it has six seats around
     it. This one has a board and your two cards, so it is sized to them.
     Compounded with .felt because table.css loads after this file. */
  aspect-ratio: auto;
  min-height: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 22px 14px;
  margin-bottom: 14px;
}
.felt.spot-felt .board-area {
  position: static;
  left: auto; top: auto;
  transform: none;
  display: grid;
  justify-items: center;
  gap: 8px;
}
.felt.spot-felt .board { min-height: 0; }
.felt.spot-felt::before { font-size: var(--t-3xl); }
.spot-hole {
  display: grid;
  justify-items: center;
  gap: 4px;
  position: relative;
  z-index: 1;
}
.spot-hole.villain { opacity: 0.92; }
.spot-hole-label {
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}
.felt.spot-felt .spot-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.felt.spot-felt .pot-chip { position: static; transform: none; }

.practice-question { font-size: var(--t-md); font-weight: 650; margin-bottom: 12px; }

.practice-options { display: grid; gap: 8px; }
.practice-option { text-align: left; justify-content: flex-start; }
.practice-option.correct { border-color: var(--green); background: rgba(62, 207, 142, 0.12); }
.practice-option.wrong { border-color: var(--red); background: rgba(242, 85, 90, 0.12); }

.practice-entry { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (min-width: 640px) {
  .practice-options { grid-template-columns: 1fr 1fr; }
}

/* ---- The seat ring, used to ask about position ---------------------- *
   Same table as the game, stripped of everything the question is not
   about: no pot, no board, no stacks. Compounded with .felt because
   table.css loads after this file and would otherwise win. */
.felt.seat-felt {
  aspect-ratio: 16 / 9;
  min-height: 300px;
  max-height: 420px;
  margin-bottom: 14px;
}
.felt.seat-felt .pot-chip,
.felt.seat-felt .street-tag,
.felt.seat-felt .board,
.felt.seat-felt .seat-stack { display: none; }
.felt.seat-felt .seat-pos:empty { display: none; }
.felt.seat-felt::before { font-size: var(--t-3xl); }

/* ---- Typing the answer instead of picking it ------------------------ */
.drill-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.drill-entry-input {
  flex: 1 1 120px;
  min-width: 110px;
  max-width: 200px;
  font-size: var(--t-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-bright);
  background: var(--bg-raised);
  color: var(--text);
}
.drill-entry-input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.drill-entry-unit { font-size: var(--t-lg); font-weight: 700; color: var(--text-dim); }

/* The clipboard can refuse; the text still has to be gettable by hand. */
.copy-fallback {
  display: block;
  width: 100%;
  min-height: 160px;
  margin-top: 10px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--t-sm);
  line-height: 1.5;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
  background: var(--bg-raised);
  color: var(--text);
  white-space: pre;
}

/* ---- The one module the home screen is pointing at ------------------ *
   A tier badge says what state a module is in; several can read the same
   thing at once. This says which one to open, so the banner above and the
   grid below cannot disagree. */
.module-tile.next-up {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-dim) inset;
}
.badge.next-badge {
  background: var(--gold);
  color: #23180a;
  border-color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* A lesson table says out loud what it has simplified away. */
.panel.lesson-note {
  border-color: var(--gold-dim);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: var(--t-base);
  line-height: 1.55;
  display: grid;
  gap: 4px;
}

/* ---- A lesson run: the counter, the warning, the report ------------- */
.lesson-warning {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--gold);
  background: rgba(227, 178, 60, 0.08);
  border-radius: var(--radius-sm);
  font-size: var(--t-base);
}
.run-report { display: block; }
.run-mistake {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.run-mistake:last-of-type { border-bottom: 0; }
.run-mistake-head { font-weight: 650; color: var(--red); }

/* ---------------- the drill's cheat sheet ---------------- */

.cheat-sheet {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 8px;
}
.cheat-scroll { overflow-x: auto; }
.cheat-steps { margin: 8px 0 12px; padding-left: 20px; color: var(--text-dim); font-size: var(--t-sm); line-height: 1.5; }
.cheat-steps li { margin-bottom: 3px; }
.cheat-table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: var(--t-sm); }
.cheat-table th, .cheat-table td { padding: 5px 9px; text-align: center; white-space: nowrap; }
.cheat-table thead th { color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--border); }
.cheat-table tbody th { text-align: left; color: var(--text-dim); font-family: var(--font); font-weight: 500; }
.cheat-table td { color: var(--text); }
/* The column the question is actually about. */
.cheat-table .here { color: var(--gold); background: rgba(227, 178, 60, 0.08); }

/* One rung of a module's mastery ladder. */
.rung { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.rung:last-child { margin-bottom: 0; }
.rung-here { border-color: var(--gold-dim); background: rgba(227, 178, 60, 0.05); }
.notice.sm { font-size: var(--t-sm); padding: 8px 10px; }

/* The ladder row was styled entirely inline by its one caller, so the class
   carried nothing and a second caller got a bare browser button — white on a
   dark page. The defaults live here now; inline styles still win where a row
   wants to differ. */
.ladder-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* The read asked before the decision it belongs to. */
.read-ask { padding: 4px 2px 8px; }
.read-head { font-weight: 600; margin-bottom: 2px; }
.read-bands { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.read-bands .btn { flex: 1 1 auto; min-width: 68px; }
.read-said { font-size: var(--t-sm); color: var(--text-dim); margin-bottom: 8px; }

/* ------------------------------------------------------------------ *
 * Iconography
 * ------------------------------------------------------------------ */

.icon {
  flex: 0 0 auto;
  display: block;
  /* Stroke icons sit optically low beside text; nudging them up is the
     difference between a row that looks aligned and one that looks nearly
     aligned, which reads as carelessness even when nobody can say why. */
  transform: translateY(-0.5px);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.tab .icon { opacity: 0.55; transition: opacity 120ms ease; }
.tab:hover .icon,
.tab.active .icon { opacity: 1; }

/* A title with an icon in front of it, used by every panel heading. */
.panel-title h2,
.panel-title h3 { display: inline-flex; align-items: center; gap: var(--s-2); }

/* A module's mark: the drawing in a quiet frame, so it reads as an emblem
   rather than as a picture dropped into a paragraph. */
.module-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--gold);
  flex: 0 0 auto;
}
.module-glyph.lg { width: 46px; height: 46px; border-radius: var(--radius); }
.badge .module-glyph { width: auto; height: auto; border: 0; background: none; }
.locked .module-glyph { color: var(--text-faint); }

/* The tab strip has icons now, so it needs room and a scroll of its own
   rather than clipping the last tab off the end. */
.tabs {
  display: flex;
  gap: var(--s-1);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; }

/* ------------------------------------------------------------------ *
 * Typography
 * ------------------------------------------------------------------ */

/* Headings carry their icon inline, so they are flex rows rather than text.
   The icon takes the accent and the words stay plain: two colours in a
   heading is one more than it needs. */
h1, h2, h3 { display: flex; align-items: center; gap: var(--s-2); }
h1 > .icon, h2 > .icon, h3 > .icon { color: var(--gold); }

h1 { font-size: var(--t-xl); letter-spacing: var(--tracking-tight); font-weight: 600; }
h2 { font-size: var(--t-lg); letter-spacing: var(--tracking-tight); font-weight: 600; }
h3 { font-size: var(--t-md); font-weight: 600; }

/* Small capitals do the labelling work — stat captions, table headers, the
   chips that name a state. Tracked open, because capitals set tight are the
   single most common way an interface looks unconsidered. */
.stat-label,
.cheat-table thead th,
.badge.next-badge {
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  font-size: var(--t-xs);
  font-weight: 600;
}

body { font-size: var(--t-base); }
.faint, .muted { font-size: var(--t-sm); }

/* The rank emblems stay pictures on purpose: a fish, a rock, a shark and a
   crown are characters on a ladder, not controls, and line-drawing them
   would make the climb read as a settings page. Struck into a disc so they
   sit as a minted badge rather than as clip art on a panel. */
.rank-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  font-size: var(--t-xl);
  line-height: 1;
  background: radial-gradient(circle at 32% 28%, #26313f, #131a22 72%);
  border: 1px solid var(--border-bright);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-sm);
  flex: 0 0 auto;
}

/* Nine tabs with icons do not fit a tablet in landscape. Rather than clip
   the last one off the end or shrink everything until it is unreadable, only
   the tab you are on says its name. */
@media (max-width: 1180px) {
  .tab span { display: none; }
  .tab.active span { display: inline; }
  .tab { padding-left: var(--s-3); padding-right: var(--s-3); }
}

/* ------------------------------------------------------------------ *
 * Surfaces
 * ------------------------------------------------------------------ */

/* A panel was a flat fill with a flat border, which is why a column of them
   read as a list of boxes rather than as a surface with things on it. One
   hairline of light along the top edge is enough to give it a direction. */
.panel {
  background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  padding: var(--s-5);
}
.panel-title { margin-bottom: var(--s-4); }

/* Buttons had one weight for everything. The gold one is the thing to press;
   the rest should recede rather than compete with it. */
.btn {
  padding: 10px 16px;
  font-size: var(--t-base);
  letter-spacing: 0.005em;
  transition: transform 80ms, background 140ms, border-color 140ms, opacity 140ms, box-shadow 140ms;
}
.btn.primary {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 18px -8px rgba(227, 178, 60, 0.8);
}
.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.btn.sm { font-size: var(--t-sm); padding: 7px 12px; }

/* Badges are labels, not buttons: quieter, and set in the same tracked caps
   as the rest of the labelling. */
.badge {
  font-size: var(--t-xs);
  letter-spacing: 0.01em;
  font-weight: 600;
}


/* The seat mark: the abbreviation the game already uses for a player type.
   A rock for the nit was a pun on an English name; NIT says what you are
   sitting across from, in the vocabulary of the table. */
.style-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
}
.style-tag.lg { font-size: var(--t-sm); padding: 3px 8px; }

/* ==================================================================== *
 * The room
 *
 * The last pass put everything on one scale, one stroke weight and one
 * colour, and the reader's verdict was that it had become harder to tell
 * what was what. That is what uniformity does: hierarchy is made of
 * difference, and the sweep had removed the differences along with the
 * mess. So things that do different jobs look different here — a heading
 * is engraved, a plaque is not a card, a number is brass, and the rail is
 * not the table.
 * ==================================================================== */

/* ---- the rail: chrome, not content ---------------------------------- */

#topbar {
  background:
    linear-gradient(180deg, #120e09 0%, #0b0907 100%);
  border-bottom: 1px solid #000;
  box-shadow: 0 1px 0 var(--brass-line), 0 10px 30px rgba(0, 0, 0, 0.6);
}

.brand {
  font-weight: 700;
  font-size: var(--t-base);
  letter-spacing: 0.01em;
}
.brand .pip { color: var(--gold); }

/* ---- headings: engraved, and ruled off ------------------------------ */

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}
h1 { font-size: var(--t-lg); }
h2 { font-size: var(--t-md); }
/* A section label, which is what an h3 is inside a panel's title bar. The
   tracked capitals are the labelling register — applied to every h3 they
   also shouted a run's score back as "10 OF 10 — THAT IS A PASS", which is a
   sentence with numbers in it, not a label. Hierarchy applied without looking
   is the same mistake as no hierarchy at all. */
h3 {
  font-family: var(--font);
  font-size: var(--t-md);
  font-weight: 700;
  color: var(--text);
}
.panel-title h3,
h3.label {
  font-size: var(--t-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-dim);
}
h1 > .icon, h2 > .icon, h3 > .icon { color: var(--gold); }

/* A brass hairline under a panel's title, the way a plaque is scored. */
.panel-title {
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--s-3);
  position: relative;
}
.panel-title::after {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 44px; height: 1px;
  background: var(--gold);
}

/* ---- two kinds of surface ------------------------------------------- */

/* A card: content you read and act on. Lifted, warm, faintly lit from the
   top left the way a card catches the light of a table lamp. */
.panel {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 42%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--s-5);
}

/* A plaque: a number and its name, struck rather than printed. Deliberately
   not a card — this is the difference the last pass flattened away. */
.stat {
  background: #0b120e;
  border: 1px solid #1d2a21;
  border-top: 1px solid var(--brass-line);
  border-radius: 3px;
  padding: var(--s-4) var(--s-4) var(--s-3);
  box-shadow: inset 0 1px 0 rgba(217, 180, 74, 0.12);
}
.stat .label {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-faint);
}
.stat .value {
  font-family: var(--font-display);
  font-size: var(--t-xl);
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
  margin-top: 2px;
}

/* ---- figures are brass ---------------------------------------------- */

.mono { font-variant-numeric: tabular-nums lining-nums; }
.metric-value, .seat-stack { color: var(--gold); }

/* ---- module marks: struck into a well, not floated on the panel ----- */

.module-glyph {
  background: #0a110d;
  border: 1px solid #1f2d24;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(217, 180, 74, 0.08);
  color: var(--gold);
}
.module-tile.locked .module-glyph { color: #4c5a50; box-shadow: none; }

/* ---- buttons: brass for the one thing to press ---------------------- */

.btn {
  font-family: var(--font);
  font-weight: 600;
  border-radius: var(--radius-sm);
  letter-spacing: 0.01em;
}
.btn.primary {
  background: linear-gradient(180deg, #e6c55f, #b98f1e);
  border-color: #7a5f14;
  color: #1a1305;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 8px 20px -10px rgba(217, 180, 74, 0.9);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #f2d675, #c99c25); }

/* ---- motion: dealt, not faded --------------------------------------- */

@keyframes deal-in {
  from { opacity: 0; transform: translateY(14px) rotate(-0.6deg); }
  to { opacity: 1; transform: none; }
}
.screen > * {
  animation: deal-in 300ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.screen > *:nth-child(2) { animation-delay: 45ms; }
.screen > *:nth-child(3) { animation-delay: 90ms; }
.screen > *:nth-child(4) { animation-delay: 135ms; }
.screen > *:nth-child(n+5) { animation-delay: 170ms; }

@media (prefers-reduced-motion: reduce) {
  .screen > * { animation: none; }
}

/* ---- the floor: unequal columns, because the work is not the chrome ---- */

.floor {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
}
.rail { display: flex; flex-direction: column; gap: var(--s-4); }

/* Plaques stack like a column of chips rather than sitting four-across. */
.plaques { display: flex; flex-direction: column; gap: 3px; }
.plaques .stat { border-radius: 0; }
.plaques .stat:first-child { border-radius: 3px 3px 0 0; }
.plaques .stat:last-child { border-radius: 0 0 3px 3px; }
.plaques .stat + .stat { border-top-color: #1d2a21; }

/* Doors out of the room: a line you walk through, not a card in a row. */
.doors { display: flex; flex-direction: column; }
.door {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: var(--s-3) var(--s-1);
  cursor: pointer;
  transition: padding-left 160ms cubic-bezier(0.2, 0.9, 0.3, 1), color 160ms;
}
.door:last-child { border-bottom: 0; }
.door:hover { padding-left: var(--s-3); color: var(--gold); }
.door:hover .door-arrow { transform: translateX(3px); }
.door-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.door-title { font-weight: 600; font-size: var(--t-base); }
.door-sub { font-size: var(--t-xs); color: var(--text-faint); }
.door-arrow { color: var(--text-faint); transition: transform 160ms; }

/* The module grid is the point of the screen, so it gets the room. */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--s-3);
}

/* One column once the rail would squeeze the work. */
@media (max-width: 900px) {
  .floor { grid-template-columns: 1fr; }
  .rail { order: 2; }
}

/* The rail's controls do not wrap onto a second line: a topbar that grows a
   row when a word gets longer is a topbar that jumps as you switch language.
   The tab strip scrolls inside its own box instead — min-width:0 is what lets
   a flex child shrink below its content, and without it the strip pushes the
   whole page wider rather than scrolling. */
/* Two rows on purpose. Squeezing the brand, nine tabs, a language switch and
   a rank chip onto one line meant the bar silently grew a second row at some
   widths and not others — 64px at one size, 86px at the next. A rail that
   changes height as you resize reads as an accident, so this is two rows
   everywhere: who you are on top, where you can go beneath it. */
#topbar { flex-wrap: wrap; row-gap: var(--s-2); }
#topbar > .brand { margin-right: auto; }
.tabs {
  order: 10;
  flex: 1 0 100%;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  border-top: 1px solid rgba(217, 180, 74, 0.14);
  padding-top: var(--s-2);
}
/* With a row of its own there is room for the words again. */
@media (max-width: 1180px) {
  .tab span { display: inline; }
}

/* ==================================================================== *
 * The career: a room you are standing in, not a dashboard
 * ==================================================================== */

.room { padding: 0; overflow: hidden; }
.room-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-5);
  padding: var(--s-5) var(--s-5) var(--s-4);
  background:
    radial-gradient(ellipse 120% 140% at 12% -20%, rgba(29, 107, 70, 0.4), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}
.room-where {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-faint);
}
.room h1 { margin: 2px 0 4px; }
.room-colour { color: var(--text-dim); max-width: 52ch; }

.room-money { text-align: right; flex: 0 0 auto; }
.pocket {
  font-family: var(--mono);
  font-size: var(--t-xl);
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.pocket-label { font-size: var(--t-xs); color: var(--text-faint); }

/* The facts of the room, struck along a strip like markings on a rail. */
.room-strip {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #0a110d;
}
.chip-fact {
  flex: 1;
  padding: var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chip-fact + .chip-fact { border-left: 1px solid var(--border); }
.chip-fact .k {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-faint);
}
.chip-fact .v { font-family: var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }

.resident {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-4) var(--s-5);
}
.resident-text { min-width: 0; }
.resident-name { font-weight: 600; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

.sit-row, .broke { padding: 0 var(--s-5) var(--s-5); display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.notice.broke { margin: 0 var(--s-5) var(--s-5); padding: var(--s-4); display: block; }

/* The next door, and how far off it is. */
.door-name { font-weight: 600; font-size: var(--t-md); }
.door-need .mono { color: var(--gold); font-variant-numeric: tabular-nums; }

/* The building, as a list of doors along a corridor. */
.rooms { display: flex; flex-direction: column; }
.room-row {
  display: grid;
  grid-template-columns: 58px 1fr auto auto auto;
  gap: var(--s-3);
  align-items: center;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: var(--s-3) var(--s-2);
  cursor: pointer;
}
.room-row:last-child { border-bottom: 0; }
.room-row:hover:not(:disabled) { background: rgba(255, 255, 255, 0.02); }
.room-row.here { box-shadow: inset 3px 0 0 var(--gold); }
.room-row.shut { opacity: 0.45; cursor: not-allowed; }
.room-stake { font-family: var(--mono); color: var(--gold); font-size: var(--t-sm); }
.room-name { font-weight: 600; min-width: 0; }
.room-gate { font-size: var(--t-xs); color: var(--text-faint); white-space: nowrap; }
.room-beaten { color: var(--green); }

.ledger { padding: 0 var(--s-2); }

/* Study is one line at the bottom now, not the whole screen. */
.study-line {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  font: inherit;
  color: var(--text-dim);
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  transition: color 160ms, border-color 160ms;
}
.study-line:hover { color: var(--gold); border-color: var(--gold-dim); }
.study-line span { flex: 1; text-align: left; }

@media (max-width: 620px) {
  .room-head { flex-direction: column; gap: var(--s-3); }
  .room-money { text-align: left; }
  .room-row { grid-template-columns: 52px 1fr auto; }
  .room-row .style-tag { display: none; }
}
