:root {
  --bg: #f4f6f9; --card: #ffffff; --ink: #18202b; --muted: #667181; --line: #e2e7ee;
  --accent: #1f5f8b; --accent-2: #2f7fa8; --accent-soft: #e6f0f8; --warm: #c4572f; --warm-soft: #fbeee8;
  --good: #2f7a4f; --bad: #b5462a; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.05);
  --r: 18px; --tabh: 64px; --on-accent: #fff;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1319; --card: #171e27; --ink: #e8edf3; --muted: #93a0b0; --line: #253040;
    --accent: #5aa7d8; --accent-2: #3d8cc0; --accent-soft: #15283a; --warm: #e98a62; --warm-soft: #2e1d16;
    --good: #5cc48a; --bad: #f08a6c; --shadow: none; --on-accent: #07131d; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "DM Sans", sans-serif; min-height: 100dvh; overscroll-behavior-y: none; }
a { color: var(--accent); text-decoration: none; }
h2 { margin: 0; font-size: 22px; line-height: 1.2; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; justify-content: center; }
.good { color: var(--good); } .bad { color: var(--bad); }

/* header + tabs */
header.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  padding: calc(env(safe-area-inset-top) + 10px) 18px 10px; display: flex; align-items: center; gap: 8px; }
header.top h1 { font-size: 19px; margin: 0; font-weight: 750; letter-spacing: -.01em; }
#back { border: 0; background: none; font-size: 26px; color: var(--accent); padding: 0 6px 0 0; line-height: 1; cursor: pointer; }
main { padding: 4px 16px calc(var(--tabh) + env(safe-area-inset-bottom) + 24px); max-width: 640px; margin: 0 auto; }
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); height: calc(var(--tabh) + env(safe-area-inset-bottom)); }
nav.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
nav.tabs a span { font-size: 22px; filter: grayscale(1); opacity: .7; }
nav.tabs a.on { color: var(--accent); } nav.tabs a.on span { filter: none; opacity: 1; }
body[data-view="session"] nav.tabs { display: none; }
body[data-view="session"] main { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }

