/*
 * TAT — The Alchemist's Turning
 * Mobile-first stylesheet. Palette drawn from the game seal:
 * deep indigo ground, aged gold, pale parchment text.
 *
 * (c) Sui Generis Technologies
 */

/* ---------------------------------------------------------------
 * Tokens
 * ------------------------------------------------------------- */
:root {
  --ink:        #090812;
  --ink-2:      #100e1e;
  --panel:      #16142a;
  --panel-2:    #1d1a33;
  --line:       #2b2748;
  --line-soft:  #221f3c;

  --gold:       #d6b26a;
  --gold-dim:   #a68548;
  --gold-glow:  rgba(214, 178, 106, 0.16);

  --text:       #e8e2f0;
  --text-mute:  #9c95b8;
  --text-faint: #6f6890;

  --ok:         #7fd6a4;
  --warn:       #e8c46a;
  --err:        #f08a8a;
  --info:       #8ab4f0;

  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 18px 48px rgba(0, 0, 0, 0.55);

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

  --wrap: 1080px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font: 400 16px/1.65 var(--font-body);
  color: var(--text);
  background: var(--ink);
  background-image:
    radial-gradient(1000px 620px at 50% -12%, rgba(96, 78, 168, 0.20), transparent 62%),
    radial-gradient(760px 460px at 88% 8%, rgba(214, 178, 106, 0.07), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.22; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 5.2vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 3.4vw, 1.6rem); }
h3 { font-size: 1.06rem; }
p  { margin: 0 0 1rem; }

a { color: var(--gold); text-decoration-color: rgba(214, 178, 106, .4); text-underline-offset: 3px; }
a:hover { color: #e6c887; }

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

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--gold); color: var(--ink);
  padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------
 * Layout
 * ------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 1.15rem; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(9, 8, 18, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 1rem;
  min-height: 62px;
}

.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b {
  font-family: var(--font-display); font-size: 1.06rem;
  letter-spacing: .16em; color: var(--gold);
}
.brand-text span { font-size: .62rem; letter-spacing: .12em; color: var(--text-faint); text-transform: uppercase; }

.nav { margin-left: auto; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.nav a, .nav button.linklike {
  font-size: .9rem; padding: .45rem .7rem; border-radius: var(--radius-sm);
  color: var(--text-mute); text-decoration: none;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav a:hover, .nav button.linklike:hover { color: var(--text); background: var(--panel); }
.nav a[aria-current="page"] { color: var(--gold); background: var(--gold-glow); }

main { display: block; padding-block: clamp(1.6rem, 5vw, 3rem) 3rem; }

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding-block: 1.6rem 2.4rem;
  color: var(--text-faint); font-size: .84rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: .55rem 1.2rem; align-items: center; }
.site-footer a { color: var(--text-mute); }
.site-footer .spacer { margin-left: auto; }

/* ---------------------------------------------------------------
 * Panels & cards
 * ------------------------------------------------------------- */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.15rem, 4vw, 1.9rem);
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 1.15rem; }
.panel-title { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.panel-title h2 { margin-bottom: .2rem; }

.grid { display: grid; gap: 1.1rem; }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.stat {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .9rem 1rem;
}
.stat dt { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin: 0; }
.stat dd {
  margin: .25rem 0 0; font-family: var(--font-display);
  font-size: 1.75rem; color: var(--gold); line-height: 1.1;
}

/* ---------------------------------------------------------------
 * Auth card
 * ------------------------------------------------------------- */
.auth {
  width: 100%; max-width: 520px; margin-inline: auto;
}
.auth-seal { width: 92px; margin: 0 auto 1rem; border-radius: 50%; box-shadow: 0 0 46px rgba(140, 116, 220, .3); }
.auth h1 { text-align: center; margin-bottom: .3rem; }
.auth .lede { text-align: center; color: var(--text-mute); margin-bottom: 1.6rem; }
.auth-alt { text-align: center; margin-top: 1.3rem; color: var(--text-mute); font-size: .92rem; }

/* ---------------------------------------------------------------
 * Forms
 * ------------------------------------------------------------- */
.field { margin-bottom: 1.15rem; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .35rem; }
.field .hint { display: block; font-weight: 400; color: var(--text-faint); font-size: .82rem; margin-top: .15rem; }

input[type="text"], input[type="email"], input[type="password"] {
  width: 100%; padding: .78rem .9rem;
  font: inherit; font-size: 1rem; /* 16px min: stops iOS zoom-on-focus */
  color: var(--text);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--text-faint); }
input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
  outline: none;
}
input[aria-invalid="true"] { border-color: var(--err); }

.input-group { position: relative; display: flex; }
.input-group input { padding-right: 4.2rem; }
.input-group button {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--text-mute);
  font: inherit; font-size: .82rem; cursor: pointer;
  padding: .4rem .55rem; border-radius: 6px;
}
.input-group button:hover { color: var(--gold); background: var(--panel); }

.field-note { display: block; font-size: .82rem; margin-top: .35rem; min-height: 1.2em; color: var(--text-faint); }
.field-note.is-ok { color: var(--ok); }
.field-note.is-error { color: var(--err); }
.field-note.is-checking { color: var(--text-mute); }
.field-error { display: block; font-size: .84rem; color: var(--err); margin-top: .35rem; }

.check { display: flex; gap: .7rem; align-items: flex-start; margin-bottom: .9rem; }
.check input[type="checkbox"] {
  width: 20px; height: 20px; margin: .18rem 0 0; flex: 0 0 auto;
  accent-color: var(--gold-dim); cursor: pointer;
}
.check label { font-size: .9rem; font-weight: 400; line-height: 1.5; cursor: pointer; margin: 0; }

/* ---------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .8rem 1.4rem;
  font: 600 1rem/1 var(--font-body);
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: transform .1s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(180deg, #e0bd76, var(--gold-dim));
  color: #1a1408;
  box-shadow: 0 8px 26px rgba(214, 178, 106, .18);
}
.btn-primary:hover { filter: brightness(1.06); color: #1a1408; }

.btn-ghost {
  background: transparent; border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { background: var(--panel); border-color: var(--gold-dim); color: var(--text); }

/* ---------------------------------------------------------------
 * Flash & callouts
 * ------------------------------------------------------------- */
