/* Learn N Grow — one stylesheet. Rules: .claude/skills/lng-ui-standards/SKILL.md
   Layout: iPad-first. Child = content column + bottom tab bar (two panes on wide
   screens). Parent = header + tab strip + cards. Every value comes from a token. */

:root {
  /* palette: calm teal ink, marigold for "due soon", no red for the child */
  --bg: #f2f5f4;
  --surface: #ffffff;
  --surface2: #e9efed;
  --surface3: #dde6e3;
  --border: #cfdcd8;
  --border-strong: #a9bdb7;
  --text: #14302b;
  --muted: #56706a;
  --on-strong: #ffffff;
  --accent: #0f7a66;
  --accent-hover: #0b5e4f;
  --accent-soft: #d8efe9;
  --marigold: #8a5208;
  --marigold-soft: #fbecd2;
  --green: #1d7a3a;
  --green-bg: #dcf1e2;
  --red: #b3261e;
  --red-bg: #f8dedb;
  --warn: #8a5208;
  --warn-bg: #fbecd2;
  --scrim: rgba(20, 48, 43, 0.4);
  --shadow: 0 6px 24px rgba(20, 48, 43, 0.08);

  /* space (4 px base) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  /* radii */
  --radius-sm: 6px; --radius-md: 8px; --radius: 12px; --radius-lg: 16px; --radius-pill: 999px;
  /* type (16 px floor for reading on the iPad) */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  --font-num: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 14px; --fs-md: 16px;
  --fs-lg: clamp(18px, 1.6vw, 20px); --fs-xl: clamp(22px, 2.4vw, 26px); --fs-2xl: clamp(26px, 3.2vw, 32px);
  --lh-tight: 1.25; --lh-heading: 1.2; --lh-body: 1.5;
  /* controls */
  --control-h: 44px; --control-h-sm: 36px; --tap-min: 44px; --pin-key: 64px;
  --tabbar-h: 64px; --header-h: 56px; --content-max: 1760px; --gutter: clamp(16px, 2.6vw, 48px);
  --focus-ring: 0 0 0 3px var(--accent-soft), 0 0 0 5px var(--accent);
  --focus-offset: 2px; --motion-fast: 140ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1716; --surface: #16211f; --surface2: #1d2b28; --surface3: #253532;
    --border: #2c3d39; --border-strong: #425953; --text: #e3eeeb; --muted: #9db3ad; --on-strong: #0f1716;
    --accent: #4cc7ab; --accent-hover: #6fd8c0; --accent-soft: #173c34;
    --marigold: #f0a43a; --marigold-soft: #3a2a10; --green: #6fd38c; --green-bg: #173a22;
    --red: #ff8a80; --red-bg: #3d1a17; --warn: #f0a43a; --warn-bg: #3a2a10;
    --scrim: rgba(0, 0, 0, 0.55); --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1716; --surface: #16211f; --surface2: #1d2b28; --surface3: #253532;
  --border: #2c3d39; --border-strong: #425953; --text: #e3eeeb; --muted: #9db3ad; --on-strong: #0f1716;
  --accent: #4cc7ab; --accent-hover: #6fd8c0; --accent-soft: #173c34;
  --marigold: #f0a43a; --marigold-soft: #3a2a10; --green: #6fd38c; --green-bg: #173a22;
  --red: #ff8a80; --red-bg: #3d1a17; --warn: #f0a43a; --warn-bg: #3a2a10;
  --scrim: rgba(0, 0, 0, 0.55); --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: var(--fs-md); line-height: var(--lh-body);
}
h1, h2, h3 { margin: 0; line-height: var(--lh-heading); text-wrap: balance; font-weight: 650; }
h1 { font-size: var(--fs-2xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.eyebrow { font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- layout ---------- */
.page { width: 100%; max-width: var(--content-max); margin: 0 auto; padding-inline: var(--gutter); padding-block: var(--sp-4) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.stack-lg { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }
.row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; min-width: 0; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--sp-4); align-items: start; }
/* Adaptive tiles: card lists fill the width (1 column on a phone, 2-4 on wide screens). */
.tiles, .list.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: var(--sp-3); align-items: start; }
.tiles > h2, .tiles > .empty { grid-column: 1 / -1; }
/* Running text stays readable however wide the page gets. */
.page p, .page :not(.list) > li:not([class]) { max-width: 88ch; }
.page .table p, .page .table li, .page .tiles p, .page .tiles li { max-width: none; }
.two-pane { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
@media (min-width: 1000px) { .two-pane { grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); align-items: start; } }
@media (min-width: 1600px) { .two-pane { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-5); } }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.card.tight { padding: var(--sp-3); }
.card.hi { border-color: var(--accent); background: var(--accent-soft); }
.card.quiet { background: var(--surface2); border-color: transparent; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.thought { border-left: 3px solid var(--marigold); padding-left: var(--sp-3); color: var(--muted); font-style: italic; }
.list { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.divider { height: 1px; background: var(--border); border: 0; margin: var(--sp-1) 0; width: 100%; }

/* ---------- pills / chips ---------- */
.pill { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.03em; padding: 2px var(--sp-2); border-radius: var(--radius-pill); background: var(--surface2); color: var(--muted); white-space: nowrap; }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.soon { background: var(--marigold-soft); color: var(--marigold); }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.stop { background: var(--red-bg); color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip { min-height: var(--tap-min); padding: 0 var(--sp-4); border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: background var(--motion-fast); }
.chip:hover { background: var(--surface2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--control-h); padding: 0 var(--sp-4); border-radius: var(--radius-md); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text); transition: background var(--motion-fast), border-color var(--motion-fast); }
.btn:hover { background: var(--surface2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-strong); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.sm { min-height: var(--control-h-sm); padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.field label { font-size: var(--fs-sm); font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-label { display: flex; align-items: center; gap: var(--sp-1); min-width: 0; min-height: 24px; }
.req { color: var(--red); font-weight: 700; margin-left: 2px; }
.hint.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tip-btn { flex: none; width: 24px; height: 24px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--accent); font: italic 700 var(--fs-xs) / 1 var(--font-ui); cursor: pointer; display: inline-grid; place-items: center; padding: 0; }
.tip-btn[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-strong); }
.tip { font-size: var(--fs-xs); color: var(--text); background: var(--surface2); border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-3); }
.input, textarea.input, select.input { min-height: var(--control-h); width: 100%; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); }
textarea.input { min-height: 120px; resize: vertical; line-height: var(--lh-body); }
.hint { font-size: var(--fs-sm); color: var(--muted); }
.error { color: var(--red); font-size: var(--fs-sm); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--sp-3); align-items: start; }
.form-row > .btn, .form-row > .actions { align-self: end; }
.form-row.top { align-items: start; }

