/* Simple Six v2 — phone-first, light + dark, one accent color per track. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #070910;
  --surface: #10131C;
  --surface-2: #181C28;
  --surface-3: #242A3A;
  --text: #EEEEF2;
  --text-2: #A0A0B2;
  --text-3: #8E8EA2;              /* 4.5:1 on --surface-2 (WCAG AA) */
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #5B8DEF;
  --ok: #34D399;
  --ok-dim: rgba(52, 211, 153, 0.12);
  --danger: #F87171;
  /* Track colors */
  --six: #5B8DEF;
  --golf: #4FD1A1;
  --band: #FBBF24;                /* the band stroke in figures */
  --bands: #A78BFA;               /* the Resistance Bands track */
  --beach: #F472B6;
  --on-track: #0A0A0F;            /* text on a filled track color */
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F5F6FA;
  --surface: #FFFFFF;
  --surface-2: #F0F1F6;
  --surface-3: #E1E4EC;
  --text: #14141B;
  --text-2: #4E5060;
  --text-3: #646876;              /* 4.5:1 on --surface-2 (WCAG AA) */
  --line: rgba(20, 20, 27, 0.08);
  --line-strong: rgba(20, 20, 27, 0.16);
  --accent: #2D5BD0;
  --ok: #0B7451;
  --ok-dim: rgba(16, 134, 91, 0.10);
  --danger: #C62828;
  --six: #2D5BD0;
  --golf: #086A4A;
  --band: #B45309;
  --bands: #6D28D9;
  --beach: #A0256A;
  --on-track: #FFFFFF;
  color-scheme: light;
}

/* Each block sets --t to its track color; components read --t. */
.t-six   { --t: var(--six); }
.t-golf  { --t: var(--golf); }
.t-band  { --t: var(--bands); }   /* not --band: the band must stand out from the figure */
.t-beach { --t: var(--beach); }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.45;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 300; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

main { display: block; max-width: 560px; margin: 0 auto; padding: 4px 16px 24px; outline: none; }
.loading { height: 60vh; }

/* ===== Header + nav ===== */
.app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: var(--bg);
}
.brand { font-size: 15px; font-weight: 800; letter-spacing: 2.5px; text-transform: uppercase; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text-2); font-size: 24px; line-height: 1;
}
.icon-btn svg { width: 20px; height: 20px; }
[data-theme="light"] .icon-moon, [data-theme="dark"] .icon-sun { display: none; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; justify-content: center;
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav-tab {
  flex: 1; max-width: 186px; height: var(--nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 11px; font-weight: 600;
}
.nav-tab svg { width: 22px; height: 22px; }
.nav-tab[aria-current="page"] { color: var(--accent); }
/* Workout = full focus: no header, no nav. */
body[data-view="workout"] .app-header, body[data-view="workout"] .bottom-nav { display: none; }
body[data-view="workout"] { padding-bottom: 24px; }

/* ===== Shared ===== */
.view-title { font-size: 26px; font-weight: 800; margin: 6px 0 14px; }
.section-title {
  font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-3); margin: 22px 0 10px;
}
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.card-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 12px; }
.empty { color: var(--text-3); text-align: center; padding: 24px 0; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 20px; border-radius: 12px;
  font-weight: 700; font-size: 15px; transition: transform 0.08s; text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn-primary { background: var(--t, var(--accent)); color: var(--on-track); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 700;
  padding: 4px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2);
}
.chip-level { background: color-mix(in srgb, var(--t, var(--accent)) 16%, transparent); color: var(--t, var(--accent)); }
.chip-good { background: var(--ok-dim); color: var(--ok); }

/* Exercise figures. The band is its own colored stroke. */
.ex-icon, .ex-art { display: block; width: 100%; height: 100%; }
.ex-icon .band, .ex-art .band { stroke: var(--band); stroke-width: 2.4; }
.ex-icon .band-anchor, .ex-art .band-anchor { fill: var(--band); stroke: none; }

/* ===== Today ===== */
.track-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.track-tile {
  position: relative; text-align: left;
  display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: 10px;
  align-items: center; padding: 12px; min-height: 68px;
  background: var(--surface); border-radius: var(--radius); border: 2px solid transparent;
}
.track-tile.selected { border-color: var(--t); background: color-mix(in srgb, var(--t) 10%, var(--surface)); }
.track-icon { grid-row: span 2; width: 36px; height: 36px; color: var(--t); }
.track-name { font-weight: 800; font-size: 14px; line-height: 1.2; }
.track-today { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.resume-card {
  width: 100%; margin-top: 14px; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 14px 16px; border-radius: var(--radius); background: var(--ok-dim); border: 1px solid var(--ok);
}
.resume-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--ok); animation: pulse 1.6s infinite; flex-shrink: 0; }
@keyframes pulse { 50% { opacity: 0.35; } }
.resume-text { flex: 1; display: flex; flex-direction: column; font-size: 13px; color: var(--text-2); }
.resume-text strong { color: var(--text); font-size: 15px; }
.resume-cta { font-weight: 800; color: var(--ok); }

.today-card {
  margin-top: 14px; padding: 20px; border-radius: 20px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--t) 22%, var(--surface)) 0%, var(--surface) 70%);
}
.today-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--t); }
.today-title { font-size: 28px; font-weight: 800; line-height: 1.15; margin: 6px 0 6px; }
.today-desc { color: var(--text-2); font-size: 14px; }
.today-focus { margin-top: 10px; font-size: 14px; }
.today-icons { display: flex; gap: 4px; margin: 16px 0 6px; color: var(--t); }
.today-icons .ex-icon, .today-icons .ex-art { width: 40px; height: 40px; }
.today-meta { font-size: 12px; color: var(--text-3); margin-bottom: 16px; }
.today-card.rest .btn { margin-top: 14px; }

.stat-line {
  display: flex; justify-content: space-around; flex-wrap: wrap; gap: 6px 12px;
  margin-top: 14px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface);
  font-size: 13px; color: var(--text-2);
}
.stat-line strong { color: var(--text); font-size: 15px; }
.stat-line .ok strong { color: var(--ok); }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.week-day {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 2px; min-height: 76px; border-radius: 12px; background: var(--surface);
  font-size: 10px; color: var(--text-2); text-align: center; border: 1.5px solid transparent;
}
.week-day.today { border-color: var(--accent); }
/* Rest and missed days look quieter without opacity, which fails text contrast. */
.week-day.rest { background: transparent; border: 1.5px dashed var(--line-strong); }
.week-day.rest.today { border: 1.5px solid var(--accent); }
.week-day.past:not(.done) { background: transparent; }
.wd-day { font-weight: 800; font-size: 11px; color: var(--text); }
.wd-mark { font-size: 15px; line-height: 1; height: 16px; color: var(--text-3); }
.week-day.done .wd-mark { color: var(--ok); font-weight: 800; }
.wd-name { line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.program-list { display: flex; flex-direction: column; gap: 8px; }
.program-row {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 12px 14px; border-radius: 14px; background: var(--surface);
}
.program-row:active { background: var(--surface-2); }
.program-icon { width: 40px; height: 40px; flex-shrink: 0; color: var(--t, var(--accent)); }
.program-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.program-name { font-weight: 700; }
.program-desc { font-size: 12px; color: var(--text-2); }
.program-min { font-weight: 800; font-size: 15px; text-align: right; white-space: nowrap; }
.program-min small { display: block; font-size: 10px; font-weight: 600; color: var(--text-3); }

/* ===== Player ===== */
.player-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  margin: 0 -16px; padding: calc(8px + var(--safe-t)) 16px 8px; background: var(--bg);
}
.player-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.player-title h1 { font-size: 16px; line-height: 1.3; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-title small { font-size: 12px; color: var(--text-3); }
.player-clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-2); }
.steps { display: flex; gap: 4px; margin: 4px 0 12px; }
.step { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); padding: 0; }
.step.done { background: color-mix(in srgb, var(--t) 55%, transparent); }
.step.current { background: var(--t); }

