:root {
  /* Palette from hessamzahedi.com (Raft theme). Lobby = the site's light look.
     Modules override these on entry (Camus uses the dark inverse section). */
  --bg: #ebe8e6; /* warm greige */
  --bg-2: #f4f2f0; /* lighter panel */
  --ink: #1d1f25; /* near-black */
  --muted: #6f675e; /* warm gray */
  --accent: #c26148; /* terracotta */
  --accent-2: #ac5039; /* deeper terracotta */
  --line: rgba(29, 31, 37, 0.13);
  --card: rgba(255, 255, 255, 0.6); /* frosted white panels */

  --display: "Gloock", Georgia, "Times New Roman", serif;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Readex Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Dark mode (viewer-chosen, persisted). Soft off-white ink — not pure white —
   to keep long passages easy on the eyes. Module themes still override these
   on entry via inline styles; this governs the lobby and global chrome. */
:root[data-theme="dark"] {
  --bg: #16161a; /* warm-neutral charcoal */
  --bg-2: #202026;
  --ink: #ece7df; /* soft off-white, gentle on the eyes */
  --muted: #9c948a;
  --accent: #d6795c; /* terracotta, lifted for dark backgrounds */
  --accent-2: #c26148;
  --line: rgba(236, 231, 223, 0.13);
  --card: rgba(255, 255, 255, 0.05);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  position: relative;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  transition: background 1.1s ease, color 1.1s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Account bar ---------- */
.topbar {
  position: fixed;
  top: 1.15rem;
  left: 1.25rem;
  right: 8rem; /* leave room for the theme + sound toggles */
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.9rem;
  font-size: 0.85rem;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar[hidden] { display: none; }
.account-status { display: flex; align-items: center; gap: 0.55rem; }
.acct-name, .acct-guest { color: var(--ink); font-weight: 600; }
.acct-guest { letter-spacing: 0.04em; }
.acct-count, .acct-hint { color: var(--muted); }
.account-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.acct-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.32rem 0.82rem;
  font: inherit;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.2s ease;
}
.acct-btn:hover { filter: brightness(1.08); }
.acct-btn.ghost { background: none; border: 1px solid var(--line); color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%) translateY(1rem);
  background: var(--bg-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 1.2rem;
  font-size: 0.9rem;
  max-width: 90vw;
  z-index: 200;
  opacity: 0;
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Light / dark toggle ---------- */
/* Pill switches: a sliding knob with a morphing icon (recreated natively). */
.switch {
  position: fixed;
  top: 1.25rem;
  z-index: 50;
  width: 3.1rem;
  height: 1.7rem;
  padding: 0;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: background-color 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55), border-color 0.4s ease;
}
.switch:hover { border-color: var(--accent); }
.switch[hidden] { display: none; }
.switch-knob {
  position: absolute;
  top: 50%;
  left: 0.18rem;
  transform: translateY(-50%);
  width: 1.2rem;
  height: 1.2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: left 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55),
    background-color 0.5s ease, color 0.5s ease;
}
.sw-ico {
  grid-area: 1 / 1;
  display: block;
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.4s ease;
}

/* Theme switch — day (sun, left) ↔ night (moon, right). */
.theme-toggle { right: 1.25rem; border-color: #e8d5b7; background: #fef3c7; }
.theme-toggle .switch-knob { background: #ff9500; color: #fff; }
.theme-toggle .sw-moon { transform: rotate(-90deg) scale(0.5); opacity: 0; }
:root[data-theme="dark"] .theme-toggle { border-color: #2d2a4e; background: #1a1838; }
:root[data-theme="dark"] .theme-toggle .switch-knob {
  left: calc(100% - 1.38rem);
  background: #e8e6f0;
  color: #1a1838;
}
:root[data-theme="dark"] .theme-toggle .sw-sun { transform: rotate(90deg) scale(0.5); opacity: 0; }
:root[data-theme="dark"] .theme-toggle .sw-moon { transform: rotate(0) scale(1); opacity: 1; }

/* Sound switch — on (waves, right, accent) ↔ off (muted, left, grey). */
.sound-toggle {
  right: 4.6rem;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 16%, var(--card));
}
.sound-toggle .switch-knob {
  left: calc(100% - 1.38rem);
  background: var(--accent);
  color: #fff;
}
.sound-toggle .sw-soundoff { transform: rotate(-90deg) scale(0.5); opacity: 0; }
.sound-toggle.muted { border-color: var(--line); background: var(--card); }
.sound-toggle.muted .switch-knob { left: 0.18rem; background: var(--muted); color: var(--bg); }
.sound-toggle.muted .sw-soundon { transform: rotate(90deg) scale(0.5); opacity: 0; }
.sound-toggle.muted .sw-soundoff { transform: rotate(0) scale(1); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .switch, .switch-knob, .sw-ico { transition: none; }
}

/* Soft terracotta gradient shape — the site's "AI gradient" graphic motif.
   Recolors with the active theme since it uses the accent variables. */
body::before {
  content: "";
  position: fixed;
  top: -18vmax;
  right: -12vmax;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    color-mix(in srgb, var(--accent) 55%, transparent),
    color-mix(in srgb, var(--accent-2) 22%, transparent) 45%,
    transparent 70%
  );
  filter: blur(40px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
  transition: opacity 1.1s ease;
}
body::after {
  content: "";
  position: fixed;
  bottom: -22vmax;
  left: -16vmax;
  width: 48vmax;
  height: 48vmax;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    color-mix(in srgb, var(--accent-2) 38%, transparent),
    transparent 68%
  );
  filter: blur(48px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  transition: opacity 1.1s ease;
}

.screen { display: none; position: relative; z-index: 1; min-height: 100vh; padding: 7vh 6vw; }
.screen.is-active { display: block; animation: fade 0.8s ease both; }

/* Faint, character-specific chamber backdrop. Sits behind the chamber's text
   (z-index: -1 within the screen's stacking context) and above the page bg.
   --scene is set per character in applyModuleTheme(); unset elsewhere. */
#module::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--scene, transparent);
  opacity: 0.9;
  pointer-events: none;
  animation: fade 1.4s ease both;
}
@media (prefers-reduced-motion: reduce) {
  #module::before { animation: none; }
}

/* A large portrait of the character bled into the right edge of the chamber.
   Duotone-tinted to the accent (background-blend-mode: luminosity) and masked
   so it dissolves toward the text, so it reads as presence rather than a photo.
   --portrait / --portrait-pos are set per character in applyModuleTheme(). */
#module::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: min(46vmax, 78vw);
  z-index: -1;
  background-color: var(--accent);
  background-image: var(--portrait, none);
  background-size: cover;
  background-position: var(--portrait-pos, 50% 18%);
  background-repeat: no-repeat;
  background-blend-mode: luminosity;
  opacity: 0.13;
  -webkit-mask-image: linear-gradient(to left, #000 0%, #000 30%, transparent 90%);
  mask-image: linear-gradient(to left, #000 0%, #000 30%, transparent 90%);
  pointer-events: none;
  animation: fade 1.8s ease both;
}
/* Lighter backgrounds need a touch more presence to read. */
:root:not([data-theme="dark"]) #module::after { opacity: 0.16; }
@media (prefers-reduced-motion: reduce) {
  #module::after { animation: none; }
}

@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Landing (front door) ---------- */
/* The landing is a dark hero over an animated shader, regardless of theme, so
   its text is fixed light for contrast. */
#landing {
  position: relative;
  overflow: hidden;
  color: #f3eee7;
  --ink: #f3eee7;
  --muted: rgba(243, 238, 231, 0.72);
  --line: rgba(243, 238, 231, 0.28);
  --card: rgba(255, 255, 255, 0.08);
}
.landing-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  background: #05060a; /* shown if WebGL2 is unavailable */
}
/* Scrim over the shader so the words stay readable. */
#landing::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120% 85% at 50% 32%, rgba(5, 6, 10, 0.2), rgba(5, 6, 10, 0.62));
}
.landing-wrap {
  position: relative;
  z-index: 1;
  max-width: 44rem;
  margin: 0 auto;
  padding: 4vh 0 2vh;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* "What's new" announcement pill on the landing hero. */
.announcement {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: min(92vw, 30rem);
  margin: 0 0 1.8rem;
  padding: 0.28rem 0.85rem 0.28rem 0.32rem;
  border-radius: 999px;
  border: 1px solid rgba(243, 238, 231, 0.18);
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #f3eee7;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.announcement:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(243, 238, 231, 0.32);
  transform: translateY(-1px);
}
.announcement[hidden] { display: none; }
.announcement-tag {
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--accent) 85%, transparent);
  color: #fff;
  border-radius: 999px;
  padding: 0.2rem 0.62rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.announcement-title { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.announcement-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.announcement-arrow { flex: 0 0 auto; opacity: 0.7; }

.updates-list { list-style: none; padding: 0; margin: 0 0 1.4rem; text-align: left; max-height: 50vh; overflow-y: auto; }
.updates-list li { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.updates-list li:last-child { border-bottom: none; }
.updates-list .u-date { display: block; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 0.2rem; }
.updates-list .u-text { color: var(--ink); }

.landing-logo { width: clamp(72px, 12vw, 104px); height: auto; margin: 0 0 1.2rem; }
.landing-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 8vw, 4rem);
  letter-spacing: -0.02em;
  margin: 0;
}
.landing-kicker {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0.5rem 0 2rem;
}
.landing-lead {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 3.2vw, 1.5rem);
  line-height: 1.7;
  margin: 0 0 1.4rem;
  max-width: 36rem;
}
.landing-contract {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
  max-width: 34rem;
  margin: 0 0 2.2rem;
}
.landing-contract em { color: var(--accent); font-style: italic; }
.landing-voices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 0 2.4rem;
}
.landing-voice {
  font-family: var(--serif);
  font-size: 0.92rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.38rem 0.9rem;
  background: var(--card);
}
/* Liquid-glass button (recreated natively): a glass rim of layered shadows + an
   SVG displacement backdrop-filter that liquifies the aurora behind it. Where
   url() backdrop-filters aren't supported it degrades to a clean glass button. */
