/* ————————————————————————————————————————————————————————————————
   Luzura & Chino — The Pilgrimage
   deep jungle dark · dawn gold · bone · the white road
   ———————————————————————————————————————————————————————————————— */

:root {
  --ink: #e9e0cb;
  --ink-dim: #b3a98e;
  --ink-faint: #7d755f;
  --gold: #e8c48a;
  --gold-bright: #ffdca4;
  --paper: #f2ebda;
  --paper-ink: #241c12;
  --dark: #060a08;
  --hairline: rgba(232, 196, 138, 0.22);
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --label: 'Marcellus', 'Cormorant Garamond', Georgia, serif;
  /* how far the dock is lifted off the bottom edge — the chapter panel stacks
     on top of it, so both read the same number */
  --dock-lift: 1.1rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }
html, body { background: var(--dark); }
body {
  font-family: var(--serif);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* the walk is a touch instrument: one finger scrolls, holds mean something,
     and the OS gestures (pinch, double-tap, long-press callout) stay out of it */
  touch-action: pan-y;
  overscroll-behavior-y: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
html.reader-open, html.reader-open body { overflow: hidden; }
html.gated, html.gated body { overflow: hidden; } /* the world waits behind the enter button */
button, .rail-node, #ab-chapters li { touch-action: manipulation; }

::selection { background: rgba(232, 196, 138, 0.28); color: #fff8ea; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#scroll-space { position: relative; z-index: 1; pointer-events: none; }

/* ————— atmosphere overlays ————— */
#vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 52%, rgba(2, 5, 3, 0.42) 100%),
    linear-gradient(to bottom, rgba(2, 5, 3, 0.30), transparent 18%, transparent 82%, rgba(2, 5, 3, 0.38));
}
#grain {
  position: fixed; inset: -100px; z-index: 3; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.7'/%3E%3C/svg%3E");
}
#flash {
  position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at 50% 45%, #fff7e6 0%, #ffe9bd 55%, #f7d291 100%);
  transition: opacity 0.12s linear;
}

/* ————— hero ————— */
#hero {
  position: fixed; inset: 0; z-index: 10; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 1.35rem;
}
#hero .kicker {
  font-family: var(--label);
  font-size: 0.72rem; letter-spacing: 0.42em; text-indent: 0.42em;
  color: var(--ink-dim); text-transform: uppercase;
}
#hero h1 {
  font-family: var(--label);
  font-weight: 400;
  font-size: clamp(2.5rem, 7.2vw, 5.4rem);
  letter-spacing: 0.16em; text-indent: 0.16em;
  line-height: 1.08; color: #f2e8d2;
  text-shadow: 0 2px 34px rgba(0, 0, 0, 0.65);
}
#hero .rule {
  width: 120px; height: 1px;
  background: linear-gradient(to right, transparent, var(--hairline) 20%, var(--gold) 50%, var(--hairline) 80%, transparent);
}
#hero .sub {
  font-style: italic; font-weight: 400;
  font-size: clamp(1.25rem, 2.6vw, 1.8rem);
  color: var(--gold);
}
#hero .scroll-hint {
  position: absolute; bottom: 12rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.8rem;
  font-family: var(--label); font-size: 0.66rem; letter-spacing: 0.34em; text-indent: 0.34em;
  text-transform: uppercase; color: #8a8070;
}
#hero .scroll-hint .line {
  width: 1px; height: 52px;
  background: linear-gradient(to bottom, transparent, var(--gold));
  animation: fall 2.6s ease-in-out infinite;
  transform-origin: top;
}
@keyframes fall {
  0% { transform: scaleY(0); opacity: 0; }
  35% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1) translateY(30px); opacity: 0; }
}

