/* ============================================================
   Name Words — "the decryption chamber"
   System fonts only. No CDNs. One easing family, nothing bounces.
   ============================================================ */

:root {
  --bg:        #030408;
  --bg-2:      #0a0d18;
  --surface:   #141927;
  --surface-2: #1a2032;
  --line:      #2a3345;
  --line-soft: #1f2737;

  --ink:       #eef2f8;
  --ink-dim:   #9aa6bc;
  --ink-faint: #5a647c;

  --gold:      #f4c45a;
  --gold-deep: #b8862b;
  --gold-dark: #6b5320;
  --warn:      #ff8a4c;

  --serif: ui-serif, "New York", Georgia, "Times New Roman", serif;
  --mono:  ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ease: cubic-bezier(0.22, 0.8, 0.3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  /* the void: a faint warm heart swallowed by true black at the edges */
  background:
    radial-gradient(1100px 700px at 50% 30%, rgba(30, 26, 16, 0.55), transparent 70%),
    radial-gradient(900px 480px at 50% -10%, rgba(244, 196, 90, 0.05), transparent 65%),
    var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(40px, 9vh, 110px) clamp(18px, 4vw, 40px) 120px;
  transition: padding 0.6s var(--ease);
}
body.decoded .wrap { padding-top: 28px; }

/* ---------- arrival ---------- */
#arrival {
  text-align: center;
  margin-bottom: clamp(30px, 6vh, 56px);
  transition: margin 0.6s var(--ease), opacity 0.6s var(--ease),
              transform 0.6s var(--ease);
}
body.decoded #arrival { margin-bottom: 14px; }
body.decoded #arrival .tag { opacity: 0; height: 0; margin: 0; overflow: hidden; }

.brand {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  color: var(--ink-faint);
}
.brand .tld { color: var(--gold); }
.tag {
  margin: 26px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4.5vw, 2.3rem);
  font-style: italic;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.01em;
  transition: opacity 0.5s var(--ease);
}

/* ---------- ciphertext anchor — fixed above the whole descent ---------- */
#anchor {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  text-align: center;
  padding: 14px 12px 12px;
  background: linear-gradient(180deg, rgba(10, 12, 20, 0.92) 55%, transparent);
}
.anchor-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
}
#cartouches {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.cartouche {
  width: 34px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--gold);
  background: rgba(244, 196, 90, 0.07);
  border: 1px solid var(--gold-dark);
  border-radius: 7px;
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.5s var(--ease) forwards;
  transition: background 0.3s, box-shadow 0.3s, color 0.3s, border-color 0.3s;
}
.cartouche.space { border: none; background: none; width: 14px; }
.cartouche.lit {
  color: #ffe9b0;
  background: rgba(244, 196, 90, 0.22);
  border-color: var(--gold-deep);
  box-shadow: 0 0 16px rgba(244, 196, 90, 0.35);
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- inscription (input) ---------- */
#form {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  max-width: 620px;
  margin: 0 auto;
  transition: max-width 0.6s var(--ease), transform 0.6s var(--ease);
}
body.decoded #form { max-width: 480px; transform: scale(0.86); }

#inscription {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 6px 2px 10px;
  min-height: 54px;
  cursor: text;
  transition: border-color 0.3s;
}
#inscription:focus-within { border-color: var(--gold-deep); }

#mirror {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  letter-spacing: 0.06em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  min-height: 1.25em;
}
#mirror .ltr { display: inline-block; }
#mirror .ltr.settling { color: var(--gold); }
#mirror .ltr.burn { animation: burn 0.25s var(--ease) forwards; }
@keyframes burn { to { opacity: 0; transform: translateY(-8px); } }

#mirror .ph { color: var(--ink-faint); font-style: italic; }

#caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--gold);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }
#inscription.shake { animation: shake 0.3s var(--ease); }
@keyframes shake {
  25% { transform: translateX(-5px); } 75% { transform: translateX(5px); }
}

#name {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  font-size: 1.5rem;
  border: 0;
  background: none;
  color: transparent;
  caret-color: transparent;
  outline: none;
}

#decode-btn {
  flex: 0 0 auto;
  padding: 12px 26px;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  color: #1a1206;
  background: linear-gradient(180deg, #f9d271, var(--gold) 55%, var(--gold-deep));
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s var(--ease), filter 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 18px -8px rgba(244, 196, 90, 0.5);
}
#decode-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
#decode-btn:active { transform: none; filter: brightness(0.95); }

