/* =========================================================================
   Ask Gianfranco — a personal AI app
   Hand-authored. OKLCH throughout. Warm paper stage, deep clay-red accent.
   base.css: tokens, stage, device, statusbar, liveact, os-switch, sys glyphs,
   mood overlays, navind, reduced-motion block, per-OS chrome skins.
   ========================================================================= */

:root {
  --stage:        oklch(0.915 0.014 83);  /* warm ecru page */
  --surface:      oklch(0.975 0.006 86);  /* app screen, warm white */
  --surface-2:    oklch(0.948 0.011 80);  /* incoming bubbles, panels */
  --surface-3:    oklch(0.918 0.014 78);  /* chips, inputs */
  --line:         oklch(0.85 0.015 76);
  --line-soft:    oklch(0.90 0.012 78);

  --text:         oklch(0.28 0.018 52);   /* warm charcoal ink */
  --text-muted:   oklch(0.46 0.020 50);
  --text-faint:   oklch(0.55 0.018 52);

  /* ----------------------------------------------------- seeded accent ----
     --seed is the single hue source for the whole OS accent. Settings writes
     it (hue only; L/C stay 0.47/0.155). Every seed-derived token is declared
     TWICE: a literal clay-red first (the permanent fallback for browsers
     without relative-color support), then the relative-color version that
     follows --seed. Browsers that don't understand `oklch(from ...)` ignore
     the second declaration and keep clay-red — so theming degrades cleanly.
     Neutrals (--stage/--surface/--line/--text), --mint, glass, the island
     near-black and AI transient colors NEVER re-seed: paper identity + text
     contrast are guaranteed regardless of the chosen hue. */
  --seed:         oklch(0.47 0.155 33);   /* deep clay red — the OS accent seed */

  --accent:       oklch(0.47 0.155 33);   /* deep clay red, AA on paper (fallback) */
  --accent:       oklch(from var(--seed) l c h);
  --accent-strong:oklch(0.41 0.160 32);                                   /* fallback */
  --accent-strong:oklch(from var(--seed) calc(l - 0.06) calc(c + 0.005) h);
  --accent-ink:   oklch(0.975 0.012 80);  /* paper text on accent fills (fallback) */
  --accent-ink:   oklch(from var(--seed) 0.975 0.012 h);
  --accent-soft:  oklch(0.47 0.155 33 / 0.13);                            /* fallback */
  --accent-soft:  oklch(from var(--seed) l c h / 0.13);
  --accent-line:  oklch(0.47 0.155 33 / 0.32);                            /* fallback */
  --accent-line:  oklch(from var(--seed) l c h / 0.32);
  --mint:         oklch(0.58 0.135 150);  /* online dot, deepened for light — FIXED */

  /* status-bar adaptation tokens (consumed by .statusbar; default = warm paper
     chrome). Dark apps (e.g. Terminal, later phases) override these per
     `body[data-app=...]` to flip the bar's ink + fill without touching the
     global accent. */
  --statusbar-ink: var(--text);
  --statusbar-bg:  color-mix(in oklch, var(--surface) 82%, transparent);

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-ui:      "Schibsted Grotesk", system-ui, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, "SF Mono", monospace;
  --font-label:   "Schibsted Grotesk", system-ui, sans-serif; /* labels: sans, not mono */

  --ease:         cubic-bezier(0.16, 1, 0.3, 1);
  --col:          min(460px, 100vw);

  /* ---- device tier tokens ------------------------------------------------
     Three tiers replace the old phone→floated-phone split:
       phone   (≤739px): full-bleed, --dev-w = --col.
       float   (740–1023px): phone floats centered with full chrome.
       tablet  (≥1024px): the device becomes a landscape tablet.
     --dev-w is the single source of the device's rendered width; the stage
     wordmark + OS switch calc their gutters off it (was hard-coded to --col).
     Tablet dims are clamped so the chrome NEVER overflows the viewport. */
  --dev-w:        var(--col);
  /* gutters (≥180px each) hold the wordmark + OS switch without overflow.
     wider windows cap at 1100px so the tablet stays a believable size. */
  --tablet-w:     min(1100px, calc(100vw - 360px));
  /* height clamps: fits the viewport AND stays landscape — capped to 0.75× the
     width (never taller than a 4:3 tablet), so a narrow-tall window can't make
     the device read square. */
  --tablet-h:     min(760px, calc(100dvh - 48px), calc(var(--tablet-w) * 0.75));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-ui);
  background: var(--stage);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--accent-soft); color: var(--text); }

a { color: inherit; }

/* ----------------------------------------------------------------- stage */

.stage-grain,
.stage-glow { position: fixed; pointer-events: none; z-index: 0; }

/* a faint warm wash at the top of the paper, nothing more */
.stage-glow {
  inset: 0;
  background: radial-gradient(72vw 44vw at 50% -8%, oklch(0.72 0.07 45 / 0.12), transparent 60%);
  transition: opacity 1.2s var(--ease);
}

/* oversized faint wordmark grounding the tablet stage (hidden on phones/float).
   The left gutter is tall + narrow, so the mark reads VERTICALLY (rotated,
   bottom-to-top) — a clean editorial device that fits the gutter without any
   mid-letter crop. Anchored to the left edge, vertically centered. */
.stage-mark { display: none; }
@media (min-width: 1024px) {
  .stage-mark {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    top: 50%;
    /* sit in the middle of the left gutter (half the gutter width from the edge) */
    left: calc((100vw - var(--dev-w)) / 4);
    transform: translate(-50%, -50%) rotate(-90deg);
    transform-origin: center;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 0.5ch;
    font-family: var(--font-display);
    font-weight: 800;
    /* sized off viewport height (the axis the rotated text runs along), clamped
       so the two words never exceed the device height. */
    font-size: clamp(2.6rem, 6vh, 4.4rem);
    line-height: 1;
    letter-spacing: -0.03em;
    color: oklch(0.30 0.02 50 / 0.08);
    white-space: nowrap;
  }
  .stage-mark span:last-child { opacity: 0.62; }
}

