:root {
  --bg: #f4efe6;
  --surface: #fffaf2;
  --ink: #2a2622;
  --muted: #6d655c;
  --line: #ddd3c4;
  --accent: #b85c24;
  --accent-ink: #fff;
  --warm: #d97a3a;
  --cold: #c9c2b6;
  --best: #2f7d4f;
  --good: #3a6ea5;
  --ok: #9a7420;
  --bad: #a83a32;
  --radius: 12px;
  --past: #6f665c;
  --up: #2f7d4f;
  --down: #a83a32;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171c; --surface: #1e2128; --ink: #e9e4da; --muted: #a49c90; --line: #333843;
    --accent: #e08a4c; --accent-ink: #1a1208; --cold: #3b404b;
    --best: #5cbf85; --good: #79a8de; --ok: #d4ad55; --bad: #e0766d; --past: #a9a194; --up: #6fcf97; --down: #ec8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171c; --surface: #1e2128; --ink: #e9e4da; --muted: #a49c90; --line: #333843;
  --accent: #e08a4c; --accent-ink: #1a1208; --cold: #3b404b;
  --best: #5cbf85; --good: #79a8de; --ok: #d4ad55; --bad: #e0766d; --past: #a9a194; --up: #6fcf97; --down: #ec8a80;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  /* PT Serif has full Bulgarian Cyrillic (ѝ); Georgia does not. */
  font: 19px/1.6 "PT Serif", Cambria, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { max-width: 680px; margin: 0 auto; padding: 0 16px 64px; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; margin-bottom: 8px; border-bottom: 1px solid var(--line);
  font: 15px/1.2 system-ui, sans-serif;
}
.brand { color: var(--muted); letter-spacing: .04em; text-transform: uppercase; font-size: 13px; }
.link { background: none; border: 0; padding: 4px 0; color: var(--muted); }
.link:hover { color: var(--ink); }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.seg button {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 4px 11px; font: 13px/1.4 system-ui, sans-serif; color: var(--muted);
}
.seg button.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* title screen */
.title { padding-top: 24px; }
.audience { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.section h1 { font-size: 40px; line-height: 1.1; margin: 0 0 8px; letter-spacing: -.01em; }
.section-blurb { color: var(--muted); margin: 0 0 24px; }
.cards { display: grid; gap: 14px; }
.story-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 20px;
}
.story-card h2 { font-size: 26px; line-height: 1.15; margin: 0 0 8px; }
/* v1.13.2: a story without the current language: dimmed, with the languages it has */
.story-card.other-lang { opacity: .72; }
.story-card.other-lang:hover, .story-card.other-lang:focus-within { opacity: 1; }
.story-card .lang-note { float: right; margin: 0 0 4px 8px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px;
  font: 600 11px/1.6 system-ui, sans-serif; letter-spacing: .06em; color: var(--muted); }
.story-card .blurb { font-size: 17px; margin-bottom: 8px; }
.story-card .actions { margin-top: 14px; }
/* drawing on the card (stories/index.json "picture"): a strip above the text, cut from the middle of the drawing; no camera move */
.story-card.has-picture { padding-top: 0; overflow: hidden; }
.card-scene { position: relative; overflow: hidden; aspect-ratio: 3 / 1; margin: 0 -20px 16px; }
.card-scene .scene-band { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-58%); border-radius: 0; max-height: none; }
.card-scene .scene-band .layer { animation: none !important; }
.tag {
  margin: 0 0 6px; font: 600 11px/1.3 system-ui, sans-serif; text-transform: uppercase;
  letter-spacing: .07em; color: var(--accent);
}
.blurb { font-size: 21px; color: var(--muted); margin: 0 0 16px; }
.meta { font: 14px/1.4 system-ui, sans-serif; color: var(--muted); margin: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.primary, .secondary {
  border-radius: 999px; padding: 10px 22px; font: 600 16px/1.2 system-ui, sans-serif;
  border: 1px solid var(--accent);
}
.primary { background: var(--accent); color: var(--accent-ink); }
.secondary { background: transparent; color: var(--accent); }

/* passage */
.status {
  display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center;
  font: 13px/1.4 system-ui, sans-serif; color: var(--muted); padding: 6px 0 18px;
}
.stat { display: flex; align-items: center; gap: 8px; }
.stat-label { text-transform: uppercase; letter-spacing: .05em; font-size: 11px; }
.dots { display: inline-flex; gap: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cold); transition: background .4s; }
.dot.on { background: var(--warm); }