.landing-enter {
  position: relative;
  isolation: isolate;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #f6f1ea;
  border: none;
  cursor: pointer;
  padding: 1.05rem 2.8rem;
  border-radius: 999px;
  /* A hint of the terracotta the button used to be, under the glass. */
  background: color-mix(in srgb, var(--accent) 22%, rgba(255, 255, 255, 0.05));
  -webkit-backdrop-filter: url("#container-glass");
  backdrop-filter: url("#container-glass");
  box-shadow:
    0 0 8px rgba(0, 0, 0, 0.03),
    0 2px 6px rgba(0, 0, 0, 0.08),
    inset 3px 3px 0.5px -3.5px rgba(255, 255, 255, 0.09),
    inset -3px -3px 0.5px -3.5px rgba(255, 255, 255, 0.85),
    inset 1px 1px 1px -0.5px rgba(255, 255, 255, 0.6),
    inset -1px -1px 1px -0.5px rgba(255, 255, 255, 0.6),
    inset 0 0 6px 6px rgba(255, 255, 255, 0.12),
    inset 0 0 2px 2px rgba(255, 255, 255, 0.06),
    0 0 12px rgba(0, 0, 0, 0.15),
    0 0 22px -4px color-mix(in srgb, var(--accent) 50%, transparent);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.landing-enter:hover {
  transform: scale(1.05);
  background: color-mix(in srgb, var(--accent) 34%, rgba(255, 255, 255, 0.06));
}
.landing-enter:active { transform: scale(0.98); }
.landing-enter:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  .landing-enter { transition: none; }
}
.landing-readlink { margin: 1.1rem 0 0; }
.landing-foot { margin-top: 4.5rem; color: var(--muted); font-size: 0.9rem; }
.landing-foot .patreon-foot { margin-bottom: 1.4rem; }
.landing-foot a { color: var(--accent); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}

