/* ==========================================================================
   Mythos — a text-first world mythology game
   Palette: deep ink green, parchment, old gold, terracotta.
   ========================================================================== */

:root {
  color-scheme: dark;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --bg: #0e1310;
  --bg-2: #121914;
  --surface: #171f19;
  --surface-2: #1d2820;
  --surface-3: #26332a;
  --ink: #f0e9da;
  --ink-2: #d4ccbd;
  --muted: #aaa696;
  --line: rgba(240, 233, 218, 0.12);
  --line-strong: rgba(240, 233, 218, 0.24);
  --gold: #d8a94f;
  --gold-2: #f0cd7a;
  --gold-dim: rgba(216, 169, 79, 0.14);
  --terracotta: #c46b4c;
  --danger: #d97763;
  --ok: #8cba79;
  --teal: #6fa7a0;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --radius: 16px;
  --max: 1180px;
  --header-height: 76px;
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f3ede0;
  --bg-2: #ece4d3;
  --surface: #fdf9ef;
  --surface-2: #f6efdf;
  --surface-3: #e8ddc7;
  --ink: #241f17;
  --ink-2: #4c4437;
  --muted: #6b6253;
  --line: rgba(36, 31, 23, 0.14);
  --line-strong: rgba(36, 31, 23, 0.28);
  --gold: #8a5e18;
  --gold-2: #a9741f;
  --gold-dim: rgba(138, 94, 24, 0.12);
  --terracotta: #a14f32;
  --danger: #a84532;
  --ok: #4f7a3f;
  --teal: #3f6f69;
  --shadow: 0 18px 44px rgba(60, 45, 20, 0.14);
}

html[data-font="md"] { font-size: 100%; }
html[data-font="lg"] { font-size: 112.5%; }
html[data-font="xl"] { font-size: 125%; }

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 82% -8%, rgba(216, 169, 79, 0.08), transparent 62%),
    radial-gradient(900px 500px at -5% 12%, rgba(111, 167, 160, 0.06), transparent 58%),
    var(--bg);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="light"] body {
  background:
    radial-gradient(1000px 520px at 84% -6%, rgba(138, 94, 24, 0.1), transparent 60%),
    radial-gradient(800px 480px at -5% 10%, rgba(63, 111, 105, 0.08), transparent 58%),
    var(--bg);
}

img { max-width: 100%; }
svg { max-width: 100%; }

h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.6rem, 5.4vw, 4.6rem); }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.25rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a { color: inherit; }

::selection { background: var(--gold); color: #171208; }

:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: var(--gold-2);
  color: #171208;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.18s ease;
}

.skip-link:focus { transform: translateY(0); }

/* --------------------------------------------------------------------------
   Chrome
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 19, 16, 0.82);
  backdrop-filter: blur(16px) saturate(130%);
}

[data-theme="light"] .site-header { background: rgba(243, 237, 224, 0.86); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.brand__mark { display: block; }

.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name {
  font-family: var(--font-display);
  font-size: 1.32rem;
  letter-spacing: 0.02em;
}
.brand__tag {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  gap: 0.12rem;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.main-nav a:hover { background: var(--surface-2); color: var(--ink); }
.main-nav a[aria-current="page"] { background: var(--gold-dim); color: var(--gold-2); }

.header-actions { display: flex; gap: 0.35rem; flex: 0 0 auto; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.icon-button:hover { border-color: var(--gold); color: var(--gold-2); }

.voice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  height: 2.6rem;
  padding: 0 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.voice-button:hover { border-color: var(--gold); color: var(--gold-2); }
.voice-button svg { flex: 0 0 auto; }
.voice-button__chevron { width: 0.8rem; height: 0.8rem; opacity: 0.65; }

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  background: var(--bg-2);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.footer-brand { display: flex; gap: 0.9rem; align-items: flex-start; }
.footer-brand strong { font-family: var(--font-display); font-size: 1.05rem; }
.footer-brand p { max-width: 48ch; margin: 0.2rem 0 0; color: var(--muted); font-size: 0.86rem; }

.footer-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-content: start; }
.footer-nav a { color: var(--ink-2); font-size: 0.88rem; text-decoration: none; }
.footer-nav a:hover { color: var(--gold-2); }

.footer-note {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   Shared layout and primitives
   -------------------------------------------------------------------------- */

#main { min-height: 60vh; }

.page {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.6rem 1.5rem 5rem;
}

.page--narrow { max-width: 850px; }
.page--reader { max-width: 820px; }
.page--quiz { max-width: 860px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.65rem;
  color: var(--gold);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow__rule {
  display: inline-block;
  width: 2.1rem;
  height: 1px;
  background: var(--gold);
}

.lede {
  max-width: 64ch;
  color: var(--ink-2);
  font-size: 1.08rem;
  line-height: 1.72;
}

.muted { color: var(--muted); }
.small { font-size: 0.84rem; line-height: 1.58; }

.text-link {
  color: var(--gold-2);
  text-decoration-color: color-mix(in srgb, var(--gold) 45%, transparent);
  text-underline-offset: 0.2em;
}
.text-link:hover { text-decoration-color: var(--gold); }
/* Standalone links need a 24px target; inline ones are covered by the WCAG inline exception. */
.text-link--standalone {
  display: inline-block;
  padding-block: 4px;
  padding-inline: 2px;
  margin-inline: -2px;
}

.page-head { margin-bottom: 2.3rem; }
.page-head--split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 2rem;
  align-items: end;
  max-width: none;
}

.page-head h1 { margin-bottom: 0.7rem; }

.section { margin-top: 4.5rem; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 1.4rem;
}

.section-head h2 { margin-top: 0.1rem; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.6rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.breadcrumb a { color: var(--ink-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--gold-2); }

.panel {
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.panel--soft { background: var(--surface-2); }
.panel--center { padding: 3.5rem 2rem; text-align: center; }
.panel--center .lede { margin: 1rem auto 1.5rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.68rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.button__icon { width: 1.05em; height: 1.05em; flex: 0 0 auto; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button--primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1a1409;
  box-shadow: 0 8px 22px rgba(216, 169, 79, 0.16);
}
.button--primary:hover { background: linear-gradient(180deg, #f7d992, var(--gold)); }
.button--ghost { border-color: var(--line-strong); color: var(--ink); }
.button--ghost:hover { background: var(--surface-2); border-color: var(--gold); }
.button--danger { border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: var(--danger); }
.button--danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.button--wide { width: 100%; }
.button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.58rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  line-height: 1.5;
  white-space: nowrap;
}
.pill--quiet { color: var(--muted); }
.pill--gold { border-color: color-mix(in srgb, var(--gold) 42%, transparent); background: var(--gold-dim); color: var(--gold-2); }
.pill--danger { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.2rem;
  padding: 0.3rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.chip:hover { border-color: var(--gold); color: var(--ink); }
.chip.is-active { border-color: var(--gold); background: var(--gold-dim); color: var(--gold-2); }
.chip span { color: var(--muted); font-size: 0.7rem; }
.chip--tiny { padding: 0.12rem 0.5rem; font-size: 0.67rem; cursor: default; }

.search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.8rem;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.search:focus-within { border-color: var(--gold); }
.search__icon { color: var(--muted); font-size: 1.1rem; }
.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}
.search input::placeholder { color: var(--muted); }

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}
.progress--compact { height: 5px; }
.progress__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width 0.45s ease;
}

.sigil { display: block; width: 48px; height: 48px; image-rendering: pixelated; }
.sigil--small { width: 32px; height: 32px; }
.sigil--hero { width: 88px; height: 88px; }

.result-card {
  padding: 2.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.result-card--compact { padding: 1.6rem; box-shadow: none; }
.result-card.is-pass { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.result-card.is-fail { border-color: color-mix(in srgb, var(--danger) 34%, var(--line)); }
.result-score {
  margin: 1.2rem 0 0.2rem;
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 8vw, 5rem);
  line-height: 1;
}
.result-score span { color: var(--muted); font-size: 0.42em; }
.result-percent { color: var(--gold-2); font-size: 1rem; font-weight: 700; letter-spacing: 0.04em; }
.result-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }

.status {
  display: inline-flex;
  margin: 0.7rem 0 1rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status--ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.status--warn { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

.empty-state {
  padding: 3rem 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}
.empty-state__mark { color: var(--gold); font-size: 1.8rem; }
.empty-state h2 { margin: 0.5rem 0; font-size: 1.5rem; }
.empty-state p { color: var(--muted); }

.loading-page {
  display: grid;
  place-content: center;
  min-height: 52vh;
  text-align: center;
  color: var(--muted);
}
.loading-page__mark { color: var(--gold); font-size: 2rem; animation: pulse 1.8s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.04); }
}

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(300px, 0.72fr);
  gap: 3.5rem;
  align-items: center;
  padding: 3.2rem 0 2rem;
}

.hero h1 {
  margin: 0.4rem 0 1.2rem;
  font-size: clamp(3rem, 7.4vw, 6.4rem);
  letter-spacing: -0.04em;
}
.hero h1 em { color: var(--gold-2); font-weight: 400; }

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin: 2rem 0 0; }

