:root {
  --ink: #07060b;
  --parchment: #f4e7cb;
  --parchment-deep: #e7d3ae;
  --ink-text: #2a160f;
  --faded: #6d4c2e;
  --gold: #e7c98a;
  --gold-bright: #f6e2ae;
  --wax: #8d1d2e;
  --up: #0f6b3c;
  --down: #8e1d2c;
  --serif: "Cormorant Garamond", Palatino, "Palatino Linotype", Georgia, serif;
  --display: "Cinzel", Palatino, serif;
  --ornament: "Cinzel Decorative", "Cinzel", Palatino, serif;
  --script: "Great Vibes", cursive;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: #f3e6c8;
}

body {
  font-family: var(--serif);
  overflow-x: hidden;
}

body.book-open { overflow: hidden; }

button, input, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#embers {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

body {
  background:
    radial-gradient(ellipse at 50% 38%, rgba(212, 160, 70, 0.16), transparent 42%),
    radial-gradient(ellipse at 50% 110%, rgba(70, 28, 16, 0.55), transparent 46%),
    radial-gradient(ellipse at 12% 80%, rgba(90, 24, 32, 0.28), transparent 32%),
    radial-gradient(ellipse at 88% 16%, rgba(64, 42, 120, 0.22), transparent 30%),
    var(--ink);
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.72) 100%);
}

.flash {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 46%, rgba(255, 228, 176, 0.72), rgba(255, 186, 90, 0.15) 36%, transparent 58%);
}

body:has(.stage.is-open) .flash { animation: bloom 1.15s ease forwards; }

@keyframes bloom {
  0% { opacity: 0; }
  32% { opacity: 1; }
  100% { opacity: 0; }
}

.candles { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; }
body.is-lit .candles { opacity: 1; transition: opacity 1.4s ease; }

.candle {
  position: absolute;
  bottom: 6vh;
  width: 16px;
  background: linear-gradient(#f6edd8, #b8925a 70%, #6a5030);
  border-radius: 2px 2px 3px 3px;
  box-shadow: inset -3px 0 0 rgba(0, 0, 0, 0.18);
}

.candle::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 2px;
  height: 8px;
  background: #2a2118;
  transform: translateX(-50%);
}

.candle.c1 { left: 9vw; height: 78px; }
.candle.c2 { right: 11vw; height: 104px; bottom: 8vh; }
.candle.c3 { left: 18vw; height: 48px; bottom: 4vh; opacity: 0.85; }

.flame {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  width: 14px;
  height: 26px;
  transform: translateX(-50%);
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(ellipse at 50% 78%, #fff 0 12%, #ffe7a8 28%, #ff9a32 58%, transparent 74%);
  filter: blur(0.3px);
  box-shadow: 0 0 18px 8px rgba(255, 150, 50, 0.38);
  animation: flicker 0.28s infinite alternate;
}

.candle.c2 .flame { animation-duration: 0.36s; height: 32px; }
.candle.c3 .flame { animation-duration: 0.22s; animation-delay: -0.1s; }

@keyframes flicker {
  from { transform: translateX(-50%) scale(1) rotate(-2deg); opacity: 0.9; }
  to { transform: translateX(-50%) scale(1.08, 0.92) rotate(3deg); opacity: 1; }
}

.stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px 64px;
  gap: 10px;
}

.mast { text-align: center; max-width: 740px; opacity: 0; }
body.is-lit .mast { opacity: 1; transition: opacity 1.2s ease; }

.kicker {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
}

.mast h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.5rem, 6.4vw, 4.8rem);
  line-height: 1.05;
  letter-spacing: 0.16em;
  background: linear-gradient(#fff6d8, #e7c56a 46%, #c48a3a 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 14px auto 0;
  max-width: 38rem;
  font-size: 1.35rem;
  font-style: italic;
  line-height: 1.35;
  color: #e6d7be;
}

.social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  padding: 9px 16px;
  border: 1px solid rgba(231, 201, 138, 0.55);
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
}

.social:hover { background: rgba(231, 201, 138, 0.12); }

.foot-social {
  margin-top: 2px;
  font-style: normal;
}

