/* ─────────────────────────────────────────────────────────────
   FLATLAND — a walkable novel
   paper, ink, one forbidden colour
   ───────────────────────────────────────────────────────────── */

:root {
  --paper: #e9e3d5;
  --paper-light: #f2ecdf;
  --paper-deep: #ded5c3;
  --ink: #191714;
  --ink-soft: #4e483d;
  --muted: #8d8372;
  --line: rgba(25, 23, 20, 0.22);
  --line-strong: rgba(25, 23, 20, 0.52);
  --accent: #b4402a;
  --accent-bright: #cf5b3e;
  --accent-deep: #7b2819;
  --cream: #f4efe4;
  --night: #111310;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: "SFMono-Regular", "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-slow: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body { touch-action: none; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

kbd {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
  letter-spacing: .04em;
  padding: 4px 5px 3px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 2px;
  background: rgba(255, 255, 255, .18);
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--paper);
}

#stage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.paper-grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .17;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 86% 76% at 50% 48%, transparent 42%, rgba(32, 27, 20, .13) 100%),
    linear-gradient(to bottom, rgba(48, 42, 31, .07), transparent 13%, transparent 86%, rgba(48, 42, 31, .1));
}

/* ───────────────────────────── cover ───────────────────────────── */

#cover {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(20px, 3.2vw, 46px) clamp(22px, 4.4vw, 72px) clamp(18px, 2.4vw, 34px);
  background:
    radial-gradient(ellipse 70% 60% at 72% 40%, rgba(255, 252, 243, .55), transparent 70%),
    linear-gradient(112deg, rgba(255, 255, 255, .1), transparent 45%),
    var(--paper);
  transition: opacity .9s var(--ease), visibility .9s;
}

#cover::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image:
    linear-gradient(to right, transparent calc(100% - 1px), rgba(25, 23, 20, .1) 1px),
    linear-gradient(to bottom, transparent calc(100% - 1px), rgba(25, 23, 20, .06) 1px);
  background-size: 80px 80px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

#cover::after {
  content: "2";
  position: absolute;
  right: -2vw;
  bottom: -16vh;
  z-index: -1;
  font-family: var(--serif);
  font-size: min(68vw, 900px);
  line-height: .8;
  color: transparent;
  -webkit-text-stroke: 1px rgba(25, 23, 20, .055);
  pointer-events: none;
  user-select: none;
}

body.is-playing #cover {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cover-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .19em;
  color: var(--ink-soft);
  opacity: 0;
  animation: fade-in 1.2s var(--ease) .15s forwards;
}

.cover-meta-mid { color: var(--muted); }

.cover-main {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, .92fr);
  gap: clamp(30px, 5vw, 90px);
  align-items: center;
  min-height: 0;
  padding: clamp(26px, 4vh, 60px) 0;
}

.cover-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
  padding-left: min(2vw, 28px);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 clamp(12px, 2.2vh, 26px);
  font-family: var(--mono);
  font-size: clamp(9px, .74vw, 11px);
  letter-spacing: .24em;
  color: var(--ink-soft);
  opacity: 0;
  animation: rise-in 1s var(--ease) .3s forwards;
}

.eyebrow-line {
  display: inline-block;
  width: 42px;
  height: 1px;
  background: var(--accent);
}

.title-cn {
  display: flex;
  align-items: flex-start;
  gap: .015em;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(94px, 14.2vw, 218px);
  font-weight: 400;
  line-height: .82;
  letter-spacing: -.07em;
  white-space: nowrap;
  color: var(--ink);
}

.title-cn span {
  display: inline-block;
  opacity: 0;
  transform: translateY(.22em);
  animation: title-in 1.35s var(--ease-slow) forwards;
}

.title-cn span:nth-child(1) { animation-delay: .38s; }
.title-cn span:nth-child(2) { animation-delay: .48s; transform: translateY(.13em); }
.title-cn span:nth-child(3) { animation-delay: .58s; }

.title-en {
  display: flex;
  gap: .58em;
  margin-top: clamp(24px, 2.8vh, 34px);
  padding-left: .2em;
  font-family: var(--mono);
  font-size: clamp(9px, .8vw, 12px);
  letter-spacing: .06em;
  color: var(--ink-soft);
}

.title-en span {
  opacity: 0;
  animation: letter-in .8s var(--ease) forwards;
}
.title-en span:nth-child(1) { animation-delay: .72s; }
.title-en span:nth-child(2) { animation-delay: .77s; }
.title-en span:nth-child(3) { animation-delay: .82s; }
.title-en span:nth-child(4) { animation-delay: .87s; }
.title-en span:nth-child(5) { animation-delay: .92s; }
.title-en span:nth-child(6) { animation-delay: .97s; }
.title-en span:nth-child(7) { animation-delay: 1.02s; }
.title-en span:nth-child(8) { animation-delay: 1.07s; }

.cover-lede {
  max-width: 31em;
  margin: clamp(22px, 3.6vh, 42px) 0 0;
  font-family: var(--serif);
  font-size: clamp(14px, 1.12vw, 18px);
  line-height: 2;
  color: var(--ink-soft);
  letter-spacing: .015em;
  opacity: 0;
  animation: rise-in 1.1s var(--ease) 1s forwards;
}

.cover-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px 24px;
  margin-top: clamp(24px, 4vh, 46px);
  opacity: 0;
  animation: rise-in 1s var(--ease) 1.2s forwards;
}

.primary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 34px;
  padding: 17px 19px 17px 25px;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: .1em;
  transition: background .35s var(--ease), transform .35s var(--ease);
  overflow: hidden;
}

.primary-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-101%);
  transition: transform .5s var(--ease-slow);
}

.primary-btn:hover { transform: translateY(-2px); }
.primary-btn:hover::before { transform: translateX(0); }
.primary-btn > span { position: relative; z-index: 1; }

.primary-arrow {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 17px;
  border-left: 1px solid rgba(244, 239, 228, .3);
  padding-left: 12px;
  transition: transform .35s var(--ease);
}

.primary-btn:hover .primary-arrow { transform: translateX(4px); }

.cover-duration {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--muted);
}

.cover-controls {
  margin: 18px 0 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--muted);
  opacity: 0;
  animation: rise-in 1s var(--ease) 1.35s forwards;
}

.cover-controls span { margin: 0 7px; opacity: .55; }

.cover-figure {
  position: relative;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
  margin: 0;
  padding: clamp(14px, 2vw, 24px) 0 clamp(12px, 1.8vw, 20px) clamp(18px, 2vw, 32px);
  border-left: 1px solid var(--line);
  color: var(--ink);
  opacity: 0;
  animation: figure-in 1.8s var(--ease-slow) .6s forwards;
}

.figure-top, .figure-bottom {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .14em;
  color: var(--muted);
  text-transform: uppercase;
}

.figure-top span:first-child { color: var(--accent); }

.figure-art {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 10px 0;
}

.figure-art svg {
  width: min(100%, 58vh, 560px);
  height: auto;
  max-height: 100%;
  color: var(--ink);
  overflow: visible;
}

.fig-slow {
  transform-origin: 280px 280px;
  animation: fig-rotate 120s linear infinite;
}

.fig-square {
  transform-origin: 280px 280px;
  animation: fig-breathe 9s ease-in-out infinite;
}

.fig-triangle {
  transform-origin: 280px 160px;
  animation: fig-drift 7s ease-in-out infinite;
}

.fig-orb {
  animation: orb-pulse 4.6s ease-in-out infinite;
  transform-origin: 392px 366px;
}

.figure-bottom span:last-child { color: var(--ink-soft); }

.cover-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.5;
  letter-spacing: .1em;
  color: var(--muted);
  opacity: 0;
  animation: fade-in 1.2s var(--ease) 1.5s forwards;
}

.cover-footer-right {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.footer-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

@keyframes title-in {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes letter-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes figure-in {
  from { opacity: 0; transform: translateY(20px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fig-rotate {
  to { transform: rotate(360deg); }
}
@keyframes fig-breathe {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(.5deg) scale(1.012); }
}
@keyframes fig-drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
@keyframes orb-pulse {
  0%, 100% { transform: scale(1); opacity: .92; }
  50% { transform: scale(1.13); opacity: 1; }
}

/* ───────────────────────────── HUD ───────────────────────────── */

#hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .8s var(--ease) .2s, visibility .8s;
}

#hud.is-visible {
  opacity: 1;
  visibility: visible;
}

#hud.is-quiet {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 20px;
  padding: clamp(14px, 2.2vw, 26px) clamp(16px, 2.6vw, 38px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  pointer-events: auto;
}

.brand-mark {
  position: relative;
  width: 20px;
  height: 20px;
  border: 1px solid var(--ink);
  transform: rotate(45deg);
}

.brand-mark::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-name {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  line-height: 1;
}

.brand-sub {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .14em;
  color: var(--muted);
  line-height: 1;
}

.chapter-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 1px;
}

.chapter-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 11px 6px;
  border: 1px solid var(--line);
  background: rgba(233, 227, 213, .78);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.chapter-num {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--accent);
}

.chapter-name {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: .25em;
}

.objective-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  letter-spacing: .05em;
  color: var(--ink-soft);
  padding: 6px 11px;
  border: 1px solid var(--line);
  background: rgba(238, 232, 219, .88);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.objective-label {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .12em;
  color: var(--muted);
}

.objective-pips {
  display: flex;
  gap: 4px;
  margin-left: 2px;
}

.objective-pips i {
  display: block;
  width: 4px;
  height: 4px;
  border: 1px solid var(--ink-soft);
  border-radius: 50%;
  transition: background .3s var(--ease), border-color .3s;
}

.objective-pips i.is-filled {
  background: var(--accent);
  border-color: var(--accent);
}

.hud-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.hud-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: rgba(236, 230, 216, .58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .08em;
  color: var(--ink-soft);
  transition: border-color .25s, background .25s, color .25s;
}

.hud-btn:hover {
  border-color: var(--line-strong);
  background: var(--paper-light);
  color: var(--ink);
}

.hud-btn-key {
  color: var(--accent);
  font-size: 8px;
}

.entry-count {
  display: inline-grid;
  place-items: center;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  background: var(--ink);
  color: var(--cream);
  font-size: 7px;
  border-radius: 10px;
}

.hud-btn.icon-only {
  width: 28px;
  justify-content: center;
  padding: 0;
}

