/* The Wisdom Council: the sorting quiz.
   Tokens follow website/landing/public/styles.css (parchment, iron-gall ink,
   rubric red, gilt). Night is "the lantern closed": dark vellum and gilt. */

@font-face {
  font-family: 'Truth Point';
  src: url('/assets/truth-point-medium-v3.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

:root {
  --paper: #efe4cf;
  --paper-raised: #f5ecda;
  --paper-tile: url('/assets/vellum.webp');
  --ink: #2a1d14;
  --ink-soft: #46362a;
  --ink-muted: #6b5845;
  --rule: rgba(58, 38, 22, 0.22);
  --rule-strong: rgba(58, 38, 22, 0.45);
  --rubric: #8c2f1f;
  --rubric-hi: #a33b24;
  --gilt: #9b7631;
  --gilt-hi: #d9b86c;
  --focus: #8c2f1f;
  --burn: 104, 64, 26;
  --button-text: #f7eedc;
  --school: var(--gilt);
  --serif: Cardo, 'Iowan Old Style', Georgia, serif;
  --display: 'Truth Point', Cardo, Georgia, serif;
  --gutter: clamp(1rem, 4vw, 3rem);
  --ease-ink: cubic-bezier(0.6, 0.05, 0.3, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

:root[data-theme='night'] {
  --paper: #18120e;
  --paper-raised: #211912;
  --paper-tile: url('/assets/vellum-night.webp');
  --ink: #ece1cb;
  --ink-soft: #d3c5ab;
  --ink-muted: #a99880;
  --rule: rgba(236, 225, 203, 0.16);
  --rule-strong: rgba(236, 225, 203, 0.34);
  --rubric: #e08a6f;
  --rubric-hi: #ee9d82;
  --gilt: #c9a458;
  --gilt-hi: #f4dc9c;
  --focus: #f0b08f;
  --burn: 0, 0, 0;
  --button-text: #1a120c;
  color-scheme: dark;
}

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

html {
  background-color: var(--paper);
  background-image: var(--paper-tile);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--ink);
  font-feature-settings: 'kern', 'liga', 'onum';
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color 0.6s var(--ease-ink);
}

/* Mottling and a burnt edge, as on the cover's parchment. The school's color
   bleeds in at the edges once the council is sure. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 12% 18%, rgba(var(--burn), 0.07), transparent 70%),
    radial-gradient(ellipse 60% 50% at 88% 78%, rgba(var(--burn), 0.08), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(var(--burn), 0.14));
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 110% 85% at 50% 50%, transparent 60%, var(--school));
  opacity: var(--school-glow, 0);
  transition: opacity 1.6s var(--ease-ink), background 1.6s var(--ease-ink);
}

[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sc { font-variant-caps: small-caps; letter-spacing: 0.04em; }

/* --- Running head ----------------------------------------------------- */

.running-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem var(--gutter);
  border-bottom: 1px solid var(--rule);
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.running-title { color: var(--ink-soft); }
.running-movement { margin-left: auto; color: var(--gilt); }
.lantern {
  width: 2.2rem; height: 2.2rem;
  display: grid; place-items: center;
  background: none; border: 1px solid var(--rule); border-radius: 50%;
  color: var(--gilt); cursor: pointer;
}
.lantern svg { width: 1.2rem; height: 1.2rem; }
:root[data-theme='day'] .lantern .flame { opacity: 0.25; }

/* --- Desk: the leaf and the margin ------------------------------------ */

.desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 26rem);
  grid-template-areas: 'leaf margin';
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  width: 100%;
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3.5rem) var(--gutter);
}
.leaf { grid-area: leaf; max-width: 40rem; padding-bottom: 2rem; }
.margin { grid-area: margin; position: sticky; top: 1.5rem; text-align: center; }
.sigil-stage { position: relative; width: 100%; aspect-ratio: 1; }
.sigil { width: 100%; height: 100%; display: block; transition: opacity 0.6s var(--ease-ink); }
.sigil-stage.settled .sigil { opacity: 0; pointer-events: none; }
.crest {
  position: absolute; inset: 0;
  animation: ink-in 0.9s var(--ease-ink) both;
}
.crest::before {
  content: ''; position: absolute; inset: -6%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, var(--school) 0%, transparent 68%);
  opacity: 0.14;
}
:root[data-theme='night'] .crest::before { opacity: 0.22; }
.crest-lattice, .crest-solid {
  position: absolute; inset: 3%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}
