/* =================================================================
   CHEKA — app styles (one file since 2026-09-28; tokens live in tokens.css).
   The sections below are the historical layers in their original order,
   concatenated unchanged: later sections override earlier ones exactly as
   the separate files did. Prune dead rules section by section, and re-check
   the app at 360×800 / 390×844 after each change.
   ================================================================= */


/* ################################################################
   BASE (prototype, 2026-09-15)   (was css/style.css)
   ################################################################ */

/* ---------------------------------------------------------------
   Dark theme, board-as-hero. Colours live in CSS variables so the
   whole look can be tuned from one place.
--------------------------------------------------------------- */
:root {
  /* Colours, spacing and motion live in css/tokens.css (loaded first). */
  --board-max: 480px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
}
main[hidden] { display: none; }

h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 8px 0 4px;
  letter-spacing: 0.01em;
}

button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
button:active { transform: scale(0.97); }
button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  border-color: transparent;
  box-shadow: 0 4px 0 var(--accent-deep);
}
button.subtle { background: transparent; color: var(--text-dim); }
.icon-btn {
  width: 40px; height: 40px; padding: 0;
  font-size: 26px; line-height: 1;
  display: grid; place-items: center;
}
#sound-toggle { font-size: 18px; }
#sound-toggle.off { opacity: 0.45; }

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  letter-spacing: 0.03em;
}
.pill.w { background: #f0f0f0; color: #1a1a1a; }
.pill.b { background: #2a2a2e; color: #e9e9e9; border: 1px solid #444; }

/* ---------- Home: opening cards ---------- */
.home-header { width: 100%; }
.cards { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px 16px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.card.w::before { background: #e9edf2; }
.card.b::before { background: var(--accent); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card h2 { margin: 0; font-size: 18px; font-weight: 650; }
.card-sub { margin: 0; color: var(--text-dim); font-size: 13px; }
.card-line { margin: 0; font-size: 14px; color: var(--text); opacity: 0.85; font-variant-numeric: tabular-nums; }
.card-actions { display: flex; gap: 10px; margin-top: 6px; }
.card-actions button { flex: 1; }

/* ---------- Home: progress + settings ---------- */
.panel { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.panel-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 10px 0 0;
}
.stat-card, .setting-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { text-align: center; background: var(--surface-2); border-radius: 10px; padding: 8px 4px; }
.stat b { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.stat span { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.weak { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.weak b { color: var(--text); font-weight: 600; }
.weak .dim { opacity: 0.75; }
.row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.row output { color: var(--text-dim); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }
.hint { margin: 0; font-size: 12px; color: var(--text-dim); line-height: 1.5; min-height: 1em; }
.row-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.row-buttons button { flex: 1; }

/* ---------- Trainer ---------- */
.trainer-header {
  width: 100%;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
}
.trainer-title {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 15px; font-weight: 600;
}

.board-wrap {
  position: relative;
  width: min(92vw, var(--board-max));
  aspect-ratio: 1;
  border-radius: 10px;
  padding: 3px;
  background: linear-gradient(160deg, #2b3340, #171b22);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: 7px;
  overflow: hidden;
}
.sq {
  position: relative;
  user-select: none;
  cursor: pointer;
  transition: box-shadow 0.12s ease;
}
.sq.light { background: var(--sq-light); }
.sq.dark  { background: var(--sq-dark); }
.sq.last  { box-shadow: inset 0 0 0 100vmax var(--sq-last); }
.sq.selected { box-shadow: inset 0 0 0 100vmax color-mix(in srgb, var(--accent) 55%, transparent); }
.sq.check { background: radial-gradient(circle, rgba(229, 83, 75, 0.95) 0%, rgba(229, 83, 75, 0.5) 45%, transparent 75%); }
.sq.legal::after {
  content: "";
  position: absolute;
  inset: 0; margin: auto;
  width: 26%; height: 26%;
  border-radius: 50%;
  background: var(--sq-target);
  pointer-events: none;
}
.sq.legal.capture::after {
  width: 86%; height: 86%;
  background: transparent;
  border: 4px solid rgba(15, 25, 40, 0.42);
}
/* Coordinates on the two edges nearest the player. */
.sq[data-rank-label]::before,
.sq[data-file-label]::after {
  position: absolute;
  font-size: clamp(8px, 2.2vw, 11px);
  font-weight: 700;
  color: var(--coord);
  pointer-events: none;
  line-height: 1;
}
.sq[data-rank-label]::before { content: attr(data-rank-label); top: 3px; left: 3px; }
.sq[data-file-label]::after {
  content: attr(data-file-label);
  bottom: 2px; right: 3px;
  /* the ::after slot is shared with legal-move dots; the dot wins while selected */
}
.sq.legal[data-file-label]::after { content: ""; }

.piece {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  padding: 4%;
  box-sizing: border-box;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
  will-change: transform;
}
.piece.slide { transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1); }
.piece.land { animation: land 0.22s ease-out; }
@keyframes land {
  0% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.arrows {
  position: absolute;
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  pointer-events: none;
  overflow: visible;
}
.arrows line {
  stroke: var(--hint);
  stroke-width: 0.18;
  stroke-linecap: round;
  opacity: 0.9;
  marker-end: url(#arrowhead);
  filter: drop-shadow(0 0 0.05px rgba(0, 0, 0, 0.6));
}

.streak-chip {
  position: absolute;
  top: -12px; right: 10px;
  background: var(--surface-2);
  color: var(--warn);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.streak-chip[hidden] { display: none; }
/* Feedback pulses (added by feedback.js right after a move). */
@keyframes flash-good {
  0%   { box-shadow: inset 0 0 0 100vmax rgba(76, 175, 80, 0.85); }
  100% { box-shadow: inset 0 0 0 100vmax rgba(76, 175, 80, 0); }
}
@keyframes flash-bad {
  0%   { box-shadow: inset 0 0 0 100vmax rgba(229, 83, 75, 0.85); }
  35%  { box-shadow: inset 0 0 0 100vmax rgba(229, 83, 75, 0.85); }
  100% { box-shadow: inset 0 0 0 100vmax rgba(229, 83, 75, 0); }
}
.sq.flash-good { animation: flash-good 0.5s ease-out; }
.sq.flash-bad  { animation: flash-bad 0.55s ease-out; }

.status {
  width: min(92vw, var(--board-max));
  min-height: 46px;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  padding: 10px 14px;
  transition: background 0.2s ease, color 0.2s ease;
}
.status.neutral { background: var(--surface); color: var(--text-dim); }
.status.good { background: rgba(76, 175, 80, 0.15); color: var(--good); }
.status.bad  { background: rgba(229, 83, 75, 0.15); color: var(--bad); }
.status.warn { background: rgba(224, 163, 52, 0.15); color: var(--warn); }

.moves {
  width: min(92vw, var(--board-max));
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-dim);
  min-height: 40px;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}
.moves .mv { margin-right: 6px; white-space: nowrap; }
.moves .mv.cur { color: var(--text); font-weight: 600; }

.note {
  width: min(92vw, var(--board-max));
  font-size: 13px;
  color: var(--text-dim);
  padding: 0 4px;
  line-height: 1.5;
}
.note[hidden] { display: none; }
.note.plan {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid var(--good);
  padding: 6px 10px;
  background: rgba(76, 175, 80, 0.08);
  border-radius: 6px;
}

.plan-dialog {
  width: min(500px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}
.plan-dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
.plan-dialog-head,
.plan-dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}
.plan-dialog-head {
  justify-content: space-between;
  color: var(--good);
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.plan-dialog-head .icon-btn { width: 34px; height: 34px; }
.plan-dialog-body { padding: 18px 16px 8px; }
.plan-dialog-body h2 { margin: 0 0 10px; font-size: 19px; line-height: 1.3; }
.plan-dialog-body p { margin: 0; color: var(--text); font-size: 15px; line-height: 1.55; }
.plan-dialog-actions { justify-content: flex-end; padding-top: 16px; }
.plan-dialog-body .plan-credit { margin-top: 10px; color: var(--text-dim); font-size: 12px; }
.plan-dialog-body .plan-credit:empty { display: none; }

@media (max-width: 480px) {
  .plan-dialog-actions button { flex: 1; }
}

.controls { display: flex; gap: 10px; margin-top: 4px; }
.controls[hidden] { display: none; }

/* ---------- Train / Review toggle ---------- */
.segmented {
  width: min(92vw, var(--board-max));
  display: flex;
  background: var(--surface);
  border-radius: 10px;
  padding: 3px;
}
.segmented button {
  flex: 1;
  background: transparent;
  color: var(--text-dim);
  padding: 8px;
  border-radius: 8px;
}
.segmented button.active { background: var(--surface-2); color: var(--text); }
.segmented.small { margin-top: -6px; }
.segmented.small button { font-size: 13px; padding: 6px; }
.segmented[hidden] { display: none; }

/* ---------- Line list (under the tabs) ---------- */
.line-list {
  width: min(92vw, var(--board-max));
  background: var(--surface);
  border-radius: 10px;
  margin-top: -6px;
  font-size: 13px;
}
.line-list[hidden] { display: none; }
.line-list summary {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-weight: 600;
}
.line-list summary::-webkit-details-marker { display: none; }
.line-list summary::after { content: "▾"; color: var(--text-dim); margin-left: auto; }
.line-list[open] summary::after { content: "▴"; }
.line-list summary .dim { font-weight: 500; margin-left: 0; }
#line-rows { padding: 2px 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.line-row {
  display: grid;
  grid-template-columns: 1fr auto 22px;
  gap: 10px;
  align-items: center;
  padding: 8px 8px 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid transparent;
}
.line-row:active { transform: scale(0.99); }
.line-row.playing { border-color: var(--accent); background: rgba(79, 157, 255, 0.10); }
.line-row input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.line-row .lr-name { color: var(--text); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.line-row .lr-moves { color: var(--text-dim); font-size: 12px; margin-top: 1px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
.line-row.hidden-line { opacity: 0.45; }
.lr-badges { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 110px; }
/* mastery bar */
.lr-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); margin-top: 6px; overflow: hidden; }
.lr-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.lr-bar.bronze i { background: #c8803a; }
.lr-bar.silver i { background: #b9c4d3; }
.lr-bar.gold i { background: #f5b942; }
.lr-bar.master i { background: linear-gradient(90deg, #f5b942, #ff6b9d); }
.tier { font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; }
.tier.bronze { background: rgba(200, 128, 58, 0.2); color: #e0a06a; }
.tier.silver { background: rgba(185, 196, 211, 0.2); color: #d5dde8; }
.tier.gold { background: rgba(245, 185, 66, 0.2); color: #f5b942; }
.tier.master { background: rgba(255, 107, 157, 0.2); color: #ff8fb8; }
.lr-clean { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-dim);
}
.badge.due { background: rgba(224, 163, 52, 0.18); color: var(--warn); }
.badge.new { background: rgba(79, 157, 255, 0.18); color: var(--accent); }
.badge.ok { background: rgba(76, 175, 80, 0.15); color: var(--good); }
.badge.side { background: rgba(229, 83, 75, 0.15); color: var(--bad); }
.lr-play { font-size: 12px; padding: 4px 9px; }

/* ---------- Review controls ---------- */
.review {
  width: min(92vw, var(--board-max));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.review[hidden] { display: none; }
select {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 15px;
}
.stepper { display: flex; gap: 8px; }
.stepper button { flex: 1; font-size: 18px; padding: 10px 0; }
.stepper button:disabled { opacity: 0.35; cursor: default; }

/* ---------- Explorer panel (review mode) ---------- */
.explorer {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}
.explorer-head {
  display: flex; justify-content: space-between; gap: 10px;
  color: var(--text-dim);
  font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.explorer-head .dim { text-transform: none; letter-spacing: 0; font-weight: 500; text-align: right; }
.explorer-body { display: flex; flex-direction: column; gap: 7px; min-height: 20px; color: var(--text-dim); line-height: 1.4; }
.explorer-body .bad { color: var(--bad); }
.ex-row {
  display: grid;
  grid-template-columns: 68px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px; row-gap: 3px;
  align-items: center;
}
.ex-san { grid-row: 1 / span 2; color: var(--text); font-weight: 600; font-size: 15px; }
.ex-book { color: var(--accent); font-size: 12px; margin-left: 4px; }
.ex-games { font-size: 12px; font-variant-numeric: tabular-nums; }
.ex-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.ex-bar i { display: block; height: 100%; }
.ex-bar .w { background: #e8e8e8; }
.ex-bar .d { background: #8a8a90; }
.ex-bar .b { background: #3a3a40; }

input[type="password"], input[type="text"] {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 15px;
}
a.link { color: var(--accent); font-size: 13px; text-decoration: none; }

/* ---------- Engine check ---------- */
.ev-row { display: grid; grid-template-columns: 76px 64px 1fr; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; }
.ev-row .ev-san { color: var(--text); font-weight: 600; }
.ev-row .ev-cp { font-weight: 600; text-align: right; }
.ev-row .ev-best { font-size: 12px; }
.ev-good { color: var(--good); }
.ev-bad  { color: var(--bad); }
.ev-verdict { margin-top: 4px; font-weight: 600; color: var(--text); }
.ev-verdict.discard { color: var(--warn); }
.json {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  overflow: auto;
  user-select: all;
  white-space: pre;
}
.json[hidden] { display: none; }
.gaps button { padding: 3px 10px; font-size: 12px; margin-left: 6px; vertical-align: middle; }

/* ---------- Weakness report ---------- */
.weak-list { margin: 4px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--text-dim); }
.weak-list b { color: var(--text); }
.weak-list .drop { color: var(--bad); font-weight: 600; }
.weak-list a { color: var(--accent); text-decoration: none; margin-left: 4px; }

/* ---------- Chess.com gap report ---------- */
.row-inline { display: flex; gap: 8px; }
.row-inline input { flex: 1; min-width: 0; }
.gap-opening h3 { margin: 8px 0 2px; font-size: 15px; font-weight: 600; }
.gap-opening h3 .dim { color: var(--text-dim); font-weight: 500; font-size: 13px; }
.gaps { margin: 4px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--text-dim); }
.gaps b { color: var(--text); }
.gaps a { color: var(--accent); text-decoration: none; margin-left: 4px; }

.moves .mv.future { opacity: 0.45; }
.moves .mv.clickable { cursor: pointer; }


/* ################################################################
   PASS 2 — buttons, chips, bars   (was css/app-v2.css)
   ################################################################ */

/* =================================================================
   DESIGN PHASE (2026-09-24) — layout 1, Onyx + ice, Duolingo loop.
   Loaded after css/style.css and overrides the prototype's rules;
   every value comes from css/tokens.css.
   ================================================================= */
body { font-family: Inter, Roboto, "Segoe UI", system-ui, sans-serif; line-height: 1.35; }
main { gap: var(--sp-3); padding: var(--sp-3) var(--sp-3) var(--sp-8); }
h1 { font-size: 24px; font-weight: 900; letter-spacing: -0.01em; }

/* buttons: press-down with a darker bottom edge */
button { border-radius: var(--r-3); border: 0; font-weight: 700; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out); }
button:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(0, 0, 0, 0.45); }
button.primary { text-transform: uppercase; letter-spacing: 0.04em; font-weight: 900; position: relative; overflow: hidden; }
button.primary:active { box-shadow: 0 0 0 var(--accent-deep); transform: translateY(4px); }
button.primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%); transform: translateX(-120%); animation: shine 3.2s var(--ease-out) 1s infinite; pointer-events: none; }
@keyframes shine { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.icon-btn { box-shadow: none; background: transparent; color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* chips: streak / level */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 var(--sp-3); border-radius: 999px; background: var(--surface-2); font-weight: 800; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.streak { color: var(--warn); }
.chip.streak.cold { color: var(--text-dim); filter: grayscale(1); }
.chip.xp { color: var(--xp); }

/* today's goal bar: gloss line + shimmer sweep */
.goal { width: min(92vw, var(--board-max)); display: flex; align-items: center; gap: var(--sp-3); font-size: 13px; color: var(--text-dim); }
.home-goal { width: 100%; }
.goal b { color: var(--text); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.bar { flex: 1; height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: var(--accent); transition: width var(--t-slow) var(--ease-pop); overflow: hidden; }
.bar > i::after { content: ""; position: absolute; inset: 3px 6px auto 6px; height: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.4); }
.bar > i::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%); transform: translateX(-100%); animation: shimmer 2.4s var(--ease-out) 0.8s infinite; }
.bar.done > i { background: var(--good); }
@keyframes shimmer { 0%, 40% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* home */
.home-header { display: flex; align-items: center; justify-content: space-between; }
.home-stats { display: flex; gap: var(--sp-2); }
.card { border-radius: var(--r-3); border: 1px solid var(--line); background: var(--surface); }
.card.w::before { background: var(--sq-light); }
.card-sub b { color: var(--warn); }

/* trainer header */
.trainer-header { grid-template-columns: var(--tap) 1fr auto auto; gap: var(--sp-2); width: min(92vw, var(--board-max)); }
.trainer-title { align-items: flex-start; gap: 0; font-size: 17px; font-weight: 900; min-width: 0; }
.trainer-title #trainer-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.trainer-title .sub { font-size: 12px; font-weight: 600; color: var(--text-dim); }

/* board frame + feedback */
.board-wrap { background: var(--surface-2); border-radius: var(--r-2); padding: 3px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5); }
.board { border-radius: var(--r-1); }
.board-wrap.shake { animation: shake 280ms var(--ease-out); }
@keyframes shake { 20% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 80% { transform: translateX(-2px); } }
@keyframes flash-good { 0% { box-shadow: inset 0 0 0 100vmax transparent; } 25% { box-shadow: inset 0 0 0 100vmax var(--good-wash); } 100% { box-shadow: inset 0 0 0 100vmax transparent; } }
@keyframes flash-bad { 0% { box-shadow: inset 0 0 0 100vmax transparent; } 25% { box-shadow: inset 0 0 0 100vmax var(--bad-wash); } 100% { box-shadow: inset 0 0 0 100vmax transparent; } }
.sq.flash-good { animation: flash-good 0.7s var(--ease-out); }
.sq.flash-bad { animation: flash-bad 0.6s var(--ease-out); }
.piece.land { animation: land 0.24s var(--ease-pop); }

/* status: one line, state by colour */
.status { width: min(92vw, var(--board-max)); min-height: var(--tap); border-radius: var(--r-2); font-weight: 800; display: flex; align-items: center; justify-content: center; text-align: center; transition: background var(--t-base), color var(--t-base); }
.status.neutral { background: var(--surface); color: var(--text); }
.status.good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.status.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.status.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

/* actions: restart + one primary */
.controls { width: min(92vw, var(--board-max)); display: grid; grid-template-columns: 56px 1fr; gap: var(--sp-2); }
.controls button { height: 50px; }
#restart { font-size: 20px; padding: 0; }

/* train/review + tabs below the board */
.segmented { width: min(92vw, var(--board-max)); }
.segmented button { box-shadow: none; }
.segmented button.active { background: var(--accent); color: var(--accent-ink); }

/* line browser: search + families */
.line-list { width: min(92vw, var(--board-max)); }
#line-search { width: 100%; margin: var(--sp-2) 0; height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--r-2); border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 14px; }
#line-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.fam-head { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--sp-2); align-items: center; margin: var(--sp-4) 0 var(--sp-2); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.fam-meta { font-weight: 700; text-transform: none; letter-spacing: 0; display: flex; align-items: center; gap: 4px; }
.due-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); display: inline-block; }
.fam-dots { grid-column: 1 / -1; display: flex; gap: 3px; flex-wrap: wrap; }
.fam-dots i { width: 14px; height: 4px; border-radius: 2px; background: var(--surface-2); }
.fam-dots i.bronze { background: var(--bronze); } .fam-dots i.silver { background: var(--silver); } .fam-dots i.gold { background: var(--gold); } .fam-dots i.master { background: var(--master); }
.line-row { border-radius: var(--r-2); border: 1px solid var(--line); background: var(--surface); }
.line-row.playing { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.lr-bar { height: 6px; border-radius: 999px; background: var(--surface-2); }
.lr-bar i { border-radius: 999px; transition: width var(--t-slow) var(--ease-pop); }

/* completion dialog: reward first, then the plan */
.plan-dialog { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.plan-dialog[open] { animation: pop-in 320ms var(--ease-pop); }
@keyframes pop-in { from { transform: translateY(24px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.plan-dialog-head { color: var(--accent); }
.reward { margin-bottom: var(--sp-4); padding: var(--sp-3); border-radius: var(--r-2); background: var(--surface-2); }
.reward b { font-size: 18px; font-weight: 900; }
.reward .xp-gain { color: var(--xp); font-weight: 900; margin-left: var(--sp-2); display: inline-block; animation: xp-pop 600ms var(--ease-pop) 200ms both; }
@keyframes xp-pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.reward-row { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); font-weight: 800; animation: xp-pop 500ms var(--ease-pop) 450ms both; }
.reward-sub { margin-top: var(--sp-2); font-size: 12px; color: var(--text-dim); }
.reward.big { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface-2)), var(--surface-2)); }
.medal { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #1a1400; background: var(--gold); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); position: relative; overflow: hidden; flex: none; }
.medal.bronze { background: var(--bronze); color: #fff; } .medal.silver { background: var(--silver); } .medal.master { background: var(--master); } .medal.goal { background: var(--warn); } .medal.lvl { background: var(--accent); color: var(--accent-ink); }
.medal::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.7) 50%, transparent 70%); transform: translateX(-100%); animation: shine 2.4s var(--ease-out) 0.8s infinite; }
.plan-dialog-actions button.primary { flex: 1; }

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


/* ################################################################
   PASS 4 — home tabs, opening cards, progress, sheet, rings   (was css/app-v3.css)
   ################################################################ */

/* =================================================================
   DESIGN PASS 4 (2026-09-24) — owner's review of 15c84c7 applied app-wide.
   Ice palette family (tokens.css), gloss at all times + slow sheen,
   Instagram-style swipe tabs on home, focus-mode trainer, lines sheet,
   medal rings, notation kept out of sight. Loaded last.
   ================================================================= */
:root { --board-max: 640px; }
body { background: radial-gradient(120% 60% at 50% -10%, #12202c 0%, var(--bg) 55%) fixed; }
main { padding-top: calc(var(--sp-3) + env(safe-area-inset-top)); }

/* ---------------- universal buttons: primary · secondary · tertiary ---------------- */
button { font-family: inherit; }
button.primary, button.secondary, button.danger {
  position: relative; overflow: hidden; height: 50px; padding: 0 var(--sp-4); border-radius: var(--r-3);
  font-weight: 900; font-size: 15px; letter-spacing: 0.05em; text-transform: uppercase; border: 0;
  background-image: var(--gloss);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), filter var(--t-base);
}
button.primary { background-color: var(--ice-300); color: var(--ice-900); box-shadow: 0 4px 0 var(--ice-500), var(--glow-ice); }
button.primary:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ice-500), var(--glow-ice); }
button.secondary { background-color: var(--ice-800); color: var(--ice-100); box-shadow: 0 4px 0 var(--ice-900), inset 0 0 0 1.5px rgba(72, 202, 228, 0.45); }
button.secondary:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ice-900), inset 0 0 0 1.5px rgba(72, 202, 228, 0.45); }
button.danger { background-color: #3a1a20; color: var(--coral); box-shadow: 0 4px 0 #22090e, inset 0 0 0 1.5px rgba(255, 138, 147, 0.4); }
button.danger:active { transform: translateY(4px); box-shadow: 0 0 0 #22090e; }
/* the sheen: one soft sweep every ~6 s, staggered so buttons never flash together */
button.primary::after, button.secondary::after {
  content: ""; position: absolute; inset: -20% 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.42) 50%, transparent 62%);
  transform: translateX(-130%); animation: sheen 6s ease-in-out infinite;
}
button.secondary::after { background: linear-gradient(105deg, transparent 40%, rgba(174, 220, 255, 0.28) 50%, transparent 60%); animation-delay: 2.4s; }
@keyframes sheen { 0%, 80% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
button.primary:disabled, button.secondary:disabled { filter: grayscale(0.6) brightness(0.7); }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; color: var(--ice-100); transition: background var(--t-base), transform var(--t-fast); }
.icon-btn:active { transform: scale(0.9); background: rgba(72, 202, 228, 0.12); }
.icon-btn svg, .tool svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.text-btn { background: none; box-shadow: none; color: var(--ice-300); font-weight: 800; padding: 6px 10px; }

/* ---------------- chips ---------------- */
.chip { background: rgba(22, 64, 95, 0.55); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.14); backdrop-filter: blur(6px); }
.chip.streak { color: var(--amber); }
.chip.streak:not(.cold) { animation: flicker 3.6s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { text-shadow: 0 0 0 transparent; } 50% { text-shadow: 0 0 10px rgba(255, 194, 107, 0.7); } }
.chip.level { color: var(--ice-100); position: relative; overflow: hidden; padding-left: 12px; }
.chip.level::before { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--p, 0) * 100%); background: var(--ice-300); border-radius: 2px; transition: width var(--t-slow) var(--ease-pop); }

/* ---------------- bars: gloss always, shimmer every ~6 s ---------------- */
.bar { background: rgba(15, 38, 56, 0.9); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5); }
.bar > i { background-color: var(--ice-300); background-image: var(--gloss); box-shadow: 0 0 12px rgba(72, 202, 228, 0.45); }
.bar > i::before { animation: shimmer 6s ease-in-out 1s infinite; }
.bar.done > i { background-color: var(--mint); box-shadow: 0 0 12px rgba(79, 224, 191, 0.5); }
.bar.thin { height: 6px; }

/* ---------------- home: header ---------------- */
.top { width: 100%; display: flex; align-items: center; justify-content: space-between; animation: rise 500ms var(--ease-out) both; }
.brand { display: flex; align-items: center; gap: var(--sp-3); }
.logo { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(145deg, var(--ice-300), var(--ice-500)); box-shadow: 0 4px 0 var(--ice-700), var(--glow-ice); position: relative; overflow: hidden; }
.logo img { width: 32px; height: 32px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3)); }
.logo::after { content: ""; position: absolute; inset: 0; background: var(--gloss); }
.brand h1 { margin: 0; font-size: 22px; line-height: 1; }
.greet { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.top-stats { display: flex; gap: var(--sp-2); }

.today-card { width: 100%; padding: var(--sp-3) var(--sp-4); border-radius: 16px; background: linear-gradient(135deg, rgba(29, 90, 140, 0.35), rgba(15, 38, 56, 0.6)); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.14); animation: rise 500ms var(--ease-out) 60ms both; }
.today-row { display: flex; align-items: baseline; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.today-label { font-weight: 900; font-size: 15px; }
.today-hint { flex: 1; font-size: 12px; color: var(--ice-200); }
.today-row b { font-variant-numeric: tabular-nums; font-size: 15px; }

/* ---------------- home: swipe tabs ---------------- */
.tabs { width: 100%; position: relative; display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); animation: rise 500ms var(--ease-out) 120ms both; --x: 0; }
.tabs button { background: none; box-shadow: none; border-radius: 0; padding: 12px 0; color: var(--text-dim); font-weight: 800; font-size: 14px; transition: color var(--t-base); }
.tabs button.on { color: var(--ice-100); }
.tab-ink { position: absolute; bottom: -1px; left: 0; width: 25%; height: 3px; border-radius: 3px; background: var(--ice-300); box-shadow: 0 0 10px var(--ice-300); transform: translateX(calc(var(--x) * 100%)); transition: transform 320ms var(--ease-out); }
.pager { width: calc(100% + 2 * var(--sp-3)); margin: 0 calc(-1 * var(--sp-3)); overflow: hidden; touch-action: pan-y; }
.pager::-webkit-scrollbar { display: none; }
.page { display: none; padding: var(--sp-2) var(--sp-3) var(--sp-6); flex-direction: column; gap: var(--sp-3); }
.page.on { display: flex; }
.page.from-right { animation: page-in-r 320ms var(--ease-out); }
.page.from-left { animation: page-in-l 320ms var(--ease-out); }
@keyframes page-in-r { from { transform: translateX(40%); opacity: 0; } }
@keyframes page-in-l { from { transform: translateX(-40%); opacity: 0; } }

/* ---------------- home: opening cards (stacked) ---------------- */
.openings { display: flex; flex-direction: column; gap: var(--sp-4); }
.opening { border-radius: 20px; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); position: relative; overflow: hidden;
  background: linear-gradient(170deg, #15283a 0%, var(--surface) 55%); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.12), 0 12px 30px rgba(0, 0, 0, 0.35);
  animation: rise 560ms var(--ease-out) calc(180ms + var(--i) * 90ms) both; }
.opening::before { content: ""; position: absolute; inset: 0; background: radial-gradient(90% 45% at 100% 0%, rgba(72, 202, 228, 0.16), transparent 70%); pointer-events: none; }
.opening.b::before { background: radial-gradient(90% 45% at 100% 0%, rgba(170, 182, 255, 0.18), transparent 70%); }
.op-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-2); position: relative; }
.op-side { font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ice-200); }
.opening.b .op-side { color: var(--lilac); }
.op-head h2 { margin: 2px 0 0; font-size: 24px; font-weight: 900; letter-spacing: -0.01em; }
.due-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; color: var(--amber); background: rgba(255, 194, 107, 0.12); white-space: nowrap; }
.due-pill.calm { color: var(--mint); background: rgba(79, 224, 191, 0.12); }
.due-pill .dot, .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 3px rgba(255, 138, 147, 0.2); display: inline-block; animation: ping 2.4s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255, 138, 147, 0.5); } 70%, 100% { box-shadow: 0 0 0 7px rgba(255, 138, 147, 0); } }
.op-board { width: 100%; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
.op-meta { display: flex; gap: var(--sp-4); font-size: 13px; color: var(--text-dim); }
.op-meta b { color: var(--text); font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; margin-right: 3px; }
.op-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: var(--sp-2); }