/* subtle paper tooth */
.stage-grain {
  inset: 0;
  opacity: 0.32;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
}

/* -------------------------------------- story mood: emotional temperature */
/* Overlays crossfade per story beat to shift the paper's temperature
   (Phillips arc). Subtle on light; opacity-only transitions keep it cheap. */
.mood { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0; }
.mood-cool {
  background: radial-gradient(62vw 50vw at 50% -6%, oklch(0.62 0.05 242 / 0.13), transparent 62%);
  transition: opacity 1.2s var(--ease);
}
.mood-dim {
  background: oklch(0.55 0.012 60 / 0.12);
  mix-blend-mode: multiply;
  transition: opacity 1.3s var(--ease);
}
.mood-bloom {
  background: radial-gradient(72vw 50vw at 50% -6%, oklch(0.62 0.13 40 / 0.15), transparent 62%);
  transition: opacity 1.2s var(--ease);
}

body[data-mood="challenge"] .mood-cool { opacity: 1; }
body[data-mood="challenge"] .stage-glow { opacity: 0.4; }
body[data-mood="peak"] .mood-bloom { opacity: 0.55; }
body[data-mood="setback"] .mood-dim { opacity: 1; }
body[data-mood="setback"] .mood-cool { opacity: 0.4; }
body[data-mood="setback"] .stage-glow { opacity: 0.3; }
body[data-mood="payoff"] .mood-bloom { opacity: 1; animation: bloom 1.6s var(--ease); }
body[data-mood="payoff"] .stage-glow { opacity: 1; }

@keyframes bloom {
  0% { opacity: 0; transform: scale(0.97); }
  45% { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}

/* the device surface also takes the temperature, so mood reads on mobile */
.device { transition: background-color 1.3s var(--ease); }
body[data-mood="challenge"] .device { background: oklch(0.965 0.006 92); }
body[data-mood="setback"] .device { background: oklch(0.945 0.007 72); }
body[data-mood="payoff"] .device { background: oklch(0.978 0.011 82); }

/* ---------------------------------------------------------------- device */

.device {
  position: relative;
  z-index: 1;
  width: var(--dev-w);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  /* @container source for app CSS (later wave) — two-pane tablet layouts.
     inline-size (not size) so it does not affect the absolute screens' block
     sizing or the View Transition capture. */
  container-type: inline-size;
  container-name: device;
  box-shadow:
    0 0 0 1px var(--line),
    0 2rem 4.5rem -2rem oklch(0.4 0.03 50 / 0.28);
}

/* ------------------------------------------------------------- statusbar */

.statusbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: max(0.7rem, env(safe-area-inset-top)) 1.25rem 0.7rem;
  color: var(--statusbar-ink);
  background: var(--statusbar-bg);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line-soft);
}
.statusbar__time {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
/* Android clocks sit lighter and a touch smaller than iOS */
body[data-os="android"] .statusbar__time { font-weight: 500; font-size: 0.84rem; letter-spacing: 0; }
.statusbar__app {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.statusbar__sys { justify-self: end; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--statusbar-ink); }
.statusbar__sys svg { fill: currentColor; }
/* per-OS status glyph clusters: only the active platform's set shows */
.sys { display: none; align-items: center; gap: 0.42rem; }
.sys--android { gap: 0.32rem; }
body[data-os="ios"] .sys--ios { display: inline-flex; }
body[data-os="android"] .sys--android { display: inline-flex; }
.sys-pct { font-family: var(--font-ui); font-weight: 600; font-size: 0.74rem; letter-spacing: -0.02em; color: currentColor; }

/* clock + (tablet-only) date cluster at the leading edge */
.statusbar__lead { justify-self: start; display: inline-flex; align-items: baseline; gap: 0.5rem; }
.statusbar__date { display: none; font-family: var(--font-ui); font-size: 0.82rem; font-weight: 500; color: var(--statusbar-ink); opacity: 0.72; letter-spacing: -0.01em; }

/* =========================================================================
   TABLET STATUS BAR (≥1024px)
   iPad has no Dynamic Island: clock + date lead-left, wifi/battery trail-right,
   the Live Activity pill relocates into the right cluster (iPadOS-style). The
   center island slot is emptied. Android tablet keeps clock left, icons right,
   Live Update chip near center-right.
   ========================================================================= */
@media (min-width: 1024px) {
  .statusbar {
    grid-template-columns: auto 1fr auto auto;
    column-gap: 0.9rem;
    padding-inline: 1.6rem;
  }
  .statusbar__lead { grid-column: 1; gap: 0.6rem; }
  /* iPadOS status bar: clock + date lead the left edge. The date sits a hair
     lighter than the clock (regular vs semibold) so the pair reads as real
     iPadOS chrome, not two equal-weight labels. */
  .statusbar__date { display: inline; font-weight: 500; opacity: 0.66; }
  body[data-os="ios"] .statusbar__date { font-weight: 400; }
  /* the Live Activity + system glyphs pack together on the trailing edge */
  .liveact { justify-self: end; grid-column: 3; }
  .statusbar__sys { grid-column: 4; }

  /* iPadOS Live Activity: a clean rounded pill (NOT the phone Dynamic Island).
     Drop the TrueDepth sensor cutout + lead/trail island segments. */
  body[data-os="ios"] .statusbar .liveact {
    width: auto;
    max-width: 12rem;
    height: 1.85rem;
    color: var(--statusbar-ink);
  }
  /* .statusbar prefix raises specificity above the phone Dynamic Island rules
     in the fidelity section (which are later in source order). */
  body[data-os="ios"] .statusbar .liveact::before { display: none; } /* no island sensor */
  body[data-os="ios"] .statusbar .liveact__goo { display: block; }
  body[data-os="ios"] .statusbar .liveact__bg {
    background: color-mix(in oklch, var(--surface) 68%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
            backdrop-filter: blur(16px) saturate(1.6);
    border: 1px solid var(--glass-stroke);
    border-radius: 1.1rem;
  }
  body[data-os="ios"] .statusbar .liveact__content {
    position: relative;
    inset: auto;
    display: inline-flex;
    padding: 0 0.66rem;
    gap: 0.42rem;
  }
  body[data-os="ios"] .statusbar .liveact__lead,
  body[data-os="ios"] .statusbar .liveact__trail {
    position: static;
    transform: none;
    width: auto; height: auto;
    background: none;
    box-shadow: none;
    color: inherit;
  }
  body[data-os="ios"] .statusbar .liveact__text { display: inline-flex; }
  body[data-os="ios"] .statusbar .liveact__title { font-size: 0.76rem; }
  body[data-os="ios"] .statusbar .liveact--progress .liveact__ring { width: 1.05rem; height: 1.05rem; }
  body[data-os="ios"] .statusbar .liveact--progress .liveact__ringtrack { stroke: color-mix(in oklch, var(--statusbar-ink) 30%, transparent); }
}

/* story progress: a hairline that fills as the narrative advances */
.story-progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--line-soft);
  overflow: hidden;
}
.story-progress__fill {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.9s var(--ease);
  box-shadow: 0 0 0.6rem var(--accent);
}

.dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; display: inline-block; }
.dot--live {
  background: var(--mint);
  box-shadow: 0 0 0 0 oklch(0.58 0.135 150 / 0.5);
  animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 oklch(0.58 0.135 150 / 0.45); }
  70%  { box-shadow: 0 0 0 0.5rem oklch(0.58 0.135 150 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.58 0.135 150 / 0); }
}

/* ------------------------------------------------------- reveal & motion */

.reveal { opacity: 0; transform: translateY(1.2rem); }
.reveal.in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }

/* =========================================================================
   DEVICE TIERS
   phone (≤739): full-bleed (base rules above).
   float (740–1023): the phone floats centered, full chrome + comfortable
     margins, stage wallpaper visible around it.
   tablet (≥1024): the device becomes a landscape tablet (the headline). Width
     and height are clamped so the chrome never overflows at any window size.
   ========================================================================= */

/* ---- float tier: 740–1023px -------------------------------------------- */
@media (min-width: 740px) {
  body { padding: 3vh 0; align-items: center; }
  .device {
    width: var(--dev-w);
    height: min(880px, calc(100dvh - 6vh));
    min-height: min(680px, calc(100dvh - 6vh));
    margin: auto;
    overflow: clip;
    max-height: none;
    /* soft paper-cradle: a light bezel ring plus a long warm shadow */
    box-shadow:
      0 0 0 1px var(--line),
      0 0 0 0.5rem oklch(0.97 0.006 86),
      0 0 0 0.55rem var(--line),
      0 2.5rem 5.5rem -1.5rem oklch(0.4 0.03 50 / 0.32);
  }
  /* the per-screen scroller (.app-body) owns scrolling now, not .thread */
  .statusbar { border-radius: var(--radius-device) var(--radius-device) 0 0; }
}

/* ---- tablet tier: ≥1024px ---------------------------------------------- */
@media (min-width: 1024px) {
  body { padding: 24px 0; align-items: center; }
  :root { --dev-w: var(--tablet-w); }
  .device {
    width: var(--tablet-w);
    height: var(--tablet-h);
    min-height: 0;
    /* landscape tablet: iPad ≈ 2.2rem, Android tablet ≈ 1.6rem (set per-OS) */
    border-radius: var(--radius-tablet);
  }
  .statusbar { border-radius: var(--radius-tablet) var(--radius-tablet) 0 0; }
}

/* very small phones */
@media (max-width: 360px) {
  .thread { padding-inline: 0.9rem; }
  .bubble { font-size: 0.95rem; }
}

/* =========================================================================
   OS-FEATURE LAYER (overdrive)
   The device behaves like a real OS; each story beat fires a native feature
   of the selected platform. Chrome only: the chat content and the clay-red
   brand are untouched. Skinned by body[data-os="ios" | "android"].
   ========================================================================= */

/* ---- Material You tonal palette, seeded from --seed (authentic dynamic color)
   The whole tonal palette is generated from ONE hue (the seed). Each token
   keeps its hand-tuned L/C; only the hue follows --seed — this is exactly the
   Material You mechanic (a tonal palette derived from a single source color),
   so dragging the hue slider in Settings re-tints every Android surface live.
   Declared as a fallback pair (literal clay-red first, relative second) so
   non-supporting browsers keep the original clay palette. Applied to Android
   chrome only. The neutral surfaces carry a faint seed tint by design (Material
   surfaces are tinted toward the source color). */
