/* Health coach. Calm and glanceable: your state, your one thing and what's next on the first screen;
   everything else one tap away. Dark is deep ink, light is a cool off-white with white cards. */

:root {
  color-scheme: light;
  --bg: #f1f4f3;
  --card: #ffffff;
  --card-2: #f6f8f7;
  --fill: #e8edeb;
  --ink: #101920;
  --ink-2: #4f5b66;
  --ink-3: #85909a;
  --line: #e0e6e3;
  --accent: #0d7a64;
  --accent-ink: #ffffff;
  --accent-soft: #dcf0ea;
  --band: rgba(13, 122, 100, 0.12);
  --good: #1d8a59;
  --steady: #b0761a;
  --low: #c4532c;
  --rest: #b4385a;
  --z0: #e1efe9; --z1: #bfe0d3; --z2: #8dc8b3; --z3: #57a98f; --z4: #2c8a71; --z5: #0d6b56;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  --text: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --r-card: 22px;
  --r-inner: 14px;
  --shadow: 0 1px 2px rgba(16, 25, 32, 0.04), 0 6px 18px -10px rgba(16, 25, 32, 0.18);
  --tab-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e141a;
    --card: #161e26;
    --card-2: #1c252f;
    --fill: #232e39;
    --ink: #eef1f3;
    --ink-2: #a3aeb9;
    --ink-3: #6f7c88;
    --line: #232d38;
    --accent: #5fd4b6;
    --accent-ink: #062019;
    --accent-soft: #15322c;
    --band: rgba(95, 212, 182, 0.13);
    --good: #4fd18b;
    --steady: #f2b84b;
    --low: #ff8a5c;
    --rest: #ff7a9a;
    --z0: #1a2b29; --z1: #1f4740; --z2: #277062; --z3: #3a9a84; --z4: #5fc4a8; --z5: #a6ead6;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 var(--text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
p { margin: 0; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

#view {
  max-width: 600px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + var(--tab-h) + 40px);
  outline: none;
  transition: opacity 0.15s;
}
#view.loading { opacity: 0.6; }

/* ---------- Type ---------- */

.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 4px 0; }
.date { font-size: 14px; font-weight: 600; color: var(--ink-3); }
.hello { margin: 2px 4px 16px; font-family: var(--round); font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.title { margin: 6px 4px 6px; font-family: var(--round); font-size: 32px; line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; }
.sub { margin: 0 4px 18px; color: var(--ink-2); font-size: 16px; }
.label { font-size: 13.5px; font-weight: 600; color: var(--ink-3); }
.h { margin: 0; font-family: var(--round); font-weight: 700; font-size: 21px; line-height: 1.25; letter-spacing: -0.005em; }
.h-sm { margin: 0; font-family: var(--round); font-weight: 650; font-size: 17px; line-height: 1.3; }
.muted { color: var(--ink-3); }
.secondary { color: var(--ink-2); }
.small { font-size: 15px; }
.tiny { font-size: 13px; }
.num { font-family: var(--round); font-variant-numeric: tabular-nums; }
.section-title { margin: 26px 4px 10px; font-size: 15px; font-weight: 650; color: var(--ink-2); }

.preview { margin: 0 0 14px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); font-size: 14px; }

/* Tones, always paired with a word. */
.t-great, .t-good { --tone: var(--good); }
.t-steady, .t-watch { --tone: var(--steady); }
.t-low, .t-alert { --tone: var(--low); }
.t-rest { --tone: var(--rest); }
.t-neutral { --tone: var(--ink-3); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--tone, var(--ink-3)) 14%, transparent); color: var(--tone, var(--ink-2)); font-size: 13.5px; font-weight: 650; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Cards ---------- */