.scene:empty { display: none; }
.text p { margin: 0 0 1em; }
.text p:first-child::first-letter { font-size: 1.15em; }

.choices { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
.choice {
  width: 100%; text-align: left; display: flex; gap: 14px; align-items: baseline;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; font-size: 17px; line-height: 1.45;
  transition: border-color .15s, transform .15s;
}
.choice:hover, .choice:focus-visible { border-color: var(--accent); transform: translateX(2px); outline: none; }
.num {
  flex: none; font: 600 13px/1 system-ui, sans-serif; color: var(--accent);
  border: 1px solid currentColor; border-radius: 50%; width: 22px; height: 22px;
  display: inline-grid; place-items: center; transform: translateY(-1px);
}

/* endings */
.ending-card {
  margin-top: 28px; padding: 20px 22px; background: var(--surface);
  border: 1px solid var(--line); border-left: 5px solid var(--kind, var(--accent)); border-radius: var(--radius);
}
.kind-best { --kind: var(--best); } .kind-good { --kind: var(--good); }
.kind-ok { --kind: var(--ok); } .kind-bad { --kind: var(--bad); }
.ending-card .kind { margin: 0; font: 600 12px/1 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--kind); }
.ending-card h2 { margin: 6px 0 12px; font-size: 30px; line-height: 1.15; }
.ending-card h3 { margin: 16px 0 4px; font: 600 13px/1.3 system-ui, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ending-card p { margin: 0; }
.learn ul { margin: 4px 0 0; padding-left: 20px; font-size: 17px; }
.ending-card .actions { margin-top: 20px; }
.sources { margin-top: 28px; font-size: 16px; }
.traps ul { margin: 4px 0 0; padding-left: 20px; font-size: 17px; }
.traps li { margin-bottom: 6px; }
.traps a { white-space: nowrap; font-size: 15px; }

/* household setup */
.setup { padding-top: 24px; }
.setup h1 { font-size: 34px; margin: 0 0 8px; }
.setup-rows { display: grid; gap: 14px; margin-top: 20px; font: 16px/1.4 system-ui, sans-serif; }
.setup .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.setup .row > span { min-width: 180px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.setup .row.sub { padding-left: 28px; margin-top: -6px; }
.setup .who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.setup input.name { font: inherit; padding: 6px 10px; border: 1px solid var(--line, #ccc); border-radius: 8px; background: var(--bg); color: var(--ink); min-width: 0; width: 220px; max-width: 100%; }
.sources h3 { font: 600 13px/1.3 system-ui, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 4px; }

.passage { animation: fade .35s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .passage { animation: none; } .choice { transition: none; } }

@media (max-width: 520px) {
  body { font-size: 18px; }
  .story-card h1 { font-size: 34px; }
  .title { padding-top: 6vh; }
}
.error, .loading { color: var(--muted); padding: 40px 0; }
a.primary, a.secondary, a.link { text-decoration: none; display: inline-block; }
.guides-link { margin-top: 48px; font: 15px/1.4 system-ui, sans-serif; }

/* guide pages */
.guide { animation: fade .35s ease-out; }
.guide h1 { font-size: 34px; line-height: 1.15; margin: 16px 0 10px; }
.guide h2 { font-size: 22px; margin: 28px 0 8px; }
.guide p, .guide li { margin: 0 0 .7em; }
.guide ul, .guide ol { padding-left: 22px; }
.guide .note {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 12px 16px; margin-top: 20px;
}
.site-notice { border-left: 3px solid var(--line); padding: 6px 0 6px 12px; margin: 12px 0; }
.guide .disclaimer { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 14px; }
.guide-list { list-style: none; padding: 0 !important; }
.guide-list li { padding: 14px 0; border-bottom: 1px solid var(--line); margin: 0; }
.guide-list a { font-size: 20px; font-weight: 700; text-decoration: none; }
.guide-list p { margin: 4px 0 0; color: var(--muted); font-size: 17px; }

/* ---------- play view: scene band + transcript ---------- */
html[data-size="s"] body { font-size: 17px; }
html[data-size="l"] body { font-size: 21px; }
.play { padding-bottom: 24px; }
.scene-host {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding-top: max(8px, env(safe-area-inset-top, 0px)); padding-bottom: 8px; margin: 0 -2px;
}
.play .status { padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.kit-item {
  display: inline-block; padding: 1px 8px; margin: 2px 4px 2px 0; border: 1px solid var(--line);
  border-radius: 999px; font-size: 12px; color: var(--ink);
}
.muted { color: var(--muted); }

/* notebook (site/config.js notebook: true) */
.notebook { flex-basis: 100%; }
.notebook summary { cursor: pointer; color: var(--ink); }
.notebook summary .stat-label { color: var(--muted); }
.notebook .nb-theory { color: var(--accent); }
.notebook .clues { margin: 8px 0 2px; padding-left: 22px; font-size: 14px; color: var(--ink); display: grid; gap: 4px; }
.clue-note { color: var(--muted); }
.reveal ul { margin: 4px 0 0; padding-left: 0; list-style: none; font-size: 16px; display: grid; gap: 6px; }
.reveal .verdict { font: 600 12px/1 system-ui, sans-serif; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.reveal .verdict.good { color: var(--up); } .reveal .verdict.trap { color: var(--down); }

.transcript { display: grid; gap: 4px; }
.beat { scroll-margin-top: calc(34vh + 24px); }
.beat.past .text p { color: var(--past); }
.beat.past .text p { margin: 0 0 .7em; }
.echo {
  margin: 2px 0 6px; padding-left: 12px; border-left: 3px solid var(--accent);
  font: 600 15px/1.45 system-ui, sans-serif; color: var(--accent);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px 12px; }
.chip {
  font: 12px/1.3 system-ui, sans-serif; padding: 3px 9px; border-radius: 999px;
  border: 1px solid currentColor; font-variant-numeric: tabular-nums;
}
.chip.up { color: var(--up); } .chip.down { color: var(--down); }
.beat.past + .beat.now { margin-top: 10px; padding-top: 18px; border-top: 1px dashed var(--line); }

/* reveal: paragraphs fade in one by one, choices after them; a tap shows all */
@keyframes beat-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* --step: time between paragraphs. The first paragraph starts at once, so a click always shows something. */
.beat { --step: .3s; }
.beat.revealing .reveal { opacity: 0; animation: beat-rise .4s ease-out forwards; animation-delay: calc(var(--i) * var(--step)); }
.beat.revealing .choices, .beat.revealing .ending-card { opacity: 0; animation: beat-rise .4s ease-out forwards; animation-delay: calc(var(--n) * var(--step) + .15s); }
/* "more is coming": pulsing dots until the options arrive; a tap shows everything at once */
.reveal-more { display: none; margin: 6px 0 0; font: 13px/1.4 system-ui, sans-serif; color: var(--muted); }
.beat.revealing .reveal-more { display: flex; align-items: center; gap: 8px; animation: more-out .2s forwards; animation-delay: calc(var(--n) * var(--step) + .1s); }
@keyframes more-out { to { opacity: 0; visibility: hidden; height: 0; margin: 0; } }
.pulse { display: inline-flex; gap: 4px; }
.pulse i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: dot 1s infinite ease-in-out; }
.pulse i:nth-child(2) { animation-delay: .15s; } .pulse i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-2px); } }
.thinking { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; font: 13px/1.4 system-ui, sans-serif; color: var(--muted); }
html[data-speed="instant"] .beat.revealing .reveal-more { display: none; }
html[data-speed="instant"] .beat.revealing .reveal,
html[data-speed="instant"] .beat.revealing .choices,
html[data-speed="instant"] .beat.revealing .ending-card { animation: none; opacity: 1; }
html.motion-off .beat.revealing * { animation-duration: .01s !important; animation-delay: 0s !important; }
@media (prefers-reduced-motion: reduce) { .beat.revealing * { animation: none !important; opacity: 1 !important; } .beat.revealing .reveal-more { display: none; } .pulse i { animation: none; opacity: .6; } }
html.motion-off .beat.revealing .reveal-more { display: none; }

.choice.locked { opacity: .6; cursor: not-allowed; transform: none !important; }
.choice.locked .num { border: 0; }
.needs { display: block; font: 12px/1.3 system-ui, sans-serif; color: var(--muted); margin-top: 3px; }

.trail ol { margin: 4px 0 0; padding-left: 22px; font-size: 16px; }
.trail li { margin-bottom: 4px; }

/* endings collection on the story card */
.endings-map { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.endings-map li {
  font: 12px/1.3 system-ui, sans-serif; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
}
.endings-map li.unknown { color: var(--muted); border-style: dashed; min-width: 30px; text-align: center; }
.endings-map li.found { color: var(--kind, var(--accent)); border-color: currentColor; }

/* settings */
.settings { margin-top: 36px; font: 14px/1.4 system-ui, sans-serif; color: var(--muted); }
.settings summary { cursor: pointer; }
.settings-rows { display: grid; gap: 10px; margin-top: 12px; }
.settings .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.settings .row > span { min-width: 120px; }

/* wide screens: picture on the left, story on the right */
@media (min-width: 960px) {
  #app:has(.play) { max-width: 1180px; }
  .play { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 640px); column-gap: 40px; align-items: start; }
  .play .scene-host { grid-column: 1; grid-row: 1 / span 3; top: 16px; padding-top: 0; }
  .play .scene-band { max-height: none; }
  .play .status, .play .ai-bar, .play .transcript, .play .settings { grid-column: 2; }
  .beat { scroll-margin-top: 24px; }
}

/* confidence question */
.choice.asking { border-color: var(--accent); }
.ask-sure {
  margin: 8px 0 4px 36px; padding: 10px 12px; border-left: 3px solid var(--accent);
  font: 14px/1.4 system-ui, sans-serif; animation: beat-rise .3s ease-out;
}
.ask-sure p { margin: 0 0 8px; color: var(--ink); }
.ask-sure .seg button { padding: 6px 12px; font-size: 14px; color: var(--ink); }
.ask-sure .seg .skip { color: var(--muted); border-style: dashed; }
.sure-tag { font-weight: 400; color: var(--muted); }
.sure ul { margin: 4px 0 0; padding-left: 20px; font-size: 16px; }
.sure .verdict { font: 600 12px/1 system-ui, sans-serif; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.sure .verdict.good { color: var(--up); } .sure .verdict.trap { color: var(--down); }
.calib p { margin: 10px 0 2px; font-size: 15px; color: var(--muted); }
.calib ul { font-size: 15px; }

/* clocks */
.stat.clock { gap: 6px; }
.clock-ring svg path { fill: var(--cold); transition: fill .4s; }
.clock-ring svg path.on { fill: var(--accent); }
.stat.clock.full .clock-ring svg path.on { fill: var(--bad); }
.clock-full { font: 600 11px/1 system-ui, sans-serif; color: var(--bad); text-transform: uppercase; letter-spacing: .05em; }
.chip.clock { color: var(--accent); }

/* amounts (money in euros) */
.stat.amount { gap: 6px; }
.amount-value { color: var(--ink); font: 600 15px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.stat.amount.low .amount-value { color: var(--bad); }

/* month calendar */
.stat.calendar { flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 6px; }
.cal-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.cal-today { font: 600 13px/1 system-ui, sans-serif; }
.cal-next { font: 12px/1.2 system-ui, sans-serif; color: var(--accent); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; max-width: 280px; }
.cal-day { font: 11px/20px system-ui, sans-serif; text-align: center; border-radius: 4px; font-variant-numeric: tabular-nums; }
.cal-day.past { opacity: .4; }
.cal-day.mark { box-shadow: inset 0 -2px 0 var(--accent); font-weight: 600; }
.cal-day.today { background: var(--accent); color: var(--bg, #fff); font-weight: 700; }

/* ending: figures, help */
.facts ul, .help ul { padding-left: 1.1em; }
.fact-source { font-size: .9em; opacity: .8; }

/* --- fellow travellers --------------------------------------------------- */
.companions { margin: 4px 0 10px; }
.companion-line {
  margin: 0 0 .55em; padding: 4px 0 4px 12px; border-left: 3px solid var(--line);
  font-style: italic;
}
.companion-line.argue { border-left-color: var(--accent); }
.companion-line .who {
  display: inline-block; font: 600 12px/1.6 system-ui, sans-serif; font-style: normal;
  letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin-right: 4px;
}
.companion-line[data-mood="scared"] .who, .companion-line[data-mood="worried"] .who { color: var(--muted, #777); }
.companion-line .by-ai {
  margin-left: 6px; padding: 0 5px; border: 1px solid var(--line); border-radius: 8px;
  font: 600 10px/1.5 system-ui, sans-serif; font-style: normal; color: var(--muted, #777); vertical-align: 1px;
}
.beat.past .companion-line { color: var(--past); }
.companion-line.arrive, .event-line.arrive { animation: beat-rise .4s ease-out; }
.event-line {
  margin: 0 0 .55em; padding: 4px 0 4px 12px; border-left: 3px dotted var(--muted);
}
.event-line .tag {
  font: 600 11px/1.6 system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px;
}
.event-line .by-ai {
  margin-left: 6px; padding: 0 5px; border: 1px solid var(--line); border-radius: 8px;
  font: 600 10px/1.5 system-ui, sans-serif; color: var(--muted); vertical-align: 1px;
}
.beat.past .event-line { color: var(--past); }
.choices.waiting .choice { opacity: .55; cursor: progress; }
.choice .pushed {
  display: inline-block; margin-left: 8px; padding: 0 6px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font: 600 11px/1.6 system-ui, sans-serif; vertical-align: 1px;
}
.ai-note { grid-column: 1 / -1; margin: 2px 0 0; }
.ai-note progress { width: 100%; }
html.motion-off .companion-line.arrive, html.motion-off .event-line.arrive { animation: none; }
@media (prefers-reduced-motion: reduce) { .companion-line.arrive, .event-line.arrive { animation: none; } }

/* --- AI companion switch (iOS-style: grey off, green on) -------------------- */
.ai-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 12px; font: 14px/1.35 system-ui, sans-serif; }
.switch { position: relative; flex: none; width: 46px; height: 28px; padding: 0; border: 0; border-radius: 999px;
  background: #d1d1d6; cursor: pointer; transition: background .2s ease; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3), 0 1px 1px rgba(0,0,0,.08); transition: transform .2s ease; }
.switch[aria-checked="true"] { background: #34c759; }
.switch[aria-checked="true"] .knob { transform: translateX(18px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ai-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ai-label { font-weight: 600; color: var(--ink); }
.ai-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.ai-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #c7c7cc; }
.tone-on .ai-dot { background: #34c759; }
.tone-wait .ai-dot { background: #ff9f0a; animation: dot 1.2s infinite ease-in-out; }
.ai-bar progress { width: 100%; height: 6px; }
.ai-download { padding: 4px 12px; font-size: 13px; border-radius: 999px; }
html.motion-off .switch, html.motion-off .switch .knob { transition: none; }
@media (prefers-reduced-motion: reduce) { .switch, .switch .knob { transition: none; } .tone-wait .ai-dot { animation: none; } }

/* Footer with the legal links (not shown during play). */
.site-foot { max-width: 720px; margin: 48px auto 24px; padding: 16px 20px 0; border-top: 1px solid var(--line);
  font: 13px/1.4 system-ui, sans-serif; color: var(--muted); text-align: center; }
.site-foot a { color: var(--muted); }
.legal .address { line-height: 1.5; }

/* Countdown to the site's end (site setting lifespan; not shown during play). */
.lifespan { max-width: 720px; margin: 0 auto 32px; padding: 0 20px; font: 13px/1.4 system-ui, sans-serif; color: var(--muted); text-align: center; }
.site-foot + .lifespan { margin-top: -8px; }
main + .lifespan { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); }
.life-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.life-bar span { display: block; height: 100%; min-width: 6px; border-radius: 999px; background: var(--accent); }
.life-dates { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; }
.life-left { margin: 6px 0 0; }
.life-left strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- staging (v1.11.0): page moods, big frames, one-shot effects ----------
   Page moods recolour the whole page for a stretch of the story (night, alarm ...). A story
   sets them with "page" on a scene entry (scenes/<id>/index.json); src/scene.js puts
   data-page on <html>, taken from the path, so reload and step back land on the same mood.
   The page colours are registered so a mood change fades over 1.8 s instead of jumping.
   Sites and stories may add their own moods in theme.css or scene.css with the same selector
   html:root[data-page="name"] and must set at least --bg, --surface, --ink, --muted, --line
   (and --page-tone: dark | light when the --bg alone does not say it). */
@property --bg      { syntax: '<color>'; inherits: true; initial-value: #f4efe6; }
@property --surface { syntax: '<color>'; inherits: true; initial-value: #fffaf2; }
@property --ink     { syntax: '<color>'; inherits: true; initial-value: #2a2622; }
@property --muted   { syntax: '<color>'; inherits: true; initial-value: #6d655c; }
@property --line    { syntax: '<color>'; inherits: true; initial-value: #ddd3c4; }
html { transition: --bg 1.8s ease, --surface 1.8s ease, --ink 1.8s ease, --muted 1.8s ease, --line 1.8s ease; }
html.motion-off { transition: none; }
@media (prefers-reduced-motion: reduce) { html { transition: none; } }

/* dark moods take the dark accent and ending colours, light moods the light ones, whatever the theme.
   v1.13.1: scene.js also puts data-page-tone="dark" or "light" on <html> for every mood, the site's own
   moods included (from the mood's --page-tone, else from its --bg), so an own mood gets these colours
   without listing it, and a site can recolour its own variables once per tone:
     html:root[data-page-tone="dark"] { --pen: #9cc3ff; } */
html:root[data-page="night"], html:root[data-page="smoke"], html:root[data-page="alarm"], html:root[data-page="blackout"] { --page-tone: dark; }
html:root[data-page="dawn"], html:root[data-page="cold"], html:root[data-page="warm"] { --page-tone: light; }
html:root[data-page="night"], html:root[data-page="smoke"], html:root[data-page="alarm"], html:root[data-page="blackout"], html:root[data-page-tone="dark"] {
  --accent: #e08a4c; --accent-ink: #1a1208; --cold: #3b404b;
  --best: #5cbf85; --good: #79a8de; --ok: #d4ad55; --bad: #e0766d; --past: #a9a194; --up: #6fcf97; --down: #ec8a80;
  color-scheme: dark;
}
html:root[data-page="dawn"], html:root[data-page="cold"], html:root[data-page="warm"], html:root[data-page-tone="light"] {
  --accent: #b85c24; --accent-ink: #fff; --cold: #c9c2b6;
  --best: #2f7d4f; --good: #3a6ea5; --ok: #9a7420; --bad: #a83a32; --past: #6f665c; --up: #2f7d4f; --down: #a83a32;
  color-scheme: light;
}
/* night is deep blue, not black */
html:root[data-page="night"]    { --bg: #0f1a33; --surface: #17254a; --ink: #dfe6f5; --muted: #93a2c2; --line: #2a3a5e; --accent: #f0b35e; --accent-ink: #1a1208; --past: #a3b0cc; }
html:root[data-page="dawn"]     { --bg: #f6e7da; --surface: #fdf3ea; --ink: #2a2230; --muted: #6a5a69; --line: #e2cdbd; }
html:root[data-page="cold"]     { --bg: #e6edf3; --surface: #f4f8fb; --ink: #1d2a36; --muted: #52637a; --line: #c9d5e0; --accent: #2f6690; }
html:root[data-page="smoke"]    { --bg: #3b3a38; --surface: #46443f; --ink: #ece8e1; --muted: #bcb6ac; --line: #5a5750; }
html:root[data-page="warm"]     { --bg: #f7ead6; --surface: #fdf4e6; --ink: #2e2116; --muted: #72604c; --line: #e6d2b5; }
html:root[data-page="alarm"]    { --bg: #1e1416; --surface: #2a1c1f; --ink: #f3e4e2; --muted: #c9a7a3; --line: #4a2f33; --accent: #f08a6e; }
html:root[data-page="blackout"] { --bg: #08090c; --surface: #111318; --ink: #c9ccd3; --muted: #8a8f99; --line: #23262d; }
/* alarm: a slow red glow at the edges of the screen */
html[data-page="alarm"] body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 40;
  box-shadow: inset 0 0 90px rgba(200, 40, 40, .32); animation: mood-alarm 3.2s ease-in-out infinite alternate;
}
@keyframes mood-alarm { from { opacity: .45; } to { opacity: 1; } }
html.motion-off[data-page="alarm"] body::before { animation: none; opacity: .7; }
@media (prefers-reduced-motion: reduce) { html[data-page="alarm"] body::before { animation: none; opacity: .7; } }

/* big frame (the transitions sit in scenes/scenes.css with the band's own): at a turning point the picture grows (scene entry "frame": "big" or "hold").
   Phones and tablets: taller crop, edge to edge, the camera slides to "focus" (set by
   src/scene.js as --focus-dx). It shrinks back before the choices appear. */
@media (max-width: 959px) {
  .scene-band.big { aspect-ratio: 9 / 8; max-height: 68vh; margin-inline: -14px; width: calc(100% + 28px); border-radius: 0; } /* #app padding 16px, .scene-host margin -2px */
  .scene-band.big .cam { translate: var(--focus-dx, 0px) 0; }
}
/* desktop: the picture column widens and the story column narrows for the moment */
@media (min-width: 960px) {
  .play { transition: grid-template-columns .8s cubic-bezier(.3, 0, .2, 1); }
  .play:has(.scene-band.big) { grid-template-columns: minmax(0, 1.5fr) minmax(0, 560px); }
}
html.motion-off .scene-band, html.motion-off .scene-band .cam, html.motion-off .play { transition: none; }

/* one-shot effects (scene entry "fx"), run once when the passage is reached by a choice.
   ::before is the effect layer (::after is the paper grain). */
.scene-band::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: 0; background: #000; border-radius: inherit; }
.scene-band.fx-blackout::before     { animation: fx-blackout 1s ease-out both; }
.scene-band.fx-fade-in-slow::before { animation: fx-fade-in 3s ease-out both; }
.scene-band.fx-flash::before        { background: #fff; animation: fx-flash .5s ease-out both; }
.scene-band.fx-desaturate .layer    { filter: saturate(.25); }
.scene-band.fx-shake                { animation: fx-shake .4s ease-in-out 3; }
@keyframes fx-blackout { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fx-fade-in  { from { opacity: 1; } to { opacity: 0; } }
@keyframes fx-flash    { 0% { opacity: .55; } 100% { opacity: 0; } }
@keyframes fx-shake    { 0%, 100% { transform: none; } 25% { transform: translate(-3px, 1px); } 75% { transform: translate(3px, -1px); } }
@media (prefers-reduced-motion: reduce) {
  .scene-band::before { animation: none !important; opacity: 0 !important; }
  .scene-band, .play { transition: none !important; }
}

/* own choice, "Something else" (v1.12.0): quiet, under the choices; only on passages with hidden choices */
.own { margin: 14px 0 0; font: 14px/1.45 system-ui, sans-serif; color: var(--muted); }
.own-link { background: none; border: 0; padding: 4px 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.own-busy { margin: 6px 0 0; color: var(--muted); font-size: 0.9em; }
.own-link:hover, .own-link:focus-visible { color: var(--ink); text-decoration-color: currentColor; }
.own-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.own-form input { flex: 1 1 14rem; min-width: 0; font: 16px/1.4 system-ui, sans-serif; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface, transparent); color: var(--ink); }
.own-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.own-form button, .own-send button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 14px;
  font: 14px/1.4 system-ui, sans-serif; color: var(--ink); cursor: pointer; }
.own-form button:hover, .own-send button:not(:disabled):hover { border-color: var(--accent); }
.own-form .own-cancel { color: var(--muted); }
.own-send button:disabled { opacity: .5; cursor: default; }
.own-confirm p, .own-list p { margin: 0 0 8px; color: var(--ink); }
.own-miss, .own-sent { margin: 10px 0 0; color: var(--ink); }
.own-send { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.own-send label { cursor: pointer; }
.own-note { flex-basis: 100%; margin: 0; font-size: 13px; }
.own-list { margin-top: 12px; }
.own-list ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.own-item { width: 100%; text-align: left; border: 1px dashed var(--line); background: transparent; border-radius: 12px;
  padding: 10px 14px; font: 16px/1.4 system-ui, sans-serif; color: var(--ink); cursor: pointer; }
.own-item:hover, .own-item:focus-visible { border-color: var(--accent); }
.echo.own { border-left-style: dashed; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.beat.revealing .own { opacity: 0; animation: beat-rise .4s ease-out forwards; animation-delay: calc(var(--n) * var(--step) + .25s); }
html[data-speed="instant"] .beat.revealing .own { animation: none; opacity: 1; }
@media print { .own { display: none; } }
