/* Erised — a midnight reading room. Product tokens from apps/erised/frontend/src/style.css.
   Fraunces carries titles, Newsreader carries prose, the system sans carries controls,
   Silkscreen appears only inside the 8-bit section (display=swap; the mono fallback is set uppercase so it still reads as a title). One gradient on the page: the hero's dusk sky. */

:root {
  color-scheme: dark;
  --night: #111D2D;
  --water: #17283A;
  --silver: #DCE6ED;
  --mist: #9DADBF;
  --gold: #C9B78A;
  --rose: #EAA5A5;
  --sage: #A9BEA4;
  --line: #344255;
  --prose: #CFDAE2;
  --hairline: color-mix(in srgb, var(--silver) 12%, transparent);
  --gold-soft: color-mix(in srgb, var(--gold) 14%, transparent);
  --gold-edge: color-mix(in srgb, var(--gold) 45%, transparent);
  --field-bg: color-mix(in srgb, var(--night) 72%, #000);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --pixel: "Silkscreen", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ease-settle: cubic-bezier(0.2, 0.7, 0.2, 1);
  --radius: 4px;
  --max-w: 1200px;
  --shell-bg: #0B1420;
  --shell-fg: var(--silver);
  --footer-bg: #0B1420;
  --footer-fg: var(--silver);
  --focus-ring: var(--gold);
  --selection-bg: #5A5440;
  --selection-fg: #fff;
}

html { scroll-padding-top: 24px; }
body {
  background: var(--night);
  color: var(--silver);
  font: 400 16px/1.5 var(--sans);
  font-synthesis: none;
}
/* The product's still grain, fixed beneath everything; desktop only, so phones never repaint it on scroll. */
@media (min-width: 900px) and (prefers-reduced-motion: no-preference) {
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
}
main, header, footer, .aer-strip { position: relative; z-index: 1; }
.skip-link { background: var(--gold); color: var(--night); }
h1, h2 { text-wrap: balance; }

/* ---------- Nav ---------- */
.nav { background: var(--night); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 16px; min-height: 76px; }
.nav__brand { margin-right: auto; }
.nav__menu { order: 2; }
.nav__cta { order: 3; }
.nav__toggle { order: 4; }
.nav__brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--silver); font: 330 26px/1 var(--display); letter-spacing: 0.045em; padding: 8px 0; }
.nav__brand svg { width: 22px; height: 28px; color: var(--gold); }
.nav__menu { display: flex; align-items: center; gap: 28px; }
.nav__menu a { font: 500 14px/1 var(--sans); color: var(--mist); text-decoration: none; padding: 15px 0; }
.nav__menu a:hover { color: var(--gold); }
.nav__cta, .nav__cta:hover { padding-top: 10px; padding-bottom: 10px; color: #0B1420; }
.nav__toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--gold-edge); border-radius: var(--radius); flex-direction: column; justify-content: center; align-items: center; gap: 6px; }
.nav__toggle span { width: 18px; height: 1.5px; background: var(--gold); transition: transform 160ms ease; }
.nav__toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }
@media (max-width: 760px) {
  .nav { position: relative; z-index: 40; }
  .nav__toggle { display: flex; }
  .nav__menu { position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0; background: var(--night); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 16px; box-shadow: 0 24px 40px rgb(0 0 0 / 0.45); }
  .nav__menu[hidden] { display: none; }
  .nav__menu a { padding: 14px 4px; border-bottom: 1px solid var(--hairline); font-size: 16px; }
  .nav .wrap { gap: 12px; }
  .nav__cta { padding-left: 12px; padding-right: 12px; }
}
@media (min-width: 761px) { .nav__menu[hidden] { display: flex; } }

/* ---------- Buttons: the product's gold primary and quiet outline ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 13px 22px; border: 1px solid transparent; border-radius: var(--radius); font: 600 14px/1.4 var(--sans); letter-spacing: 0.01em; text-decoration: none; white-space: nowrap; }
.btn--primary { background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 86%, #fff) 0%, var(--gold) 100%); color: color-mix(in srgb, var(--night) 92%, #000); border-color: color-mix(in srgb, var(--gold) 70%, #000); box-shadow: inset 0 1px rgb(255 255 255 / 0.28), 0 1px rgb(0 0 0 / 0.35); }
.btn--primary:hover { background: color-mix(in srgb, var(--gold) 84%, #fff); }
.btn--quiet { background: transparent; color: var(--gold); border-color: var(--gold-edge); }
.btn--quiet:hover { border-color: var(--gold); }
.btn--sm { min-height: 44px; padding: 10px 16px; font-size: 13px; }
.btn--static { min-height: 40px; padding: 8px 16px; margin-top: 12px; font-size: 13px; pointer-events: none; }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(36px, 5vw, 64px) 0 clamp(40px, 6vw, 72px);
  background:
    radial-gradient(ellipse 80% 55% at 50% -14%, color-mix(in srgb, var(--mist) 12%, transparent), transparent 72%),
    linear-gradient(180deg, #1B3047 0%, var(--water) 42%, var(--night) 100%);
}
.hero__grid {
  display: grid;
  /* The art column gives way between 901px and ~1180px so the reading column keeps a ~50ch measure. */
  grid-template-columns: clamp(300px, 40%, 470px) minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  grid-template-areas: "art title" "art lede" "art scene";
  column-gap: clamp(32px, 5vw, 88px);
  align-items: start;
}
.hero__art { grid-area: art; padding: 18px 18px 0; position: sticky; top: 24px; }
.hero__title { grid-area: title; font: 360 clamp(38px, 2.2vw + 24px, 60px)/1.08 var(--display); letter-spacing: -0.014em; color: var(--silver); max-width: 16ch; margin-top: 8px; }
.hero__title span { display: block; }
.hero__lede { grid-area: lede; margin-top: 22px; font: 400 clamp(18px, 0.4vw + 15px, 20px)/1.6 var(--serif); color: var(--prose); max-width: 52ch; }
.scene { grid-area: scene; margin-top: clamp(28px, 3.5vw, 44px); max-width: 60ch; }
@media (max-width: 900px) {
  .hero { padding-top: 28px; }
  .hero__grid { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "title" "lede" "art" "scene"; }
  .hero__art { position: static; margin-top: 32px; padding: 18px 18px 0; }
  .hero__title { max-width: none; }
}