/* ---------- toolbar ---------- */
#toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 620px;
  margin: 26px auto 0;
}
#depth-ctl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}
.ctl-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 8px 0 12px;
}
#depth-ctl button {
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
#depth-ctl button:hover { color: var(--ink); }
#depth-ctl button.on {
  color: #1a1206;
  background: var(--gold);
  border-color: var(--gold-deep);
}
#status {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* ---------- offline banner ---------- */
.banner {
  margin: 22px auto 0;
  max-width: 620px;
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 0.8rem;
  text-align: center;
  color: #ffd9bf;
  background: #221610;
  border: 1px solid rgba(255, 138, 76, 0.4);
  border-radius: 10px;
}

.hidden { display: none !important; }

/* ---------- layers ---------- */
#layers { margin-top: 44px; }

.layer {
  margin: 0 0 8px;
  padding: 26px clamp(14px, 3vw, 30px) 34px;
  border-radius: 16px;
  opacity: 0;
  animation: rise 0.6s var(--ease) forwards;
}
.layer:nth-of-type(1) { background: transparent; }
.layer:nth-of-type(2) { background: rgba(10, 12, 22, 0.55); }
.layer:nth-of-type(3) { background: rgba(7, 8, 16, 0.75); }
.layer:nth-of-type(4) { background: rgba(4, 5, 11, 0.9); border: 1px solid #171b28; }

.layer-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 6px;
}
.layer-num {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--gold);
}
.layer:nth-of-type(3) .layer-num,
.layer:nth-of-type(4) .layer-num { color: var(--gold-deep); }
.layer-name {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.layer-head::after {
  content: "";
  flex: 1;
  height: 1px;
  align-self: center;
  background: linear-gradient(90deg, var(--gold-dark), transparent);
  opacity: 0.6;
}
.layer-sub {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-faint);
}

.theme-group { margin: 0 0 18px; }
.theme-label {
  margin: 0 0 9px;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- word chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  padding: 7px 15px;
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  animation: rise 0.45s var(--ease) forwards;
  transition: transform 0.15s var(--ease), border-color 0.2s,
              background 0.2s, box-shadow 0.2s;
}
.chip:hover {
  transform: translateY(-2px);
  border-color: var(--gold-deep);
  background: var(--surface-2);
  box-shadow: 0 6px 20px -10px rgba(244, 196, 90, 0.4);
}
.chip.near {
  border-color: var(--gold-deep);
  background: linear-gradient(180deg, rgba(244, 196, 90, 0.14), rgba(244, 196, 90, 0.05));
}
.chip.near::after { content: " ✦"; color: var(--gold); }
.chip.nudge { animation: nudge 2.4s var(--ease); }
@keyframes nudge {
  0%, 100% { box-shadow: none; }
  30% { box-shadow: 0 0 22px rgba(244, 196, 90, 0.55); border-color: var(--gold); }
}

/* ---------- the reading (word detail) ---------- */
#reading {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 5, 10, 0.72);
  backdrop-filter: blur(3px);
  animation: fade 0.25s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

#reading-card {
  position: relative;
  width: min(560px, 94vw);
  padding: 34px 36px 32px;
  background: linear-gradient(180deg, #171b29, #0e111d);
  border: 1px solid var(--gold-dark);
  border-radius: 18px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9),
              0 0 40px rgba(244, 196, 90, 0.08);
  animation: rise 0.35s var(--ease);
}
#reading-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink-faint);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.2s;
}
#reading-close:hover { color: var(--ink); }

#reading-provenance {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 22px;
}
#reading-provenance .pl {
  width: 26px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink-faint);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  transition: all 0.3s var(--ease);
}
#reading-provenance .pl.space { border: none; width: 10px; }
#reading-provenance .pl.lit {
  color: #ffe9b0;
  border-color: var(--gold-deep);
  background: rgba(244, 196, 90, 0.2);
  box-shadow: 0 0 12px rgba(244, 196, 90, 0.35);
}

#reading-word {
  display: flex;
  justify-content: center;
  gap: 2px;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 7vw, 3rem);
  letter-spacing: 0.14em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 6px;
}
#reading-word .wl {
  display: inline-block;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}

#reading-meta {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 18px;
}
#reading-meta .dot { color: var(--gold); }

#reading-def {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.7;
  text-align: center;
  color: var(--ink-dim);
}

/* ---------- responsive ---------- */
@media (max-width: 520px) {
  #form { flex-direction: column; align-items: stretch; gap: 14px; }
  #decode-btn { width: 100%; padding: 14px; }
  #toolbar { justify-content: center; }
  .cartouche { width: 28px; height: 36px; font-size: 1.05rem; }
}

/* ============================================================
   The descent — scroll-scrubbed journey
   ============================================================ */