.hero__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 2.8rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.hero__stats div { display: flex; flex-direction: column-reverse; gap: 0.1rem; }
.hero__stats dt { color: var(--muted); font-size: 0.69rem; letter-spacing: 0.08em; text-transform: uppercase; }
.hero__stats dd { margin: 0; font-family: var(--font-display); font-size: 1.9rem; line-height: 1; }

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 1.8rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(155deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
}
.hero-card::before {
  position: absolute;
  top: -80px;
  right: -70px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 169, 79, 0.16), transparent 68%);
  content: "";
  pointer-events: none;
}
.hero-card__top { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.2rem; }
.hero-card h2 { font-size: 1.65rem; }

.ring {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--value) * 1%), var(--surface-3) 0);
  position: relative;
}
.ring::before {
  position: absolute;
  inset: 7px;
  border-radius: inherit;
  background: var(--surface);
  content: "";
}
.ring span { position: relative; font-family: var(--font-display); font-size: 1.55rem; line-height: 1; }
.ring::after { position: absolute; inset: 0; border: 1px solid var(--line); border-radius: inherit; content: ""; }
.ring small { font-size: 0.55em; color: var(--muted); }

.mini-stats {
  display: flex;
  gap: 1.5rem;
  margin: 1.2rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.mini-stats div { display: flex; flex-direction: column-reverse; gap: 0.1rem; }
.mini-stats dt { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.mini-stats dd { margin: 0; font-family: var(--font-display); font-size: 1.25rem; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.feature-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); background: var(--surface-2); }
.feature-card__icon { display: block; margin-bottom: 0.2rem; }
.feature-card h3 { font-size: 1.1rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.feature-card p + p { color: var(--ink-2); }
.feature-card__cta { margin-top: auto; padding-top: 0.6rem; color: var(--gold-2); font-size: 0.78rem; font-weight: 650; }

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}
.step {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.step__num { display: block; margin-bottom: 0.8rem; color: var(--gold-2); font-family: var(--font-display); font-size: 1.1rem; letter-spacing: 0.12em; }
.step h3 { margin-bottom: 0.5rem; }
.step p { color: var(--muted); font-size: 0.88rem; }

.home-note { max-width: 940px; margin-top: 4rem; }
.home-note h2 { margin-bottom: 0.7rem; }

/* --------------------------------------------------------------------------
   Traditions list
   -------------------------------------------------------------------------- */

.list-tools { display: grid; gap: 0.9rem; }
.region-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.result-count { margin: 0 0 1rem; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; }

.region-group { margin-top: 2.4rem; }
.region-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.region-group__head h2 { font-size: 1.05rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gold); }

.myth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

.myth-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.myth-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); background: var(--surface-2); }
.myth-card__link { display: flex; flex-direction: column; gap: 0.75rem; height: 100%; padding: 1.2rem; color: var(--ink); text-decoration: none; }
.myth-card__head { display: flex; align-items: flex-start; gap: 0.8rem; }
.myth-card__head > div { min-width: 0; }
.myth-card__head h3 { font-size: 1.2rem; }
.myth-card__head .pill { margin-left: auto; }
.myth-card__icon .sigil { width: 42px; height: 42px; }
.myth-card p { color: var(--ink-2); font-size: 0.9rem; }
.myth-card__progress { display: grid; gap: 0.35rem; margin-top: auto; }
.myth-card__cta { color: var(--gold-2); font-size: 0.8rem; font-weight: 650; }
.list-footnote { margin-top: 2rem; }

/* --------------------------------------------------------------------------
   Mythology page
   -------------------------------------------------------------------------- */

.myth-hero {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 280px;
  gap: 1.6rem;
  align-items: start;
  padding-bottom: 2.4rem;
  border-bottom: 1px solid var(--line);
}
.myth-hero__icon { padding-top: 0.4rem; }
.myth-hero__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.7rem; }
.myth-hero__period { color: var(--gold-2); font-size: 0.8rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
.myth-hero h1 { margin: 0.15rem 0 0.8rem; }
.myth-hero .lede { font-size: 1rem; }
.myth-hero__side { min-width: 0; }

.mini-panel { padding: 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.mini-panel__row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.84rem; }
.mini-panel__row span { color: var(--muted); }
.mini-panel__row strong { font-weight: 650; }
.mini-panel .progress { margin: 0.8rem 0; }
.mini-panel .button { margin-top: 0.4rem; }

.respect-note {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin: 1.8rem 0;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--gold);
  background: var(--gold-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.respect-note__mark { color: var(--gold); line-height: 1.4; }
.respect-note p { margin: 0; font-size: 0.88rem; }

.myth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 3rem;
  margin-top: 2.4rem;
  align-items: start;
}

.story-list { display: grid; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }

.story-row {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
a.story-row:hover { border-color: var(--gold); background: var(--surface-2); transform: translateX(2px); }
.story-row.is-passed { border-left: 3px solid var(--ok); }
.story-row.is-locked { opacity: 0.62; background: transparent; border-style: dashed; }
.story-row__num { color: var(--gold); font-family: var(--font-display); font-size: 1.05rem; }
.story-row__body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.story-row__title { font-family: var(--font-display); font-size: 1.08rem; font-weight: 600; }
.story-row__meta { color: var(--muted); font-size: 0.79rem; }
.story-row__status { display: flex; align-items: center; gap: 0.35rem; }
.story-row__arrow { color: var(--gold); margin-left: 0.25rem; }

.lock { color: var(--muted); font-size: 1rem; }
.lock-note { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.82rem; }

.final-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding: 1.4rem;
  border: 1px solid color-mix(in srgb, var(--gold) 38%, var(--line));
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--gold-dim), transparent 55%), var(--surface);
}
.final-card h2 { font-size: 1.35rem; margin: 0.1rem 0 0.4rem; }
.final-card p { margin: 0; color: var(--ink-2); font-size: 0.86rem; }
.final-card.is-locked { border-color: var(--line); background: var(--surface); opacity: 0.8; }