/* ---------- The mirror ---------- */
.mirror { margin: 0; position: relative; width: min(100%, 470px); margin-inline: auto; }
.mirror__glass {
  position: relative;
  aspect-ratio: 47 / 44;
  border-radius: 50% 50% 3px 3px / 46% 46% 3px 3px;
  overflow: hidden;
  background: var(--water);
  border: 1px solid #918772;
  box-shadow: 0 0 0 6px var(--night), 0 0 0 7px #6B6D68, 0 0 0 16px var(--night), 0 0 0 17px #333F4D;
  isolation: isolate;
}
/* The pan overhangs the glass by 7.1% above, 9% at the sides and 1.82% below. That makes the pan 440px tall when the
   glass is 434px wide (every size from 901px up, and tablets), so the 480x220 pixel art lands on exactly 2 CSS px per
   art pixel. The drift in page.js stays inside the overhang (-5 to +17px down, +-16px across), so no edge ever shows,
   and the traveller's feet stay in frame at every end position. */
.mirror__pan { position: absolute; inset: -7.1% -9% -1.82%; will-change: transform; }
.mirror__scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; image-rendering: pixelated; opacity: 0; transition: opacity 900ms ease; }
/* Per-scene framing: the ember forge sits left of centre in its painting. */
.mirror__scene[data-scene="ember"] { object-position: 2% 100%; }
.mirror__scene.is-current { opacity: 1; }
.mirror__sheen {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(160deg, rgb(255 255 255 / 0.10) 0%, transparent 36%, transparent 68%, rgb(255 255 255 / 0.04) 100%);
  box-shadow: inset 0 0 60px rgb(11 21 34 / 0.85), inset 0 -40px 60px -30px rgb(11 21 34 / 0.6);
}
.mirror__plinth { display: block; height: 8px; margin: 26px 4px 0; background: #454C53; border-top: 1px solid #8B877B; border-bottom: 1px solid #262F3B; box-shadow: 0 10px 24px -8px rgb(0 0 0 / 0.6); }
.mirror__caption { margin-top: 14px; text-align: center; font: italic 400 14px/1.5 var(--serif); color: var(--mist); text-wrap: balance; }
/* The pending replica sits outside the hero's padded column: keep its two outer rings inside the gutter. */
.replica.mirror { width: min(100% - 36px, 470px); margin: 18px auto 0; }
/* Pending state: the backdrop stands in, dimmed, with the mirror mark over it (still; no loop). */
.mirror--pending .mirror__scene { opacity: 0.32; filter: blur(5px) saturate(0.8); }
.mirror__pending { position: absolute; inset: 0; display: grid; place-items: center; color: var(--gold); pointer-events: none; }
.mirror__pending svg { width: 44px; height: 56px; opacity: 0.8; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--gold) 45%, transparent)); }

/* ---------- The reading column replica (apps/erised/frontend/src/stage.css, polish.css) ---------- */
.scene__eyebrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.scene__eyebrow p { font: 600 10.5px/1.5 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: color-mix(in srgb, var(--mist) 70%, var(--silver)); }
.turn-badge { border-radius: 999px; padding: 5px 11px; background: var(--gold-soft); border: 1px solid var(--gold-edge); color: var(--gold); font: 600 10.5px/1.2 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; flex: none; }
.scene__prior { font: italic 400 16px/1.6 var(--serif); color: var(--mist); border-left: 1px solid var(--gold-edge); padding-left: 16px; margin-bottom: 24px; }
.scene__prior span { font: 600 10.5px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-style: normal; margin-right: 0.6em; }
.scene__title { font: 360 clamp(26px, 1.2vw + 18px, 34px)/1.12 var(--display); letter-spacing: -0.012em; color: var(--silver); text-wrap: balance; margin-bottom: 18px; }
.scene__hairline { display: block; width: 72px; height: 1px; margin: 0 0 24px; background: linear-gradient(90deg, var(--gold), transparent); }
.scene__prose { font-family: var(--serif); font-size: 18px; line-height: 1.7; color: var(--prose); max-width: 58ch; text-wrap: pretty; }
.scene__prose p + p { margin-top: 0.85em; }
.scene__prose > p:first-child::first-letter { float: left; font: 400 3.3em/0.82 var(--display); color: var(--gold); padding: 0.08em 0.09em 0 0; margin-top: 0.04em; }
@media (max-width: 650px) { .scene__prose { font-size: 17px; } }