/* cards */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); border: 1px solid var(--line); display: block; color: inherit; }
.card.soft { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.card.action { display: flex; gap: 14px; align-items: center; }
.card.action .ic, .tile .ic { font-size: 28px; }
.card.action p { margin: 2px 0 0; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--warm); margin-bottom: 4px; }
.eyebrow.light { color: rgba(255,255,255,.8); }
.hello { font-size: 15px; color: var(--muted); margin: 4px 2px 0; }
.hero { background: linear-gradient(140deg, #173f5f, #1f5f8b 55%, #2f7fa8); color: #fff; border: 0; }
.hero h2 { color: #fff; margin-bottom: 12px; }
.streak { text-align: center; background: rgba(255,255,255,.14); border-radius: 14px; padding: 6px 12px; }
.streak b { display: block; font-size: 26px; line-height: 1.1; } .streak span { font-size: 12px; opacity: .9; }
.weekdots { display: flex; justify-content: space-between; margin: 4px 0 16px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; opacity: .85; }
.wd i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); }
.wd.on i { background: #fff; border-color: #fff; }
.wd.on i::after { content: "✓"; color: var(--accent); display: flex; justify-content: center; align-items: center; height: 100%; font-size: 14px; font-weight: 800; }
.wd.today span { font-weight: 800; opacity: 1; text-decoration: underline; }
.row { display: flex; align-items: center; } .row.between { justify-content: space-between; align-items: flex-start; } .gap { gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; }
.link { display: inline-block; margin-top: 8px; font-weight: 600; }
.kbd { border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }

/* buttons */
.btn { appearance: none; border: 0; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; border-radius: 14px; padding: 13px 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-align: center; min-height: 48px; }
.btn:active { transform: scale(.98); }
.btn.wide { width: 100%; margin: 6px 0; }
.btn.small { padding: 8px 14px; min-height: 38px; font-size: 14px; border-radius: 12px; }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--line); }
.btn.light { background: #fff; color: #173f5f !important; }
.btn.ghost-light { background: rgba(255,255,255,.14); color: #fff; }
.btn.rec { background: var(--warm); color: #fff; }
.btn.stop, .btn.ghost-light, .btn.light { color: #fff; }
.btn.stop { background: #b42318; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: .35; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.chip { border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 600; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.round { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-size: 22px; font-weight: 700; }
.round.big { width: 64px; height: 64px; background: var(--warm); color: #fff; border: 0; font-size: 30px; }

/* tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; color: var(--ink); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px; }
.tile b { font-size: 15.5px; } .tile span { font-size: 13px; color: var(--muted); line-height: 1.3; }

/* session */
.progress { display: flex; gap: 5px; margin: 4px 0 14px; }
.progress i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.progress i.done { background: var(--accent); } .progress i.on { background: var(--warm); }
.stephead { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.stepicon { font-size: 30px; width: 54px; height: 54px; border-radius: 16px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.intro { font-size: 17px; margin: 6px 0 10px; }
ul.steps { padding-left: 20px; margin: 0 0 8px; } ul.steps li { margin-bottom: 7px; }
.timerwrap { margin: 8px 0; }
.navbar { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 0 calc(env(safe-area-inset-bottom) + 6px); background: linear-gradient(transparent, var(--bg) 30%); margin-top: 10px; }
.ring { position: relative; width: 150px; height: 150px; margin: 0 auto 8px; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--line); } .ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-text b { font-size: 34px; font-variant-numeric: tabular-nums; } .ring-text span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.celebrate { text-align: center; padding-top: 30px; } .celebrate .big { font-size: 72px; }
.streakline { font-size: 20px; margin: 8px 0 12px; }

/* tools */
.tool { margin-top: 6px; }
.topic { font-size: 22px; font-weight: 750; line-height: 1.25; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 16px; margin: 6px 0 12px; text-align: center; box-shadow: var(--shadow); }
.topic.small { font-size: 16px; padding: 12px; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; font-weight: 600; }
.think { text-align: center; margin: 18px 0; } .think b { display: block; font-size: 88px; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.think span { color: var(--muted); }
.preview { width: 100%; max-height: 42vh; object-fit: cover; border-radius: var(--r); background: #000; transform: scaleX(-1); margin-bottom: 8px; }
.talkclock { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0 10px; }
.talkclock b { font-size: 56px; font-variant-numeric: tabular-nums; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #e5372b; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.bar { position: relative; height: 14px; background: var(--line); border-radius: 8px; overflow: hidden; margin: 6px 0; }
.bar .zone { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--good) 35%, transparent); }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); opacity: .85; border-radius: 8px; }
.live { min-height: 40px; font-style: italic; text-align: center; margin: 6px 0; }
.stats { display: flex; gap: 10px; margin: 8px 0; }
.stats div { flex: 1; background: var(--accent-soft); border-radius: 14px; padding: 10px; text-align: center; }
.stats b { display: block; font-size: 24px; } .stats span { font-size: 12px; color: var(--muted); }
.player { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin: 10px 0; }
.player audio, .player video { width: 100%; border-radius: 12px; }
.player video { max-height: 50vh; background: #000; }
.counter { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.counter-label { font-size: 14px; font-weight: 600; } .counter-label .muted { font-weight: 400; font-size: 12.5px; }
.counter-ctl { display: flex; align-items: center; gap: 12px; } .counter-ctl b { font-size: 26px; min-width: 30px; text-align: center; }
.player .row { justify-content: space-between; }
.bigbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 190px; height: 190px; border-radius: 50%; border: 0; margin: 16px auto;
  background: var(--accent); color: #fff; font: inherit; font-size: 22px; font-weight: 800; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent); touch-action: manipulation; user-select: none; }
.bigbtn span { font-size: 36px; font-variant-numeric: tabular-nums; }
.bigbtn.stop { background: #b42318; }
.bigbtn:active { transform: scale(.97); }
.twister { font-size: 19px; font-weight: 650; margin: 6px 0 10px; }
.result { font-size: 52px; font-weight: 800; text-align: center; margin: 10px 0; line-height: 1; } .result span { display: block; font-size: 15px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.passage { font-family: Georgia, "Noto Serif", serif; font-size: 19px; line-height: 1.9; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.passage u { text-decoration-color: var(--warm); text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 700; }
.p1 { color: var(--accent); font-weight: 800; font-family: system-ui, sans-serif; } .p2 { color: var(--warm); font-weight: 800; font-family: system-ui, sans-serif; }
.passage.plain { font-size: 18px; line-height: 1.8; }
.passage.plain span { border-radius: 4px; padding: 1px 0; }
.sticky-clock { position: sticky; top: calc(env(safe-area-inset-top) + 52px); z-index: 5; background: var(--accent); color: #fff; border-radius: 14px; padding: 10px 14px; text-align: center; margin-bottom: 10px; font-weight: 600; }
.sticky-clock b { font-size: 22px; } .sticky-clock.tapnow { background: var(--warm); }
.recbar { margin: 12px 0 4px; } .recbar .btn { width: 100%; }
details summary { cursor: pointer; font-weight: 600; }

/* forms */
.field { display: block; font-weight: 650; font-size: 14.5px; margin: 10px 0; }
.field input, .field textarea, input[type="time"] { display: block; width: 100%; margin-top: 5px; font: inherit; font-weight: 400; padding: 11px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
input[type="time"] { width: auto; margin: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.check.disabled { opacity: .55; }

/* progress */
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { text-align: center; margin: 8px 0 0; padding: 12px 6px; } .stat b { display: block; font-size: 26px; } .stat span { font-size: 12px; color: var(--muted); }
.heat { display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.heat i, .legend i { aspect-ratio: 1; border-radius: 4px; background: var(--line); }
.legend i { display: inline-block; width: 12px; vertical-align: -1px; margin-left: 6px; }
.l1 { background: color-mix(in srgb, var(--accent) 35%, var(--line)) !important; }
.l2 { background: color-mix(in srgb, var(--accent) 65%, var(--line)) !important; }
.l3 { background: var(--accent) !important; }
.heat i.today { outline: 2px solid var(--warm); outline-offset: 1px; } .heat i.future { opacity: .35; }
.chartrow { display: flex; gap: 16px; margin: 6px 0; }
.nums b { display: block; font-size: 22px; } .nums span { font-size: 12px; color: var(--muted); }
.nums.good b { color: var(--good); } .nums.bad b { color: var(--bad); }
svg.chart { width: 100%; height: 70px; overflow: visible; }
svg.chart polyline { fill: none; stroke: var(--accent); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
svg.chart circle { fill: var(--accent); }
.note { border-top: 1px solid var(--line); padding: 8px 0; } .note:first-of-type { border: 0; } .note p { margin: 2px 0; }
.list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin: 12px 0; }
.list a { padding: 15px 16px; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; } .list a:last-child { border: 0; }
.list a::after { content: "›"; float: right; color: var(--muted); }
.score { display: flex; flex-direction: column; gap: 8px; } .score p { margin: 2px 0 0; }
.dots { display: flex; gap: 8px; } .dots button { flex: 1; height: 42px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 700; }
.dots button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.fix { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--line); } .fix:last-child { border: 0; } .fix span { color: var(--muted); }
.card.rec .row.gap { margin-top: 8px; }

/* guide */
.guide summary { font-size: 17px; font-weight: 750; list-style: none; display: flex; justify-content: space-between; }
.guide summary::after { content: "+"; color: var(--accent); font-size: 22px; line-height: 1; }
.guide[open] summary::after { content: "−"; }
.gbody { margin-top: 10px; } .gbody ul, .gbody ol { padding-left: 20px; } .gbody li { margin-bottom: 6px; }
.planrow { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.planrow > b { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; font-size: 14px; }
.planrow.cur > b { background: var(--warm); color: #fff; } .planrow p { margin: 0; } .planrow > div { flex: 1; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 16px); transform: translate(-50%, 20px); opacity: 0; transition: .25s;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 50; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.toolwrap .bigbtn { width: 150px; height: 150px; font-size: 19px; } .toolwrap .bigbtn span { font-size: 30px; }
.btn[disabled] { pointer-events: none; }