.fact-list { margin: 0; padding: 0; list-style: none; }
.fact-list li { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.fact-list li:last-child { border-bottom: 0; }
.fact-list__year { display: block; color: var(--gold); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.fact-list strong { display: block; margin: 0.12rem 0; font-size: 0.9rem; }
.fact-list span:last-child { color: var(--muted); font-size: 0.81rem; }

.source-list { margin: 0; padding: 0; list-style: none; }
.source-list li { padding: 0.65rem 0; border-bottom: 1px solid var(--line); font-size: 0.82rem; }
.source-list li:last-child { border-bottom: 0; }
.source-list strong { display: block; font-weight: 650; }
.source-list span { color: var(--muted); }
.review-note { margin-top: 0.8rem; }

.myth-aside { display: grid; gap: 1rem; }
.myth-aside details summary { cursor: pointer; color: var(--gold-2); font-size: 0.85rem; font-weight: 650; }
.myth-aside details[open] summary { margin-bottom: 0.6rem; }

/* --------------------------------------------------------------------------
   Story reader
   -------------------------------------------------------------------------- */

.story-reader__head { margin-bottom: 1.6rem; }
.story-reader__kicker { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.4rem; }
.story-reader__kicker .eyebrow { margin: 0; }
.sigil--story { width: 40px; height: 40px; }
.story-reader__head h1 { margin: 0.3rem 0 0.5rem; font-size: clamp(2.2rem, 4.6vw, 3.6rem); }
.story-reader__source { color: var(--muted); font-size: 0.82rem; font-style: italic; }
.story-reader__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.8rem; }

.reader-progress {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.6rem;
}
.reader-progress .progress { flex: 1; }
.dots { display: flex; gap: 0.3rem; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); }
.dot.is-done { background: var(--gold); }
.dot.is-current { background: var(--gold-2); box-shadow: 0 0 0 3px var(--gold-dim); }

.story-text {
  min-height: 12rem;
  padding: 1.8rem 0;
  outline: none;
}
.story-text p {
  max-width: 62ch;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.22rem, 2.1vw, 1.48rem);
  line-height: 1.78;
}
.story-text p::first-letter {
  float: left;
  margin: 0.12em 0.1em 0 0;
  color: var(--gold-2);
  font-family: var(--font-display);
  font-size: 3.3em;
  line-height: 0.75;
}

.story-end {
  padding: 1.3rem;
  border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line));
  border-radius: var(--radius);
  background: var(--gold-dim);
}
.story-end__note { font-size: 0.88rem; }
.story-end__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.reader-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
}

.story-reader__foot { margin-top: 2.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.character-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.8rem; }
.uncertain-note { padding: 0.7rem 0.9rem; border-left: 2px solid var(--terracotta); background: var(--surface-2); font-size: 0.82rem; }

/* --------------------------------------------------------------------------
   Quiz
   -------------------------------------------------------------------------- */

.quiz-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.quiz-progress { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.4rem; }
.quiz-progress__label { flex: 0 0 auto; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; }
.quiz-progress .progress { flex: 1; }

.question-card {
  padding: 1.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.question-card__top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.question-card__text { margin-bottom: 1.4rem; font-size: clamp(1.5rem, 3vw, 2.05rem); }

.choices { display: grid; gap: 0.55rem; }
.choices--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.choice {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  min-height: 3.2rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.choice:hover:not(:disabled) { border-color: var(--gold); background: var(--surface-3); transform: translateY(-1px); }
.choice:disabled { cursor: default; }
.choice__letter {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
}
.choice.is-correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, var(--surface)); }
.choice.is-correct .choice__letter { border-color: var(--ok); color: var(--ok); }
.choice.is-wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.choice.is-wrong .choice__letter { border-color: var(--danger); color: var(--danger); }
.choice.is-dimmed { opacity: 0.45; }

.quiz-feedback { display: none; margin-top: 1rem; padding: 1rem 1.1rem; border-left: 3px solid var(--gold); background: var(--surface-2); border-radius: 0 12px 12px 0; }
.quiz-feedback.is-visible { display: block; animation: rise 0.22s ease; }
.quiz-feedback.is-correct { border-left-color: var(--ok); }
.quiz-feedback.is-wrong { border-left-color: var(--danger); }
.quiz-feedback__title { margin: 0 0 0.25rem; color: var(--gold-2); font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.quiz-feedback.is-correct .quiz-feedback__title { color: var(--ok); }
.quiz-feedback.is-wrong .quiz-feedback__title { color: var(--danger); }
.quiz-feedback__body { margin: 0 0 0.5rem; font-size: 0.9rem; }
.quiz-feedback__correct { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.82rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.review { margin-top: 1.2rem; }
.review summary { cursor: pointer; color: var(--gold-2); font-size: 0.86rem; font-weight: 650; }
.review-list { margin: 1rem 0 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; }
.review-item { padding: 0.8rem 1rem; border-left: 2px solid var(--line-strong); background: var(--surface); border-radius: 0 8px 8px 0; }
.review-item.is-correct { border-left-color: var(--ok); }
.review-item.is-wrong { border-left-color: var(--danger); }
.review-item p { margin: 0 0 0.25rem; font-size: 0.87rem; }
.review-item__q { font-family: var(--font-display); font-size: 0.95rem !important; }
.review-item__tag { display: inline-block; min-width: 5.5rem; color: var(--muted); font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; }
.review-item__why { color: var(--muted); }

/* --------------------------------------------------------------------------
   Challenges
   -------------------------------------------------------------------------- */

.challenge-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.challenge-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.challenge-card__icon { color: var(--gold); font-size: 1.8rem; line-height: 1; }
.challenge-card h2 { font-size: 1.3rem; }
.challenge-card p { color: var(--muted); font-size: 0.87rem; }
.challenge-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: auto; padding-top: 0.8rem; }
.challenge-card .button { margin-top: 0.5rem; }
.study-note { margin-top: 2rem; }
.study-note h2 { margin-bottom: 0.5rem; }

.challenge-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.2rem 0; }

.order-list { display: grid; gap: 0.5rem; }
.order-item {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.order-item__number { color: var(--gold); font-family: var(--font-display); }
.order-item__body { display: flex; flex-direction: column; }
.order-item__buttons { display: flex; gap: 0.3rem; }
.order-item .icon-button { width: 2.2rem; height: 2.2rem; font-size: 0.9rem; }
.order-item[draggable="true"] { cursor: grab; }
.order-item[draggable="true"]:active { cursor: grabbing; }
.order-item:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.order-item.is-dragging { opacity: 0.45; }
.order-item.is-drop-target {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 35%, transparent);
}

.correct-order { margin: 1rem 0; padding-left: 1.2rem; }
.correct-order li { padding: 0.3rem 0; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.correct-order span { color: var(--muted); }

.figure-card { display: flex; align-items: center; gap: 1rem; margin: 0.8rem 0 1.3rem; }
.figure-card h2 { font-size: 1.7rem; }
.figure-card p { margin: 0.1rem 0; }
.question-card h3 { margin: 1rem 0 0.8rem; font-size: 1.15rem; }

.story-snippet {
  margin: 0 0 1.3rem;
  padding: 1.1rem 1.3rem;
  border-left: 3px solid var(--gold);
  background: var(--surface-2);
  border-radius: 0 12px 12px 0;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-style: italic;
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Codex
   -------------------------------------------------------------------------- */

.codex-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin-top: 1rem; }
.codex-tools { display: grid; gap: 0.8rem; margin-bottom: 2rem; }
.codex-tools .search { max-width: 420px; }
.codex-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.codex-group { margin-top: 2.2rem; }
.codex-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}
.codex-group__title { display: flex; align-items: center; gap: 0.6rem; }
.codex-group__head h2 { font-size: 1.3rem; }
.codex-subhead { margin: 1.1rem 0 0.6rem; color: var(--gold); font-family: var(--font-body); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }

.codex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; }
.codex-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.codex-card__head { display: flex; align-items: flex-start; gap: 0.55rem; margin-bottom: 0.55rem; }
.codex-card__icon { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; }
.codex-card__icon--lock { border: 1px solid var(--line); border-radius: 50%; color: var(--muted); }
.codex-card__head h4 { font-size: 1.05rem; }
.codex-card h4 { margin-bottom: 0.35rem; }
.codex-card p { font-size: 0.83rem; }
.codex-card__domains { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.45rem; }
.codex-card__fact { margin-top: 0.45rem; color: var(--muted); font-style: italic; }
.codex-card.is-locked { border-style: dashed; background: transparent; opacity: 0.72; }
.codex-card.is-locked .codex-card__head { margin-bottom: 0; align-items: center; }
.codex-card.is-locked h4 { font-size: 0.95rem; margin: 0; }
.codex-card.is-locked p { margin: 0; }
.codex-card.is-locked h4 { color: var(--muted); }

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */

.timeline-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 2rem; }
.era { margin-bottom: 2.4rem; }
.era__title {
  margin-bottom: 0.9rem;
  color: var(--gold);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.era__list { position: relative; margin: 0; padding: 0 0 0 0.5rem; list-style: none; }
.era__list::before {
  position: absolute;
  top: 0.6rem;
  bottom: 0.6rem;
  left: 6.35rem;
  width: 1px;
  background: var(--line-strong);
  content: "";
}

.timeline-row {
  display: grid;
  grid-template-columns: 5rem 1.8rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  padding: 0.55rem 0;
}
.timeline-row__year { padding-top: 0.75rem; color: var(--muted); font-size: 0.72rem; font-weight: 700; text-align: right; letter-spacing: 0.03em; }
.timeline-row__dot { position: relative; z-index: 1; width: 9px; height: 9px; margin: 0.95rem auto 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--line-strong); box-shadow: 0 0 0 1px var(--line-strong); }
.timeline-row.is-playable .timeline-row__dot { background: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.timeline-row__card { padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.timeline-row__head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.timeline-row__head h3 { font-size: 1.15rem; }
.timeline-row__head h3 a { text-decoration: none; }
.timeline-row__head h3 a:hover { color: var(--gold-2); }
.timeline-row__mark { width: 32px; text-align: center; color: var(--muted); }
.timeline-row__summary { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.84rem; }
.timeline-row.is-playable .timeline-row__card { border-color: color-mix(in srgb, var(--gold) 28%, var(--line)); }
.timeline-foot { margin-top: 2rem; }

/* --------------------------------------------------------------------------
   Map
   -------------------------------------------------------------------------- */

.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; min-width: 0; }

.map-frame {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overflow-y: hidden; border-radius: 10px; }
.map-scroll:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.world-map { display: block; width: 100%; height: auto; border-radius: 10px; background: #0d2028; }
.map-scroll-hint { display: none; margin: 0.35rem 0 0; }
.map-scroll::-webkit-scrollbar { height: 8px; }
.map-scroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; }
.map-tile { shape-rendering: crispEdges; }
.map-graticule line { stroke: rgba(240, 233, 218, 0.08); stroke-width: 0.6; }
.map-region { cursor: pointer; outline: none; }
.map-region__hit { fill: transparent; stroke: transparent; stroke-width: 1.4; transition: fill 0.18s ease, stroke 0.18s ease; }
.map-region:hover .map-region__hit,
.map-region:focus-visible .map-region__hit,
.map-region.is-selected .map-region__hit { fill: rgba(216, 169, 79, 0.09); stroke: rgba(216, 169, 79, 0.65); }
.map-region__label {
  fill: var(--region-color, #d8a94f);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(13, 32, 40, 0.75);
  stroke-width: 3px;
  pointer-events: none;
}
.map-marker { cursor: pointer; outline: none; }
.map-marker__halo { fill: rgba(216, 169, 79, 0.22); stroke: rgba(240, 205, 122, 0.85); stroke-width: 1; transition: fill 0.15s ease; }
.map-marker:hover .map-marker__halo,
.map-marker:focus-visible .map-marker__halo { fill: rgba(240, 205, 122, 0.5); stroke-width: 2; }
.map-marker image { image-rendering: pixelated; }
.map-caption { margin: 0.6rem 0 0; padding: 0 0.3rem; }

.map-panel {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.map-panel__body { padding: 1.3rem; }
.map-panel h2 { margin: 0.1rem 0 0.5rem; }
.region-legend { display: grid; gap: 0.3rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.region-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
}
.region-chip:hover { border-color: var(--line); background: var(--surface-2); }
.region-chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--region-color, var(--gold)); }
.region-chip .muted { margin-left: auto; }

.map-myth-list { display: grid; gap: 0.4rem; margin: 1rem 0; }
.map-myth {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.map-myth:hover { border-color: var(--gold); background: var(--surface-2); }
.map-myth span { display: flex; flex-direction: column; min-width: 0; }
.map-myth strong { font-size: 0.9rem; }
.map-catalogue { margin-top: 0.8rem; }
.map-catalogue summary { cursor: pointer; color: var(--gold-2); font-size: 0.8rem; }
.map-catalogue p { margin: 0.4rem 0 0; }
.map-panel .text-link { display: inline-block; margin-top: 0.8rem; font-size: 0.82rem; }

.map-list { margin-top: 1.2rem; }
.map-list__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.map-list__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
}
.map-list__item:hover { border-color: var(--gold); }
.map-list__item span { display: flex; flex-direction: column; min-width: 0; }
.map-list__item strong { font-size: 0.84rem; }

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */

.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.7rem; }
.stat { padding: 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat__value { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1; }
.stat__value small { color: var(--muted); font-size: 0.45em; }
.stat__label { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; }

.overall-panel { margin-top: 1rem; }
.overall-panel .progress { margin-top: 0.9rem; }

.progress-list { display: grid; gap: 0.45rem; }
.progress-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1.1fr) minmax(100px, 0.9fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.progress-row:hover { border-color: var(--gold); }
.progress-row__name { display: flex; flex-direction: column; min-width: 0; }
.progress-row__name .small { font-size: 0.8rem; line-height: 1.5; }
.progress-row__bar { min-width: 0; }
.progress-row__pct { color: var(--gold-2); font-size: 0.76rem; font-weight: 700; text-align: right; }

.badge-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.badge {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  opacity: 0.58;
}
.badge.is-earned { border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); background: linear-gradient(145deg, var(--gold-dim), transparent 65%), var(--surface); opacity: 1; }
.badge__icon { display: block; color: var(--gold); font-size: 1.4rem; line-height: 1; }
.badge h3 { margin: 0.5rem 0 0.25rem; font-size: 0.98rem; }
.badge p { color: var(--muted); font-size: 0.75rem; }
.badge__state { display: inline-block; margin-top: 0.4rem; color: var(--muted); font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; }
.badge.is-earned .badge__state { color: var(--gold-2); }

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 1.5rem;
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
}
.danger-zone h2 { font-size: 1.25rem; margin-bottom: 0.3rem; }
.danger-zone p { color: var(--muted); font-size: 0.84rem; }

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */

.prose h2 { margin: 2rem 0 0.6rem; font-size: 1.5rem; }
.prose h2:first-child { margin-top: 0; }
.prose p { color: var(--ink-2); }
.prose code { padding: 0.1rem 0.3rem; border-radius: 4px; background: var(--surface-3); font-size: 0.85em; }
.about-sources { display: grid; gap: 1rem; margin-top: 1rem; }
.about-source-group h3 { color: var(--gold-2); font-size: 1.05rem; }
.about-source-group .source-list li { font-size: 0.78rem; }

/* --------------------------------------------------------------------------
   Dialog & toast
   -------------------------------------------------------------------------- */