.crest-lattice {
  background: var(--ink-muted);
  opacity: 0.44;
  -webkit-mask-image: url('/assets/crest-lattice.webp');
  mask-image: url('/assets/crest-lattice.webp');
}
:root[data-theme='night'] .crest-lattice { opacity: 0.36; }
.crest-solid {
  background: var(--school-deep, var(--school));
  -webkit-mask-image: var(--crest-solid);
  mask-image: var(--crest-solid);
}
.crest-solid-b { display: none; }
:root[data-theme='night'] .crest-solid { background: var(--school); }
.crest.crest-dual .crest-solid-a {
  background: var(--crest-a-color, var(--school-deep, var(--school)));
  animation: crest-fade-a 7.2s ease-in-out infinite;
}
.crest.crest-dual .crest-solid-b {
  display: block;
  background: var(--crest-b-color, var(--gilt));
  -webkit-mask-image: var(--crest-solid-b);
  mask-image: var(--crest-solid-b);
  animation: crest-fade-b 7.2s ease-in-out infinite;
}
:root[data-theme='night'] .crest.crest-dual .crest-solid-a { background: var(--crest-a-night, var(--school)); }
:root[data-theme='night'] .crest.crest-dual .crest-solid-b { background: var(--crest-b-night, var(--gilt)); }
@keyframes crest-fade-a {
  0%, 16%, 100% { opacity: 0.96; }
  50%, 66% { opacity: 0.14; }
}
@keyframes crest-fade-b {
  0%, 16%, 100% { opacity: 0.14; }
  50%, 66% { opacity: 0.96; }
}
.crest.crest-open .crest-lattice { background: var(--gilt); opacity: 0.78; }
.crest.crest-open .crest-solid { display: none; }
.sigil-caption {
  min-height: 1.4em;
  margin-top: 0.4rem;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-muted);
  transition: color 1s;
}

@media (max-width: 52rem) {
  .desk { grid-template-columns: 1fr; grid-template-areas: 'margin' 'leaf'; gap: 0.5rem; padding-top: 1rem; }
  .margin { position: static; }
  .sigil-stage { width: min(62vw, 15rem); margin: 0 auto; }
  .leaf { max-width: none; }
}

/* --- Gate -------------------------------------------------------------- */

.kicker { font-style: italic; color: var(--ink-muted); font-size: 0.95rem; }
.title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  margin: 0.4rem 0 1.2rem;
}
.title-the { color: var(--rubric); font-size: 0.42em; letter-spacing: 0.3em; vertical-align: 0.9em; margin-right: 0.3em; }
.opening { font-size: 1.15rem; color: var(--ink-soft); margin-bottom: 1.8rem; max-width: 34rem; }
.gate-form { display: grid; gap: 1rem; max-width: 26rem; }
.field { display: grid; gap: 0.25rem; }
.field-label { font-family: var(--display); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); }
.field-note { text-transform: none; letter-spacing: 0; font-family: var(--serif); font-style: italic; font-size: 0.9rem; }
.field input, .field select {
  padding: 0.55rem 0.1rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-strong);
  border-radius: 0;
  font-size: 1.1rem;
}
.field select { padding-left: 0; }
.field select option { background: var(--paper-raised); color: var(--ink); }
.field input::placeholder { color: var(--ink-muted); opacity: 0.6; font-style: italic; }
.field input:focus { outline: none; border-bottom-color: var(--gilt); }
.consent { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; align-items: start; font-size: 0.92rem; color: var(--ink-soft); }
.consent input { margin-top: 0.3rem; accent-color: var(--rubric); width: 1.05rem; height: 1.05rem; }
.under13-note { font-size: 0.92rem; font-style: italic; color: var(--ink-muted); }
.turnstile-container {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.turnstile-container.needs-interaction {
  position: static;
  opacity: 1;
  pointer-events: auto;
}
.gate-actions { display: flex; align-items: center; gap: 0.9rem; }
.gate-actions .button { flex: 1; }
.verify-spinner {
  display: none;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.gate-form.verifying .verify-spinner { display: inline-block; }
.verify-spinner path { stroke: var(--rubric); }
.form-error { min-height: 1.2em; color: var(--rubric); font-style: italic; font-size: 0.95rem; }
.form-error:empty { display: none; }
.fine { font-size: 0.85rem; font-style: italic; color: var(--ink-muted); }
.resume { display: grid; gap: 0.75rem; max-width: 22rem; margin-top: 1.5rem; }

/* --- Buttons ------------------------------------------------------------ */

.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  font-family: var(--display); font-size: 0.82rem; letter-spacing: 0.16em; text-transform: uppercase;
  border-radius: 2px; cursor: pointer;
  transition: transform 0.2s var(--ease-out), background-color 0.2s;
}
.button-rubric { background: var(--rubric); color: var(--button-text); border: 1px solid var(--rubric); box-shadow: 0 1px 0 rgba(0,0,0,0.2); }
.button-rubric:hover { background: var(--rubric-hi); }
.button-rubric:active { transform: translateY(1px); }
.button-rubric:disabled { opacity: 0.4; cursor: default; }
.button-quiet { background: none; color: var(--ink-soft); border: 1px solid var(--rule-strong); }

/* --- A question --------------------------------------------------------- */

.movement-break {
  font-family: var(--display); font-size: 0.85rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--gilt); margin-bottom: 1.4rem;
  display: flex; align-items: center; gap: 1rem;
}
.movement-break::before, .movement-break::after { content: ''; flex: 1; height: 1px; background: var(--rule-strong); }
/* A question's title reads like a chapter heading; the subtitle is its quiet qualifier. */
.q-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.15;
  letter-spacing: 0.005em;
  margin-bottom: 0.15rem;
}
.q-title:focus { outline: none; }
.q-subtitle {
  font-style: italic; color: var(--ink-muted);
  font-size: 1.12rem; margin-bottom: 0.9rem;
}
.prompt.prompt-under-title { font-size: clamp(1.12rem, 2.4vw, 1.3rem); color: var(--ink-soft); margin-top: 0.5rem; }
.prompt {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.35rem, 3.2vw, 1.75rem); line-height: 1.35;
  margin-bottom: 0.4rem;
}
.prompt:focus { outline: none; }
.hint { font-style: italic; color: var(--ink-muted); margin-bottom: 1.2rem; min-height: 0.5rem; }
.answer, .followup { display: grid; gap: 0.15rem; margin: 0.6rem 0 1.4rem; }
.followup-prompt { font-style: italic; font-size: 1.2rem; margin: 0.4rem 0 0.4rem; color: var(--ink-soft); }