/* ---------- Disclaimer gate ---------- */
.disclaimer-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 6vw;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: fade 0.5s ease both;
}
.disclaimer-overlay[hidden] { display: none; }
.disclaimer-box {
  max-width: 40rem;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2.6rem 2.4rem 2.4rem;
  box-shadow: 0 34px 90px -42px rgba(0, 0, 0, 0.6);
}
.disclaimer-box h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.9rem, 5vw, 2.4rem);
  letter-spacing: -0.01em;
  margin: 0 0 1.3rem;
}
.disclaimer-box p {
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.78;
  margin: 0 0 1.05rem;
}
.disclaimer-box .emphasis {
  font-family: var(--serif);
  font-size: 1.12rem;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding-left: 1.2rem;
}
.disclaimer-box .offer { margin-top: 1rem; }
.disclaimer-box .note { color: var(--muted); }

/* Library modal contents */
.library-list { list-style: none; padding: 0; margin: 0 0 0.5rem; }
.library-list[hidden] { display: none; }
.library-list li { margin: 0.5rem 0; font-family: var(--serif); font-size: 1.12rem; }
.library-list a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.library-list a:hover { border-bottom-color: var(--accent); }
.lib-src { color: var(--muted); font-size: 0.78rem; font-family: var(--sans); margin-left: 0.45rem; }
.library-browse-label { color: var(--muted); font-size: 0.85rem; margin: 1.2rem 0 0.6rem; }
.library-browse { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.4rem; }

/* Suggest-a-voice modal + card */
#suggest-name, #suggest-reason { width: 100%; margin: 0.4rem 0 0.8rem; }
.suggest-card { border-style: dashed; }
.suggest-card h3 { color: var(--accent); }

.disclaimer-link {
  display: inline-block;
  margin-top: 1.4rem;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease;
}
.disclaimer-link:hover { opacity: 0.7; }