.ex-card { background: var(--surface); border-radius: 20px; overflow: hidden; }
.ex-hero {
  position: relative; width: 100%; display: flex; justify-content: center;
  padding: 18px 0 10px; color: var(--t);
  background: color-mix(in srgb, var(--t) 9%, var(--surface-2));
}
.ex-hero .ex-icon { width: 120px; height: 120px; }
.ex-hero .ex-art { width: 180px; height: 180px; margin: -12px 0 -8px; }
.ex-hero-hint {
  position: absolute; right: 12px; bottom: 10px; font-size: 12px; font-weight: 700;
  padding: 5px 11px; border-radius: 999px; background: var(--surface); color: var(--text-2);
}
.ex-head { padding: 12px 18px 0; text-align: center; }
.ex-head .chips { justify-content: center; }
.badge-focus {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; background: var(--t); color: var(--on-track); margin-bottom: 6px;
}
.ex-name { font-size: 24px; font-weight: 800; line-height: 1.2; }

/* The set to do now: readable from 2 m away. */
.now { padding: 10px 14px 4px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.now-label { font-size: 15px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--t); }
.now-done { font-size: 20px; font-weight: 800; color: var(--ok); padding: 18px 14px; }
.stepper { display: grid; grid-template-columns: 60px minmax(0, 170px) 60px; gap: 10px; align-items: center; width: 100%; justify-content: center; }
.step-btn {
  width: 60px; height: 60px; border-radius: 999px; background: var(--surface-2);
  font-size: 30px; font-weight: 700; line-height: 1; color: var(--text);
}
.step-btn:active { transform: scale(0.95); background: var(--surface-3); }
.now-num { display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.now-num input {
  min-width: 1.6ch; max-width: 5ch; border: none; background: none; text-align: center; color: var(--text);
  font-size: 56px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.now-num input::-webkit-outer-spin-button, .now-num input::-webkit-inner-spin-button { -webkit-appearance: none; }
.now-num small { font-size: 16px; font-weight: 700; color: var(--text-3); }
.now-last { font-size: 14px; color: var(--text-3); }

.set-dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px 4px; }
.set-dot {
  min-width: 44px; height: 36px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: var(--text-3); border: 2px solid var(--line-strong);
}
.set-dot.current { color: var(--t); border-color: var(--t); }
.set-dot.done { background: var(--ok-dim); border-color: transparent; color: var(--ok); }
.key-cue { margin: 8px 18px 16px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 15px; color: var(--text-2); text-align: center; }

/* Bottom dock: the one big action, in thumb reach. */
body[data-view="workout"] { padding-bottom: calc(96px + var(--safe-b)); }
.player-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: 56px 1fr 56px; gap: 10px;
  max-width: 560px; margin: 0 auto; padding: 10px 16px calc(12px + var(--safe-b));
  background: var(--bg); box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
}
.dock-main { min-height: 64px; font-size: 19px; font-weight: 800; padding: 0 10px; }
.dock-side { min-height: 64px; padding: 0; font-size: 26px; }

/* ... menu */
.player-menu { position: relative; }
.player-menu summary { list-style: none; font-size: 22px; }
.player-menu summary::-webkit-details-marker { display: none; }
.player-menu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 210px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); display: flex; flex-direction: column;
}
.player-menu .menu button { text-align: left; padding: 12px; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--text); }
.player-menu .menu button:active { background: var(--surface-2); }
.player-menu .menu .menu-danger { color: var(--danger); border-top: 1px solid var(--line); margin-top: 4px; }

/* All moves */
.steps { width: 100%; }
.overview { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ov-row { width: 100%; display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 8px 12px; background: var(--surface); border-radius: 14px; text-align: left; border: 2px solid transparent; }
.ov-row.current { border-color: var(--t); }
.ov-icon { width: 52px; height: 52px; color: var(--t); }
.ov-info { display: flex; flex-direction: column; min-width: 0; }
.ov-name { font-weight: 800; font-size: 15px; }
.ov-info small { color: var(--text-3); font-size: 13px; }
.ov-count { font-weight: 800; color: var(--text-2); }
.ov-row.done .ov-count { color: var(--ok); }

.summary { text-align: center; padding: 48px 4px 0; }
.summary-burst {
  width: 84px; height: 84px; margin: 0 auto 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ok); color: var(--on-track); font-size: 40px; font-weight: 800;
}
.summary h1 { font-size: 26px; font-weight: 800; }
.summary-sub { color: var(--text-2); margin-top: 4px; }
.summary-stats { display: flex; justify-content: center; gap: 10px; margin: 24px 0; }
.summary-stats div { flex: 1; max-width: 140px; background: var(--surface); border-radius: var(--radius); padding: 14px 6px; display: flex; flex-direction: column; }
.summary-stats strong { font-size: 26px; font-weight: 800; }
.summary-stats small { font-size: 15px; color: var(--text-3); }
.summary-stats span { font-size: 12px; color: var(--text-3); }
.summary .btn + .btn { margin-top: 10px; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 400; overflow: hidden; }
.confetti i { position: absolute; top: -10px; width: 8px; height: 8px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: 0.7; } }

/* ===== Timer: full screen, readable from across the room ===== */
.timer {
  position: fixed; inset: 0; z-index: 150; display: flex; justify-content: center;
  transform: translateY(110%); visibility: hidden; background: var(--bg);
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}
.timer.active { transform: none; visibility: visible; transition: transform 0.25s ease; }
.timer-panel {
  width: 100%; max-width: 560px; height: 100%; padding: calc(16px + var(--safe-t)) 20px calc(20px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 14px;
}
.timer-top { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.timer-label { font-size: 15px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-2); text-align: center; }
.timer-ring-wrap { position: relative; width: min(72vw, 300px); aspect-ratio: 1; }
.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 7; }
.timer-ring-fg { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.timer-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(64px, 22vw, 96px); font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-controls { width: 100%; display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 10px; }
.timer-controls .btn { min-height: 60px; font-size: 17px; }
.timer-next { width: 100%; }
.next-card { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; background: var(--surface); border-radius: 18px; padding: 12px; }
.next-icon { width: 96px; height: 96px; color: var(--accent); }
.next-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.next-label { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); }
.next-name { font-size: 20px; font-weight: 800; }
.next-amount { font-size: 15px; color: var(--text-2); }
.next-weight { font-size: 18px; font-weight: 800; }
.next-weight.changed { color: var(--band); }

