/* base.css — @font-face, reset, layout, components, states.
   Design tokens (colors/type/spacing/radius) live in tokens.css, loaded first. */

/* ---------- self-hosted fonts (offline-first — cached by sw.js) ----------
   Bricolage Grotesque (display — wordmark, event titles, the giant countdown
   numerals) and Space Grotesk (UI — labels, body, controls) are both SIL Open
   Font License, free for commercial use, downloaded once at build time (no
   Google Fonts CDN request at runtime — required for an offline-first PWA and
   for perf). font-display: swap avoids a blank-text flash; the metrics-tuned
   FALLBACK faces right below (computed from the real files with fontTools —
   see /scratchpad — using the standard capsize/fontaine size-adjust formula)
   make the swap itself nearly invisible. */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../assets/fonts/bricolage-grotesque-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF;
  src: url("../assets/fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
}
/* Metrics extracted from the real woff2 (unitsPerEm 1000, ascent 930, descent
   -270, xAvgCharWidth 548) and matched against Arial with the capsize formula,
   so the fallback line-box/width is close enough that swap causes minimal reflow. */
@font-face {
  font-family: "Bricolage Fallback";
  src: local("Arial"), local("Helvetica"), local("Segoe UI");
  size-adjust: 124.15%;
  ascent-override: 74.91%;
  descent-override: 21.75%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/space-grotesk-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF;
  src: url("../assets/fonts/space-grotesk-latin-ext.woff2") format("woff2");
}
/* Metrics from the real file (unitsPerEm 1000, ascent 984, descent -292,
   xAvgCharWidth 559) matched against Arial. */
@font-face {
  font-family: "Space Grotesk Fallback";
  src: local("Arial"), local("Helvetica"), local("Segoe UI");
  size-adjust: 126.64%;
  ascent-override: 77.7%;
  descent-override: 23.06%;
  line-gap-override: 0%;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  background: var(--bg);
  color: var(--ink);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--sp-6);
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: var(--lh-tight); margin: 0; }
p { margin: 0; }
button, input, textarea, select { font-family: inherit; }
img, svg { display: block; }
a { color: var(--accent); }

/* Always honour the OS-level reduced-motion preference, independent of the
   in-app toggle (that toggle is seeded FROM this same query at boot — see
   app.js — but this is a hard floor so motion never leaks through before JS
   runs). This disables the digit-roll tick, the zero bloom, and the grain. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
[data-reduce="1"] *, [data-reduce="1"] *::before, [data-reduce="1"] *::after { animation: none !important; transition: none !important; }

@media (prefers-contrast: more) {
  :root, [data-theme] { --line: var(--ink-soft); }
  .btn, .field, .event-card, .sheet, .ring-track { border-width: 2px; }
}
@media (forced-colors: active) {
  .btn, .field, .event-card, .ring-track, .milestone-row { forced-color-adjust: none; border: 1px solid CanvasText; }
}

/* faint dusk grain — a tiny baked noise tile (data URI, ~1.6KB, no extra
   request), off for reduced-motion/contrast. A decoded bitmap tiles for free;
   a repeating radial-gradient recomputes per tile and measurably slows first
   paint by comparison (kept as a house convention from earlier products). */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: var(--grain-opacity); mix-blend-mode: overlay;
  background-image: url("data:image/png;base64,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");
  background-size: 48px 48px;
}
@media (prefers-reduced-motion: reduce), (prefers-contrast: more) { body::before { display: none; } }

.skip-link { position: absolute; left: -999px; top: 0; z-index: 100; }
.skip-link:focus { left: var(--sp-3); top: var(--sp-3); background: var(--ink); color: var(--bg); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-xs); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- masthead ---------- */
.masthead { max-width: var(--maxw); margin: 0 auto; padding: calc(env(safe-area-inset-top) + var(--sp-4)) var(--sp-4) var(--sp-2); position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.wordmark { display: flex; align-items: center; gap: var(--sp-2); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-h1); color: var(--ink); }
.wordmark-ic { width: 26px; height: 26px; color: var(--accent); flex: 0 0 auto; }
.masthead-actions { display: flex; gap: var(--sp-2); align-items: center; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition: transform .1s ease, background .15s ease, border-color .15s ease; flex: 0 0 auto; }
.icon-btn:active { transform: scale(.92); }
.icon-btn:hover { border-color: var(--accent); }