/* ---------- Brand masthead ---------- */
.lobby-top {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  flex-wrap: wrap;
  margin-bottom: 3.5rem;
}
.brand {
  /* Dark plaque so the cream wordmark stays legible in light mode too. */
  background: #06090f;
  border: 1px solid color-mix(in srgb, #c8993e 30%, transparent);
  border-radius: 14px;
  padding: 0.7rem 0.75rem;
  width: 130px;
  flex: 0 0 auto;
  box-shadow: 0 18px 44px -34px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  font: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.brand:hover {
  border-color: color-mix(in srgb, #c8993e 70%, transparent);
  transform: translateY(-2px);
}
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.brand-logo { display: block; width: 100%; height: auto; }

/* ---------- Lobby ---------- */
.lobby-head { max-width: 42rem; margin: 0; flex: 1 1 18rem; }
.lobby-head h1 {
  font-family: var(--display);
  font-size: clamp(2.8rem, 7vw, 4.6rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 0 0 0.7rem;
}
.sub { color: var(--muted); font-size: 1.08rem; max-width: 34rem; margin: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1.4rem;
}

.card {
  position: relative;
  text-align: left;
  background: var(--card);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.7rem 1.6rem 1.9rem;
  color: inherit;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}
.card { transform-origin: center; will-change: transform; }
.card:hover:not(.locked) {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 22px 48px -28px var(--accent);
}
/* A soft sheen that follows the cursor while the card is tilted. */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.16),
    transparent 45%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 2;
}
.card:hover:not(.locked)::after { opacity: 1; }
.card.locked { opacity: 0.45; cursor: not-allowed; }
.card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
}
.card .card-tag { color: var(--muted); font-size: 0.94rem; margin: 0; }
.card .enter-cue {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
}
.card.locked .enter-cue { color: var(--muted); }

/* Portrait bleeds to the card edges, above the title. */
.portrait {
  display: block;
  margin: -1.7rem -1.6rem 1.4rem;
  height: 240px;
  overflow: hidden;
  border-radius: 17px 17px 0 0;
  background: var(--bg);
}
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  display: block;
  filter: grayscale(0.2) sepia(0.18) saturate(1.05) contrast(1.02);
  transition: filter 0.4s ease, transform 0.5s ease;
}
.card:hover:not(.locked) .portrait img {
  filter: grayscale(0) sepia(0.04) saturate(1.1);
  transform: scale(1.04);
}

/* ---------- Encounters: draggable card stack ---------- */
.lobby-encounters { margin: 3.5rem 0 0; }
.encounters-head {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.3rem;
}
.encounters-sub { color: var(--muted); font-size: 0.95rem; margin: 0 0 1.6rem; }
.encounter-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem 3rem;
}
.encounter-group { flex: 1 1 320px; min-width: min(320px, 100%); }
.encounter-group-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 0 0 1rem;
}
.card-stack {
  position: relative;
  width: min(420px, 100%);
  height: 360px;
}
.stack-card {
  position: absolute;
  top: 0;
  left: 0;
  width: min(280px, 78%);
  height: 330px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.8rem;
  padding: 2rem;
  border-radius: 20px;
  border: 1px solid var(--line);
  /* The frosted card tint over a mostly-opaque base — a little of the page still shows through. */
  background: linear-gradient(var(--card), var(--card)), color-mix(in srgb, var(--bg-2) 55%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 28px 60px -34px rgba(0, 0, 0, 0.55);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}
.stack-card h3 { font-family: var(--serif); font-weight: 500; font-size: 1.7rem; margin: 0; }
.stack-card p { color: var(--muted); margin: 0; }
.stack-card .enter-cue {
  margin-top: 1rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
}
.stack-front {
  z-index: 3;
  transform: rotate(-5deg);
  cursor: grab;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.stack-front:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.stack-middle { z-index: 2; transform: rotate(0deg) translateX(26%); }
.stack-back { z-index: 1; transform: rotate(6deg) translateX(40%); }
.stack-card.dragging { transition: none; cursor: grabbing; }

/* Deep Thought card: a rotating conic-gradient border to set it apart.
   Needs @property so the angle can animate; degrades to a static ring without. */
@property --gradient-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@keyframes gradient-rotate {
  to { --gradient-angle: 360deg; }
}
.stack-card.stack-glow {
  border: 2px solid transparent;
  background:
    linear-gradient(
      color-mix(in srgb, var(--bg-2) 92%, var(--accent)),
      color-mix(in srgb, var(--bg-2) 92%, var(--accent))
    ) padding-box,
    conic-gradient(
      from var(--gradient-angle),
      var(--accent) 0%,
      var(--accent-2) 25%,
      color-mix(in srgb, var(--accent) 35%, #ffffff) 50%,
      var(--accent-2) 75%,
      var(--accent) 100%
    ) border-box;
  animation: gradient-rotate 6s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .stack-card.stack-glow { animation: none; }
}

/* ---------- Commonplace Book ---------- */
.reply-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; }
.keep-btn {
  background: none;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 999px;
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.keep-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: var(--accent); }
.keep-btn.kept { color: var(--muted); border-color: var(--line); cursor: default; background: none; }
#closing-gift .keep-btn { margin-top: 1rem; }

.book-box { max-width: 40rem; }
.book-list { max-height: 56vh; overflow-y: auto; margin: 0.5rem 0 1.2rem; text-align: left; }
.book-entry {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  margin: 0 0 0.8rem;
  background: var(--card);
  position: relative;
}
.book-entry .book-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: baseline;
  margin: 0 0 0.5rem;
}
.book-entry .book-who { font-family: var(--display); color: var(--accent); font-size: 1.1rem; }
.book-entry .book-kind { color: var(--muted); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; }
.book-entry .book-text {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.7;
  white-space: pre-wrap;
  margin: 0;
  color: var(--ink);
}
.book-entry .book-date { color: var(--muted); font-size: 0.74rem; margin: 0.6rem 0 0; }
.book-entry .book-remove {
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
}
.book-entry .book-remove:hover { color: var(--accent); }

/* ---------- Lobby footer ---------- */
.lobby-foot {
  max-width: 42rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.lobby-foot p { color: var(--muted); font-size: 0.85rem; margin: 0; letter-spacing: 0.02em; }
.lobby-foot a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.lobby-foot a:hover { border-bottom-color: var(--accent); }

/* ---------- Module ---------- */
.leave {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1.4rem;
  transition: color 0.2s ease;
}
.leave:hover { color: var(--accent); }

/* Character name header — who is speaking. */
.module-head { max-width: 42rem; margin-bottom: 2.6rem; }
.module-name {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 5.5vw, 2.9rem);
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 0 0 0.35rem;
}
.module-tag {
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
}

.scene { max-width: 40rem; min-height: 6rem; margin-bottom: 2.5rem; }
.scene p {
  font-family: var(--serif);
  font-size: 1.32rem;
  line-height: 1.78;
  color: var(--ink);
  margin: 0 0 1.25rem;
}
/* Atmosphere entrance: each line fades in, rises, and settles out of a soft blur. */
.scene p.fx {
  opacity: 0;
  transform: translateY(12px);
  filter: blur(3px);
  transition: opacity 1.15s ease, transform 1.15s cubic-bezier(0.2, 0.7, 0.2, 1),
    filter 1.15s ease, color 0.9s ease;
}
.scene p.fx.in { opacity: 1; transform: none; filter: blur(0); }
/* Earlier lines recede as the next one takes the light. (Placed after .fx.in
   so it wins the opacity at equal specificity.) */
.scene p.fx.dim { color: var(--muted); opacity: 0.5; }
/* The character's spoken invitation — the final line — keeps the light. */
.scene p.voice {
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  padding-left: 1.2rem;
}
/* A soft "about to speak" cue shown in the breath before the invitation. */
.scene-cue { display: flex; gap: 0.4rem; padding: 0.1rem 0 0.7rem; }
.scene-cue span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.3;
  animation: cuePulse 1.4s ease-in-out infinite;
}
.scene-cue span:nth-child(2) { animation-delay: 0.2s; }
.scene-cue span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cuePulse {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  50% { opacity: 0.7; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .scene p.fx { transition: opacity 0.5s ease; transform: none; filter: none; }
  .scene-cue span { animation: none; opacity: 0.45; }
}

.stage { max-width: 42rem; animation: fade 0.8s ease both; }
.stage-head h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}
.howto { color: var(--muted); margin: 0 0 2rem; }