body[data-os="android"] {
  --m3-primary:               oklch(0.47 0.155 33);                /* fallback */
  --m3-primary:               oklch(from var(--seed) 0.47 0.155 h);
  --m3-on-primary:            oklch(0.985 0.010 80);               /* fallback */
  --m3-on-primary:            oklch(from var(--seed) 0.985 0.010 h);
  --m3-primary-container:     oklch(0.885 0.052 42);              /* fallback */
  --m3-primary-container:     oklch(from var(--seed) 0.885 0.052 h);
  --m3-on-primary-container:  oklch(0.33 0.100 33);               /* fallback */
  --m3-on-primary-container:  oklch(from var(--seed) 0.33 0.100 h);
  /* Secondary container: M3's secondary tonal palette is the same source hue
     at much lower chroma (a muted sibling, not a re-hue) — same L as primary
     container so it sits at an equivalent tone, chroma cut ~45%. */
  --m3-secondary-container:   oklch(0.885 0.028 42);              /* fallback */
  --m3-secondary-container:   oklch(from var(--seed) 0.885 0.028 h);
  --m3-surface:               oklch(0.975 0.006 70);              /* fallback */
  --m3-surface:               oklch(from var(--seed) 0.975 0.006 h);
  --m3-surface-container:     oklch(0.945 0.013 58);              /* fallback */
  --m3-surface-container:     oklch(from var(--seed) 0.945 0.013 h);
  --m3-surface-container-hi:  oklch(0.915 0.016 52);              /* fallback */
  --m3-surface-container-hi:  oklch(from var(--seed) 0.915 0.016 h);
  --m3-outline:               oklch(0.78 0.020 58);               /* fallback */
  --m3-outline:               oklch(from var(--seed) 0.78 0.020 h);

  /* Android wears Roboto for UI + labels — the single strongest "different
     OS" signal there is. Display (Bricolage) stays brand on both platforms. */
  --font-ui:    "Roboto", system-ui, sans-serif;
  --font-label: "Roboto", system-ui, sans-serif;
}
body[data-os="android"] .device { background: oklch(0.972 0.009 64); }

/* Android status bar: flat Material surface — no iOS glass blur, no hairline.
   Keeps the per-app --statusbar-bg tints (Maps blue, Ledger green, Terminal
   dark); only the treatment changes. */
body[data-os="android"] .statusbar {
  -webkit-backdrop-filter: none;
          backdrop-filter: none;
  border-bottom-color: transparent;
}

/* ------------------------------------------------------------- os-switch */
.os-switch {
  --switch-pad: 0.18rem;
  --switch-gap: 0.1rem;
  --switch-row: 2.75rem;
  position: relative;
  align-self: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--switch-gap);
  margin: 0 auto 0.5rem;
  padding: var(--switch-pad);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-label);
}
.os-switch__btn {
  position: relative;
  z-index: 1;
  flex: 1 1 0;              /* equal columns so the thumb aligns under either */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.34rem;
  min-width: 5.2rem;
  min-height: var(--switch-row);
  padding: 0.32rem 0.85rem;
  border: none;
  background: none;
  border-radius: 2rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.3s var(--ease);
}
.os-switch__btn[aria-pressed="true"] { color: var(--text); }
.os-switch__btn:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.os-switch__glyph { opacity: 0.9; }
.os-switch__thumb {
  position: absolute;
  z-index: 0;
  top: var(--switch-pad); bottom: var(--switch-pad); left: var(--switch-pad);
  width: calc((100% - (var(--switch-pad) * 2) - var(--switch-gap)) / 2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 0.2rem 0.5rem -0.25rem oklch(0.4 0.03 50 / 0.3);
  transition: transform 0.42s var(--ease);
}
body[data-os="android"] .os-switch__thumb { transform: translateX(calc(100% + var(--switch-gap))); }

/* desktop: lift the STAGE selector out of the phone, onto the stage (mirrors the
   wordmark on the left). Stacks vertically; the thumb slides top/bottom. Scoped
   to .os-switch--stage so the relocated Settings instance keeps its compact
   horizontal segmented look on desktop too. */
@media (min-width: 1024px) {
  .os-switch--stage {
    --switch-pad: 0.3rem;
    --switch-gap: 0.28rem;
    --switch-row: 2.85rem;
    position: fixed;
    z-index: 6;
    top: 50%;
    left: calc(50% + var(--dev-w) / 2 + 1.4vw);
    transform: translateY(-50%);
    margin: 0;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, var(--switch-row));
    gap: var(--switch-gap);
    width: 9.6rem;
    min-width: 0;
    overflow: hidden;
    padding: var(--switch-pad);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 1.4rem;
    box-shadow: 0 0.6rem 1.6rem -0.5rem oklch(0.35 0.03 50 / 0.4);
  }
  .os-switch--stage .os-switch__btn {
    width: 100%;
    justify-content: flex-start;
    gap: 0.5rem;
    padding-inline: 0.85rem;
    border-radius: 1.05rem;
  }
  .os-switch--stage .os-switch__glyph { width: 15px; height: 15px; }
  .os-switch--stage .os-switch__btn:focus-visible { outline-offset: -3px; }
  /* a clean sliding thumb: equal-height row, slides top→bottom */
  .os-switch--stage .os-switch__thumb {
    top: var(--switch-pad);
    left: var(--switch-pad);
    right: var(--switch-pad);
    bottom: auto;
    width: auto;
    height: var(--switch-row);
    border: 1px solid var(--line);
    border-radius: 1.05rem;
    transition: transform 0.42s var(--ease);
  }
  body[data-os="android"] .os-switch--stage .os-switch__thumb {
    transform: translateY(calc(var(--switch-row) + var(--switch-gap)));
    border-radius: 1.05rem;
  }
}

/* =========================================================================
   Live Activity: iOS Dynamic Island / Android Live Update status chip
   ========================================================================= */
.liveact {
  position: relative;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  height: 1.9rem;
  max-width: min(72vw, 320px);
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.liveact__goo { position: absolute; inset: 0; z-index: 0; }
.liveact__bg {
  position: absolute; inset: 0;
  border-radius: 1.2rem;
  transition: background 0.45s var(--ease), border-radius 0.45s var(--ease);
  touch-action: manipulation;
}
.liveact:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 4px; }
.liveact__blob {
  position: absolute; top: 50%; left: 0;
  width: 1.2rem; height: 1.2rem;
  border-radius: 50%;
  transform: translate(-30%, -50%) scale(0);
  opacity: 0;
}
.liveact__content {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 0.42rem;
  height: 100%; padding: 0 0.72rem;
  white-space: nowrap;
}
.liveact__lead { display: inline-flex; align-items: center; }
.liveact__dot { width: 0.5rem; height: 0.5rem; }
.liveact__ic { display: none; }
.liveact__text { display: inline-flex; flex-direction: column; justify-content: center; line-height: 1.05; min-width: 0; }
.liveact__title { font-weight: 600; font-size: 0.8rem; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; }
.liveact__sub { font-family: var(--font-label); font-size: 0.64rem; opacity: 0.82; overflow: hidden; text-overflow: ellipsis; }
.liveact__trail { display: inline-flex; align-items: center; }
.liveact__ring { display: none; }
.liveact__ringtrack { stroke: currentColor; opacity: 0.28; }
.liveact__ringfill {
  stroke: var(--accent);
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--prog, 0) * 100);
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.85s var(--ease);
}
.liveact__bar { display: none; width: 2.4rem; height: 0.32rem; border-radius: 1rem; background: currentColor; opacity: 0.3; overflow: hidden; }
.liveact__barfill { display: block; height: 100%; width: calc(var(--prog, 0) * 100%); background: var(--accent); border-radius: inherit; transition: width 0.85s var(--ease); }