/* ---------------- mini boards ---------------- */
.mini { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; overflow: hidden; }
.mini i { position: relative; background: var(--sq-light); }
.mini i.d { background: var(--sq-dark); }
.mini i.hl::before { content: ""; position: absolute; inset: 0; background: var(--sq-last); }
.mini img { position: absolute; inset: 6%; width: 88%; height: 88%; }

/* ---------------- panels (progress, games, settings) ---------------- */
.panel-card { border-radius: 16px; padding: var(--sp-4); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: var(--sp-3); animation: rise 420ms var(--ease-out) both; }
.panel-card h3 { margin: 0; font-size: 16px; font-weight: 900; }
.panel-card .lead { margin: -6px 0 0; color: var(--text-dim); font-size: 13px; }
.panel-card input[type="text"], .panel-card input[type="password"], .panel-card select { height: var(--tap); border-radius: var(--r-2); border: 0; background: var(--ice-900); color: var(--text); padding: 0 var(--sp-3); font-size: 14px; box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.18); }
.row-inline { display: flex; gap: var(--sp-2); } .row-inline input { flex: 1; min-width: 0; }
.row-buttons { display: flex; gap: var(--sp-2); flex-wrap: wrap; } .row-buttons button { flex: 1; }
.switch input { position: absolute; opacity: 0; }
.switch i { width: 46px; height: 28px; border-radius: 999px; background: var(--ice-900); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.25); position: relative; transition: background var(--t-base); }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text-dim); transition: transform var(--t-base) var(--ease-pop), background var(--t-base); }
.switch input:checked + i { background: var(--ice-500); }
.switch input:checked + i::after { transform: translateX(18px); background: #fff; }

.hero-stats { flex-direction: row; align-items: center; gap: var(--sp-4); background: linear-gradient(135deg, rgba(29, 90, 140, 0.4), var(--surface)); }
.hero-nums { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.hero-nums b { display: block; font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.hero-nums b small { font-size: 12px; color: var(--text-dim); }
.hero-nums span { font-size: 11px; color: var(--text-dim); font-weight: 700; }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 4px; background: var(--ice-900); }
.heat .h1 { background: var(--ice-700); } .heat .h2 { background: var(--ice-500); } .heat .h3 { background: var(--ice-400); } .heat .h4 { background: var(--ice-300); box-shadow: 0 0 8px rgba(72, 202, 228, 0.6); }
.opp-head { display: flex; justify-content: space-between; align-items: baseline; }
.acc { font-size: 22px; font-weight: 900; color: var(--ice-200); } .acc small { font-size: 11px; color: var(--text-dim); margin-left: 4px; font-weight: 700; }
.medal-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.medal-stat { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; background: var(--ice-900); }
.medal-stat em { font-style: normal; font-weight: 900; font-size: 18px; }
.weak { margin: 0; font-size: 13px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { padding: 3px 8px; border-radius: 999px; background: rgba(255, 138, 147, 0.12); color: var(--coral); font-weight: 800; font-size: 12px; }

/* ---------------- medals + rings ---------------- */
.medal-core { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #231a00; background-color: var(--gold); background-image: var(--gloss); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); position: relative; overflow: hidden; flex: none; }
.medal-core.bronze { background-color: var(--bronze); color: #fff; } .medal-core.silver { background-color: var(--silver); } .medal-core.master { background-color: var(--master); color: #fff; }
.medal-core.none { background: var(--ice-900); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.18); }
.medal-core:not(.none)::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.75) 50%, transparent 65%); transform: translateX(-130%); animation: sheen 6s ease-in-out 1.5s infinite; }
.ring { position: relative; width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; stroke-linecap: round; }
.ring .track { stroke: var(--ice-900); }
.ring .fill { stroke: var(--ice-300); stroke-dashoffset: var(--off); animation: ring-fill 900ms var(--ease-out) both; filter: drop-shadow(0 0 3px currentColor); }
@keyframes ring-fill { from { stroke-dashoffset: 101; } }
.ring.to-bronze .fill { stroke: var(--bronze); } .ring.to-silver .fill { stroke: var(--silver); } .ring.to-gold .fill { stroke: var(--gold); } .ring.to-master .fill { stroke: var(--master); }
.ring.big { width: 64px; height: 64px; } .ring.big .medal-core { width: 36px; height: 36px; font-size: 15px; }
.ring.xl { width: 96px; height: 96px; } .ring.xl circle { stroke-width: 7; } .ring.xl .fill.lvl { stroke: var(--ice-300); animation-duration: 1200ms; }
@keyframes ring-fill-xl { from { stroke-dashoffset: 214; } }
.ring.xl .fill { animation-name: ring-fill-xl; }
.ring.xl b { font-size: 30px; font-weight: 900; line-height: 1; } .ring.xl small { position: absolute; bottom: 20px; font-size: 10px; color: var(--text-dim); font-weight: 800; text-transform: uppercase; }
.pips { display: flex; gap: 4px; margin-top: 6px; }
.pips i { width: 16px; height: 5px; border-radius: 3px; background: var(--ice-900); }
.pips i.on { background: var(--ice-300); animation: pip 400ms var(--ease-pop) both; }
.pips.to-bronze i.on { background: var(--bronze); } .pips.to-silver i.on { background: var(--silver); } .pips.to-gold i.on { background: var(--gold); } .pips.to-master i.on { background: var(--master); }
.pips.done { color: var(--master); font-size: 12px; }
@keyframes pip { from { transform: scaleX(0.2); opacity: 0; } }

/* ---------------- trainer: focus mode ---------------- */
main[data-screen="trainer"] { padding-left: 4px; padding-right: 4px; gap: var(--sp-2); }
.trainer-header { width: min(calc(100vw - 16px), var(--board-max)); grid-template-columns: var(--tap) 1fr auto auto; }
.trainer-header .chip { height: 30px; font-size: 12px; }
.goal.slim { width: min(calc(100vw - 16px), var(--board-max)); gap: var(--sp-2); }
.goal.slim .bar { height: 8px; }
.goal.slim b { font-size: 12px; color: var(--text-dim); min-width: 0; }
.board-wrap { width: min(calc(100vw - 8px), var(--board-max)); padding: 2px; background: var(--ice-900); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(72, 202, 228, 0.12); animation: rise 420ms var(--ease-out) both; }
.status { width: min(calc(100vw - 16px), var(--board-max)); border-radius: 12px; animation: status-in 260ms var(--ease-out); }
@keyframes status-in { from { transform: translateY(4px); opacity: 0.4; } }
.status.neutral { background: rgba(15, 38, 56, 0.7); color: var(--ice-100); }
.status.good { background: rgba(79, 224, 191, 0.14); color: var(--mint); }
.status.bad { background: rgba(255, 138, 147, 0.14); color: var(--coral); }
.status.warn { background: rgba(255, 194, 107, 0.14); color: var(--amber); }
.controls { width: min(calc(100vw - 16px), var(--board-max)); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-1); grid-template-columns: none; }
.tool { background: none; box-shadow: none; color: var(--ice-100); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border-radius: 12px; font-size: 11px; font-weight: 800; height: auto; min-width: 56px; transition: background var(--t-base), transform var(--t-fast); }
.tool span { color: var(--text-dim); }
.tool:active { transform: scale(0.92); background: rgba(72, 202, 228, 0.1); }
.tool[hidden] { display: none; }
.mode { display: flex; padding: 3px; border-radius: 999px; background: var(--ice-900); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.14); margin-left: auto; }
.mode button { background: none; box-shadow: none; border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 900; color: var(--text-dim); transition: background var(--t-base), color var(--t-base); }
.mode button.active { background-color: var(--ice-300); background-image: var(--gloss); color: var(--ice-900); }
.next { width: min(calc(100vw - 16px), var(--board-max)); animation: pop-in 380ms var(--ease-pop) both; }
.moves, .note, .review { width: min(calc(100vw - 16px), var(--board-max)); }