/* ---------- Name step ---------- */
.name-step { max-width: 42rem; animation: fade 0.8s ease both; }
.name-step .silence-input { margin-bottom: 1rem; }

/* ---------- Mode select ---------- */
.mode-select { max-width: 42rem; animation: fade 0.8s ease both; }
.mode-prompt {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
}
.mode-posture {
  max-width: 42rem;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 3.2vw, 1.45rem);
  line-height: 1.78;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding-left: 1.3rem;
  margin: 0 0 2.2rem;
  animation: fade 0.8s ease both;
}
.mode-bar { font-size: 0.85rem; color: var(--muted); margin: 0 0 1.6rem; }
.mode-bar strong { color: var(--ink); font-weight: 600; }
.modebar-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.modebar-link:hover { opacity: 0.7; }

/* ---------- Game menu ---------- */
.game-menu { max-width: 42rem; display: grid; gap: 1rem; animation: fade 0.8s ease both; }
.game-card {
  text-align: left;
  background: var(--card);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.3rem 1.4rem;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.game-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  transform: translateY(-3px);
}
.game-card h3 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; margin: 0 0 0.3rem; }
.game-card p { color: var(--muted); margin: 0; font-size: 0.95rem; }
.back-games { margin: 0 0 1.6rem; }

/* ---------- Silence game ---------- */
.silence { max-width: 42rem; }
.silence-line {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3.5vw, 1.6rem);
  line-height: 1.8;
  color: var(--ink);
  margin: 0 0 2rem;
}
.silence-wait { animation: fade 0.8s ease both; }
.timer { position: relative; width: 120px; height: 120px; margin: 0 0 1.6rem; }
.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: var(--line); stroke-width: 5; }
.timer-arc { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }
.timer-count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 1.9rem;
  color: var(--ink);
}
.silence-input {
  width: 100%;
  background: var(--card);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}