.dialog {
  width: min(440px, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(5, 8, 6, 0.65); backdrop-filter: blur(3px); }
.dialog__panel { padding: 1.6rem; }
.dialog__title { font-size: 1.5rem; margin-bottom: 0.6rem; }
.dialog__body { color: var(--ink-2); font-size: 0.9rem; }
.voice-dialog { width: min(540px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; }
.narration-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  cursor: pointer;
}
.narration-switch span { display: flex; flex-direction: column; gap: 0.12rem; }
.narration-switch strong { color: var(--ink); font-size: 0.88rem; }
.narration-switch small { color: var(--muted); font-size: 0.75rem; }
.narration-switch input {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--gold);
}
.field-label {
  display: block;
  margin: 1.25rem 0 0.45rem;
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 650;
}
.voice-select {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-2);
  color: var(--ink);
  font: inherit;
}
.voice-select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.voice-note { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.78rem; }
.voice-tip { margin: 0.85rem 0 0; padding: 0.7rem 0.8rem; border-left: 2px solid var(--gold); background: var(--surface-2); color: var(--muted); font-size: 0.76rem; line-height: 1.55; }
.voice-tip strong { color: var(--gold-2); }
.studio-samples {
  margin-top: 1rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}
.studio-samples__title { margin: 0 0 0.25rem; color: var(--ink); font-family: var(--font-display); font-size: 0.9rem; }
.studio-samples__note { margin: 0 0 0.65rem; color: var(--muted); font-size: 0.74rem; line-height: 1.45; }
.studio-sample { display: grid; gap: 0.3rem; margin-top: 0.6rem; }
.studio-sample__choice { display: flex; align-items: center; gap: 0.55rem; cursor: pointer; }
.studio-sample__choice input { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; accent-color: var(--gold); }
.studio-sample__choice span { display: flex; flex-direction: column; gap: 0.05rem; color: var(--ink-2); font-size: 0.8rem; }
.studio-sample__choice small { color: var(--muted); font-size: 0.72rem; }
.studio-sample audio { width: 100%; height: 32px; }
.studio-samples__status { flex: 1 1 12rem; margin: 0; color: var(--muted); font-size: 0.74rem; line-height: 1.45; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.4rem; }
.voice-dialog .dialog__panel { padding-bottom: 0; }
.voice-dialog .dialog__actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 1.2rem -1.6rem 0;
  padding: 0.85rem 1.6rem 1.6rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

#toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  z-index: 150;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast__item {
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast__item.is-visible { opacity: 1; transform: translateY(0); }
.toast__item--gold { border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); color: var(--gold-2); }


/* --------------------------------------------------------------------------
   Visual storytelling
   -------------------------------------------------------------------------- */

.page--reader { max-width: 1120px; }
.page--quiz { max-width: 1100px; }

.story-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 2.2rem;
  align-items: start;
}
.story-art {
  position: sticky;
  top: calc(var(--header-height) + 1.2rem);
  display: grid;
  gap: 0.7rem;
  min-width: 0;
}
.story-copy { min-width: 0; }

.story-art .pixel-frame,
.question-art .pixel-frame { border-color: color-mix(in srgb, var(--gold) 28%, var(--line)); }
.pixel-frame {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
}
.pixel-scene {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  animation: scene-in 0.36s ease both;
}
.story-art__caption,
.question-art__caption {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.75rem 0.85rem 0.35rem;
  background: var(--surface);
}
.story-art__caption strong,
.question-art__caption strong {
  color: var(--gold-2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.story-art__caption span,
.question-art__caption span {
  color: var(--muted);
  font-size: 0.78rem;
}
.story-art__hint { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.story-art__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.button--small {
  min-height: 2.15rem;
  padding: 0.4rem 0.78rem;
  font-size: 0.78rem;
}

.character-portrait {
  display: inline-block;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-3);
}
.chip--figure { padding: 0.18rem 0.58rem 0.18rem 0.22rem; }
.chip--figure .character-portrait { width: 23px; height: 23px; }
.codex-card .character-portrait { width: 30px; height: 30px; }

.question-card--visual { padding: 0; overflow: hidden; }
.question-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  align-items: stretch;
}
.question-art {
  min-width: 0;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
}
.question-art__note { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.72rem; }
.pixel-frame--quiz { border-radius: 12px; }
.question-main { min-width: 0; padding: 1.5rem 1.6rem; }
.question-card__tools { display: flex; align-items: center; gap: 0.65rem; }
.question-card__tools .button, .story-art__actions .button { border-color: color-mix(in srgb, var(--gold) 38%, var(--line)); }
.question-card--visual .question-card__text {
  margin: 1.1rem 0 1.35rem;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
}
.question-card--visual .choice { animation: question-in 0.24s ease both; }
.question-card--visual .choice:nth-child(2) { animation-delay: 0.04s; }
.question-card--visual .choice:nth-child(3) { animation-delay: 0.08s; }
.question-card--visual .choice:nth-child(4) { animation-delay: 0.12s; }

.choice--icon { padding-left: 0.55rem; }
.choice--icon > .character-portrait,
.choice--icon > .choice-glyph { width: 34px; height: 34px; }
.choice-glyph {
  display: block;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-3);
}
.choice.is-correct .character-portrait,
.choice.is-correct .choice-glyph { border-color: var(--ok); }
.choice.is-wrong .character-portrait,
.choice.is-wrong .choice-glyph { border-color: var(--danger); }
.choice__key {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  opacity: 0.72;
}
.key-hint { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.72rem; }
.quiz-progress__label { font-variant-numeric: tabular-nums; }

.audio-toggle.is-off .audio-wave { display: none; }
.audio-toggle .audio-slash { display: none; }
.audio-toggle.is-off .audio-slash { display: block; }
.audio-toggle { color: var(--ink-2); }
.audio-toggle.is-off { color: var(--muted); }

@keyframes scene-in {
  from { opacity: 0; transform: scale(1.015); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes question-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1040px) {
  .story-layout { grid-template-columns: 1fr; }
  .story-art { position: static; max-width: 620px; }
  .question-layout { grid-template-columns: 1fr; }
  .question-art { border-right: 0; border-bottom: 1px solid var(--line); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .myth-hero { grid-template-columns: 88px minmax(0, 1fr); }
  .myth-hero__side { grid-column: 1 / -1; }
  .myth-layout { grid-template-columns: 1fr; gap: 2rem; }
  .map-layout { grid-template-columns: 1fr; }
  .map-panel { min-height: 0; }
  .codex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-list__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .badge-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .challenge-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; gap: 0.6rem 1rem; padding: 0.55rem 1.2rem; }
  .main-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .header-actions { margin-left: auto; }
  .hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 2rem; }
  .hero h1 { font-size: clamp(2.8rem, 10vw, 4.8rem); }
  .page-head--split { grid-template-columns: 1fr; gap: 1.2rem; }
  .myth-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { grid-template-columns: 1fr; }
  .choices--grid { grid-template-columns: 1fr; }
  .progress-row { grid-template-columns: 30px minmax(0, 1fr) 80px; }
  .progress-row__pct { grid-column: 3; }
  .progress-row .progress-row__bar { grid-column: 2 / -1; }
  .progress-row__pct { grid-row: 1; }
  .era__list::before { left: 4.15rem; }
  .timeline-row { grid-template-columns: 4rem 1.5rem minmax(0, 1fr); }
  .map-list__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-scroll-hint { display: block; }
  .world-map { min-width: 680px; }
  .myth-hero { grid-template-columns: 1fr; }
  .myth-hero__icon .sigil { width: 64px; height: 64px; }
  .myth-hero__side { grid-column: auto; }
}