/* ---------- task cards (child) ---------- */
.task { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); min-height: 72px; }
.task.selected { border-color: var(--accent); background: var(--accent-soft); }
.task .title { font-weight: 600; overflow-wrap: anywhere; }
.task .why { font-size: var(--fs-sm); color: var(--muted); }
.task .order { display: flex; flex-direction: column; gap: var(--sp-1); }
.icon-btn { width: var(--tap-min); height: var(--tap-min); border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface2); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn.mini { width: var(--control-h-sm); height: var(--control-h-sm); }
.steps { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.step { font-size: var(--fs-xs); padding: 2px var(--sp-2); border-radius: var(--radius-sm); background: var(--surface2); color: var(--muted); }
.step.on { background: var(--accent); color: var(--on-strong); font-weight: 600; }
.step.past { background: var(--accent-soft); color: var(--accent); }
.budget { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); }

/* ---------- empty / quiet states ---------- */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-5); border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); }
.rest { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--sp-3); padding: var(--sp-6) var(--sp-4); }
.rest .moon { width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft); box-shadow: inset -14px -6px 0 0 var(--accent); }

/* ---------- child shell ---------- */
.child-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); border-bottom: 1px solid var(--border); }
.child-header .inner { max-width: var(--content-max); margin: 0 auto; padding: var(--sp-2) var(--gutter); min-height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.child-main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--sp-4)); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar .inner { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tab { min-height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: var(--fs-sm); font-weight: 600; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }

/* ---------- parent header ---------- */
.p-brand { min-height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.p-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: var(--sp-2); font-weight: 700; text-decoration: none; color: inherit; }
.brand .mark { width: 28px; height: 28px; border-radius: var(--radius-md); background: var(--accent); display: inline-flex; align-items: center; justify-content: center; color: var(--on-strong); font-size: var(--fs-sm); }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--marigold-soft); color: var(--marigold); font-size: var(--fs-xs); display: inline-flex; align-items: center; justify-content: center; }