.flash {
  display: flex; gap: .75rem; align-items: flex-start;
  border: 1px solid var(--line); border-left-width: 3px;
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: .8rem 1rem; margin-bottom: 1rem; font-size: .93rem;
}
.flash button { background: none; border: 0; color: inherit; cursor: pointer; margin-left: auto; opacity: .6; font-size: 1.1rem; line-height: 1; }
.flash button:hover { opacity: 1; }
.flash-success { border-left-color: var(--ok); }
.flash-error   { border-left-color: var(--err); }
.flash-info    { border-left-color: var(--info); }
.flash-warning { border-left-color: var(--warn); }

.callout {
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-dim);
  background: rgba(214, 178, 106, .06);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  margin-bottom: 1.4rem;
}
.callout h3 { color: var(--gold); margin-bottom: .35rem; font-size: .98rem; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout ul { margin: .4rem 0 0; padding-left: 1.15rem; color: var(--text-mute); font-size: .9rem; }
.callout li { margin-bottom: .2rem; }

/* ---------------------------------------------------------------
 * Landing
 * ------------------------------------------------------------- */
.hero { text-align: center; padding-block: clamp(1rem, 5vw, 2.4rem) 1rem; }
.hero-seal {
  width: min(280px, 62vw); margin: 0 auto 1.6rem; border-radius: 50%;
  box-shadow: 0 0 90px rgba(126, 104, 205, .32);
}
.hero .eyebrow {
  font-size: .74rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--gold-dim); margin-bottom: .7rem;
}
.hero h1 { font-size: clamp(2rem, 7.5vw, 3.3rem); letter-spacing: .04em; }
.hero .tagline {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1rem, 3.2vw, 1.3rem); color: var(--gold);
  margin-bottom: 1.5rem;
}
.hero .lede { max-width: 56ch; margin-inline: auto; color: var(--text-mute); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin-top: 1.9rem; }
.hero-actions .btn { flex: 1 1 220px; max-width: 300px; }

.pillars { margin-top: clamp(2.4rem, 8vw, 4rem); }
.pillar h3 { color: var(--gold); display: flex; align-items: center; gap: .5rem; }
.pillar p { color: var(--text-mute); font-size: .93rem; margin: 0; }

.question {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1.15rem, 4vw, 1.7rem);
  text-align: center; color: var(--text);
  border-block: 1px solid var(--line-soft);
  padding-block: 1.8rem; margin-block: clamp(2.4rem, 8vw, 3.6rem);
}

/* ---------------------------------------------------------------
 * Dashboard / phase list
 * ------------------------------------------------------------- */
.page-head { margin-bottom: 1.6rem; }
.page-head .eyebrow { font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--text-faint); }
.page-head h1 { margin-bottom: .2rem; }

.phase-list { list-style: none; margin: 0; padding: 0; }
.phase-list li {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: .7rem 0; border-bottom: 1px solid var(--line-soft);
}
.phase-list li:last-child { border-bottom: 0; }
.phase-list .tick { flex: 0 0 auto; width: 1.3rem; text-align: center; }
.phase-list .done .tick { color: var(--ok); }
.phase-list .todo { color: var(--text-faint); }
.phase-list b { display: block; font-weight: 600; }
.phase-list small { color: var(--text-faint); }

/* ---------------------------------------------------------------
 * Tables
 * ------------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .89rem; min-width: 520px; }
th, td { text-align: left; padding: .65rem .7rem; border-bottom: 1px solid var(--line-soft); }
th {
  font-size: .71rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; white-space: nowrap;
}
td.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .8rem; color: var(--text-mute); }

.pill {
  display: inline-block; padding: .12rem .5rem; border-radius: 999px;
  font-size: .72rem; letter-spacing: .04em;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-mute);
}
.pill-active { color: var(--ok); border-color: rgba(127, 214, 164, .3); }

/* ---------------------------------------------------------------
 * Error / offline pages
 * ------------------------------------------------------------- */
.notice-page { text-align: center; max-width: 44ch; margin-inline: auto; padding-block: clamp(2rem, 10vw, 5rem); }
.notice-page .code {
  font-family: var(--font-display); font-size: clamp(3.4rem, 16vw, 6rem);
  color: var(--gold-dim); line-height: 1; margin-bottom: .3rem;
}
.notice-page p { color: var(--text-mute); }

/* ---------------------------------------------------------------
 * Admin chrome
 * ------------------------------------------------------------- */
.admin-bar {
  background: #1a1330; border-bottom: 1px solid var(--line);
  font-size: .8rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold-dim); padding: .45rem 0;
}
.admin-bar .wrap { display: flex; gap: 1rem; align-items: center; }

/* ---------------------------------------------------------------
 * Utilities
 * ------------------------------------------------------------- */