.silence-input::placeholder { color: var(--muted); opacity: 0.7; }
.silence-input:focus { border-color: var(--accent); }
.silence-wait .offer { margin-top: 1rem; }
.silence-reply { animation: fade 0.8s ease both; }
.silence-reply .silence-line { border-left: 3px solid var(--accent); padding-left: 1.4rem; }
.silence-reply .again { margin-top: 0.5rem; }

/* ---------- Agree or Disagree ---------- */
.debate { max-width: 42rem; }
.debate-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1rem; }
.offer.ghost {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.offer.ghost:hover {
  filter: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.debate-reply { animation: fade 0.8s ease both; }
.debate-reply .silence-line { border-left: 3px solid var(--accent); padding-left: 1.4rem; }
.debate-reply .again { margin-top: 0.5rem; }

/* ---------- Two Voices (dialogue) ---------- */
.dialogue-card { border-style: dashed; }
.dlg-setup, .dlg-exchange { max-width: 42rem; animation: fade 0.8s ease both; }
.dlg-pickers { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.dlg-pick {
  flex: 1 1 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dlg-select {
  background: var(--card);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1rem;
  text-transform: none;
  letter-spacing: 0;
  outline: none;
}
.dlg-select:focus { border-color: var(--accent); }
.dlg-step { max-width: 42rem; margin-top: 1.8rem; animation: fade 0.7s ease both; }
.dlg-prompt { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); margin: 0 0 0.9rem; }
.dlg-answer { margin-top: 2rem; animation: fade 0.7s ease both; }
.dlg-speaker {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
  color: var(--accent);
}
.dlg-text {
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.8;
  white-space: pre-wrap;
  border-left: 3px solid var(--accent);
  padding-left: 1.4rem;
  margin: 0;
  color: var(--ink);
}
#dlg-again-wrap { display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* ---------- The Symposium ---------- */
.sym-picks { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.2rem; }
.sym-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--muted);
  background: var(--card);
  transition: border-color 0.2s ease, color 0.2s ease;
  user-select: none;
}
.sym-pick:hover { border-color: var(--accent); }
.sym-pick.checked { color: var(--ink); border-color: var(--accent); }
.sym-pick input { accent-color: var(--accent); margin: 0; }
.sym-pick input:disabled { cursor: not-allowed; }
.sym-question-echo { font-style: italic; color: var(--muted); }
.sym-tension { margin-top: 2.4rem; }
.sym-tension .dlg-speaker { font-size: 1.15rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.sym-tension .dlg-text { border-left-color: var(--accent-2); font-style: italic; }
#sym-after { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 2rem; }

/* ---------- Philosophers' Football ---------- */
.fb-setup, .fb-match { max-width: 44rem; animation: fade 0.8s ease both; }
.fb-teamnames { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.fb-nameinput {
  flex: 1 1 10rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  color: var(--ink);
  font: inherit;
  outline: none;
}
.fb-nameinput:focus { border-color: var(--accent); }
.fb-vs { color: var(--muted); font-family: var(--serif); font-style: italic; }
.fb-badge-a { color: var(--accent); }
.fb-badge-b { color: var(--accent-2); }

.fb-roster { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.8rem 0 1.4rem; }
.fb-player {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.fb-player[data-team="A"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.fb-player[data-team="B"] {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 18%, transparent);
}
.fb-player .fb-tag { font-weight: 700; margin-left: 0.35rem; }
.fb-player[data-team="A"] .fb-tag { color: var(--accent); }
.fb-player[data-team="B"] .fb-tag { color: var(--accent-2); }
.fb-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; }

.fb-scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
  margin-bottom: 1.4rem;
}
.fb-side { display: flex; align-items: center; gap: 0.5rem; }
.fb-side b { font-size: 1.6rem; color: var(--accent); }
.fb-clock { color: var(--muted); font-size: 0.95rem; font-family: var(--sans); }

.fb-ticker { display: flex; flex-direction: column; gap: 0.7rem; }
.fb-line {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.6;
  color: var(--ink);
  opacity: 0;
  animation: lineIn 0.6s ease forwards;
  padding-left: 3.2rem;
  position: relative;
}
.fb-line .fb-min {
  position: absolute;
  left: 0;
  top: 0.15rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8rem;
}
.fb-line.fb-goal { color: var(--accent); font-weight: 500; }
.fb-line.fb-event { color: var(--muted); font-style: italic; }
.fb-after { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 2rem; }

/* ---------- The Last Question ---------- */
.last-question {
  display: block;
  margin: 3.5rem 0 1rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.last-question:hover { color: var(--accent); border-color: var(--accent); }

/* "Think deeper" — the gate to level-2 games. Sits above The Last Question. */
.think-deeper {
  margin: 2.5rem 0 0;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.think-deeper:hover { color: var(--accent); border-color: var(--accent); }
.think-deeper[hidden] { display: none; }

/* Level 2 · The Mask and the Face */
.mask { max-width: 42rem; animation: fade 0.8s ease both; }
.mask[hidden] { display: none; }
#mask-intro { margin-bottom: 1.6rem; }
.mask-options { display: flex; flex-direction: column; gap: 1rem; }
.mask-options[hidden] { display: none; }
.mask-option {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  color: var(--ink);
  font: inherit;
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.55;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
}
.mask-option:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--accent) 7%, var(--card));
}
.mask-reply { margin-top: 1.8rem; animation: fade 0.7s ease both; }
.mask-reply[hidden] { display: none; }
.mask-reply .silence-line { border-left: 3px solid var(--accent); padding-left: 1.4rem; }

/* Level 2 · The Inventory */
.inventory { max-width: 42rem; animation: fade 0.8s ease both; }
.inventory[hidden] { display: none; }
#inv-prompt { margin-bottom: 1.6rem; }
.inv-form { display: flex; flex-direction: column; gap: 1.1rem; }
.inv-form[hidden] { display: none; }
.inv-field { display: block; }
.inv-field span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}
.inv-field .silence-input { margin: 0; }
.inv-reply { margin-top: 1.8rem; animation: fade 0.7s ease both; }
.inv-reply[hidden] { display: none; }
.inv-reply .silence-line { border-left: 3px solid var(--accent); padding-left: 1.4rem; }

