/* Stage v0.1 shared styles. Islands rule: every element its own tint, dark text on tinted light panels,
   buttons never the colour of their panel, neighbours never repeat. */
:root {
  --ink: #15112b; --ink-2: #2a2450; --night: #07060d; --gold: #ffc23d;
  --lav: #ece6ff; --sky: #e0f0ff; --mint: #ddf9ec; --peach: #ffeedd; --rose: #ffe5f0; --lemon: #fff6c9; --ice: #e3fbfb;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--night); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.55; overflow-x: hidden; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: pan-y; cursor: grab; }
#scene.dragging { cursor: grabbing; }
#scene.pointer { cursor: pointer; }

#loader { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--night); transition: opacity 0.8s ease; }
#loader.done { opacity: 0; pointer-events: none; }
.loader-pill { background: var(--lav); color: var(--ink); padding: 14px 26px; border-radius: 999px; font-size: 15px; display: flex; gap: 14px; align-items: baseline; }
.loader-pill b { font-family: var(--mono); font-size: 22px; min-width: 3.2em; text-align: right; }

.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 16px; pointer-events: none; }
.hud-right { display: flex; gap: 10px; }
.hud-pill { pointer-events: auto; color: var(--ink); text-decoration: none; border: 0; border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 600; }
.hud-brand { background: var(--lemon); }
.hud-chapter { background: var(--sky); }
.hud-sound { background: var(--mint); cursor: pointer; font-family: var(--mono); font-size: 13px; font-weight: 600; }
.hud-sound[aria-pressed="true"] { background: var(--peach); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

main { position: relative; z-index: 10; pointer-events: none; }
.chapter { min-height: 100vh; display: flex; align-items: center; padding: 90px 16px 60px; }
.card { pointer-events: auto; width: min(460px, 100%); margin-left: max(16px, 6vw); padding: 26px 28px 24px; border-radius: 22px; color: var(--ink); box-shadow: 0 18px 60px rgba(0,0,0,0.35); }
.card.wide { width: min(780px, 100%); }
.card p { margin: 0 0 12px; color: var(--ink-2); }
.card h1, .card h2 { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: clamp(36px, 5vw, 54px); line-height: 1.04; letter-spacing: -0.01em; margin: 0 0 14px; color: var(--ink); }
.kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; }
.hint { font-size: 12.5px; margin-top: 14px !important; }
.t-lav { background: var(--lav); } .t-lav .kicker { color: #4b2fb0; }
.t-sky { background: var(--sky); } .t-sky .kicker { color: #0b5aa8; }
.t-mint { background: var(--mint); } .t-mint .kicker { color: #0a6b44; }
.t-peach { background: var(--peach); } .t-peach .kicker { color: #9a4a00; }
.t-rose { background: var(--rose); } .t-rose .kicker { color: #a3134f; }
.t-ice { background: var(--ice); } .t-ice .kicker { color: #076b6b; }
.t-lemon { background: var(--lemon); } .t-lemon .kicker { color: #7a5a00; }

.btn { display: inline-block; margin-top: 6px; color: var(--ink); padding: 12px 20px; border-radius: 999px; font-weight: 700; text-decoration: none; border: 0; cursor: pointer; font-size: 15px; font-family: var(--font); }
.b-lemon { background: var(--lemon); } .b-sky { background: var(--sky); } .b-mint { background: var(--mint); } .b-rose { background: var(--rose); } .b-lav { background: var(--lav); } .b-peach { background: var(--peach); }
.btn[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }

.stat { display: inline-flex; gap: 10px; align-items: baseline; border-radius: 14px; padding: 8px 14px; margin: 4px 6px 4px 0; }
.stat b { font-family: var(--mono); font-size: 22px; }
.stat span { font-size: 13px; font-weight: 600; }

.range { width: 100%; margin: 6px 0 4px; accent-color: #0b5aa8; }
.range-labels { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; }

.alert { position: fixed; right: 16px; bottom: 60px; z-index: 15; width: min(360px, calc(100vw - 32px)); padding: 16px 18px; border-radius: 18px; background: var(--rose); color: var(--ink); box-shadow: 0 18px 50px rgba(0,0,0,0.45); transform: translateY(20px); opacity: 0; transition: opacity 0.4s, transform 0.4s; pointer-events: none; }
.alert.show { opacity: 1; transform: none; pointer-events: auto; }
.alert .kicker { color: #a3134f; margin: 0 0 4px; }
.alert p { margin: 0 0 6px; }
.alert .tag { display: inline-block; background: var(--lemon); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; }

.proto-note { position: fixed; left: 16px; bottom: 12px; z-index: 20; margin: 0; background: var(--peach); color: var(--ink); padding: 5px 12px; border-radius: 999px; font-size: 11.5px; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .chapter { align-items: flex-end; padding-bottom: 70px; }
  .card, .card.wide { margin: 0 auto; padding: 20px; }
  .hud { padding: 12px; } .hud-brand, .proto-note { display: none; }
  .alert { bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { #loader, .alert { transition: none; } }