@media (max-width: 560px) {
  .story-art__actions { flex-direction: column; align-items: stretch; }
  .story-art__actions .button { width: 100%; }
  .story-art__hint { text-align: center; }
  .question-main { padding: 1.2rem; }
  .question-card__top { align-items: flex-start; flex-wrap: wrap; }
  .question-card__tools { width: 100%; justify-content: space-between; }
  .choice__key { display: none; }
  .page { padding: 1.8rem 1rem 3.5rem; }
  .header-inner { padding-inline: 1rem; }
  .brand__tag { display: none; }
  .brand__name { font-size: 1.2rem; }
  .voice-button { width: 2.6rem; padding: 0; }
  .voice-button__label { display: none; }
  .main-nav a { padding: 0.4rem 0.55rem; font-size: 0.82rem; }
  .hero__stats { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: 1fr; }
  .myth-card__head { flex-wrap: wrap; }
  .myth-card__head .pill { margin-left: 0; }
  .myth-hero__tags .pill { white-space: normal; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .badge-grid { grid-template-columns: 1fr; }
  .codex-grid { grid-template-columns: 1fr; }
  .map-list__grid { grid-template-columns: 1fr; }
  .question-card { padding: 1.2rem; }
  .story-text p { font-size: 1.15rem; }
  .reader-controls { flex-direction: column; align-items: stretch; }
  .reader-controls .button { width: 100%; }
  .story-end__actions .button { width: 100%; }
  .final-card, .danger-zone { flex-direction: column; align-items: flex-start; }
  .final-card .button, .danger-zone .button { width: 100%; }
  .choices--grid { grid-template-columns: 1fr; }
  .progress-row { grid-template-columns: 28px minmax(0, 1fr); }
  .progress-row__bar, .progress-row__pct { display: none; }
  .timeline-row { grid-template-columns: 3.4rem 1.2rem minmax(0, 1fr); gap: 0.4rem; }
  .era__list::before { left: 3.55rem; }
  .timeline-row__head { align-items: flex-start; }
  .map-panel { border-radius: 12px; }
  .footer-inner { padding: 1.8rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --------------------------------------------------------------------------
   Story paths — saga library, landings and scenes
   -------------------------------------------------------------------------- */

.page--saga,
.page--saga-play { max-width: 1180px; }

.saga-glyph { display: block; shape-rendering: crispEdges; }

.saga-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 2.6rem;
  align-items: center;
  padding-top: 1rem;
}
.saga-hero h1 {
  margin: 0.2rem 0 1.1rem;
  font-size: clamp(3.3rem, 7vw, 6.2rem);
  line-height: 0.92;
}
.saga-hero h1 em { color: var(--gold-2); font-style: normal; }
.saga-hero__copy .lede { max-width: 54ch; }
.saga-hero__meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 1.1rem 0 0; }
.saga-hero__frame { margin: 0; }
.saga-hero__frame .pixel-scene { min-height: 240px; }

.saga-resume {
  margin-top: 1.7rem;
  padding: 1.25rem;
  border: 1px solid color-mix(in srgb, var(--gold) 34%, var(--line));
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gold) 8%, var(--surface)), var(--surface));
}
.saga-resume--new { border-color: var(--line); background: var(--surface); }
.saga-resume__head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.55rem; }
.saga-resume__glyph {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, var(--gold) 38%, var(--line));
  border-radius: 12px;
  background: var(--bg);
}
.saga-resume h2 { margin: 0; font-size: 1.55rem; }
.saga-resume__actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; }

.saga-name-form { margin-top: 0.8rem; }
.saga-name-label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--ink-2);
  font-size: 0.86rem;
  font-weight: 650;
}
.saga-name-row { display: flex; gap: 0.5rem; align-items: stretch; }
.saga-name-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 2.85rem;
  padding: 0 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.saga-name-input:focus { border-color: var(--gold); outline: 2px solid color-mix(in srgb, var(--gold) 35%, transparent); outline-offset: 2px; }
.saga-name-suggestions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.55rem; }
.chip--name { min-height: 1.9rem; padding: 0.1rem 0.6rem; font-size: 0.74rem; }
.saga-new-thread { margin-top: 1rem; }
.saga-new-thread summary { cursor: pointer; color: var(--gold-2); font-size: 0.82rem; font-weight: 650; }
.saga-new-thread[open] summary { margin-bottom: 0.4rem; }

.saga-breadcrumb { margin-bottom: 1.4rem; }
.saga-library__head { max-width: 64ch; padding-top: 0.8rem; }
.saga-library__head h1 {
  margin: 0.2rem 0 1rem;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  line-height: 0.96;
}
.saga-library__head h1 em { color: var(--gold-2); font-style: normal; }
.saga-library__head .lede { max-width: 58ch; }
.saga-library__meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 1.1rem; }
.saga-library__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
  margin-top: 2.4rem;
}
.saga-library-card {
  display: grid;
  grid-template-rows: 150px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.saga-library-card:hover {
  border-color: color-mix(in srgb, var(--gold) 60%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.saga-library-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.saga-library-card__art { margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; overflow: hidden; }
.saga-library-card__art .pixel-scene { width: 100%; height: 150px; min-height: 0; aspect-ratio: auto; }
.saga-library-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  min-width: 0;
  padding: 1.1rem 1.2rem;
}
.saga-library-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.saga-library-card__age,
.saga-library-card__time { color: var(--ink-2); font-size: 0.72rem; font-weight: 650; letter-spacing: 0.03em; }
.saga-library-card .pill--quiet {
  border-color: var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  font-weight: 650;
}
.saga-library-card h2 { margin: 0.2rem 0 0; font-size: clamp(1.35rem, 2.2vw, 1.75rem); line-height: 1.05; }
.saga-library-card p { margin: 0; color: var(--ink-2); font-size: 0.86rem; line-height: 1.55; }
.saga-library-card__cta {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.3rem;
  margin-top: auto;
  padding: 0.42rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--gold) 42%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 12%, transparent);
  color: var(--gold-2);
  font-size: 0.8rem;
  font-weight: 700;
}
.saga-library-card__cta span { transition: transform 160ms ease; display: inline-block; }
.saga-library-card:hover .saga-library-card__cta span { transform: translateX(3px); }

.saga-roads { margin-top: 4.5rem; }
.saga-road-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.saga-road {
  display: flex;
  gap: 0.85rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.saga-road__glyph {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.saga-road h3 { margin-bottom: 0.3rem; font-size: 1.18rem; }
.saga-road p { margin: 0; color: var(--muted); font-size: 0.85rem; line-height: 1.6; }

.saga-how { margin-top: 3.4rem; }
.saga-how h2 { max-width: 32ch; }
.saga-how__steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}
.saga-how__steps li { display: flex; gap: 0.65rem; }
.saga-how__steps > li > span { color: var(--gold); font-family: var(--font-display); font-size: 1.2rem; line-height: 1.2; }
.saga-how__steps strong { display: block; font-size: 0.92rem; }
.saga-how__steps p { margin: 0.22rem 0 0; color: var(--muted); font-size: 0.82rem; }

.saga-gallery { margin-top: 4rem; }
.saga-gallery__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; }
.saga-ending-card {
  display: flex;
  gap: 0.65rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.saga-ending-card__glyph {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-3);
}
.saga-ending-card h3 { font-size: 1rem; }
.saga-ending-card p { margin: 0.2rem 0 0.35rem; font-size: 0.78rem; }
.saga-ending-card.is-locked { border-style: dashed; background: transparent; opacity: 0.66; }
.saga-ending-card.is-locked h3 { color: var(--muted); font-size: 0.92rem; }

.saga-source-note {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}
.saga-source-note p { max-width: 82ch; }

/* Home feature ------------------------------------------------------- */