/* ---------- primary layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--sp-4); position: relative; z-index: 2; }
.overview-line { color: var(--ink-soft); font-size: var(--fs-sm); max-width: 60ch; margin: var(--sp-1) 0 var(--sp-5); min-height: calc(1em * var(--lh-body)); }
.overview-line strong { color: var(--ink); font-weight: 600; }

/* ---------- hero band: the star of the page ---------- */
.hero-band {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-4);
  margin-bottom: var(--sp-6);
  box-shadow: 0 24px 60px -32px color-mix(in srgb, var(--accent) 55%, transparent);
  display: grid; gap: var(--sp-4);
}
@media (min-width: 760px) { .hero-band { padding: var(--sp-6) var(--sp-5); grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr); align-items: center; } }
/* subtle single-hue dusk wash — never a purple-to-blue AI gradient, just a
   quiet radial glow of the theme's OWN accent low in the corner, off for
   reduced-motion/contrast so nothing shifts unexpectedly for those users. */
.hero-band::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 8% 110%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%);
}
@media (prefers-reduced-motion: reduce), (prefers-contrast: more) { .hero-band::before { display: none; } }
.hero-band.is-zero { animation: bloom 1.1s cubic-bezier(.2,.8,.2,1); }
@keyframes bloom {
  0% { box-shadow: 0 24px 60px -32px color-mix(in srgb, var(--accent) 55%, transparent); }
  35% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 45%, transparent), 0 24px 90px -20px color-mix(in srgb, var(--accent) 70%, transparent); }
  100% { box-shadow: 0 24px 60px -32px color-mix(in srgb, var(--accent) 55%, transparent); }
}

.hero-main { position: relative; z-index: 1; min-width: 0; }
.hero-kicker { display: flex; align-items: center; gap: var(--sp-2); color: var(--ink-soft); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .09em; font-weight: 600; margin-bottom: var(--sp-2); }
.hero-kicker .ic { width: 14px; height: 14px; color: var(--accent); }
.hero-title { font-family: var(--font-display); font-size: var(--fs-display); font-weight: 700; margin-bottom: var(--sp-3); overflow-wrap: anywhere; }

/* Digit strip — the giant tabular-nums countdown. Fixed-width digit boxes
   (font-variant-numeric: tabular-nums + explicit width) so the per-second tick
   causes ZERO layout shift (Gate 4 CLS). Each unit block is a flex column:
   digits on top, a small caption label underneath. */
.hero-clock { display: flex; align-items: flex-end; gap: var(--sp-1); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.clock-unit { display: flex; flex-direction: column; align-items: center; }
.clock-digits { display: flex; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-hero); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--ink); }
.clock-unit.is-days .clock-digits { color: var(--accent); }
.digit-box { display: inline-block; width: 0.66em; text-align: center; position: relative; overflow: hidden; height: 1.05em; }
.digit-glyph { display: block; position: relative; }
.digit-box.flip .digit-glyph { animation: digitFlip .38s cubic-bezier(.2,.8,.2,1); }
@keyframes digitFlip {
  0% { transform: translateY(-55%); opacity: 0; }
  55% { transform: translateY(8%); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
.clock-sep { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-hero); line-height: 1; color: var(--ink-soft); padding: 0 2px; align-self: flex-start; opacity: .55; }
.clock-label { font-size: var(--fs-xs); color: var(--ink-soft); text-transform: uppercase; letter-spacing: .07em; margin-top: var(--sp-2); font-weight: 600; }

.hero-phrase { font-size: 17px; color: var(--ink); margin-bottom: 2px; }
.hero-phrase strong { color: var(--accent); font-weight: 700; }
.hero-exact { color: var(--ink-soft); font-size: var(--fs-sm); }
.hero-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-4); }

.hero-side { position: relative; z-index: 1; display: flex; flex-direction: column; gap: var(--sp-3); }
.runway-teaser { background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--sp-3); }
.runway-teaser-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); font-size: var(--fs-sm); font-weight: 600; }
.runway-teaser-head .ic { color: var(--accent); }
.runway-bar { height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; border: 1px solid var(--line); }
.runway-fill { width: 0; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s cubic-bezier(.2,.8,.2,1); }
.runway-teaser-sub { color: var(--ink-soft); font-size: var(--fs-xs); margin-top: var(--sp-2); }
.runway-cite { color: var(--ink-soft); font-size: 11.5px; font-style: italic; margin-top: var(--sp-2); line-height: 1.5; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 18px; transition: transform .08s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.96); }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.btn.big { width: 100%; padding: 15px; font-size: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.link-btn { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
.mini { display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font: inherit; font-size: 12.5px; font-weight: 600; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-xs);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer;
  transition: transform .08s ease, background .15s ease; }
.mini:active { transform: scale(.94); }
.mini .ic { width: 14px; height: 14px; }

/* ---------- events grid: asymmetric, not "hero + 3 equal cards" ---------- */
.grid-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.grid-section-head h2 { font-size: var(--fs-h2); }
.sub { color: var(--ink-soft); font-size: var(--fs-sm); }
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-6); }