/* ===== Exercise sheet ===== */
.sheet { position: fixed; inset: 0; z-index: 200; visibility: hidden; }
.sheet.active { visibility: visible; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 0.2s; }
.sheet.active .sheet-backdrop { opacity: 1; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding-bottom: calc(24px + var(--safe-b));
  transform: translateY(100%); transition: transform 0.25s ease;
}
.sheet.active .sheet-panel { transform: none; }
.sheet-close { position: sticky; top: 10px; float: right; margin: 10px 10px 0 0; z-index: 2; background: var(--surface-2); }
.sheet-hero {
  position: relative; display: flex; justify-content: center; margin: 14px 16px 0; padding: 18px;
  border-radius: var(--radius); color: var(--t); background: color-mix(in srgb, var(--t) 9%, var(--surface-2));
}
.sheet-hero .ex-icon { width: 160px; height: 160px; }
.sheet-hero .ex-art { width: 250px; height: 250px; margin: -12px 0; }
.hero-play { position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 999px; background: var(--surface); font-size: 11px; }
.frames { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin: 10px 16px 0; color: var(--text-3); }
.frames figure { display: flex; flex-direction: column; align-items: center; padding: 10px 6px 8px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--t); }
.frames .ex-icon { width: 70px; height: 70px; }
.frames .ex-art { width: 110px; height: 110px; }
.frames figcaption { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--text-2); margin-top: 4px; }
.sheet-title { font-size: 24px; font-weight: 800; margin: 18px 16px 0; }
.sheet-meta { color: var(--text-2); font-size: 13px; margin: 2px 16px 0; }
.muscles { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 16px 0; }
.muscles span { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); text-transform: capitalize; }
.sheet-desc { margin: 14px 16px 0; color: var(--text-2); }
.howto, .levels { margin: 18px 16px 0; }
.howto h3, .levels h3 { font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--t); margin-bottom: 8px; }
.howto ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.howto li { position: relative; padding-left: 16px; }
.howto li::before { content: ''; position: absolute; left: 0; top: 8px; width: 7px; height: 7px; border-radius: 999px; background: var(--t); }
.howto strong { color: var(--t); }
.levels-rule { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.level {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 12px; margin-bottom: 6px; border-radius: 12px; background: var(--surface-2); border: 1.5px solid transparent;
}
.level.current { border-color: var(--t); }
.level-n { width: 26px; height: 26px; flex-shrink: 0; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; background: var(--surface-3); color: var(--text-2); }
.level.current .level-n { background: var(--t); color: var(--on-track); }
.level-text { flex: 1; display: flex; flex-direction: column; font-size: 12px; color: var(--text-2); }
.level-text strong { font-size: 14px; color: var(--text); }
.level-text em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--text-3); margin-left: 4px; }
.level-you { font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--t); }

/* ===== Library ===== */
.search {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); font-size: 15px;
}
.chip-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 12px -16px 0; padding: 0 16px; }
.chip-row::-webkit-scrollbar { display: none; }
.filter-chip { flex-shrink: 0; padding: 8px 14px; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 700; color: var(--text-2); }
.filter-chip.on { background: var(--accent); color: var(--on-track); }
.lib-count { font-size: 12px; color: var(--text-3); margin: 12px 0 8px; }
.ex-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ex-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 6px 12px; border-radius: 14px; background: var(--surface); text-align: center;
}
.ex-tile:active { background: var(--surface-2); }
.ex-tile-icon { width: 46px; height: 46px; color: var(--t); margin-bottom: 4px; }
.ex-tile-name { font-size: 12px; font-weight: 700; line-height: 1.25; }
.ex-tile-equip { font-size: 10px; color: var(--text-3); }