/* discovery-mode disclosure cue: a small chevron hinting the chip expands.
   Only shown in discovery mode (`liveact--discover`), decorative, subtle. It
   rotates 180deg while the card is open so the affordance reads as a toggle. */
.liveact__disclose { display: none; align-items: center; margin-left: 0.06rem; opacity: 0.62; }
.liveact--discover .liveact__disclose { display: inline-flex; }
.liveact__chev { transition: transform 0.32s var(--ease); }
.liveact--discover.liveact--expanded .liveact__chev { transform: rotate(180deg); }

/* progress mode: glyph + progress replace the simple app dot */
.liveact--progress .liveact__dot { display: none; }
.liveact--progress .liveact__ic  { display: inline-flex; }
.liveact--progress .liveact__sub { display: inline; }

/* ---- discovery segmented arc ------------------------------------------------
   The collapsed discovery tracker reads as a deliberate 6-tick ring that fills
   as apps are visited — NOT a stray reload glyph. In discovery mode the arc
   replaces the circular-arrow icon (the arrow stays for Messages story beats).
   The count ("N/6") still rides alongside in .liveact__title. */
.liveact__seg { display: none; align-items: center; justify-content: center; }
.liveact--discover .liveact__seg { display: inline-flex; }
.liveact--discover .liveact__ic  { display: none; }        /* arc supplants the arrow */
/* discovery has no separate ring/bar — the arc IS the progress read */
.liveact--discover .liveact__ring,
.liveact--discover .liveact__bar { display: none !important; }
.liveact__segg { opacity: 1; }
.liveact__segd {
  opacity: 0.32;
  transition: opacity 0.4s var(--ease), stroke 0.4s var(--ease);
}
.liveact__segd--on {
  opacity: 1;
  stroke: var(--accent);
}