.sound-icon {
  font-size: 13px;
  line-height: 1;
  transition: color .25s;
}

body.sound-on .sound-icon { color: var(--accent); }

.status-strip {
  position: absolute;
  left: clamp(16px, 2.6vw, 38px);
  bottom: clamp(46px, 7vh, 82px);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .12em;
  color: var(--muted);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

.status-strip .status-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.status-sep { opacity: .5; }

.controls-hint {
  position: absolute;
  left: clamp(16px, 2.6vw, 38px);
  bottom: clamp(16px, 2.2vw, 28px);
  display: flex;
  align-items: center;
  gap: 13px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .05em;
  color: var(--muted);
  opacity: .95;
}

.controls-hint span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.controls-hint kbd {
  border-color: rgba(25, 23, 20, .15);
  color: var(--ink-soft);
  padding: 3px 4px 2px;
  font-size: 7px;
}

.hint-sep {
  width: 1px;
  height: 10px;
  background: var(--line);
}

.interaction-wrap {
  position: absolute;
  left: 50%;
  bottom: clamp(54px, 8vh, 92px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  pointer-events: none;
}

.interaction {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 15px 8px 9px;
  border: 1px solid var(--line-strong);
  background: rgba(244, 239, 228, .93);
  box-shadow: 0 9px 28px rgba(32, 25, 14, .13);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
}

.interaction.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.keycap {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
}

.interaction-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.interaction-kicker {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .16em;
  color: var(--accent);
  text-transform: uppercase;
}

.interaction-name {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: .08em;
}

.toast {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translate(-50%, 8px);
  max-width: min(84vw, 520px);
  padding: 9px 15px;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .06em;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, transform .3s var(--ease), visibility .3s;
}

.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.compass {
  position: absolute;
  right: clamp(16px, 2.6vw, 38px);
  bottom: clamp(46px, 8vh, 90px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(236, 230, 216, .48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .08em;
  color: var(--ink-soft);
  transition: opacity .3s;
}

.compass.is-hidden { opacity: 0; }

.compass-needle {
  display: block;
  width: 13px;
  height: 13px;
  position: relative;
  transform: rotate(0deg);
  transition: transform .2s linear;
}

.compass-needle::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  width: 1px;
  height: 13px;
  background: var(--accent);
}

.compass-needle::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 5px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
  transform: rotate(45deg);
}

.compass-dist { color: var(--muted); }

.touch-ui { display: none; }

/* ─────────────────────── chapter card ─────────────────────── */

#chaptercard {
  position: absolute;
  inset: 0;
  z-index: 26;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  opacity: 0;
  visibility: hidden;
  transition: opacity .7s var(--ease), visibility .7s;
  cursor: pointer;
}

#chaptercard::before {
  content: "";
  position: absolute;
  inset: 8vh 7vw;
  border: 1px solid var(--line);
  pointer-events: none;
}

#chaptercard.is-visible {
  opacity: 1;
  visibility: visible;
}

.chaptercard-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: translateY(10px);
}

#chaptercard.is-visible .chaptercard-inner {
  animation: chapter-in 1.2s var(--ease-slow) .15s forwards;
}

.cc-kicker {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .35em;
  color: var(--muted);
}

.cc-num {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: clamp(74px, 12vw, 150px);
  line-height: .95;
  color: transparent;
  -webkit-text-stroke: 1px rgba(25, 23, 20, .35);
}

.cc-rule {
  width: 1px;
  height: clamp(24px, 4.5vh, 50px);
  margin: 10px 0;
  background: var(--accent);
}

#cc-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 62px);
  font-weight: 400;
  letter-spacing: .22em;
  text-indent: .22em;
}

#cc-sub {
  margin: 16px 0 0;
  font-family: var(--serif);
  font-size: clamp(13px, 1.15vw, 16px);
  letter-spacing: .12em;
  color: var(--ink-soft);
}

.cc-skip {
  position: absolute;
  bottom: 6vh;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .2em;
  color: var(--muted);
  animation: soft-blink 2.4s ease-in-out infinite;
}

@keyframes chapter-in {
  to { transform: translateY(0); }
}
@keyframes soft-blink {
  0%, 100% { opacity: .35; }
  50% { opacity: 1; }
}

/* ─────────────────────── dialogue ─────────────────────── */

#dialogue {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: clamp(14px, 3vw, 40px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s var(--ease), visibility .35s;
}

#dialogue.is-visible {
  opacity: 1;
  visibility: visible;
}

.dialogue-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(17, 19, 16, .06), rgba(17, 19, 16, .33)),
    radial-gradient(ellipse at center, transparent 30%, rgba(17, 19, 16, .16));
  backdrop-filter: blur(1.6px);
  -webkit-backdrop-filter: blur(1.6px);
}

.dialogue-card {
  position: relative;
  width: min(880px, 100%);
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, .24), transparent 28%),
    var(--cream);
  border: 1px solid rgba(25, 23, 20, .65);
  box-shadow: 0 26px 80px rgba(20, 16, 10, .28);
  transform: translateY(18px);
  transition: transform .45s var(--ease-slow);
}

#dialogue.is-visible .dialogue-card { transform: translateY(0); }

.dialogue-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 62px;
  height: 3px;
  background: var(--accent);
}

.dialogue-head {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px 24px 15px;
  border-bottom: 1px solid var(--line);
}

.speaker-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .18);
}

.speaker-icon svg { width: 31px; height: 31px; overflow: visible; }
.speaker-icon .s-fill { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.speaker-icon .s-accent { fill: var(--accent); stroke: none; }

.speaker-meta { min-width: 0; flex: 1; }

.speaker-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .2em;
  color: var(--accent);
  margin-bottom: 3px;
}

.speaker-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

#speaker-name {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(19px, 2.1vw, 27px);
  font-weight: 400;
  letter-spacing: .12em;
  line-height: 1.2;
}

#speaker-role {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .08em;
  color: var(--muted);
}

.dialogue-index {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .1em;
  color: var(--muted);
  align-self: flex-start;
  padding-top: 3px;
}

.dialogue-body {
  padding: clamp(20px, 3vw, 34px) clamp(22px, 4vw, 48px) clamp(18px, 2.6vw, 28px);
}

.dialogue-text {
  margin: 0;
  min-height: 3.4em;
  font-family: var(--serif);
  font-size: clamp(16px, 1.52vw, 21px);
  line-height: 1.95;
  letter-spacing: .035em;
  color: var(--ink);
}

.dialogue-text.is-narration {
  color: var(--ink-soft);
  font-style: italic;
}

.dialogue-text.is-typing::after {
  content: "";
  display: inline-block;
  width: .45em;
  height: 1em;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: -.12em;
  animation: caret 1s steps(1) infinite;
}

@keyframes caret { 50% { opacity: 0; } }

.dialogue-choices {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 20px;
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  text-align: left;
  background: rgba(255, 255, 255, .14);
  font-family: var(--serif);
  font-size: clamp(13px, 1.15vw, 16px);
  letter-spacing: .04em;
  transition: background .22s, border-color .22s, color .22s, transform .22s;
}

.choice-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
  transform: translateX(3px);
}

.choice-num {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 7px;
  color: var(--muted);
  flex: 0 0 auto;
}

.choice-btn:hover .choice-num {
  border-color: rgba(244, 239, 228, .4);
  color: var(--cream);
}

.dialogue-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px 11px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .12em;
  color: var(--muted);
}

.dialogue-next {
  font-size: 12px;
  line-height: 1;
  color: var(--accent);
  animation: next-bob 1.5s ease-in-out infinite;
}

@keyframes next-bob {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(2px); }
}

/* ─────────────────────── journal ─────────────────────── */

#journal {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 40px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .4s var(--ease), visibility .4s;
}

#journal.is-visible {
  opacity: 1;
  visibility: visible;
}

.journal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(17, 19, 16, .63);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.journal-book {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1110px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  background:
    linear-gradient(to right, transparent calc(31% - 1px), rgba(25, 23, 20, .35) 31%, transparent calc(31% + 1px)),
    linear-gradient(105deg, rgba(255, 255, 255, .22), transparent 45%),
    var(--paper-light);
  border: 1px solid rgba(25, 23, 20, .55);
  box-shadow: 0 30px 90px rgba(12, 10, 7, .4);
  transform: translateY(16px) scale(.992);
  transition: transform .5s var(--ease-slow);
}

#journal.is-visible .journal-book { transform: translateY(0) scale(1); }

.journal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 26px 15px;
  border-bottom: 1px solid var(--line);
}

.journal-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .22em;
  color: var(--accent);
  margin-bottom: 5px;
}

.journal-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 400;
  letter-spacing: .18em;
}

.journal-volume {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .1em;
  color: var(--muted);
  vertical-align: middle;
  margin-left: 8px;
}

.close-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1;
  color: var(--ink-soft);
  transition: background .2s, color .2s;
}

.close-btn:hover { background: var(--ink); color: var(--cream); }

.journal-grid {
  display: grid;
  grid-template-columns: 31% 1fr;
  min-height: 0;
  flex: 1;
}

.journal-aside {
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid transparent;
}

.journal-epigraph {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: clamp(15px, 1.35vw, 19px);
  line-height: 1.9;
  letter-spacing: .04em;
  color: var(--ink-soft);
}

.journal-figure {
  display: grid;
  place-items: center;
  margin: 6px 0 26px;
  color: var(--ink-soft);
  opacity: .92;
}

.journal-figure svg {
  width: min(100%, 238px);
  height: auto;
}

.journal-facts {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: auto 0 22px;
  border-top: 1px solid var(--line);
}

.journal-facts div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px dotted var(--line);
}

.journal-facts dt {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .12em;
  color: var(--muted);
}

.journal-facts dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .04em;
  text-align: right;
}

.journal-progress-label {
  display: block;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .12em;
  color: var(--muted);
}

.journal-progress-num {
  display: block;
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: .1em;
}

.journal-progress-track {
  height: 2px;
  margin-top: 9px;
  background: rgba(25, 23, 20, .12);
}

.journal-progress-track span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .5s var(--ease);
}

.journal-controls {
  margin: 18px 0 0;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .06em;
  color: var(--muted);
}

.journal-pages {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 15px 26px 22px;
  overflow: hidden;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, rgba(25, 23, 20, .06) 31px, rgba(25, 23, 20, .06) 32px);
}