/* Choice: inked lines; the chosen one takes a rubric mark. */
.opt {
  display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.4rem; align-items: baseline;
  width: 100%; text-align: left;
  padding: 0.65rem 0.4rem;
  background: none; border: none; border-bottom: 1px solid var(--rule);
  cursor: pointer; font-size: 1.12rem; color: var(--ink);
  transition: background-color 0.2s, color 0.2s;
}
.opt:hover { background: rgba(var(--burn), 0.06); }
:root[data-theme='night'] .opt:hover { background: rgba(255, 240, 210, 0.04); }
.opt-key { font-family: var(--display); font-size: 0.75rem; color: var(--ink-muted); letter-spacing: 0.1em; }
.opt-mark {
  font-family: var(--display); color: var(--rubric); font-size: 1rem;
  transform: scale(0.4); opacity: 0; transition: transform 0.3s var(--ease-out), opacity 0.3s;
}
.opt[aria-pressed='true'] { color: var(--rubric); }
.opt[aria-pressed='true'] .opt-mark { transform: scale(1); opacity: 1; }
.opt[aria-pressed='true'] .opt-key { display: none; }
.opt:not([aria-pressed='true']) .opt-mark { position: absolute; }

/* Checkboxes: a scribe's tick in the margin. */
.opt.tick .opt-box {
  width: 1.05rem; height: 1.05rem; border: 1px solid var(--rule-strong); display: grid; place-items: center;
  font-family: var(--display); color: var(--rubric); font-size: 1rem; line-height: 1;
}
.tick-count { font-style: italic; color: var(--ink-muted); font-size: 0.95rem; min-height: 1.3em; }

/* Slider: a bowstring between two poles. */
.slider { display: grid; gap: 0.9rem; margin-top: 0.4rem; }
.slider-poles { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; font-size: 1.05rem; }
.slider-poles span:last-child { text-align: right; }
.pole { color: var(--ink-soft); transition: color 0.3s, opacity 0.3s; }
.pole.lean { color: var(--ink); }
.pole.away { opacity: 0.5; }
.slider input[type='range'] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 2rem; background: transparent; cursor: pointer;
}
.slider input[type='range']::-webkit-slider-runnable-track { height: 1px; background: var(--ink-muted); }
.slider input[type='range']::-moz-range-track { height: 1px; background: var(--ink-muted); }
.slider input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; width: 1.3rem; height: 1.3rem; margin-top: -0.65rem; border-radius: 50%;
  background: var(--rubric); border: 2px solid var(--paper-raised); box-shadow: 0 0 0 1px var(--rubric);
}
.slider input[type='range']::-moz-range-thumb {
  width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--rubric); border: 2px solid var(--paper-raised);
}
.slider-notches { display: flex; justify-content: space-between; padding: 0 0.55rem; margin-top: -0.9rem; }
.slider-notches i { width: 1px; height: 0.5rem; background: var(--rule-strong); }