.mute { color: var(--text-mute); }
.faint { color: var(--text-faint); }
.small { font-size: .86rem; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 1.5rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===============================================================
 * PHASE 2 — assessment, profile, archetypes, audio
 * ============================================================= */

/* --- Assessment ---------------------------------------------- */
.assessment { max-width: 640px; margin-inline: auto; }

.assess-progress {
  height: 2px; background: var(--line-soft); border-radius: 2px;
  overflow: hidden; margin-bottom: 2.4rem;
}
.assess-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

.assess-eyebrow {
  font-size: .7rem; letter-spacing: .26em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .5rem;
}
.assess-prompt {
  font-size: clamp(1.5rem, 5vw, 2.1rem); margin-bottom: 1.2rem; color: var(--gold);
}
.assess-scenario {
  border-left: 2px solid var(--line); padding-left: 1.15rem;
  margin-bottom: 2rem;
}
.assess-scenario p {
  font-size: clamp(1rem, 2.6vw, 1.1rem); line-height: 1.75;
  color: var(--text); margin: 0;
}

.assess-options fieldset { border: 0; padding: 0; margin: 0; }

.assess-option {
  display: flex; gap: .9rem; align-items: flex-start; width: 100%;
  text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem; margin-bottom: .7rem;
  transition: border-color .15s, background .15s, transform .08s;
}
.assess-option:hover {
  border-color: var(--gold-dim); background: var(--panel-2);
}
.assess-option:active { transform: translateY(1px); }
.assess-option-mark {
  flex: 0 0 auto; width: 15px; height: 15px; margin-top: .32rem;
  border: 1px solid var(--line); border-radius: 50%;
  transition: border-color .15s, box-shadow .15s;
}
.assess-option:hover .assess-option-mark {
  border-color: var(--gold); box-shadow: inset 0 0 0 3px var(--gold-glow);
}
.assess-note {
  text-align: center; font-size: .84rem; color: var(--text-faint);
  margin-top: 1.6rem;
}

/* --- Identity ------------------------------------------------- */
.identity { text-align: center; }
.identity-eyebrow {
  font-size: .7rem; letter-spacing: .24em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .6rem;
}
.identity-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 6.5vw, 3rem);
  color: var(--gold); margin-bottom: .6rem; letter-spacing: .02em;
}
.identity-hybrid {
  font-size: .88rem; color: var(--text-mute);
  border-block: 1px solid var(--line-soft); padding-block: .6rem;
  max-width: 44ch; margin: 0 auto 1.1rem;
}
.identity-desc { max-width: 54ch; margin-inline: auto; color: var(--text); }
.identity-flavour {
  font-family: var(--font-display); font-style: italic;
  color: var(--text-mute); max-width: 50ch; margin: 0 auto;
}

.near-list { list-style: none; margin: 0; padding: 0; }
.near-list li {
  padding: .75rem 0; border-bottom: 1px solid var(--line-soft);
}
.near-list li:last-child { border-bottom: 0; }
.near-list b { color: var(--text); margin-right: .5rem; }
.near-list small { display: block; color: var(--text-faint); margin-top: .2rem; }

/* --- Dimension bands ------------------------------------------ */
.dim { margin-bottom: 1.3rem; }
.dim:last-child { margin-bottom: 0; }
.dim-head {
  display: flex; align-items: baseline; gap: .7rem; margin-bottom: .4rem;
}
.dim-head b { font-size: 1rem; }
.dim-band {
  margin-left: auto; font-size: .74rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold);
}
.dim-bar {
  height: 6px; background: var(--ink-2); border-radius: 3px;
  overflow: hidden; border: 1px solid var(--line-soft);
}
.dim-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 3px;
}
.dim-note { font-size: .85rem; color: var(--text-faint); margin: .4rem 0 0; }

/* --- Stage list ----------------------------------------------- */
.stage-list { list-style: none; margin: 0; padding: 0; counter-reset: stage; }
.stage-list li {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: .8rem 0; border-bottom: 1px solid var(--line-soft);
}
.stage-list li:last-child { border-bottom: 0; }
.stage-list li.is-current { color: var(--gold); }
.stage-list li.is-current b { color: var(--gold); }
.stage-age {
  flex: 0 0 62px; font-family: ui-monospace, Menlo, monospace;
  font-size: .78rem; color: var(--text-faint); padding-top: .22rem;
}
.stage-list b { display: block; font-weight: 600; margin-bottom: .1rem; }
.stage-list small { color: var(--text-faint); }

/* --- Archetype catalogue -------------------------------------- */
.arch-grid { display: grid; gap: .9rem; }
@media (min-width: 640px) { .arch-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .arch-grid { grid-template-columns: repeat(3, 1fr); } }

.arch {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 1rem 1.05rem;
  position: relative;
}
.arch h3 { color: var(--gold); font-size: 1rem; margin-bottom: .3rem; }
.arch-tier {
  position: absolute; top: .85rem; right: .9rem;
  font-size: .62rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint);
}
.arch.tier-rare { border-color: rgba(214,178,106,.34); }
.arch.tier-rare .arch-tier { color: var(--gold-dim); }
.arch.tier-legendary { border-color: var(--gold-dim); background: rgba(214,178,106,.06); }
.arch.tier-legendary .arch-tier { color: var(--gold); }
.arch-desc { font-size: .87rem; color: var(--text-mute); margin-bottom: .5rem; }
.arch-flavour {
  font-family: var(--font-display); font-style: italic;
  font-size: .85rem; color: var(--text-faint); margin-bottom: .4rem;
}
.arch-forms { font-size: .74rem; margin: 0; }

.how-title { display: grid; gap: 1rem; margin-bottom: 1.4rem; }
@media (min-width: 720px) { .how-title { grid-template-columns: repeat(4, 1fr); } }
.how-label {
  display: block; font-size: .68rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--gold); margin-bottom: .3rem;
}
.how-title p { font-size: .86rem; color: var(--text-mute); margin: 0; }
.title-example {
  text-align: center; font-family: var(--font-display);
  font-size: clamp(1.05rem, 3.4vw, 1.45rem);
  border-block: 1px solid var(--line-soft); padding-block: 1.2rem;
  margin-bottom: 1.1rem;
}
.title-example .faint { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; }
.title-example em { color: var(--text-mute); font-style: italic; }
.title-example strong { color: var(--gold); }

/* --- Audio settings ------------------------------------------- */
.mixer { display: grid; gap: 1.1rem; }
.mix-row { display: grid; grid-template-columns: 1fr; gap: .3rem; }
.mix-row label { font-size: .9rem; font-weight: 600; }
.mix-row input[type="range"] {
  width: 100%; accent-color: var(--gold-dim); height: 26px; cursor: pointer;
}
.mix-row .hint { font-size: .8rem; color: var(--text-faint); }