/* ————— header ————— */
header#top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.5rem 2.2rem;
  padding-top: max(1.5rem, env(safe-area-inset-top));
  pointer-events: none;
}
.wordmark {
  font-family: var(--label); font-size: 0.82rem;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-dim);
  pointer-events: auto;
}
.wordmark b { color: var(--gold); font-weight: 400; }
.top-actions { display: flex; gap: 0.7rem; pointer-events: auto; }
.ghost-btn {
  font-family: var(--label); font-size: 0.68rem;
  letter-spacing: 0.24em; text-indent: 0.24em; text-transform: uppercase;
  color: var(--ink-dim);
  background: rgba(4, 8, 5, 0.35);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.62rem 1.15rem 0.58rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: color 0.25s, border-color 0.25s;
}
.ghost-btn:hover { color: var(--gold-bright); border-color: rgba(232, 196, 138, 0.5); }
.ghost-btn.on { color: var(--gold-bright); border-color: rgba(232, 196, 138, 0.55); background: rgba(232, 196, 138, 0.1); }

/* ————— zone label ————— */
#zone-label {
  position: fixed; top: 1.6rem; left: 50%; transform: translateX(-50%);
  z-index: 15; pointer-events: none;
  font-family: var(--label); font-size: 0.68rem;
  letter-spacing: 0.4em; text-indent: 0.4em; text-transform: uppercase;
  color: var(--ink-faint);
  opacity: 0; transition: opacity 0.8s;
}

/* ————— cards ————— */
#cards {
  position: fixed; inset: 0; z-index: 12; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.card {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(34rem, 86vw);
  text-align: center;
  opacity: 0; visibility: hidden;
}
.card p {
  font-size: clamp(1.28rem, 2.4vw, 1.62rem);
  font-weight: 400; line-height: 1.62;
  color: var(--ink);
  text-shadow: 0 1px 22px rgba(0, 0, 0, 0.85), 0 0 60px rgba(0, 0, 0, 0.5);
  hyphens: none;
}
.card p + p { margin-top: 1.1em; }
.card .who {
  font-family: var(--label); font-size: 0.64rem;
  letter-spacing: 0.4em; text-indent: 0.4em; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
}
.card .who::after {
  content: ''; display: block; width: 34px; height: 1px;
  background: var(--hairline); margin: 0.85rem auto 0;
}
.card.voice p { font-style: italic; color: #f3ddb4; }
.card.cardinal p {
  font-family: var(--label);
  font-size: clamp(1.7rem, 3.6vw, 2.7rem);
  letter-spacing: 0.1em; line-height: 1.3;
  color: #f5ecd8;
}

/* ————— chapter rail ————— */
#rail {
  position: fixed; right: 2rem; top: 50%; transform: translateY(-50%);
  z-index: 16; height: min(46vh, 420px); width: 30px;
}
#rail::before {
  content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(to bottom, transparent, var(--hairline) 12%, var(--hairline) 88%, transparent);
}
.rail-node {
  position: absolute; right: -7px; transform: translateY(-50%);
  width: 44px; height: 44px; /* keeps the visual numeral; the touch target is the whole cell */
  display: grid; place-items: center;
  background: none; border: 0; cursor: pointer;
  font-family: var(--label); font-size: 0.6rem; letter-spacing: 0.1em;
  color: var(--ink-faint);
  transition: color 0.3s;
  pointer-events: auto;
}
.rail-node span { display: block; text-align: center; }
.rail-node i {
  position: absolute; right: 130%; top: 50%; transform: translateY(-50%);
  font-style: normal; font-size: 0.62rem; letter-spacing: 0.22em; text-transform: uppercase;
  white-space: nowrap; color: var(--ink-dim);
  opacity: 0; transition: opacity 0.25s;
  font-family: var(--label);
}
.rail-node:hover i, .rail-node:focus-visible i { opacity: 1; }
.rail-node.past { color: var(--gold); }
.rail-node:hover { color: var(--gold-bright); }

/* ————— the gate (the looking away) ————— */
#gate {
  position: fixed; inset: 0; z-index: 18; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 17vh;
  padding-bottom: max(17vh, calc(env(safe-area-inset-bottom) + 12vh));
  opacity: 0; transition: opacity 1.2s ease;
}
#gate.on { opacity: 1; }
#gate-line {
  font-style: italic; font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  color: #f3ddb4; text-align: center;
  text-shadow: 0 1px 20px rgba(0, 0, 0, 0.9);
  min-height: 2.4em; max-width: min(36rem, 88vw);
  transition: opacity 0.5s;
}
#gate-hold {
  margin-top: 2.2rem;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