/* before a name is given, there is no "below" */
body.predecoded { overflow: hidden; height: 100vh; }
body.decoded #act-hero { min-height: auto; padding-top: 96px; }
#act-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
#act-hero > * { width: 100%; }
#act-hero #form { width: min(620px, 100%); }

/* vignette + grain over the field */
#vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E"),
    radial-gradient(120% 90% at 50% 42%, transparent 55%, rgba(3, 4, 9, 0.55) 100%);
}
.wrap, #journey { position: relative; z-index: 2; }

/* ---------- intro beat ---------- */
#intro-beat { text-align: center; margin-top: clamp(40px, 10vh, 90px); }
#intro-line {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 3vw, 1.5rem);
  color: var(--ink-dim);
}
.scroll-hint {
  margin-top: 34px;
  font-size: 0.9rem;
  color: var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: bob 2.2s var(--ease) infinite;
}
.scroll-hint span {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(7px); } }

/* ---------- seals: pinned, scroll-scrubbed reveals ---------- */
/* height priced per letter by app.js (--track-h); fallback only */
.seal-track { height: var(--track-h, 280vh); position: relative; }
/* restacked: name (fixed top) → word just beneath → meaning → open middle
   → ark at the bottom. The word plunges past the meaning on collapse. */
.seal-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  /* ponytail: static clearance under the fixed anchor; 3-row mobile names may kiss it — measure anchor height if that ever bites */
  padding: max(150px, 16vh) 20px 40px;
  text-align: center;
}
.seal-kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 30px;
  opacity: calc(var(--p, 0) * 3);
}
.seal-word {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 11vw, 6rem);
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(244, 196, 90, calc(var(--p, 0) * 0.45));
  opacity: calc(0.25 + var(--p, 0) * 0.75);
}
.seal-def {
  max-width: 560px;
  margin: 30px 0 0;
  font-family: var(--serif);
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  line-height: 1.7;
  color: var(--ink-dim);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.seal-stage.told .seal-def { opacity: 1; transform: none; }

/* ---------- interstitial beats ---------- */
.beat {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px;
}
.beat p {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  color: var(--ink-dim);
  max-width: 620px;
}
.rise-in { opacity: 0; transform: translateY(24px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.rise-in.seen { opacity: 1; transform: none; }

/* ---------- finale ---------- */
#beat-finale { min-height: 90vh; }
.finale-kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
#finale-word {
  margin: 26px 0 10px;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 9vw, 5rem);
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 0 50px rgba(244, 196, 90, 0.4);
}
#finale-def {
  max-width: 560px;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-dim);
}
#again-btn {
  margin-top: 44px;
  padding: 14px 34px;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  color: #1a1206;
  background: linear-gradient(180deg, #f9d271, var(--gold) 55%, var(--gold-deep));
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 22px -8px rgba(244, 196, 90, 0.55);
  transition: transform 0.15s var(--ease), filter 0.2s;
}
#again-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }

#stacks { padding-top: 20px; }

/* ---------- the ark ---------- */
#ark {
  position: fixed;
  bottom: 2.5vh;
  left: 50%;
  transform: translateX(-50%) scale(0.86);
  z-index: 3;
  pointer-events: none;
  text-align: center;
  opacity: 0.92;
  filter: drop-shadow(0 0 26px rgba(244, 196, 90, 0.22));
  transition: filter 0.4s var(--ease), transform 0.4s var(--ease);
}
#ark.pulse {
  filter: drop-shadow(0 0 60px rgba(244, 196, 90, 0.65));
  transform: translateX(-50%) scale(0.94);
}
#ark-glow { animation: breathe 4.5s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 0.65; } 50% { opacity: 1; } }
#ark-count {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

/* seal words travel to the ark on collapse — over the meaning, not behind it */
.seal-word { will-change: transform, opacity, letter-spacing; position: relative; z-index: 2; }
.seal-stage.told .seal-def { opacity: 1; transform: none; }
.seal-stage .seal-def { transition: opacity 0.45s var(--ease), transform 0.45s var(--ease); }

/* ---------- the gathering stream (compact, endless) ---------- */
.gathering .seal-track, .seal-track.gathering { height: var(--track-h, 150vh); }
.gathering .seal-word { font-size: clamp(1.9rem, 7vw, 3.4rem); }
.gathering .seal-def { font-size: 0.95rem; max-width: 440px; }
.gathering .seal-kicker { margin-bottom: 18px; }