.choices { margin-top: 26px; border-top: 1px solid var(--line); }
.choices__ask { font: italic 400 15px/1.4 var(--serif); color: var(--mist); padding: 14px 0 6px; }
.choice {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 18px; gap: 0 14px; align-items: center;
  min-height: 64px; padding: 15px 4px; border-bottom: 1px solid var(--line);
  color: inherit; text-decoration: none;
  transition: background-color 180ms ease;
}
.choice:hover { background: linear-gradient(90deg, var(--gold-soft), transparent 70%); }
.choice__index { width: 32px; height: 32px; justify-self: center; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgb(255 255 255 / 0.16); color: var(--night); transition: background-color 160ms ease, border-color 160ms ease; }
.choice__index svg { width: 14px; height: 18px; }
.choice--primary .choice__index, .choice:hover .choice__index, .choice:focus-visible .choice__index { background: var(--gold); border-color: var(--gold); }
.choice strong { display: block; font: 500 15px/1.35 var(--sans); color: var(--silver); }
.choice small { display: block; margin-top: 3px; font: 400 14px/1.45 var(--serif); color: color-mix(in srgb, var(--mist) 80%, var(--silver)); text-wrap: pretty; }
.choice__arrow { width: 18px; height: 18px; color: var(--mist); transition: transform 180ms var(--ease-settle), color 180ms ease; }
.choice:hover .choice__arrow, .choice:focus-visible .choice__arrow { color: var(--gold); transform: translateX(3px); }

.free-action { display: flex; align-items: center; margin-top: 24px; border-radius: 6px; background: var(--field-bg); border: 1px solid var(--hairline); box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.28); color: inherit; text-decoration: none; transition: border-color 160ms ease; }
.free-action:hover { border-color: var(--gold-edge); }
.free-action__field { flex: 1; font: italic 400 17px/1.6 var(--serif); padding: 11px 16px; color: color-mix(in srgb, var(--mist) 75%, transparent); }
.free-action__send { width: 40px; height: 40px; flex: none; margin: 0 10px 0 4px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--hairline); color: color-mix(in srgb, var(--mist) 55%, transparent); }
.free-action__send svg { width: 18px; height: 18px; }
.free-action__send { transition: color 160ms ease, border-color 160ms ease; }
.free-action:hover .free-action__send, .free-action:focus-visible .free-action__send { color: var(--gold); border-color: var(--gold-edge); }

/* The hero's one orchestrated moment: the artwork fades over its placeholder, then the column arrives in order. */
@media (prefers-reduced-motion: no-preference) {
  .hero .mirror__glass { animation: art-fade 420ms ease 120ms both; }
  .scene > * { animation: arrive 320ms var(--ease-settle) both; }
  .scene__eyebrow { animation-delay: 300ms; }
  .scene__prior { animation-delay: 380ms; }
  .scene__title { animation-delay: 460ms; }
  .scene__hairline { animation-delay: 560ms; }
  .scene__prose { animation-delay: 640ms; }
  .choices { animation-delay: 780ms; }
  .free-action { animation-delay: 940ms; }
}
@keyframes art-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Sections ---------- */
.section { padding-top: clamp(64px, 9vw, 120px); }
.section__head { max-width: 62ch; }
.section h2, .access h2 { font: 400 clamp(30px, 1.4vw + 20px, 42px)/1.15 var(--display); letter-spacing: -0.008em; color: var(--silver); }
.section__lede { margin-top: 20px; font: 400 19px/1.6 var(--serif); color: var(--prose); text-wrap: pretty; }
.section__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); margin-top: clamp(32px, 4vw, 48px); align-items: start; }
.section__grid--tight { gap: clamp(24px, 3vw, 40px); }
@media (max-width: 900px) { .section__grid { grid-template-columns: 1fr; } }
/* Beside a longer list, the replica travels with the reading instead of ending in a blank column. */
@media (min-width: 901px) {
  .section__grid > .desire-replica, #story .section__grid > div:first-child, #arcade .section__grid > div:first-child { position: sticky; top: 24px; }
}
/* Two sheets side by side end on one line. */
.section__grid--tight { align-items: stretch; }
.section__grid--tight > .sheet { display: flex; flex-direction: column; }
.section__grid--tight > .sheet > .sheet__body { flex: 1; }

.features { display: grid; gap: 24px; }
.features--row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; margin-top: clamp(32px, 4vw, 48px); }
@media (max-width: 1000px) { .features--row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .features--row { grid-template-columns: 1fr; gap: 24px; } }
.features > li { position: relative; padding-left: 18px; }
.features > li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 5px; height: 5px; background: var(--gold); transform: rotate(45deg); }
.features strong { display: block; font: 600 15px/1.4 var(--sans); color: var(--silver); }
.features p { margin-top: 4px; font: 400 16.5px/1.6 var(--serif); color: var(--mist); text-wrap: pretty; }

