:root {
  --bg: #FBF7F2; --surface: #FFFFFF; --text: #1F1B16; --muted: #6B6259; --line: #E8DFD3;
  --accent: #B3261E; --accent-ink: #FFFFFF; --gold: #F4C430; --ok: #2E7D32; --bad: #C62828; --soft: #F5EDE3;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16130F; --surface: #221E19; --text: #F2ECE4; --muted: #A99F93; --line: #3A332B;
    --accent: #E5584F; --accent-ink: #16130F; --gold: #E8B923; --ok: #66BB6A; --bad: #EF5350; --soft: #2C2620; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--accent); }
.brand span { color: var(--muted); font-weight: 500; font-size: .85rem; }
.gear { text-decoration: none; font-size: 1.3rem; color: var(--muted); }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px; }
nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav a { flex: 1; text-align: center; padding: 8px 0 6px; text-decoration: none; color: var(--muted); font-size: 1.15rem; }
nav a span { display: block; font-size: .7rem; }
nav a.active { color: var(--accent); }
body.nologin nav, body.nologin .gear { display: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card.link { display: block; text-decoration: none; color: inherit; }
.card h2 { margin: 0 0 8px; font-size: 1.3rem; } .card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.hero { border-left: 5px solid var(--accent); }
.block.done { opacity: .75; } .block.done h3::after { content: " ✓"; color: var(--ok); }
.block-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.status { font-size: .8rem; color: var(--muted); text-align: right; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.bad { color: var(--bad); } .hidden { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--soft); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; margin: 8px 0; }
.btn.small { min-height: 32px; padding: 4px 10px; }
.btn:disabled { opacity: .5; }
.btn.rec { background: var(--bad); color: #fff; border-color: var(--bad); animation: pulse 1.2s infinite; }
.btn.mic { min-height: 64px; font-size: 1.15rem; }
@keyframes pulse { 50% { opacity: .75; } }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

.uk { font-size: 1.1rem; } .big { font-size: 1.45rem; font-weight: 700; margin: 6px 0; } .huge { font-size: 2.2rem; font-weight: 800; margin: 18px 0; }
.es { color: var(--accent); }
.note { background: var(--soft); border-radius: 10px; padding: 8px 10px; font-size: .92rem; }
.heard { font-style: italic; color: var(--muted); }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--gold); color: #3A2A00; padding: 2px 8px; border-radius: 999px; margin-bottom: 6px; }
.badge.warn { background: var(--accent); color: var(--accent-ink); }
.ok { color: var(--ok); font-weight: 700; } span.bad { text-decoration: underline wavy; font-weight: 700; }
.drill-head { display: flex; justify-content: space-between; font-size: .9rem; color: var(--muted); }
.grades { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0; }
.grade { flex-direction: column; min-height: 58px; } .grade small { font-weight: 400; font-size: .72rem; color: var(--muted); }
.grade.sugg { outline: 3px solid var(--gold); }

input, select, textarea { width: 100%; font: inherit; padding: 10px 12px; margin: 6px 0; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); }
input[type=radio] { width: auto; margin: 0 4px 0 0; } input[type=range] { padding: 0; }
label { display: block; margin: 8px 0; }
pre.opener { white-space: pre-wrap; font: inherit; font-size: .9rem; background: var(--soft); padding: 10px; border-radius: 10px; }
.steps li { margin: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chip { border: 1px solid var(--line); background: var(--soft); color: var(--accent);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 600; }
details { border-top: 1px solid var(--line); padding: 8px 0; } summary { font-weight: 700; cursor: pointer; }
.choice { flex: 1; font-size: 1.3rem; min-height: 64px; } .choice.right { background: var(--ok); color: #fff; } .choice.wrong { opacity: .5; }
.metrics { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9rem; }
.run { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.cando { border-top: 1px solid var(--line); padding: 6px 0; } .cando p { margin: 4px 0; }
.scale { display: flex; justify-content: space-between; } .scale label { margin: 0; display: flex; align-items: center; }
.read { font-size: 1.15rem; line-height: 1.6; }
.parts li { margin: 6px 0; } .parts li.done a { color: var(--ok); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin: 8px 0 12px; }
.kpis b { display: block; font-size: 1.35rem; } .kpis span { font-size: .72rem; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 80px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; background: var(--soft); border-radius: 3px; }
.bar i { display: block; width: 100%; background: var(--accent); border-radius: 3px; }
.bar.today { outline: 2px solid var(--gold); }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; } .tbl td, .tbl th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.mine { list-style: none; padding: 0; } .mine li { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: 90vw; }