.stage.is-open .mast,
.stage.is-closing .mast {
  opacity: 0;
  pointer-events: none;
}

.reliquary {
  position: relative;
  width: min(560px, 100%);
  display: grid;
  place-items: center;
  margin-top: 8px;
  opacity: 0;
}

.reliquary::before {
  content: "";
  position: absolute;
  z-index: 0;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 190, 100, 0.22), transparent 68%);
  filter: blur(6px);
  pointer-events: none;
}

body.is-lit .reliquary { opacity: 1; transition: opacity 1.3s ease 0.15s; }

.orbit {
  position: absolute;
  width: min(520px, 108vw);
  aspect-ratio: 1;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  animation: spin 56s linear infinite;
  pointer-events: none;
  opacity: 0.45;
}

.orbit text {
  fill: var(--gold);
  font-family: var(--display);
  font-size: 7.2px;
  letter-spacing: 2.4px;
}

@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.levitate {
  position: relative;
  z-index: 1;
  animation: levitate 6.4s ease-in-out infinite;
  text-align: center;
  filter: drop-shadow(0 22px 18px rgba(0, 0, 0, 0.55));
}

.stage.is-open .levitate,
.stage.is-closing .levitate { animation-play-state: paused; }

@keyframes levitate {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

.tilt {
  transform: rotateX(var(--tilt-x, 7deg)) rotateY(var(--tilt-y, -16deg));
  transition: transform 0.18s linear;
  transform-style: preserve-3d;
}

.tome {
  position: relative;
  width: 280px;
  height: 390px;
  padding: 0;
  border: 0;
  background: transparent;
  transform-style: preserve-3d;
  perspective: 1400px;
}

.tome-spine {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 28px;
  border-radius: 5px 0 0 5px;
  background: linear-gradient(90deg, #120806, #6a3824 42%, #2a120e 72%, #100705);
  box-shadow: inset -4px 0 6px rgba(0, 0, 0, 0.45);
}

.tome-pages {
  position: absolute;
  z-index: 1;
  right: -12px;
  top: 10px;
  bottom: 10px;
  width: 16px;
  border-radius: 0 3px 3px 0;
  background: repeating-linear-gradient(
    to bottom,
    #f7edd8 0 2px,
    #d9c6a2 2px 3px
  );
  box-shadow: 3px 0 0 #c4ae88, 6px 1px 8px rgba(0, 0, 0, 0.35);
}

.tome-board {
  position: absolute;
  z-index: 2;
  inset: 0 0 0 22px;
  border-radius: 0 6px 6px 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  background:
    radial-gradient(ellipse at 35% 18%, rgba(255, 196, 140, 0.28), transparent 42%),
    radial-gradient(ellipse at 80% 90%, rgba(0, 0, 0, 0.35), transparent 46%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 4px),
    linear-gradient(165deg, #b86a48 0%, #7a3828 42%, #3d1a14 100%);
  box-shadow:
    inset 0 0 0 1px rgba(240, 215, 140, 0.45),
    inset 0 0 0 12px rgba(0, 0, 0, 0.18),
    inset 0 0 50px rgba(0, 0, 0, 0.45);
}

.tome-board-back {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(160deg, #4a2418, #140a07 70%);
  transform: rotateY(180deg);
  backface-visibility: hidden;
}

.filigree {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.plate {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 108px;
  text-align: center;
  backface-visibility: hidden;
  color: var(--gold-bright);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65);
}

.plate-kicker {
  display: block;
  font-family: var(--script);
  font-size: 1.7rem;
  color: #f3ddb0;
}

.plate-title {
  display: block;
  margin-top: -6px;
  font-family: var(--ornament);
  font-size: 1.55rem;
  letter-spacing: 0.08em;
}

.plate-rule {
  display: block;
  width: 72px;
  height: 1px;
  margin: 8px auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.plate-sub, .plate-vol {
  display: block;
  font-family: var(--display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.62rem;
}

.plate-vol { margin-top: 8px; opacity: 0.75; }

.seal {
  position: absolute;
  left: 50%;
  bottom: 54px;
  transform: translateX(-50%);
  width: 78px;
  height: 78px;
  backface-visibility: hidden;
  animation: sealPulse 3.4s ease-in-out infinite;
}

.seal-wax {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 220, 180, 0.35), transparent 28%),
    radial-gradient(circle at 50% 55%, #a82838, #6e1422 70%, #4a0d16);
  box-shadow:
    0 8px 14px rgba(0, 0, 0, 0.45),
    inset 0 0 0 3px rgba(240, 200, 120, 0.55),
    inset 0 -8px 12px rgba(0, 0, 0, 0.35);
}

.eye {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #1a0908 0 5px, #f0d78c 6.5px 9px, transparent 10px),
    radial-gradient(circle at 50% 50%, #f4e7c8 0 13px, transparent 14px);
  box-shadow: 0 0 0 1px rgba(90, 12, 20, 0.4);
}

@keyframes sealPulse {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 170, 70, 0)); }
  50% { filter: drop-shadow(0 0 12px rgba(255, 160, 70, 0.85)); }
}

.bookmark {
  position: absolute;
  z-index: 4;
  right: 34px;
  bottom: -36px;
  width: 16px;
  height: 74px;
  background: linear-gradient(#9a2434, #5c101a);
  clip-path: polygon(0 0, 100% 0, 100% 86%, 50% 100%, 0 86%);
  box-shadow: 2px 4px 6px rgba(0, 0, 0, 0.35);
}

.stage.is-open .tome-board {
  animation: coverOpen 1.15s cubic-bezier(0.7, 0.05, 0.2, 1) forwards;
}

.stage.is-closing .tome-board {
  animation: coverOpen 0.8s ease reverse forwards;
}

@keyframes coverOpen {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(-162deg); }
}

.stage.is-open .reliquary {
  animation: relicFade 1.15s ease forwards;
  pointer-events: none;
}

.stage.is-closing .reliquary {
  animation: relicFade 0.7s ease reverse forwards;
  pointer-events: none;
}

@keyframes relicFade {
  0%, 40% { opacity: 1; }
  100% { opacity: 0; }
}

.plinth {
  width: 200px;
  height: 22px;
  margin: 28px auto 0;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.65), transparent 70%);
  animation: shadowPulse 6.4s ease-in-out infinite;
}

@keyframes shadowPulse {
  0%, 100% { transform: scaleX(1); opacity: 0.85; }
  50% { transform: scaleX(0.75); opacity: 0.4; }
}

.hint {
  margin: 4px 0 0;
  font-family: var(--script);
  font-size: 2rem;
  color: #f6e7c4;
  text-shadow: 0 0 18px rgba(240, 190, 100, 0.45);
}

.tome:hover { filter: brightness(1.08); }

.manuscript-wrap {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 16px 18px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.97);
}