#gate-hold .track {
  width: 150px; height: 1px; background: rgba(232, 196, 138, 0.22);
  position: relative; overflow: visible;
}
#gate-hold .track::after {
  content: ''; position: absolute; left: 0; top: -1px; height: 3px; width: var(--h, 0%);
  background: var(--gold-bright);
  box-shadow: 0 0 12px rgba(255, 220, 164, 0.8);
  transition: width 0.1s linear;
}
#gate-hold .word {
  font-family: var(--label); font-size: 0.66rem;
  letter-spacing: 0.34em; text-indent: 0.34em; text-transform: uppercase;
  color: var(--ink-dim);
  animation: pulse 2.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ————— audiobook bar ————— */
#ab-panel {
  position: fixed; right: 1.4rem; bottom: 5.6rem; z-index: 30;
  width: min(23rem, calc(100vw - 2.8rem));
  background: rgba(6, 10, 8, 0.92);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  backdrop-filter: blur(14px);
  padding: 1.1rem 1.2rem;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
#ab-panel.on { opacity: 1; transform: none; pointer-events: auto; }
.ab-head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.6rem;
  font-family: var(--label); font-size: 0.58rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold);
  white-space: nowrap;
  padding-bottom: 0.8rem; margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(232, 196, 138, 0.14);
}
#ab-follow-wrap {
  display: flex; align-items: center; gap: 0.5rem; cursor: pointer;
  font-size: 0.58rem; letter-spacing: 0.18em; color: var(--ink-dim);
}
#ab-follow-wrap input { display: none; }
#ab-follow-wrap i {
  width: 26px; height: 14px; border-radius: 999px;
  border: 1px solid var(--hairline); position: relative; transition: background 0.25s;
}
#ab-follow-wrap i::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--ink-dim); transition: transform 0.25s, background 0.25s;
}
#ab-follow-wrap input:checked + i { background: rgba(232, 196, 138, 0.18); }
#ab-follow-wrap input:checked + i::after { transform: translateX(12px); background: var(--gold-bright); }
#ab-chapters { list-style: none; }
#ab-chapters li {
  display: grid; grid-template-columns: 2rem 1fr auto; align-items: baseline; gap: 0.6rem;
  padding: 0.5rem 0.4rem; border-radius: 6px; cursor: pointer;
  transition: background 0.2s;
}
#ab-chapters li:hover { background: rgba(232, 196, 138, 0.07); }
#ab-chapters li.now { background: rgba(232, 196, 138, 0.1); }
.ab-n { font-family: var(--label); font-size: 0.62rem; color: var(--gold); }
.ab-t { font-size: 1.02rem; color: var(--ink); }
.ab-d { font-size: 0.72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; min-width: 3rem; text-align: right; }
.ab-note { font-size: 0.92rem; font-style: italic; color: var(--ink-faint); margin-top: 0.8rem; line-height: 1.5; }

#audiobar {
  position: fixed; left: 50%; bottom: 1.1rem; transform: translateX(-50%);
  bottom: max(1.1rem, calc(env(safe-area-inset-bottom) + 0.7rem));
  z-index: 30;
  width: min(40rem, calc(100vw - 2rem));
  /* four children: play | what-and-where | the track | chapters.
     A three-column grid wrapped the chapter button onto a second row and
     doubled the pill's height — that was the "broken" dock. */
  display: grid; grid-template-columns: auto minmax(0, 13rem) minmax(0, 1fr) auto;
  align-items: center; gap: 0.9rem;
  background: rgba(6, 10, 8, 0.82);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.55rem 1.2rem 0.55rem 0.7rem;
  backdrop-filter: blur(14px);
  opacity: 0.92; transition: opacity 0.6s ease;
}
#audiobar.idle { opacity: 0.62; }
#audiobar.idle:hover { opacity: 0.95; }
#ab-play {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--hairline);
  background: rgba(232, 196, 138, 0.1);
  color: var(--gold-bright);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.25s, transform 0.15s;
}
#ab-play:hover { background: rgba(232, 196, 138, 0.22); }
#ab-play:active { transform: scale(0.94); }
#ab-meta { min-width: 0; }
#ab-chapter {
  font-size: 1.02rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#ab-time { font-size: 0.72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; letter-spacing: 0.06em; margin-top: 0.1rem; }