/* ---------------- lines sheet ---------------- */
.sheet { position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 640px; max-height: 86vh; padding: 0 var(--sp-3) calc(var(--sp-4) + env(safe-area-inset-bottom)); border: 0; border-radius: 22px 22px 0 0; background: #0f1821; color: var(--text); box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(72, 202, 228, 0.2); overflow-y: auto; overscroll-behavior: contain; }
.sheet[open] { animation: sheet-up 340ms var(--ease-out); display: flex; flex-direction: column; gap: var(--sp-3); }
.sheet::backdrop { background: rgba(3, 8, 12, 0.6); backdrop-filter: blur(3px); animation: fade 260ms ease both; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.sheet-grab { width: 44px; height: 5px; border-radius: 3px; background: var(--ice-700); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: var(--sp-2); position: sticky; top: 0; background: #0f1821; padding: var(--sp-2) 0; z-index: 2; }
.sheet-head > div { flex: 1; } .sheet-head h2 { margin: 0; font-size: 20px; font-weight: 900; } .sheet-head .dim { font-size: 12px; color: var(--text-dim); }
.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cats button { height: auto; padding: 10px 4px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font-weight: 900; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 2px; border-top: 3px solid transparent; }
.cats button small { font-size: 12px; color: var(--text-dim); font-weight: 700; }
.cats .cat-main { border-top-color: var(--ice-300); } .cats .cat-side { border-top-color: var(--coral); } .cats .cat-sur { border-top-color: var(--lilac); } .cats .cat-mine { border-top-color: var(--mint); }
.cats button.active { background: linear-gradient(180deg, rgba(72, 202, 228, 0.18), var(--surface)); box-shadow: inset 0 0 0 1.5px var(--ice-300); }
#line-search { height: var(--tap); border-radius: 12px; border: 0; background: var(--ice-900); color: var(--text); padding: 0 var(--sp-3); font-size: 14px; box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.18); margin: 0; width: 100%; }
#line-search:focus { outline: none; box-shadow: inset 0 0 0 2px var(--ice-300); }
.line-list { width: 100%; }
.fam { margin-bottom: var(--sp-4); }
.fam-head { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-2); text-transform: none; letter-spacing: 0; }
.fam-head h3 { margin: 0; font-size: 15px; font-weight: 900; color: var(--text); }
.fam-head small { color: var(--text-dim); font-size: 12px; font-weight: 700; }
.fam-medals { margin-left: auto; display: flex; gap: 3px; }
.fam-medals i { width: 8px; height: 8px; border-radius: 50%; background: var(--ice-900); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.2); }
.fam-medals i.bronze { background: var(--bronze); } .fam-medals i.silver { background: var(--silver); } .fam-medals i.gold { background: var(--gold); } .fam-medals i.master { background: var(--master); }
.fam-due { min-width: 20px; height: 20px; border-radius: 10px; background: var(--coral); color: #2a070b; font-size: 11px; font-weight: 900; display: grid; place-items: center; padding: 0 5px; }
.line-row { display: grid; grid-template-columns: 52px 1fr auto; gap: var(--sp-3); align-items: center; padding: var(--sp-2); margin-bottom: 6px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; animation: rise 360ms var(--ease-out) calc(var(--k) * 30ms) both; transition: transform var(--t-fast), box-shadow var(--t-base); }
.line-row:active { transform: scale(0.985); }
.line-row.playing { box-shadow: inset 0 0 0 2px var(--ice-300), var(--glow-ice); }
.line-row.off { opacity: 0.45; }
.thumb { width: 52px; border-radius: 8px; }
.lr-body { min-width: 0; }
.lr-name { font-weight: 800; font-size: 14px; line-height: 1.25; display: flex; align-items: center; gap: 6px; }
.lr-name .dot { flex: none; }
.lr-sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; font-size: 11px; color: var(--text-dim); align-items: center; }
.kind { padding: 1px 7px; border-radius: 999px; font-weight: 900; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.kind.trap, .kind.side { color: var(--coral); background: rgba(255, 138, 147, 0.12); } .kind.sur { color: var(--lilac); background: rgba(170, 182, 255, 0.12); }
.lr-moves { width: 100%; color: var(--ice-200); }
.keep { display: none; }
.sheet.editing .keep { display: grid; grid-column: 3; }
.sheet.editing .line-row .ring { display: none; }
.keep input { position: absolute; opacity: 0; }
.keep i { width: 26px; height: 26px; border-radius: 8px; background: var(--ice-900); box-shadow: inset 0 0 0 1.5px rgba(72, 202, 228, 0.35); display: grid; place-items: center; }
.keep input:checked + i { background: var(--ice-300); } .keep input:checked + i::after { content: "✓"; color: var(--ice-900); font-weight: 900; }
.empty { color: var(--text-dim); font-size: 13px; padding: var(--sp-3); text-align: center; }

/* ---------------- line complete ---------------- */
.plan-dialog { width: min(92vw, 440px); background: linear-gradient(180deg, #13222f, var(--surface)); border: 0; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(72, 202, 228, 0.18); border-radius: 20px; }
.plan-dialog::backdrop { background: rgba(3, 8, 12, 0.55); backdrop-filter: blur(2px); }
.plan-dialog-body { padding: var(--sp-4) var(--sp-4) 0; }
.plan-dialog-body h2 { font-size: 17px; }
.plan-label { margin: 0 0 4px; font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ice-300); }
.reward { text-align: center; background: radial-gradient(80% 90% at 50% 0%, rgba(72, 202, 228, 0.22), transparent 70%), var(--ice-900); border-radius: 16px; padding: var(--sp-4) var(--sp-3); }
.reward b { font-size: 22px; }
.reward-ring { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: var(--sp-3); }
.reward-ring .ring.big .medal-core { animation: medal-pop 700ms var(--ease-pop) 500ms both; }
@keyframes medal-pop { from { transform: scale(0.3) rotate(-30deg); opacity: 0; } }
.reward-row { justify-content: center; }
.plan-dialog-actions { display: grid; grid-template-columns: var(--tap) 1fr 1.4fr; gap: var(--sp-2); padding: var(--sp-4); align-items: center; }
.plan-dialog-actions button { flex: none; }

/* ---------------- motion ---------------- */
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
@keyframes pop-in { from { transform: translateY(16px) scale(0.96); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
}

/* the old #restart rule from pass 2 made the toolbar label huge */
#restart.tool { font-size: 11px; padding: 6px 10px; }

/* no dead black space below the content: the pager is exactly as tall as the tab you are on (js fitPager) */
main[data-screen="home"] { padding-bottom: var(--sp-4); min-height: 0; }
html, body { min-height: 100%; }


/* ################################################################
   PASS 5 — sessions, plan panel, drawer, Watch, celebrations, critic fixes   (was css/app-v5.css)
   ################################################################ */

/* =================================================================
   PASS 5 (2026-09-25): sessions, plan under the board, XP flight,
   milestone celebration, piece-glow hints, square Train/Watch switch,
   right-edge lines drawer that pushes the board, Watch tutorial, what-if.
   Loaded after app-v3.css.
   ================================================================= */

/* --- stage + drawer: the board slides away as the drawer comes in --- */
main[data-screen="trainer"] { position: relative; overflow-x: clip; }
.stage { width: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); transition: transform 420ms var(--ease-out), filter 420ms var(--ease-out); will-change: transform; }
.drawer-open .stage { transform: translateX(-78%) scale(0.94); filter: brightness(0.45) saturate(0.7); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(88vw, 520px); z-index: 30; background: linear-gradient(180deg, #102030, #0c141c 40%); box-shadow: -24px 0 60px rgba(0, 0, 0, 0.55), inset 1px 0 0 rgba(72, 202, 228, 0.18); padding: calc(var(--sp-3) + env(safe-area-inset-top)) var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); overflow-y: auto; overscroll-behavior: contain; transform: translateX(104%); transition: transform 420ms var(--ease-out); }
.drawer-open .drawer { transform: none; }
.drawer .sheet-head { background: transparent; position: static; }
.drawer .line-row { animation: none; }
.drawer-open .drawer .line-row { animation: slide-in 380ms var(--ease-out) calc(120ms + min(var(--k), 12) * 26ms) both; }
@keyframes slide-in { from { transform: translateX(28px); opacity: 0; } }
.drawer-edge { position: fixed; top: 30%; right: 0; width: 5px; height: 72px; border-radius: 4px 0 0 4px; background: linear-gradient(180deg, transparent, var(--ice-300), transparent); opacity: 0.55; animation: edge-breathe 3s ease-in-out infinite; pointer-events: none; }
.drawer-open .drawer-edge { opacity: 0; }
@keyframes edge-breathe { 50% { opacity: 0.15; } }
.cats button { border-radius: var(--r-2); }

/* --- session bar + combo --- */
.session { width: min(calc(100vw - 16px), var(--board-max)); display: flex; align-items: center; gap: var(--sp-2); }
.seg-bar { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.seg-bar i { height: 8px; border-radius: 4px; background: var(--ice-900); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5); }
.seg-bar i.done { background-color: var(--amber); background-image: var(--gloss); animation: seg-fill 520ms var(--ease-pop) both; transform-origin: left; }
.seg-bar i.done.perfect { background-color: var(--ice-300); box-shadow: 0 0 10px rgba(72, 202, 228, 0.55); }
.seg-bar i.current { background: rgba(72, 202, 228, 0.25); animation: seg-pulse 1.6s ease-in-out infinite; }
@keyframes seg-fill { from { transform: scaleX(0.1); } }
@keyframes seg-pulse { 50% { background: rgba(72, 202, 228, 0.5); } }
.combo { font-weight: 900; font-size: 13px; color: var(--amber); padding: 3px 8px; border-radius: var(--r-1); background: rgba(255, 194, 107, 0.14); }
.combo.pop { animation: combo-pop 520ms var(--ease-pop); }
@keyframes combo-pop { 40% { transform: scale(1.35); } }

/* --- hints: the piece glows, never an arrow --- */
.sq.hint-from { box-shadow: inset 0 0 0 100vmax rgba(72, 202, 228, 0.35); }
.sq.hint-from .piece { animation: hint-bob 1.1s ease-in-out infinite; filter: drop-shadow(0 0 6px var(--ice-300)) drop-shadow(0 0 12px rgba(72, 202, 228, 0.8)); }
@keyframes hint-bob { 50% { transform: translateY(-6%) scale(1.06); } }
.sq.hint-to::after { content: ""; position: absolute; inset: 34%; border-radius: 50%; background: var(--ice-300); box-shadow: 0 0 14px var(--ice-300); animation: ping-dot 1.2s ease-out infinite; }
@keyframes ping-dot { 0% { transform: scale(0.6); opacity: 1; } 100% { transform: scale(1.6); opacity: 0.2; } }

/* --- square Train/Watch switch (no pills) --- */
.mode { border-radius: var(--r-2); padding: 3px; gap: 3px; background: var(--ice-900); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.16); }
.mode button { border-radius: 6px; display: flex; align-items: center; gap: 6px; padding: 8px 12px; }
.mode button svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linejoin: round; }
.mode button.active { box-shadow: 0 2px 0 var(--ice-500); }

/* --- status: livelier --- */
.status { transition: background 260ms, color 260ms, transform 200ms; }
.status.good { animation: status-good 420ms var(--ease-pop); }
@keyframes status-good { 30% { transform: scale(1.03); } }

/* --- plan under the board --- */
.after { width: min(calc(100vw - 16px), var(--board-max)); border-radius: 16px; padding: var(--sp-4); background: linear-gradient(180deg, #132536, var(--surface)); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.16), 0 14px 30px rgba(0, 0, 0, 0.35); display: flex; flex-direction: column; gap: var(--sp-2); animation: rise 420ms var(--ease-out) both; }
.after[hidden] { display: none; }
.after.perfect { box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.4), 0 0 30px rgba(72, 202, 228, 0.12), 0 14px 30px rgba(0, 0, 0, 0.35); }
.after-head h2 { margin: 2px 0 0; font-size: 19px; font-weight: 900; }
.after-kind { font-size: 11px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); }
.after.perfect .after-kind { color: var(--ice-300); }
.plan-label { margin: var(--sp-2) 0 0; font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.plan-text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ice-50); }
.plan-credit { margin: 0; font-size: 11px; color: var(--text-dim); }
.after-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: var(--sp-2); margin-top: var(--sp-2); }
.after-actions button { height: 50px; }
button.nudge { animation: nudge 1.8s ease-in-out 1.2s infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: none; } 78% { transform: translateY(-3px); } 86% { transform: none; } 92% { transform: translateY(-1px); } }