/* --- Cue region (§38 visual equivalents) ---------------------- */
.cue-region {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  display: flex; flex-direction: column; gap: .4rem;
  pointer-events: none; max-width: min(340px, 82vw);
}
.cue-line {
  margin: 0; padding: .5rem .8rem;
  background: rgba(22,20,42,.94); border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  font-size: .82rem; color: var(--text);
  box-shadow: var(--shadow);
}

/* ===============================================================
 * PHASE 3 — the play loop
 * ============================================================= */
.play { max-width: 660px; margin-inline: auto; }

.play-head {
  display: flex; align-items: baseline; gap: .8rem;
  padding-bottom: .8rem; margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
}
.play-age { color: var(--gold); font-weight: 600; }
.play-stage { color: var(--text-faint); }
.play-timeline-link { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: .84rem; }

.play-weight {
  font-size: .76rem; letter-spacing: .2em; text-transform: uppercase;
  margin-bottom: .6rem;
}
.play-weight.risk-high { color: var(--warn); }
.play-weight.risk-critical { color: var(--err); letter-spacing: .26em; }

.play-title { font-size: clamp(1.5rem, 5vw, 2.2rem); color: var(--gold); margin-bottom: 1.1rem; }

.play-scenario {
  border-left: 2px solid var(--line); padding-left: 1.15rem; margin-bottom: 2rem;
}
.play-scenario p {
  font-size: clamp(1rem, 2.6vw, 1.1rem); line-height: 1.78; margin: 0;
}

.play-choices fieldset { border: 0; padding: 0; margin: 0; }
.play-choice {
  display: flex; gap: .9rem; align-items: flex-start; width: 100%;
  text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 1rem 1.1rem; margin-bottom: .7rem;
  transition: border-color .15s, background .15s, transform .08s;
}
.play-choice:hover { border-color: var(--gold-dim); background: var(--panel-2); }
.play-choice:active { transform: translateY(1px); }
.play-choice-mark {
  flex: 0 0 auto; width: 15px; height: 15px; margin-top: .34rem;
  border: 1px solid var(--line); border-radius: 50%;
  transition: border-color .15s, box-shadow .15s;
}
.play-choice:hover .play-choice-mark {
  border-color: var(--gold); box-shadow: inset 0 0 0 3px var(--gold-glow);
}
.play-note { text-align: center; font-size: .82rem; color: var(--text-faint); margin-top: 1.4rem; }

/* --- resources ------------------------------------------------ */
.play-resources {
  display: grid; gap: .55rem; margin-top: 2rem;
  padding-top: 1.4rem; border-top: 1px solid var(--line-soft);
}
.play-resources.wide { border-top: 0; padding-top: 0; margin-top: 0; }
@media (min-width: 620px) { .play-resources { grid-template-columns: repeat(2, 1fr); gap: .55rem 1.4rem; } }
.res { display: grid; grid-template-columns: 5.6rem 1fr 5.4rem; gap: .6rem; align-items: center; }
.res-name { font-size: .8rem; color: var(--text-mute); }
.res-bar {
  height: 5px; background: var(--ink-2); border-radius: 3px;
  border: 1px solid var(--line-soft); overflow: hidden;
}
.res-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.res-band { font-size: .72rem; color: var(--text-faint); text-align: right; }

/* --- outcome -------------------------------------------------- */
.outcome-eyebrow {
  font-size: .74rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .4rem;
}
.outcome-choice {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1.05rem, 3vw, 1.3rem); color: var(--text-mute);
  margin-bottom: 1.4rem;
}
.outcome-narrative {
  border-left: 2px solid var(--gold-dim); padding-left: 1.15rem;
  margin-bottom: 1.6rem;
}
.outcome-narrative p { font-size: clamp(1rem, 2.6vw, 1.1rem); line-height: 1.78; }
.outcome-narrative.tone-failure, .outcome-narrative.tone-setback { border-left-color: var(--err); }
.outcome-narrative.tone-success { border-left-color: var(--ok); }
.outcome-narrative.tone-discovery, .outcome-narrative.tone-opportunity { border-left-color: var(--info); }
.outcome-narrative.tone-turning { border-left-color: var(--gold); }
.outcome-after { color: var(--text-mute); font-size: .93rem; }

.effect-list { list-style: none; margin: 0 0 1.4rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.effect-list li {
  font-size: .78rem; padding: .2rem .6rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-mute);
}
.effect-list li.up { border-color: rgba(127,214,164,.34); color: var(--ok); }
.effect-list li.down { border-color: rgba(240,138,138,.3); color: var(--err); }

.turning-mark {
  text-align: center; font-size: .74rem; letter-spacing: .26em;
  text-transform: uppercase; color: var(--gold);
  border-block: 1px solid var(--gold-dim); padding-block: .8rem; margin-bottom: 1.6rem;
}

.stage-change {
  text-align: center; border: 1px solid var(--gold-dim);
  background: rgba(214,178,106,.06); border-radius: var(--radius);
  padding: 1.3rem; margin-bottom: 1.6rem;
}
.stage-change-label { font-size: .7rem; letter-spacing: .22em; text-transform: uppercase; color: var(--text-faint); margin-bottom: .3rem; }
.stage-change-name { font-family: var(--font-display); font-size: 1.4rem; color: var(--gold); margin-bottom: .4rem; }
.stage-change-desc { color: var(--text-mute); font-size: .9rem; margin: 0; }

.outcome-identity {
  text-align: center; font-family: var(--font-display);
  font-size: 1.2rem; color: var(--gold);
  border-top: 1px solid var(--line-soft); padding-top: 1.3rem; margin-top: 1.8rem;
}
.outcome-identity .faint { font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; font-family: var(--font-body); }