#ab-track {
  position: relative; height: 22px; cursor: pointer; min-width: 6rem;
}
#ab-track::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px;
  background: rgba(232, 196, 138, 0.2);
}
#ab-fill {
  position: absolute; left: 0; top: 50%; height: 1px; width: 0%;
  background: var(--gold-bright);
  box-shadow: 0 0 8px rgba(255, 220, 164, 0.7);
}
#ab-ticks i {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 1px; height: 7px; background: rgba(232, 196, 138, 0.45);
}
#ab-list {
  background: none; border: 0; color: var(--ink-dim); cursor: pointer;
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; transition: color 0.2s;
}
#ab-list:hover { color: var(--gold-bright); }

/* ————— reader (the whole book) ————— */
#reader {
  /* The reader has its own light: the walk is nocturnal, so the book opens
     dark and can be turned to paper. --rd-scale is the reader's text size,
     stepped by the A-/A+ control and remembered per reader. */
  --rd-bg: #0c0f0d;
  --rd-ink: #e4dcc9;
  --rd-ink-soft: #a99d84;
  --rd-faint: #7d7361;
  --rd-accent: #d8ab6a;
  --rd-rule: rgba(216, 171, 106, 0.28);
  --rd-chip: rgba(18, 22, 19, 0.86);
  --rd-chip-edge: rgba(216, 171, 106, 0.3);
  --rd-scale: 1;
  position: fixed; inset: 0; z-index: 50;
  background: var(--rd-bg);
  color: var(--rd-ink);
  overflow-y: auto;
  /* reading is reading: the page selects, and pinch-zoom stays available */
  touch-action: pan-y pinch-zoom;
  -webkit-user-select: text;
  user-select: text;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  opacity: 0; pointer-events: none; transition: opacity 0.45s ease;
}
#reader.on { opacity: 1; pointer-events: auto; }
#reader.paper {
  --rd-bg: var(--paper);
  --rd-ink: #2c2314;
  --rd-ink-soft: #6d5c42;
  --rd-faint: #8a7350;
  --rd-accent: #8a6a3a;
  --rd-rule: rgba(60, 45, 25, 0.3);
  --rd-chip: rgba(242, 235, 218, 0.85);
  --rd-chip-edge: rgba(60, 45, 25, 0.25);
}
#reader-inner { max-width: 38rem; margin: 0 auto; padding: 6rem 1.6rem 8rem; }
#reader-close {
  position: fixed; top: 1.4rem; right: 1.6rem; z-index: 51;
  top: max(1.4rem, env(safe-area-inset-top));
  font-family: var(--label); font-size: 0.68rem;
  letter-spacing: 0.26em; text-indent: 0.26em; text-transform: uppercase;
  color: var(--rd-ink-soft); background: var(--rd-chip); border: 1px solid var(--rd-chip-edge);
  border-radius: 999px; padding: 0.85rem 1.35rem 0.8rem; min-height: 44px; cursor: pointer;
  backdrop-filter: blur(6px);
}
#reader-close:hover { color: var(--rd-ink); border-color: var(--rd-accent); }
.rb-head { text-align: center; margin-bottom: 4.5rem; }
.rb-kicker {
  font-family: var(--label); font-size: 0.62rem;
  letter-spacing: 0.4em; text-indent: 0.4em; text-transform: uppercase;
  color: var(--rd-faint); margin-bottom: 1.6rem;
}
.rb-head h1 {
  font-family: var(--label); font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3.6rem); letter-spacing: 0.12em; text-indent: 0.12em;
  color: var(--rd-ink);
}
.rb-sub { font-style: italic; font-size: calc(1.35rem * var(--rd-scale)); color: var(--rd-ink-soft); margin-top: 0.7rem; }
.rb-sec { margin-bottom: 4.5rem; }
.rb-num {
  font-family: var(--label); font-size: 0.72rem; letter-spacing: 0.5em; text-indent: 0.5em;
  color: var(--rd-accent); text-align: center; margin-bottom: 0.6rem;
}
.rb-sec h2 {
  font-family: var(--label); font-weight: 400; text-align: center;
  font-size: 1.7rem; letter-spacing: 0.14em; text-indent: 0.14em; text-transform: uppercase;
  color: var(--rd-ink); margin-bottom: 2.4rem;
}
.rb-sec h2::after {
  content: ''; display: block; width: 60px; height: 1px;
  background: var(--rd-rule); margin: 1.2rem auto 0;
}
.rb-sec p {
  font-size: calc(1.28rem * var(--rd-scale)); line-height: 1.82;
  margin-bottom: 1.2rem;
  color: var(--rd-ink);
}
.rb-sec p.first::first-letter {
  font-family: var(--label);
  font-size: 3.3em; line-height: 0.82;
  float: left; padding: 0.08em 0.12em 0 0;
  color: var(--rd-accent);
}
.rb-colophon { text-align: center; margin-top: 6rem; }
.rb-colophon p { font-style: italic; font-size: calc(1.3rem * var(--rd-scale)); color: var(--rd-ink-soft); }
.rb-colophon .rb-fine {
  font-family: var(--label); font-style: normal; font-size: 0.62rem;
  letter-spacing: 0.34em; text-indent: 0.34em; text-transform: uppercase;
  color: var(--rd-faint); margin-top: 1.2rem;
}