/* needs-you cards */
.need { display: flex; flex-direction: column; gap: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); background: var(--surface); }
.need.attention { border-left: 4px solid var(--marigold); }
.need .meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; font-size: var(--fs-sm); color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-xs); }
.check { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 2px var(--sp-2); border-radius: var(--radius-sm); background: var(--green-bg); color: var(--green); }
.check.fail { background: var(--warn-bg); color: var(--warn); }
.excerpt { font-size: var(--fs-sm); color: var(--muted); background: var(--surface2); border-radius: var(--radius-md); padding: var(--sp-2) var(--sp-3); white-space: pre-wrap; overflow-wrap: anywhere; }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--sp-2); }

/* tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { text-align: left; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { background: var(--surface2); color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }

/* blueprint (About) */
/* Architecture blueprint (web/static/js/blueprint.js): SVG classes styled with theme tokens, dark mode included. */
.bp-card { gap: var(--sp-3); }
.bp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-md); }
.bp-svg { display: block; max-width: 100%; height: auto; margin: 0 auto; font-family: inherit; }
@media (max-width: 720px) { .bp-svg { max-width: none; width: 960px; } }
.bp-band rect { fill: var(--surface2); }
.bp-band text { fill: var(--muted); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.bp-edge { fill: none; stroke: var(--border-strong); stroke-width: 1.5; stroke-linejoin: round; }
.bp-edge.dash { stroke-dasharray: 5 4; }
.bp-arrow { fill: var(--border-strong); }
.bp-n rect, .bp-n path { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; }
.bp-n .rim { fill: none; }
.bp-n.store path { fill: var(--accent-soft); stroke: var(--accent); }
.bp-n.human rect { fill: var(--green-bg); stroke: var(--green); }
.bp-n.gate rect { stroke: var(--accent); stroke-width: 2.4; }
.bp-n.policy rect { fill: var(--marigold-soft); stroke: var(--marigold); stroke-dasharray: 5 3; }
.bp-n .t { fill: var(--text); font-size: var(--fs-sm); font-weight: 700; text-anchor: middle; }
.bp-n .d { fill: var(--muted); font-size: var(--fs-xs); text-anchor: middle; }
.bp-l rect { fill: var(--surface); stroke: var(--border); }
.bp-l text { fill: var(--muted); font-size: var(--fs-xs); font-weight: 600; text-anchor: middle; }
.page ul.bp-legend.bp-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: row; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); color: var(--muted); }
.bp-legend li { display: inline-flex; align-items: center; gap: var(--sp-1); }
.bp-key { display: inline-block; width: 22px; height: 14px; border: 1.5px solid var(--border-strong); border-radius: 4px; background: var(--surface); }
.bp-key.human { border-radius: var(--radius-pill); background: var(--green-bg); border-color: var(--green); }
.bp-key.gate { border: 2.5px solid var(--accent); }
.bp-key.policy { background: var(--marigold-soft); border: 1.5px dashed var(--marigold); }
.bp-key.store { background: var(--accent-soft); border-color: var(--accent); border-radius: 50% / 30%; }
.bp-key.line { height: 0; border: 0; border-top: 2px solid var(--border-strong); border-radius: 0; background: none; }
.bp-key.line.dash { border-top-style: dashed; }
.bp-code summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); }
.bp-code[open] summary { margin-bottom: var(--sp-2); }
pre.code { margin: 0; padding: var(--sp-3); background: var(--surface2); border-radius: var(--radius-md); overflow-x: auto; font-family: var(--font-num); font-size: var(--fs-xs); }
details > summary { cursor: pointer; font-weight: 600; min-height: var(--tap-min); display: flex; align-items: center; }

