/* DuskMoment styles. Read DESIGN.md first.
   Order: fonts, tokens, base, layout primitives, components, screens, utilities.
   Pages never set their own sizes or colors: they use these tokens and components. */

/* ---------- fonts ---------- */
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 400; font-display: swap; src: url('../fonts/bricolage-grotesque-v9-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 600; font-display: swap; src: url('../fonts/bricolage-grotesque-v9-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 700; font-display: swap; src: url('../fonts/bricolage-grotesque-v9-latin-700.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 800; font-display: swap; src: url('../fonts/bricolage-grotesque-v9-latin-800.woff2') format('woff2'); }

/* ---------- tokens ---------- */
:root {
  /* Color: one ground, two surfaces, three text levels, one accent, two signals */
  --ground: #16111A;          /* the sky after sunset */
  --surface-1: #221A27;       /* cards, lists, fields */
  --surface-2: #2B2231;       /* pressed and raised */
  --line: rgba(246, 239, 230, 0.12);
  --line-strong: rgba(246, 239, 230, 0.22);
  --text: #F6EFE6;            /* warm cream, never pure white */
  --text-2: #C9BDC8;          /* secondary text, 8:1 on ground */
  --text-3: #8E7F8F;          /* decorative only, never body copy */
  --accent: #FFB38A;          /* the last light: links, selection, the one highlight */
  --accent-hover: #FFD1B5;
  --accent-soft: rgba(255, 179, 138, 0.16);
  --accent-line: rgba(255, 179, 138, 0.35);
  --good: #7FD6C2;            /* green flags */
  --good-soft: rgba(127, 214, 194, 0.16);
  --danger: #FF8A7A;          /* red flags, destructive actions */
  --danger-soft: rgba(255, 138, 122, 0.14);
  --scrim: rgba(8, 5, 10, 0.66);
  --track: rgba(246, 239, 230, 0.08);     /* empty part of bars and progress */
  --hover: rgba(246, 239, 230, 0.03);
  --glow: rgba(255, 179, 138, 0.28);       /* the halo on the chapter tile and in the video */
  --glow-0: rgba(255, 179, 138, 0);
  /* The sky. --bar must equal the theme-color meta: iPhone paints its status
     bar once, in that color, so every screen's top edge stays exactly --bar
     and the light comes in below it. Dark only: there is no light theme. */
  --bar: #16111A;
  --bar-0: rgba(22, 17, 26, 0);
  --sky-glow: rgba(255, 150, 120, 0.24);

  /* Type: a display serif italic and a workhorse grotesque, on a 1.2 scale */
  --sans: 'Bricolage Grotesque', -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --t-xs: 12px;      /* chart labels, legend, footnotes */
  --t-sm: 13px;      /* labels, eyebrows, sub-lines */
  --t-md: 15px;      /* chips, list sub-text, small body */
  --t-body: 16px;    /* body and list rows */
  --t-lg: 17px;      /* buttons, card titles */
  --t-xl: 20px;      /* sheet titles */
  --t-2xl: 24px;     /* stat numbers */
  --t-3xl: 30px;     /* display: section titles, person names */
  --t-4xl: 36px;     /* display: screen titles */
  --t-5xl: 42px;     /* display: welcome only */
  --lh-tight: 1.08;
  --lh-snug: 1.3;
  --lh-body: 1.45;

  /* Space: 4-point scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --gutter: var(--s-5);

  /* Radius with intent: fields are tighter than cards, cards tighter than tiles, actions are pills */
  --r-xs: 4px;       /* bars, tracks */
  --r-s: 12px;       /* inputs */
  --r-m: 18px;       /* cards, rows, lists */
  --r-l: 28px;       /* chapter tiles, sheets, the video frame */
  --r-pill: 999px;   /* buttons and chips */

  /* Size */
  --tap: 44px;       /* minimum touch target */
  --btn-h: 56px;     /* primary actions */
  --chip-h: 44px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-1: 150ms;
  --dur-2: 280ms;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ground); color: var(--text); font-family: var(--sans); font-size: var(--t-body); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; touch-action: manipulation; }
/* The light at the top of every screen: seamless with the status bar, then a soft warm glow. */
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 560px; pointer-events: none; z-index: 0;
  background:
    linear-gradient(to bottom, var(--bar) 0, var(--bar) var(--safe-top), var(--bar-0) calc(var(--safe-top) + 150px)),
    radial-gradient(90% 75% at 72% 0%, var(--sky-glow) 0%, rgba(0, 0, 0, 0) 72%);
}
button, input, textarea { font: inherit; color: inherit; touch-action: manipulation; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }  /* headings take focus on each new screen, for screen readers */
p { margin: 0; line-height: var(--lh-body); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- layout primitives ---------- */
#app { min-height: 100%; display: flex; justify-content: center; position: relative; z-index: 1; }
.screen {
  width: 100%; max-width: 480px; min-height: 100dvh;
  padding: calc(var(--s-5) + var(--safe-top)) var(--gutter) calc(var(--s-8) + var(--safe-bottom));
  display: flex; flex-direction: column; gap: var(--s-6);
  animation: rise var(--dur-2) var(--ease-out) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stack { display: flex; flex-direction: column; gap: var(--s-2); }
.stack.tight { gap: var(--s-1); }
.stack-l { display: flex; flex-direction: column; gap: var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-3); }
.row.wide { gap: var(--s-4); }
.row.close { gap: var(--s-2); }
.between { justify-content: space-between; }
.grow { flex-grow: 1; min-width: 0; }
.center { text-align: center; }
.self-center { align-self: center; }
.self-start { align-self: flex-start; }
.top { display: flex; align-items: center; justify-content: space-between; min-height: var(--tap); gap: var(--s-3); }
.top-spacer { width: var(--tap); flex-shrink: 0; }
/* A row that scrolls sideways, starts on the gutter and fades into both edges. */
.rail {
  display: flex; gap: var(--s-2); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter) var(--s-1); scroll-padding-inline: var(--gutter);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; flex-shrink: 0; }