.journal-pages-head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .16em;
  color: var(--muted);
}

.journal-entries {
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.journal-entries::-webkit-scrollbar { width: 4px; }
.journal-entries::-webkit-scrollbar-thumb { background: var(--line-strong); }

.entry {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 15px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(6px);
  animation: entry-in .5s var(--ease) forwards;
}

@keyframes entry-in { to { opacity: 1; transform: translateY(0); } }

.entry-index {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .08em;
  color: var(--accent);
  padding-top: 4px;
}

.entry-body h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: .1em;
}

.entry-body p {
  margin: 0;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.75;
  letter-spacing: .025em;
  color: var(--ink-soft);
}

.entry-source {
  display: block;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .1em;
  color: var(--muted);
}

.entry.is-locked { opacity: .35 !important; filter: blur(.2px); }
.entry.is-locked .entry-body h3 { color: var(--muted); }
.entry.is-locked .entry-index { color: var(--muted); }

/* ─────────────────────── ascension ─────────────────────── */

#ascend-ui {
  position: absolute;
  inset: 0;
  z-index: 28;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  color: var(--cream);
  transition: opacity 1s var(--ease), visibility 1s;
}

#ascend-ui.is-visible {
  opacity: 1;
  visibility: visible;
}

.ascend-head {
  position: absolute;
  top: clamp(22px, 4vw, 42px);
  left: clamp(22px, 4vw, 56px);
  right: clamp(22px, 4vw, 56px);
  display: flex;
  justify-content: space-between;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(244, 239, 228, .18);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .16em;
  color: rgba(244, 239, 228, .58);
}

.ascend-kicker { color: #d97d63; }

.ascend-title {
  position: absolute;
  top: clamp(72px, 12vh, 130px);
  left: clamp(22px, 6vw, 90px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}

.ascend-title.is-dim {
  opacity: .18;
  transform: translateY(-6px);
}

.ascend-title p {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .22em;
  color: rgba(244, 239, 228, .48);
}

.ascend-title h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(36px, 5.7vw, 78px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: .1em;
  color: var(--cream);
  text-shadow: 0 3px 30px rgba(0, 0, 0, .25);
}

.ascend-title h2 em {
  font-style: normal;
  color: #d97d63;
}

.ascend-hold {
  position: absolute;
  left: 50%;
  bottom: clamp(30px, 6vh, 62px);
  transform: translateX(-50%);
  pointer-events: auto;
  transition: opacity .5s;
}

.ascend-hold.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.hold-btn {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 8px 22px 8px 8px;
  border: 1px solid rgba(244, 239, 228, .22);
  background: rgba(15, 18, 16, .4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--cream);
  user-select: none;
  transition: border-color .3s, background .3s;
}

.hold-btn:hover, .hold-btn.is-holding {
  border-color: rgba(217, 125, 99, .7);
  background: rgba(15, 18, 16, .6);
}

.hold-ring {
  position: relative;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
}

.hold-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.hold-track { stroke: rgba(244, 239, 228, .25); }

.hold-fill {
  stroke: #d97d63;
  stroke-linecap: round;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray .08s linear;
}

.hold-glyph {
  font-family: var(--mono);
  font-size: 17px;
  color: #d97d63;
  animation: hold-float 2s ease-in-out infinite;
}

@keyframes hold-float {
  0%, 100% { transform: translateY(2px); }
  50% { transform: translateY(-2px); }
}

.hold-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }

.hold-label {
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: .13em;
}

.hold-sub {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .12em;
  color: rgba(244, 239, 228, .42);
}

.ascend-bottom {
  position: absolute;
  left: clamp(22px, 4vw, 56px);
  right: clamp(22px, 4vw, 56px);
  bottom: clamp(20px, 3vw, 32px);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .14em;
  color: rgba(244, 239, 228, .3);
}

/* ─────────────────────── ending ─────────────────────── */

#ending {
  position: absolute;
  inset: 0;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transition: opacity .8s var(--ease), visibility .8s;
  overflow: hidden;
}

#ending.is-visible {
  opacity: 1;
  visibility: visible;
}

.ending-paper {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 60% at 72% 38%, rgba(255, 255, 255, .3), transparent 70%),
    var(--paper);
}

.ending-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .22;
  background-image:
    linear-gradient(to right, transparent calc(100% - 1px), rgba(25, 23, 20, .12) 1px),
    linear-gradient(to bottom, transparent calc(100% - 1px), rgba(25, 23, 20, .08) 1px);
  background-size: 72px 72px;
}

.ending-inner {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(26px, 5vw, 80px);
  padding: clamp(28px, 5vw, 74px);
}

.ending-art {
  position: relative;
  display: grid;
  place-items: center;
  height: min(72vh, 640px);
  opacity: 0;
  transform: scale(.97) rotate(-1deg);
  transition: opacity 1s var(--ease) .2s, transform 1.4s var(--ease-slow) .2s;
}

#ending.is-visible .ending-art {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.ending-art svg {
  width: min(100%, 54vh, 520px);
  height: auto;
  overflow: visible;
}

.ending-content {
  min-width: 0;
  max-width: 560px;
}

.ending-content.is-choice { max-width: 580px; }

.ending-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .24em;
  color: var(--accent);
  margin-bottom: 12px;
}

.ending-content h2 {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-size: clamp(36px, 4.8vw, 68px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: .06em;
}

.ending-lede {
  margin: 0 0 28px;
  max-width: 30em;
  font-family: var(--serif);
  font-size: clamp(14px, 1.2vw, 17px);
  line-height: 1.9;
  letter-spacing: .03em;
  color: var(--ink-soft);
}

.ending-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 26px;
}

.ending-choice {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  text-align: left;
  background: rgba(255, 255, 255, .12);
  transition: background .3s, color .3s, border-color .3s, transform .3s var(--ease);
}

.ending-choice:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
  transform: translateX(4px);
}

.ec-num {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--accent);
}

.ending-choice:hover .ec-num { color: #d97d63; }

.ec-copy { display: flex; flex-direction: column; gap: 4px; }

.ec-title {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .1em;
}

.ec-desc {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .06em;
  color: var(--muted);
}

.ending-choice:hover .ec-desc { color: rgba(244, 239, 228, .6); }

.ec-arrow {
  font-family: var(--mono);
  font-size: 14px;
  opacity: .5;
  transition: transform .25s, opacity .25s;
}

.ending-choice:hover .ec-arrow { transform: translateX(3px); opacity: 1; }

.ending-story {
  margin: 0 0 24px;
  font-family: var(--serif);
  font-size: clamp(14px, 1.14vw, 16.5px);
  line-height: 2.05;
  letter-spacing: .025em;
  color: var(--ink-soft);
  white-space: pre-line;
  max-height: 42vh;
  overflow: auto;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.ending-story::-webkit-scrollbar { width: 3px; }
.ending-story::-webkit-scrollbar-thumb { background: var(--line-strong); }

.ending-coda {
  margin: 0 0 24px;
  padding-left: 16px;
  border-left: 1px solid var(--accent);
  font-family: var(--serif);
  font-size: clamp(14px, 1.25vw, 18px);
  line-height: 1.8;
  letter-spacing: .08em;
  color: var(--ink);
}

.ending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .1em;
  transition: background .25s, color .25s, border-color .25s;
}

.text-btn:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }

.text-btn.is-quiet { border-color: transparent; color: var(--muted); }
.text-btn.is-quiet:hover { background: transparent; color: var(--ink); }

.ending-signature {
  margin-top: 22px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .14em;
  color: var(--muted);
}

/* fade + rotate */

#fade {
  position: absolute;
  inset: 0;
  z-index: 90;
  background: #121312;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 1.1s var(--ease), visibility 1.1s;
}

#fade.is-dark {
  opacity: 1;
  visibility: visible;
}

#rotate-note {
  position: absolute;
  inset: 0;
  z-index: 95;
  display: none;
  place-items: center;
  background: var(--paper);
  text-align: center;
  font-family: var(--serif);
  color: var(--ink-soft);
}

.rotate-glyph { font-size: 30px; display: block; margin-bottom: 12px; }
#rotate-note p { font-size: 14px; line-height: 1.9; letter-spacing: .08em; }

/* ─────────────────────── responsive ─────────────────────── */

@media (max-width: 1020px) {
  .cover-main {
    grid-template-columns: 1.1fr .9fr;
    gap: 24px;
  }
  .cover-figure { padding-left: 18px; }
  .title-cn { font-size: clamp(88px, 14.5vw, 160px); }
  .hud-top { grid-template-columns: auto 1fr auto; }
  .chapter-block { align-items: flex-start; }
  .journal-grid { grid-template-columns: 34% 1fr; }
  .ending-inner { padding: 42px; }
}