/* ————— loader ————— */
#loader {
  position: fixed; inset: 0; z-index: 60;
  background: var(--dark);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem;
  transition: opacity 1.2s ease;
}
#loader.done { opacity: 0; pointer-events: none; }
#loader .sun {
  width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, #ffe9bd, #e8b06a 70%, #b97f42);
  box-shadow: 0 0 60px rgba(232, 176, 106, 0.45);
  animation: rise 2.8s ease-in-out infinite alternate;
}
@keyframes rise { from { transform: translateY(10px); } to { transform: translateY(-6px); } }
#loader .line {
  font-style: italic; font-size: 1.1rem; color: var(--ink-dim); text-align: center;
  padding: 0 2rem;
}

/* ————— the threshold (enter — one gesture opens the sound) ————— */
#enter {
  position: fixed; inset: 0; z-index: 45;
  display: flex; align-items: center; justify-content: center;
  padding: max(1.6rem, env(safe-area-inset-top)) 1.6rem max(1.6rem, env(safe-area-inset-bottom));
  transition: opacity 1.4s ease;
}
#enter .veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(6, 10, 8, 0.32), rgba(4, 7, 5, 0.78) 78%),
    linear-gradient(to bottom, rgba(4, 7, 5, 0.82), rgba(4, 7, 5, 0.6) 40%, rgba(3, 5, 4, 0.88));
  backdrop-filter: blur(2px);
}
#enter .enter-inner {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 1.15rem;
  max-width: 26rem;
}
#enter .kicker {
  font-family: var(--label); font-size: 0.72rem;
  letter-spacing: 0.42em; text-indent: 0.42em; text-transform: uppercase;
  color: var(--ink-dim);
}
#enter h1 {
  font-family: var(--label); font-weight: 400;
  font-size: clamp(2.4rem, 9vw, 4.2rem);
  letter-spacing: 0.16em; text-indent: 0.16em; line-height: 1.08;
  color: #f2e8d2;
  text-shadow: 0 2px 34px rgba(0, 0, 0, 0.75);
}
#enter .rule {
  width: 120px; height: 1px;
  background: linear-gradient(to right, transparent, var(--hairline) 20%, var(--gold) 50%, var(--hairline) 80%, transparent);
}
#enter .sub {
  font-style: italic;
  font-size: clamp(1.15rem, 4.4vw, 1.5rem);
  color: var(--gold);
}
#enter-btn {
  margin-top: 1.4rem;
  display: inline-flex; align-items: center; gap: 0.7rem;
  min-height: 56px; padding: 0.9rem 2.4rem;
  font-family: var(--label); font-size: 0.82rem;
  letter-spacing: 0.3em; text-indent: 0.3em; text-transform: uppercase;
  color: #f6ecd6;
  background: rgba(232, 196, 138, 0.1);
  border: 1px solid rgba(232, 196, 138, 0.55);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, transform 0.15s, box-shadow 0.3s;
}
#enter-btn:hover { background: rgba(232, 196, 138, 0.2); border-color: var(--gold-bright); }
#enter-btn:active { transform: scale(0.97); }
#enter-btn:focus-visible {
  outline: none; box-shadow: 0 0 0 3px rgba(232, 196, 138, 0.35);
  border-color: var(--gold-bright);
}
#enter-btn svg { margin-right: -0.3em; opacity: 0.85; }
#enter .note {
  margin-top: 0.2rem;
  font-family: var(--label); font-size: 0.6rem;
  letter-spacing: 0.24em; text-indent: 0.24em; text-transform: uppercase;
  color: var(--ink-faint);
}
#enter.gone { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { #enter { transition: none; } }