/* Rank: floating boxes, dragged or tapped into order. */
.rank { display: grid; gap: 0.55rem; margin-top: 0.3rem; }
.rank-card {
  position: relative;
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab;
  border: 1px solid var(--rule-strong); border-radius: 3px;
  background: color-mix(in srgb, var(--paper) 80%, var(--ink) 4%);
  box-shadow: 0 1px 0 rgba(var(--burn), 0.12);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.rank-inner {
  display: grid; grid-template-columns: 2.4rem 1fr auto; align-items: center; gap: 0.5rem;
  padding: 0.7rem 0.9rem 0.7rem 0.6rem; font-size: 1.08rem;
  animation: bob var(--bob-dur, 3s) ease-in-out var(--bob-delay, 0s) infinite alternate;
}
@keyframes bob { from { transform: translateY(-1.6px) rotate(-0.3deg); } to { transform: translateY(1.6px) rotate(0.3deg); } }
.rank-num { font-family: var(--display); font-size: 0.85rem; letter-spacing: 0.08em; color: var(--ink-muted); text-align: center; }
.rank-grip { color: var(--ink-muted); opacity: 0.6; letter-spacing: -0.2em; }
.rank-card.rank-top { border-color: var(--gilt); }
.rank-card.rank-top .rank-num { color: var(--gilt); }
.rank-card.rank-bottom { opacity: 0.78; }
.rank-card.placed .rank-num { color: var(--rubric); }
.rank-card.dragging { z-index: 5; cursor: grabbing; box-shadow: 0 10px 24px rgba(var(--burn), 0.25); border-color: var(--rubric); }
.rank-card.dragging .rank-inner, .rank.is-dragging .rank-inner { animation-play-state: paused; }
.rank-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rank-help { font-style: italic; color: var(--ink-muted); font-size: 0.9rem; margin-top: 0.6rem; }

/* Open answer: a ruled line with a quill. */
.ruled {
  width: 100%; padding: 0.5rem 0.1rem;
  background: transparent; border: none; border-bottom: 1px solid var(--rule-strong);
  font-size: 1.2rem; font-style: italic; resize: none; line-height: 1.6;
  caret-color: var(--rubric);
}
.ruled:focus { outline: none; border-bottom-color: var(--gilt); }
.char-count { margin-top: 0.35rem; text-align: right; font-size: 0.85rem; font-style: italic; color: var(--ink-muted); }
.char-count.near-limit { color: var(--rubric); }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }

/* Actions and feathers. */
.actions { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; margin-top: 0.4rem; }
.feather-skip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: none; border: none; cursor: pointer; color: var(--ink-muted);
  font-family: var(--display); font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase;
}
.feather-skip:hover { color: var(--ink); }
.feather-skip:disabled { opacity: 0.35; cursor: default; }
.feathers { display: inline-flex; gap: 0.15rem; }
.feather { width: 0.8rem; height: 1.4rem; color: var(--gilt); transition: transform 1.2s var(--ease-out), opacity 1.2s; }
.feather.spent { transform: translate(1.2rem, -2.5rem) rotate(40deg); opacity: 0; }

/* Ink: each new leaf writes itself in. */
.screen { animation: ink-in 0.7s var(--ease-ink) both; }
@keyframes ink-in { from { opacity: 0; filter: blur(3px); transform: translateY(6px); } to { opacity: 1; filter: none; transform: none; } }

/* Revisiting an earlier answer. */
.revisit-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.2rem; padding: 0.5rem 0.8rem;
  border: 1px solid var(--rubric); border-radius: 3px;
  font-style: italic; color: var(--rubric); font-size: 0.95rem;
}
.revisit-bar button { background: none; border: none; cursor: pointer; color: var(--ink); font-family: var(--display); font-style: normal; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }

/* Back: a quiet pencil link, not a second big button. */
.button-back {
  background: none; border: none; cursor: pointer; color: var(--ink-muted);
  font-family: var(--display); font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase;
}
.button-back:hover { color: var(--ink); }