/* iOS Dynamic Island skin */
body[data-os="ios"] .liveact { color: oklch(0.97 0.005 80); }
body[data-os="ios"] .liveact__goo { filter: url(#goo); }
body[data-os="ios"] .liveact__bg,
body[data-os="ios"] .liveact__blob { background: oklch(0.16 0.010 60); }
body[data-os="ios"] .liveact__ringtrack { stroke: oklch(0.55 0.01 60); }
body[data-os="ios"] .liveact--progress .liveact__ring { display: inline-block; }

/* Android Live Update status chip skin */
body[data-os="android"] .liveact { color: var(--m3-on-primary-container); height: 1.72rem; }
body[data-os="android"] .liveact__goo { filter: none; }
body[data-os="android"] .liveact__bg { background: var(--m3-primary-container); border-radius: 0.95rem; }
body[data-os="android"] .liveact__blob { display: none; }
body[data-os="android"] .liveact--progress .liveact__bar { display: inline-block; }

/* wake (hero): the activity comes alive */
@keyframes liveact-wake {
  0% { transform: scale(0.55); opacity: 0; }
  55% { opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.liveact--wake .liveact__goo { animation: liveact-wake 0.7s var(--ease); transform-origin: center; }

/* iOS goo: a blob detaches and re-merges when the state updates */
@keyframes liveact-pop {
  0%   { transform: translate(-20%, -50%) scale(0); }
  45%  { transform: translate(-135%, -50%) scale(1); }
  100% { transform: translate(-20%, -50%) scale(0); }
}
body[data-os="ios"] .liveact--pulse .liveact__blob { opacity: 1; animation: liveact-pop 0.7s var(--ease); }

/* expanded (build beat): a detail card spawns from the island/status chip */
.liveact__expand {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 50%;
  width: min(80vw, 320px);
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-radius: 1.15rem;
  opacity: 0;
  transform: translateX(-50%) translateY(-0.4rem) scale(0.96);
  transform-origin: top center;
  pointer-events: none;
  z-index: 60;     /* above app-screen (30) + navind (40); shell layering */
  transition: opacity 0.35s var(--ease), transform 0.42s var(--ease);
}
.liveact--expanded .liveact__expand {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  pointer-events: auto;
}
body[data-os="ios"] .liveact__expand { background: oklch(0.16 0.010 60); color: oklch(0.96 0.005 80); box-shadow: 0 1rem 2.4rem -0.8rem oklch(0 0 0 / 0.6); }
body[data-os="android"] .liveact__expand { background: var(--m3-surface-container-hi); color: var(--text); border: 1px solid var(--m3-outline); box-shadow: 0 0.8rem 2rem -0.8rem oklch(0.3 0.03 50 / 0.4); }
.liveact__ehead { font-family: var(--font-label); font-size: 0.64rem; opacity: 0.7; margin-bottom: 0.45rem; display: flex; justify-content: space-between; align-items: center; }
/* explicit close affordance in the expand card (never leave it stuck open) */
.liveact__eclose {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  margin: -0.2rem -0.15rem -0.2rem 0;
  border-radius: 50%;
  font-size: 0.7rem;
  line-height: 1;
  opacity: 0.75;
  cursor: pointer;
  background: color-mix(in oklch, currentColor 12%, transparent);
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease);
}
.liveact__eclose:hover { opacity: 1; background: color-mix(in oklch, currentColor 22%, transparent); }
.liveact__eclose:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; opacity: 1; }
/* discovery checklist rows: each app wears its real mini tile (shared
   .minitile family). Visited rows sit in full color with a small check;
   unvisited ones wait in grayscale — no hairline-per-row noise. */
.liveact__elist { display: flex; flex-direction: column; gap: 0.12rem; margin: 0 -0.2rem; }
.liveact__erow {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.24rem 0.2rem;
  font-size: 0.8rem;
}
.liveact__etile { width: 1.45rem; height: 1.45rem; }
.liveact__etile svg { width: 58%; height: 58%; }
.liveact__ev {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.liveact__erow:not(.liveact__erow--done) .liveact__etile { filter: grayscale(1); opacity: 0.38; }
.liveact__erow:not(.liveact__erow--done) .liveact__ev { opacity: 0.55; font-weight: 500; }
.liveact__echeck {
  margin-left: auto;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: color-mix(in oklch, currentColor 13%, transparent);
}
/* completion payoff: a real button that launches Notes from the card */
.liveact__enotes {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.42rem 0.5rem;
  border: none;
  border-radius: 0.85rem;
  font: inherit;
  font-size: 0.8rem;
  color: inherit;
  text-align: left;
  background: color-mix(in oklch, currentColor 9%, transparent);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.liveact__enotes:hover { background: color-mix(in oklch, currentColor 15%, transparent); }
.liveact__enotes:active { background: color-mix(in oklch, currentColor 19%, transparent); }
.liveact__enotes:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.liveact__echev { margin-left: auto; flex: 0 0 auto; opacity: 0.6; }

/* Focus / Do Not Disturb (setback) */
body.is-focus .mood-dim { opacity: 1; }
body.is-focus .device { filter: saturate(0.9) brightness(0.985); transition: filter 0.9s var(--ease); }
.sysfocus { display: inline-flex; align-items: center; color: var(--text-muted); }
.sysfocus svg { width: 0.95rem; height: 0.95rem; }

/* =========================================================================
   OS FIDELITY PASS
   Liquid Glass (iOS 26) vs Material 3 Expressive (Android): translucent
   refractive chrome for iOS, tonal springy surfaces for Android. Plus a
   per-OS wallpaper that crossfades on switch, gesture-nav indicators, and
   platform corner radii.
   ========================================================================= */

/* ---- per-OS design tokens ---------------------------------------------- */
body[data-os="ios"] {
  --glass-bg:     oklch(0.985 0.006 250 / 0.5);
  --glass-stroke: oklch(1 0 0 / 0.55);
  --glass-hi:     oklch(1 0 0 / 0.7);
  --glass-shadow: 0 0.7rem 2rem -0.7rem oklch(0.32 0.04 255 / 0.4);
  --radius-device: 3rem;   /* floating phone corner */
  --radius-tablet: 2.2rem; /* iPad uniform corner */
}
body[data-os="android"] {
  --radius-device: 2rem;
  --radius-tablet: 1.6rem; /* Android tablet corner */
}

/* ---- per-OS wallpaper behind the phone (animated crossfade) ------------- */
.stage-os { position: fixed; inset: 0; z-index: 0; opacity: 0; pointer-events: none; transition: opacity 0.8s var(--ease); }
/* Richer, layered stage moods — clearly cool (iOS) vs warm (Android), still
   calm and light on warm paper. Multiple soft blooms give depth; a faint mid
   field follows --seed so re-seeding re-tints the stage live without breaking
   the cool/warm identity. No dark theme, no purple-teal slop. */
.stage-os--ios {
  background:
    radial-gradient(78vw 62vh at 84% -14%, oklch(0.9 0.094 250 / 0.78), transparent 58%),
    radial-gradient(72vw 60vh at 2% 118%, oklch(0.89 0.076 208 / 0.68), transparent 56%),
    radial-gradient(56vw 52vh at 46% 44%, oklch(from var(--seed) 0.93 0.04 calc(h + 195) / 0.32), transparent 62%),
    linear-gradient(158deg, oklch(0.952 0.024 250), oklch(0.922 0.034 272) 54%, oklch(0.94 0.026 236));
}
/* one soft, large-scale blurred shape adds depth without leaving the light
   paper world (no dark, no glow, no purple-teal). Cool-blue for iOS. Placed on
   a pseudo so it layers over the gradient fields. */
.stage-os--ios::after {
  content: "";
  position: absolute;
  width: 46vw; height: 46vw;
  right: 6vw; top: 8vh;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, oklch(0.9 0.088 246 / 0.5), transparent 68%);
  filter: blur(42px);
}
/* Android wallpaper is the warm/clay one — it follows the seed hue (stops fan
   around the seed to keep the gradient's tonal spread). iOS's cool-blue
   wallpaper above is FIXED art direction and never re-seeds.
   Fallback pair: literal clay hues first, relative (seed-following) second. */
.stage-os--android {
  background:
    radial-gradient(80vw 64vh at 88% -10%, oklch(0.88 0.122 46 / 0.76), transparent 56%),
    radial-gradient(74vw 60vh at 0% 112%, oklch(0.89 0.1 78 / 0.66), transparent 56%),
    radial-gradient(56vw 50vh at 44% 42%, oklch(0.92 0.066 30 / 0.36), transparent 62%),
    linear-gradient(158deg, oklch(0.932 0.044 60), oklch(0.914 0.038 40) 54%, oklch(0.928 0.04 24));
  background:
    radial-gradient(80vw 64vh at 88% -10%, oklch(from var(--seed) 0.88 0.122 calc(h + 13) / 0.76), transparent 56%),
    radial-gradient(74vw 60vh at 0% 112%, oklch(from var(--seed) 0.89 0.1 calc(h + 45) / 0.66), transparent 56%),
    radial-gradient(56vw 50vh at 44% 42%, oklch(from var(--seed) 0.92 0.066 calc(h - 3) / 0.36), transparent 62%),
    linear-gradient(158deg, oklch(from var(--seed) 0.932 0.044 calc(h + 27)), oklch(from var(--seed) 0.914 0.038 calc(h + 7)) 54%, oklch(from var(--seed) 0.928 0.04 calc(h - 9)));
}
/* Android soft depth shape — warm/clay, seed-following (literal fallback then
   relative), staying light. Anchored bottom-left to counter the iOS shape's
   top-right so the two moods stay visibly distinct. */
.stage-os--android::after {
  content: "";
  position: absolute;
  width: 48vw; height: 48vw;
  left: 4vw; bottom: 6vh;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, oklch(0.89 0.108 52 / 0.5), transparent 68%);
  background: radial-gradient(circle at 50% 50%, oklch(from var(--seed) 0.89 0.108 calc(h + 19) / 0.5), transparent 68%);
  filter: blur(44px);
}
body[data-os="ios"] .stage-os--ios { opacity: 1; }
body[data-os="android"] .stage-os--android { opacity: 1; }
/* dial back the warm grain so the OS wallpaper reads */
.stage-grain { opacity: 0.12; }

/* ---- device: platform corner radius + smooth morph on switch ----------- */
.device { transition: background-color 1.3s var(--ease), border-radius 0.6s var(--ease); }
@media (min-width: 740px) {
  .device { border-radius: var(--radius-device); }
  .statusbar { border-radius: var(--radius-device) var(--radius-device) 0 0; }
}
@media (min-width: 1024px) {
  .device { border-radius: var(--radius-tablet); }
  .statusbar { border-radius: var(--radius-tablet) var(--radius-tablet) 0 0; }
}

/* ---- gesture nav indicator: iOS home bar / Android handle ----------------
   The .navind interactive styling lives in shell.css now (it is a working Home
   control, moved out of the composer to device level). The per-OS handle look
   is defined there too. */

/* ---- composer: Liquid Glass (iOS) / Material surface (Android) ---------- */
/* The glass lives on a ::before layer, NOT the composer itself: a
   backdrop-filter on .composer would make it a containing block and trap the
   fixed desktop OS-switch inside it. The pseudo keeps the composer filter-free. */
.composer { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.composer::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-top: 1px solid transparent;
  transition: background 0.6s var(--ease), border-color 0.6s var(--ease);
}
body[data-os="ios"] .composer::before {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(1.8);
          backdrop-filter: blur(22px) saturate(1.8);
  border-top: 1px solid var(--glass-stroke);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
body[data-os="android"] .composer::before {
  background: color-mix(in oklch, var(--m3-surface-container) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  border-top: 1px solid var(--m3-outline);
}

/* ---- suggest chips: scroll-snap + platform skins ----------------------- */
.suggest { scroll-snap-type: x proximity; }
.chip { scroll-snap-align: center; transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease); }
body[data-os="ios"] .chip {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
          backdrop-filter: blur(14px) saturate(1.6);
  border: 1px solid var(--glass-stroke);
}
body[data-os="android"] .chip { background: var(--m3-surface-container-hi); border-color: transparent; border-radius: 1.25rem; }
body[data-os="android"] .chip:hover { background: var(--m3-primary-container); transform: none; }

/* ---- Live Activity polish ---------------------------------------------- */
/* iOS compact Live Activities live around the TrueDepth camera, not inside it.
   The center sensor stays blank; compact leading/trailing carry the state. */
body[data-os="ios"] .liveact {
  width: 10.3rem;
  max-width: none;
  height: 2rem;
}
body[data-os="ios"] .liveact::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 4.7rem;
  height: 1.48rem;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: oklch(0.10 0.006 60);
  box-shadow: inset 0 0.04rem 0 oklch(1 0 0 / 0.05), 0 0.18rem 0.45rem -0.18rem oklch(0 0 0 / 0.9);
}
body[data-os="ios"] .liveact__goo { display: none; }
body[data-os="ios"] .liveact__content {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  padding: 0;
}
body[data-os="ios"] .liveact__text { display: none; }
body[data-os="ios"] .liveact__lead,
body[data-os="ios"] .liveact__trail {
  position: absolute;
  top: 50%;
  height: 1.48rem;
  border-radius: 999px;
  transform: translateY(-50%);
  background: oklch(0.10 0.006 60);
  color: oklch(0.97 0.005 80);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0.04rem 0 oklch(1 0 0 / 0.05), 0 0.18rem 0.45rem -0.18rem oklch(0 0 0 / 0.9);
}
body[data-os="ios"] .liveact__lead {
  left: 0.14rem;
  width: 2.08rem;
}
body[data-os="ios"] .liveact__trail {
  right: 0.14rem;
  width: 2.32rem;
}
body[data-os="ios"] .liveact__trail[hidden] { display: none !important; }
/* iOS: seat the disclosure chevron in the blank camera zone, just inboard of
   the trailing pill (content is absolutely positioned, so place it explicitly). */
body[data-os="ios"] .liveact--discover .liveact__disclose {
  position: absolute;
  top: 50%;
  right: 0.5rem;         /* trailing ring pill is hidden in discovery: sit near the edge */
  transform: translateY(-50%);
  margin: 0;
}
body[data-os="ios"] .liveact--discover.liveact--expanded .liveact__chev { transform: rotate(180deg); }
body[data-os="ios"] .liveact--progress .liveact__ic {
  display: inline-flex;
  width: 0.92rem;
  height: 0.92rem;
}
/* discovery wins over progress at equal os-scoped specificity: arc, not arrow */
body[data-os="ios"] .liveact--discover .liveact__ic { display: none; }
body[data-os="ios"] .liveact--progress .liveact__ring {
  display: block;
  width: 1.08rem;
  height: 1.08rem;
}
/* iOS island, discovery mode: the segmented arc rides in the LEAD pill and IS
   the progress read, so the trailing ring pill is redundant — hide it and let
   the leading-only compact Live Activity carry the tracker (a valid island
   layout). The count stays in the pill's aria-label. */
body[data-os="ios"] .liveact--discover .liveact__seg {
  display: inline-flex;
  width: 1.02rem;
  height: 1.02rem;
}
body[data-os="ios"] .liveact--discover .liveact__seg svg { width: 100%; height: 100%; }
body[data-os="ios"] .liveact--discover .liveact__trail { display: none !important; }
body[data-os="ios"] .liveact--wake::before,
body[data-os="ios"] .liveact--wake .liveact__lead,
body[data-os="ios"] .liveact--wake .liveact__trail {
  animation: liveact-wake 0.7s var(--ease);
}
body[data-os="ios"] .liveact--pulse .liveact__lead {
  animation: island-nudge 0.64s var(--ease);
}
@keyframes island-nudge {
  0%, 100% { transform: translateY(-50%) scale(1); }
  42% { transform: translateY(-50%) translateX(-0.16rem) scale(1.06); }
}

/* Android uses the platform's promoted Live Update status chip pattern:
   short critical text in the status bar, fuller context in the card. */
body[data-os="android"] .liveact {
  height: 1.58rem;
  max-width: 6rem;
}
body[data-os="android"] .liveact__content {
  gap: 0.28rem;
  padding: 0 0.48rem;
}
body[data-os="android"] .liveact__text {
  display: inline-flex;
  min-width: 0;
}
body[data-os="android"] .liveact__title {
  max-width: 2.25rem;
  font-size: 0.72rem;
  line-height: 1;
}
body[data-os="android"] .liveact__sub { display: none !important; }
body[data-os="android"] .liveact__ic {
  width: 0.82rem;
  height: 0.82rem;
}
/* Android Live-Update chip, discovery mode: the segmented arc leads the count;
   the flat bar is dropped (the arc carries the progress read). */
body[data-os="android"] .liveact--discover .liveact__seg {
  width: 0.92rem;
  height: 0.92rem;
}
body[data-os="android"] .liveact--discover .liveact__seg svg { width: 100%; height: 100%; }
body[data-os="android"] .liveact__bar {
  width: 1.42rem;
  height: 0.23rem;
}
body[data-os="android"] .liveact__trail[hidden] { display: none !important; }
/* Android: the Live Update chip flows in flex, so the caret sits after the bar.
   Give the discovery chip a hair more width so title + bar + caret fit. */
body[data-os="android"] .liveact--discover { max-width: 8.4rem; }
/* the discovery count / "one to go" nudge needs room the story short label doesn't */
body[data-os="android"] .liveact--discover .liveact__title { max-width: 4.6rem; }
body[data-os="android"] .liveact__disclose { margin-left: 0.02rem; }

/* iOS expanded island reads as dark liquid glass */
body[data-os="ios"] .liveact__expand {
  background: oklch(0.18 0.012 60 / 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
          backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid oklch(1 0 0 / 0.12);
}
/* Android status chip gains a hair of elevation */
body[data-os="android"] .liveact__bg { box-shadow: 0 0.18rem 0.5rem -0.22rem oklch(0.3 0.03 50 / 0.4); }
body[data-os="android"] .liveact__expand {
  width: min(19rem, calc(100vw - 2rem));
  padding: 0.9rem 0.95rem;
  border-radius: 1.45rem;
}
.liveact__etitle {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.15;
  margin-bottom: 0.16rem;
}
.liveact__estate {
  font-family: var(--font-label);
  font-size: 0.72rem;
  opacity: 0.78;
  margin-bottom: 0.58rem;
}
.liveact__etrack {
  position: relative;
  height: 0.42rem;
  border-radius: 999px;
  margin-bottom: 0.7rem;
  background: color-mix(in oklch, currentColor 18%, transparent);
  overflow: hidden;
}
.liveact__etrack span {
  display: block;
  width: var(--pct, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.liveact__etrack::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.12rem;
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  transform: translateY(-50%);
  background: oklch(0.975 0.006 86);
}
/* at 6/6 the goal marker has been reached: no stray dot on a full bar */
.liveact__etrack--full::after { display: none; }
/* checklist footer: a dry nudge toward the reward, quieter than the rows and
   set off by a hairline. Uses only the existing label font + currentColor. */
.liveact__efoot {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid color-mix(in oklch, currentColor 16%, transparent);
  font-family: var(--font-label);
  font-size: 0.72rem;
  opacity: 0.6;
}

/* ---- notifications: glass (iOS) with a specular top edge ---------------- */
.notif { position: relative; }
body[data-os="ios"] .notif {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(1.7);
          backdrop-filter: blur(22px) saturate(1.7);
  border: 1px solid var(--glass-stroke);
  box-shadow: var(--glass-shadow);
}
body[data-os="ios"] .notif::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
body[data-os="android"] .poster { box-shadow: 0 0.6rem 1.6rem -0.8rem oklch(0.3 0.03 50 / 0.4); }

/* ---- knowledge card spacing ------------------------------------------- */
.profile { gap: 0.9rem; padding: 0.12rem 0 1rem; margin: 0.02rem 0 0.95rem; }
.profile__id { gap: 0.16rem; }
.profile__role { margin-bottom: 0; }
.profile__link { margin-top: 0.38rem; }
.glance { gap: 1.1rem; }

/* =========================================================================
   prefers-reduced-motion — kept complete in base.css as one block so the
   cascade order is preserved (chat element rules included intentionally).
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .stream-cursor { display: none; }
  /* OS-feature components rest in their final, visible state */
  .notif, .gemini, .poster { opacity: 1; transform: none; }
  .ai-glow, .ai-label { display: none; }
}