/* --- surfaced consequences & echoes --------------------------- */
.surfaced, .echo {
  border: 1px solid var(--line); border-left: 3px solid var(--info);
  background: rgba(138,180,240,.05); border-radius: var(--radius-sm);
  padding: .85rem 1rem; margin-bottom: 1rem;
}
.surfaced-tag, .echo-tag {
  display: block; font-size: .66rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--info); margin-bottom: .3rem;
}
.surfaced p, .echo p { margin: 0; font-size: .92rem; color: var(--text); }
.echo-growth { border-left-color: var(--ok); background: rgba(127,214,164,.05); }
.echo-growth .echo-tag { color: var(--ok); }
.echo-regression { border-left-color: var(--err); background: rgba(240,138,138,.05); }
.echo-regression .echo-tag { color: var(--err); }
.echo-consistency { border-left-color: var(--gold-dim); background: rgba(214,178,106,.05); }
.echo-consistency .echo-tag { color: var(--gold-dim); }

/* --- timeline ------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-stage {
  font-size: .7rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold-dim); margin: 1.6rem 0 .7rem;
  padding-bottom: .35rem; border-bottom: 1px solid var(--line-soft);
}
.timeline-stage:first-child { margin-top: 0; }
.timeline-entry { display: flex; gap: 1rem; padding: .7rem 0; align-items: flex-start; }
.timeline-age {
  flex: 0 0 2.2rem; font-family: ui-monospace, Menlo, monospace;
  font-size: .82rem; color: var(--text-faint); padding-top: .18rem; text-align: right;
}
.timeline-body b { display: inline; margin-right: .5rem; }
.timeline-body small { display: block; color: var(--text-faint); margin-top: .25rem; }
.timeline-entry.kind-turning_point .timeline-body b { color: var(--gold); }
.timeline-entry.kind-growth .timeline-body b { color: var(--ok); }
.timeline-entry.kind-failure .timeline-body b { color: var(--err); }

.chain-list { list-style: none; margin: 0; padding: 0; }
.chain-list li {
  display: flex; gap: .8rem; padding: .6rem 0;
  border-bottom: 1px solid var(--line-soft); font-size: .92rem;
}
.chain-list li:last-child { border-bottom: 0; }
.chain-gap {
  flex: 0 0 5.2rem; font-family: ui-monospace, Menlo, monospace;
  font-size: .76rem; color: var(--gold-dim); padding-top: .1rem;
}

.skill-list { list-style: none; margin: 0; padding: 0; }
.skill-list li { padding: .5rem 0; border-bottom: 1px solid var(--line-soft); }
.skill-list li:last-child { border-bottom: 0; }
.skill-list small { display: block; color: var(--text-faint); }

/* ===============================================================
 * PHASE 4 — people
 * ============================================================= */
.play-cast {
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold-dim); margin-bottom: 1.1rem;
}

.people { display: grid; gap: .9rem; }
@media (min-width: 680px) { .people { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1020px) { .people { grid-template-columns: repeat(3, 1fr); } }

.person {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 1rem 1.05rem;
}
.person.is-known { border-color: var(--gold-dim); }
.person.status-distant { opacity: .72; }
.person.status-estranged { border-color: rgba(240,138,138,.3); opacity: .8; }

.person-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .35rem; }
.person-head h3 { color: var(--gold); font-size: 1.02rem; margin: 0; }
.person-status {
  margin-left: auto; font-size: .64rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-faint);
}
.person-reading {
  font-family: var(--font-display); font-style: italic;
  font-size: .95rem; color: var(--text); margin-bottom: .5rem;
}
.person-truth {
  font-size: .84rem; color: var(--gold); margin-bottom: .5rem;
  padding: .3rem .6rem; border: 1px solid var(--gold-dim);
  border-radius: 999px; display: inline-block;
}
.person-insight {
  height: 3px; background: var(--ink-2); border-radius: 2px;
  overflow: hidden; margin-bottom: .6rem;
}
.person-insight span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
}
.person-desc { font-size: .85rem; color: var(--text-mute); margin-bottom: .7rem; }
.person-bands { display: flex; gap: .9rem; margin: 0 0 .5rem; flex-wrap: wrap; }
.person-bands dt {
  font-size: .6rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); margin: 0;
}
.person-bands dd { margin: 0; font-size: .8rem; color: var(--text-mute); }
.person-meta { font-size: .72rem; margin: 0; }

/* --- tells and reveals ---------------------------------------- */
.tell {
  border: 1px solid var(--line); border-left: 3px solid var(--text-faint);
  background: rgba(111,104,144,.06); border-radius: var(--radius-sm);
  padding: .8rem 1rem; margin-bottom: 1rem;
}
.tell-tag {
  display: block; font-size: .64rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: .3rem;
}
.tell p { margin: 0; font-size: .9rem; color: var(--text-mute); font-style: italic; }

.reveal {
  border: 1px solid var(--gold-dim); background: rgba(214,178,106,.07);
  border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.4rem;
  text-align: center;
}
.reveal-colder { border-color: rgba(240,138,138,.45); background: rgba(240,138,138,.06); }
.reveal-warmer { border-color: rgba(127,214,164,.45); background: rgba(127,214,164,.06); }
.reveal-tag {
  display: block; font-size: .66rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--gold); margin-bottom: .6rem;
}
.reveal-colder .reveal-tag { color: var(--err); }
.reveal-warmer .reveal-tag { color: var(--ok); }
.reveal-text {
  font-family: var(--font-display); font-size: 1.05rem;
  line-height: 1.6; margin-bottom: .5rem;
}
.reveal-nature {
  font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); margin: 0;
}

/* ===============================================================
 * PHASE 5 — risk, endings, summaries, the archive
 * ============================================================= */

/* --- risk signalling (never a number) ------------------------- */
.risk-note {
  font-size: .88rem; font-style: italic;
  border-left: 2px solid var(--line); padding-left: .9rem;
  margin-bottom: 1rem; color: var(--text-mute);
}
.risk-note.risk-high    { border-left-color: var(--warn); color: var(--warn); }
.risk-note.risk-severe  { border-left-color: var(--err); color: var(--err); }
.risk-note.risk-critical{
  border-left-color: var(--err); color: var(--err);
  letter-spacing: .02em;
}