/* --- session end --- */
.se-top h2 { margin: 2px 0 0; font-size: 22px; font-weight: 900; }
.se-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-top: var(--sp-2); }
.se-stats div { background: var(--ice-900); border-radius: var(--r-2); padding: var(--sp-3) var(--sp-2); text-align: center; animation: rise 460ms var(--ease-out) both; }
.se-stats div:nth-child(2) { animation-delay: 80ms; } .se-stats div:nth-child(3) { animation-delay: 160ms; }
.se-stats b { display: block; font-size: 26px; font-weight: 900; color: var(--ice-200); }
.se-stats small { font-size: 11px; color: var(--text-dim); font-weight: 800; }
.se-goal { display: flex; align-items: center; gap: var(--sp-2); font-size: 13px; color: var(--text-dim); } .se-goal .bar { flex: 1; } .se-goal b { color: var(--text); }
.se-insight, .se-next { margin: 0; font-size: 14px; color: var(--ice-100); } .se-next { color: var(--text-dim); font-size: 13px; }

/* --- XP flight + chip bump --- */
.xp-fly { position: fixed; z-index: 60; pointer-events: none; font-weight: 900; font-size: 22px; color: var(--xp); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 209, 102, 0.7); white-space: nowrap; }
.chip.bump { animation: bump 520ms var(--ease-pop); }
@keyframes bump { 35% { transform: scale(1.25); box-shadow: 0 0 0 4px rgba(72, 202, 228, 0.35); } }