/* ---------- Level 2 · The Descent ---------- */
.descent { max-width: 42rem; animation: fade 0.8s ease both; }
.descent[hidden] { display: none; }
.descent-thread { margin: 0 0 1.6rem; }
.descent-thread .descent-pair { margin: 0 0 1.1rem; opacity: 0.55; }
.descent-thread .descent-q {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink);
  margin: 0 0 0.3rem;
}
.descent-thread .descent-a {
  color: var(--muted);
  font-size: 0.98rem;
  margin: 0 0 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--line);
}
#descent-question { margin-bottom: 1rem; }
.descent-end { animation: fade 0.7s ease both; }
.descent-end[hidden] { display: none; }
#descent-closing { border-left: 3px solid var(--accent); padding-left: 1.4rem; }

/* ---------- The Oracle (fāl-e Hāfez) ---------- */
.oracle-result { max-width: 42rem; animation: fade 0.8s ease both; }
.oracle-result[hidden] { display: none; }
.oracle-q { color: var(--muted); font-style: italic; margin: 0 0 1.4rem; }
.oracle-omen {
  font-family: var(--serif);
  font-size: 1.45rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding-left: 1.5rem;
  margin: 0 0 1.6rem;
}
.oracle-reading { color: var(--muted); font-size: 1.02rem; line-height: 1.7; margin: 0 0 1.8rem; }

/* ---------- The Mirror ---------- */
.mirror-body { max-width: 42rem; animation: fade 0.8s ease both; }
.mirror-portrait p {
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.75;
  color: var(--ink);
  margin: 0 0 1.1rem;
}
.mirror-portrait p:first-child { color: var(--accent); }
.mirror-speak-wrap { margin: 1.4rem 0 0; }
.mirror-speak-text {
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding-left: 1.4rem;
  margin: 1.6rem 0 0;
}
.mirror-speak-text[hidden] { display: none; }

/* ---------- Deep Thought ---------- */
.dt-result { max-width: 42rem; animation: fade 0.8s ease both; }
.dt-result[hidden] { display: none; }
#dt-answer { white-space: pre-wrap; }
.dt-lenses { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.03em; margin: 1rem 0 0; font-style: italic; }
.dt-lenses[hidden] { display: none; }

/* ---------- Level 1 · The Fork ---------- */
.fork { max-width: 42rem; animation: fade 0.8s ease both; }
.fork[hidden] { display: none; }
#fork-intro { margin-bottom: 1.8rem; }
.fork-progress { display: flex; gap: 0.45rem; margin: 0 0 1.6rem; }
.fork-progress .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.25s ease;
}
.fork-progress .dot.done { background: var(--accent); }
.fork-progress .dot.current { background: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.fork-choices {
  display: flex;
  align-items: stretch;
  gap: 1rem;
}
.fork-or { align-self: center; color: var(--muted); font-style: italic; }
.fork-choice {
  flex: 1 1 0;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.6rem 1.2rem;
  color: var(--ink);
  font: inherit;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
}
.fork-choice:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
}
.fork-end { animation: fade 0.7s ease both; }
.fork-end[hidden] { display: none; }
.fork-label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.8rem;
}
#fork-portrait { border-left: 3px solid var(--accent); padding-left: 1.4rem; }
@media (max-width: 30rem) {
  .fork-choices { flex-direction: column; }
}