/* --- LIFE ENDED (§32) ----------------------------------------- */
.ended {
  max-width: 520px; margin-inline: auto; text-align: center;
  padding-block: clamp(3rem, 16vh, 8rem);
}
.ended-mark {
  font-size: .78rem; letter-spacing: .42em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 2.4rem;
  animation: ended-in 2.2s ease-out both;
}
.ended-statement {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 4.2vw, 1.7rem); line-height: 1.6;
  color: var(--text); margin-bottom: 3rem;
  animation: ended-in 2.6s ease-out .8s both;
}
.ended-facts {
  display: flex; justify-content: center; gap: 1.6rem; flex-wrap: wrap;
  font-size: .76rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 3rem;
  animation: ended-in 2s ease-out 2s both;
}
/* Held back on purpose: §32 wants several seconds of silence before
   anything asks the player to act. */
.ended-onward { animation: ended-in 1.6s ease-out 4.5s both; }
.ended-note {
  font-size: .78rem; color: var(--text-faint); margin-top: 2.4rem;
  animation: ended-in 1.6s ease-out 5.4s both;
}
@keyframes ended-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .ended-mark, .ended-statement, .ended-facts, .ended-onward, .ended-note {
    animation: none;
  }
}

/* --- life summary --------------------------------------------- */
.summary { max-width: 680px; margin-inline: auto; text-align: center; margin-bottom: 2rem; }
.summary-eyebrow {
  font-size: .72rem; letter-spacing: .24em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .5rem;
}
.summary-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 2.9rem); color: var(--gold);
  margin-bottom: .4rem; letter-spacing: .02em;
}
.summary-path {
  font-family: var(--font-display); font-style: italic;
  color: var(--text-mute); margin-bottom: 1.8rem;
}
.summary-facts {
  display: flex; justify-content: center; gap: 1.4rem 2.2rem; flex-wrap: wrap;
  border-block: 1px solid var(--line-soft); padding-block: 1.1rem;
  margin-bottom: 2rem;
}
.summary-facts dt {
  font-size: .64rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); margin: 0;
}
.summary-facts dd {
  margin: .2rem 0 0; font-family: var(--font-display);
  font-size: 1.5rem; color: var(--text);
}

.reflection { text-align: left; max-width: 60ch; margin-inline: auto; }
.reflection p {
  font-size: clamp(1rem, 2.6vw, 1.1rem); line-height: 1.8;
  color: var(--text); margin-bottom: 1.2rem;
}
.reflection p:first-child { color: var(--gold); font-family: var(--font-display); }
.summary.tone-warm .reflection p:first-child { color: var(--gold); }
.summary.tone-restrained .reflection p:first-child { color: var(--text-mute); }

.epithet {
  border: 1px solid var(--gold-dim); background: rgba(214,178,106,.07);
  border-radius: var(--radius); padding: 1.2rem; margin-top: 1.8rem;
}
.epithet-tag {
  display: block; font-size: .64rem; letter-spacing: .24em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: .4rem;
}
.epithet-text {
  font-family: var(--font-display); font-size: 1.3rem;
  color: var(--gold); margin: 0;
}

/* --- archive --------------------------------------------------- */
.archive { display: grid; gap: 1rem; }
@media (min-width: 700px) { .archive { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .archive { grid-template-columns: repeat(3, 1fr); } }

.archived {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 1.1rem;
}
.archived.tone-warm { border-color: rgba(214,178,106,.34); }
.archived.tone-restrained { opacity: .86; }
.archived-head {
  display: flex; justify-content: space-between;
  font-size: .66rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .5rem;
}
.archived h3 {
  font-family: var(--font-display); color: var(--gold);
  font-size: 1.08rem; margin-bottom: .3rem;
}
.archived-path {
  font-style: italic; font-size: .84rem; color: var(--text-mute);
  margin-bottom: .5rem;
}
.archived-ending { font-size: .86rem; color: var(--text-mute); margin-bottom: .8rem; }
.archived-facts { display: flex; flex-wrap: wrap; gap: .8rem 1.1rem; margin: 0 0 .8rem; }
.archived-facts dt {
  font-size: .6rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); margin: 0;
}
.archived-facts dd { margin: 0; font-size: .92rem; color: var(--text); }
.archived-link { margin: 0; font-size: .86rem; }

/* =====================================================================
   Phase 6 — scores, trends, achievements, rankings
   ===================================================================== */

/* --- The nine measures ---------------------------------------------- */
.score-grid {
  display: grid; gap: 1.05rem;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
}
.score-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: .6rem; margin-bottom: .38rem;
}
.score-head b { font-size: .9rem; }
.score-value {
  font-family: var(--font-display); color: var(--gold);
  font-size: 1.02rem; font-variant-numeric: tabular-nums;
}
.score-note {
  margin: .42rem 0 0; font-size: .76rem; line-height: 1.5;
  color: var(--text-faint);
}

/* The composite. Deliberately quieter than the nine above it: §24 says
   it must not be presented as the only measure, and typography is where
   that argument is either made or quietly lost. */
.composite {
  margin-top: 1.6rem; padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft); text-align: center;
}
.composite-label {
  font-size: .64rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .3rem;
}
.composite-value {
  font-family: var(--font-display); font-size: 2.1rem; line-height: 1;
  color: var(--gold-dim); font-variant-numeric: tabular-nums;
  margin-bottom: .7rem;
}
.composite-caveat {
  max-width: 46ch; margin: 0 auto; font-size: .84rem;
  line-height: 1.62; color: var(--text-mute);
}

