:root {
  --night: #0e0b08;
  --paper: #f4ead8;
  --dim: #a3968a;
  --rule: #2c241c;
  --orange: #f7931a;
  --ember: #c4570f;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font: 400 1.15rem/1.6 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--orange) 60%, transparent); text-underline-offset: 0.18em; }
a:hover { color: var(--orange); }
.skip, .sr { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); color: var(--night); padding: 0.5rem 1rem; z-index: 9; }

.bar {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center;
  padding: max(0.7rem, env(safe-area-inset-top)) clamp(1rem, 4vw, 2.5rem) 0.7rem;
  background: color-mix(in srgb, var(--night) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.02em;
}
.mark { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.cube { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border: 1.5px solid var(--orange); color: var(--orange); font-family: var(--serif); font-size: 1.05rem; transform: rotate(-8deg); border-radius: 3px; }
.bar nav { display: flex; gap: 1.2rem; justify-content: center; }
.bar nav a { text-decoration: none; color: var(--dim); }
.bar nav a:hover { color: var(--paper); }
.ask { position: relative; display: flex; align-items: center; gap: 0.3rem; }
.ask input { width: min(15rem, 38vw); background: #17120d; border: 1px solid var(--rule); color: var(--paper); border-radius: 999px; padding: 0.45rem 0.9rem; font: inherit; }
.ask input:focus { outline: 1.5px solid var(--orange); outline-offset: 1px; }
.mic { background: none; border: 1px solid var(--rule); border-radius: 50%; width: 2.1rem; height: 2.1rem; display: grid; place-items: center; cursor: pointer; }
.mic svg { width: 1rem; fill: var(--dim); }
.mic.on { border-color: var(--orange); box-shadow: 0 0 0 4px color-mix(in srgb, var(--orange) 25%, transparent); }
.mic.on svg { fill: var(--orange); }
.guess { position: absolute; top: 100%; right: 0; margin-top: 0.4rem; color: var(--orange); white-space: nowrap; }

main { padding: 0 clamp(1.1rem, 5vw, 3rem); }
.kicker { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin: 0 0 0.8rem; }
.height { color: var(--orange); margin-right: 0.6rem; }
h1 { font-weight: 360; font-size: clamp(2.6rem, 8vw, 5.4rem); line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 1.4rem; }
h2 { font-weight: 400; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; margin: 0 0 1rem; }
.lede { font-size: clamp(1.25rem, 2.4vw, 1.55rem); line-height: 1.45; color: var(--paper); max-width: 36rem; }
.ed { font-style: italic; color: var(--dim); max-width: 34rem; font-size: 1.08rem; }
.note { font-family: var(--mono); font-size: 0.8rem; color: var(--dim); border-left: 2px solid var(--rule); padding-left: 1rem; max-width: 34rem; }
.notice { font-family: var(--mono); font-size: 0.85rem; color: var(--orange); margin: 1.5rem auto 0; max-width: 62rem; }

.hero { position: relative; max-width: 62rem; margin: 0 auto; padding: clamp(3rem, 10vh, 7rem) 0 3rem; }
.hero h1 { font-size: clamp(3.2rem, 11vw, 7.5rem); max-width: 10ch; }
.pumpkin {
  position: absolute; right: -2rem; top: clamp(1rem, 6vh, 4rem); width: clamp(10rem, 34vw, 24rem); aspect-ratio: 1.12;
  border-radius: 48% 48% 46% 46% / 52% 52% 46% 46%;
  background:
    radial-gradient(ellipse 18% 46% at 50% 52%, #ffb04d55, transparent 70%),
    radial-gradient(ellipse 22% 50% at 30% 52%, #ffa13a33, transparent 70%),
    radial-gradient(ellipse 22% 50% at 70% 52%, #ffa13a33, transparent 70%),
    radial-gradient(circle at 38% 30%, #ffb75a, var(--orange) 38%, var(--ember) 78%, #6b2a06);
  box-shadow: 0 0 120px #f7931a33, inset -18px -24px 60px #00000055;
  opacity: 0.92; z-index: -1;
  animation: breathe 7s ease-in-out infinite;
}
.pumpkin::before { content: ""; position: absolute; left: 47%; top: -9%; width: 7%; height: 16%; background: #3d4a22; border-radius: 40% 40% 20% 20%; transform: rotate(8deg); }
@keyframes breathe { 50% { box-shadow: 0 0 170px #f7931a55, inset -18px -24px 60px #00000055; } }
@media (prefers-reduced-motion: reduce) { .pumpkin { animation: none; } }

.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; margin: 2rem 0; }
.primary, .ghost, .share, .reveal {
  font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.03em; text-decoration: none; cursor: pointer;
  border-radius: 999px; padding: 0.7rem 1.2rem; border: 1px solid var(--rule); background: none; color: var(--paper);
}
.primary { background: var(--orange); border-color: var(--orange); color: #1a0f04; font-weight: 600; }
.primary:hover { color: #1a0f04; filter: brightness(1.08); }
.ghost:hover, .share:hover, .reveal:hover { border-color: var(--orange); color: var(--orange); }

.chain { max-width: 62rem; margin: 2rem auto 5rem; }
.chain h2 { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.chain ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.chain li a {
  display: grid; gap: 0.35rem; height: 100%; padding: 1.2rem 1.2rem 1rem; text-decoration: none;
  border: 1px solid var(--rule); border-radius: 6px; background: linear-gradient(#15100b, #110d09);
  transition: border-color 0.2s, transform 0.2s;
}
.chain li a:hover { border-color: var(--orange); transform: translateY(-2px); color: var(--paper); }
.chain b { font-weight: 500; font-size: 1.35rem; line-height: 1.15; }
.chain span:not(.height) { color: var(--dim); font-size: 1rem; line-height: 1.4; }
.chain .height { font-family: var(--mono); font-size: 0.78rem; }
.chain code { font-family: var(--mono); font-size: 0.68rem; color: #5d5246; margin-top: 0.4rem; }

.place, .film-page, .book { max-width: 44rem; margin: 0 auto; padding: clamp(2.5rem, 8vh, 5rem) 0 4rem; }
.q { margin: 2.2rem 0; padding: 0; }
.q blockquote { margin: 0; white-space: pre-line; font-size: clamp(1.2rem, 2.2vw, 1.38rem); line-height: 1.55; font-weight: 380; }
.q.star blockquote { border-left: 3px solid var(--orange); padding-left: 1.3rem; }
.q.paper blockquote { font-style: italic; color: var(--dim); padding-left: 1.3rem; border-left: 1px solid var(--rule); }
.q figcaption { font-family: var(--mono); font-size: 0.74rem; color: var(--dim); margin-top: 0.7rem; padding-left: 1.3rem; }
.headline { font-family: "Times New Roman", Times, serif; font-size: clamp(1.4rem, 3.4vw, 2.1rem); line-height: 1.25; border-top: 3px double var(--paper); border-bottom: 1px solid var(--paper); padding: 1rem 0; margin: 1.5rem 0 2.5rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 2rem 0; align-items: start; }
.pair figure { margin: 0; }
.block-card { border: 1px solid var(--rule); border-radius: 6px; padding: 1.2rem; font-family: var(--mono); font-size: 0.78rem; background: #120e0a; }
.block-card figcaption { color: var(--orange); margin-bottom: 1rem; }
.block-card dt { color: var(--dim); }
.block-card dd { margin: 0 0 0.9rem; word-break: break-all; }
.wheel img { width: 100%; height: auto; display: block; }
.wheel figcaption, .plate figcaption { font-size: 0.95rem; color: var(--dim); margin-top: 0.6rem; line-height: 1.45; }
.plate { margin: 2.5rem 0; }
.plate img { width: 100%; height: auto; border-radius: 4px; border: 1px solid var(--rule); background: #fff; }
.plate b { color: var(--orange); font-weight: 600; }
.steps { padding-left: 1.3rem; }
.steps li { margin: 0.8rem 0; }
.steps b { font-weight: 600; }

.chain-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 4rem; border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.chain-nav a { text-decoration: none; display: grid; font-size: 1.2rem; }
.chain-nav .next { text-align: right; }
.chain-nav small { font-family: var(--mono); font-size: 0.72rem; color: var(--dim); }

.decodes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.8rem; }
.decodes a { display: grid; gap: 0.3rem; padding: 1rem; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; height: 100%; }
.decodes a:hover { border-color: var(--orange); color: var(--paper); }
.decodes b { font-weight: 500; font-size: 1.25rem; }
.whose { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.decode.star .whose, .key.star .whose { color: var(--orange); }
.when { font-family: var(--mono); font-size: 0.72rem; color: #6c6055; }
.key { border: 1px solid var(--rule); border-radius: 6px; padding: 1rem 1.3rem; margin: 1rem 0; }
.key.star { border-color: var(--orange); }
.decoded-item h1 { font-size: clamp(2.4rem, 7vw, 4.4rem); }

.player { margin: 1.5rem 0; }
.player video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; border: 1px solid var(--rule); }
.chapters { font-family: var(--mono); font-size: 0.85rem; padding-left: 1.4rem; }
.chapters a { text-decoration: none; }
.chapters .t { color: var(--orange); margin-right: 0.6rem; }

.book .title-page { min-height: 60vh; display: grid; align-content: center; text-align: center; justify-items: center; border-bottom: 1px solid var(--rule); margin-bottom: 3rem; }
.book .title-page h1 { font-size: clamp(3.4rem, 12vw, 7rem); margin-bottom: 0.4rem; }
.subtitle { font-style: italic; font-size: 1.4rem; color: var(--dim); margin: 0; }
.byline { font-family: var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--orange); margin: 2rem 0 0; }
.toc ol { columns: 2; font-size: 1.1rem; }
.chapter { padding-top: 4rem; margin-top: 3rem; border-top: 1px solid var(--rule); }
.chapter h2 { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 360; }
.b-decode h3 { font-weight: 500; font-size: 1.4rem; margin: 2.5rem 0 0; }
.b-decode small { font-family: var(--mono); font-size: 0.72rem; color: var(--dim); }
.key-star { max-width: 34rem; }
.colophon { font-family: var(--mono); font-size: 0.75rem; color: var(--dim); margin-top: 5rem; text-align: center; }

.sources dt { font-family: var(--mono); font-size: 0.8rem; color: var(--orange); margin-top: 1.4rem; }
.sources dd { margin: 0.3rem 0 0; }

.foot { border-top: 1px solid var(--rule); padding: 2.5rem clamp(1rem, 5vw, 3rem) max(2.5rem, env(safe-area-inset-bottom)); text-align: center; font-family: var(--mono); font-size: 0.75rem; color: var(--dim); }
.foot p { margin: 0.6rem 0; }
.sign img { height: 44px; width: auto; }
.build-stamp { color: var(--dim); }


.tome { position: relative; width: min(300px, 64vw); aspect-ratio: 5.5 / 8.5; margin: 1rem auto 3rem; perspective: 1400px; transform-style: preserve-3d; }
.tome .cover, .tome .spine, .tome .pages { position: absolute; top: 0; height: 100%; }
.tome .cover {
  inset: 0; display: grid; align-content: center; justify-items: center; gap: 0.6rem; padding: 12%;
  transform: rotateY(-24deg) rotateX(4deg); transform-origin: left center; border-radius: 2px 6px 6px 2px;
  background: repeating-linear-gradient(0deg, #00000008 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, #ffffff0d 0 1px, transparent 1px 3px), linear-gradient(135deg, #efe4cf, #d9c9ab);
  color: #1a1410; box-shadow: 24px 30px 60px #000a, inset 8px 0 14px #00000022; text-align: center;
}
.tome .cover .cube { border-color: #c4570f; color: #c4570f; }
.tome .cover b { font-weight: 400; font-size: clamp(1.8rem, 6vw, 2.5rem); line-height: 1; letter-spacing: -0.01em; }
.tome .cover i { font-size: 0.9rem; color: #5b5048; }
.tome .cover small { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.25em; text-transform: uppercase; color: #c4570f; margin-top: 1.5rem; }
.tome .spine { left: -26px; width: 30px; transform: rotateY(-24deg) translateZ(0) skewY(0deg); transform-origin: right center;
  background: linear-gradient(90deg, #b9a98b, #d9c9ab 40%, #c8b796); border-radius: 3px 0 0 3px;
  box-shadow: inset 0 0 0 1px #00000014; display: grid; place-items: center; }
.tome .spine::before, .tome .spine::after { content: ""; position: absolute; left: 6px; right: 6px; height: 2px; background: #c4570f; }
.tome .spine::before { top: 8%; } .tome .spine::after { bottom: 8%; }
.tome .spine span { writing-mode: vertical-rl; font-family: var(--mono); font-size: 0.55rem; letter-spacing: 0.2em; text-transform: uppercase; color: #3b2f25; }
.tome .pages { right: -10px; width: 12px; top: 1.5%; height: 97%; background: repeating-linear-gradient(90deg, #f8f2e6 0 1px, #e7dcc8 1px 2px); transform: rotateY(-24deg) translateX(-6px); z-index: -1; border-radius: 0 3px 3px 0; }
@media print { .tome { display: none; } }

@media (max-width: 720px) {
  .bar { grid-template-columns: auto 1fr; }
  .bar nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; gap: 1rem; overflow-x: auto; }
  .ask { justify-self: end; }
  .ask input { width: 42vw; }
  .pair { grid-template-columns: 1fr; }
  .pumpkin { right: -4rem; opacity: 0.55; }
  .toc ol { columns: 1; }
}

@media print {
  @page { size: 5.5in 8.5in; margin: 0.7in 0.6in 0.8in; }
  :root { --night: #fff; --paper: #1a1410; --dim: #5b5048; --rule: #d9cfc2; color-scheme: light; }
  html, body { background: #fffdf8; }
  body { font-size: 10.5pt; line-height: 1.5; }
  .bar, .foot, .actions, .toc, .skip { display: none !important; }
  main { padding: 0; }
  .book { max-width: none; padding: 0; }
  .book .title-page { min-height: 7in; border: 0; page-break-after: always; }
  .book .title-page h1 { font-size: 46pt; }
  .preface { page-break-after: always; }
  .chapter { page-break-before: always; border: 0; padding-top: 0.6in; margin: 0; }
  .chapter h2 { font-size: 28pt; }
  .q blockquote { font-size: 11pt; }
  .q { page-break-inside: avoid; }
  .q.star blockquote { border-left-color: #c4570f; }
  .plate, .pair { page-break-inside: avoid; }
  .pair { grid-template-columns: 1fr; }
  .block-card { background: none; }
  .wheel img { max-width: 3.6in; margin: 0 auto; filter: invert(0.92) hue-rotate(180deg); }
  .lede { font-size: 13pt; }
  a { text-decoration: none; }
  .colophon { page-break-before: always; padding-top: 3in; }
}