/* login + pin pad */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding-inline: var(--sp-4); padding-block: var(--sp-6); }
.login .card { width: 100%; max-width: 420px; padding: var(--sp-5); gap: var(--sp-4); box-shadow: var(--shadow); }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface2); border-radius: var(--radius-md); padding: var(--sp-1); }
.seg button { min-height: var(--control-h); border: 0; border-radius: var(--radius-sm); background: transparent; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pin-dots { display: flex; justify-content: center; gap: var(--sp-3); }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent); }
.pin-dots span.on { background: var(--accent); }
.pinpad { display: grid; grid-template-columns: repeat(3, var(--pin-key)); gap: var(--sp-3); justify-content: center; }
.pinpad button { width: var(--pin-key); height: var(--pin-key); border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); font-size: var(--fs-xl); cursor: pointer; }
.pinpad button:hover { background: var(--surface2); }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--sp-4)); z-index: 50; background: var(--text); color: var(--bg); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md); box-shadow: var(--shadow); max-width: calc(100vw - var(--sp-6)); font-size: var(--fs-sm); }
.toast.err { background: var(--red); color: var(--on-strong); }

/* support */
.helpline { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.helpline .number { font-family: var(--font-num); font-size: var(--fs-xl); font-weight: 700; user-select: all; }
.breath { width: 120px; height: 120px; border-radius: 50%; background: var(--accent-soft); border: 2px solid var(--accent); margin: var(--sp-2) auto; animation: breathe 10s ease-in-out infinite; }
@keyframes breathe { 0% { transform: scale(0.75); } 40% { transform: scale(1); } 100% { transform: scale(0.75); } }

@media (max-width: 480px) {
  .task { grid-template-columns: minmax(0, 1fr) auto; }
  .task .order { display: none; }
  .page { padding-inline: var(--sp-3); }
}

/* ---------- parent shell: server-driven left menu (AIR pattern) ---------- */
.p-header { padding: 0 var(--gutter); }
.p-shell { display: grid; grid-template-columns: minmax(0, 1fr); }
.p-nav { display: flex; gap: var(--sp-1); overflow-x: auto; scrollbar-width: none; padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--header-h)); z-index: 4; }
.p-nav::-webkit-scrollbar { display: none; }
.p-nav-group { display: flex; gap: var(--sp-1); flex: none; }
.p-nav-heading { display: none; }
.p-link { flex: none; min-height: var(--tap-min); display: inline-flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-3); border-radius: var(--radius-md); color: var(--muted); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); }
.p-link:hover { background: var(--surface2); color: var(--text); }
.p-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.p-main { min-width: 0; }
@media (min-width: 900px) {
  .p-shell { grid-template-columns: 232px minmax(0, 1fr); }
  .p-nav { flex-direction: column; gap: var(--sp-4); overflow: visible; position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--header-h)); align-self: start; height: calc(100vh - var(--header-h)); border-bottom: 0; border-right: 1px solid var(--border); padding: var(--sp-4) var(--sp-3); }
  .p-nav-group { flex-direction: column; }
  .p-nav-heading { display: block; font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 var(--sp-3) var(--sp-1); margin: 0; }
  .p-link { width: 100%; }
}
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap-min); cursor: pointer; }
.switch input { width: 44px; height: 26px; appearance: none; border-radius: var(--radius-pill); background: var(--surface3); border: 1px solid var(--border-strong); position: relative; cursor: pointer; transition: background var(--motion-fast); margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); transition: transform var(--motion-fast); }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:disabled { opacity: 0.5; cursor: not-allowed; }
.trace { display: flex; flex-wrap: wrap; gap: var(--sp-1); align-items: center; }
.trace .stage { font-size: var(--fs-xs); padding: 2px var(--sp-2); border-radius: var(--radius-sm); background: var(--surface2); color: var(--muted); }
.trace .stage.ok { background: var(--green-bg); color: var(--green); }
.trace .stage.warn { background: var(--warn-bg); color: var(--warn); }
.trace .arrow { color: var(--muted); font-size: var(--fs-xs); }
.secret-once { font-family: var(--font-num); background: var(--warn-bg); color: var(--text); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md); overflow-wrap: anywhere; user-select: all; }
.channel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2) var(--sp-3); align-items: start; }

/* ---------- links and button-cards ---------- */
a.card { text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--accent); }
button.task { width: 100%; text-align: left; cursor: pointer; color: inherit; font: inherit; }
button.task:hover { border-color: var(--accent); }
.task .btn.ghost { justify-content: flex-start; text-align: left; min-height: var(--tap-min); height: auto; padding: var(--sp-1) 0; color: inherit; font-weight: 400; }
.task .btn.ghost:hover { background: transparent; }
.seg[role="tablist"] { grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); max-width: 640px; }
.page ol:not(.list), .page ul:not(.list) { margin: 0; padding-left: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-1); }