.saga-home {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 2.4rem;
  align-items: center;
  margin-top: 4.5rem;
  padding: clamp(1rem, 2.5vw, 1.6rem);
  border: 1px solid color-mix(in srgb, var(--gold) 26%, var(--line));
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(700px 300px at 82% 10%, rgba(216, 169, 79, 0.09), transparent 68%),
    linear-gradient(135deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
}
.saga-home__art { margin: 0; }
.saga-home__art .pixel-scene { aspect-ratio: 16 / 9; }
.saga-home__copy h2 { margin: 0.15rem 0 0.8rem; font-size: clamp(2.2rem, 4vw, 3.4rem); }
.saga-home__copy .lede { font-size: 1rem; }
.saga-home__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  margin: 1.1rem 0 1.2rem;
  padding: 0;
  list-style: none;
}
.saga-home__facts strong { display: block; color: var(--gold-2); font-family: var(--font-display); font-size: 1.65rem; line-height: 1; }
.saga-home__facts span { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.04em; }
.hero__aside-link { margin-top: 0.9rem; }

/* Play --------------------------------------------------------------- */

.saga-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.7rem;
}
.saga-topbar__home { color: var(--gold-2); font-size: 0.84rem; font-weight: 650; text-decoration: none; }
.saga-topbar__home:hover { text-decoration: underline; text-underline-offset: 3px; }
.saga-topbar__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }

.saga-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
  gap: 2.3rem;
  align-items: start;
}
.saga-visual {
  position: sticky;
  top: calc(var(--header-height) + 1.2rem);
  display: grid;
  gap: 0.8rem;
  min-width: 0;
}
.saga-frame { margin: 0; }
.saga-copy { min-width: 0; }

.saga-scene-head { margin-bottom: 0.8rem; }
.saga-scene-head .eyebrow { margin-bottom: 0.35rem; }
.saga-scene-head h1 { margin: 0.25rem 0 0.55rem; font-size: clamp(2.1rem, 4.6vw, 3.55rem); }
.saga-location { margin: 0; color: var(--muted); font-size: 0.82rem; font-style: italic; }
.saga-scene-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 0.65rem; margin-top: 0.85rem; }
.saga-scene-progress .progress { flex: 1 1 130px; min-width: 100px; }
.saga-skip {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--gold-2);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.saga-read-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0.5rem 0 0.2rem; }
.saga-text { min-height: 14rem; padding: 1.3rem 0 0.3rem; }
.saga-text .saga-paragraph {
  max-width: 60ch;
  margin: 0 0 1.15rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.18rem, 1.65vw, 1.34rem);
  line-height: 1.78;
}
.saga-text .saga-paragraph:first-child::first-letter {
  float: left;
  margin: 0.12em 0.1em 0 0;
  color: var(--gold-2);
  font-family: var(--font-display);
  font-size: 3.2em;
  line-height: 0.76;
}
.saga-paragraph-group { position: relative; }
.saga-paragraph-group[hidden] { display: none !important; }
.saga-paragraph { animation: sagaParagraph 0.5s ease both; }
.saga-listen-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  margin: -0.65rem 0 1rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  min-height: 2rem;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.saga-listen-inline:hover,
.saga-listen-inline:focus-visible { color: var(--ink); border-color: var(--gold); background: var(--surface); }
.saga-listen-inline .button__icon { width: 13px; height: 13px; }
.saga-lore__listen { margin-top: 0.55rem; }
.saga-intro-listen-wrap { margin-top: 0.8rem; }
.saga-paragraph.is-hidden,
.saga-paragraph[hidden],
.saga-after[hidden],
.saga-controls[hidden],
.saga-choices[hidden] { display: none !important; }

.saga-after { margin-top: 1rem; }

.saga-lore {
  margin: 1.4rem 0 0;
  padding: 1.2rem 1.25rem;
  border-left: 3px solid var(--gold);
  border-radius: 0 14px 14px 0;
  background: var(--surface-2);
  animation: sagaParagraph 0.55s ease both;
}
.saga-lore h2 { margin-bottom: 0.45rem; font-size: 1.35rem; }
.saga-lore p { margin: 0 0 0.5rem; color: var(--ink-2); font-size: 0.9rem; }
.saga-lore__source { margin: 0 !important; color: var(--muted) !important; font-size: 0.74rem !important; font-style: italic; }