/* ————— small screens ————— */
@media (max-width: 760px) {
  header#top {
    padding: 0.9rem 1.1rem;
    padding-top: max(0.9rem, env(safe-area-inset-top));
    gap: 0.8rem;
  }
  /* one line each. At 390px the wordmark wrapped and its second line ran under
     the sound icon, and "Read the story" wrapped inside its own pill. */
  .wordmark {
    font-size: 0.7rem; letter-spacing: 0.2em;
    white-space: nowrap; overflow: hidden; flex: 0 1 auto; min-width: 0;
  }
  .rd-rest { display: none; }        /* "Read the story" → "Read" */
  #rail { display: none; }
  #hero { gap: 1.1rem; }
  #hero h1 { font-size: clamp(2rem, 8.6vw, 3.4rem); letter-spacing: 0.11em; text-indent: 0.11em; }
  #hero .scroll-hint { bottom: 10.2rem; } /* clear of the audiobar + home indicator */
  #audiobar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    overflow: hidden; gap: 0.7rem;
    /* the last 1.25rem is the journey strip's own room, so the scrub target can
       be 20px tall without eating into the play or chapter buttons */
    padding: 0.5rem 0.9rem 1.25rem 0.6rem;
  }
  /* the journey line, drawn along the bottom of the pill instead of inline.
     The hairline stays 2px; the thing a thumb has to hit is the whole strip. */
  #ab-track {
    position: absolute; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; height: 20px; min-width: 0;
    background: none; border-radius: 0;
  }
  #ab-track::before { top: auto; bottom: 7px; height: 2px; background: rgba(232, 196, 138, 0.18); }
  #ab-fill { top: auto; bottom: 7px; height: 2px; }
  #ab-track #ab-ticks { display: none; }
  /* one line, ellipsised: the long "tap play to walk hands-free" note wrapped
     onto a second line and was clipped off by the pill's own overflow */
  #ab-chapter { font-size: 0.98rem; }
  #ab-time { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #zone-label { display: none; }

  /* fingers, not cursors: every tap target clears 44px and none of them may be
     squeezed under it by the flex row (the sound icon was measuring 40px) */
  .ghost-btn { padding: 0.85rem 1.1rem 0.8rem; min-height: 44px; white-space: nowrap; flex: 0 0 auto; }
  .top-actions { gap: 0.5rem; flex: 0 0 auto; }

  /* cards breathe at 390px — bigger leading, no clipped descenders over the road */
  .card { width: min(30rem, 88vw); }
  .card p { font-size: 1.18rem; line-height: 1.7; }
  .card.cardinal p { font-size: 1.5rem; }
  .card .who { margin-bottom: 0.85rem; letter-spacing: 0.32em; text-indent: 0.32em; }
  #gate-line { font-size: 1.08rem; padding: 0 1rem; }
  /* the instruction ran the full width of a 390px screen, touching both edges */
  #gate-hold { margin-top: 1.7rem; }
  #gate-hold .word {
    font-size: 0.58rem; letter-spacing: 0.2em; text-indent: 0.2em;
    padding: 0 1rem; text-align: center;
  }

  #ab-play { width: 46px; height: 46px; }
  #ab-list { width: 44px; height: 44px; }
  /* the home indicator is cleared by the pill's offset alone — the old rule
     added the inset a second time as padding, leaving a dead band inside */
  :root { --dock-lift: max(0.9rem, calc(env(safe-area-inset-bottom) + 0.35rem)); }
  #audiobar { bottom: var(--dock-lift); }
  /* the panel stacks clear of the taller pill instead of 4px into its top edge */
  #ab-panel { right: 1rem; bottom: calc(var(--dock-lift) + 5.9rem); width: min(23rem, calc(100vw - 2rem)); }
  /* a chapter is a thumb target, not a line of text: rows were 36px */
  #ab-chapters li { min-height: 44px; align-items: center; padding: 0.55rem 0.5rem; }
  /* the head's two labels plus the toggle do not fit on one 390px line — they
     were running out through the panel's right padding */
  .ab-head { flex-direction: column; align-items: flex-start; gap: 0.55rem; white-space: normal; }
  #reader-inner { padding: calc(5rem + env(safe-area-inset-top)) 1.25rem calc(7rem + env(safe-area-inset-bottom)); }
  #reader-close { top: max(0.9rem, env(safe-area-inset-top)); right: 1rem; }
}