@media (max-width: 780px) {
  .cover-meta-mid { display: none; }
  .cover-main {
    grid-template-columns: 1fr;
    padding: 20px 0 8px;
    align-content: center;
  }
  .cover-copy { padding-left: 0; }
  .cover-figure {
    position: absolute;
    right: -8px;
    top: 72px;
    width: min(42vw, 178px);
    height: min(42vw, 178px);
    opacity: .42;
    z-index: 0;
    border: 0;
    padding: 0;
    pointer-events: none;
    animation: fade-in 2s var(--ease) .4s forwards;
  }
  .cover-figure .figure-art { padding: 0; }
  .cover-figure .figure-art svg { width: 100%; }
  .figure-top, .figure-bottom { display: none; }
  .figure-art svg { width: 100%; }
  .title-cn { font-size: clamp(78px, 23vw, 150px); }
  .cover-lede { font-size: 14px; line-height: 1.9; max-width: 24em; }
  .cover-cta { margin-top: 26px; }
  .cover-controls { display: none; }
  .cover-footer { font-size: 7px; }
  .cover-footer-right { display: none; }

  .hud-top {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 14px 14px;
  }
  .brand-sub { display: none; }
  .chapter-block {
    position: absolute;
    top: 44px;
    left: 14px;
    align-items: flex-start;
    gap: 5px;
  }
  .chapter-name { font-size: 13px; }
  .chapter-line { padding: 4px 8px 5px; }
  .objective-line { padding: 4px 8px; font-size: 8px; }
  .objective-label { display: none; }
  .hud-actions { grid-column: 2; }
  .hud-btn { height: 26px; font-size: 7px; padding: 0 8px; }
  .hud-btn-key { display: none; }
  .hud-btn.icon-only { width: 26px; }
  .controls-hint { display: none; }
  .status-strip { display: none; }
  .interaction-wrap { bottom: 28px; }
  .interaction { padding: 7px 13px 7px 8px; }
  .interaction-name { font-size: 12px; }
  .compass { bottom: 20px; right: 14px; font-size: 6.5px; }

  .touch-ui {
    display: block;
    pointer-events: none;
  }
  .joystick {
    position: absolute;
    left: 24px;
    bottom: 86px;
    width: 106px;
    height: 106px;
    border: 1px solid rgba(25, 23, 20, .42);
    border-radius: 50%;
    background: rgba(240, 234, 221, .7);
    box-shadow: 0 8px 24px rgba(40, 33, 22, .1), inset 0 0 0 7px rgba(255, 255, 255, .14);
    pointer-events: auto;
    touch-action: none;
  }
  .joystick-label {
    position: absolute;
    left: 50%;
    bottom: -19px;
    transform: translateX(-50%);
    font-family: var(--mono);
    font-size: 6.5px;
    letter-spacing: .16em;
    color: rgba(25, 23, 20, .45);
    pointer-events: none;
  }
  .joystick-cross::before, .joystick-cross::after {
    content: "";
    position: absolute;
    background: rgba(25, 23, 20, .13);
  }
  .joystick-cross::before { left: 50%; top: 15%; bottom: 15%; width: 1px; }
  .joystick-cross::after { top: 50%; left: 15%; right: 15%; height: 1px; }
  .joystick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    border: 1.5px solid rgba(25, 23, 20, .66);
    border-radius: 50%;
    background: #f6f0e4;
    box-shadow: 0 4px 10px rgba(35, 28, 18, .16);
    transition: transform .1s linear;
    pointer-events: none;
  }
  .joystick-knob::after {
    content: "";
    position: absolute;
    inset: 14px;
    background: var(--accent);
    border-radius: 50%;
  }
  .touch-actions {
    position: absolute;
    right: 20px;
    bottom: 28px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    pointer-events: auto;
  }
  .touch-btn {
    border: 1px solid var(--line-strong);
    background: rgba(244, 239, 228, .82);
    backdrop-filter: blur(8px);
    font-family: var(--serif);
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--ink);
  }
  .touch-journal { padding: 10px 13px; font-size: 9px; }
  .touch-interact {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--cream);
    font-family: var(--sans);
    font-size: 12px;
    opacity: .35;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
  }
  .touch-interact.is-ready {
    opacity: 1;
    pointer-events: auto;
  }
  .touch-interact:active { transform: scale(.94); }
  .interaction-wrap { pointer-events: none; bottom: 138px; }
  .interaction { display: none; }
  .toast {
    display: block;
    bottom: auto;
    top: 4px;
    max-width: 88vw;
    white-space: normal;
    line-height: 1.5;
    font-size: 11px;
    padding: 8px 12px;
  }

  .dialogue { padding: 10px; }
  .dialogue-head { gap: 10px; padding: 13px 15px 11px; }
  .speaker-icon { width: 38px; height: 38px; }
  .speaker-icon svg { width: 25px; height: 25px; }
  .speaker-row { gap: 7px; }
  #speaker-role { font-size: 6.5px; }
  .dialogue-index { font-size: 6.5px; }
  .dialogue-body { padding: 18px 17px 15px; }
  .dialogue-text { font-size: 15.5px; line-height: 1.9; min-height: 5.2em; }
  .choice-btn { padding: 10px 11px; font-size: 13px; }
  .dialogue-foot { padding: 8px 15px 9px; }
  .dialogue-card::before { width: 44px; }

  .journal-book {
    max-height: calc(100vh - 22px);
    background:
      linear-gradient(105deg, rgba(255, 255, 255, .22), transparent 45%),
      var(--paper-light);
  }
  .journal-head { padding: 14px 16px 11px; }
  .journal-grid { grid-template-columns: 1fr; overflow-y: auto; }
  .journal-aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px 16px 14px;
    display: block;
  }
  .journal-epigraph { margin-bottom: 12px; font-size: 14px; }
  .journal-figure { display: none; }
  .journal-facts { display: none; }
  .journal-progress { display: flex; align-items: center; gap: 10px; }
  .journal-progress-label { display: none; }
  .journal-progress-num { margin: 0; font-size: 14px; }
  .journal-progress-track { flex: 1; margin: 0; }
  .journal-controls { display: none; }
  .journal-pages { padding: 10px 16px 16px; overflow: visible; }
  .entry { grid-template-columns: 30px 1fr; gap: 10px; padding: 14px 0; }

  .ascend-title { top: 18vh; left: 20px; right: 20px; }
  .ascend-title h2 { font-size: clamp(34px, 11vw, 54px); }
  body.is-ascended .ascend-title { display: none; }
  .ascend-head { left: 20px; right: 20px; top: 18px; }
  .ascend-coordinates { display: none; }
  .ascend-hold { bottom: 64px; }
  .ascend-bottom { left: 20px; right: 20px; font-size: 6px; }
  .ascend-bottom span:last-child { display: none; }

  .ending-inner {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 14px;
    padding: 22px;
    overflow-y: auto;
  }
  .ending-art {
    position: absolute;
    right: -8vw;
    top: 3vh;
    width: 64vw;
    height: 64vw;
    opacity: .13 !important;
    z-index: 0;
    pointer-events: none;
  }
  .ending-content { position: relative; z-index: 1; max-width: 100%; }
  .ending-content h2 { font-size: clamp(34px, 9vw, 48px); margin-bottom: 15px; }
  .ending-kicker { margin-bottom: 8px; }
  .ending-lede { margin-bottom: 20px; font-size: 13px; line-height: 1.85; }
  .ending-story { max-height: 35vh; font-size: 13px; line-height: 1.95; margin-bottom: 18px; }
  .ending-coda { font-size: 13px; margin-bottom: 18px; }
  .ending-choice { padding: 12px; }
  .ec-title { font-size: 15px; }
  .ending-actions { gap: 7px; }
  .text-btn { padding: 9px 11px; font-size: 7px; }
  .ending-signature { margin-top: 16px; }
}

@media (max-width: 440px) {
  .cover-meta { font-size: 7px; letter-spacing: .12em; }
  .cover-meta span:last-child { color: var(--muted); }
  .cover-main { padding-top: 16px; }
  .title-cn { font-size: 25vw; }
  .cover-lede { font-size: 13px; }
  .primary-btn { gap: 20px; padding: 15px 16px 15px 19px; font-size: 13px; }
  .cover-duration { width: 100%; }
  .cover-footer { line-height: 1.6; }
  .hud-btn { width: auto; padding: 0 8px; justify-content: center; gap: 5px; }
  .hud-btn .hud-btn-key { display: none; }
  .hud-btn.icon-only { width: 26px; padding: 0; }
  .entry-count { min-width: 12px; height: 12px; font-size: 6px; }
  .chapter-block { top: 42px; }
  .objective-line { max-width: 168px; }
  .objective-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .compass { bottom: 96px; }
  .joystick { left: 18px; bottom: 102px; width: 96px; height: 96px; }
  .touch-actions { right: 16px; bottom: 32px; }
}

@media (max-height: 660px) and (min-width: 781px) {
  .cover-main { padding: 12px 0; }
  .cover-lede { margin-top: 18px; line-height: 1.75; }
  .cover-cta { margin-top: 20px; }
  .title-cn { font-size: min(12vw, 122px); }
  .cover-figure { padding-top: 8px; }
}

@media (max-height: 460px) and (orientation: landscape) {
  #rotate-note { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .fig-slow, .fig-square, .fig-triangle, .fig-orb { animation: none !important; }
}

/* ───────────────────────────── dream hint ───────────────────────────── */

.dream-hint {
  position: absolute;
  left: 50%;
  bottom: clamp(42px, 7vh, 78px);
  z-index: 20;
  transform: translate(-50%, 12px);
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 9px 15px;
  border: 1px solid rgba(238, 231, 214, .18);
  background: rgba(13, 16, 14, .48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(238, 231, 214, .7);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .08em;
  opacity: 0;
  visibility: hidden;
  transition: opacity .6s var(--ease), transform .6s var(--ease), visibility .6s;
}

.dream-hint.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.dream-hint-kicker {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .18em;
  color: #d07a60;
}

.dream-hint b {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin: 0 2px;
  border: 1px solid rgba(238, 231, 214, .24);
  font-family: var(--mono);
  font-weight: 400;
  font-size: 9px;
  color: rgba(238, 231, 214, .9);
}

/* reveal dialogue over Spaceland */
body.is-ascended .dialogue-backdrop {
  background: linear-gradient(to bottom, rgba(10, 13, 11, .02) 0%, rgba(10, 13, 11, .08) 34%, rgba(10, 13, 11, .55) 100%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.is-ascended .dialogue-card {
  width: min(820px, 100%);
  border-color: rgba(244, 239, 228, .26);
  background:
    linear-gradient(110deg, rgba(255, 246, 228, .045), transparent 55%),
    rgba(12, 15, 13, .72);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  color: var(--cream);
  backdrop-filter: blur(7px) saturate(.85);
  -webkit-backdrop-filter: blur(7px) saturate(.85);
}

body.is-ascended .dialogue-card::before { background: #d97d63; }
body.is-ascended .dialogue-head { border-bottom-color: rgba(244, 239, 228, .16); }
body.is-ascended .speaker-icon {
  border-color: rgba(244, 239, 228, .2);
  background: rgba(255, 255, 255, .03);
}
body.is-ascended .speaker-icon .s-fill { stroke: var(--cream); }
body.is-ascended .speaker-icon .s-accent { fill: #d97d63; }
body.is-ascended #speaker-name { color: var(--cream); }
body.is-ascended #speaker-role,
body.is-ascended .dialogue-index,
body.is-ascended .dialogue-foot { color: rgba(244, 239, 228, .45); }
body.is-ascended .dialogue-text { color: var(--cream); }
body.is-ascended .dialogue-text.is-narration { color: rgba(244, 239, 228, .62); }
body.is-ascended .dialogue-foot { border-top-color: rgba(244, 239, 228, .14); }
body.is-ascended .dialogue-next { color: #d97d63; }
body.is-ascended .choice-btn {
  border-color: rgba(244, 239, 228, .2);
  background: rgba(255, 255, 255, .02);
  color: var(--cream);
}
body.is-ascended .choice-btn:hover {
  background: var(--cream);
  border-color: var(--cream);
  color: var(--ink);
}
body.is-ascended .choice-num { border-color: rgba(244, 239, 228, .25); color: rgba(244, 239, 228, .6); }
body.is-ascended .choice-btn:hover .choice-num { border-color: rgba(25, 23, 20, .3); color: var(--ink); }

body.is-ascended #dialogue {
  align-items: flex-end;
}

/* ending content transition */
.ending-content.is-result {
  animation: ending-content-in .9s var(--ease-slow) both;
}

@keyframes ending-content-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 780px) {
  .dialogue { padding: 10px; }
  .dream-hint { font-size: 10px; padding: 8px 11px; gap: 8px; white-space: nowrap; bottom: 36px; }
  .dream-hint-kicker { display: none; }
}

/* ── device safe areas ── */
@supports (padding: env(safe-area-inset-top)) {
  .hud-top {
    padding-top: calc(clamp(14px, 2.2vw, 26px) + env(safe-area-inset-top));
  }
  #cover {
    padding-top: calc(clamp(20px, 3.2vw, 46px) + env(safe-area-inset-top));
    padding-bottom: calc(clamp(18px, 2.4vw, 34px) + env(safe-area-inset-bottom));
  }
  #dialogue {
    padding-bottom: calc(clamp(14px, 3vw, 40px) + env(safe-area-inset-bottom));
  }
  .ascend-bottom {
    bottom: calc(clamp(20px, 3vw, 32px) + env(safe-area-inset-bottom));
  }
  .ending-inner {
    padding-bottom: calc(clamp(28px, 5vw, 74px) + env(safe-area-inset-bottom));
  }
}

/* ═══════════════════════════════════════════════════════════════
   NEW CHAPTERS — ritual room, colour, spaceland, pointland
   ═══════════════════════════════════════════════════════════════ */

/* shared ritual frame */
#feeling, #colour, #spaceland, #pointland {
  position: absolute;
  inset: 0;
  z-index: 46;
  opacity: 0;
  visibility: hidden;
  transition: opacity .7s var(--ease), visibility .7s;
}

#feeling.is-visible, #colour.is-visible, #spaceland.is-visible, #pointland.is-visible {
  opacity: 1;
  visibility: visible;
}