.saga-choices { display: grid; gap: 0.55rem; margin: 1.6rem 0 0; animation: sagaParagraph 0.5s ease both; }
.saga-choices__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.15rem; }
.saga-choice {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}
.saga-choice:hover,
.saga-choice:focus-visible { border-color: var(--gold); background: var(--surface-2); transform: translateY(-1px); }
.saga-choice.is-chosen { border-color: var(--gold); background: var(--gold-dim); }
.saga-choice__glyph {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.saga-choice__body { display: flex; flex-direction: column; gap: 0.12rem; min-width: 0; }
.saga-choice__body strong { font-size: 0.94rem; font-weight: 650; line-height: 1.38; }
.saga-choice__body small { color: var(--muted); font-size: 0.74rem; }
.saga-choice__arrow { margin-left: auto; color: var(--gold); font-size: 1.15rem; transition: transform 0.16s ease; }
.saga-choice:hover .saga-choice__arrow { transform: translateX(3px); }

.saga-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.saga-thread { padding: 1.1rem; }
.saga-thread__head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.9rem; }
.saga-thread__glyph {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--gold) 34%, var(--line));
  border-radius: 12px;
  background: var(--bg);
}
.saga-thread__head .eyebrow { margin-bottom: 0.1rem; }
.saga-thread__head h2 { margin: 0; font-size: 1.45rem; }
.saga-stats { display: grid; gap: 0.45rem; margin: 0 0 0.9rem; }
.saga-stat { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; }
.saga-stat dt { color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.saga-stat dd { display: flex; align-items: center; gap: 0.55rem; margin: 0; }
.saga-stat strong { color: var(--gold-2); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.saga-pips { display: inline-flex; gap: 2px; }
.saga-pip { width: 7px; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 22%, transparent); }
.saga-pip.is-on { background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.saga-thread__boons { margin-top: 0.85rem; padding-top: 0.85rem; border-top: 1px solid var(--line); }
.saga-thread__boons .eyebrow { margin-bottom: 0.4rem; }
.saga-boon-list { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.saga-trail { margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.saga-trail summary { cursor: pointer; color: var(--gold-2); font-size: 0.8rem; font-weight: 650; }
.saga-trail summary span { font-weight: 400; }
.saga-trail ol { display: grid; gap: 0.22rem; margin: 0.55rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.77rem; }
.saga-trail li.is-current { color: var(--ink); font-weight: 650; }
.saga-thread__back { margin-top: 0.8rem; }

.saga-ending {
  margin: 1.8rem 0 0;
  padding: 1.4rem;
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  border-radius: var(--radius);
  background:
    radial-gradient(420px 220px at 10% 0%, rgba(216, 169, 79, 0.13), transparent 70%),
    var(--surface-2);
  animation: sagaParagraph 0.6s ease both;
}
.saga-ending__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.7rem; }
.saga-ending__head h2 { margin: 0.1rem 0 0; font-size: clamp(1.6rem, 3vw, 2.1rem); }
.saga-ending p { color: var(--ink-2); font-size: 0.92rem; }
.saga-ending .small { color: var(--muted); }
.saga-ending__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }

/* Scene motion ------------------------------------------------------- */

.saga-scene { background: #0a0e1a; }
.saga-scene * { transform-box: fill-box; }

.saga-twinkle { animation: sagaTwinkle 3.2s ease-in-out infinite; }
.saga-aurora { animation: sagaAurora 9s ease-in-out infinite alternate; }
.saga-wave { animation: sagaWave 4.2s ease-in-out infinite alternate; }
.saga-window-glow { animation: sagaGlow 4.4s ease-in-out infinite; }
.saga-rune-glow { animation: sagaGlow 3.1s ease-in-out infinite; }
.saga-eye-glow { animation: sagaGlow 2.8s ease-in-out infinite; }
.saga-water-glow { animation: sagaGlow 5.2s ease-in-out infinite; }
.saga-water-glint { animation: sagaTwinkle 2.4s ease-in-out infinite; }
.saga-fire-glow { animation: sagaGlow 1.7s ease-in-out infinite; }
.saga-chain-glow { animation: sagaTwinkle 2.6s ease-in-out infinite; }
.saga-sun-glow-pixel { animation: sagaGlow 6s ease-in-out infinite; }
.saga-mist-pixel { animation: sagaMist 12s ease-in-out infinite alternate; }
.saga-smoke-puff { animation: sagaSmoke 5.5s ease-out infinite; }
.saga-flame { animation: sagaFlame 0.9s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.saga-spark { animation: sagaSpark 1.6s ease-out infinite; }
.saga-snow { animation: sagaSnow 13s linear infinite; }
.saga-rain { animation: sagaRain 2s linear infinite; }
.saga-ember { animation: sagaEmber 4s ease-out infinite; }
.saga-mote { animation: sagaMote 3.6s ease-in-out infinite; }
.saga-leaf { animation: sagaLeaf 8s ease-in-out infinite; }
.saga-bird { animation: sagaBird 7s ease-in-out infinite; }
.saga-butterfly { animation: sagaButterfly 5s ease-in-out infinite; }
.saga-drip { animation: sagaDrip 2.6s ease-in infinite; }
.saga-raven { animation: sagaFly 16s ease-in-out infinite; }
.saga-flap-a { animation: sagaFlap 0.72s steps(1, end) infinite; }
.saga-flap-b { animation: sagaFlap 0.72s steps(1, end) infinite; animation-delay: -0.36s; }
.saga-flash { animation: sagaFlash 8s linear infinite; pointer-events: none; }
.saga-eye-blink { animation: sagaBlink 6s steps(1, end) infinite; }
.saga-ship-bob { animation: sagaBob 4.6s ease-in-out infinite alternate; }
.saga-serpent { animation: sagaCoil 5.5s ease-in-out infinite alternate; }
.saga-wolf-breath { animation: sagaGlow 3.4s ease-in-out infinite; }
.saga-breath-puff { animation: sagaBreath 3.8s ease-out infinite; }
.saga-bifrost { animation: sagaBifrost 4.8s ease-in-out infinite alternate; }

@keyframes sagaTwinkle { 0%, 100% { opacity: 0.22; } 50% { opacity: 1; } }
@keyframes sagaAurora {
  from { opacity: 0.42; transform: translateX(-3px) translateY(1px); }
  to { opacity: 0.85; transform: translateX(4px) translateY(-1px); }
}
@keyframes sagaWave {
  from { transform: translateX(-3px); opacity: 0.55; }
  to { transform: translateX(4px); opacity: 1; }
}
@keyframes sagaGlow { 0%, 100% { opacity: 0.42; } 50% { opacity: 1; } }
@keyframes sagaMist { from { transform: translateX(-6px); } to { transform: translateX(6px); } }
@keyframes sagaSmoke {
  0% { opacity: 0; transform: translate(0, 0) scale(0.7); }
  18% { opacity: 0.6; }
  100% { opacity: 0; transform: translate(3px, -15px) scale(1.25); }
}
@keyframes sagaFlame {
  from { transform: scaleY(0.9) scaleX(0.96); opacity: 0.82; }
  to { transform: scaleY(1.1) scaleX(1.04); opacity: 1; }
}
@keyframes sagaSpark {
  0% { opacity: 0; transform: translate(0, 0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-4px, -17px); }
}
@keyframes sagaSnow {
  0% { opacity: 0; transform: translate(0, -8px); }
  12% { opacity: 0.9; }
  100% { opacity: 0.55; transform: translate(-7px, 62px); }
}
@keyframes sagaRain {
  0% { opacity: 0; transform: translate(0, -10px); }
  10% { opacity: 0.85; }
  100% { opacity: 0.1; transform: translate(-10px, 64px); }
}
@keyframes sagaEmber {
  0% { opacity: 0; transform: translate(0, 0); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(3px, -26px); }
}
@keyframes sagaMote {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-6px); }
}
@keyframes sagaLeaf {
  0% { opacity: 0; transform: translate(0, -4px) rotate(0deg); }
  15% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(9px, 26px) rotate(90deg); }
}
@keyframes sagaBird {
  0%, 100% { transform: translate(-6px, 3px); }
  50% { transform: translate(10px, -4px); }
}
@keyframes sagaButterfly {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(5px, -4px); }
  50% { transform: translate(9px, 1px); }
  75% { transform: translate(4px, 3px); }
}
@keyframes sagaDrip {
  0% { opacity: 0; transform: translateY(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(11px); }
}
@keyframes sagaFly {
  0%, 100% { transform: translate(-16px, 2px); }
  50% { transform: translate(16px, -4px); }
}
@keyframes sagaFlap { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes sagaFlash {
  0%, 88%, 100% { opacity: 0; }
  89% { opacity: 0.65; }
  90% { opacity: 0.1; }
  91% { opacity: 0.8; }
  93% { opacity: 0.08; }
  94% { opacity: 0.4; }
}
@keyframes sagaBlink {
  0%, 91%, 100% { opacity: 0; }
  92%, 94% { opacity: 1; }
}
@keyframes sagaBob { from { transform: translateY(-1px) rotate(-0.4deg); } to { transform: translateY(1.5px) rotate(0.4deg); } }
@keyframes sagaCoil { from { transform: translateY(-1px); } to { transform: translateY(2px); } }
@keyframes sagaBreath {
  0% { opacity: 0; transform: translate(0, 0) scale(0.7); }
  25% { opacity: 0.7; }
  100% { opacity: 0; transform: translate(5px, -4px) scale(1.3); }
}
@keyframes sagaBifrost { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes sagaParagraph {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Saga responsive ---------------------------------------------------- */

@media (max-width: 980px) {
  .saga-hero,
  .saga-home { grid-template-columns: 1fr; gap: 1.6rem; }
  .saga-hero__frame { order: -1; }
  .saga-library__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .saga-layout { grid-template-columns: 1fr; }
  .saga-visual { position: static; max-width: 680px; }
  .saga-road-grid { grid-template-columns: 1fr; }
  .saga-how__steps { grid-template-columns: 1fr; }
  .saga-gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .saga-library__grid { grid-template-columns: 1fr; }
  .saga-library-card { grid-template-rows: 160px minmax(0, 1fr); }
  .saga-library-card__art .pixel-scene { height: 160px; }
  .saga-library-card__cta { align-self: stretch; justify-content: center; }
}

@media (max-width: 560px) {
  .saga-name-row { flex-direction: column; }
  .saga-name-row .button { width: 100%; }
  .saga-topbar { flex-direction: column; align-items: flex-start; }
  .saga-gallery__grid { grid-template-columns: 1fr; }
  .saga-resume__actions .button { width: 100%; }
  .saga-ending__head { flex-direction: column; }
  .saga-scene-progress { align-items: flex-start; }
  .saga-scene-progress .progress { flex-basis: 100%; }
}

@media (max-width: 720px) {
  .saga-listen-inline { min-height: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .saga-scene *,
  .saga-paragraph,
  .saga-lore,
  .saga-choices,
  .saga-ending { animation: none !important; }
  .saga-flap-b { opacity: 0 !important; }
  .saga-flash,
  .saga-snow,
  .saga-rain,
  .saga-ember,
  .saga-spark,
  .saga-mote,
  .saga-leaf,
  .saga-drip,
  .saga-breath-puff { opacity: 0 !important; }
}