/* ---------- treasuring: the hold, the halo, the orbit ---------- */
.holdable {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}
/* the shimmer: a quiet invitation on anything not yet treasured */
.seal-word.holdable:not(.treasured):hover,
#finale-word.holdable:not(.treasured):hover,
#reading-word.holdable:not(.treasured):hover {
  text-shadow: 0 0 30px rgba(244, 196, 90, 0.6), 0 0 70px rgba(244, 196, 90, 0.25);
}

#hold-ring {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  transform: translate(-50%, -50%);
  overflow: visible;
}
#hold-ring circle {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 207.3;
  stroke-dashoffset: 207.3;
  transform: rotate(-90deg);
  transform-origin: center;
  filter: drop-shadow(0 0 7px rgba(244, 196, 90, 0.75));
}
#hold-ring.flare { animation: ring-flare 0.5s var(--ease) forwards; }
@keyframes ring-flare {
  to { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

/* the halo: a treasured word keeps its light */
.seal-word.treasured, #finale-word.treasured, #reading-word.treasured {
  color: #ffe9b0;
  text-shadow: 0 0 22px rgba(244, 196, 90, 0.85), 0 0 60px rgba(244, 196, 90, 0.35);
}
.chip.treasured {
  color: #ffe9b0;
  border-color: var(--gold-deep);
  background: linear-gradient(180deg, rgba(244, 196, 90, 0.16), rgba(244, 196, 90, 0.06));
  box-shadow: 0 0 16px rgba(244, 196, 90, 0.35);
}

/* the orbit: treasured words circle the ark in tiny glowing script */
#ark-orbit { position: absolute; inset: 0; pointer-events: none; }
#ark-orbit .ow {
  position: absolute;
  left: 50%;
  top: 46%;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  opacity: 0.8;
  text-shadow: 0 0 9px rgba(244, 196, 90, 0.7);
  animation: orbit 48s linear infinite;
  animation-delay: var(--orbit-d, 0s);
}
@keyframes orbit {
  from { transform: rotate(0turn) translateX(var(--orbit-r, 118px)) rotate(0turn); }
  to   { transform: rotate(1turn) translateX(var(--orbit-r, 118px)) rotate(-1turn); }
}
@media (max-width: 520px) { #ark-orbit .ow { --orbit-r: 88px; } }
/* reduced motion: the orbit stands still, each word at its own station */
@media (prefers-reduced-motion: reduce) {
  #ark-orbit .ow {
    animation: none !important;
    transform: rotate(var(--oa, 0deg)) translateX(var(--orbit-r, 118px))
               rotate(calc(-1 * var(--oa, 0deg)));
  }
}
#treasure-count {
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
}

/* teach once: the caption under seal I */
.teach-cap {
  margin-top: 26px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-faint);
  opacity: 0;
  animation: rise 0.8s var(--ease) 0.4s forwards;
  transition: opacity 0.9s var(--ease);
}
.teach-cap.gone { opacity: 0 !important; }

/* the wax seal: the reading's explicit way in */
#reading-treasure {
  display: block;
  margin: 24px auto 0;
  width: 74px;
  height: 74px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.78rem;
  color: #1a1206;
  background: radial-gradient(circle at 38% 32%, #f9d271, var(--gold) 45%, var(--gold-deep) 85%);
  border: 1px solid var(--gold-dark);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 2px 6px rgba(255, 233, 176, 0.5), inset 0 -3px 8px rgba(60, 42, 8, 0.45),
              0 4px 18px -6px rgba(244, 196, 90, 0.5);
  transition: transform 0.15s var(--ease), filter 0.2s, box-shadow 0.3s;
}
#reading-treasure:hover { transform: translateY(-1px); filter: brightness(1.07); }
#reading-treasure:active { transform: scale(0.96); }
#reading-treasure.done {
  color: #3a2c0c;
  filter: saturate(0.75) brightness(0.92);
  cursor: default;
  box-shadow: inset 0 2px 6px rgba(255, 233, 176, 0.35), 0 0 22px rgba(244, 196, 90, 0.35);
}

/* ---------- controls ---------- */
#sound-btn {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 20;
  padding: 7px 14px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: rgba(10, 12, 20, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
#sound-btn:hover { color: var(--gold); border-color: var(--gold-dark); }

#skip-btn {
  margin-top: 30px;
  padding: 10px 22px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
#skip-btn:hover { color: var(--gold); border-color: var(--gold-dark); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .chip, .layer, .cartouche, .rise-in, .seal-def { opacity: 1 !important; transform: none !important; }
  .seal-track { height: auto !important; }
  .seal-stage { position: static; height: auto; min-height: 60vh; --p: 1; }
  .seal-word { opacity: 1; transform: none !important; }
}
