:root {
  color-scheme: light dark;
  --paper: #f6f4ee; --surface: #ffffff; --surface-2: #ece9df; --ink: #14201b; --ink-2: #4b5a53; --ink-3: #6d7b74;
  --line: #dcd8cb; --brand: #0f3d2e; --brand-ink: #ffffff; --accent: #0e7a55; --gold: #a86a00; --gold-soft: #fbeed3;
  --red: #c4262e; --red-soft: #fde4e4; --orange: #b85400; --good-soft: #dcf2e6; --zone: #0c2b21; --zone-ink: #f2f6f3;
  --radius: 16px; --shadow: 0 1px 2px rgb(20 32 27 / .07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1512; --surface: #18211d; --surface-2: #222d28; --ink: #eef3f0; --ink-2: #b4c0ba; --ink-3: #8f9c96;
    --line: #2e3a35; --brand: #3fc592; --brand-ink: #06221a; --accent: #46cf9b; --gold: #f2b84b; --gold-soft: #3a2d12;
    --red: #ff7b7f; --red-soft: #431c1f; --orange: #f5a35b; --good-soft: #15352a; --zone: #07130f; --shadow: none;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1 { font-size: 1.85rem; line-height: 1.15; margin: 0 0 .4rem; letter-spacing: -.02em; outline: none; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 .6rem; }
.card h2 { margin-top: 0; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
small { display: block; color: var(--ink-2); font-size: .85rem; line-height: 1.35; }
.small { font-size: .9rem; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.fine { font-size: .8rem; color: var(--ink-3); }
.center { text-align: center; }
.good { color: var(--accent); }
.grow { flex: 1; min-width: 0; }
.lead { color: var(--ink-2); }
.eyebrow { text-transform: uppercase; letter-spacing: .09em; font-size: .72rem; font-weight: 700; color: var(--gold); margin-bottom: .25rem; display: block; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.icon { width: 22px; height: 22px; flex: none; }

.page { max-width: 560px; margin: 0 auto; padding: max(1.25rem, env(safe-area-inset-top)) 16px calc(92px + env(safe-area-inset-bottom)); }
.tabs {
  position: fixed; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5;
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 2px 8px; font-size: .68rem; font-weight: 600; color: var(--ink-3); text-decoration: none; }
.tabs a.active { color: var(--accent); }

.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.card.quiet { background: var(--surface-2); border: 0; box-shadow: none; }
.card.warn { border-color: var(--orange); }
.card ul { margin: 0; padding-left: 1.1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; min-height: 50px; padding: .7rem 1rem; margin-bottom: .6rem;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .08s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.big { min-height: 60px; font-size: 1.05rem; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; }
.hero h1 { margin: 0; }
.streak { display: grid; grid-template-columns: auto auto; column-gap: 3px; align-items: center; color: var(--gold); }
.streak strong { font-size: 1.4rem; line-height: 1; color: var(--ink); }
.streak span { grid-column: 1 / -1; text-align: center; font-size: .68rem; color: var(--ink-3); }

.workout, .drills, .badges, .log-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.workout { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.workout li + li { border-top: 1px solid var(--line); }
.workout a { display: flex; gap: .8rem; align-items: center; padding: .9rem 1rem; color: inherit; text-decoration: none; min-height: 70px; }
.workout .icon:last-child, .score-link > .icon:last-child, .drills .icon { color: var(--ink-3); width: 18px; }
.workout .done strong { color: var(--ink-2); }
.tick { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--line); color: var(--brand-ink); }
.done .tick, .earned .tick { background: var(--accent); border-color: var(--accent); }
.tick .icon { width: 16px; height: 16px; stroke-width: 3; }
.score-link, .drills .card { display: flex; gap: .9rem; align-items: center; }
.badge-score { font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.ring { position: relative; width: var(--ring-size); height: var(--ring-size); flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring .track { stroke: var(--surface-2); }
.ring .fill { stroke: var(--accent); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: calc(var(--ring-size) * .3); font-variant-numeric: tabular-nums; }

.pullquote { border-left: 3px solid var(--gold); padding-left: .8rem; font-weight: 600; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 0 0 1rem; border: 0; border-radius: 14px; background: var(--surface-2); }
.segmented button { min-height: 44px; border: 0; border-radius: 11px; background: none; color: var(--ink-2); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.segmented .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.zone {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem;
  padding: max(24px, env(safe-area-inset-top)) 24px 24px; background: var(--zone); color: var(--zone-ink); text-align: center; transition: background .25s;
}
.zone.caught { background: #4a2a10; }
.zone .prompt { font-size: 1.3rem; line-height: 1.3; font-weight: 600; max-width: 460px; margin: 0; }
.zone .small { color: #b5c5bd; }
.cue { font-size: 1.05rem; color: #f2c66d; font-weight: 600; min-height: 3em; margin: 0; }
.countdown { position: relative; width: min(58vw, 240px); aspect-ratio: 1; }
.countdown svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown circle { fill: none; stroke-width: 5; }
.countdown .track { stroke: rgb(255 255 255 / .12); }
.countdown .fill { stroke: #54d6a4; stroke-linecap: round; transition: stroke-dasharray .1s linear; }
.countdown span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; font-weight: 300; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .countdown .fill, .zone { transition: none; } }

.prompt.solid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; font-weight: 600; font-size: 1.05rem; line-height: 1.35; }
.unlocked { color: var(--accent); font-weight: 700; }
.focus { display: inline-block; padding: .15rem .6rem; border-radius: 99px; background: var(--gold-soft); color: var(--gold); font-size: .8rem; font-weight: 700; margin-bottom: .6rem; }
.script { font-size: 1.35rem; line-height: 1.35; font-weight: 600; }
.rep-bar { display: flex; align-items: center; gap: .6rem; margin: .5rem 0 .9rem; }
.meter { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--ink-3); border-radius: 99px; transition: width .1s; }
.meter span.on { background: var(--accent); }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 2.5em; text-align: right; }
.pace { padding: .2rem .6rem; border-radius: 99px; font-size: .8rem; font-weight: 800; background: var(--surface-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pace.good { background: var(--good-soft); color: var(--accent); }
.pace.rush { background: var(--gold-soft); color: var(--orange); }
.live { min-height: 7.5rem; max-height: 40vh; overflow-y: auto; font-size: 1.15rem; line-height: 1.55; overflow-wrap: anywhere; }
.filler { color: var(--red); background: var(--red-soft); font-weight: 700; border-radius: 5px; padding: 0 3px; }
.hedge { color: var(--red); text-decoration: line-through; }
.better { display: inline-block; margin-left: 4px; font-size: .78rem; font-weight: 800; color: var(--accent); }
.prompter { list-style: none; margin: 0 0 1rem; padding: 0; }
.prompter li { padding: .7rem .8rem; margin-bottom: .5rem; border-left: 4px solid var(--line); font-size: 1.1rem; font-weight: 600; line-height: 1.3; }
.prompter small { margin-top: .2rem; font-weight: 700; }
.prompter .now { border-color: var(--accent); background: var(--good-soft); border-radius: 0 10px 10px 0; }
.prompter .past { color: var(--ink-3); }

.result { padding-top: .5rem; }
.score-row { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.headline { font-size: 1.25rem; line-height: 1.25; font-weight: 700; margin: 0; }
.fix { background: var(--gold-soft); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .6rem; }
.fix p { margin: 0; font-weight: 600; }
.fix.next { background: var(--good-soft); }
.fix.next .eyebrow { color: var(--accent); }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: .5rem; margin: 1rem 0; }
.chips div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .7rem; }
.chips dt { font-size: .74rem; color: var(--ink-2); }
.chips dd { margin: 0; font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
details { margin-bottom: 1rem; }
summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.actions { margin-top: 1rem; }

.log-form label { display: block; margin-bottom: 1rem; font-weight: 600; font-size: .95rem; }
.log-form select, .log-form input[type=text] { display: block; width: 100%; min-height: 48px; margin-top: .3rem; padding: .5rem .7rem; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; }
.log-form input[type=range] { display: block; width: 100%; height: 36px; accent-color: var(--accent); }
.toggle { display: flex !important; gap: .6rem; align-items: center; min-height: 44px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.log-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; margin-bottom: .5rem; }
.log-list li > div { display: flex; justify-content: space-between; align-items: baseline; }
.log-list p { margin: .3rem 0 0; }

.authority { display: flex; gap: 1.1rem; align-items: center; }
.authority dl { flex: 1; margin: 0; min-width: 0; }
.authority dl div { display: flex; justify-content: space-between; gap: .5rem; padding: .22rem 0; font-size: .88rem; }
.authority dt { color: var(--ink-2); }
.authority dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.charts { display: grid; gap: .75rem; margin-bottom: .75rem; }
.trend { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }
.trend figcaption { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 600; }
.trend-note { font-size: .74rem; color: var(--ink-3); text-align: right; margin: 0; }
.trend svg { width: 100%; display: block; }
.trend .grid { stroke: var(--line); stroke-width: 1; }
.trend .axis { fill: var(--ink-3); font-size: 9px; }
.trend .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.trend .hit { fill: transparent; cursor: pointer; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: .5rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .3rem .2rem; border-bottom: 1px solid var(--line); }
.badges { display: grid; gap: .5rem; }
.badges li { display: flex; gap: .7rem; align-items: center; opacity: .62; }
.badges li.earned { opacity: 1; }

.welcome { max-width: 560px; margin: 0 auto; padding: max(2rem, env(safe-area-inset-top)) 16px 2rem; }
.welcome h1 { font-size: 2.2rem; }
.pillars { list-style: none; padding: 0; margin: 1rem 0; }
.pillars li { padding: .5rem 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .95rem; }
.pillars strong { display: block; color: var(--ink); }

.boot { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem; padding: 24px; background: #0f3d2e; color: #fff; text-align: center; }
.boot-mark { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.boot-bar { width: 200px; height: 6px; border-radius: 99px; background: rgb(255 255 255 / .18); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: var(--blazor-load-percentage, 4%); background: #f2c66d; transition: width .2s; }
.boot p { font-size: .85rem; color: #bcd0c6; margin: 0; }
#blazor-error-ui { position: fixed; inset: auto 0 0 0; z-index: 20; padding: .8rem 1rem; background: var(--gold-soft); color: var(--ink); }
#blazor-error-ui[hidden] { display: none; }

.btn.share { width: auto; min-height: 44px; margin: 0; padding: .3rem .7rem; flex: none; }
.log-form form { margin-top: .75rem; }
.log-form input::placeholder { color: var(--ink-3); }