.ritual-frame {
  position: absolute;
  inset: 0;
  padding: clamp(20px, 3.4vw, 48px) clamp(22px, 5vw, 80px);
  display: flex;
  flex-direction: column;
  color: var(--cream);
  background:
    radial-gradient(ellipse 52% 56% at 68% 42%, rgba(188, 132, 90, .16), transparent 68%),
    linear-gradient(160deg, #1a1b16, #0d100e 70%);
}

.ritual-head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(244, 239, 228, .18);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .16em;
  color: rgba(244, 239, 228, .45);
}

.ritual-head span:first-child { color: #cf7a5d; }

.ritual-foot {
  display: flex;
  justify-content: space-between;
  padding-top: 9px;
  border-top: 1px solid rgba(244, 239, 228, .12);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .13em;
  color: rgba(244, 239, 228, .3);
}

.ritual-kicker {
  display: block;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .18em;
  color: rgba(244, 239, 228, .42);
}

.ritual-btn {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 12px 16px;
  border: 1px solid rgba(244, 239, 228, .35);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: .1em;
  transition: background .25s, border-color .25s, color .25s;
}

.ritual-btn:hover { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.ritual-btn:disabled { opacity: .3; pointer-events: none; }

.ritual-btn kbd {
  border-color: rgba(244, 239, 228, .2);
  color: rgba(244, 239, 228, .5);
  font-size: 6.5px;
}

/* ── feeling trial ── */

#feeling {
  display: grid;
  place-items: center;
  background: transparent;
}

#feeling .ritual-frame {
  justify-content: space-between;
  gap: 18px;
  max-width: 1120px;
  margin: auto;
  border: 1px solid rgba(244, 239, 228, .15);
  min-height: min(760px, calc(100vh - 40px));
}

.feeling-grid {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  align-items: center;
  gap: clamp(20px, 5vw, 70px);
  flex: 1;
  min-height: 0;
}

.feeling-copy h2 {
  margin: 0 0 24px;
  font-family: var(--serif);
  font-size: clamp(38px, 5vw, 70px);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: .07em;
}

.feeling-copy h2 em { font-style: normal; color: #d18668; }

.feeling-copy p {
  max-width: 27em;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(13px, 1.1vw, 16px);
  line-height: 2;
  color: rgba(244, 239, 228, .58);
}

.feeling-round-label {
  margin-top: 26px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .14em;
  color: rgba(244, 239, 228, .45);
}

.feeling-round-label b { color: #d18668; font-weight: 400; }

.feeling-rules {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 22px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .12em;
  color: rgba(244, 239, 228, .28);
}

.feeling-rules span::before { content: "— "; color: #b4402a; }

.feeling-chamber {
  position: relative;
  width: min(100%, 500px);
  aspect-ratio: 1;
  justify-self: center;
  border: 1px solid rgba(244, 239, 228, .16);
  background:
    radial-gradient(circle at 50% 50%, rgba(244, 239, 228, .07), transparent 54%),
    rgba(3, 5, 4, .28);
  overflow: hidden;
}

.feeling-aura {
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  border: 1px solid rgba(244, 239, 228, .09);
  box-shadow: 0 0 90px rgba(197, 128, 88, .09);
}

#feeling-svg {
  position: absolute;
  inset: 8%;
  width: 84%;
  height: 84%;
  overflow: visible;
}

.feel-shape {
  fill: rgba(244, 239, 228, .035);
  stroke: rgba(244, 239, 228, .22);
  stroke-width: 1;
}

.feel-edge {
  stroke: rgba(244, 239, 228, .12);
  stroke-width: 1.4;
  transition: stroke .18s, stroke-width .18s, filter .18s;
}

.feel-edge.is-traced {
  stroke: #e2a07f;
  stroke-width: 2.6;
  filter: drop-shadow(0 0 7px rgba(226, 160, 127, .8));
}

.feel-vertex { fill: rgba(244, 239, 228, .35); }
.feel-edge.is-traced + .feel-vertex { fill: #d18668; }

.feeling-count-wrap {
  position: absolute;
  right: 24px;
  bottom: 18px;
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-family: var(--mono);
}

.feeling-count-wrap span {
  font-family: var(--serif);
  font-size: clamp(44px, 5vw, 64px);
  line-height: 1;
  color: rgba(244, 239, 228, .72);
}

.feeling-count-wrap small {
  font-size: 7px;
  letter-spacing: .12em;
  color: rgba(244, 239, 228, .3);
}

.feeling-cloth {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(118deg, transparent 0 40%, rgba(244, 239, 228, .025) 40.2% 40.4%, transparent 40.6%),
    repeating-linear-gradient(102deg, transparent 0 36px, rgba(244, 239, 228, .018) 37px, transparent 38px);
  pointer-events: none;
}

.feeling-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 0 4px;
  text-align: center;
}

#feeling-prompt {
  margin: 0 0 2px;
  font-family: var(--serif);
  font-size: clamp(13px, 1.15vw, 16px);
  letter-spacing: .04em;
  color: rgba(244, 239, 228, .7);
}

.feeling-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.feel-choice {
  min-width: 54px;
  padding: 9px 12px;
  border: 1px solid rgba(244, 239, 228, .24);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 15px;
  transition: background .2s, color .2s, border-color .2s;
}

.feel-choice:hover { background: var(--cream); border-color: var(--cream); color: var(--ink); }
.feel-choice.is-wrong { border-color: #d18668; color: #e8a183; }
.feel-choice:disabled { opacity: .3; pointer-events: none; }

/* ── colour interlude ── */

#colour {
  color: var(--ink);
  background: transparent;
}

#colour .ritual-frame {
  color: var(--ink);
  background:
    radial-gradient(ellipse 46% 65% at 73% 35%, rgba(182, 142, 87, .13), transparent 70%),
    var(--paper);
}

#colour .ritual-head {
  border-bottom-color: var(--line-strong);
  color: var(--muted);
}

#colour .ritual-head span:first-child { color: var(--accent); }
#colour .ritual-foot { border-top-color: var(--line); color: var(--muted); }
#colour .ritual-kicker { color: var(--accent); }

.colour-grid {
  display: grid;
  grid-template-columns: .78fr 1.22fr;
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  flex: 1;
  min-height: 0;
}

.colour-copy h2 {
  margin: 0 0 24px;
  font-family: var(--serif);
  font-size: clamp(38px, 4.3vw, 60px);
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: .035em;
}

.colour-copy h2 em { font-style: normal; color: var(--accent); }

.colour-copy p {
  max-width: 28em;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(13px, 1.12vw, 16px);
  line-height: 2;
  color: var(--ink-soft);
}

.colour-workbench {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.colour-stage {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: clamp(12px, 2.2vw, 24px);
  border: 1px solid var(--line);
  background-image:
    linear-gradient(to right, transparent calc(100% - 1px), rgba(25,23,20,.05) 1px),
    linear-gradient(to bottom, transparent calc(100% - 1px), rgba(25,23,20,.05) 1px);
  background-size: 40px 40px;
}

.colour-shape {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  aspect-ratio: 1.3;
  padding: 8px;
  border: 1px solid rgba(25, 23, 20, .14);
  background: rgba(255, 255, 255, .08);
  transition: border-color .25s, background .25s, transform .25s var(--ease);
}

.colour-shape:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .3); transform: translateY(-2px); }
.colour-shape.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(180,64,42,.2); }
.colour-shape.is-painted { background: rgba(255, 255, 255, .26); }

.colour-shape svg {
  width: 54%;
  height: auto;
  overflow: visible;
}

.colour-shape .shape-body {
  stroke: var(--ink);
  stroke-width: 1.2;
  fill: rgba(216, 210, 196, .8);
  transition: fill .6s var(--ease), filter .8s, opacity .8s;
}

.colour-shape .shape-mark {
  fill: none;
  stroke: rgba(25, 23, 20, .35);
  stroke-width: .7;
}