/* Patreon support badge — holographic shimmer + 3D tilt, recreated natively. */
.patreon-foot { display: flex; justify-content: center; margin: 0 0 1.6rem; }
.patreon-badge { display: inline-block; width: 220px; max-width: 80vw; text-decoration: none; }
.patreon-badge-inner {
  transform: perspective(600px) rotateX(0) rotateY(0) scale(1);
  transform-origin: center center;
  transition: transform 200ms ease-out;
  will-change: transform;
  border-radius: 10px;
}
.patreon-badge svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.18));
}
.patreon-eyebrow {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  fill: #7a3b2e;
}
.patreon-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  fill: #5a2a20;
}
.patreon-shimmer { mix-blend-mode: overlay; }
.patreon-shimmer .po {
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform;
}
.patreon-shimmer .po1 { animation: patShim1 5s infinite; }
.patreon-shimmer .po2 { animation: patShim2 5s infinite; }
.patreon-shimmer .po3 { animation: patShim3 5s infinite; }
.patreon-shimmer .po4 { animation: patShim4 5s infinite; }
.patreon-shimmer .po5 { animation: patShim5 5s infinite; }
.patreon-shimmer .po6 { animation: patShim6 5s infinite; }
.patreon-shimmer .po7 { animation: patShim7 5s infinite; }
.patreon-shimmer .po8 { animation: patShim8 5s infinite; }
@keyframes patShim1 { 0% { transform: rotate(0deg); } 50% { transform: rotate(10deg); } 100% { transform: rotate(0deg); } }
@keyframes patShim2 { 0% { transform: rotate(10deg); } 50% { transform: rotate(20deg); } 100% { transform: rotate(10deg); } }
@keyframes patShim3 { 0% { transform: rotate(20deg); } 50% { transform: rotate(30deg); } 100% { transform: rotate(20deg); } }
@keyframes patShim4 { 0% { transform: rotate(30deg); } 50% { transform: rotate(40deg); } 100% { transform: rotate(30deg); } }
@keyframes patShim5 { 0% { transform: rotate(40deg); } 50% { transform: rotate(50deg); } 100% { transform: rotate(40deg); } }
@keyframes patShim6 { 0% { transform: rotate(50deg); } 50% { transform: rotate(60deg); } 100% { transform: rotate(50deg); } }
@keyframes patShim7 { 0% { transform: rotate(60deg); } 50% { transform: rotate(70deg); } 100% { transform: rotate(60deg); } }
@keyframes patShim8 { 0% { transform: rotate(70deg); } 50% { transform: rotate(80deg); } 100% { transform: rotate(70deg); } }
@media (prefers-reduced-motion: reduce) {
  .patreon-shimmer .po { animation: none; }
  .patreon-badge-inner { transition: none; }
}
.closing { max-width: 42rem; animation: fade 0.8s ease both; }
.closing-step { animation: fade 0.7s ease both; }
#closing-farewell { border-left: 3px solid var(--accent); padding-left: 1.4rem; }
.closing-gift { margin-bottom: 1.6rem; animation: fade 0.8s ease both; }
.closing-gift[hidden] { display: none; }
.gift-label {
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}
#closing-gift-text {
  border-left: 3px solid var(--accent-2);
  padding-left: 1.4rem;
  margin: 0;
}
.skip-atmosphere {
  display: inline-block;
  margin: 0.2rem 0 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4rem 1.1rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.skip-atmosphere:hover { color: var(--accent); border-color: var(--accent); }
.skip-atmosphere[hidden] { display: none; }

.scene p.remembrance {
  color: var(--accent);
  font-style: italic;
  animation: fade 1.1s ease both;
}

/* ---------- The Reframe ---------- */
.reframe { max-width: 42rem; }
.reframe-step { animation: fade 0.7s ease both; }
#reframe-text,
#reframe-reply { border-left: 3px solid var(--accent); padding-left: 1.4rem; }
.reframe-step .again { margin-top: 0.5rem; }

/* ---------- Word form ---------- */
.word-form { margin-bottom: 1rem; }
#word-input {
  width: 100%;
  background: var(--card);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.95rem 1.1rem;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#word-input::placeholder { color: var(--muted); opacity: 0.7; }
#word-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.9rem 0;
  min-height: 2rem;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.chip:hover { opacity: 0.6; }
.chip::after { content: " ×"; color: var(--accent); }
.counter { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

.offer, .again {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1.7rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease, filter 0.2s ease;
}
.offer:hover:not(:disabled), .again:hover { filter: brightness(1.07); transform: translateY(-1px); }
.offer:disabled { opacity: 0.4; cursor: not-allowed; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.9rem 0 0; min-height: 1.2rem; }
.hint.error { color: var(--accent-2); }

/* ---------- Answer ---------- */
.answer { margin-top: 2.5rem; animation: fade 0.7s ease both; }
.answer-text {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.85;
  white-space: pre-wrap;
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0 0.4rem 1.5rem;
  color: var(--ink);
}
.source { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 1.5rem 0; }
.again { background: none; border: 1px solid var(--line); color: var(--ink); }
.again:hover { border-color: var(--accent); filter: none; }

.thinking { color: var(--muted); font-style: italic; }