/* Admin: the author's margin (?mode=admin). */
.admin {
  margin-top: 2rem; padding: 1rem 1.1rem; border: 1px dashed var(--rule-strong); border-radius: 3px;
  font-size: 0.88rem; line-height: 1.45; background: rgba(var(--burn), 0.04);
}
.admin h3 { font-family: var(--display); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gilt); margin-bottom: 0.4rem; }
.admin-meta { color: var(--ink-muted); font-family: ui-monospace, Menlo, monospace; font-size: 0.78rem; margin-bottom: 0.4rem; }
.admin-tags span { display: inline-block; margin: 0 0.3rem 0.3rem 0; padding: 0 0.4rem; border: 1px solid var(--rule); border-radius: 2px; font-family: ui-monospace, Menlo, monospace; font-size: 0.72rem; color: var(--ink-soft); }
.admin-live { color: var(--gilt); font-family: ui-monospace, Menlo, monospace; font-size: 0.75rem; margin: 0.3rem 0; }
.admin-error { color: var(--rubric); border: 1px solid var(--rubric); padding: 0.3rem 0.5rem; margin: 0.4rem 0; font-size: 0.85rem; }
.admin-signals { color: var(--ink-soft); margin: 0.4rem 0; }
.admin-opt { padding: 0.45rem 0; border-top: 1px solid var(--rule); display: grid; gap: 0.2rem; }
.admin-w { font-family: ui-monospace, Menlo, monospace; font-size: 0.72rem; color: var(--ink-muted); }
.admin input, .admin textarea { background: transparent; border: none; border-bottom: 1px solid var(--rule-strong); font-size: 0.88rem; padding: 0.2rem 0; width: 100%; }
.admin input[type=radio], .admin input[type=checkbox] { width: auto; accent-color: var(--rubric); }
.admin-verdict, .admin-flags { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.7rem 0 0.4rem; }
.admin-verdict label { font-family: var(--display); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.75rem; }
.admin-flags label { font-size: 0.82rem; color: var(--ink-soft); }
.admin-note { margin-top: 0.4rem; border: 1px solid var(--rule) !important; padding: 0.4rem !important; }
.admin-actions { display: flex; gap: 1rem; align-items: center; margin-top: 0.6rem; }
.admin-history { margin-top: 0.6rem; color: var(--ink-muted); }
.admin-history p { margin-top: 0.3rem; }

/* The council confers. */
.confer { min-height: 12rem; display: grid; place-items: center; }
.confer-text { font-style: italic; font-size: 1.3rem; color: var(--gilt); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }

/* --- The path: leaves at the foot of the page -------------------------- */

/* The leaves stay in reach at the foot of the window, over a soft paper fade. */
.path {
  position: sticky; bottom: 0; z-index: 4;
  padding: 1.4rem var(--gutter) 1rem; display: grid; justify-items: center; gap: 0.3rem;
  background: linear-gradient(to bottom, transparent, var(--paper) 45%);
}
.leaves { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem; max-width: 40rem; }
.leaf-btn, .leaf-slot { position: relative; display: inline-grid; place-items: center; background: none; border: none; padding: 0.2rem 0.08rem; }
.leaf-btn { cursor: pointer; transition: transform 0.25s var(--ease-out); }
.leaf-btn:hover, .leaf-btn:focus-visible { transform: translateY(-6px) scale(1.8); z-index: 2; }
.leaf-btn:hover .leaf-mark, .leaf-btn:focus-visible .leaf-mark { color: var(--rubric); opacity: 1; }
.leaf-btn.skipped .leaf-mark { opacity: 0.45; }
.leaf-btn.editing .leaf-mark { color: var(--rubric); opacity: 1; transform: translateY(-3px); }
/* A skipped leaf, falling. */
.falling-leaf { position: fixed; z-index: 20; pointer-events: none; color: var(--gilt); opacity: 1; transform-origin: 50% 20%; }

/* The hovered leaf names its question. */
.leaf-btn::after {
  content: attr(data-title);
  position: absolute; bottom: calc(100% + 0.25rem); left: 50%;
  transform: translateX(-50%) scale(0.56);
  transform-origin: bottom center;
  white-space: nowrap; pointer-events: none;
  padding: 0.25rem 0.6rem; border-radius: 2px;
  background: var(--paper-raised); border: 1px solid var(--rule-strong); color: var(--ink);
  font-family: var(--serif); font-style: italic; font-size: 1rem;
  opacity: 0; transition: opacity 0.2s;
}
.leaf-btn:hover::after, .leaf-btn:focus-visible::after { opacity: 1; }
.leaf-mark { width: 0.55rem; height: 0.85rem; color: var(--ink-muted); opacity: 0.35; transition: opacity 0.6s, color 0.6s, transform 0.6s var(--ease-out); }
.leaf-btn.done .leaf-mark { color: var(--gilt); opacity: 0.95; }
.leaf-slot.now .leaf-mark { color: var(--rubric); opacity: 1; transform: translateY(-2px); }
.leaves-label { font-size: 0.85rem; font-style: italic; color: var(--ink-muted); }

/* --- Reveal ------------------------------------------------------------- */

