@font-face { font-family: Fraunces; font-style: normal; font-weight: 300 800; font-display: swap; src: url("fonts/fraunces-normal-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Fraunces; font-style: normal; font-weight: 300 800; font-display: swap; src: url("fonts/fraunces-normal-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Fraunces; font-style: italic; font-weight: 300 800; font-display: swap; src: url("fonts/fraunces-italic-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Fraunces; font-style: italic; font-weight: 300 800; font-display: swap; src: url("fonts/fraunces-italic-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/source-serif-4-normal-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/source-serif-4-normal-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400 700; font-display: swap; src: url("fonts/source-serif-4-italic-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400 700; font-display: swap; src: url("fonts/source-serif-4-italic-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --paper: #f6f1e8;
  --paper-2: #efe7da;
  --card: rgba(252, 249, 243, 0.94);
  --ink: #221a16;
  --ink-2: #4d423b;
  --muted: #6c5f56;
  --rule: #d9cdbd;
  --accent: #a3401c;
  --accent-ink: #8a3414;
  --gold: #9a6a12;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 8px 28px rgba(60, 40, 20, 0.08);
  --bar-h: 3rem;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --display: Fraunces, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14161c; --paper-2: #1b1e26; --card: rgba(24, 27, 35, 0.95);
    --ink: #efe8dc; --ink-2: #d4cbbd; --muted: #a99e90; --rule: #343844;
    --accent: #f09a6c; --accent-ink: #f3ae86; --gold: #f0c46a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14161c; --paper-2: #1b1e26; --card: rgba(24, 27, 35, 0.95);
  --ink: #efe8dc; --ink-2: #d4cbbd; --muted: #a99e90; --rule: #343844;
  --accent: #f09a6c; --accent-ink: #f3ae86; --gold: #f0c46a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 0.5rem); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.125rem/1.62 var(--serif); font-optical-sizing: auto; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
i, em { font-style: italic; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 0.5rem; z-index: 50; background: var(--paper); padding: 0.4rem 0.8rem; }

/* top bar, one line */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--bar-h); display: flex; align-items: center; gap: 0.9rem; padding: 0 1rem; background: color-mix(in srgb, var(--paper) 92%, transparent); border-bottom: 1px solid var(--rule); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 0.92rem; }
.topbar .home { color: var(--ink); text-decoration: none; font-weight: 600; white-space: nowrap; }
.topnav { display: flex; gap: 0.9rem; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1 1 auto; }
.topnav::-webkit-scrollbar { display: none; }
.topnav { -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); }
.topnav a { color: var(--muted); text-decoration: none; white-space: nowrap; padding: 0.2rem 0; border-bottom: 2px solid transparent; }
.topnav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.icon-btn { flex: 0 0 auto; width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 1px solid var(--rule); background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
.topbar .lang { color: var(--muted); text-decoration: none; font-size: 0.86rem; white-space: nowrap; }
.topbar .lang:hover { color: var(--ink); text-decoration: underline; }

/* the descent: a dark scene that stays dark in both themes; glass cards over it */
.story { position: relative; background: #07090e; }
.stage { position: sticky; top: var(--bar-h); height: calc(100svh - var(--bar-h)); overflow: hidden; background: #0d0b09; z-index: 1; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hud { position: absolute; left: 1rem; bottom: 1rem; z-index: 2; color: #ece6da; font: 600 0.8rem/1.25 ui-monospace, Menlo, monospace; pointer-events: none; text-shadow: 0 1px 6px #000; }
.hud p { margin: 0; }
.hud-town { color: #f3c96f; letter-spacing: 0.04em; }
.hud-age { font-size: 1.3rem; margin-top: 0.2rem !important; }
.stage .fallback { display: none; }
.stage:not(.live) .hud { display: none; }

.flow { position: relative; z-index: 2; margin-top: calc(-100svh + var(--bar-h)); pointer-events: none; }
.flow .step { min-height: 115svh; display: flex; align-items: center; justify-content: flex-end; padding: 0 max(1rem, 4.5rem) 0 1rem; }
.flow .step:last-child { min-height: 150svh; }
.card, .hero { pointer-events: auto; }
.card { max-width: 29rem; padding: 1.3rem 1.4rem 1.2rem; border-radius: 16px; color: #efe8dc; background: rgba(12, 15, 22, 0.9); border: 1px solid rgba(243, 201, 111, 0.22); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45); }
.card .when { margin: 0 0 0.35rem; font: 600 0.8rem/1.2 ui-monospace, Menlo, monospace; letter-spacing: 0.06em; color: #f3c96f; }
.card h2 { margin: 0 0 0.7rem; font: 400 clamp(1.7rem, 3.6vw, 2.35rem)/1.08 var(--display); letter-spacing: -0.01em; }
.card p { margin: 0 0 0.8rem; font-size: 1.04rem; line-height: 1.55; color: #ddd5c6; }
.card p:last-child { margin-bottom: 0; }
.card a { color: #f5cf85; }
.more a { font-weight: 600; text-decoration: none; }
.more a::after { content: " \2192"; }
.more a:hover { text-decoration: underline; }
.also { font-size: 0.95rem; }
.card .also { color: #b9b0a0; }

.flow .hero { min-height: calc(100svh - var(--bar-h)); justify-content: flex-start; align-items: flex-start; flex-direction: column; padding: clamp(1.6rem, 6vh, 4.5rem) 1rem 2rem max(1rem, calc((100vw - 76rem) / 2 + 1rem)); color: #f2ebdf; }
.hero .kicker { font: 600 0.82rem/1.3 var(--serif); letter-spacing: 0.18em; text-transform: uppercase; color: #cfc5b4; margin: 0 0 0.9rem; padding-top: 0.9rem; border-top: 1px solid rgba(243, 201, 111, 0.45); display: inline-block; }
.hero h1 { font: 380 clamp(2.2rem, 6.4vw, 4.9rem)/1.03 var(--display); letter-spacing: -0.02em; margin: 0 0 1.1rem; max-width: 17ch; text-shadow: 0 2px 22px rgba(0, 0, 0, 0.7); font-variation-settings: "SOFT" 50, "WONK" 0; }
.hero .deck { font-size: clamp(1.08rem, 2.2vw, 1.32rem); line-height: 1.5; color: #e2dacb; max-width: 34rem; margin: 0 0 1rem; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8); }
.hero .how { font-size: 0.98rem; color: #bdb4a5; max-width: 34rem; margin: 0; }

/* reading rail */
.rail { position: fixed; right: 1.1rem; top: 50%; transform: translateY(-50%); z-index: 20; display: none; flex-direction: column; gap: 0.62rem; }
.rail a { position: relative; display: block; width: 7px; height: 7px; border-radius: 50%; background: rgba(160, 150, 135, 0.55); }
.rail a[aria-current] { background: var(--accent); transform: scale(1.45); }
.rail a span { position: absolute; right: 1.2rem; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: 0.8rem; background: var(--paper); color: var(--ink); padding: 0.15rem 0.5rem; border-radius: 6px; border: 1px solid var(--rule); opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.rail a:hover span, .rail a:focus-visible span { opacity: 1; }
@media (min-width: 76rem) { .rail { display: flex; } }

/* after the descent: page chrome follows the theme */
.prose { max-width: 40rem; margin: 0 auto; padding: 4.5rem 1rem 1rem; }
.prose h2 { font: 400 clamp(2rem, 4.6vw, 3rem)/1.08 var(--display); letter-spacing: -0.015em; margin: 0 0 1rem; }
.prose p { margin: 0 0 1.05rem; }
.ending { max-width: 44rem; padding: 5rem 1rem 3rem; }
.ending p { font: 360 clamp(1.35rem, 3.2vw, 1.9rem)/1.38 var(--display); margin: 0 0 1.2rem; }
.ending p:last-child { color: var(--accent-ink); }
.shelf { max-width: 76rem; }
.shelf > p { max-width: 40rem; color: var(--ink-2); margin: 0 0 2rem; }
.shelf ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.2rem 2rem; }
.shelf li { padding: 0.6rem 0; border-bottom: 1px dotted var(--rule); }
.shelf li a { font-weight: 600; text-decoration: none; color: var(--ink); display: block; line-height: 1.3; }
.shelf li a:hover { color: var(--accent-ink); text-decoration: underline; }
.shelf li span { display: block; font-size: 0.92rem; color: var(--muted); line-height: 1.4; margin-top: 0.15rem; }
.method { font-size: 0.98rem; color: var(--ink-2); }
.method h2 { font-size: 1.8rem; color: var(--ink); }
.method .updated { color: var(--muted); }
.prose .more { font-size: 1rem; }
.foot { max-width: 76rem; margin: 2rem auto 0; padding: 2rem 1rem 3rem; border-top: 1px solid var(--rule); font-size: 0.92rem; color: var(--muted); }
.foot a { color: var(--muted); }

/* phones: the scene fills the top, the card sits low so the drawing stays visible */
@media (max-width: 47.5rem) {
  .flow .step { min-height: 120svh; }
  .card { padding: 1rem 1.05rem 0.95rem; }
  .card p { font-size: 1rem; }
  .hero h1 { font-size: clamp(1.85rem, 8.4vw, 2.6rem); }
  .flow .step.hero { align-items: flex-start; }
}
html:not(.js) .stage { display: none; }
html:not(.js) .flow { margin-top: 0; }
html:not(.js) .flow .step { min-height: 0; padding-top: 1.2rem; padding-bottom: 1.2rem; justify-content: center; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print { .stage, .rail, .topbar { display: none; } .flow { margin-top: 0; } .flow .step { min-height: 0; } }

/* the town picker, on the opening screen */
.picker { margin: 0.4rem 0 1.1rem; max-width: 30rem; pointer-events: auto; }
.picker[hidden] { display: none; }
.picker label { display: block; font: 600 0.78rem/1.2 ui-monospace, Menlo, monospace; letter-spacing: 0.08em; text-transform: uppercase; color: #f3c96f; margin-bottom: 0.35rem; }
.combo { position: relative; }
.combo input { width: 100%; font: 400 1.25rem/1.3 var(--serif); padding: 0.55rem 0.8rem; border-radius: 10px; border: 1px solid rgba(243, 201, 111, 0.55); background: rgba(12, 15, 22, 0.88); color: #f2ebdf; min-height: 44px; }
.combo input::placeholder { color: #9c9383; }
.combo ul { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; list-style: none; margin: 0; padding: 0.25rem; border-radius: 10px; background: #12151d; border: 1px solid rgba(243, 201, 111, 0.35); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
.combo li { padding: 0.5rem 0.65rem; border-radius: 7px; cursor: pointer; color: #efe8dc; min-height: 44px; display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.combo li span { color: #a99e90; font-size: 0.85rem; }
.combo li[aria-selected="true"], .combo li:hover { background: rgba(243, 201, 111, 0.16); }
.pick-note { margin: 0.45rem 0 0; font-size: 0.9rem; color: #bdb4a5; }
.hero .how { font-size: 0.95rem; }
.ending [data-k], .card [data-k] { color: #f5cf85; }
.ending [data-k] { color: var(--accent-ink); }
@media (max-width: 62.5rem) {
  .flow .step { justify-content: flex-end; padding: 0 0.7rem 0 5.2rem; }
  .flow .hero { justify-content: flex-start; padding-left: 5.2rem; padding-right: 0.8rem; padding-top: 22svh; }
  .hud { left: auto; right: 0.8rem; top: auto; bottom: 0.9rem; text-align: right; }
}
@media (max-width: 47.5rem) {
  .flow .step { padding: 0 0.6rem 0 4.4rem; }
  .flow .hero { padding-left: 4.4rem; padding-top: 14svh; min-height: calc(100svh - var(--bar-h)); }
  .hero .deck { font-size: 1.02rem; }
}