/* phone: the open task comes first; parent header stays two rows */
@media (max-width: 999px) { .two-pane > .first-on-phone { order: -1; } }
@media (max-width: 600px) { .hide-sm { display: none; } }
.channel + .channel { border-top: 1px solid var(--border); padding-top: var(--sp-3); }

/* v0.2.0: photo picker, scoreboard meters, callouts */
.photo-canvas { display: block; max-width: 100%; height: auto; border-radius: var(--radius-md); border: 1px solid var(--border); touch-action: none; cursor: crosshair; }
.score { display: flex; flex-direction: column; gap: var(--sp-1); padding-block: var(--sp-2); border-bottom: 1px solid var(--border); }
.score:last-child { border-bottom: 0; }
.meter { height: 8px; border-radius: var(--radius-pill); background: var(--surface2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; }
.meter i.w5 { width: 5%; }
.meter i.w10 { width: 10%; }
.meter i.w15 { width: 15%; }
.meter i.w20 { width: 20%; }
.meter i.w25 { width: 25%; }
.meter i.w30 { width: 30%; }
.meter i.w35 { width: 35%; }
.meter i.w40 { width: 40%; }
.meter i.w45 { width: 45%; }
.meter i.w50 { width: 50%; }
.meter i.w55 { width: 55%; }
.meter i.w60 { width: 60%; }
.meter i.w65 { width: 65%; }
.meter i.w70 { width: 70%; }
.meter i.w75 { width: 75%; }
.meter i.w80 { width: 80%; }
.meter i.w85 { width: 85%; }
.meter i.w90 { width: 90%; }
.meter i.w95 { width: 95%; }
.meter i.w100 { width: 100%; }
.callout { background: var(--warn-bg); color: var(--text); border-left: 3px solid var(--warn); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); }
.pill.stop { background: var(--red-bg); color: var(--red); }
@media (max-width: 480px) { .tip-btn { width: 32px; height: 32px; } }

/* v0.1.1: set-up wizard, child switcher */
.list.wizard { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: var(--sp-2); }
.wizard-step { width: 100%; display: flex; align-items: center; gap: var(--sp-2); text-align: left; padding: var(--sp-2) var(--sp-3); min-height: var(--control-h);
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text); cursor: pointer; }
.wizard-step[aria-current="step"] { border-color: var(--accent); background: var(--accent-soft); }
.wizard-dot { flex: none; width: 28px; height: 28px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--surface2);
  font-weight: 700; font-size: var(--fs-sm); }
.wizard-dot.done { background: var(--green-bg); color: var(--green); }
.child-switch .input.sm { min-height: var(--control-h-sm); padding-block: 0; width: auto; max-width: 220px; }

/* v0.3.0: Coach */
.list.ladder { display: flex; flex-direction: column; gap: var(--sp-2); }
.rung { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--sp-3); align-items: start; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md); background: var(--surface2); color: var(--muted); }
.rung.on { background: var(--accent-soft); color: var(--text); }
.rung-n { width: 28px; height: 28px; border-radius: var(--radius-pill); display: grid; place-items: center; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border-strong); font-size: var(--fs-sm); }
.rung.on .rung-n { background: var(--accent); border-color: var(--accent); color: var(--on-strong); }
.question { font-size: var(--fs-lg); background: var(--surface2); border-radius: var(--radius-md); padding: var(--sp-3); }
.pencil { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 560; max-width: 100%; background: var(--surface); color: var(--text);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md); touch-action: none; cursor: crosshair; }
@media (min-width: 1000px) { .two-pane.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.list.usage { gap: 2px; }
.list.usage li { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); align-items: center; }
.list.usage li span:first-child { color: var(--muted); min-width: 64px; }
.stat-line { font-size: var(--fs-lg); font-weight: 700; color: var(--accent); }
/* v0.3.0: worked examples, Coach measures */
.steps-list { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: var(--sp-1); max-width: 88ch; }
.meter i.ok { background: var(--green, var(--accent)); }