.preview-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem 1.2rem; flex-wrap: wrap;
  margin-bottom: 1.4rem; padding: 0.55rem 0.85rem;
  border: 1px dashed var(--rule-strong); border-radius: 3px;
  font-size: 0.9rem; font-style: italic; color: var(--ink-muted);
}
.preview-bar-links { display: flex; gap: 1rem; flex-wrap: wrap; font-style: normal; }
.preview-bar a {
  font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--rule-strong);
}
.preview-bar a:hover { color: var(--ink); border-bottom-color: var(--gilt); }
.reveal .kicker { margin-bottom: 0.2rem; }
.reveal-school { font-size: 0.82rem; font-family: var(--display); letter-spacing: 0.22em; text-transform: uppercase; color: var(--school-deep, var(--school)); }
.reveal-virtue { font-family: var(--display); font-weight: 500; font-size: clamp(3rem, 9vw, 5.4rem); line-height: 1; color: var(--school-deep, var(--school)); letter-spacing: 0.03em; }
:root[data-theme='night'] .reveal-school,
:root[data-theme='night'] .reveal-virtue { color: var(--school); }
.reveal-question { font-style: italic; font-size: 1.35rem; margin: 0.4rem 0 0.6rem; }
.reveal-meta { font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 1.4rem; }
.reveal-blurb { font-size: 1.15rem; color: var(--ink-soft); margin-bottom: 1.2rem; }
.reveal-quote {
  margin: 0.2rem 0 1.4rem; padding: 0.25rem 0 0.25rem 1.05rem;
  border-left: 2px solid var(--school-deep, var(--school));
  font-style: italic; font-size: 1.08rem; line-height: 1.55; color: var(--ink-soft);
}
:root[data-theme='night'] .reveal-quote { border-left-color: var(--school); }
.reveal-close { font-style: italic; color: var(--ink-muted); margin-bottom: 1.4rem; }
.tied-houses { display: grid; gap: 1.2rem; margin: 1.2rem 0 1.6rem; }
.tied-house { padding-left: 1rem; border-left: 2px solid var(--tied-color, var(--gilt)); }
.tied-house-name { font-family: var(--display); font-size: 0.85rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--tied-color, var(--gilt)); }
.tied-house-q { font-style: italic; font-size: 1.15rem; margin: 0.15rem 0 0.35rem; }
.tied-house p:last-child { color: var(--ink-soft); font-size: 1.05rem; }
.reveal h3 { font-family: var(--display); font-weight: 500; font-size: 0.85rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gilt); margin: 1.8rem 0 0.65rem; display: flex; gap: 0.8rem; align-items: center; }
.reveal h3::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.section-lead { color: var(--ink-soft); margin-bottom: 0.9rem; }
.work-list { display: grid; gap: 0.7rem; margin-bottom: 0.8rem; }
.work-item { font-size: 1.08rem; line-height: 1.5; color: var(--ink-soft); }
.work-item strong { font-weight: 700; color: var(--school-deep, var(--school)); }
:root[data-theme='night'] .work-item strong { color: var(--school); }
.work-drain .work-item strong { color: var(--ink); }
.triad-lines { display: grid; gap: 0.55rem; margin-bottom: 0.9rem; color: var(--ink-soft); }
.path-lines { display: grid; gap: 0.5rem; }
.path-lines .path-wing { color: var(--ink-soft); font-style: italic; }
.path-lines .toward { color: var(--school-deep, var(--school)); font-size: 1.15rem; margin-top: 0.2rem; }
:root[data-theme='night'] .path-lines .toward { color: var(--school); }
details.curious { margin-top: 1.8rem; font-size: 0.95rem; color: var(--ink-muted); }
details.curious summary { cursor: pointer; font-style: italic; }
.curious-body { margin-top: 0.75rem; }
.curious-body.has-diagram { display: grid; grid-template-columns: 1fr auto; gap: 1rem 1.4rem; align-items: center; }
.curious-list {
  display: grid; grid-template-columns: minmax(7.5rem, 10rem) 1fr; gap: 0.35rem 1rem;
  padding: 0.8rem 1rem;
  border-left: 2px solid var(--rule-strong);
  font-size: 0.94rem; line-height: 1.45;
}
.curious-list dt { font-style: italic; color: var(--ink-muted); }
.curious-list dd { color: var(--ink-soft); }
.curious-enneagram { display: grid; justify-items: center; gap: 0.25rem; margin: 0; }
.curious-enneagram figcaption { font-size: 0.82rem; font-style: italic; color: var(--ink-muted); text-align: center; }
.enn-svg { width: 10.5rem; height: 10.5rem; overflow: visible; }
.enn-ring { fill: none; stroke: var(--rule-strong); stroke-width: 1.25; }
.enn-line { stroke: var(--ink-muted); stroke-opacity: 0.24; stroke-width: 0.9; stroke-linecap: round; }
.enn-line.active { stroke: var(--school-deep, var(--school)); stroke-opacity: 0.82; stroke-width: 1.75; }
.enn-line.active.leaning { stroke-opacity: 0.6; stroke-dasharray: 4 3; }
:root[data-theme='night'] .enn-line.active { stroke: var(--school); }
.enn-dot { fill: var(--ink-muted); fill-opacity: 0.45; }
.enn-dot.linked { fill: var(--ink-soft); fill-opacity: 0.72; }
.enn-dot.active { fill: var(--school-deep, var(--school)); fill-opacity: 1; }
:root[data-theme='night'] .enn-dot.active { fill: var(--school); }
.enn-halo { fill: none; stroke: var(--gilt); stroke-width: 1.3; stroke-opacity: 0.85; }
.enn-halo.leaning { stroke-dasharray: 3 2.5; stroke-opacity: 0.7; }
.enn-num {
  font-family: var(--serif); font-size: 13px; fill: var(--ink-muted); fill-opacity: 0.72;
  text-anchor: middle; dominant-baseline: central;
}
.enn-num.linked { fill: var(--ink-soft); fill-opacity: 0.92; }
.enn-num.active { font-size: 15.5px; font-weight: 700; fill: var(--school-deep, var(--school)); fill-opacity: 1; }
:root[data-theme='night'] .enn-num.active { fill: var(--school); }
@media (max-width: 38rem) {
  .curious-body.has-diagram { grid-template-columns: 1fr; }
  .curious-enneagram { justify-self: center; margin-top: 0.4rem; }
}
@media (max-width: 34rem) { .curious-list { grid-template-columns: 1fr; gap: 0.1rem; } .curious-list dt { margin-top: 0.45rem; } }
.reveal-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }

/* --- Haven Departure Arch & Double Doors -------------------------------- */

.haven-arch {
  position: relative;
  width: 100%;
  max-width: 26rem;
  margin: 2.2rem auto 0.6rem;
  aspect-ratio: 420 / 332;
}
.haven-arch-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(32, 22, 14, 0.14));
}
:root[data-theme='night'] .haven-arch-svg {
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.55));
}
.stone-body { fill: url(#stone-grad-day); stroke: #8e7f6b; stroke-width: 1.15; }
:root[data-theme='night'] .stone-body { fill: url(#stone-grad-night); stroke: rgba(196, 181, 155, 0.26); }
.stone-grain-overlay { fill: rgba(58, 44, 30, 0.13); filter: url(#stone-noise); pointer-events: none; }
:root[data-theme='night'] .stone-grain-overlay { fill: rgba(235, 220, 195, 0.10); }
.stone-bevel-hi { fill: none; stroke: rgba(255, 251, 242, 0.7); stroke-width: 1.1; }
:root[data-theme='night'] .stone-bevel-hi { stroke: rgba(242, 228, 200, 0.16); }
.stone-soffit { fill: none; stroke: rgba(45, 33, 22, 0.38); stroke-width: 3.2; }
:root[data-theme='night'] .stone-soffit { stroke: rgba(0, 0, 0, 0.65); }
.stone-joint { stroke: rgba(74, 59, 44, 0.26); stroke-width: 0.85; }
.stone-joint-hi { stroke: rgba(255, 250, 240, 0.42); stroke-width: 0.7; }
:root[data-theme='night'] .stone-joint { stroke: rgba(0, 0, 0, 0.48); }
:root[data-theme='night'] .stone-joint-hi { stroke: rgba(235, 222, 198, 0.08); }
.stone-sill { fill: url(#sill-grad-day); stroke: #8e7f6b; stroke-width: 1; }
:root[data-theme='night'] .stone-sill { fill: url(#sill-grad-night); stroke: rgba(196, 181, 155, 0.24); }
.etch-script, .etch-script-hi {
  font-family: 'Charm', 'Apple Chancery', 'Snell Roundhand', Georgia, cursive;
  font-size: 14px;
  letter-spacing: 0.015em;
  text-anchor: middle;
  dominant-baseline: central;
}
.etch-script { fill: #4e4033; fill-opacity: 0.92; }
.etch-script-hi { fill: rgba(255, 252, 244, 0.78); }
:root[data-theme='night'] .etch-script { fill: #d4c4a8; fill-opacity: 0.86; }
:root[data-theme='night'] .etch-script-hi { fill: rgba(0, 0, 0, 0.82); }

.haven-doors {
  position: absolute;
  left: 22.4%;
  right: 22.4%;
  top: 29.5%;
  bottom: 3.6%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border-radius: 50% 50% 2px 2px / 52% 52% 2px 2px;
  overflow: hidden;
  perspective: 820px;
  background: linear-gradient(to bottom, #fff7e0 0%, #ead3a6 55%, #cfb07a 100%);
  box-shadow: inset 0 6px 16px rgba(24, 16, 10, 0.36);
}
:root[data-theme='night'] .haven-doors {
  background: linear-gradient(to bottom, #6e542e 0%, #44321a 55%, #1d150c 100%);
  box-shadow: inset 0 8px 20px rgba(0, 0, 0, 0.7);
}
.haven-doors.single-door { grid-template-columns: 1fr; }

.door-leaf {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0.75rem 2.3rem;
  border: none;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--display);
  font-size: clamp(0.62rem, 1.8vw, 0.72rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.42;
  text-align: center;
  color: #f4ead6;
  text-shadow: 0 1px 2px rgba(20, 12, 6, 0.65);
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 240, 210, 0.04) 0px,
      rgba(255, 240, 210, 0.04) 1px,
      transparent 1px,
      transparent 19px,
      rgba(20, 11, 5, 0.12) 19px,
      rgba(20, 11, 5, 0.12) 20px
    ),
    linear-gradient(180deg, #5e4330 0%, #493223 58%, #3c281b 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 200, 0.12),
    inset 0 10px 18px rgba(18, 10, 4, 0.32);
  backface-visibility: hidden;
  transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1), filter 0.3s ease, box-shadow 0.45s ease;
}
.door-leaf.door-rubric {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 240, 210, 0.04) 0px,
      rgba(255, 240, 210, 0.04) 1px,
      transparent 1px,
      transparent 19px,
      rgba(20, 8, 4, 0.15) 19px,
      rgba(20, 8, 4, 0.15) 20px
    ),
    linear-gradient(180deg, #753425 0%, #5c2519 58%, #4a1d13 100%);
}
:root[data-theme='night'] .door-leaf {
  color: #ede0c6;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 238, 206, 0.03) 0px,
      rgba(255, 238, 206, 0.03) 1px,
      transparent 1px,
      transparent 19px,
      rgba(0, 0, 0, 0.24) 19px,
      rgba(0, 0, 0, 0.24) 20px
    ),
    linear-gradient(180deg, #3e2d20 0%, #2d2016 58%, #221710 100%);
}
:root[data-theme='night'] .door-leaf.door-rubric {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 238, 206, 0.03) 0px,
      rgba(255, 238, 206, 0.03) 1px,
      transparent 1px,
      transparent 19px,
      rgba(0, 0, 0, 0.28) 19px,
      rgba(0, 0, 0, 0.28) 20px
    ),
    linear-gradient(180deg, #622a1e 0%, #4a1e15 58%, #39160f 100%);
}
.door-leaf::before {
  content: '';
  position: absolute;
  inset: 14px 10px 10px;
  border: 1px solid rgba(236, 212, 168, 0.14);
  border-radius: 2px;
  pointer-events: none;
}
.door-left { transform-origin: left center; }
.door-right { transform-origin: right center; }
.door-left::before { border-top-left-radius: 96px; }
.door-right::before { border-top-right-radius: 96px; }
.door-leaf::after {
  content: '';
  position: absolute;
  top: 71%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(212, 178, 114, 0.8);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  transition: border-color 0.3s ease, transform 0.35s ease;
  pointer-events: none;
}
.door-left::after { right: 11px; }
.door-right::after { left: 11px; }
.haven-doors.single-door .door-leaf { transform-origin: left center; }
.haven-doors.single-door .door-leaf::before { border-radius: 96px 96px 2px 2px; }
.haven-doors.single-door .door-leaf::after { right: 18px; left: auto; }

.door-left:hover, .door-left:focus-visible {
  transform: rotateY(22deg);
  filter: brightness(1.09);
  box-shadow: 14px 0 24px rgba(20, 12, 5, 0.45), inset 0 0 0 1px rgba(255, 236, 200, 0.22);
  outline: none;
}
.door-right:hover, .door-right:focus-visible {
  transform: rotateY(-22deg);
  filter: brightness(1.11);
  box-shadow: -14px 0 24px rgba(20, 12, 5, 0.45), inset 0 0 0 1px rgba(255, 236, 200, 0.22);
  outline: none;
}
.door-leaf:hover::after, .door-leaf:focus-visible::after { border-color: #f0d89c; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .crest.crest-dual .crest-solid-a, .crest.crest-dual .crest-solid-b { opacity: 0.65; }
  .door-left:hover, .door-left:focus-visible, .door-right:hover, .door-right:focus-visible { transform: none; }
}