/* ---------- type ---------- */
.eyebrow { margin: 0; font-size: var(--t-sm); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text-2); }
h1, .title { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--t-4xl); line-height: var(--lh-tight); letter-spacing: -0.2px; }
.title.xl { font-size: var(--t-5xl); }
.title.m { font-size: var(--t-3xl); }
h2 { font-size: var(--t-xl); font-weight: 700; line-height: var(--lh-snug); }
h3 { margin: var(--s-4) 0 var(--s-1); font-size: var(--t-body); font-weight: 700; }
.lead { font-size: var(--t-body); color: var(--text-2); line-height: var(--lh-body); }
.muted { color: var(--text-2); }
.small { font-size: var(--t-sm); }
.label { font-size: var(--t-sm); font-weight: 600; color: var(--text-2); }
.error { color: var(--danger); font-size: var(--t-md); min-height: 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-lg); font-weight: 800; letter-spacing: -0.2px; }
.brand .mark { display: flex; color: var(--accent); }
.glyph, .ic { display: inline-flex; flex-shrink: 0; }
.glyph { vertical-align: -4px; color: var(--accent); }

/* ---------- buttons ---------- */
.btn {
  min-height: var(--btn-h); border-radius: var(--r-pill); border: 1px solid transparent; padding: 0 var(--s-6); width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font-size: var(--t-lg); font-weight: 700; text-decoration: none; cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), opacity var(--dur-1);
}
.btn.primary { background: var(--text); color: var(--ground); }
.btn.primary:hover { background: #fff; color: var(--ground); }
.btn.primary:active { opacity: 0.85; }
.btn.quiet { background: transparent; color: var(--text); border-color: var(--line-strong); min-height: 52px; font-size: var(--t-body); font-weight: 600; }
.btn.quiet:hover { border-color: var(--text-2); }
.btn.link { background: transparent; color: var(--accent); min-height: 48px; font-size: var(--t-md); font-weight: 600; width: auto; padding: 0 var(--s-2); }
.btn.link:hover { color: var(--accent-hover); }
.btn.link.inline { min-height: var(--tap); padding: 0; }
.btn.danger { background: var(--danger); color: var(--ground); }
.btn.danger-text, .danger-text { color: var(--danger); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.icon-btn {
  width: var(--tap); height: var(--tap); border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text); cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--text-2); }