.colour-shape .shape-label {
  position: absolute;
  left: 9px;
  top: 7px;
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .1em;
  color: var(--muted);
}

.colour-shape .shape-name {
  position: absolute;
  right: 9px;
  bottom: 7px;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--ink-soft);
}

.colour-palette-wrap { display: flex; align-items: center; gap: 16px; }

.colour-palette-label {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .14em;
  color: var(--muted);
  white-space: nowrap;
}

.colour-palette { display: flex; gap: 10px; flex-wrap: wrap; }

.swatch {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(25, 23, 20, .2);
  transition: transform .2s, border-color .2s;
}

.swatch:hover { transform: scale(1.1); }
.swatch.is-selected { border-color: var(--ink); transform: scale(1.12); }

.swatch::after {
  content: attr(data-name);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  font-family: var(--serif);
  font-size: 9px;
  color: var(--ink-soft);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

.swatch:hover::after, .swatch.is-selected::after { opacity: 1; }

.colour-edict {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 94px;
  transform: translateX(-50%);
  width: min(700px, calc(100% - 60px));
  z-index: 3;
  border-top: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  padding: 16px 24px;
  text-align: center;
  background: rgba(237, 231, 218, .97);
  box-shadow: 0 18px 50px rgba(39, 30, 18, .18);
}

#colour.is-edict .colour-palette-wrap {
  opacity: 0;
  transition: opacity .3s;
}

.colour-edict.is-visible { display: block; animation: edict-in .7s var(--ease); }

.colour-edict-mark {
  display: block;
  margin-bottom: 5px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .24em;
  color: var(--accent);
}

.colour-edict p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(13px, 1.25vw, 17px);
  line-height: 1.8;
  letter-spacing: .06em;
}

@keyframes edict-in {
  from { opacity: 0; transform: scaleY(.8); }
  to { opacity: 1; transform: scaleY(1); }
}

.colour-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 48px;
  padding-top: 8px;
}

#colour-prompt {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(13px, 1.1vw, 16px);
  letter-spacing: .03em;
  color: var(--ink-soft);
}

.colour-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.colour-btn {
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .1em;
  color: var(--ink);
  transition: background .25s, color .25s, border-color .25s;
}

.colour-btn:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.colour-btn.is-accent { border-color: var(--accent); color: var(--accent); }
.colour-btn.is-accent:hover { background: var(--accent); color: var(--cream); }

.colour-stage.is-draining .colour-shape:not(.is-saved) .shape-body {
  fill: rgba(216, 210, 196, .85) !important;
  filter: grayscale(1);
  opacity: .5;
  transition: fill 1.2s var(--ease), filter 1.2s, opacity 1.2s;
}

.colour-shape.is-saved { border-color: var(--accent); background: rgba(255, 255, 255, .35); }
.colour-shape.is-saved .shape-body { filter: drop-shadow(0 0 12px rgba(180,64,42,.4)); }

/* ── spaceland hub ── */

#spaceland {
  z-index: 29;
  pointer-events: none;
}

.spaceland-panel {
  position: absolute;
  left: clamp(20px, 4vw, 58px);
  top: 50%;
  transform: translateY(-50%);
  width: min(390px, 31vw);
  padding: 24px 24px 20px;
  border: 1px solid rgba(244, 239, 228, .22);
  background: rgba(12, 15, 13, .74);
  color: var(--cream);
  backdrop-filter: blur(14px) saturate(.8);
  -webkit-backdrop-filter: blur(14px) saturate(.8);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  pointer-events: auto;
  max-height: calc(100vh - 90px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(244,239,228,.3) transparent;
}

.spaceland-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(244, 239, 228, .16);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .12em;
  color: rgba(244, 239, 228, .42);
}

.spaceland-head span:first-child { color: #d18668; }

.spaceland-panel h2 {
  margin: 20px 0 14px;
  font-family: var(--serif);
  font-size: clamp(30px, 3vw, 45px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: .06em;
}

.spaceland-panel h2 em { font-style: normal; color: #d18668; }

.spaceland-lede {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.8;
  color: rgba(244, 239, 228, .55);
}

.spaceland-cards { display: flex; flex-direction: column; gap: 7px; }

.observation {
  display: grid;
  grid-template-columns: 25px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  border: 1px solid rgba(244, 239, 228, .15);
  text-align: left;
  color: rgba(244, 239, 228, .82);
  transition: background .25s, border-color .25s, transform .25s var(--ease);
}

.observation:hover {
  background: rgba(244, 239, 228, .1);
  border-color: rgba(244, 239, 228, .35);
  transform: translateX(3px);
}

.observation.is-done { border-color: rgba(209, 134, 104, .36); }
.observation.is-done .obs-index { color: #d18668; }

.obs-index {
  font-family: var(--mono);
  font-size: 7px;
  color: rgba(244, 239, 228, .35);
}

.obs-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.obs-title { font-family: var(--serif); font-size: 14px; letter-spacing: .07em; }
.obs-desc { font-family: var(--sans); font-size: 8px; letter-spacing: .04em; color: rgba(244, 239, 228, .4); }
.obs-state { font-family: var(--mono); font-size: 6.5px; letter-spacing: .1em; color: rgba(244, 239, 228, .3); white-space: nowrap; }
.observation.is-done .obs-state { color: #d18668; }

.spaceland-return {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin-top: 13px;
  padding: 13px 14px;
  border: 1px solid rgba(209, 134, 104, .5);
  color: #e2a07f;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: .12em;
  transition: background .25s, color .25s;
}

.spaceland-return.is-visible { display: flex; }
.spaceland-return:hover { background: #d18668; color: #15110e; }
.spaceland-return-arrow { font-family: var(--mono); font-size: 14px; }

.spaceland-coords {
  position: absolute;
  right: clamp(20px, 4vw, 58px);
  bottom: clamp(20px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .14em;
  color: rgba(244, 239, 228, .28);
}

/* ── pointland ── */

#pointland {
  z-index: 29;
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 3.4vw, 48px) clamp(22px, 5vw, 80px);
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 48%, rgba(186, 113, 78, .16), transparent 27%),
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, .035), transparent 52%),
    #070908;
}

.pointland-head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(244, 239, 228, .13);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .16em;
  color: rgba(244, 239, 228, .38);
}

.pointland-head span:first-child { color: #d18668; }

.pointland-center {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
}

.pointland-dot {
  position: relative;
  z-index: 2;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f6d9c2;
  box-shadow:
    0 0 18px 4px rgba(245, 196, 159, .8),
    0 0 80px 20px rgba(209, 122, 85, .25);
  animation: point-pulse 3.2s ease-in-out infinite;
}

.pointland-glow {
  position: absolute;
  width: min(26vw, 260px);
  height: min(26vw, 260px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(236, 190, 152, .18), rgba(236, 190, 152, 0) 68%);
  animation: point-breathe 7s ease-in-out infinite;
}

.pointland-ring {
  position: absolute;
  width: min(40vw, 430px);
  aspect-ratio: 1;
  border: 1px solid rgba(244, 239, 228, .08);
  border-radius: 50%;
}

.pointland-ring-b { width: min(62vw, 650px); border-color: rgba(244, 239, 228, .045); }

.pointland-label {
  position: absolute;
  margin-top: min(28vw, 300px);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .3em;
  color: rgba(244, 239, 228, .22);
}

@keyframes point-pulse {
  0%, 100% { transform: scale(1); opacity: .8; }
  50% { transform: scale(1.5); opacity: 1; }
}

@keyframes point-breathe {
  0%, 100% { transform: scale(.88); opacity: .6; }
  50% { transform: scale(1.12); opacity: 1; }
}

.pointland-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding-top: 16px;
  border-top: 1px solid rgba(244, 239, 228, .13);
}

.pointland-bottom p {
  margin: 0;
  max-width: 32em;
  font-family: var(--serif);
  font-size: clamp(13px, 1.2vw, 17px);
  line-height: 1.9;
  color: rgba(244, 239, 228, .56);
}

.point-button {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  border: 1px solid rgba(209, 134, 104, .45);
  color: #e2a07f;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: .1em;
  white-space: nowrap;
  transition: background .25s, color .25s;
}

.point-button:hover { background: #d18668; color: #120e0c; }
.point-button kbd { border-color: rgba(244, 239, 228, .2); color: rgba(244, 239, 228, .45); }

.pointland-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .14em;
  color: rgba(244, 239, 228, .24);
}

.pointland-bottom.is-speaking { opacity: .2; pointer-events: none; }

/* responsive for new chapters */
@media (max-width: 900px) {
  .feeling-grid { grid-template-columns: 1fr; gap: 14px; }
  .feeling-copy p { display: none; }
  .feeling-copy h2 { font-size: clamp(30px, 7vw, 46px); margin-bottom: 12px; }
  .feeling-copy .feeling-rules { display: none; }
  .feeling-round-label { margin-top: 8px; }
  .feeling-chamber { width: min(74vw, 400px); }
  #feeling .ritual-frame { min-height: calc(100vh - 24px); padding: 16px 18px; gap: 10px; }
  .colour-grid { grid-template-columns: 1fr; gap: 14px; align-content: center; }
  .colour-copy h2 { font-size: clamp(32px, 8vw, 50px); margin-bottom: 12px; }
  .colour-copy p { max-width: none; font-size: 12.5px; line-height: 1.8; }
  #colour .ritual-frame { padding: 16px 16px; overflow-y: auto; }
  .colour-workbench { gap: 10px; }
  .colour-stage { gap: 7px; padding: 8px; }
  .colour-shape { aspect-ratio: 1.1; }
  .colour-shape svg { width: 48%; }
  .colour-shape .shape-name { display: none; }
  .colour-bottom { align-items: flex-start; flex-direction: column; gap: 8px; }
  .colour-actions { justify-content: flex-start; }
  .colour-palette-wrap { gap: 10px; }
  .swatch { width: 26px; height: 26px; }
  .spaceland-panel {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    transform: none;
    width: auto;
    max-height: 58vh;
    padding: 17px 16px 14px;
  }
  .spaceland-panel h2 { font-size: 28px; margin: 12px 0 8px; }
  .spaceland-lede { font-size: 11px; margin-bottom: 10px; }
  .spaceland-head { font-size: 6px; }
  .observation { padding: 9px 8px; }
  .obs-title { font-size: 13px; }
  .obs-desc { font-size: 7.5px; }
  .spaceland-coords { display: none; }
  #pointland { padding: 16px 18px 14px; }
  .pointland-bottom { flex-direction: column; align-items: stretch; gap: 10px; }
  .pointland-bottom p { font-size: 12px; }
  .point-button { justify-content: space-between; }
  .pointland-label { margin-top: 250px; }
}

@media (max-width: 480px) {
  .ritual-head { font-size: 6px; letter-spacing: .1em; }
  .ritual-foot { font-size: 5.5px; }
  .feeling-chamber { width: min(80vw, 330px); }
  .feeling-copy h2 { font-size: 30px; }
  .ritual-kicker { margin-bottom: 8px; }
  .feeling-count-wrap span { font-size: 40px; }
  .colour-stage { grid-template-columns: 1fr 1fr; }
  .colour-copy p { font-size: 11.5px; }
  #colour .ritual-frame { padding: 14px 14px; }
  .palette-label { display: none; }
  .spaceland-panel { max-height: 61vh; }
  .observation { grid-template-columns: 22px 1fr auto; gap: 7px; }
}

/* keep ritual rooms below the dialogue sheet */
#feeling, #colour { z-index: 39; }
#feeling.is-covered { pointer-events: none; }

/* full-bleed ritual backdrops */
#feeling { background: #0d100e; }
#colour { background: var(--paper); }

/* keep the trial's big phrase on two comfortable lines */
.feeling-copy h2 {
  font-size: clamp(34px, 4.2vw, 58px);
  line-height: 1.3;
}

@media (max-width: 900px) {
  .feeling-copy h2 { font-size: clamp(28px, 7vw, 42px); }
}

/* colour grid must be able to shrink inside the page */
.colour-grid { min-width: 0; }
.colour-grid > * { min-width: 0; }
.colour-workbench { min-width: 0; width: 100%; }
.colour-stage { min-width: 0; }
.colour-shape { min-width: 0; }
@media (max-width: 900px) {
  .colour-copy h2 { font-size: clamp(30px, 7.6vw, 46px); }
}

@media (max-width: 900px) {
  .colour-edict {
    left: 16px;
    right: 16px;
    bottom: 118px;
    width: auto;
    transform: none;
    padding: 12px 16px;
  }
  .colour-edict p { font-size: 12px; }
}

@media (max-width: 900px) {
  .ritual-btn kbd, .point-button kbd { display: none; }
  .entry-count { min-width: 15px; height: 15px; font-size: 6.5px; }
}

/* ───────────────────────────── voice / reader ───────────────────────────── */
.voice-btn {
  gap: 6px;
}

.voice-indicator {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(180, 64, 42, .12);
  transition: background .25s, box-shadow .25s, opacity .25s;
}

.voice-btn[aria-pressed="false"] .voice-indicator {
  background: transparent;
  border: 1px solid var(--muted);
  box-shadow: none;
}

body.is-voice-speaking .voice-indicator {
  animation: voice-pulse 1.1s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(180, 64, 42, .12); opacity: .8; }
  50% { box-shadow: 0 0 0 5px rgba(180, 64, 42, .04), 0 0 12px rgba(180, 64, 42, .5); opacity: 1; }
}