.event-card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2);
  border-left: 3px solid var(--card-accent, var(--accent));
  transition: box-shadow .15s ease, transform .1s ease, border-color .15s ease;
}
.event-card:hover { box-shadow: 0 10px 26px -18px color-mix(in srgb, var(--card-accent, var(--accent)) 60%, transparent); }
.event-card.is-pinned { box-shadow: 0 10px 30px -18px color-mix(in srgb, var(--card-accent, var(--accent)) 65%, transparent); }
.card-top { display: flex; align-items: flex-start; gap: var(--sp-2); }
.card-open { display: flex; align-items: center; gap: var(--sp-2); flex: 1 1 auto; min-width: 0; background: none; border: none; text-align: left; cursor: pointer; padding: 4px 0; border-radius: var(--radius-sm); }
.card-icon-badge {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: color-mix(in srgb, var(--card-accent, var(--accent)) 18%, var(--surface));
  color: var(--card-accent, var(--accent));
}
.card-icon-badge .ic { width: 20px; height: 20px; }
.card-meta { min-width: 0; }
.card-title { display: block; font-family: var(--font-display); font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.card-sub { display: flex; align-items: center; gap: 5px; color: var(--ink-soft); font-size: var(--fs-xs); margin-top: 2px; flex-wrap: wrap; }
.card-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.pin-btn, .more-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid transparent; background: none;
  color: var(--ink-soft); cursor: pointer; display: grid; place-items: center; transition: transform .08s ease, color .15s ease, background .15s ease; flex: 0 0 auto;
}
.pin-btn:hover, .more-btn:hover { color: var(--card-accent, var(--accent)); background: var(--surface-2); }
.pin-btn:active, .more-btn:active { transform: scale(.9); }
.pin-btn[aria-pressed="true"] { color: var(--card-accent, var(--accent)); }
.card-body { display: flex; align-items: center; gap: var(--sp-3); }
.card-ring { flex: 0 0 auto; }
.card-time { min-width: 0; }
.card-phrase { display: block; font-weight: 600; font-size: 15px; }
.card-progress-note { display: block; color: var(--ink-soft); font-size: var(--fs-xs); margin-top: 2px; }

/* progress ring — sequential ramp of the theme's own accent (per SPEC §6), never
   an unrelated hue. Track vs fill both verified >=3:1 in tokens.css. */
.ring-track { stroke: var(--surface-2); fill: none; }
.ring-fill { stroke: var(--card-accent, var(--accent)); fill: none; stroke-linecap: round; transition: stroke-dashoffset .5s cubic-bezier(.2,.8,.2,1); }

/* ---------- empty state ---------- */
.empty-state { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: var(--sp-6) var(--sp-4); text-align: center; margin-bottom: var(--sp-6); }
.empty-state h1 { font-size: var(--fs-display); font-family: var(--font-display); margin-bottom: var(--sp-2); }
.empty-state p { color: var(--ink-soft); max-width: 46ch; margin: 0 auto var(--sp-4); }
.starter-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; margin-bottom: var(--sp-3); }
.starter-chip { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-weight: 600; font-size: 14px; min-height: 44px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer;
  transition: transform .08s ease, border-color .15s ease; }
.starter-chip:hover { border-color: var(--accent); }
.starter-chip:active { transform: scale(.95); }
.starter-chip .ic { color: var(--accent); }