/* --- milestone celebration --- */
.celebrate { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: linear-gradient(180deg, transparent 35%, rgba(3, 8, 12, 0.7)); animation: fade 260ms ease both; padding: 0 var(--sp-3) calc(var(--sp-4) + env(safe-area-inset-bottom)); }
.celebrate[hidden] { display: none; }
.celebrate.out { animation: fade-out 260ms ease forwards; }
@keyframes fade-out { to { opacity: 0; } }
.cel-card { width: min(100%, 460px); border-radius: 20px; padding: var(--sp-4); background: radial-gradient(90% 70% at 50% 0%, rgba(72, 202, 228, 0.28), transparent 70%), #10202e; box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.3), 0 -10px 50px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; gap: var(--sp-3); animation: sheet-up 480ms var(--ease-pop) both; }
.cel-xp { text-align: center; }
.cel-xp b { font-size: 48px; font-weight: 900; color: var(--xp); text-shadow: 0 0 24px rgba(255, 209, 102, 0.6); }
.cel-xp span { font-weight: 900; color: var(--xp); margin-left: 6px; }
.cel-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-3); background: rgba(15, 38, 56, 0.8); animation: rise 420ms var(--ease-out) 300ms both; }
.cel-row + .cel-row { animation-delay: 450ms; }
.cel-row > div { flex: 1; } .cel-row b { display: block; font-size: 16px; } .cel-row small { color: var(--text-dim); font-size: 12px; }
.medal-core.big { width: 44px; height: 44px; font-size: 18px; animation: medal-pop 700ms var(--ease-pop) 400ms both; }
.cel-flame { font-size: 34px; animation: combo-pop 900ms var(--ease-pop) 400ms both; }
.cel-lvl { width: 44px; height: 44px; border-radius: var(--r-2); display: grid; place-items: center; font-weight: 900; font-size: 20px; color: var(--ice-900); background-color: var(--ice-300); background-image: var(--gloss); animation: medal-pop 700ms var(--ease-pop) 400ms both; }
.fill-now { width: 100%; animation: fill-now 900ms var(--ease-out) 500ms both; }
@keyframes fill-now { from { width: 0; } }
.cel-row .bar { height: 8px; margin-top: 6px; }

/* --- rings: a clear count instead of an empty circle --- */
.ring-count { font-size: 11px; font-weight: 800; color: var(--text-dim); letter-spacing: -0.02em; position: relative; }
.ring-count em { font-style: normal; color: var(--ice-100); font-size: 13px; }
.ring .track { stroke: rgba(72, 202, 228, 0.14); }

/* --- Watch mode: tutorial controls + what-if --- */
.review { display: flex; flex-direction: column; gap: var(--sp-2); }
.review[hidden] { display: none; }
.tut { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); }
.tut .tool { min-width: 48px; }
.play { width: 64px; height: 64px; border-radius: 18px; background-color: var(--ice-300); background-image: var(--gloss); color: var(--ice-900); box-shadow: 0 4px 0 var(--ice-500), var(--glow-ice); display: grid; place-items: center; padding: 0; }
.play svg { width: 28px; height: 28px; fill: currentColor; stroke: none; }
.play.on svg { display: none; }
.play.on::before { content: ""; width: 20px; height: 22px; border-left: 7px solid var(--ice-900); border-right: 7px solid var(--ice-900); box-sizing: border-box; }
.play:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ice-500); }
.tut-track { height: 4px; border-radius: 2px; background: var(--ice-900); overflow: hidden; }
.tut-track i { display: block; height: 100%; width: 0; background: var(--ice-300); transition: width 400ms var(--ease-out); }
.tut-pick { display: flex; align-items: center; gap: var(--sp-2); font-size: 12px; color: var(--text-dim); font-weight: 800; }
.tut-pick select { flex: 1; height: var(--tap); border-radius: var(--r-2); border: 0; background: var(--ice-900); color: var(--text); padding: 0 var(--sp-3); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.18); }
.tut-tip { margin: 0; text-align: center; font-size: 12px; color: var(--text-dim); }
.whatif { border-radius: var(--r-3); padding: var(--sp-3); background: linear-gradient(135deg, rgba(170, 182, 255, 0.16), var(--surface)); box-shadow: inset 0 0 0 1px rgba(170, 182, 255, 0.35); display: flex; flex-direction: column; gap: 6px; animation: rise 360ms var(--ease-pop) both; }
.whatif[hidden] { display: none; }
.whatif b { font-size: 15px; } .whatif span { color: var(--ice-100); font-size: 14px; }
.wi-actions { display: flex; gap: var(--sp-2); margin-top: 4px; } .wi-actions button { flex: 1; height: 44px; }
.controls[hidden] { display: none; }

/* ---------- critic round 1 fixes ---------- */
.goal[hidden], .combo[hidden] { display: none !important; }
.trainer-header { position: sticky; top: 0; z-index: 5; padding-top: calc(4px + env(safe-area-inset-top)); background: linear-gradient(180deg, var(--bg) 70%, transparent); }
.tool { border-radius: var(--r-2); min-height: var(--tap); }
.play { border-radius: var(--r-2); }
.icon-btn { border-radius: var(--r-2); }
#line-search { height: var(--tap) !important; min-height: var(--tap); border-radius: var(--r-2); flex: none; }
.drawer #line-search { display: block; }
.sq.hint-from { box-shadow: inset 0 0 0 3px var(--ice-100), inset 0 0 0 100vmax rgba(72, 202, 228, 0.18); animation: hint-ring 1.2s ease-in-out infinite; }
@keyframes hint-ring { 50% { box-shadow: inset 0 0 0 5px var(--ice-300), inset 0 0 0 100vmax rgba(72, 202, 228, 0.32); } }
.flame { width: 14px; height: 14px; fill: var(--amber); vertical-align: -2px; margin-right: 4px; filter: drop-shadow(0 0 4px rgba(255, 194, 107, 0.6)); }
.chip.streak.cold .flame { fill: var(--text-dim); filter: none; }
.chip b { font-weight: 900; }
.combo .flame { width: 12px; height: 12px; margin-right: 2px; }
.status.intro { background: rgba(72, 202, 228, 0.12); color: var(--ice-100); animation: status-in 320ms var(--ease-out); }
.played { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-2); background: rgba(255, 194, 107, 0.12); color: var(--amber); font-weight: 900; }
.after-kind { color: var(--ice-200); }
.panel-card .row > span:first-child { white-space: nowrap; }
.cats button { font-size: 12px; white-space: nowrap; }
.thumb { width: 60px; }
.line-row { grid-template-columns: 60px 1fr auto; }