/* ---------- surfaces ---------- */
.card { background: var(--surface-1); border-radius: var(--r-m); padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); }
.card.accent { border: 1px solid var(--accent-line); }   /* notices: sample season, install */
.card.warn { background: var(--danger-soft); }
.list { background: var(--surface-1); border-radius: var(--r-m); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }
.item {
  min-height: 56px; width: 100%; padding: var(--s-3) var(--s-4); display: flex; align-items: center; gap: var(--s-3); text-align: left;
  background: transparent; border: 0; color: var(--text); cursor: pointer; text-decoration: none; font-size: var(--t-body);
}
.item:hover { background: var(--hover); }
.item.danger { color: var(--danger); }
.item .sub, .pending .sub, .teaser .sub { display: block; font-size: var(--t-sm); color: var(--text-2); margin-top: 2px; font-weight: 400; }
.item .end { margin-left: auto; color: var(--text-2); font-size: var(--t-md); display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.item.entry .when { width: 52px; flex-shrink: 0; font-size: var(--t-sm); color: var(--text-2); }
.item .feel { font-size: var(--t-md); font-weight: 700; margin-left: auto; flex-shrink: 0; }
/* A tappable row that leads somewhere: patterns, the season song */
.teaser {
  width: 100%; min-height: 64px; border-radius: var(--r-m); padding: var(--s-3) var(--s-4); background: var(--surface-1); border: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--s-3); text-align: left; color: var(--text); font: inherit; cursor: pointer;
}
.teaser:hover { border-color: var(--line-strong); }
.pending { width: 100%; min-height: 64px; border-radius: var(--r-m); padding: var(--s-3) var(--s-4); background: var(--accent-soft); border: 1px solid var(--accent-line); display: flex; align-items: center; gap: var(--s-3); text-align: left; color: var(--text); font: inherit; cursor: pointer; }
.choice {
  width: 100%; text-align: left; border-radius: var(--r-m); padding: var(--s-4); background: var(--surface-1); border: 1px solid var(--line);
  display: flex; gap: var(--s-3); align-items: flex-start; cursor: pointer; color: var(--text);
}
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choice .t { font-size: var(--t-body); font-weight: 700; display: block; }
.choice .d { font-size: var(--t-md); color: var(--text-2); display: block; margin-top: 3px; line-height: 1.4; }
.tag { display: inline-block; font-size: var(--t-xs); font-weight: 700; color: var(--ground); background: var(--good); border-radius: var(--r-pill); padding: 2px var(--s-2); margin-left: 6px; vertical-align: 2px; }

/* ---------- chapter tile ---------- */
.chapter {
  width: 100%; text-align: left; color: var(--text); font: inherit; cursor: pointer;
  border-radius: var(--r-l); padding: var(--s-5); background: var(--surface-1); border: 1px solid var(--accent-line);
  display: flex; flex-direction: column; gap: var(--s-3); min-height: 180px; position: relative; overflow: hidden;
}
.chapter .glow { position: absolute; right: -40px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, var(--glow), var(--glow-0) 70%); pointer-events: none; }
.chapter-name { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--t-3xl); }
.chapter-go { margin-top: auto; display: inline-flex; align-items: center; gap: var(--s-1); font-weight: 700; color: var(--accent); }