/* ---------- footer ---------- */
.site-footer { max-width: var(--maxw); margin: var(--sp-6) auto 0; padding: var(--sp-5) var(--sp-4); border-top: 1px solid var(--line); color: var(--ink-soft); font-size: var(--fs-sm); position: relative; z-index: 2; }
.footer-grid { display: grid; gap: var(--sp-4); }
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.footer-cite { font-style: italic; line-height: 1.6; max-width: 52ch; }
.footer-cite b { color: var(--ink); font-style: normal; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.version { color: var(--ink-soft); font-size: 11.5px; text-align: center; margin-top: var(--sp-4); }

/* ---------- form fields ---------- */
.field-label { display: block; font-size: var(--fs-sm); font-weight: 600; margin: var(--sp-3) 0 var(--sp-2); color: var(--ink); }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.field {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink);
  min-height: 44px;
}
.field:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.field-err { color: var(--danger); font-size: var(--fs-xs); margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
.field-err .ic { width: 14px; height: 14px; margin-top: 2px; flex: 0 0 auto; }
.hint { color: var(--ink-soft); font-size: var(--fs-xs); line-height: 1.5; margin-top: var(--sp-2); }
.muted { color: var(--ink-soft); font-weight: 400; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: var(--sp-3); }
.mt-18 { margin-top: 18px; }
.cite { color: var(--ink-soft); font-size: var(--fs-xs); font-style: italic; margin-top: var(--sp-2); line-height: 1.5; }

.seg-group { display: flex; gap: var(--sp-1); background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; }
.seg { flex: 1; font: inherit; font-size: 13px; font-weight: 600; min-height: 44px; border: none; border-radius: var(--radius-xs); background: transparent; color: var(--ink-soft); cursor: pointer; padding: 8px 6px; }
.seg[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px -1px rgba(0,0,0,.18); }

.icon-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--sp-2); }
.icon-opt { aspect-ratio: 1; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer; display: grid; place-items: center; min-height: 44px; }
.icon-opt[aria-checked="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.icon-opt:hover { border-color: var(--accent); }

.accent-picker { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.accent-opt { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; background: var(--sw); position: relative; }
.accent-opt[aria-checked="true"]::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--ink); }
.accent-opt[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface); }

.toggle-row { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; font-size: 15px; min-height: 44px; }
.toggle-row input { width: 22px; height: 22px; accent-color: var(--accent); flex: 0 0 auto; }

/* ---------- overlay sheets (dialogs) ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 60%, black 30%);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-3); }
.sheet { position: relative; background: var(--bg); width: 100%; max-width: var(--maxw-narrow); border-radius: 22px;
  max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom)); animation: rise .28s cubic-bezier(.2,.8,.2,1); }
.sheet-wide { max-width: 680px; }
@keyframes rise { from { transform: translateY(28px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet h2 { font-size: 21px; margin: var(--sp-1) 0 6px; padding-right: 40px; }
.sheet-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--accent); border: 1px solid var(--line); margin-bottom: var(--sp-2); }
.sheet-ic { width: 24px; height: 24px; }
.sheet-close { position: absolute; top: var(--sp-2); right: var(--sp-2); width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center; }
.sheet-close:active { transform: scale(.9); }

/* ---------- focus mode: full-viewport countdown ---------- */
.focus-overlay { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--sp-4); text-align: center; }
.focus-close { position: absolute; top: calc(env(safe-area-inset-top) + var(--sp-3)); right: var(--sp-3); width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.focus-close:active { transform: scale(.92); }
.focus-title { font-family: var(--font-display); font-size: clamp(1.5rem, 1.2rem + 2vw, 2.4rem); font-weight: 700; margin-bottom: var(--sp-4); overflow-wrap: anywhere; max-width: 90vw; }
.focus-clock .clock-digits { font-size: clamp(2.6rem, 1rem + 13vw, 9rem); }
.focus-clock .clock-sep { font-size: clamp(2.6rem, 1rem + 13vw, 9rem); }
.focus-exact { color: var(--ink-soft); margin-top: var(--sp-4); font-size: 15px; }
.focus-phrase { font-size: 18px; margin-top: var(--sp-2); }
.focus-phrase strong { color: var(--accent); }

/* ---------- runway sheet ---------- */
.runway-progress-row { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-3) 0; }
.runway-progress-row .runway-bar { flex: 1 1 auto; }
.runway-progress-label { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.milestone-list { list-style: none; padding: 0; margin: var(--sp-3) 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.milestone-row { display: flex; align-items: flex-start; gap: var(--sp-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-2); }
.ms-check { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; border: 2px solid var(--accent); background: var(--bg); cursor: pointer; display: grid; place-items: center; color: transparent; margin-top: -4px; transition: transform .1s ease, background .15s ease, color .15s ease; }
.ms-check .ic { width: 16px; height: 16px; }
.ms-check[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.ms-check.just-checked { animation: msPop .4s cubic-bezier(.2,.8,.2,1); }
@keyframes msPop { 0% { transform: scale(.7); } 55% { transform: scale(1.2); } 100% { transform: scale(1); } }
.ms-body { flex: 1 1 auto; min-width: 0; padding-top: 3px; }
.ms-label { display: block; font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.ms-label.is-done { text-decoration: line-through; color: var(--ink-soft); }
.ms-date { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.ms-cue { display: block; font-size: 12.5px; color: var(--ink-soft); font-style: italic; margin-top: 3px; }
.ms-row-actions { display: flex; gap: 2px; flex: 0 0 auto; }
.ms-icon-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: none; color: var(--ink-soft); cursor: pointer; display: grid; place-items: center; }
.ms-icon-btn:hover { color: var(--accent); background: var(--surface-2); }
.ms-icon-btn .ic { width: 16px; height: 16px; }
.ms-edit-form { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--sp-2); }
.ms-add-form { background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--sp-3); margin-top: var(--sp-3); }
.tip-banner { display: flex; gap: var(--sp-2); align-items: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: var(--sp-3); margin: var(--sp-3) 0; font-size: var(--fs-sm); color: var(--ink); }
.tip-banner .ic { color: var(--accent); margin-top: 2px; flex: 0 0 auto; }

/* ---------- menu list (overflow "..." actions) ---------- */
.menu-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.menu-item { display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; padding: 13px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 44px;
  transition: transform .08s ease, border-color .15s ease; }
.menu-item:hover { border-color: var(--accent); }
.menu-item:active { transform: scale(.98); }
.menu-ic { width: 20px; height: 20px; flex: 0 0 auto; color: var(--accent); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .menu-ic { color: var(--danger); }

.tip-list { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-2); }
.tip-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3); }
.tip-card h4 { font-family: var(--font-display); font-size: 16px; margin-bottom: 4px; }
.tip-card p { font-size: var(--fs-sm); color: var(--ink); margin-bottom: 6px; }
.tip-card .cite { margin-top: 0; }