/* ---------- critic round 2 fixes ---------- */
.seg-bar i.done.learned { background-color: var(--ice-300); box-shadow: 0 0 10px rgba(72, 202, 228, 0.45); }
.seg-bar i.done.perfect { background-color: var(--mint); box-shadow: 0 0 10px rgba(79, 224, 191, 0.55); }
.due-pill.fresh { color: var(--ice-200); background: rgba(72, 202, 228, 0.12); }
.plan-text { max-height: 7.6em; overflow-y: auto; overscroll-behavior: contain; mask-image: linear-gradient(180deg, #000 80%, transparent); padding-bottom: 0.6em; }
.after-actions { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); }
.after { margin-bottom: var(--sp-2); }
.line-info { width: min(calc(100vw - 16px), var(--board-max)); display: grid; grid-template-columns: 1fr auto; gap: 2px var(--sp-2); padding: var(--sp-3); border-radius: var(--r-3); background: rgba(15, 38, 56, 0.55); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.1); animation: rise 360ms var(--ease-out) both; }
.line-info .li-fam { grid-column: 1 / -1; font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.line-info b { font-size: 15px; font-weight: 900; }
.line-info .li-medal { font-size: 12px; color: var(--ice-200); font-weight: 800; align-self: center; }
.line-info .li-steps { grid-column: 1 / -1; display: flex; gap: 4px; margin-top: 6px; }
.line-info .li-steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--ice-900); transition: background 300ms; }
.line-info .li-steps i.on { background: var(--ice-300); }
main[data-screen="trainer"] .controls[hidden] ~ .line-info { display: none; }

/* ---------- critic round 3 fixes ---------- */
.status.two { flex-direction: column; gap: 2px; line-height: 1.2; padding-top: 6px; padding-bottom: 6px; }
.status.two small { font-size: 12px; font-weight: 700; color: var(--text-dim); }
.status.two span { font-weight: 900; }
.sq.hint-to:has(.piece)::after { inset: 4%; border-radius: 6px; background: transparent; box-shadow: inset 0 0 0 3px var(--ice-300), 0 0 12px var(--ice-300); }
.session-end .after-actions { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); }
.line-info { min-height: 96px; align-content: center; }


/* ################################################################
   PASS 6 — coach marks, stepped Watch, plan view, edge handle   (was css/app-v6.css)
   ################################################################ */

/* =================================================================
   PASS 6 (2026-09-25, owner review of ac933b6): coach marks on the
   board, Watch stepped by hand, plan drawn on the board with a shrunk
   board, drawer that pushes AND shrinks the board, edge handle instead
   of the Lines button, part rewards, mastery ladder, one-line buttons.
   Loaded after app-v5.css.
   ================================================================= */