.steps { display: grid; gap: 24px; counter-reset: step; }
.steps > li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 0 14px; }
.steps > li::before { counter-increment: step; content: counter(step); grid-row: 1 / 3; font: italic 400 30px/1 var(--serif); font-variant-numeric: lining-nums; color: var(--gold); opacity: 0.85; padding-top: 1px; }
.steps strong { display: block; font: 600 15px/1.4 var(--sans); color: var(--silver); }
.steps p { margin-top: 4px; font: 400 16.5px/1.6 var(--serif); color: var(--mist); text-wrap: pretty; }

/* ---------- Replicas of the app's sheets (apps/erised/frontend/src/polish.css) ---------- */
.replica { margin: 0; }
.replica__caption { margin-top: 12px; font: italic 400 14px/1.5 var(--serif); color: var(--mist); text-wrap: balance; }
.sheet .replica__caption { padding: 14px 24px 16px; border-top: 1px solid var(--hairline); margin: 0; }
.sheet { background: linear-gradient(180deg, color-mix(in srgb, var(--water) 97%, #fff), var(--water)); border: 1px solid var(--hairline); border-left-color: color-mix(in srgb, var(--silver) 18%, transparent); box-shadow: inset 1px 0 0 rgb(255 255 255 / 0.03); }
.sheet__heading { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--hairline); background: color-mix(in srgb, var(--water) 94%, #fff); }
.sheet__heading svg { width: 20px; height: 26px; color: var(--gold); opacity: 0.72; flex: none; }
.sheet__title { font: 400 24px/1.2 var(--display); letter-spacing: -0.005em; }
.sheet__body { padding: 20px 24px 22px; }
.sheet__sub { display: flex; align-items: baseline; gap: 10px; font: 400 20px/1.25 var(--display); margin-bottom: 12px; }
.sheet__sub::before { content: "✧"; font: 400 12px/1 var(--display); color: var(--gold); transform: translateY(-0.15em); }
.quiet { font: italic 400 15px/1.6 var(--serif); color: var(--mist); }
@media (max-width: 560px) { .sheet__heading { padding: 16px 18px; } .sheet__body { padding: 18px 18px 20px; } .sheet .replica__caption { padding: 12px 18px 14px; } }

/* Setup: the desire field is the one "writing on a page" moment, with only a gold underline. */
.desire-replica .sheet__body { padding-top: 16px; }
.setup-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.setup-top__back { display: inline-flex; align-items: center; gap: 6px; font: 500 13px/1.4 var(--sans); color: var(--mist); }
.setup-top__back svg { width: 16px; height: 16px; }
.setup-top .quiet, .setup-foot .quiet { font-size: 14px; }
.setup-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.setup-foot .btn { margin-top: 0; }
.track { display: flex; gap: 6px; margin-bottom: 26px; }
.track span { width: 28px; height: 3px; border-radius: 2px; background: var(--line); }
.track .is-filled { background: var(--gold-edge); }
.track .is-current { background: var(--gold); }
.desire-replica__label { font: 400 22px/1.3 var(--display); color: var(--silver); }
.desire-replica__input { position: relative; min-height: calc(1.5em + 24px); margin-top: 14px; padding: 12px 0; border-bottom: 1px solid var(--gold); font: 400 19px/1.5 var(--serif); color: var(--silver); text-wrap: pretty; }
/* While the demo has cleared the field, the product's placeholder shows in its place. */
.desire-replica__input.is-empty::before { content: attr(data-placeholder); position: absolute; left: 0; right: 0; top: 12px; font-style: italic; color: color-mix(in srgb, var(--mist) 85%, transparent); pointer-events: none; }
.desire-replica__caret { display: none; width: 1.5px; height: 1.1em; margin-left: 2px; vertical-align: -0.18em; background: var(--gold); }
.desire-replica.is-typing .desire-replica__caret { display: inline-block; }
.desire-replica__input.is-empty .desire-replica__caret { position: relative; z-index: 1; margin-left: 0; }
/* Locked (field empty): an outline, not a faded fill, so it reads as "not yet" rather than broken. */
.desire-replica.is-locked .desire-replica__go { background: transparent; color: var(--mist); border-color: var(--line); box-shadow: none; }
.desire-replica__hint { margin-top: 12px; font: italic 400 14px/1.5 var(--serif); color: var(--gold); text-wrap: pretty; }

/* Party */
.party { margin-top: 14px; }
.party__member { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.party__member strong { display: block; font: 400 19px/1.3 var(--display); letter-spacing: -0.005em; }
.party__member small { display: block; font: 400 12px/1.4 var(--sans); color: var(--mist); }
.party__member .turn-badge { margin-left: auto; }
.monogram { width: 44px; height: 56px; flex: none; display: grid; place-items: center; border-radius: 50% 50% 3px 3px; background: var(--field-bg); border: 1px solid var(--gold-edge); font: 400 20px/1 var(--display); color: var(--gold); }
.monogram--sm { width: 30px; height: 38px; font-size: 14px; }
.invite { margin-top: 22px; }
.invite__code { font: 400 32px/1 var(--display); letter-spacing: 0.22em; text-indent: 0.22em; font-variant-numeric: lining-nums tabular-nums; color: var(--gold); text-align: center; padding: 22px; background: var(--field-bg); border: 1px solid var(--gold-edge); border-radius: var(--radius); box-shadow: inset 0 0 0 4px var(--field-bg), inset 0 0 0 5px var(--hairline); }
@media (max-width: 420px) { .invite__code { font-size: 24px; letter-spacing: 0.16em; text-indent: 0.16em; padding: 18px 10px; } }

/* Setup mode options (apps/erised/frontend/src/Setup.tsx) and the dice note */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .modes { grid-template-columns: 1fr; } }
.mode { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: start; padding: 16px; background: var(--field-bg); border: 1px solid var(--hairline); border-radius: var(--radius); }
.mode--selected { background: var(--gold-soft); border-color: var(--gold-edge); }
.mode > svg { width: 26px; height: 26px; color: var(--gold); margin-top: 2px; }
.mode strong { display: block; font: 500 15px/1.3 var(--sans); color: var(--silver); }
.mode span span { display: block; margin-top: 4px; font: 400 14px/1.5 var(--serif); color: var(--mist); }
.dice-replica { margin-top: 28px; }
.dice { display: flex; align-items: flex-start; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.dice + .dice { border-top: 0; }
.dice::before { content: ""; align-self: stretch; width: 2px; flex: none; border-radius: 1px; background: var(--sage); }
.dice--setback::before { background: var(--rose); }
.dice__die { position: relative; width: 44px; height: 44px; flex: none; }
.dice__die svg { width: 44px; height: 44px; color: var(--mist); opacity: 0.3; }
.dice__die b { position: absolute; inset: 0; display: grid; place-items: center; font: 400 20px/1 var(--display); font-variant-numeric: lining-nums; color: var(--gold); text-shadow: 0 0 6px var(--night), 0 0 2px var(--night); }
.dice strong { display: block; font: 500 14px/1.5 var(--sans); color: var(--silver); }
.dice strong span { font: 600 10.5px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: #B8CDBD; margin-left: 12px; }
.dice--setback strong span { color: var(--rose); }
.dice p { margin-top: 2px; font: 400 13px/1.5 var(--sans); font-variant-numeric: tabular-nums; color: var(--mist); }

/* Journal */
.tabs { display: flex; gap: 22px; margin-bottom: 14px; border-bottom: 1px solid var(--hairline); }
.tabs span { padding: 0 0 10px; font: 500 13px/1.2 var(--sans); color: var(--mist); border-bottom: 1px solid transparent; margin-bottom: -1px; }
.tabs .is-on { color: var(--gold); border-bottom-color: var(--gold); }
.journal { margin-top: 10px; }
.journal__entry { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 16px; padding: 18px 8px 18px 12px; border-bottom: 1px solid var(--hairline); }
.journal__num { font: italic 400 28px/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--gold); opacity: 0.8; padding-top: 2px; }
.journal__entry strong { display: block; font: 400 21px/1.3 var(--display); letter-spacing: -0.005em; color: var(--silver); }
.journal__entry small { display: block; margin: 6px 0; font: 600 10.5px/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.journal__entry p { margin-top: 6px; font: 400 15px/1.6 var(--serif); color: var(--mist); }
.journal__entry.is-current { background: color-mix(in srgb, var(--gold) 8%, transparent); border: 1px solid var(--gold-edge); border-radius: var(--radius); margin-bottom: 4px; }
.journal__entry.is-current .journal__num { opacity: 1; text-shadow: 0 0 16px color-mix(in srgb, var(--gold) 55%, transparent); }
.journal__export { margin-top: 20px; }
.journal__export svg { width: 16px; height: 16px; }
.nowrap { white-space: nowrap; }
.journal__now { display: block; margin-bottom: 8px; font: 600 10.5px/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }

/* Character sheet */
.char__head { display: flex; align-items: center; gap: 14px; }
.char__name { font: 400 28px/1.2 var(--display); letter-spacing: -0.008em; color: var(--silver); }
.desire { position: relative; margin: 30px 0 24px; padding-top: 26px; font: italic 400 21px/1.5 var(--serif); color: #D4C3A0; }
.desire::before { content: "✧"; position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; font: 400 12px/1 var(--display); font-style: normal; color: var(--gold); background: linear-gradient(var(--hairline), var(--hairline)) left 50% / calc(50% - 14px) 1px no-repeat, linear-gradient(var(--hairline), var(--hairline)) right 50% / calc(50% - 14px) 1px no-repeat; }
.desire span { display: block; margin-top: 12px; font: 600 10.5px/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; font-style: normal; color: var(--mist); }
.health { display: flex; justify-content: space-between; align-items: baseline; }
.health strong { font: 600 10.5px/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--mist); }
.health span { font: 400 14px/1 var(--sans); font-variant-numeric: tabular-nums; color: #B8CDBD; }
.meter { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--w, 50%); border-radius: 3px; background: linear-gradient(90deg, #8FAE9A, #B8CDBD); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 24px; }
.stats > div { text-align: center; padding: 6px 0; }
.stats > div + div { border-left: 1px solid var(--hairline); }
.stats strong { display: block; font: 400 30px/1.1 var(--display); font-variant-numeric: lining-nums tabular-nums; color: #D4C3A0; }
.stats span { display: block; margin-top: 8px; font: 600 10.5px/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--mist); }
.carry { margin-top: 26px; }
.carry li { padding: 9px 0; border-bottom: 1px solid var(--hairline); font: 400 15px/1.5 var(--serif); color: var(--silver); }

/* Moods: the eight atmospheres, read as data */
.moods { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 12px 24px; width: min(100% - 36px, 470px); margin: 28px auto 0; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 480px) { .moods { column-gap: 8px; } .moods li { font-size: 14px; gap: 6px; } .moods i { width: 8px; height: 8px; } }
.moods[role="list"] { padding-top: 16px; } /* base.css zeroes list padding at higher specificity */
.moods li { display: inline-flex; align-items: center; gap: 8px; font: 400 15px/1 var(--serif); color: var(--silver); }
.moods i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgb(255 255 255 / 0.08); }
@media (max-width: 360px) { .moods { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 8-bit: Silkscreen only here */
/* Silkscreen is drawn on an 8px grid: 24px and 32px keep every pixel whole. Uppercase so the mono fallback reads as a title too. */
/* Weight 700 only reaches the fallback: Silkscreen ships one weight and body sets font-synthesis: none. */
.arcade h2 { font: 700 24px/1.25 var(--pixel); letter-spacing: 0; text-transform: uppercase; }
@media (min-width: 901px) { .arcade h2 { font-size: 32px; } }
/* The Platformer screen, after apps/erised/frontend/src/arcade.css (its own palette: cream ink, lantern gold). */
.arcade__screen { padding: 0 10px; background: #172738; border: 1px solid var(--line); color: #FFF0CC; font: 400 12px/1.4 var(--sans); }
.arcade__bar { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.arcade__back { padding-right: 12px; border-right: 1px solid #405651; color: #BFD0C5; white-space: nowrap; }
.arcade__name { flex: 1; min-width: 0; font: 700 16px/1 var(--pixel); white-space: nowrap; overflow: hidden; }
.arcade__name span { font: 400 12px/1 var(--sans); color: #B9C9BE; }
.arcade__btn { padding: 5px 9px; border: 1px solid #65746A; border-radius: 3px; background: #233D43; box-shadow: 0 2px 0 #0D2029; font-size: 11px; font-weight: 600; white-space: nowrap; }
.arcade__game { position: relative; overflow: hidden; border: 2px solid #526F65; box-shadow: 0 0 0 3px #0F212C; background: #3A2E3D; }
.arcade__game img { width: 100%; image-rendering: pixelated; }
.arcade__hud { position: absolute; inset: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 9px 11px 26px; background: linear-gradient(#132B3CBA, transparent); text-shadow: 0 2px 0 #102C36; font-weight: 700; }
.arcade__hp { display: inline-flex; align-items: center; gap: 6px; }
.arcade__hp i { font-style: normal; font-size: 14px; line-height: 1; color: #41646A; margin-right: 1px; }
.arcade__hp i.full { color: #FF9180; }
.arcade__hp small, .arcade__wallet small { font-size: 10px; font-weight: 400; color: #E8E6D2; }
.arcade__shards { margin-right: auto; margin-left: 4px; font-size: 13px; white-space: nowrap; }
.arcade__shards b { color: #8FE4E5; }
.arcade__shards small { font-size: 11px; font-weight: 400; color: #E3E9D7; }
.arcade__stage { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); text-align: center; white-space: nowrap; }
.arcade__stage small { display: block; font-size: 10px; font-weight: 400; color: #E0E8D3; }
.arcade__stage strong { display: block; margin-top: 1px; font: 700 16px/1 var(--pixel); }
.arcade__wallet { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; white-space: nowrap; }
.arcade__wallet b { color: #F7C66A; text-shadow: 1px 2px #9F6635; }
.arcade__message { position: absolute; right: 10px; bottom: 10px; max-width: 46%; padding: 6px 10px; background: #172F35E8; border-left: 3px solid #F7C66A; box-shadow: 0 3px 0 #14333B66; font-size: 12px; line-height: 1.4; color: #FFF0CC; text-wrap: balance; }
.arcade__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 10px 0; font-size: 11px; color: #91AFA1; }
.arcade__saved { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.arcade__saved i { width: 5px; height: 5px; background: #ACD387; }
.arcade__keys { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.arcade__keys > span { white-space: nowrap; }
.arcade__keys kbd { display: inline-block; margin-right: 3px; padding: 2px 5px; border: 1px solid #405651; border-bottom-width: 2px; border-radius: 3px; font: 600 10px/1.2 var(--sans); color: #FFF0CC; }
/* The screen sizes itself to its column, not the viewport (it is 370px wide at a 901px window, 540px at 1440). */
.arcade__screen { container-type: inline-size; }
@container (max-width: 520px) {
  .arcade__stage small { display: none; }
  .arcade__stage { top: 30px; }
}
@container (max-width: 440px) {
  /* Phone-sized stage (~150px tall): one HUD row, the objective set under the stage, no key legend. */
  .arcade__back { padding-right: 10px; }
  .arcade__back span, .arcade__name span { display: none; }
  .arcade__hud { padding-bottom: 18px; }
  .arcade__hud { flex-wrap: wrap; gap: 6px 10px; }
  .arcade__stage { display: none; }
  .arcade__message { position: static; max-width: none; margin-top: 8px; padding: 6px 10px; }
  .arcade__keys { display: none; }
}

/* The reflection sheet's finding (apps/erised/frontend/src/Reflection.tsx) */
.finding__label { margin-top: 20px; font: italic 400 14px/1.4 var(--serif); color: var(--gold); }
.finding__title { margin-top: 6px; font: 400 24px/1.25 var(--display); color: var(--silver); }
.finding__reading { margin-top: 12px; font: 400 16px/1.7 var(--serif); color: var(--prose); text-wrap: pretty; }
.finding details { margin-top: 12px; }
.finding summary { display: flex; align-items: center; min-height: 44px; padding: 6px 0; font: 500 13px/1.4 var(--sans); color: var(--gold); cursor: pointer; list-style: none; }
.finding summary::-webkit-details-marker { display: none; }
.finding summary::before { content: ""; width: 6px; height: 6px; margin-right: 10px; border-right: 1px solid var(--gold); border-bottom: 1px solid var(--gold); transform: rotate(-45deg); transition: transform 160ms ease; }
.finding details[open] summary::before { transform: rotate(45deg); }
.evidence { margin-top: 2px; }
.evidence li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--hairline); font: 400 14px/1.5 var(--serif); color: var(--mist); }
.evidence li span:first-child { font: 500 12px/1.6 var(--sans); color: var(--silver); }
.finding__q { margin-top: 18px; padding-left: 16px; border-left: 1px solid var(--gold-edge); font: italic 400 17px/1.6 var(--serif); color: var(--silver); }
.finding__exp { margin-top: 14px; font: 400 15px/1.6 var(--serif); color: var(--mist); }
.finding__exp strong { font-weight: 500; color: var(--silver); }

/* ---------- Access ---------- */
.access { padding: clamp(72px, 10vw, 140px) 0 clamp(72px, 9vw, 120px); }
.access__inner { max-width: 62ch; }
.access__icon { width: 56px; height: 56px; margin-bottom: 24px; border-radius: 12px; box-shadow: 0 0 0 1px var(--gold-edge); }
.access__lede { margin-top: 20px; font: 400 19px/1.6 var(--serif); color: var(--prose); text-wrap: pretty; }
.access__ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.access__notes { display: grid; gap: 8px; margin-top: 28px; font: 400 15px/1.6 var(--serif); color: var(--mist); text-wrap: pretty; }

.access__notes li { position: relative; padding-left: 18px; }
.access__notes li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 5px; height: 5px; background: var(--gold); transform: rotate(45deg); }
@media (min-width: 901px) {
  .access__inner { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: clamp(32px, 5vw, 72px); }
  .access__inner > * { grid-column: 1; }
  .access__lede { max-width: 62ch; }
  .access__notes { grid-column: 2; grid-row: 3 / span 2; align-self: start; gap: 0; margin-top: 26px; border-top: 1px solid var(--line); }
  .access__notes li { padding: 14px 0 14px 18px; border-bottom: 1px solid var(--hairline); }
  .access__notes li::before { top: calc(14px + 0.6em); }
}
/* ---------- Shared shell tints ---------- */
.aer-strip, .aer-footer { --focus-ring: var(--gold); }
.aer-strip { border-bottom: 1px solid rgb(255 255 255 / 0.06); }
.aer-footer { margin-top: 0; border-top: 1px solid var(--line); }
.aer-footer h2 { font: 400 18px/1.2 var(--display); color: var(--silver); }
.aer-footer p a { text-decoration: underline; text-decoration-color: var(--gold-edge); text-underline-offset: 3px; }

/* ---------- Reduced motion: parallax is off in page.js; here nothing is left to settle ---------- */
@media (prefers-reduced-motion: reduce) {
  .mirror__pan { transform: none !important; }
}

/* ---------- Pass 2: phones. Replica micro text never drops under 11px. ---------- */
@media (max-width: 640px) {
  .scene__eyebrow p, .turn-badge, .scene__prior span, .journal__entry small, .journal__now, .desire span,
  .health strong, .stats span, .dice strong span { font-size: 11px; letter-spacing: 0.12em; }
  .party__member small, .arcade__hp small, .arcade__wallet small, .arcade__shards small, .arcade__btn, .arcade__foot, .arcade__stage small { font-size: 11px; }
  .arcade__screen { font-size: 12px; }
  .choice:active { background: var(--gold-soft); }
}

/* ---------- Pass 2: motion. Transform/opacity only; plays once, then settles. Hidden starting
   states exist only under .ex, which page.js adds when JS runs without reduced motion. ---------- */
.btn { transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 180ms var(--ease-settle), box-shadow 160ms ease; }
.btn:not(.btn--static):active { transform: translateY(1px) scale(0.98); }
@media (hover: hover) {
  .btn:not(.btn--static):hover { transform: translateY(-1px); }
  .btn--primary:not(.btn--static):hover { box-shadow: inset 0 1px rgb(255 255 255 / 0.28), 0 6px 16px -6px rgb(0 0 0 / 0.6); }
}
.btn--quiet:not(.btn--static):hover { background: var(--gold-soft); }
.btn--quiet:active { background: var(--gold-soft); }
.choice:active .choice__index { transform: scale(0.92); }
.choice__index { transition: background-color 160ms ease, border-color 160ms ease, transform 160ms var(--ease-settle); }
.free-action:active { border-color: var(--gold); }
.nav__menu a { position: relative; }
@media (min-width: 761px) {
  .nav__menu a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 10px; height: 1px; background: var(--gold); transform: scaleX(0); transform-origin: left center; transition: transform 240ms var(--ease-settle); }
  .nav__menu a:hover::after, .nav__menu a:focus-visible::after { transform: scaleX(1); }
}
.desire-replica__go { transition: background-color 420ms ease, color 420ms ease, border-color 420ms ease, box-shadow 420ms ease; }
/* The hero's path preview (page.js) borrows the hover look of a choice row. */
.choice.is-preview { background: linear-gradient(90deg, var(--gold-soft), transparent 70%); }
.choice.is-preview .choice__index { background: var(--gold); border-color: var(--gold); }
.choice.is-preview .choice__arrow { color: var(--gold); transform: translateX(3px); }

@media (prefers-reduced-motion: no-preference) {
  @keyframes ex-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  @keyframes ex-pop { 0% { opacity: 0; transform: scale(0.9); } 60% { opacity: 1; transform: scale(1.04); } 100% { opacity: 1; transform: none; } }
  @keyframes ex-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  /* Hero title and lede arrive before the reading column (pure CSS: finishes without JS). */
  .hero__title span, .hero__lede { animation: ex-rise 640ms var(--ease-settle) both; }
  .hero__title span:nth-child(2) { animation-delay: 90ms; }
  .hero__lede { animation-delay: 180ms; }
  .scene__hairline { transform-origin: left center; animation-name: ex-grow; animation-duration: 600ms; }

  /* Staggered entrances, batched by arrival (page.js sets --d). */
  .ex .rv:not(.is-in) { opacity: 0; transform: translateY(18px); }
  .ex .rv.is-in { animation: ex-rise 620ms var(--ease-settle) both; animation-delay: calc(var(--d, 0) * 70ms); }

  /* Inside the sheets, rows arrive in order once the sheet is in. */
  .ex .sheet.rv:not(.is-in) :is(.party__member, .journal__entry, .carry li, .stats > div, .evidence li) { opacity: 0; }
  .ex .sheet.rv.is-in :is(.party__member, .journal__entry, .carry li, .stats > div) { animation: ex-rise 520ms var(--ease-settle) both; animation-delay: calc(var(--d, 0) * 70ms + 260ms + var(--n, 0) * 90ms); }
  .ex .sheet.rv.is-in .party__member .turn-badge { animation: ex-pop 420ms var(--ease-settle) both; animation-delay: calc(var(--d, 0) * 70ms + 760ms); }
  .ex .sheet.rv.is-in .meter i { transform-origin: left center; animation: ex-grow 900ms var(--ease-settle) both; animation-delay: calc(var(--d, 0) * 70ms + 500ms); }
  .ex .sheet.rv.is-in .journal__now { animation: ex-pop 420ms var(--ease-settle) both; animation-delay: calc(var(--d, 0) * 70ms + 700ms); }
  .ex .moods.rv.is-in li { animation: ex-pop 420ms var(--ease-settle) both; animation-delay: calc(var(--d, 0) * 70ms + var(--n, 0) * 60ms); }
  .ex .moods.rv:not(.is-in) li { opacity: 0; }
  .ex .track span { transform-origin: left center; }
  .ex .desire-replica.rv.is-in .track span { animation: ex-grow 360ms var(--ease-settle) both; animation-delay: calc(var(--d, 0) * 70ms + 200ms + var(--n, 0) * 110ms); }
  .ex .desire-replica.is-typing .desire-replica__caret { animation: ex-blink 0.9s steps(1) infinite; }
  @keyframes ex-blink { 50% { opacity: 0; } }
  .ex .desire-replica.is-ready .desire-replica__go { animation: ex-pop 480ms var(--ease-settle) both; }
  /* Dice: the die face settles after page.js has rolled it. */
  .ex .dice.is-rolling .dice__die b { opacity: 0.7; }
  .ex .dice.is-landed .dice__die { animation: ex-pop 420ms var(--ease-settle) both; }
  .ex .dice.is-landed strong span { animation: ex-pop 420ms var(--ease-settle) 120ms both; }
}

/* Once explicitly settled, restoring motion never replays this entrance.
   Deliberate scene/preview interactions retain their normal transitions. */
html.erised-motion-settled .hero .mirror__glass,
html.erised-motion-settled .scene > *,
html.erised-motion-settled .hero__title span,
html.erised-motion-settled .hero__lede,
html.erised-motion-settled .scene__hairline { animation: none!important; }