.about-h { font-size: 15px; margin: var(--sp-4) 0 4px; }
.about-p { font-size: 14px; line-height: 1.6; color: var(--ink-soft); margin: 0; }
.about-p a { color: var(--accent); }

.setting-group { margin: var(--sp-4) 0; padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }
.setting-group h3 { font-size: 16px; margin: 0 0 var(--sp-2); }
.theme-picker { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.theme-swatch { display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; min-width: 60px; }
.theme-swatch-dot { width: 46px; height: 46px; border-radius: 14px; border: 2px solid var(--line); position: relative; overflow: hidden; }
.theme-swatch[aria-pressed="true"] .theme-swatch-dot { outline: 3px solid var(--ink); outline-offset: 2px; }
.theme-swatch-label { font-size: 11px; color: var(--ink-soft); text-align: center; }
.steps-guide { margin: var(--sp-2) 0 4px; padding-left: 22px; }
.steps-guide li { font-size: 15px; line-height: 1.55; padding: 6px 0; }
.legend { list-style: none; padding: 0; margin: var(--sp-2) 0; }
.legend li { display: flex; gap: var(--sp-2); font-size: var(--fs-sm); line-height: 1.5; padding: 8px 0; border-bottom: 1px solid var(--line); }
.legend b { font-family: var(--font-display); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px;
  font-size: 14px; z-index: 70; max-width: 90%; text-align: center; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: rise .22s ease; }
.toast-btn { margin-left: 8px; background: var(--bg); color: var(--ink); border: none; border-radius: 999px;
  padding: 5px 13px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.toast-btn:active { transform: scale(.94); }

/* install banner: fixed at the BOTTOM on purpose (CLS) — beforeinstallprompt can
   fire well after first paint; out-of-flow means it only ever overlays. */
.banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
  background: var(--accent); color: var(--accent-ink); font-size: 14px; text-align: center;
  box-shadow: 0 -6px 18px -8px rgba(0,0,0,.35); }
.banner button { margin-left: 8px; background: var(--accent-ink); color: var(--accent); border: none; border-radius: 8px; padding: 6px 10px; font: inherit; font-weight: 600; cursor: pointer; }
.banner .close { background: transparent; color: var(--accent-ink); float: right; padding: 4px; }

@media (max-width: 480px) {
  .hero-clock { gap: 2px; }
  .clock-sep { padding: 0 1px; }
}