/* ---------- people ---------- */
.dot { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; color: var(--ground); font-weight: 800; line-height: 1; }
.castcard {
  flex: 0 0 132px; min-height: 128px; border-radius: var(--r-m); padding: var(--s-4) var(--s-3); text-align: left;
  background: var(--surface-1); border: 1px solid color-mix(in srgb, var(--c, #fff) 38%, transparent); color: var(--text);
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-2); cursor: pointer; font: inherit;
}
.castcard.new { border: 1px dashed var(--line-strong); }
.castcard .plus { font-size: var(--t-2xl); line-height: 1; color: var(--accent); }
.cc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cc-name { font-size: var(--t-body); font-weight: 600; line-height: 1.15; overflow-wrap: break-word; }
.cc-sub { font-size: var(--t-sm); color: var(--text-2); }
.pill { height: 32px; padding: 0 var(--s-3); border-radius: var(--r-pill); background: color-mix(in srgb, var(--c, #fff) 18%, transparent); display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); font-weight: 600; max-width: 60%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tagchip { height: 32px; padding: 0 var(--s-3); border-radius: var(--r-pill); display: inline-flex; align-items: center; font-size: var(--t-sm); font-weight: 600; }
.tagchip.green { background: var(--good-soft); }
.tagchip.red { background: var(--danger-soft); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.stat { background: var(--surface-1); border-radius: var(--r-m); padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-1); }
.stat strong { font-size: var(--t-2xl); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.input, textarea.input {
  min-height: 52px; border-radius: var(--r-s); border: 1px solid var(--line-strong); background: var(--surface-1);
  padding: var(--s-3) 14px; font-size: var(--t-lg); width: 100%;
}
textarea.input { min-height: 96px; resize: vertical; font-family: var(--mono); letter-spacing: 0.5px; }
textarea.input.note { font-family: var(--sans); letter-spacing: 0; min-height: 72px; }
input[type="date"].input { color-scheme: dark; }
.input:focus { border-color: var(--accent); outline: none; }
.check { display: flex; gap: var(--s-3); align-items: flex-start; cursor: pointer; padding: 6px 0; line-height: var(--lh-body); }
.check input { width: 24px; height: 24px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip {
  min-height: var(--chip-h); padding: 0 var(--s-4); border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: transparent;
  display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--t-md); font-weight: 600; cursor: pointer; color: var(--text);
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1);
}
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.chip.green[aria-pressed="true"] { border-color: var(--good); background: var(--good-soft); }
.chip.red[aria-pressed="true"] { border-color: var(--danger); background: var(--danger-soft); }
.chip.add { border-style: dashed; color: var(--text-2); }
.chip.ghost { border-color: transparent; color: var(--accent); }
/* A 1 to 5 scale (how it felt, the guess) */
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-2); }
.scale .chip { min-height: 64px; padding: var(--s-1); border-radius: var(--r-m); justify-content: center; text-align: center; font-size: var(--t-sm); line-height: 1.2; background: var(--surface-1); border-color: var(--line); color: var(--text-2); }
.scale .chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.verdict { text-align: center; font-weight: 600; color: var(--accent); min-height: 22px; }
.dots { display: flex; justify-content: center; gap: var(--s-4); padding: var(--s-2) 0; }
.dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); }
.dots span.on { background: var(--text); border-color: var(--text); }
.dots.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); max-width: 320px; width: 100%; margin: 0 auto; }
.pad button { height: 68px; border-radius: var(--r-pill); border: 0; background: var(--surface-1); font-size: var(--t-2xl); font-weight: 600; cursor: pointer; }
.pad button:active { background: var(--surface-2); }
.pad .ghost { background: transparent; font-size: var(--t-md); font-weight: 600; color: var(--text-2); }