/* --- Behavioural trends (§23) ---------------------------------------- */
.discovery .trend {
  padding: .95rem 1.05rem; margin-bottom: .7rem;
  background: var(--panel-2); border-left: 2px solid var(--line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.discovery .trend:last-child { margin-bottom: 0; }
.trend-strength, .trend-improvement { border-left-color: var(--gold-dim); }
.trend-weakness, .trend-decline     { border-left-color: var(--line); }
.trend-contradiction                { border-left-color: var(--info); }
.trend-tag {
  display: inline-block; font-size: .58rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: .35rem;
}
.trend-statement {
  margin: 0; font-size: .95rem; line-height: 1.62; color: var(--text);
}
.trend-evidence {
  margin: .4rem 0 0; font-size: .79rem; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* --- Achievements ---------------------------------------------------- */
.ach-grid {
  display: grid; gap: .85rem;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
}
.ach-card {
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: .9rem 1rem;
}
.ach-card.tier-legendary { border-color: rgba(214,178,106,.5); background: linear-gradient(180deg, rgba(214,178,106,.09), transparent 70%), var(--panel-2); }
.ach-card.tier-major     { border-color: rgba(214,178,106,.28); }
.ach-card.is-open        { opacity: .55; }
.ach-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: .5rem; margin-bottom: .35rem;
}
.ach-head h3 {
  font-family: var(--font-display); font-size: .96rem;
  color: var(--gold); margin: 0;
}
.ach-tier {
  font-size: .55rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); white-space: nowrap;
}
.ach-desc { margin: 0; font-size: .81rem; line-height: 1.55; color: var(--text-mute); }
.ach-when { margin: .5rem 0 0; font-size: .7rem; }

.ach-strip { display: flex; flex-wrap: wrap; gap: .45rem; }
.ach-strip .ach {
  display: inline-block; padding: .3rem .68rem; font-size: .76rem;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 999px; color: var(--text-mute);
}
.ach-strip .ach.tier-legendary { border-color: rgba(214,178,106,.5); color: var(--gold); }
.ach-strip .ach.tier-major     { border-color: rgba(214,178,106,.28); }

/* --- Rankings -------------------------------------------------------- */
tr.is-you td { background: rgba(214,178,106,.07); }
tr.is-you td:first-child { box-shadow: inset 2px 0 0 var(--gold-dim); }
tr.is-varied td { color: var(--text); }
tr.is-varied td:first-child { box-shadow: inset 2px 0 0 var(--gold-dim); }
tr.row-total td {
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.stat { margin: 0; }
.stat dt {
  font-size: .6rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .28rem;
}
.stat dd {
  margin: 0; font-family: var(--font-display); font-size: 1.5rem;
  color: var(--gold); font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .composite-value { font-size: 1.75rem; }
  .score-grid, .ach-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   Phase 7 — admin CMS, moderation, deployment
   ===================================================================== */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.grow { flex: 1 1 auto; }

/* --- Forms ----------------------------------------------------------- */
.inline-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: .55rem;
}
.inline-form input[type="search"],
.inline-form input[type="text"],
.inline-form select { margin: 0; width: auto; min-width: 12rem; }

.form-actions {
  display: flex; align-items: center; gap: 1rem;
  margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--line-soft);
}
.row-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row-actions form { margin: 0; }

.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--err); }

textarea.mono { line-height: 1.5; font-size: .84rem; }

.btn.danger { border-color: rgba(240,138,138,.4); color: var(--err); }
.btn.danger:hover { background: rgba(240,138,138,.08); }

/* --- Tables ---------------------------------------------------------- */
tr.is-retired td { opacity: .5; }
tr.is-retired td:first-child { box-shadow: inset 2px 0 0 var(--line); }

.pager { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.pager a, .pager .pager-current {
  display: inline-block; min-width: 2rem; padding: .28rem .5rem;
  text-align: center; font-size: .82rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
}
.pager .pager-current { background: var(--panel-2); color: var(--gold); border-color: var(--gold-dim); }

/* --- Key/value and notes --------------------------------------------- */
.kv { display: flex; flex-wrap: wrap; gap: .9rem 1.8rem; margin: 0 0 .9rem; }
.kv dt {
  font-size: .6rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); margin: 0 0 .2rem;
}
.kv dd { margin: 0; color: var(--text); }

.notes { list-style: none; margin: 0; padding: 0; }
.notes li {
  padding: .8rem 0; border-bottom: 1px solid var(--line-soft);
}
.notes li:last-child { border-bottom: 0; padding-bottom: 0; }
.note-meta { margin: 0 0 .3rem; }

/* --- Content health --------------------------------------------------- */
.check-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.check-head h2 { margin: 0; }
.check-fault   { border-left: 3px solid var(--err); }
.check-warning { border-left: 3px solid var(--warn); }
.check-note    { border-left: 3px solid var(--line); }

.pill-fault   { color: var(--err);  border-color: rgba(240,138,138,.4); }
.pill-warning { color: var(--warn); border-color: rgba(232,196,106,.4); }
.pill-note    { color: var(--text-mute); }

.check-rows {
  list-style: none; margin: 0; padding: .7rem .9rem;
  background: var(--ink-2); border-radius: var(--radius-sm);
  max-height: 15rem; overflow-y: auto;
}
.check-rows li { padding: .16rem 0; color: var(--text-mute); }

/* --- Maintenance and errors ------------------------------------------ */
.error-page { text-align: center; padding: 4rem 1rem; max-width: 46rem; margin: 0 auto; }
.error-page .lede { font-size: 1.05rem; color: var(--text); margin-bottom: 1rem; }

@media (max-width: 640px) {
  .inline-form input[type="search"],
  .inline-form select { min-width: 0; flex: 1 1 100%; }
  .form-actions { flex-direction: column; align-items: stretch; }
}

/* =====================================================================
   Mobile navigation — hamburger
   =====================================================================
   The nav used to wrap onto three lines on a phone, which pushed the
   game itself below the fold on the one device most people play on.
   Above 860px nothing changes; below it the links collapse behind a
   button.

   The panel is hidden with `display: none` rather than being moved
   off-screen, so its links are genuinely out of the tab order when
   closed — a keyboard user should not tab into a menu they cannot see.
   ===================================================================== */

.nav-toggle {
  display: none;   /* shown only when JS is available — see .has-js below */
  margin-left: auto;
  width: 46px; height: 46px;
  align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text);
}
.nav-toggle:hover { background: var(--panel); }
.nav-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Three bars, drawn from one element: the middle bar is the element
   itself, the outer two are its pseudo-elements. On open they become an
   X — the middle fades, the outer two rotate through the centre. */