.cover-voice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .06em;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .08);
  transition: border-color .25s, background .25s, color .25s;
}

.cover-voice:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, .25);
  color: var(--ink);
}

.cover-voice-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(180, 64, 42, .12);
}

.cover-voice[aria-pressed="false"] .cover-voice-dot {
  background: transparent;
  border: 1px solid var(--muted);
  box-shadow: none;
}

.cover-voice-key {
  padding-left: 6px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 6.5px;
}

@media (max-width: 780px) {
  .cover-voice {
    order: 3;
    margin-top: 2px;
  }
}

@media (max-width: 360px) {
  .voice-btn > span:not(.hud-btn-key):not(.voice-indicator) { display: none; }
  .voice-btn { width: 26px; padding: 0; }
}

.hud-btn:disabled, .cover-voice:disabled {
  opacity: .32;
  cursor: not-allowed;
  pointer-events: none;
}

/* live reading indicator in the dialogue header */
.voice-live {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  margin-left: 2px;
  align-self: center;
}

.voice-live i {
  display: block;
  width: 1.5px;
  height: 5px;
  background: var(--accent);
  transform-origin: bottom;
  animation: voice-bar .7s ease-in-out infinite alternate;
}

.voice-live i:nth-child(2) { height: 9px; animation-delay: .15s; }
.voice-live i:nth-child(3) { height: 6px; animation-delay: .3s; }

body.is-voice-speaking .voice-live { display: inline-flex; }

@keyframes voice-bar {
  from { transform: scaleY(.45); opacity: .45; }
  to { transform: scaleY(1); opacity: 1; }
}

body.is-ascended .voice-live i { background: #d97d63; }

/* voice toggle inside dialogue */
.dialogue-foot-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dialogue-voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .08em;
  color: var(--muted);
  transition: color .2s, border-color .2s, background .2s;
}

.dialogue-voice-btn:hover {
  border-color: var(--line);
  color: var(--ink);
}

.dialogue-voice-btn.is-on { color: var(--ink-soft); }
.dialogue-voice-btn .dialogue-voice-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.dialogue-voice-btn:not(.is-on) .dialogue-voice-dot {
  background: transparent;
  border: 1px solid var(--muted);
}
.dialogue-voice-btn kbd { display: none; }
@media (min-width: 781px) {
  .dialogue-voice-btn kbd { display: inline-block; font-size: 5.5px; padding: 2px 3px 1px; opacity: .5; }
}
body.is-ascended .dialogue-voice-btn { color: rgba(244, 239, 228, .5); }
body.is-ascended .dialogue-voice-btn:hover { border-color: rgba(244, 239, 228, .18); color: var(--cream); }
body.is-ascended .dialogue-voice-btn.is-on { color: rgba(244, 239, 228, .72); }
body.is-ascended .dialogue-foot-right { color: rgba(244, 239, 228, .45); }

/* make the in-dialogue voice control a real tap target */
.dialogue-voice-btn {
  min-height: 22px;
  padding: 4px 7px;
  border-color: var(--line);
  background: rgba(255, 255, 255, .1);
}

.dialogue-voice-btn:hover {
  background: rgba(255, 255, 255, .35);
}

@media (max-width: 780px) {
  .dialogue-voice-btn {
    min-height: 26px;
    padding: 6px 8px;
    font-size: 7px;
    gap: 5px;
  }
  .dialogue-foot-right { gap: 8px; }
}
body.is-ascended .dialogue-voice-btn {
  border-color: rgba(244, 239, 228, .18);
  background: rgba(255, 255, 255, .03);
}
body.is-ascended .dialogue-voice-btn:hover {
  background: rgba(244, 239, 228, .1);
}

/* ───────────────────────────── voice casting ───────────────────────────── */
.cover-cast {
  padding: 8px 9px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .08em;
  color: var(--muted);
  background: rgba(255, 255, 255, .08);
  transition: color .2s, border-color .2s, background .2s;
}
.cover-cast:hover { color: var(--ink); border-color: var(--line-strong); background: rgba(255,255,255,.25); }

.dialogue-cast-btn {
  min-height: 22px;
  padding: 4px 5px;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .06em;
  color: var(--muted);
  transition: color .2s, border-color .2s, background .2s;
}
.dialogue-cast-btn:hover { color: var(--ink); border-color: var(--line); background: rgba(255,255,255,.25); }
body.is-ascended .dialogue-cast-btn { color: rgba(244,239,228,.38); }
body.is-ascended .dialogue-cast-btn:hover { color: var(--cream); border-color: rgba(244,239,228,.18); }

#voice-settings {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s var(--ease), visibility .35s;
}

#voice-settings.is-visible { opacity: 1; visibility: visible; }

.voice-settings-scrim {
  position: absolute;
  inset: 0;
  background: rgba(16, 18, 15, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.voice-settings-card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid rgba(25, 23, 20, .5);
  background:
    linear-gradient(110deg, rgba(255, 255, 255, .24), transparent 48%),
    var(--paper-light);
  box-shadow: 0 28px 80px rgba(10, 9, 6, .35);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.voice-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.voice-settings-kicker {
  display: block;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .22em;
  color: var(--accent);
}

.voice-settings-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 400;
  letter-spacing: .08em;
}

.voice-settings-intro {
  margin: 15px 0 20px;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.85;
  letter-spacing: .02em;
  color: var(--ink-soft);
}

.voice-settings-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.voice-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .95fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .14);
}

.voice-setting-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.voice-setting-label { font-family: var(--serif); font-size: 16px; letter-spacing: .08em; }
.voice-setting-desc { font-family: var(--sans); font-size: 8px; line-height: 1.5; color: var(--muted); }

.voice-setting-row select {
  width: 100%;
  min-width: 0;
  padding: 9px 28px 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .02em;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.voice-preview-btn {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .1em;
  color: var(--ink);
  transition: background .2s, color .2s;
}
.voice-preview-btn:hover { background: var(--ink); color: var(--cream); }

.voice-settings-note {
  margin: 16px 0 18px;
  font-family: var(--mono);
  font-size: 6.5px;
  line-height: 1.7;
  letter-spacing: .04em;
  color: var(--muted);
}

.voice-settings-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 780px) {
  .hud-actions { gap: 6px; }
  .hud-btn { padding: 0 7px; }
  .cover-cast { order: 4; }
  .voice-settings-card { padding: 20px 17px; max-height: calc(100vh - 24px); }
  .voice-settings-intro { font-size: 11px; line-height: 1.8; }
  .voice-setting-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 11px 12px;
  }
  .voice-setting-copy { grid-column: 1 / -1; }
  .voice-setting-row select { font-size: 11px; padding: 8px 24px 8px 8px; }
  .voice-preview-btn { min-height: 30px; padding: 0 9px; }
  .voice-settings-actions { gap: 8px; }
  .voice-settings-actions .text-btn { padding: 9px 11px; font-size: 7px; }
}

/* ───────────────────────────── bilingual layout ───────────────────────────── */
.cover-lang {
  padding: 8px 9px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .1em;
  color: var(--muted);
  background: rgba(255, 255, 255, .08);
  transition: color .2s, border-color .2s, background .2s;
}
.cover-lang:hover { color: var(--ink); border-color: var(--line-strong); background: rgba(255,255,255,.25); }