/* --- teaching marks: several arrows and circles at once, drawn in --- */
.arrows line { stroke: var(--ice-300); marker-end: url(#arrowhead); stroke-width: 0.16; opacity: 0.92; stroke-dasharray: 10; animation: mark-draw 420ms var(--ease-out) both; }
.arrows line.them { stroke: var(--coral); marker-end: url(#arrowhead-them); }
.arrows circle { fill: rgba(72, 202, 228, 0.10); stroke: var(--ice-300); stroke-width: 0.07; transform-box: fill-box; transform-origin: center; animation: mark-pop 380ms var(--ease-pop) both; }
.arrows circle.them { fill: rgba(255, 138, 147, 0.12); stroke: var(--coral); }
.arrows circle.plan { fill: rgba(79, 224, 191, 0.14); stroke: var(--mint); animation: mark-pop 380ms var(--ease-pop) both, plan-pulse 2.4s ease-in-out 500ms infinite; }
.arrows line.plan { stroke: var(--mint); marker-end: url(#arrowhead-plan); }
.arrows line:nth-of-type(2), .arrows circle:nth-of-type(2) { animation-delay: 140ms; }
.arrows line:nth-of-type(3), .arrows circle:nth-of-type(3) { animation-delay: 280ms; }
@keyframes mark-draw { from { stroke-dashoffset: 10; opacity: 0; } to { stroke-dashoffset: 0; } }
@keyframes mark-pop { from { transform: scale(0.3); opacity: 0; } }
@keyframes plan-pulse { 50% { fill: rgba(79, 224, 191, 0.28); } }

/* --- two-line status: the coach's line big, the reason small --- */
.status.two { min-height: 56px; padding: 6px var(--sp-3); }
.status.two small { font-size: 12.5px; font-weight: 600; line-height: 1.3; color: var(--text-dim); }
.status.good.two small { color: color-mix(in srgb, var(--mint) 55%, var(--text-dim)); }

/* --- the plan on the board: board shrinks for a moment, then grows back --- */
.board-wrap { transition: width 380ms var(--ease-out); }
.stage.plan-view .board-wrap { width: min(74vw, 470px); }

/* --- panels under the board: actions never float over text --- */
.after-actions, .session-end .after-actions { position: static; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; grid-template-columns: none; }
.after-actions button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 var(--sp-3); }
.after.part .plan-label, .after.part .plan-credit { display: none; }
.after.part h2 { font-size: 24px; }
.part-dots { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.part-dots i { width: 18px; height: 6px; border-radius: 3px; background: var(--ice-900); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.25); }
.part-dots i.on { background: var(--mint); box-shadow: 0 0 8px rgba(79, 224, 191, 0.6); animation: mark-pop 380ms var(--ease-pop) both; }
.part-dots i.half { background: linear-gradient(90deg, var(--ice-300) 50%, var(--ice-900) 50%); }
.plan-credit { font-size: 12px; }

/* --- drawer pushes AND shrinks the board (Samsung edge style), board stays bright --- */
.drawer { width: min(64vw, 520px); }
.drawer-open .stage { transform-origin: 0 0; transform: translateX(1.5vw) scale(0.34); filter: none; }
@media (min-width: 768px) { .drawer-open .stage { transform: translateX(2vw) scale(0.55); } }
.drawer .line-row .thumb { width: 44px; height: 44px; }

/* --- edge handle: visible, tappable, replaces the Lines button --- */
.drawer-edge { width: 20px; height: 76px; top: 38%; padding: 0; border: 0; border-radius: 8px 0 0 8px; background: linear-gradient(180deg, rgba(72, 202, 228, 0.18), rgba(72, 202, 228, 0.34), rgba(72, 202, 228, 0.18)); box-shadow: -2px 0 12px rgba(42, 147, 176, 0.35); opacity: 0.9; pointer-events: auto; display: grid; place-items: center; z-index: 25; animation: edge-nudge 5s ease-in-out 2s infinite; }
.drawer-edge::after { content: ""; position: absolute; inset: -10px -4px -10px -24px; }
.drawer-edge svg { width: 16px; height: 16px; fill: none; stroke: var(--ice-100); stroke-width: 2.5; }
.drawer-edge[hidden] { display: none; }
.drawer-open .drawer-edge { opacity: 0; pointer-events: none; }
@keyframes edge-nudge { 0%, 88%, 100% { transform: none; } 92% { transform: translateX(-5px); } 96% { transform: translateX(0); } }

/* --- Watch: one big "next" button, no autoplay --- */
.play:disabled { opacity: 0.35; box-shadow: none; }
.play svg { fill: none; stroke: currentColor; stroke-width: 3; }

/* --- mastery ladder (replaces the four medal coins) --- */
.ladder { display: flex; gap: 2px; height: 16px; margin: var(--sp-2) 0 var(--sp-1); }
.ladder i { flex: 1; border-radius: 3px; background: var(--ice-900); box-shadow: inset 0 0 0 1px rgba(72, 202, 228, 0.10); animation: ladder-in 420ms var(--ease-out) calc(var(--k) * 18ms) both; }
.ladder i.learned { background: var(--ice-700); }
.ladder i.bronze { background: var(--bronze); } .ladder i.silver { background: var(--silver); }
.ladder i.gold { background: var(--gold); box-shadow: 0 0 8px rgba(255, 200, 0, 0.5); } .ladder i.master { background: var(--master); box-shadow: 0 0 10px rgba(255, 107, 157, 0.6); }
@keyframes ladder-in { from { transform: scaleY(0.2); opacity: 0; } }
.ladder-legend { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); font-size: 12.5px; color: var(--text-dim); }
.ladder-legend b { color: var(--text); }
.ladder-legend .lg { display: inline-flex; align-items: center; gap: 4px; }
.ladder-legend .lg i { width: 10px; height: 10px; border-radius: 2px; }
.lg.bronze i { background: var(--bronze); } .lg.silver i { background: var(--silver); } .lg.gold i { background: var(--gold); } .lg.master i { background: var(--master); }
.next-medal { margin: var(--sp-2) 0 0; font-size: 13.5px; color: var(--text-dim); }
.next-medal b { color: var(--ice-100); }

@media (prefers-reduced-motion: reduce) {
  .arrows line, .arrows circle, .ladder i, .part-dots i.on, .drawer-edge { animation: none; }
}

/* --- narrow drawer on phones: names get the room; the shrunk board beside it is the preview --- */
@media (max-width: 600px) {
  .drawer { padding-left: var(--sp-2); padding-right: var(--sp-2); gap: var(--sp-2); }
  .drawer .sheet-head h2 { font-size: 20px; }
  .drawer .cats { grid-template-columns: repeat(2, 1fr); gap: 4px; }
  .drawer .cats button { padding: 6px 4px; flex-direction: row; justify-content: center; gap: 6px; min-height: var(--tap); }
  .drawer .line-row { grid-template-columns: 1fr auto; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3); }
  .drawer .line-row .thumb { display: none; }
  .drawer .lr-name { font-size: 13.5px; }
  .drawer .ring { width: 38px; height: 38px; }
  .drawer .fam-head h3 { font-size: 14px; }
}
.drawer-edge { width: 22px; background: linear-gradient(180deg, rgba(72, 202, 228, 0.28), rgba(72, 202, 228, 0.5), rgba(72, 202, 228, 0.28)); }
/* the handle must never sit over the board (it caught taps on h2/h3): park it low, hit area off the board */
.drawer-edge { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); }
.drawer-edge::after { inset: -10px 0 -10px -10px; }


/* ################################################################
   PASS 7–9 — one-screen trainer, coach card, top drawer, XP, progress card, review fixes   (was css/app-v7.css)
   ################################################################ */

/* =================================================================
   PASS 7 (2026-09-25): ONE SCREEN. Trainer = header · coach card at eye
   level · board sized to the space left · bottom action bar. Nothing
   scrolls. Coach text is clean white with one highlighted word. XP pops,
   then flows into a real level bar. Drawer across the full width, board
   slides down. Loaded last.
   ================================================================= */

/* ---------- trainer: a fixed one-screen column ---------- */
main[data-screen="trainer"] { height: 100dvh; overflow: hidden; }
main[data-screen="trainer"] .stage { height: 100dvh; gap: var(--sp-2); padding: 0 0 calc(var(--sp-2) + env(safe-area-inset-bottom)); }
.trainer-header { position: static; flex: none; grid-template-columns: var(--tap) 1fr auto auto auto; width: min(calc(100vw - 16px), var(--board-max)); background: none; }
.trainer-title #trainer-name { font-size: 18px; }

/* coach card: the one place the app talks — white, crisp, left-aligned, at eye level */
.coach-top { flex: none; width: min(calc(100vw - 16px), var(--board-max)); display: flex; flex-direction: column; gap: 6px; }
.coach-meta { margin: 0; display: flex; justify-content: space-between; gap: var(--sp-2); font-size: 12px; color: var(--text-dim); min-height: 16px; }
.coach-meta b { font-weight: 800; color: var(--ice-100); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-meta span { flex: none; font-weight: 800; color: var(--ice-300); }
.coach-top .status, .coach-top .status.two { width: 100%; min-height: 68px; margin: 0; padding: 10px 14px; border-radius: var(--r-2); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; text-align: left; background: #151d25; color: #fff; font-size: 17px; font-weight: 800; line-height: 1.25; box-shadow: inset 3px 0 0 var(--ice-300), 0 6px 20px rgba(0, 0, 0, 0.35); animation: coach-in 260ms var(--ease-out); }
.coach-top .status small { font-size: 13.5px; font-weight: 500; line-height: 1.35; color: rgba(255, 255, 255, 0.72); }
.coach-top .status span { font-weight: 800; }
.coach-top .status.good { box-shadow: inset 3px 0 0 var(--mint), 0 6px 20px rgba(0, 0, 0, 0.35); }
.coach-top .status.bad { box-shadow: inset 3px 0 0 var(--coral), 0 6px 20px rgba(0, 0, 0, 0.35); }
.coach-top .status.warn { box-shadow: inset 3px 0 0 var(--amber), 0 6px 20px rgba(0, 0, 0, 0.35); }
.coach-top .status.good, .coach-top .status.bad, .coach-top .status.warn, .coach-top .status.intro, .coach-top .status.neutral { color: #fff; background: #151d25; }
.coach-top .status[hidden] { display: none; }
em.hl { font-style: normal; color: var(--ice-300); }
.status.good em.hl { color: var(--mint); }
.status.warn em.hl { color: var(--amber); }
@keyframes coach-in { from { transform: translateY(-4px); opacity: 0.4; } }

/* after-line / part / watched / session end: same card, same voice */
.coach-top .after, .coach-top .session-end { width: 100%; margin: 0; padding: 12px 14px; border-radius: var(--r-2); background: #151d25; box-shadow: inset 3px 0 0 var(--ice-300), 0 6px 20px rgba(0, 0, 0, 0.35); color: #fff; animation: coach-in 260ms var(--ease-out); gap: 4px; }
.coach-top .after.perfect { box-shadow: inset 3px 0 0 var(--mint), 0 6px 20px rgba(0, 0, 0, 0.35); }
.coach-top .after h2 { margin: 0; font-size: 20px; font-weight: 900; color: #fff; }
.coach-top .after-kind { font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ice-300); display: flex; align-items: center; }
.coach-top .plan-label { display: none; }
.coach-top .plan-text { margin: 2px 0 0; font-size: 14.5px; line-height: 1.45; color: rgba(255, 255, 255, 0.9); max-height: none; overflow: visible; }
.coach-top .after.expanded .plan-text { max-height: 34dvh; overflow-y: auto; }
.coach-top .plan-credit { margin: 2px 0 0; font-size: 11.5px; color: var(--text-dim); }
.plan-text .more { display: inline; height: auto; min-height: 0; padding: 0 2px; background: none; box-shadow: none; color: var(--ice-300); font-weight: 800; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.coach-top .session-end h2 { font-size: 20px; margin: 2px 0 6px; }
.coach-top .se-stats { display: flex; gap: var(--sp-4); }
.coach-top .se-stats b { font-size: 24px; }
.coach-top .se-insight, .coach-top .se-next { margin: 6px 0 0; font-size: 13.5px; color: rgba(255, 255, 255, 0.8); }
.coach-top .whatif { width: 100%; margin: 0; border-radius: var(--r-2); background: #151d25; box-shadow: inset 3px 0 0 var(--amber); color: #fff; }

/* board fills whatever height is left — always square, never pushes anything off screen */
.board-slot { flex: 1 1 auto; min-height: 0; width: 100%; container-type: size; display: grid; place-items: center; }
.board-slot .board-wrap { width: min(calc(100cqw - 8px), 100cqh, var(--board-max)); transition: width 380ms var(--ease-out); }
.stage.plan-view .board-wrap { width: min(calc(100cqw - 8px), 100cqh, var(--board-max)); }

/* bottom action bar: fixed height, the one primary action lives here */
.action-bar { flex: none; width: min(calc(100vw - 16px), var(--board-max)); min-height: 56px; display: flex; align-items: center; gap: var(--sp-2); }
.action-bar .mode { margin: 0; flex: none; }
.action-bar .mode[hidden] { display: none; }
.action-bar .mode button { padding: 8px 10px; min-height: var(--tap); }
.action-bar .controls { width: auto; flex: 1; justify-content: flex-end; gap: var(--sp-1); }
.action-bar .review { width: auto; flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: var(--sp-2); }
.action-bar .review[hidden] { display: none; }
.action-bar .play { width: 88px; height: 52px; border-radius: var(--r-2); }
.action-bar .after-actions { flex: 1; margin: 0; }
.action-bar .after-actions[hidden] { display: none; }
.action-bar .after-actions button { height: 52px; }
.action-bar .tool { flex-direction: column; min-width: 56px; }

/* learning: a soft "follow the glow" instead of an error */
@keyframes flash-hint { 25% { box-shadow: inset 0 0 0 100vmax rgba(72, 202, 228, 0.35); } }
.sq.flash-hint { animation: flash-hint 0.6s var(--ease-out); }

/* coordinates: readable */
.sq[data-rank-label]::before, .sq[data-file-label]::after { font-size: 11px; font-weight: 800; opacity: 0.9; }

/* ---------- level chip = a real XP bar; XP pops big, then flows in and fills it ---------- */
.chip.level { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; }
.chip.level::before { display: none; }
.lv-bar { display: block; width: 44px; height: 6px; border-radius: 3px; background: rgba(72, 202, 228, 0.16); overflow: hidden; }
.lv-bar > i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--ice-400), var(--ice-200)); box-shadow: 0 0 8px rgba(72, 202, 228, 0.8); transition: width 900ms var(--ease-out); }
.chip.level.fill { animation: lv-glow 1100ms var(--ease-out); }
@keyframes lv-glow { 20% { box-shadow: 0 0 0 2px var(--ice-300), 0 0 22px rgba(72, 202, 228, 0.9); transform: scale(1.08); } }
.chip { border: 0; cursor: pointer; }
.xp-pop { position: fixed; left: 50%; top: 42%; z-index: 60; pointer-events: none; display: flex; align-items: baseline; gap: 6px; padding: 10px 20px; border-radius: var(--r-3); background: rgba(10, 14, 18, 0.82); box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.35), 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 209, 102, 0.25); backdrop-filter: blur(6px); }
.xp-pop b { font-size: 44px; font-weight: 900; color: var(--xp); line-height: 1; text-shadow: 0 0 18px rgba(255, 209, 102, 0.55); }
.xp-pop span { font-size: 18px; font-weight: 900; color: var(--xp); letter-spacing: 0.06em; }

/* ---------- drawer: full width on top; the board slides down and stays big ---------- */
.drawer { top: 0; left: 0; right: 0; bottom: auto; width: auto; height: 55dvh; border-radius: 0 0 var(--r-3) var(--r-3); padding-bottom: var(--sp-3); transform: translateY(-104%); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6), inset 0 -1px 0 rgba(72, 202, 228, 0.18); }
.drawer-open .drawer { transform: none; }
.drawer-open .stage { transform: var(--drawer-t); filter: none; }
.drawer-open .stage > :not(.board-slot) { opacity: 0; pointer-events: none; transition: opacity 200ms; }
.drawer .cats { grid-template-columns: repeat(4, 1fr); gap: 4px; }
.drawer .cats button { padding: 6px 2px; flex-direction: column; gap: 0; min-height: var(--tap); font-size: 12px; }
.drawer .line-row { grid-template-columns: 1fr auto; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3); }
.drawer .line-row .thumb { display: none; }
.drawer .ring { width: 38px; height: 38px; }
.drawer .line-list { overflow-y: auto; flex: 1; min-height: 0; }
.drawer-edge { top: calc(env(safe-area-inset-top) + 64px); bottom: auto; height: 68px; }
@media (min-width: 768px) { .drawer { left: auto; width: min(560px, 60vw); height: 100dvh; border-radius: 0; transform: translateX(104%); } .drawer-open .stage { transform: translateX(-18vw) scale(0.8); } }

/* ---------- home ---------- */
.op-next { margin: var(--sp-2) 0 0; font-size: 15px; font-weight: 800; color: #fff; display: flex; gap: 8px; align-items: baseline; }
.op-next span { font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ice-300); }

/* progress card: what you have and what is next */
.op-prog { display: flex; gap: var(--sp-4); align-items: center; margin-top: var(--sp-3); }
.lg-ring { width: 72px; height: 72px; }
.lg-ring circle { stroke-width: 6; }
.lg-ring b { font-size: 22px; font-weight: 900; line-height: 1; }
.lg-ring small { position: absolute; bottom: 14px; font-size: 11px; color: var(--text-dim); font-weight: 800; }
.op-prog-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.op-prog-label { font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.op-prog .medal-row { display: flex; gap: 6px; }
.op-prog .medal-stat { padding: 4px 8px 4px 4px; border-radius: var(--r-2); }
.op-prog .medal-core { width: 24px; height: 24px; font-size: 11px; }
.op-prog .next-medal { display: flex; gap: var(--sp-2); align-items: center; margin: 0; font-size: 13px; }
.op-prog .next-medal > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.op-prog .next-medal span { font-weight: 800; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-prog .next-medal small { color: var(--text-dim); }
.nm-bar { display: block; height: 5px; border-radius: 3px; background: var(--ice-900); overflow: hidden; }
.nm-bar > i { display: block; height: 100%; background: var(--ice-300); border-radius: 3px; }
.op-prog-hint { margin: 0; font-size: 13.5px; color: var(--text-dim); }
.weak:empty { display: none; }

@media (prefers-reduced-motion: reduce) { .coach-top .status, .coach-top .after, .chip.level.fill { animation: none; } .lv-bar > i { transition: none; } }
/* board sits right under the coach card (eye travels coach → board); the edge handle never covers text */
.board-slot { place-items: start center; }
.coach-top { padding-right: 16px; }

/* =================== pass 8 (owner review of af18bbc) =================== */
/* coach card like Chess Reps: black text on a white card, one accent word; state = thin edge only */
.coach-top .status, .coach-top .status.two,
.coach-top .status.good, .coach-top .status.bad, .coach-top .status.warn, .coach-top .status.intro, .coach-top .status.neutral,
.coach-top .after, .coach-top .session-end, .coach-top .whatif { background: #f7f9fb; color: #0d1720; box-shadow: inset 4px 0 0 var(--ice-500), 0 8px 24px rgba(0, 0, 0, 0.45); }
.coach-top .status.good, .coach-top .after.perfect { box-shadow: inset 4px 0 0 #1fae8c, 0 8px 24px rgba(0, 0, 0, 0.45); }
.coach-top .status.bad { box-shadow: inset 4px 0 0 #e0505c, 0 8px 24px rgba(0, 0, 0, 0.45); }
.coach-top .status.warn, .coach-top .whatif { box-shadow: inset 4px 0 0 #d98e14, 0 8px 24px rgba(0, 0, 0, 0.45); }
.coach-top .status small, .coach-top .plan-text, .coach-top .se-insight, .coach-top .se-next { color: #3d4b57; }
.coach-top .after h2, .coach-top .session-end h2, .coach-top .status span { color: #0d1720; }
.coach-top .after-kind { color: #1b6f8c; }
.coach-top .plan-credit { color: #6b7985; }
.coach-top em.hl, .coach-top .status.good em.hl, .coach-top .status.warn em.hl { color: #1b6f8c; }
.plan-text .more { color: #1b6f8c; }
.coach-top .se-stats b { color: #0d1720; }
.coach-top .whatif b, .coach-top .whatif span { color: #0d1720; }
/* the lull: the coach line waits for a tap on the board */
.coach-top .status.hold::after { content: "Tap the board to continue"; margin-top: 4px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.04em; color: #1b6f8c; opacity: 0; animation: hold-cue 1.6s ease-in-out 1s infinite; }
@keyframes hold-cue { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* no dead band: spare height is split around the board; progress meta sits under it */
.board-slot { place-items: center; }
.coach-meta { order: 2; }
.coach-meta:empty { display: none; }
.coach-meta b:only-child { flex: 1; }

/* bar: the primary action gets the room and never ellipsizes */
.action-bar .after-actions { grid-template-columns: auto 1fr; grid-auto-flow: row; }
.action-bar .after-actions:has(> :only-child), .action-bar .after-actions:has(> [hidden]) { grid-template-columns: 1fr; }
.action-bar .after-actions .secondary { padding: 0 var(--sp-4); }
.action-bar .after-actions .primary { text-overflow: clip; font-size: 15px; }
/* the edge handle sits beside the meta line, not over the card */
.drawer-edge { top: calc(env(safe-area-inset-top) + 58px); height: 44px; width: 18px; }

/* XP: gold everywhere — the pop, the blob, the bar */
.lv-bar > i { background: linear-gradient(90deg, #f0a800, #ffd166); box-shadow: 0 0 8px rgba(255, 200, 60, 0.85); transition: width 1100ms cubic-bezier(0.3, 1.4, 0.5, 1); }
.chip.level { color: #ffe3a0; }
@keyframes lv-glow { 20% { box-shadow: 0 0 0 2px #ffd166, 0 0 26px rgba(255, 200, 60, 0.9); transform: scale(1.12); } 45% { transform: scale(0.97); } }
.xp-pop { left: 0; top: 0; padding: 0; background: none; box-shadow: none; backdrop-filter: none; }
.xp-pop b { font-size: 84px; color: #ffd166; text-shadow: 0 0 30px rgba(255, 190, 40, 0.9), 0 4px 0 #b77900; }
.xp-pop span { font-size: 26px; color: #ffd166; text-shadow: 0 0 16px rgba(255, 190, 40, 0.8); }
.xp-pop::before { content: ""; position: absolute; inset: -40px -50px; z-index: -1; border-radius: 50%; background: radial-gradient(circle, rgba(255, 209, 102, 0.45), rgba(255, 209, 102, 0) 65%); }
.xp-blob, .xp-drop { position: fixed; z-index: 61; pointer-events: none; background: radial-gradient(circle at 35% 30%, #fff4c9, #ffd166 35%, #f0a800 75%); box-shadow: 0 0 24px rgba(255, 196, 50, 0.9), 0 0 60px rgba(255, 196, 50, 0.45); }
.xp-blob { width: 64px; height: 64px; }
.xp-drop { width: 14px; height: 14px; border-radius: 50%; }

/* drawer: half ↔ full with a grab bar at its bottom edge */
.drawer .grab { order: 99; flex: none; height: 28px; margin: 0 calc(-1 * var(--sp-3)) calc(-1 * var(--sp-3)); display: grid; place-items: center; touch-action: none; cursor: grab; }
.drawer .grab i { width: 48px; height: 5px; border-radius: 3px; background: rgba(214, 238, 255, 0.45); }
.drawer { transition: transform 420ms var(--ease-out), height 380ms var(--ease-out); }
.drawer.full { height: 100dvh; border-radius: 0; }
.coach-top .status.two small, .coach-top .status.good.two small { color: #3d4b57; }

/* softer contrast (owner: the white card was "super bright against black"):
   a cool paper card and a slightly lifted night background */
:root { --card: #dcecf1; --card-ink: #0d2433; --card-sub: #40596a; }   /* Muted Reef coach card */
body { background: var(--bg); }
.coach-top .status, .coach-top .status.two,
.coach-top .status.good, .coach-top .status.bad, .coach-top .status.warn, .coach-top .status.intro, .coach-top .status.neutral,
.coach-top .after, .coach-top .session-end, .coach-top .whatif { background: var(--card); color: var(--card-ink); }
.coach-top .status small, .coach-top .status.two small, .coach-top .status.good.two small, .coach-top .plan-text, .coach-top .se-insight, .coach-top .se-next { color: var(--card-sub); }

/* ---------- pass 9 (owner, 2026-09-26) ---------- */
/* bar: [↻] [secondary] [PRIMARY] — flex so the primary always gets the room */
.action-bar .after-actions { display: flex; gap: var(--sp-2); }
.action-bar .after-actions > button { flex: 1 1 0; min-width: 0; }
.action-bar .after-actions > .primary { flex: 1.7 1 0; }
.action-bar .after-actions > .icon-only { flex: none; width: 52px; padding: 0; display: grid; place-items: center; }
.icon-only svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.action-bar .after-actions > [hidden] { display: none; }

/* drawer scrolling: smooth — no per-row animations, filters or heavy shadows while it scrolls */
.drawer .line-list { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; will-change: scroll-position; }
.drawer-open .drawer .line-row, .drawer .line-row { animation: none; box-shadow: inset 0 0 0 1px var(--line); transition: none; }
.drawer .line-row.playing { box-shadow: inset 0 0 0 2px var(--ice-300); }
.drawer .ring .fill { filter: none; animation: none; stroke-dashoffset: var(--off); }
.drawer .cats button { transition: background 160ms, box-shadow 160ms; }

/* XP blob: floats until a tap, then leaps above the bar and is sucked in */
.xp-float { position: fixed; z-index: 61; pointer-events: none; width: 76px; height: 76px; }
.xp-float .xp-blob { position: absolute; inset: 0; width: auto; height: auto; border-radius: 50%; }
.xp-num { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: baseline; gap: 2px; white-space: nowrap; }
.xp-num b { font-size: 30px; font-weight: 900; color: #3a2500; line-height: 1; }
.xp-num span { font-size: 12px; font-weight: 900; color: #5a3c00; }
.xp-float::before { content: ""; position: absolute; inset: -34px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 209, 102, 0.4), rgba(255, 209, 102, 0) 65%); }

/* XP moment: the screen dims and softens; a word of praise over the blob; tap to collect */
.xp-veil { position: fixed; inset: 0; z-index: 60; pointer-events: none; background: rgba(6, 10, 14, 0.5); backdrop-filter: blur(3px) saturate(0.7); -webkit-backdrop-filter: blur(3px) saturate(0.7); animation: veil-in 260ms ease-out both; }
.xp-veil.out { animation: veil-out 300ms ease-in both; }
@keyframes veil-in { from { opacity: 0; } }
@keyframes veil-out { to { opacity: 0; } }
.xp-label { position: absolute; left: 50%; bottom: calc(100% + 18px); transform: translateX(-50%); white-space: nowrap; font-size: 30px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 0 24px rgba(255, 209, 102, 0.55); letter-spacing: 0.01em; }
.xp-hint { position: absolute; left: 50%; top: calc(100% + 16px); transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 238, 200, 0.85); animation: hold-cue 1.6s ease-in-out 0.8s infinite; opacity: 0.4; }
.xp-num b { font-size: 26px; }

/* ---------- review fixes 2026-09-27 ---------- */
/* the board never moves: the coach line has one fixed height (2 lines + 2 small lines max) */
.coach-top .status, .coach-top .status.two { height: 78px; min-height: 78px; overflow: hidden; justify-content: center; }
.coach-top .status span, .coach-top .status small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.coach-top .status.hold::after { position: absolute; right: 12px; bottom: 6px; margin: 0; }
.coach-top .status { position: relative; }
.coach-meta { height: 16px; }
/* the title fits on a 360 px phone */
.trainer-title #trainer-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 380px) { .trainer-title #trainer-name { font-size: 16px; } .trainer-header .chip { padding: 0 8px; } .lv-bar { width: 32px; } }
/* the drawer tab is visibly wider; the hit area stays 44 px+ */
.drawer-edge { width: 24px; }
/* the whole coach text fits — no "…" (owner, 2026-09-28): taller fixed card, line counts sized to the longest texts */
.coach-top .status, .coach-top .status.two { height: 100px; min-height: 100px; font-size: 16px; line-height: 1.22; gap: 4px; }
.coach-top .status span { -webkit-line-clamp: 2; }
.coach-top .status small { font-size: 13px; line-height: 1.3; -webkit-line-clamp: 3; }
.coach-top .status span[hidden] { display: none; }
/* the XP value is always readable: big gold "+N XP" under the praise, above the blob */
.xp-label { display: flex; flex-direction: column; align-items: center; gap: 2px; bottom: calc(100% + 14px); }
.xp-label span { font-size: 26px; font-weight: 900; color: #fff; }
.xp-label b { font-size: 40px; font-weight: 900; color: #ffd166; line-height: 1; text-shadow: 0 0 22px rgba(255, 190, 40, 0.8), 0 3px 0 #9c6800; }
.xp-float .xp-num { display: none; }

/* logo 1B (2026-09-29): the header logo is the app icon itself */
.logo { background: none; border-radius: 12px; }
.logo img { width: 44px; height: 44px; filter: none; }

/* coach card: text is sized to fit, never clipped (fitCoach in app.js steps the type down) */
.coach-top .status span, .coach-top .status small { display: block; -webkit-line-clamp: unset; overflow: visible; }
.coach-top .status { font-size: var(--say-fs, 16px); }
.coach-top .status span { font-size: var(--say-fs, 16px); }
.coach-top .status small { font-size: var(--why-fs, 13px); }
/* the "tap the board" cue has its own row at the bottom — it never sits on the text */
.coach-top .status.hold { justify-content: flex-start; padding-bottom: 22px; }
.coach-top .status.hold::after { position: absolute; left: 14px; right: 12px; bottom: 5px; text-align: right; }

/* pieces render crisp: no permanent compositing layer (it froze a low-res raster), only while sliding */
.piece { will-change: auto; }
.piece.slide { will-change: transform; }
/* Classic piece treatment from the latest deployed phone build. */
[data-pieces="pieces-concept-classic"] .piece { filter: none; padding: 0; }
/* The source set has only a light-square black king; outline it on blue. */
[data-pieces="pieces-concept-classic"] .sq.dark:has(.piece[src*="/bK-"]) .piece {
  filter: drop-shadow(1px 0 #f6f0e1) drop-shadow(-1px 0 #f6f0e1);
}
[data-pieces="pieces-concept-classic"] { --card: #f5f2e9; --card-sub: #4f5964; }
[data-pieces="pieces-concept-classic"] .board { --accent: #6d91ba; }
.board { --accent: #6d91ba; }