/* ---------- recovery ---------- */
.key { font-family: var(--mono); font-size: var(--t-xl); font-weight: 700; letter-spacing: 1px; line-height: 1.6; text-align: center; background: var(--surface-1); border-radius: var(--r-m); padding: 18px var(--s-3); user-select: all; -webkit-user-select: all; }
.cardimg { width: 100%; border-radius: var(--r-m); display: block; }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 10px; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 14px; align-items: flex-start; background: var(--surface-1); border-radius: var(--r-m); padding: 14px var(--s-4); line-height: 1.4; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- patterns ---------- */
.moodmap { display: block; overflow: visible; }
.mm-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.mm-label { fill: var(--text-2); font-size: 11px; font-family: var(--sans); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--t-xs); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.insight { background: var(--surface-1); border-radius: var(--r-m); padding: var(--s-4); display: flex; gap: 14px; align-items: flex-start; }
.insight-icon { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); }
.insight.green .insight-icon { background: var(--good-soft); color: var(--good); }
.insight.red .insight-icon { background: var(--danger-soft); color: var(--danger); }
.insight-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex-grow: 1; }
.insight h2 { font-size: var(--t-lg); }
.insight-foot { font-size: var(--t-xs); color: var(--text-2); letter-spacing: 0.3px; }
.bars { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.bar-row { display: grid; grid-template-columns: 78px minmax(0, 1fr) 58px; align-items: center; gap: var(--s-2); font-size: var(--t-xs); }
.bar-label { color: var(--text-2); }
.bar-track { display: block; height: 8px; border-radius: var(--r-xs); background: var(--track); overflow: hidden; }
.bar-track.lg { height: 10px; }
.bar-fill { display: block; height: 100%; border-radius: var(--r-xs); background: var(--accent); transition: width var(--dur-2) linear; }
.bar-value { color: var(--text); font-weight: 600; }
.progress { display: flex; gap: var(--s-2); }
.progress span { flex: 1; height: 8px; border-radius: var(--r-xs); background: var(--track); }
.progress span.on { background: var(--accent); }
details.more summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; justify-content: center; color: var(--accent); font-weight: 600; list-style: none; }
details.more summary::-webkit-details-marker, details.plan summary::-webkit-details-marker { display: none; }
details.plan summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 2px; min-height: var(--tap); justify-content: center; }
details.plan ul { margin: var(--s-2) 0 0; padding-left: 18px; color: var(--text-2); font-size: var(--t-md); line-height: 1.6; }

/* ---------- the season song ---------- */
.videoframe { width: 100%; max-width: 360px; aspect-ratio: 9 / 16; height: auto; align-self: center; border-radius: var(--r-l); background: var(--ground); box-shadow: 0 0 0 1px var(--line); }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet {
  width: 100%; max-width: 480px; max-height: 92dvh; overflow: auto; background: var(--ground); border-top: 1px solid var(--line-strong);
  border-radius: var(--r-l) var(--r-l) 0 0; padding: 22px var(--gutter) calc(var(--s-6) + var(--safe-bottom)); display: flex; flex-direction: column; gap: var(--s-4);
  animation: up 0.25s var(--ease-out) both;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.legal { line-height: 1.5; }
.legal h2 { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--t-3xl); }
.legal p { margin: var(--s-1) 0 10px; color: var(--text); }
.toast { position: fixed; left: 50%; bottom: calc(var(--s-6) + var(--safe-bottom)); transform: translateX(-50%); background: var(--text); color: var(--ground); padding: var(--s-3) 18px; border-radius: var(--r-pill); font-weight: 600; font-size: var(--t-md); z-index: 30; max-width: calc(100% - 40px); text-align: center; }
.busy { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-4); flex-grow: 1; color: var(--text-2); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Phones held sideways */
.rotate { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate { display: flex; position: fixed; inset: 0; z-index: 50; background: var(--ground); align-items: center; justify-content: center; text-align: center; padding: var(--s-6); font-size: 18px; font-weight: 600; }
}

@media print {
  body * { visibility: hidden; }
  #print, #print * { visibility: visible; }
  #print { position: absolute; inset: 0; display: block !important; }
  #print img { width: 100%; }
}