/* tall phones (390×844, 430×932): keep the threshold's promise legible */
@media (max-width: 760px) and (min-height: 780px) {
  #hero .scroll-hint { bottom: 11.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  #hero .scroll-hint .line, #gate-hold .word, #loader .sun, #enter-btn { animation: none; }
}

/* ---- the reader's own controls: how dark, how big ------------------------ */
#reader-tools {
  position: fixed; z-index: 51;
  top: max(1.4rem, env(safe-area-inset-top));
  left: 1.6rem;
  display: flex; gap: 0.4rem;
}
#reader-tools button {
  font-family: var(--label); font-size: 0.68rem;
  letter-spacing: 0.18em; text-indent: 0.18em; text-transform: uppercase;
  color: var(--rd-ink-soft);
  background: var(--rd-chip);
  border: 1px solid var(--rd-chip-edge);
  border-radius: 999px;
  padding: 0.85rem 1.1rem 0.8rem; min-height: 44px; min-width: 44px;
  cursor: pointer; backdrop-filter: blur(6px);
  transition: color 0.3s ease, border-color 0.3s ease;
}
#reader-tools button:hover { color: var(--rd-ink); border-color: var(--rd-accent); }
#reader-tools button span { letter-spacing: 0; text-indent: 0; margin-left: 0.1em; }

@media (max-width: 760px) {
  #reader-tools { left: 1rem; gap: 0.3rem; }
  #reader-tools button { padding: 0.8rem 0.9rem 0.75rem; font-size: 0.62rem; }
}

/* the sound control is an icon now — entering the story already started it */
.ghost-btn.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; min-height: 44px; padding: 0;
  flex: 0 0 auto;   /* the flex row used to shrink it to 40px */
}
.ghost-btn.icon-btn svg { display: block; }

/* ————— the finale: the hold is the only gesture —————
   A four-second press must not be read as a pan, and nothing tappable may sit
   under "press & hold — anywhere": the dock's play button and the reader's own
   button were both live under the thumb mid-ritual. */
html.at-gate, html.at-gate body { touch-action: none; }
html.at-gate #audiobar,
html.at-gate #ab-panel { opacity: 0; pointer-events: none; transition: opacity 0.7s ease; }
html.at-gate .top-actions,
html.at-gate #rail { opacity: 0.18; pointer-events: none; transition: opacity 0.7s ease; }

/* the one-time offer of the hands-free walk — said once, quietly, then gone */
#the-offer {
  position: fixed; z-index: 29;
  left: 50%; transform: translateX(-50%) translateY(6px);
  bottom: max(5.4rem, calc(env(safe-area-inset-bottom) + 5rem));
  font-family: var(--label); font-size: 0.62rem;
  letter-spacing: 0.26em; text-indent: 0.26em; text-transform: uppercase;
  color: rgba(232, 176, 106, 0.72);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9);
  pointer-events: none; text-align: center;
  max-width: min(30rem, 88vw);
  opacity: 0; transition: opacity 1.4s ease, transform 1.4s ease;
}
#the-offer.on { opacity: 1; transform: translateX(-50%) translateY(0); }
html.at-gate #the-offer { display: none; }
@media (max-width: 760px) {
  #the-offer { font-size: 0.56rem; letter-spacing: 0.2em; text-indent: 0.2em; bottom: max(6.2rem, calc(env(safe-area-inset-bottom) + 5.6rem)); }
}