.card { position: relative; margin-top: 12px; padding: 18px; border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .card { border: 1px solid var(--line); } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
a.card { display: block; color: inherit; text-decoration: none; }
.chev { width: 18px; height: 18px; color: var(--ink-3); flex: none; }

/* Hero: how you are, at a glance */
.hero { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 16px; align-items: center; background: linear-gradient(160deg, color-mix(in srgb, var(--tone) 16%, var(--card)) 0%, var(--card) 70%); }
.ring { position: relative; width: 118px; height: 118px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--fill); stroke-width: 10; }
.ring .arc { fill: none; stroke: var(--tone); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 0 14px; }
.ring-label strong { font-family: var(--round); font-size: 16px; line-height: 1.15; font-weight: 700; color: var(--tone); }
.ring-label span { margin-top: 2px; font-family: var(--round); font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.vitals { display: grid; gap: 8px; margin: 0; }
.vital { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; }
.vital + .vital { padding-top: 8px; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.vital dt { font-size: 13.5px; font-weight: 600; color: var(--ink-3); }
.vital dd { margin: 0; font-family: var(--round); font-size: 19px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.vital .u { grid-column: 2; font-size: 12px; color: var(--ink-3); white-space: nowrap; text-align: right; }
.arrow { display: inline-block; width: 12px; margin-left: 2px; font-size: 13px; }
.arrow.good { color: var(--good); }
.arrow.bad { color: var(--low); }
.arrow.flat { color: var(--ink-3); }
.read { grid-column: 1 / -1; }
.read .h { margin-top: 2px; }
.read p { margin-top: 6px; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* The one thing */
.focus { padding: 20px 18px 18px; }
.focus .when { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 650; color: var(--accent); }
.focus h2 { margin: 8px 0 0; font-family: var(--round); font-size: 25px; line-height: 1.18; font-weight: 700; letter-spacing: -0.01em; }
.focus p { margin-top: 8px; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.focus.done .when { color: var(--good); }

/* Up next */
.next { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 4px 12px; align-items: baseline; }
.next .t { font-family: var(--round); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.next .in { grid-column: 1 / -1; margin-bottom: 4px; }
.next strong { font-weight: 650; }
.next p { grid-column: 2; color: var(--ink-2); font-size: 15px; line-height: 1.45; }

/* Your day: a short agenda */
.agenda { margin: 0; padding: 0; list-style: none; }
.agenda li { display: grid; grid-template-columns: 54px 14px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 40px; }
.agenda .t { font-family: var(--round); font-size: 15px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.agenda .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--fill); background: var(--card); justify-self: center; position: relative; }
.agenda li:not(:last-child) .dot::after { content: ""; position: absolute; left: 50%; top: 10px; width: 2px; height: 32px; margin-left: -1px; background: var(--fill); }
.agenda .what { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda li.past { opacity: 0.45; }
.agenda li.past .dot { background: var(--ink-3); border-color: var(--ink-3); }
.agenda li.now .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.agenda li.now .what { font-weight: 650; }
.agenda li.train .what { color: var(--accent); font-weight: 650; }

/* Heads-up */
.alert { --tone: var(--low); display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; background: color-mix(in srgb, var(--low) 10%, var(--card)); }
.alert svg { width: 22px; height: 22px; color: var(--low); }
.alert strong { display: block; font-weight: 650; }
.alert p { margin-top: 3px; color: var(--ink-2); font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* How do you feel */
.feel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }
.feel button { display: grid; justify-items: center; gap: 2px; min-height: 62px; padding: 8px 0 6px; border: 0; border-radius: var(--r-inner); background: var(--card-2); cursor: pointer; font-size: 24px; }
.feel button span { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.feel button[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }

/* Claude */
.claude-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #d97757; color: #fff; flex: none; }
.claude-mark svg { width: 15px; height: 15px; }
.ask { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 11px 14px; margin-top: 8px; border-radius: var(--r-inner); background: var(--card-2); color: var(--ink); font-size: 15.5px; text-decoration: none; }
.ask svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.note-card .h-sm { margin-top: 8px; }
.note-card p { margin-top: 4px; color: var(--ink-2); font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Status line */
.status { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 18px; padding: 12px 6px; border: 0; background: none; color: var(--ink-3); font-size: 13.5px; text-align: left; cursor: pointer; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.status.warn .dot { background: var(--steady); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.badge.synced { color: var(--good); }
.badge.synced::before { background: currentColor; }
.badge.stale, .badge.estimated { color: var(--steady); }
.badge.stale::before, .badge.estimated::before { border: 2px solid currentColor; width: 4px; height: 4px; }
.badge.waiting { color: var(--ink-2); }
.badge.waiting::before { border: 2px dotted currentColor; width: 4px; height: 4px; }
.badge.not_connected, .badge.unavailable, .badge.not_authorised { color: var(--ink-3); }
.badge.not_connected::before, .badge.unavailable::before, .badge.not_authorised::before { height: 2px; border-radius: 1px; background: currentColor; }

/* ---------- Buttons ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 11px 18px; border: 0; border-radius: 14px; background: var(--card-2); color: var(--ink); font-size: 16px; font-weight: 650; text-decoration: none; cursor: pointer; }
@media (prefers-color-scheme: dark) { .btn { background: var(--fill); } }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.wide { width: 100%; }
.btn.danger { color: var(--low); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.link { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0; border: 0; background: none; color: var(--accent); font-size: 15px; font-weight: 650; text-decoration: none; cursor: pointer; }
.link svg { width: 15px; height: 15px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 12px; background: var(--fill); }
.seg button { min-height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 650; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 7px 14px; border: 0; border-radius: 999px; background: var(--card-2); font-size: 15px; cursor: pointer; }
@media (prefers-color-scheme: dark) { .chip { background: var(--fill); } }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ---------- Body ---------- */

.area { display: grid; gap: 10px; }
.area-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.area p { color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.area .spark { width: 100%; height: 54px; }
.area.missing { background: var(--card-2); box-shadow: none; }
.mini .band, .chart-svg .band { fill: var(--band); }
.mini .line, .chart-svg .line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.mini .bar, .chart-svg .bar { fill: var(--accent); }
.chart-svg .bar { opacity: 0.85; }
.chart-svg .bar-now { opacity: 1; fill: var(--ink); }
.mini .end-dot, .chart-svg .end-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.mini .reference, .chart-svg .reference { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 4 4; }
.mini { display: block; }
.spark .bar { opacity: 0.45; }

.back { display: inline-flex; align-items: center; gap: 2px; min-height: 40px; margin-left: -4px; color: var(--accent); font-size: 16px; font-weight: 600; text-decoration: none; }
.back svg { width: 20px; height: 20px; }
.chart { position: relative; margin-top: 6px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .tick { font: 11.5px var(--text); fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart-svg .band-label { font: 650 11.5px var(--text); fill: var(--ink-2); paint-order: stroke; stroke: var(--card); stroke-width: 4px; stroke-linejoin: round; }
.chart-svg .cross { stroke: var(--ink-2); stroke-width: 1; }
.chart-svg .cross-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.chart-svg .hit { cursor: crosshair; outline: none; }
.chart-tip { position: absolute; top: -10px; display: grid; padding: 6px 10px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.3; white-space: nowrap; pointer-events: none; transform: translateY(-100%); }
.chart-tip strong { font-family: var(--round); font-size: 15px; font-variant-numeric: tabular-nums; }
.caption { margin-top: 10px; font-size: 13.5px; color: var(--ink-3); }
.table-view { margin-top: 6px; font-size: 14px; }
.table-view summary { display: inline-flex; align-items: center; min-height: 40px; color: var(--accent); font-weight: 650; cursor: pointer; list-style: none; }
.table-view summary::-webkit-details-marker { display: none; }
.table-view table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { padding: 7px 0; border-bottom: 1px solid var(--line); text-align: left; }
.table-view th:last-child, .table-view td:last-child { text-align: right; }
.table-view tbody { display: block; max-height: 260px; overflow: auto; }
.table-view thead, .table-view tbody tr { display: table; width: 100%; table-layout: fixed; }
.prose p { margin: 0 0 10px; color: var(--ink-2); font-size: 16px; line-height: 1.55; }
.prose p:last-child { margin-bottom: 0; }
.prose ul { margin: 0 0 10px; padding-left: 20px; color: var(--ink-2); }
.prose li { margin: 4px 0; }
.prose strong { color: var(--ink); }

/* List rows inside cards (numbers, settings, sources) */
.rows { margin: -6px 0; padding: 0; list-style: none; }
.rows > * { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 0; }
.rows > * + * { border-top: 1px solid var(--line); }
.rows dt, .rows .k { color: var(--ink-2); font-size: 15.5px; }
.rows dd { margin: 0; text-align: right; }
.rows dd b { font-family: var(--round); font-weight: 700; font-variant-numeric: tabular-nums; }
.rows dd span { display: block; font-size: 12.5px; color: var(--ink-3); }
.rows a, .rows button.row { width: 100%; border: 0; background: none; color: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.row-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row-main strong { display: block; font-weight: 600; }
.row-main span { display: block; font-size: 13.5px; color: var(--ink-3); }
.row-end { display: flex; align-items: center; gap: 8px; flex: none; }
.ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; flex: none; background: var(--accent-soft); color: var(--accent); }
.ico svg { width: 18px; height: 18px; }

/* ---------- Training ---------- */

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 14px; }
.wd { display: grid; justify-items: center; gap: 6px; padding: 8px 0 10px; border-radius: 12px; }
.wd.today { background: var(--accent-soft); }
.wd-label { font-size: 12px; font-weight: 650; color: var(--ink-3); }
.wd.today .wd-label { color: var(--accent); }
.wd-marks { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 30px; justify-content: center; }
.mark { width: 13px; height: 13px; }
.mark.strength { border-radius: 3px; background: var(--ink); }
.mark.cardio { border-radius: 50%; background: var(--accent); }
.mark.walk, .mark.mobility, .mark.other { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.mark.planned { border-radius: 50%; border: 2px dashed var(--accent); background: transparent; }
.mark.none { width: 10px; height: 2px; border-radius: 1px; background: var(--fill); }
.key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }
.key span { display: inline-flex; align-items: center; gap: 5px; }
.key .mark { transform: scale(0.8); }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.meter { padding: 10px 12px; border-radius: var(--r-inner); background: var(--card-2); }
.meter b { font-family: var(--round); font-size: 20px; font-variant-numeric: tabular-nums; }
.meter .bar { display: flex; gap: 3px; margin-top: 6px; }
.meter .bar i { flex: 1; height: 5px; border-radius: 3px; background: var(--fill); }
.meter .bar i.on { background: var(--accent); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.facts span { padding: 4px 10px; border-radius: 999px; background: var(--card-2); font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
@media (prefers-color-scheme: dark) { .facts span { background: var(--fill); } }
.steps-list { margin: 0; padding: 0; list-style: none; }
.steps-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 0; }
.steps-list li + li { border-top: 1px solid var(--line); }
.steps-list .n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--card-2); font-family: var(--round); font-size: 13px; font-weight: 700; color: var(--ink-2); }
@media (prefers-color-scheme: dark) { .steps-list .n { background: var(--fill); } }
.steps-list li.done .n { background: var(--accent); color: var(--accent-ink); }
.steps-list li.done .x { color: var(--ink-3); text-decoration: line-through; }
.steps-list button { all: unset; display: contents; cursor: pointer; }
.part { margin: 16px 0 2px; font-size: 13.5px; font-weight: 650; color: var(--ink-3); }
.progress { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; margin: 8px 0 4px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s; }
.session { padding: 12px 0; }
.session + .session { border-top: 1px solid var(--line); }
.session summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; cursor: pointer; list-style: none; }
.session summary::-webkit-details-marker { display: none; }
.session .what { font-weight: 650; }
.session .when { font-size: 13px; color: var(--ink-3); }
.session .str { font-family: var(--round); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.session .meta { grid-column: 1 / -1; font-size: 13.5px; color: var(--ink-2); }
.zonebar { display: flex; gap: 2px; height: 10px; margin-top: 10px; }
.zonebar i { display: block; min-width: 2px; border-radius: 3px; }
.zonelegend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.zonelegend span { display: inline-flex; align-items: center; gap: 5px; }
.zonelegend i { width: 9px; height: 9px; border-radius: 2px; }

/* ---------- Insights ---------- */

.story-part + .story-part { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.story-part p { margin-top: 4px; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.compare { display: grid; gap: 8px; margin-top: 14px; }
.cmp { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 4px 10px; align-items: center; }
.cmp .lbl { grid-column: 1 / -1; font-size: 13px; color: var(--ink-3); }
.cmp .track { height: 10px; border-radius: 5px; background: var(--fill); overflow: hidden; }
.cmp .track i { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.cmp.worse .track i { background: var(--ink-3); }
.cmp b { font-family: var(--round); font-variant-numeric: tabular-nums; text-align: right; }
.pattern p { margin-top: 6px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.strength { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }
.message { display: block; width: 100%; padding: 12px 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.message + .message { border-top: 1px solid var(--line); }
.message .when { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.message strong { display: block; margin-top: 2px; font-weight: 650; }
.message .sum { display: block; margin-top: 2px; color: var(--ink-2); font-size: 14.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.from-claude { color: #d97757; font-weight: 650; }

/* ---------- Forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; }
.field label, .field-label { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); color: var(--ink); font: 16px var(--text); }
@media (prefers-color-scheme: dark) { input, select, textarea { background: var(--bg); } }
textarea { resize: vertical; line-height: 1.45; }
.goal { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.goal input { width: 20px; min-height: 20px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.goal span span { display: block; font-size: 13.5px; color: var(--ink-3); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; }
.toggle .txt span { display: block; font-size: 13.5px; color: var(--ink-3); }
.switch { appearance: none; -webkit-appearance: none; width: 51px; min-height: 31px; height: 31px; padding: 0; border: 0; border-radius: 999px; background: var(--fill); position: relative; flex: none; cursor: pointer; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.copy { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.copy code { flex: 1; min-width: 0; padding: 9px 10px; border-radius: 10px; background: var(--card-2); font-size: 13px; overflow-wrap: anywhere; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
.steps { margin: 8px 0; padding-left: 22px; }
.steps li { margin: 6px 0; font-size: 15px; line-height: 1.5; }
.q { margin: 18px 0 8px; font-weight: 650; font-size: 15px; }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.scale button { display: grid; justify-items: center; gap: 2px; min-height: 62px; padding: 8px 2px; border: 0; border-radius: 12px; background: var(--card-2); cursor: pointer; font-size: 22px; }
.scale button span { font-size: 11.5px; color: var(--ink-2); }
.scale button[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.error { color: var(--low); font-size: 14.5px; }

/* ---------- Tab bar ---------- */

.tabbar { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px max(8px, env(safe-area-inset-left)) calc(env(safe-area-inset-bottom) + 4px); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 94%, transparent); }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 5px 0 3px; color: var(--ink-3); font-size: 11px; font-weight: 650; text-decoration: none; }
.tabbar svg { width: 25px; height: 25px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
@media (min-width: 700px) {
  .tabbar { left: 50%; right: auto; bottom: 16px; width: 480px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 22px; padding-bottom: 6px; background: var(--card); box-shadow: var(--shadow); }
}

/* ---------- Sheet ---------- */

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(6, 10, 14, 0.45); }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 41; max-width: 600px; max-height: 92vh; margin: 0 auto; padding: 8px 18px calc(env(safe-area-inset-bottom) + 24px); overflow: auto; overscroll-behavior: contain; border-radius: 24px 24px 0 0; background: var(--bg); animation: rise 0.32s cubic-bezier(0.2, 0.9, 0.25, 1.05); }
@keyframes rise { from { transform: translateY(48px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 38px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: var(--fill); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sheet-head h2 { margin: 4px 0 0; font-family: var(--round); font-weight: 700; font-size: 24px; line-height: 1.2; }
.close { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border: 0; border-radius: 50%; background: var(--fill); cursor: pointer; }
.close svg { width: 15px; height: 15px; }
.sheet .card:first-of-type { margin-top: 8px; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 11px 0; }
.timeline li + li { border-top: 1px solid var(--line); }
.timeline .t { font-family: var(--round); font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.timeline li.train .t, .timeline li.train strong { color: var(--accent); }
.timeline strong { font-weight: 650; }
.timeline p { margin-top: 2px; font-size: 14.5px; color: var(--ink-2); line-height: 1.45; }
.why-list { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }
.why-list li { margin: 4px 0; font-size: 15px; }
.sure { display: inline-flex; gap: 3px; margin-right: 8px; vertical-align: 2px; }
.sure i { width: 16px; height: 6px; border-radius: 3px; background: var(--fill); }
.sure i.on { background: var(--accent); }

/* ---------- Login, toast, empty ---------- */

.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { display: grid; gap: 14px; width: min(360px, 100%); }
.login-card h1 { margin: 6px 0 0; font-family: var(--round); font-weight: 700; font-size: 34px; }
.login-card p { color: var(--ink-2); }
.login-card img { border-radius: 16px; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + var(--tab-h) + 18px); z-index: 60; max-width: min(92vw, 520px); padding: 11px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 550; transform: translateX(-50%); }
.empty { padding: 60px 8px; }
.empty h2 { margin: 0 0 8px; font-family: var(--round); font-weight: 700; font-size: 26px; }
.empty p { color: var(--ink-2); }

@media (max-width: 370px) {
  .hero { grid-template-columns: 100px minmax(0, 1fr); gap: 12px; }
  .ring { width: 100px; height: 100px; }
  .vital { grid-template-columns: 64px auto; }
  .vital .u { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