body:has(.stage.is-open) .manuscript-wrap {
  animation: arrive 0.75s ease 0.48s forwards;
}

body:has(.stage.is-ready) .manuscript-wrap {
  pointer-events: auto;
}

body:has(.stage.is-closing) .manuscript-wrap {
  animation: arrive 0.4s ease reverse forwards;
  pointer-events: none;
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.book-tools {
  width: min(1080px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.book-tools button,
.pager button,
.scroll button,
.seek-hit,
.bind-name {
  font-family: var(--display);
}

.book-tools button,
.pager button {
  background: transparent;
  border: 1px solid rgba(231, 201, 138, 0.45);
  color: var(--gold-bright);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.66rem;
  padding: 8px 12px;
}

.book-tools button:hover,
.pager button:hover { background: rgba(231, 201, 138, 0.1); }

.oracle {
  margin: 0;
  flex: 1;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  color: #e7d7b8;
  font-size: 1.05rem;
}

.manuscript {
  width: min(1080px, calc(100vw - 28px));
  height: min(660px, calc(100vh - 168px));
  padding-left: 20px;
  background: linear-gradient(90deg, #140b08 0 18px, #5a3424 18px 24px, transparent 24px);
  border-radius: 4px 10px 10px 4px;
  box-shadow:
    -12px 1px 0 #e4d2b0,
    -14px 1px 0 #c9b48c,
    -16px 2px 0 #b19772,
    12px 1px 0 #f1e4c8,
    14px 1px 0 #d8c4a0,
    16px 2px 0 #c2ab84,
    0 28px 70px rgba(0, 0, 0, 0.55);
  perspective: 2200px;
}

.spread {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  background: var(--parchment);
  border-radius: 0 8px 8px 0;
  transform-style: preserve-3d;
}

.spread.swap { animation: pagefade 0.35s ease; }

@keyframes pagefade {
  from { opacity: 0.35; transform: translateX(8px); }
  to { opacity: 1; transform: none; }
}

.page {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  color: var(--ink-text);
}

.page.left {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 250, 236, 0.7), transparent 46%),
    linear-gradient(90deg, #e5d0aa, #f6ead2 14%, #f3e6c8);
}

.page.right {
  background:
    radial-gradient(ellipse at 80% 100%, rgba(255, 248, 230, 0.65), transparent 42%),
    linear-gradient(90deg, #efe1c2, #f7edd6 78%, #e6d3b0);
}

.page-body {
  height: 100%;
  overflow: auto;
  padding: 26px 36px 28px;
  scrollbar-width: thin;
  scrollbar-color: #b08948 transparent;
}

.page.left .page-body { padding-right: 44px; }
.page.right .page-body { padding-left: 44px; }

.page-body::-webkit-scrollbar { width: 8px; }
.page-body::-webkit-scrollbar-thumb { background: #b08948; border-radius: 8px; }

.gutter {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 28px;
  transform: translateX(-50%);
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(90, 60, 30, 0.12), rgba(40, 22, 12, 0.22), rgba(90, 60, 30, 0.12), transparent);
}

.leaf {
  position: absolute;
  z-index: 6;
  top: 0;
  width: 50%;
  height: 100%;
  visibility: hidden;
  pointer-events: none;
  transform-style: preserve-3d;
  transition: transform 0.95s cubic-bezier(0.7, 0.05, 0.25, 1);
}

.leaf.no-motion { transition: none; }
.leaf.is-live { visibility: visible; }
.leaf.forward { right: 0; left: auto; transform-origin: left center; }
.leaf.backward { left: 0; right: auto; transform-origin: right center; }
.leaf.forward.turned { transform: rotateY(-180deg); }
.leaf.backward.turned { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  color: var(--ink-text);
}

.face.front { transform: rotateY(0deg) translateZ(1px); }

.face.back { transform: rotateY(180deg) translateZ(1px); }
.face.recto, .page.right .page-body { }
.face.verso {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 250, 236, 0.7), transparent 46%),
    linear-gradient(90deg, #e5d0aa, #f6ead2 14%, #f3e6c8);
}
.face.recto {
  background:
    radial-gradient(ellipse at 80% 100%, rgba(255, 248, 230, 0.65), transparent 42%),
    linear-gradient(90deg, #efe1c2, #f7edd6 78%, #e6d3b0);
}

.hotspot {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  width: 42px;
  border: 0;
  background: transparent;
}

.hotspot.prev { left: 0; }
.hotspot.next { right: 0; }
.hotspot.prev:hover { background: linear-gradient(90deg, rgba(140, 90, 30, 0.16), transparent); }
.hotspot.next:hover { background: linear-gradient(270deg, rgba(140, 90, 30, 0.16), transparent); }

.curl {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: 0;
  width: 72px;
  height: 72px;
  border: 0;
  background: linear-gradient(135deg, transparent 46%, rgba(150, 100, 40, 0.18) 50%, #f8f1df 64%, #c9b48a 100%);
  filter: drop-shadow(-6px -4px 4px rgba(60, 30, 10, 0.18));
}

.curl:hover { filter: drop-shadow(-8px -6px 6px rgba(60, 30, 10, 0.28)) brightness(1.05); }

.folio-kicker, .chain-seal, .stat dt, .mcap-label, .contract .eyebrow {
  font-family: var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.folio-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.folio-kicker, .chain-seal {
  margin: 0;
  font-size: 0.66rem;
  color: var(--faded);
}

.chain-seal {
  border: 1px solid rgba(109, 68, 36, 0.35);
  border-radius: 999px;
  padding: 4px 8px;
}

.page-title, .coin-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink-text);
  line-height: 0.95;
}

.page-title { font-size: clamp(1.8rem, 3vw, 2.5rem); }

.coin-name { font-size: clamp(1.9rem, 3vw, 2.7rem); }

.drop {
  float: left;
  font-family: var(--ornament);
  font-size: 4rem;
  line-height: 0.78;
  padding: 4px 8px 0 0;
  color: var(--wax);
}

.epithet {
  margin: 8px 0 0;
  font-size: 1.35rem;
  font-style: italic;
  color: #7a3a28;
}

.rule {
  height: 1px;
  margin: 12px 0;
  background: linear-gradient(90deg, rgba(122, 72, 32, 0.55), transparent 80%);
}

.lore {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.4;
  color: #3a2718;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 16px;
}

.links a, .mirror {
  color: #6d3414;
  font-size: 1.05rem;
}

.unbind {
  margin-top: 18px;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--wax);
  font-family: var(--display);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.recto-layout {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.portrait {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 4px auto 8px;
  border-radius: 50%;
  padding: 6px;
  background: radial-gradient(circle at 50% 40%, #fff8e8, #d9c093);
  box-shadow:
    0 0 0 2px #7a5a28,
    0 0 0 7px rgba(122, 90, 40, 0.18),
    0 12px 24px rgba(60, 30, 10, 0.22);
}

.portrait.tide-up { box-shadow: 0 0 0 2px #1d7a49, 0 0 22px rgba(20, 120, 70, 0.35), 0 12px 24px rgba(60, 30, 10, 0.18); }
.portrait.tide-down { box-shadow: 0 0 0 2px #8e1d2c, 0 0 22px rgba(142, 29, 44, 0.28), 0 12px 24px rgba(60, 30, 10, 0.18); }

.portrait::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px dashed rgba(122, 90, 40, 0.5);
  animation: spinring 36s linear infinite;
}

@keyframes spinring { to { transform: rotate(360deg); } }

.portrait img, .sigil {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.portrait img {
  position: relative;
  z-index: 1;
  object-fit: cover;
  display: block;
}

.sigil {
  position: absolute;
  inset: 6px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #3a1c14, #120806 72%);
  color: var(--gold-bright);
  font-family: var(--display);
  letter-spacing: 0.08em;
  font-size: 0.95rem;
}

.sigil.mini {
  position: static;
  width: 42px;
  height: 42px;
  flex: none;
  font-size: 0.62rem;
}

.mcap-label {
  margin: 8px 0 0;
  font-size: 0.64rem;
  color: var(--faded);
}

.mcap {
  margin: 0;
  font-family: var(--ornament);
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  color: #3a2412;
}

.price {
  margin: 2px 0 0;
  font-size: 1.25rem;
  color: #3a2718;
}

.chg { font-style: italic; margin-left: 6px; }
.chg.up { color: var(--up); }
.chg.down { color: var(--down); }
.chg.flat { color: var(--faded); }

.hour-change {
  margin: 0;
  color: var(--faded);
  font-size: 0.98rem;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 14px 0 8px;
  text-align: left;
}

.stats div { border-top: 1px solid rgba(90, 60, 30, 0.2); padding-top: 4px; }

.stats dt { font-size: 0.6rem; color: #7a5a32; }
.stats dd {
  margin: 0;
  font-size: 1.22rem;
  color: #2a1a10;
}

.waiting {
  margin: 18px 0;
  font-style: italic;
  font-size: 1.25rem;
  color: #6a4a30;
}

.contract {
  width: 100%;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px dashed rgba(109, 68, 36, 0.45);
  background: rgba(255, 248, 230, 0.35);
  color: var(--ink-text);
  cursor: pointer;
}

.contract code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.contract .eyebrow { font-size: 0.58rem; color: var(--faded); }

.mirror { display: inline-block; margin-top: 8px; }

.index {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.index button {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--ink-text);
  font-family: var(--serif);
  font-size: 1.2rem;
  text-align: left;
}

.index button:hover .nm { color: var(--wax); }

.index .num {
  width: 2.4rem;
  flex: none;
  font-family: var(--display);
  font-size: 0.72rem;
  color: var(--wax);
}

.index .leader {
  flex: 1;
  border-bottom: 1px dotted rgba(90, 60, 30, 0.45);
  transform: translateY(-4px);
}

.index .who { color: var(--faded); font-style: italic; }

.blank-mark {
  width: 160px;
  height: 160px;
  margin: 28px auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(122, 90, 40, 0.55);
  font-family: var(--script);
  font-size: 1.8rem;
  color: #8a6844;
}

.ink-btn {
  margin-top: 8px;
  background: #3a160f;
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  font-family: var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  padding: 10px 14px;
}

.pager {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.pager button:last-child { justify-self: end; }

#folioLabel {
  margin: 0;
  font-style: italic;
  font-size: 1.25rem;
  color: #f3e6c8;
}

.pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.colophon {
  margin: 0;
  max-width: 640px;
  text-align: center;
  font-size: 0.95rem;
  font-style: italic;
  color: #cbbfa8;
}

.veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 3, 8, 0.72);
  backdrop-filter: blur(6px);
}

.veil[hidden] { display: none; }

.scroll {
  position: relative;
  width: min(560px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 28px 26px 24px;
  color: var(--ink-text);
  background:
    radial-gradient(ellipse at 10% 0%, rgba(255, 250, 235, 0.8), transparent 40%),
    linear-gradient(#f7edd8, #e7d3ae);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.scroll h2 {
  margin: 0;
  font-family: var(--ornament);
  font-size: 1.8rem;
  color: #3a2412;
}

.scroll-lede { margin: 8px 0 14px; font-style: italic; font-size: 1.15rem; }

.scroll-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #3a2412;
  font-size: 1.6rem;
}

#seekForm, #bindForm label {
  display: flex;
  gap: 8px;
}

#bindForm { display: grid; gap: 10px; margin-top: 14px; }
#bindForm[hidden] { display: none; }

#bindForm label {
  display: grid;
  gap: 4px;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faded);
}

#seekInput, #epithetInput, #loreInput {
  width: 100%;
  border: 1px solid rgba(90, 60, 30, 0.35);
  background: rgba(255, 252, 244, 0.7);
  color: var(--ink-text);
  padding: 10px 12px;
  font-family: var(--serif);
  font-size: 1.15rem;
}

#seekBtn, #bindButton {
  border: 1px solid #3a160f;
  background: #3a160f;
  color: var(--gold-bright);
  font-family: var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.68rem;
  padding: 0 14px;
}

#bindButton { padding: 12px 14px; }

.seek-results { display: grid; gap: 8px; margin-top: 12px; }

.seek-hit {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px;
  border: 1px solid rgba(90, 60, 30, 0.25);
  background: rgba(255, 250, 240, 0.55);
  color: var(--ink-text);
}

.seek-hit img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.seek-hit strong { display: block; font-family: var(--display); }
.seek-hit em, .seek-hit small { display: block; font-style: italic; color: var(--faded); }

.seek-note { margin: 8px 0 0; font-style: italic; }

.bind-name { margin: 0; font-size: 1.15rem; }

@media (max-width: 860px) {
  .orbit { display: none; }
  .candle.c3 { display: none; }
  .manuscript-wrap {
    overflow: auto;
    justify-content: flex-start;
    padding-bottom: 28px;
  }
  .manuscript {
    height: auto;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  }
  .spread {
    display: block;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .page { height: auto; }
  .page-body { height: auto; overflow: visible; }
  .leaf, .gutter, .hotspot { display: none; }
  .pager { grid-template-columns: 1fr 1fr; }
  #folioLabel { grid-column: 1 / -1; order: -1; text-align: center; }
  .pager button:last-child { justify-self: end; }
  .book-tools { justify-content: center; }
  .oracle { flex: none; width: 100%; }
}

@media (max-width: 600px) {
  .tome { width: 230px; height: 324px; }
  .plate { top: 84px; }
  .plate-title { font-size: 1.25rem; }
  .seal { width: 64px; height: 64px; bottom: 36px; }
  .hint { font-size: 1.6rem; }
  .page-body { padding: 22px 18px 26px; }
  .stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