.nav-bars, .nav-bars::before, .nav-bars::after {
  display: block; width: 20px; height: 2px;
  background: currentColor; border-radius: 2px;
  transition: transform .18s ease, opacity .18s ease;
}
.nav-bars { position: relative; }
.nav-bars::before, .nav-bars::after { content: ''; position: absolute; left: 0; }
.nav-bars::before { top: -6px; }
.nav-bars::after  { top: 6px; }

.nav-toggle[aria-expanded="true"] .nav-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-bars::after  { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 860px) {
  /* `has-js` is added by app.js. Without it the toggle stays hidden and
     the nav stays visible, because a menu that collapses behind a button
     that cannot open it is worse than a nav that wraps onto two lines. */
  .has-js .nav-toggle { display: flex; }

  .site-header .wrap { flex-wrap: wrap; row-gap: 0; }

  .has-js .nav {
    display: none;
    order: 3;
    width: 100%;
    margin: 0 0 .7rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border-top: 1px solid var(--line-soft);
    padding-top: .5rem;
  }
  .has-js .nav.is-open { display: flex; }

  /* Full-width rows with a real touch target, rather than pills that
     happen to sit under each other. */
  .nav a, .nav button.linklike {
    display: block; width: 100%; text-align: left;
    padding: .8rem .3rem; font-size: .98rem; border-radius: 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .nav form { display: block !important; width: 100%; }
  .nav a[aria-current="page"] {
    background: none; box-shadow: inset 3px 0 0 var(--gold); padding-left: .8rem;
  }
  .nav a:last-child, .nav form:last-child button { border-bottom: 0; }
}

@media (max-width: 420px) {
  .brand-text span { display: none; }
  .brand-text b { font-size: 1rem; }
}

/* Log viewer severity, muted enough not to make a wall of red. */
.log-error { color: var(--err); }
.log-warn  { color: var(--warn); }

/* =====================================================================
   Phase 8 — chapters, interludes, proverbs
   ===================================================================== */

/* --- The chapter close ----------------------------------------------
   The one page in the game that asks nothing. It is given room to
   breathe on purpose: everything else in the play loop is dense with
   consequence, and this is where a player is allowed to stop. */
.chapter-close {
  max-width: 40rem; margin: 0 auto; text-align: center;
  padding-block: clamp(1rem, 4vw, 2.5rem);
}
.chapter-eyebrow {
  font-size: .66rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .6rem;
}
.chapter-title {
  font-family: var(--font-display); color: var(--gold);
  font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1.2;
  margin-bottom: 1.6rem;
}
.chapter-reflection p {
  font-size: 1.02rem; line-height: 1.75; color: var(--text);
  margin-bottom: .8rem;
}

/* --- Proverbs -------------------------------------------------------- */
.proverb {
  margin: 2rem auto; padding: 1.5rem 1.2rem;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  max-width: 34rem;
}
.proverb-text {
  font-family: var(--font-display); font-size: 1.12rem; line-height: 1.6;
  color: var(--text); margin-bottom: .7rem; font-style: italic;
}
.proverb-origin {
  font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold-dim);
}
.proverb-note {
  margin: .8rem 0 0; font-size: .82rem; line-height: 1.6;
  color: var(--text-faint);
}
.proverb-daily { margin: 0 auto; border: 0; padding: .4rem 0; }

/* --- Chapter facts and the invitation to stop ------------------------ */
.chapter-facts {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 1.4rem 2.2rem; margin: 1.8rem 0;
}
.chapter-facts dt {
  font-size: .6rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .25rem;
}
.chapter-facts dd {
  margin: 0; font-family: var(--font-display); font-size: 1.5rem;
  color: var(--gold); font-variant-numeric: tabular-nums;
}
.chapter-facts dd.small-fact { font-size: 1.05rem; }

.chapter-stop {
  margin-top: 2rem; padding-top: 1.6rem;
  border-top: 1px solid var(--line-soft);
}
.chapter-stop-lede {
  font-family: var(--font-display); font-size: 1.15rem;
  color: var(--text); margin-bottom: .6rem;
}
.chapter-actions {
  display: flex; gap: .8rem; justify-content: center;
  flex-wrap: wrap; margin-top: 1.4rem;
}

.chapter-so-far { margin-top: 2.4rem; text-align: left; }
.chapter-list { list-style: none; margin: 0; padding: 0; }
.chapter-list li {
  display: grid; grid-template-columns: 4.5rem 1fr; gap: .2rem .9rem;
  padding: .7rem 0; border-bottom: 1px solid var(--line-soft);
}
.chapter-list li:last-child { border-bottom: 0; }
.chapter-list li.is-now { color: var(--gold); }
.chapter-list-age {
  font-size: .78rem; color: var(--text-faint); font-variant-numeric: tabular-nums;
  padding-top: .12rem;
}
.chapter-list-title { font-size: .95rem; }
.chapter-list-note {
  grid-column: 2; font-size: .82rem; line-height: 1.6; color: var(--text-faint);
}

/* --- Interludes ------------------------------------------------------
   Deliberately quiet. This is the passage of years, not an event: no
   border, no card, nothing that looks like it needs answering. */
.interlude {
  margin: 2rem auto; max-width: 36rem; text-align: center;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line-soft);
}
.interlude-tag {
  font-size: .64rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .7rem;
}
.interlude-text {
  font-size: .98rem; line-height: 1.8; color: var(--text-mute);
  margin: 0; font-style: italic;
}
.interlude.tone-warm .interlude-text { color: var(--text); }
.interlude.tone-restrained .interlude-text { opacity: .82; }

@media (max-width: 640px) {
  .chapter-facts { gap: 1rem 1.4rem; }
  .chapter-facts dd { font-size: 1.25rem; }
  .chapter-actions .btn { width: 100%; }
}