/* ===== Progress ===== */
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-cards div { background: var(--surface); border-radius: var(--radius); padding: 14px 8px; text-align: center; display: flex; flex-direction: column; }
.stat-cards strong { font-size: 26px; font-weight: 800; }
.stat-cards span { font-size: 12px; color: var(--text-3); }
.stat-cards .ok strong { color: var(--ok); }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head span { text-align: center; font-size: 10px; color: var(--text-3); margin-bottom: 4px; }
.cal { display: block; aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); }
.cal.done { background: var(--ok); }
.cal.missed { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.cal.future { opacity: 0.35; }
.cal.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-key { display: flex; gap: 16px; margin-top: 10px; font-size: 11px; color: var(--text-3); }
.cal-key span { display: flex; align-items: center; gap: 6px; }
.cal-key i { width: 12px; height: 12px; }
.metric + .metric { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.metric-head { display: flex; justify-content: space-between; align-items: baseline; }
.metric-head h3 { font-size: 15px; font-weight: 700; }
.metric-head span { font-size: 13px; color: var(--text-2); }
.metric-head strong { font-size: 20px; color: var(--text); }
.metric-best { font-size: 12px; color: var(--ok); margin-top: 2px; }
.metric-form { display: flex; gap: 8px; margin-top: 10px; }
.metric-form input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 10px; border: none; background: var(--surface-2); }
.metric-list { list-style: none; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.metric-list li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }
.history { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.history li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border-left: 4px solid var(--t); }
.h-date { width: 36px; display: flex; flex-direction: column; align-items: center; font-size: 10px; color: var(--text-3); text-transform: uppercase; }
.h-date strong { font-size: 18px; color: var(--text); line-height: 1.1; }
.h-info { display: flex; flex-direction: column; font-size: 12px; color: var(--text-2); }
.h-info strong { font-size: 14px; color: var(--text); }
.setting { display: flex; align-items: center; gap: 10px; }
.setting span { flex: 1; display: flex; flex-direction: column; font-size: 14px; }
.setting span small { font-size: 12px; color: var(--text-3); }
.setting input { width: 76px; height: 40px; text-align: center; border-radius: 10px; border: none; background: var(--surface-2); font-weight: 700; }
.setting > small { color: var(--text-3); }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 500;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--surface-3); color: var(--text); font-size: 14px; font-weight: 600;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--ok); color: var(--on-track); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (min-width: 600px) {
  .ex-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ===== Exercise illustrations (assets/img/ex) ===== */
.ex-art { position: relative; display: block; width: 100%; height: 100%; }
.ex-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* Start -> midpoint -> start: hold each pose, ease between them. */
.ex-art.anim img.mid { animation: ex-fade 3.2s ease-in-out infinite; }
.ex-art.anim img:not(.mid) { animation: ex-fade-start 3.2s ease-in-out infinite; }
.ex-art.anim.paused img { animation-play-state: paused; }
/* The frames have transparent backgrounds, so the start frame must fade
   OUT while the mid frame fades in (else both poses show at once and a
   stretch looks like it has three legs). Short fades, long holds. */
@keyframes ex-fade { 0%, 40% { opacity: 0; } 48%, 90% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes ex-fade-start { 0%, 40% { opacity: 1; } 48%, 90% { opacity: 0; } 98%, 100% { opacity: 1; } }

/* ===== Form check ===== */
.chip-cam { background: var(--surface-3); color: var(--text); }
.sheet-form { margin: 12px 16px 0; }
.form { position: fixed; inset: 0; z-index: 260; background: #000; color: #fff; display: none; }
.form.active { display: block; }
#form-body { height: 100%; }
.form-sheet {
  height: 100%; overflow-y: auto; max-width: 560px; margin: 0 auto;
  padding: calc(16px + var(--safe-t)) 20px calc(24px + var(--safe-b));
  background: var(--bg); color: var(--text);
}
.form-x { float: right; }
.form-demo { width: 180px; height: 180px; margin: 8px auto 0; color: var(--six); }
.form-sheet h2 { font-size: 22px; font-weight: 800; margin-top: 12px; }
.form-lead { color: var(--text-2); margin-top: 8px; }
.form-steps { margin: 14px 0 0 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.form-steps strong { color: var(--text); }
.form-privacy { font-size: 13px; color: var(--text-3); margin: 16px 0; }
.form-sheet .btn-block + .btn-block { margin-top: 10px; }
.form-cam { position: relative; height: 100%; overflow: hidden; background: #000; }
.form-cam video { display: none; }
.form-cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.form-cam canvas.mirror { transform: scaleX(-1); }
.form-top, .form-bottom { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px; z-index: 2; }
.form-top { top: calc(12px + var(--safe-t)); }
.form-bottom { bottom: calc(24px + var(--safe-b)); }
.form-cam .icon-btn { background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 20px; }
.form-status { flex: 1; text-align: center; font-size: 14px; font-weight: 700; padding: 8px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); }
.form-count { position: absolute; top: 18%; left: 0; right: 0; text-align: center; font-size: 96px; font-weight: 800; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6); z-index: 2; pointer-events: none; }
.form-feedback { position: absolute; bottom: calc(120px + var(--safe-b)); left: 16px; right: 16px; text-align: center; z-index: 2; font-size: 22px; font-weight: 800; pointer-events: none; }
.form-feedback:empty { display: none; }
.form-feedback.good, .form-feedback.bad { padding: 10px 14px; border-radius: 14px; }
.form-feedback.good { background: rgba(16, 134, 91, 0.85); }
.form-feedback.bad { background: rgba(198, 40, 40, 0.88); }
.form-spacer { width: 40px; }
.rec-btn { width: 76px; height: 76px; border-radius: 999px; border: 4px solid #fff; display: flex; align-items: center; justify-content: center; }
.rec-btn span { width: 56px; height: 56px; border-radius: 999px; background: #EF4444; transition: all 0.15s; }
.rec-btn.on span { width: 28px; height: 28px; border-radius: 6px; }
.form-score { margin-top: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); display: flex; align-items: baseline; gap: 10px; }
.form-score strong { font-size: 36px; font-weight: 800; }
.form-score span { color: var(--text-2); }
.form-score.ok strong { color: var(--ok); }
.form-faults { list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.form-faults li { padding: 12px 14px; border-radius: 12px; background: var(--surface); border-left: 4px solid var(--danger); }
.form-faults p { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.form-tip { margin-top: 12px; color: var(--text-2); }
.form-tip.good { color: var(--ok); font-weight: 700; }
.rep-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.rep-dots span { width: 30px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; }
.rep-dots .good { background: var(--ok); }
.rep-dots .bad { background: var(--danger); }
.form-playback { width: 100%; max-height: 50vh; margin-top: 16px; border-radius: var(--radius); background: #000; }
.form-actions { margin-top: 16px; }

/* Dark theme: the illustrations draw equipment in charcoal, which vanishes on
   a dark card. A soft light rim keeps kettlebells and bars visible. */
[data-theme="dark"] .ex-art img { filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.55)) drop-shadow(0 0 4px rgba(255, 255, 255, 0.12)); }


/* A single chosen path leads; track browsing is secondary on a phone. */
.path-panel { padding:20px; margin-bottom:18px; border:1px solid var(--border, #343444); border-radius:18px; }
.path-panel h2 { margin:8px 0; }
.path-panel p { line-height:1.55; }
.path-meta { font-size:.85rem; opacity:.8; }
.path-panel summary,.browse-tracks summary { cursor:pointer; padding:12px 0; font-weight:600; }
.path-options { display:grid; gap:10px; margin:10px 0; }
.path-option { display:grid; gap:6px; text-align:left; padding:16px; background:transparent; color:inherit; border:1px solid var(--border, #555); border-radius:12px; font:inherit; cursor:pointer; }
.path-option[aria-pressed="true"] { border:2px solid #5B8DEF; }
.path-option small { opacity:.75; }
.path-option:focus-visible,summary:focus-visible { outline:3px solid #5B8DEF; outline-offset:3px; }
.path-guidance { font-size:.9rem; margin-top:6px; }
.browse-tracks { margin-bottom:18px; }

/* Golf Studio additions */
.section-note { font-size: 12px; color: var(--text-3); margin: -4px 0 10px; }
.sources { font-size: 11px; color: var(--text-3); margin-top: 18px; line-height: 1.5; }
.sources a { color: var(--text-2); }
.sheet-why { margin: 10px 16px 0; font-size: 14px; color: var(--text-2); padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--golf) 10%, var(--surface-2)); }
.sheet-why strong { color: var(--golf); }

/* Guided timer: phase colors and the top row (voice + stop) */
.timer-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.timer-top .timer-label { flex: 1; }
.timer-top .icon-btn { width: 36px; height: 36px; font-size: 18px; background: var(--surface-2); }
.timer[data-kind="prep"] .timer-ring-fg { stroke: var(--band); }
.timer[data-kind="hold"] .timer-ring-fg { stroke: var(--ok); }
.timer[data-kind="rest"] .timer-ring-fg { stroke: var(--accent); }
.timer #timer-skip { min-width: 112px; }

/* ===== 12-week goals ===== */
.path-group { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-3); margin: 14px 0 8px; }
.goal-dose { margin-top: 10px; font-size: 14px; color: var(--text-2); }
.goal-dose .chip { margin-right: 6px; background: color-mix(in srgb, var(--t) 18%, transparent); color: var(--t); }
.goal-phases { display: flex; gap: 4px; margin-top: 12px; }
.goal-phases span { flex: 1; text-align: center; font-size: 11px; font-weight: 700; padding: 6px 4px; border-radius: 8px; background: var(--surface-2); color: var(--text-3); }
.goal-phases span.past { color: var(--text-2); background: color-mix(in srgb, var(--t) 10%, var(--surface-2)); }
.goal-phases span.on { background: var(--t); color: var(--on-track); }
.goal-test, .goal-done { margin-top: 12px; padding: 12px; border-radius: 12px; font-size: 14px; color: var(--text-2);
  background: color-mix(in srgb, var(--t) 10%, var(--surface-2)); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.goal-test strong, .goal-done strong { color: var(--text); }
.goal-phase-list { margin: 8px 0 8px 18px; display: flex; flex-direction: column; gap: 6px; }
.metric-how { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.metric-best .up { color: var(--ok); margin-left: 6px; }
.metric-best .down { color: var(--danger); margin-left: 6px; }
.more-metrics { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.more-metrics summary { font-size: 13px; font-weight: 700; color: var(--text-2); cursor: pointer; }
.more-metrics .metric:first-of-type { margin-top: 12px; }

/* ===== Step-by-step guide (exercise sheet) ===== */
.guide { margin: 0 0 4px; }
.guide-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 14px 16px 0; outline: none; /* same inset as .sheet-hero */
}
.guide-track::-webkit-scrollbar { display: none; }
.guide-step { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; }
.guide-img {
  display: flex; justify-content: center; padding: 14px 0 6px; color: var(--t); border-radius: var(--radius);
  background: color-mix(in srgb, var(--t) 9%, var(--surface-2));
}
.guide-img .ex-art { width: 240px; height: 240px; margin: -12px 0 -10px; }
.guide-img .ex-icon { width: 160px; height: 160px; }
.guide-text { padding: 14px 2px 4px; min-height: 152px; } /* 3 lines of text: the arrows stay in one place */
.guide-n { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--t); }
.guide-text h3 { font-size: 22px; font-weight: 800; margin-top: 2px; }
.guide-text p { font-size: 17px; line-height: 1.45; color: var(--text); margin-top: 4px; }
.guide-nav { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px; }
.guide-nav .icon-btn { width: 48px; height: 48px; font-size: 26px; background: var(--surface-2); }
.guide-dots { display: flex; gap: 8px; }
.guide-dots span { width: 9px; height: 9px; border-radius: 999px; background: var(--surface-3); transition: background 0.2s, transform 0.2s; }
.guide-dots span.on { background: var(--t); transform: scale(1.25); }
.guide-talk { margin: 8px 16px 0; width: calc(100% - 32px); min-height: 52px; font-size: 16px; }
.mistakes, .why { margin: 18px 16px 0; }
.mistakes h3, .why h3 { font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--t); margin-bottom: 8px; }
.mistakes ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.mistakes li { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.mistakes .fault { color: var(--text); font-weight: 700; }
.mistakes .fault span { color: var(--danger); font-weight: 800; margin-right: 4px; }
.mistakes .fix { color: var(--text-2); margin-top: 4px; }
.mistakes .fix span { color: var(--ok); font-weight: 800; margin-right: 4px; }
.why p { color: var(--text-2); }
.more-cues summary { font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--t); cursor: pointer; margin-bottom: 8px; }

/* ===== Library: routines ===== */
.lib-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; margin: 4px 0 12px; background: var(--surface); border-radius: 14px; }
.lib-tab { min-height: 44px; border-radius: 10px; font-weight: 800; font-size: 15px; color: var(--text-2); }
.lib-tab.on { background: var(--accent); color: var(--on-track); }
.routine-list { display: flex; flex-direction: column; gap: 10px; }
.routine-row { width: 100%; display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 12px; background: var(--surface); border-radius: var(--radius); text-align: left; }
.routine-row:active { transform: scale(0.99); }
.routine-icon { width: 64px; height: 64px; color: var(--t); border-radius: 12px; background: color-mix(in srgb, var(--t) 10%, var(--surface-2)); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.routine-icon .ex-art, .routine-icon .ex-icon { width: 64px; height: 64px; }
.routine-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.routine-name { font-weight: 800; font-size: 16px; }
.routine-desc { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.routine-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.tag-place { background: color-mix(in srgb, var(--t) 16%, var(--surface)); color: var(--t); }
.routine-hero { display: flex; justify-content: center; margin: 14px 16px 0; padding: 12px; border-radius: var(--radius); color: var(--t); background: color-mix(in srgb, var(--t) 9%, var(--surface-2)); }
.routine-hero .ex-art { width: 220px; height: 220px; margin: -10px 0; }
.routine-hero .ex-icon { width: 140px; height: 140px; }
.coach { margin: 14px 16px 0; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--t) 12%, var(--surface-2)); border-left: 4px solid var(--t); }
.coach strong { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--t); }
.coach p { margin-top: 4px; color: var(--text); }
.rblock { margin: 18px 16px 0; }
.rblock h3 { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--t); margin-bottom: 6px; }
.rblock h3 small { font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--text-3); font-weight: 600; }
.rblock ol { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rmove { width: 100%; display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--surface-2); text-align: left; }
.rmove-icon { width: 44px; height: 44px; color: var(--t); }
.rmove-icon .ex-art, .rmove-icon .ex-icon { width: 44px; height: 44px; }
.rmove-name { font-weight: 700; font-size: 15px; }
.rmove-target { font-weight: 800; font-size: 14px; color: var(--t); white-space: nowrap; }
.routine-start { margin: 20px 16px 0; width: calc(100% - 32px); min-height: 56px; font-size: 17px; }
/* Workout: block label and block headers in the move list */
.block-label { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
.ov-block { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--t); padding: 8px 4px 0; }

/* ===== Phase 4: Today redesign ===== */
.today-head { margin: 4px 0 2px; }
.today-date { display: block; font-size: 13px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; }
.today-hi { font-size: 30px; font-weight: 800; line-height: 1.15; margin-top: 4px; }
.section-head { font-size: 20px; font-weight: 800; margin: 26px 0 10px; }

/* Today card with a hero scene: title on a dark fade, readable in both themes. */
.today-card.has-hero { padding: 0 0 18px; overflow: hidden; background: var(--surface); }
.today-card.has-hero > :not(.today-hero) { margin-left: 18px; margin-right: 18px; }
.today-card.has-hero .btn-block { width: calc(100% - 36px); }
.today-hero { position: relative; aspect-ratio: 3 / 2; margin-bottom: 12px; }
.today-hero .hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.today-hero-text {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 14px;
  background: linear-gradient(to top, rgba(8, 10, 20, 0.88) 0%, rgba(8, 10, 20, 0.55) 55%, rgba(8, 10, 20, 0) 100%);
}
.today-hero-text .today-eyebrow { color: #C9D8FF; }
.today-hero-text .today-title { color: #FFFFFF; margin-bottom: 0; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35); }
.today-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.today-tags .tag { font-size: 12px; padding: 4px 10px; }
.today-card .btn-primary { min-height: 54px; font-size: 17px; margin-top: 14px; }

/* Where are you training? */
.place-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.place-tile {
  position: relative; overflow: hidden; aspect-ratio: 1 / 1.05; border-radius: 16px; text-align: left;
  background: var(--surface-2); border: 3px solid transparent;
}
.place-tile.on { border-color: var(--accent); }
.place-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.place-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 8px; display: flex; flex-direction: column;
  background: linear-gradient(to top, rgba(8, 10, 20, 0.9), rgba(8, 10, 20, 0));
}
.place-label strong { color: #FFFFFF; font-size: 15px; }
.place-label small { color: #D5DEF5; font-size: 10.5px; line-height: 1.25; }
.place-tile:not(.on) { filter: saturate(0.75); }
.time-row { margin: 10px 0 4px; }
.pick-row { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 2px 8px; scrollbar-width: none; }
.pick-row::-webkit-scrollbar { display: none; }
.pick-card {
  flex: 0 0 150px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 4px; text-align: left;
  padding: 10px; border-radius: 16px; background: var(--surface);
}
.pick-art { height: 110px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); overflow: hidden; }
.pick-art .ex-art, .pick-art .ex-icon { width: 110px; height: 110px; }
.pick-name { font-weight: 800; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pick-meta { font-size: 12px; color: var(--text-2); }
.link-more { display: block; margin: 6px 0 0 auto; padding: 8px 4px; font-weight: 700; color: var(--accent); }

/* Your plan: track tiles with their scenes */
.plan-section .path-panel { margin-bottom: 8px; }
.track-tile { grid-template-columns: 64px 1fr; min-height: 76px; }
.track-icon { width: 64px; height: 48px; border-radius: 10px; overflow: hidden; }
.track-hero { width: 64px; height: 48px; object-fit: cover; display: block; }

/* Sheet: a sticky bar holds the close button, so it never covers content. */
.sheet-bar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: center;
  height: 48px; background: var(--surface); border-radius: 22px 22px 0 0;
}
.sheet-grab { width: 40px; height: 5px; border-radius: 999px; background: var(--line-strong); }
.sheet-bar .sheet-close { position: absolute; right: 10px; top: 6px; float: none; margin: 0; }
.sheet-hero, .routine-hero, .guide-track { margin-top: 4px; }

/* ===== Premium polish (dark first) ===== */
:root:not([data-theme="light"]) body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(91, 141, 239, 0.16) 0%, rgba(7, 9, 16, 0) 60%),
    var(--bg);
  background-attachment: fixed;
}
:root:not([data-theme="light"]) .app-header { background: rgba(7, 9, 16, 0.82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.today-card, .pick-card, .routine-row, .program-row, .stat-line, .week-day:not(.rest), .ex-card, .path-panel, .next-card, .place-tile, .track-tile {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px rgba(0, 0, 0, 0.28);
}
[data-theme="light"] .today-card, [data-theme="light"] .pick-card, [data-theme="light"] .routine-row, [data-theme="light"] .program-row,
[data-theme="light"] .stat-line, [data-theme="light"] .ex-card, [data-theme="light"] .next-card {
  box-shadow: 0 6px 20px rgba(20, 30, 60, 0.08);
}
.btn-primary {
  background: linear-gradient(135deg, var(--t, var(--accent)) 0%, color-mix(in srgb, var(--t, var(--accent)) 70%, #FFFFFF) 140%);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--t, var(--accent)) 35%, transparent);
  font-weight: 800; letter-spacing: 0.2px;
}
.btn-primary:active { box-shadow: 0 3px 10px color-mix(in srgb, var(--t, var(--accent)) 30%, transparent); }
.today-hi { letter-spacing: -0.5px; }
.today-title { letter-spacing: -0.4px; }
.section-head { letter-spacing: -0.2px; }
/* Gentle entrance for Today's cards (not for people who prefer less motion). */
@media (prefers-reduced-motion: no-preference) {
  .today-card, .place-picker, .stat-line { animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .stat-line { animation-delay: 0.06s; }
  .place-picker { animation-delay: 0.12s; }
  .pick-card { animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .pick-card:nth-child(2) { animation-delay: 0.05s; } .pick-card:nth-child(3) { animation-delay: 0.1s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Bell picker: the bells you own, one tap each */
.bell-now { display: flex; align-items: baseline; gap: 6px; }
.bell-num { font-size: 56px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.bell-now small { font-size: 16px; font-weight: 700; color: var(--text-3); }
.bell-row { display: flex; gap: 8px; overflow-x: auto; max-width: 100%; padding: 2px 4px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.bell-row::-webkit-scrollbar { display: none; }
.bell { flex: 0 0 auto; min-width: 52px; height: 48px; border-radius: 14px; background: var(--surface-2); font-weight: 800; font-size: 17px; color: var(--text-2); scroll-snap-align: center; }
.bell.on { background: var(--t, var(--accent)); color: var(--on-track); box-shadow: 0 6px 16px color-mix(in srgb, var(--t, var(--accent)) 40%, transparent); }
.profile-nudge { margin: 2px 0 0; padding: 4px 0; font-size: 14px; }
.profile select, .profile input[type="text"] { min-height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); padding: 0 10px; font-size: 15px; max-width: 55%; }
.coach-today { margin: 12px 0 0; }
.today-card.has-hero .coach-today { margin: 12px 18px 0; }
.myplan-offer { width: 100%; margin-top: 12px; display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px 10px 10px; border-radius: 18px; text-align: left;
  background: linear-gradient(135deg, color-mix(in srgb, var(--golf) 22%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--golf) 45%, transparent); font-size: 22px; color: var(--golf); }
.myplan-img { width: 64px; height: 48px; border-radius: 10px; overflow: hidden; display: block; }
.myplan-text { display: flex; flex-direction: column; font-size: 13px; color: var(--text-2); }
.myplan-text strong { font-size: 16px; color: var(--text); }
.rsources { margin: 16px 16px 0; }
.swap-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 16px; }
.swap-row { grid-template-columns: 52px 1fr auto; padding: 10px 12px 10px 8px; }
.swap-row .rmove-icon, .swap-row .rmove-icon .ex-art { width: 52px; height: 52px; }
.swap-row .rmove-name small { display: block; font-size: 12px; font-weight: 600; color: var(--text-3); }
.now-range { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.why { font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.why-heavier, .why-more-reps { background: var(--ok-dim); color: var(--ok); }
/* Compact bell picker: the chosen bell is the big number (readable from 2 m). */
.bell-row { align-items: center; min-height: 64px; }
.bell.on { min-width: 92px; height: 60px; font-size: 32px; border-radius: 16px; }
.bell.on small { font-size: 13px; margin-left: 3px; font-weight: 700; }
.now { gap: 6px; }
.now-range { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; }
.bell-row { justify-content: center; overflow: visible; }
.bell { min-width: 50px; }
.ex-hero .ex-art { width: 156px; height: 156px; margin: -12px 0 -10px; }
.ex-head { padding-top: 8px; }
.ex-head .chips { margin-top: 4px; }
.now-range { gap: 8px; align-items: center; }
.why { padding: 3px 9px; }
.bell-other { min-width: 44px; font-size: 20px; color: var(--text-3); }

/* ─── Progress: this week, weekly work, records, charts ─────────────── */
.pg-hero { display: grid; grid-template-columns: 92px 1fr; gap: 6px 14px; align-items: center;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 16%, var(--surface)) 0%, var(--surface) 65%); }
.pg-ring-wrap { position: relative; width: 92px; height: 92px; }
.pg-ring { width: 100%; height: 100%; }
.pg-ring-bg { fill: none; stroke: color-mix(in srgb, var(--accent) 18%, var(--surface)); stroke-width: 9; }
.pg-ring-fg { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray 0.5s ease; }
.pg-ring-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--text-3); }
.pg-ring-num strong { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.pg-hero-text h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.pg-hero-text p { font-size: 16px; font-weight: 700; margin-top: 2px; }
.pg-hero-text .pg-hero-sub { font-size: 13px; font-weight: 500; color: var(--text-2); }
.pg-hero-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.pg-hero-stats div { background: color-mix(in srgb, var(--surface-2) 80%, transparent); border-radius: 12px; padding: 10px 4px; text-align: center; display: flex; flex-direction: column; }
.pg-hero-stats strong { font-size: 22px; font-weight: 800; }
.pg-hero-stats span { font-size: 11px; color: var(--text-3); }
.pg-hero-stats .ok strong { color: var(--ok); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-meta { font-size: 12px; color: var(--text-3); }
.seg { display: flex; gap: 4px; padding: 3px; margin: 10px 0 4px; border-radius: 12px; background: var(--surface-2); }
.seg-btn { flex: 1; min-height: 36px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--text-2); background: transparent; }
.seg-btn[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.chart { margin-top: 6px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.chart-readout { font-size: 14px; font-weight: 700; color: var(--text); min-height: 20px; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-base { stroke: var(--line-strong); stroke-width: 1; }
.ch-tick { fill: var(--text-3); font-size: 10px; font-family: inherit; }
.ch-bar { fill: var(--accent); opacity: 0.5; transition: opacity 0.15s; }
.ch-col.now .ch-bar, .ch-col.sel .ch-bar { opacity: 1; }
.chart:has(.ch-col.sel) .ch-col.now:not(.sel) .ch-bar { opacity: 0.5; }
.ch-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: var(--accent); opacity: 0.1; }
.ch-dot, .ch-hover { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.ch-cross { stroke: var(--line-strong); stroke-width: 1; opacity: 0; }
.ch-hover { opacity: 0; }
.chart.on .ch-cross, .chart.on .ch-hover { opacity: 1; }
.chart-table { margin-top: 8px; font-size: 12px; color: var(--text-3); }
.chart-table summary { cursor: pointer; padding: 4px 0; }
.chart-table table { width: 100%; border-collapse: collapse; margin-top: 6px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.pr-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.pr-row { width: 100%; display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--surface-2); text-align: left; }
.pr-row:active { background: var(--surface-3); }
.pr-art { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: var(--surface-3); color: var(--accent); display: block; }
.pr-art .ex-art, .pr-art svg { width: 100%; height: 100%; display: block; }
.pr-art img { width: 100%; height: 100%; object-fit: cover; }
.pr-info { min-width: 0; display: flex; flex-direction: column; }
.pr-info strong { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-info span { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-best { display: flex; flex-direction: column; align-items: flex-end; }
.pr-best strong { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pr-best em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--ok); }
.pr-info .pr-new { color: var(--ok); font-weight: 700; }
.metric .chart { margin: 8px 0 2px; }
.card-head .card-title { margin-bottom: 0; }
.history-more { margin-top: 8px; }
.history-more summary { padding: 10px 4px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.history-more .history { margin-top: 4px; }

/* ─── First-run setup ───────────────────────────────────────────────── */
body[data-view="welcome"] .bottom-nav, body[data-view="welcome"] .app-header { display: none; }
body[data-view="welcome"] { padding-bottom: 0; }
.ob { min-height: 100svh; display: flex; flex-direction: column; padding: calc(16px + var(--safe-t)) 0 8px; }
.ob-dots { display: flex; gap: 6px; margin-bottom: 22px; }
.ob-dots span { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.ob-dots span.on { background: var(--accent); }
.ob-hero { position: relative; margin: calc(-16px - var(--safe-t)) -16px 0; height: min(240px, 30svh); overflow: hidden; }
.ob-hero-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ob-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, var(--bg) 100%); }
.ob-logo { width: 72px; height: 72px; border-radius: 17px; margin-top: -44px; position: relative; z-index: 1; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.ob-title { font-size: 28px; line-height: 1.12; font-weight: 800; letter-spacing: -0.02em; margin: 12px 0 8px; }
.ob-lead { font-size: 16px; color: var(--text-2); }
.ob-sub { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin: 22px 0 10px; }
.ob-points { list-style: none; margin: 16px 0 4px; display: flex; flex-direction: column; gap: 10px; }
.ob-points li { display: flex; flex-direction: column; padding-left: 16px; border-left: 3px solid var(--accent); }
.ob-points strong { font-size: 15px; }
.ob-points span { font-size: 14px; color: var(--text-2); }
.ob-input { width: 100%; height: 54px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 18px; font-weight: 600; }
.ob-input:focus { outline: none; border-color: var(--accent); }
.ob-cards { display: flex; flex-direction: column; gap: 10px; }
.ob-card { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 14px; padding: 8px; border-radius: 16px; background: var(--surface); border: 2px solid transparent; text-align: left; }
.ob-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.ob-card-img { width: 84px; height: 60px; border-radius: 10px; overflow: hidden; display: block; background: var(--surface-2); }
.ob-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ob-card-text { display: flex; flex-direction: column; }
.ob-card-text strong { font-size: 16px; }
.ob-card-text small { font-size: 13px; color: var(--text-3); }
.ob .chip-row { flex-wrap: wrap; margin: 0; padding: 0; gap: 8px; }
.ob .filter-chip { padding: 12px 18px; font-size: 15px; }
.ob .hint { margin-top: 10px; }
.ob-nav { margin-top: auto; padding: 24px 0 calc(8px + var(--safe-b)); display: flex; gap: 10px; position: sticky; bottom: 0; z-index: 2; background: linear-gradient(180deg, transparent, var(--bg) 30%); }
.ob-nav .btn { flex: 1; min-height: 54px; font-size: 17px; }
.ob-nav .btn-ghost { flex: 0 0 96px; }
.ob { position: relative; }
.ob-skip { position: absolute; top: calc(12px + var(--safe-t)); right: 0; z-index: 3; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; color: #fff; background: rgba(7, 9, 16, 0.55); backdrop-filter: blur(8px); }
.ob-week { list-style: none; display: grid; grid-template-columns: 1fr; gap: 6px; margin: 18px 0 4px; }
.ob-week li { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); }
.ob-week li span { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; }
.ob-week li strong { font-size: 15px; }
.ob-week li small { font-size: 12px; color: var(--text-3); }
.ob-week li.train { border-left: 3px solid var(--accent); }
.ob-week li.rest { background: transparent; border: 1.5px dashed var(--line-strong); }
.ob-week li.rest strong { color: var(--text-3); font-weight: 600; }
.ob-install { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-strong); }
.ob-install img { border-radius: 12px; flex-shrink: 0; }
.ob-install div { display: flex; flex-direction: column; font-size: 13px; color: var(--text-2); }
.ob-install strong { font-size: 15px; color: var(--text); }
.ob-install svg { vertical-align: -3px; color: var(--accent); }

/* ─── Cast to a TV (/tv) and the phone held sideways ─────────────────── */
body[data-view="tv"] .app-header, body[data-view="tv"] .bottom-nav { display: none; }
body[data-view="tv"] { padding: 0; overflow: hidden; background: #05070C; cursor: none; }
body[data-view="tv"] main { max-width: none; padding: 0; margin: 0; }
.tv { /* always the dark palette (light theme tokens are dark-on-dark here) */
  --text: #EEEEF2; --text-2: #A0A0B2; --text-3: #8E8EA2; --line: rgba(255, 255, 255, 0.07); --line-strong: rgba(255, 255, 255, 0.14);
  --surface: #10131C; --surface-2: #181C28; --surface-3: #242A3A; --accent: #5B8DEF; --ok: #34D399; --ok-dim: rgba(52, 211, 153, 0.12);
  --six: #5B8DEF; --golf: #4FD1A1; --bands: #A78BFA; --beach: #F472B6; --on-track: #0A0A0F; color-scheme: dark;
  --tvp: clamp(16px, 3vw, 64px); position: relative; height: 100vh; height: 100svh; display: flex; flex-direction: column; color: var(--text);
  background: radial-gradient(120% 90% at 20% 30%, color-mix(in srgb, var(--t, var(--accent)) 16%, #05070C) 0%, #05070C 60%); }
.tv-top { display: grid; grid-template-columns: auto auto 1fr auto auto; align-items: center; gap: 2vw; padding: 2.2vh var(--tvp); font-size: clamp(14px, 1.7vw, 34px); color: var(--text-2); }
.tv-prog { font-weight: 800; color: var(--text); }
.tv-bar { height: 0.8vh; min-height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.tv-bar i { display: block; height: 100%; background: var(--t, var(--accent)); border-radius: 99px; transition: width 0.4s; }
.tv-clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.tv-main { flex: 1; display: grid; grid-template-columns: 1fr 1.1fr; align-items: center; gap: 3vw; padding: 0 var(--tvp); min-height: 0; }
.tv-art { height: 100%; max-height: 66vh; display: flex; align-items: center; justify-content: center; }
.tv-art .ex-art, .tv-art svg { width: auto; height: 100%; max-height: 66vh; aspect-ratio: 1; display: block; }
.tv-art img { width: 100%; height: 100%; object-fit: contain; }
.tv-info { display: flex; flex-direction: column; gap: 1.2vh; min-width: 0; }
.tv-block { align-self: flex-start; padding: 0.6vh 1.2vw; border-radius: 99px; font-size: clamp(12px, 1.5vw, 30px); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--t, var(--accent)); background: color-mix(in srgb, var(--t, var(--accent)) 16%, transparent); }
.tv-name { font-size: clamp(28px, 5.2vw, 110px); line-height: 1.02; font-weight: 800; letter-spacing: -0.02em; }
.tv-set { font-size: clamp(16px, 2.2vw, 46px); font-weight: 700; color: var(--text-2); }
.tv-amount { font-size: clamp(36px, 6.4vw, 150px); line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.tv-weight { align-self: flex-start; font-size: clamp(22px, 3.6vw, 76px); font-weight: 800; padding: 0.4vh 1.4vw; border-radius: 1.2vw; background: rgba(255, 255, 255, 0.08); }
.tv-cue { font-size: clamp(14px, 1.9vw, 40px); color: var(--text-2); max-width: 34ch; }
.tv-foot { padding: 1.6vh var(--tvp) 3vh; }
.tv-next { display: flex; align-items: center; gap: 1.6vw; padding: 1.2vh 1.4vw; border-radius: 1.4vw; background: rgba(255, 255, 255, 0.06); max-width: 60vw; }
.tv-next-art { width: clamp(48px, 7vh, 120px); height: clamp(48px, 7vh, 120px); flex-shrink: 0; border-radius: 0.8vw; overflow: hidden; background: rgba(255, 255, 255, 0.06); color: var(--t, var(--accent)); display: block; }
.tv-next-art .ex-art, .tv-next-art svg, .tv-next-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tv-next-info { display: flex; flex-direction: column; font-size: clamp(13px, 1.6vw, 34px); color: var(--text-2); }
.tv-next-info strong { font-size: clamp(16px, 2.2vw, 46px); color: var(--text); }
.tv-next-label { font-size: 0.8em; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--t, var(--accent)); }
.tv-next-weight.changed { color: #FBBF24; font-weight: 800; }
.tv-next.big { flex-direction: column; align-items: flex-start; max-width: none; padding: 2.4vh 2vw; }
.tv-next.big .tv-next-art { width: 34vh; height: 34vh; }
.tv-rest { grid-template-columns: 1fr 1fr; }
.tv-rest-clock { display: flex; flex-direction: column; align-items: center; gap: 2vh; }
.tv-rest-label { font-size: clamp(20px, 3vw, 64px); font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.tv-ring { position: relative; width: min(56vh, 40vw); aspect-ratio: 1; }
.tv-ring.hold { width: min(46vh, 34vw); }
.tv-ring svg { width: 100%; height: 100%; }
.tv-ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 8; }
.tv-ring-fg { fill: none; stroke: var(--t, var(--accent)); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.tv-ring-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: min(18vh, 13vw); font-weight: 800; font-variant-numeric: tabular-nums; }
.tv-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2vh; padding: var(--tvp); }
.tv-logo { width: clamp(72px, 12vh, 160px); height: auto; border-radius: 22%; box-shadow: 0 2vh 6vh rgba(0, 0, 0, 0.5); }
.tv-title { font-size: clamp(28px, 4.6vw, 100px); font-weight: 800; letter-spacing: -0.02em; }
.tv-lead { font-size: clamp(16px, 2.2vw, 46px); color: var(--text-2); max-width: 60ch; }
.tv-code { display: flex; gap: 1.4vw; margin-top: 2vh; }
.tv-code span { width: clamp(56px, 9vw, 200px); aspect-ratio: 0.8; display: flex; align-items: center; justify-content: center; border-radius: 1.4vw;
  font-size: clamp(40px, 7vw, 160px); font-weight: 800; background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(255, 255, 255, 0.14); }
.tv-small { font-size: clamp(12px, 1.4vw, 30px); color: var(--text-3); margin-top: 3vh; }
.tv-burst { width: clamp(64px, 12vh, 180px); aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: clamp(36px, 7vh, 110px); font-weight: 800; background: var(--ok); color: #05070C; }
.tv-stats { display: flex; gap: 3vw; margin-top: 2vh; }
.tv-stats div { display: flex; flex-direction: column; }
.tv-stats strong { font-size: clamp(28px, 5vw, 110px); font-weight: 800; }
.tv-stats span { font-size: clamp(14px, 1.8vw, 38px); color: var(--text-3); }
.tv-offline { position: fixed; right: 2vw; bottom: 2vh; padding: 1vh 1.4vw; border-radius: 99px; font-size: clamp(12px, 1.4vw, 28px); background: rgba(248, 113, 113, 0.16); color: #FCA5A5; }

/* Phone: pairing sheet and the TV button */
.cast-btn { color: var(--text-3); }
.cast-btn.on { color: var(--ok); }
.cast-steps { margin: 8px 0 12px 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.cast-steps strong { color: var(--text); }
.cast-form { display: flex; gap: 8px; }
.cast-input { flex: 1; min-width: 0; height: 56px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font-size: 28px; font-weight: 800; letter-spacing: 0.3em; text-align: center; text-transform: uppercase; }
.cast-input:focus { outline: none; border-color: var(--accent); }
.cast-form .btn { min-height: 56px; }
.cast-help { margin-top: 12px; font-size: 14px; color: var(--text-2); }
.cast-help summary { cursor: pointer; font-weight: 700; color: var(--text); padding: 6px 0; }
.cast-status { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; background: var(--surface-2); margin: 10px 0; }
.cast-status div { display: flex; flex-direction: column; }
.cast-status span { font-size: 13px; color: var(--text-3); }
.cast-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.cast-status.on .cast-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-dim); }

/* Phone held sideways during a workout: the TV layout, for AirPlay mirroring. */
.tv-local { display: none; }
@media (orientation: landscape) and (max-height: 540px) {
  body[data-view="workout"] .player > :not(.tv-local) { display: none !important; }
  body[data-view="workout"] { padding: 0 !important; }
  body[data-view="workout"] main { max-width: none; padding: 0; }
  .tv-local { display: block; }
  .tv-local .tv { height: 100vh; height: 100svh; padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .tv-local .tv-done { align-self: flex-start; min-height: 50px; padding: 0 28px; font-size: 18px; margin-top: 4px; }
  .tv-local .tv-top { padding: 8px 16px; font-size: 13px; gap: 12px; }
  .tv-local .tv-main { gap: 16px; padding: 0 16px; }
  .tv-local .tv-art, .tv-local .tv-art .ex-art { max-height: 62vh; }
  .tv-local .tv-info { gap: 4px; }
  .tv-local .tv-name { font-size: 30px; }
  .tv-local .tv-set { font-size: 15px; }
  .tv-local .tv-amount { font-size: 44px; }
  .tv-local .tv-weight { font-size: 22px; }
  .tv-local .tv-cue, .tv-local .tv-block { display: none; }
  .tv-local .tv-foot { padding: 0 16px 8px; }
  .tv-local .tv-next { padding: 6px 10px; }
  .tv-local .tv-next-art { width: 40px; height: 40px; }
  .tv-local .tv-next-info { font-size: 12px; } .tv-local .tv-next-info strong { font-size: 15px; }
}
.tv-next.big .tv-next-info { font-size: clamp(16px, 2.2vw, 46px); }
.tv-next.big .tv-next-info strong { font-size: clamp(24px, 3.6vw, 76px); }
/* Today: Show on TV */
.tv-row { width: 100%; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); text-align: left; color: var(--text-3); }
.tv-row-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.tv-row-text { display: flex; flex-direction: column; }
.tv-row-text strong { font-size: 15px; color: var(--text); }
.tv-row-text span { font-size: 13px; color: var(--text-3); }
.tv-row.on .tv-row-icon { background: var(--ok-dim); color: var(--ok); }
/* Setup v2: gear, building, start */
.ob-gear { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ob-gear-item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; border-radius: 14px; background: var(--surface); border: 2px solid transparent; font-size: 15px; font-weight: 700; text-align: left; }
.ob-gear-item.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.ob-check { width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 2px solid var(--line-strong); font-size: 14px; color: var(--on-track); }
.ob-gear-item.on .ob-check { background: var(--accent); border-color: var(--accent); }
.ob-building { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 8px; }
.ob-building ol { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; font-size: 17px; color: var(--text-2); }
.ob-building li { opacity: 0; animation: ob-in 0.4s ease forwards; }
.ob-building li::before { content: '\2713'; color: var(--ok); font-weight: 800; margin-right: 10px; }
@keyframes ob-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ob-spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--accent); animation: ob-spin 0.9s linear infinite; }
@keyframes ob-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ob-building li { animation: none; opacity: 1; } .ob-spinner { animation: none; } }
.ob-week li.today { box-shadow: inset 0 0 0 2px var(--accent); }
.ob-nav-col { flex-direction: column; align-items: stretch; }
.ob-nav-col .btn { flex: none; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 64px; }
.ob-nav-col .btn small { font-size: 12px; font-weight: 600; opacity: 0.8; }
.ob-nav-col .link-more { align-self: center; }
.summary-tip { margin: 16px 0; text-align: left; }
.summary-tip .link-more { align-self: flex-start; padding: 6px 0 0; }
/* Tap targets: at least 44 px tall (Apple HIG), found by the full-site QA run */
.brand { min-height: 44px; display: inline-flex; align-items: center; }
.link-more, .profile-nudge { min-height: 44px; display: flex; align-items: center; }
.sources a { display: inline-block; padding: 12px 2px; }
.path-guidance > a { display: inline-block; padding: 12px 0; }
/* Care mode */
.care-note { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(251, 191, 36, 0.10); border: 1px solid rgba(251, 191, 36, 0.35); font-size: 14px; color: var(--text); display: flex; flex-direction: column; gap: 6px; text-align: left; }
.care-note strong { color: #FBBF24; }
[data-theme="light"] .care-note strong { color: #92400E; }
.care-swap { align-self: flex-start; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--surface-2); font-weight: 700; font-size: 14px; }
.care-card { margin-top: 14px; }
.care-head { display: flex; justify-content: space-between; align-items: center; }
.care-head .link-more { margin: 0; }
.care-row { width: 100%; display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; margin-top: 8px; padding: 10px 12px; border-radius: 14px; background: var(--surface); text-align: left; color: var(--text-3); }
.care-art { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: var(--surface-2); display: block; color: var(--accent); }
.care-art .ex-art, .care-art svg, .care-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.care-text { display: flex; flex-direction: column; } .care-text strong { color: var(--text); font-size: 15px; } .care-text span { font-size: 13px; }
.care-info ul { margin: 8px 0 14px 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.care-info h3 { font-size: 15px; margin-top: 6px; }
.care-flags li::marker { color: var(--danger); }
.switch { width: 24px; height: 24px; accent-color: var(--accent); }