.lang-btn { font-family: var(--mono); font-size: 7px; letter-spacing: .06em; color: var(--ink-soft); }

body.lang-en {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body.lang-en .title-cn {
  display: block;
  font-family: var(--serif);
  font-size: clamp(52px, 7.4vw, 112px);
  line-height: .92;
  letter-spacing: .055em;
  white-space: nowrap;
}

body.lang-en .title-cn span { animation-delay: .35s; }

body.lang-en .title-en {
  margin-top: clamp(15px, 2vh, 22px);
  font-size: clamp(7px, .68vw, 10px);
  letter-spacing: .16em;
  white-space: nowrap;
}

body.lang-en .cover-lede {
  max-width: 34em;
  line-height: 1.9;
}

body.lang-en .cover-controls,
body.lang-en .cover-duration { letter-spacing: .03em; }

body.lang-en .brand-sub { letter-spacing: .1em; }

body.lang-en .dialogue-text { letter-spacing: .01em; line-height: 1.85; }
body.lang-en .ending-story { letter-spacing: .01em; line-height: 1.95; }

@media (max-width: 780px) {
  body.lang-en .title-cn { font-size: clamp(48px, 13.5vw, 72px); }
  body.lang-en .title-en { white-space: normal; line-height: 1.6; }
  body.lang-en .cover-lang { order: 5; }
  .lang-btn { width: 26px; padding: 0; }
}
@media (max-width: 360px) {
  .lang-btn span { font-size: 6px; }
}

/* ───────────────────────────── the ladder of worlds ───────────────────────────── */
#ladder {
  position: absolute;
  inset: 0;
  z-index: 46;
  overflow-y: auto;
  color: var(--cream);
  background:
    radial-gradient(ellipse 56% 64% at 49% 44%, rgba(185, 116, 82, .1), transparent 68%),
    linear-gradient(155deg, #171a16, #090b09 72%);
  opacity: 0;
  visibility: hidden;
  transition: opacity .8s var(--ease), visibility .8s;
}

#ladder.is-visible { opacity: 1; visibility: visible; }

.ladder-shell {
  height: 100%;
  padding: clamp(16px, 3vw, 34px) clamp(18px, 4vw, 54px) 14px;
  display: flex;
  flex-direction: column;
}

.ladder-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(244, 239, 228, .16);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .16em;
  color: rgba(244, 239, 228, .42);
}

.ladder-head span:first-child { color: #d18668; }

.ladder-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 104px minmax(0, 1.18fr) minmax(280px, .82fr);
  gap: clamp(16px, 2.6vw, 38px);
  align-items: stretch;
  padding: clamp(14px, 2.4vh, 26px) 0;
}

.ladder-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.ladder-rail::before {
  content: "";
  position: absolute;
  top: 8%;
  bottom: 8%;
  left: 14px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(244, 239, 228, .16) 12%, rgba(244, 239, 228, .16) 88%, transparent);
}

.ladder-rung-btn {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 7px;
  text-align: left;
  padding: 6px 0;
  color: rgba(244, 239, 228, .32);
  transition: color .25s;
}

.ladder-rung-btn .rung-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(244, 239, 228, .18);
  border-radius: 50%;
  background: #141713;
  font-family: var(--mono);
  font-size: 8px;
  transition: border-color .25s, background .25s, color .25s;
}

.ladder-rung-btn .rung-label {
  font-family: var(--mono);
  font-size: 6.5px;
  line-height: 1.6;
  letter-spacing: .1em;
  opacity: .7;
}

.ladder-rung-btn:hover { color: rgba(244, 239, 228, .75); }
.ladder-rung-btn.is-current { color: var(--cream); }
.ladder-rung-btn.is-current .rung-dot {
  border-color: #d18668;
  background: rgba(209, 134, 104, .16);
  color: #e2a07f;
  box-shadow: 0 0 20px rgba(209, 134, 104, .2);
}

.ladder-rung-btn.is-visited .rung-dot { border-color: rgba(209, 134, 104, .4); }

.ladder-visual {
  position: relative;
  min-height: 0;
  border: 1px solid rgba(244, 239, 228, .17);
  background: rgba(0, 0, 0, .18);
  overflow: hidden;
}

#ladder-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#ladder-canvas:active { cursor: grabbing; }

.ladder-visual-foot {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.ladder-badge {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(209, 134, 104, .48);
  color: #e2a07f;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .1em;
}

.ladder-hint {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .13em;
  color: rgba(244, 239, 228, .32);
}

.ladder-shadow {
  position: absolute;
  top: 14px;
  right: 14px;
  max-width: 44%;
  text-align: right;
  font-family: var(--mono);
  font-size: 6.5px;
  line-height: 1.7;
  letter-spacing: .06em;
  color: rgba(244, 239, 228, .36);
  pointer-events: none;
}

.ladder-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 0;
}

.ladder-kicker {
  display: block;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .2em;
  color: #d18668;
}

.ladder-copy h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: clamp(30px, 3.3vw, 48px);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: .03em;
}

.ladder-copy p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(12px, 1.05vw, 15px);
  line-height: 1.9;
  color: rgba(244, 239, 228, .6);
}

.ladder-insight {
  margin-top: 14px !important;
  padding-left: 12px;
  border-left: 1px solid rgba(209, 134, 104, .6);
  color: rgba(244, 239, 228, .82) !important;
  font-size: clamp(13px, 1.12vw, 16px) !important;
  letter-spacing: .02em;
}

.ladder-quiz {
  display: none;
  margin-top: 17px;
  padding-top: 13px;
  border-top: 1px solid rgba(244, 239, 228, .13);
}

.ladder-quiz.is-visible { display: block; }

.ladder-question {
  margin-bottom: 9px;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(244, 239, 228, .8);
}

.ladder-answer {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(244, 239, 228, .18);
  text-align: left;
  font-family: var(--serif);
  font-size: 12px;
  color: rgba(244, 239, 228, .72);
  transition: background .2s, border-color .2s, color .2s;
}

.ladder-answer:hover {
  background: rgba(244, 239, 228, .08);
  border-color: rgba(244, 239, 228, .4);
  color: var(--cream);
}

.ladder-answer.is-correct {
  border-color: #d18668;
  background: rgba(209, 134, 104, .13);
  color: #e2a07f;
}

.ladder-answer.is-wrong { border-color: rgba(180, 64, 42, .6); color: #df8a71; }

.ladder-feedback {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 6.5px;
  line-height: 1.7;
  letter-spacing: .05em;
  color: rgba(244, 239, 228, .42);
}

.ladder-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.ladder-btn {
  min-height: 32px;
  padding: 8px 13px;
  border: 1px solid rgba(244, 239, 228, .24);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .1em;
  color: rgba(244, 239, 228, .8);
  transition: background .2s, border-color .2s, color .2s;
}

.ladder-btn:hover { background: var(--cream); border-color: var(--cream); color: var(--ink); }
.ladder-btn:disabled { opacity: .25; pointer-events: none; }
.ladder-btn.is-accent { border-color: #d18668; color: #e2a07f; }
.ladder-btn.is-accent:hover { background: #d18668; color: var(--ink); }

.ladder-foot {
  display: flex;
  justify-content: space-between;
  padding-top: 9px;
  border-top: 1px solid rgba(244, 239, 228, .12);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .15em;
  color: rgba(244, 239, 228, .28);
}

@media (max-width: 980px) {
  .ladder-grid {
    grid-template-columns: 74px minmax(0, 1fr) minmax(250px, .85fr);
    gap: 16px;
  }
  .ladder-rung-btn { grid-template-columns: 24px 1fr; gap: 5px; }
  .ladder-rung-btn .rung-dot { width: 24px; height: 24px; }
  .ladder-rail::before { left: 12px; }
  .ladder-rung-btn .rung-label { display: none; }
}

@media (max-width: 780px) {
  #ladder { overflow-y: auto; }
  .ladder-shell { height: auto; min-height: 100%; padding: 14px 14px 12px; }
  .ladder-head { font-size: 6px; }
  .ladder-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
  }
  .ladder-rail {
    flex-direction: row;
    justify-content: flex-start;
    gap: 7px;
    order: 0;
  }
  .ladder-rail::before { display: none; }
  .ladder-rung-btn { display: block; }
  .ladder-rung-btn .rung-label { display: none; }
  .ladder-rung-btn .rung-dot { width: 28px; height: 28px; }
  .ladder-visual { height: 39vh; min-height: 250px; order: 1; }
  .ladder-copy { order: 2; padding: 2px 0 0; }
  .ladder-copy h2 { font-size: 31px; margin-bottom: 8px; }
  .ladder-copy p { font-size: 13px; line-height: 1.8; }
  .ladder-kicker { margin-bottom: 6px; }
  .ladder-insight { margin-top: 10px !important; font-size: 13px !important; }
  .ladder-actions { margin-top: 12px; }
  .ladder-foot { font-size: 6px; }
  .ladder-shadow { top: 10px; right: 10px; font-size: 6px; }
  .ladder-visual-foot { left: 10px; right: 10px; bottom: 9px; }
}

#ladder.is-paper .ladder-shadow,
#ladder.is-paper .ladder-hint { color: rgba(25, 23, 20, .46); }
#ladder.is-paper .ladder-badge {
  border-color: rgba(180, 64, 42, .55);
  color: #b4402a;
}
#ladder.is-paper #ladder-canvas { cursor: grab; }
.ladder-actions .ladder-btn:first-child {
  min-width: 34px;
  font-size: 11px;
  line-height: 1;
}
.ladder-shadow {
  font-size: 7px;
  color: rgba(244, 239, 228, .44);
}

.ladder-actions .ladder-btn:first-child {
  min-width: 48px;
  font-size: 7px;
}
.ladder-note {
  display: inline-block;
  margin-top: 7px;
  color: #d18668;
  letter-spacing: .08em;
}

.spaceland-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.spaceland-journal {
  display: none;
  padding: 9px 12px;
  border: 1px solid rgba(244, 239, 228, .25);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .1em;
  color: rgba(244, 239, 228, .62);
}
.spaceland-journal.is-visible { display: inline-block; }
.spaceland-journal:hover { border-color: var(--cream); color: var(--cream); }

/* One good narrator voice: no visible voice-casting controls. */
#voice-settings-btn,
#cover-cast,
#dialogue-cast-btn {
  display: none !important;
}
