:root {
  --cave: #0B0E16;
  --vellum: #E8DCC1;
  --verdigris: #2E7D73;
  --amber: #D99A31;
  --plum: #5A2846;
  --venom: #B7F04A;
  --ink: #1F1B24;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cave);
  color: var(--vellum);
  font-family: "Spectral", serif;
  overflow-x: hidden;
}

button { font: inherit; }
.cave-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 16% 18%, rgba(90,40,70,.42), transparent 32%),
    radial-gradient(circle at 78% 38%, rgba(46,125,115,.18), transparent 29%),
    radial-gradient(circle at 48% 100%, rgba(217,154,49,.13), transparent 36%),
    repeating-linear-gradient(112deg, rgba(232,220,193,.026) 0 1px, transparent 1px 9px),
    linear-gradient(180deg, #0B0E16 0%, #10101a 54%, #0B0E16 100%);
}
.cave-texture::after {
  content: "∴  ∵  ⟹  ⊢  ¬  ∀  ∃";
  position: absolute;
  inset: 0;
  color: rgba(232,220,193,.045);
  font-family: "Recursive", monospace;
  font-size: 38px;
  letter-spacing: 34px;
  line-height: 2.8;
  transform: rotate(-9deg) scale(1.15);
}
.lantern-sweep {
  position: fixed;
  width: 34vw;
  height: 34vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217,154,49,.17), rgba(217,154,49,.04) 42%, transparent 70%);
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 2;
  transform: translate(-50%, -50%);
  left: 50%; top: 50%;
  transition: opacity .4s ease;
}
.inspection-lens {
  position: fixed;
  width: 132px; height: 132px;
  border: 3px double var(--amber);
  border-radius: 50%;
  z-index: 8;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.9);
  background: radial-gradient(circle, rgba(232,220,193,.16), rgba(183,240,74,.055) 55%, transparent 70%);
  box-shadow: 0 0 26px rgba(217,154,49,.22);
  opacity: .72;
}
.inspection-lens span {
  position: absolute;
  bottom: -22px; left: 8px;
  color: var(--venom);
  font: 11px "Recursive", monospace;
  letter-spacing: .09em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity .25s ease;
}
.inspection-lens.revealing span { opacity: 1; }

.lair-map {
  position: fixed;
  left: 24px;
  top: 24px;
  bottom: 24px;
  width: 185px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  border-left: 1px solid rgba(232,220,193,.2);
}
.map-title {
  font-family: "Cinzel Decorative", serif;
  color: var(--amber);
  font-size: 18px;
  line-height: 1.05;
  margin: 0 0 24px 18px;
  text-shadow: 0 0 16px rgba(217,154,49,.25);
}
.map-mark {
  cursor: pointer;
  color: rgba(232,220,193,.62);
  background: transparent;
  border: 0;
  text-align: left;
  padding: 7px 0 7px 18px;
  font-family: "Recursive", monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  transition: color .25s ease, transform .25s ease;
}
.map-mark span {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  margin-right: 9px;
  color: var(--ink);
  background: rgba(232,220,193,.7);
  border-radius: 50%;
  font-size: 10px;
}
.map-mark.active { color: var(--venom); transform: translateX(8px); }
.map-mark.active span { background: var(--venom); box-shadow: 0 0 22px rgba(183,240,74,.45); }

.monster-silhouette {
  position: fixed;
  right: -12vw;
  top: 6vh;
  width: min(86vw, 1080px);
  height: auto;
  z-index: 1;
  opacity: .34;
  filter: drop-shadow(0 0 18px rgba(11,14,22,.8));
  transition: transform .8s ease, opacity .8s ease;
}
.body-line, .jaw-bone, .neck, .tail, .tail-lens, .ribs path, .proof-roots path, .spectacles {
  fill: none;
  stroke: var(--vellum);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#inkRough);
}
.body-line { stroke-width: 5; }
.belly-plum { fill: rgba(90,40,70,.55); stroke: var(--plum); stroke-width: 2; }
.tail-lens { stroke: var(--amber); }
.pupil { fill: var(--ink); }
.ribs path { stroke: rgba(232,220,193,.62); stroke-width: 3; }
.proof-roots path { stroke: rgba(46,125,115,.78); stroke-width: 2; }
.monster-silhouette.scene-ribs { transform: translate(-7vw, 6vh) scale(1.05); opacity: .46; }
.monster-silhouette.scene-stomach { transform: translate(-16vw, 1vh) scale(1.12); opacity: .5; }
.monster-silhouette.scene-horns { transform: translate(-4vw, -7vh) scale(1.03); opacity: .44; }
.monster-silhouette.scene-verdict { transform: translate(-13vw, 4vh) scale(.92) rotate(-4deg); opacity: .56; }

.lair-scenes { position: relative; z-index: 3; }
.scene {
  min-height: 100vh;
  position: relative;
  padding: 12vh 9vw 10vh 250px;
  display: grid;
  align-content: center;
  isolation: isolate;
}
.scene::before {
  content: attr(data-chapter);
  position: absolute;
  right: 7vw; top: 7vh;
  font-family: "Recursive", monospace;
  color: rgba(183,240,74,.32);
  border: 1px solid rgba(183,240,74,.2);
  padding: 8px 12px;
}
.chapter-initial {
  position: absolute;
  left: 228px; top: 9vh;
  font-family: "UnifrakturCook", cursive;
  color: rgba(217,154,49,.3);
  font-size: clamp(86px, 12vw, 160px);
  z-index: -1;
}
h1, h2 {
  font-family: "Cinzel Decorative", serif;
  margin: 0;
  font-weight: 900;
  letter-spacing: .025em;
}
h1 { font-size: clamp(48px, 9vw, 132px); color: var(--vellum); text-shadow: 0 0 28px rgba(183,240,74,.16); }
h2 { max-width: 840px; font-size: clamp(40px, 6.4vw, 92px); line-height: .96; color: var(--vellum); }
.scene-copy {
  max-width: 600px;
  font-size: clamp(19px, 2.1vw, 27px);
  line-height: 1.28;
  color: rgba(232,220,193,.82);
  margin: 24px 0;
}
.scene-label, .mono-note, .counter-tag, .closing-marginalia {
  font-family: "Recursive", monospace;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--venom);
  font-size: 12px;
}

.jaw-stage {
  width: min(980px, 78vw);
  min-height: 470px;
  display: grid;
  place-items: center;
  position: relative;
}
.cave-eyes {
  position: absolute;
  top: 6%; right: 16%;
  display: flex; gap: 42px;
}
.cave-eyes i {
  width: 42px; height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--venom), rgba(183,240,74,.05) 62%);
  box-shadow: 0 0 26px var(--venom);
  animation: blink 5.5s infinite;
}
.cave-eyes i:nth-child(2) { animation-delay: .25s; }
@keyframes blink { 0%, 91%, 100% { transform: scaleY(1); } 94%, 96% { transform: scaleY(.08); } }
.jaw-half {
  position: absolute;
  left: 0; right: 0;
  height: 112px;
  border: 3px solid rgba(232,220,193,.62);
  background: linear-gradient(90deg, rgba(31,27,36,.78), rgba(90,40,70,.56));
  display: flex;
  justify-content: center;
  gap: 16px;
  transition: transform 1s cubic-bezier(.2,.9,.2,1);
}
.upper-jaw { top: 72px; border-radius: 80px 80px 24px 24px; transform: rotate(-2deg) translateY(12px); }
.lower-jaw { bottom: 52px; border-radius: 24px 24px 80px 80px; transform: rotate(2deg) translateY(-12px); align-items: end; }
.jaw-scene.open .upper-jaw { transform: rotate(-5deg) translateY(-35px); }
.jaw-scene.open .lower-jaw { transform: rotate(5deg) translateY(36px); }
.tooth {
  width: 78px; height: 92px;
  background: var(--vellum);
  color: var(--ink);
  clip-path: polygon(6% 0, 94% 0, 78% 100%, 50% 78%, 22% 100%);
  display: grid;
  place-items: center;
  padding-top: 13px;
  font: 10px "Recursive", monospace;
  text-transform: uppercase;
  transition: transform .7s ease;
}
.lower-jaw .tooth { transform: rotate(180deg); padding-top: 0; padding-bottom: 13px; }
.jaw-scene.open .tooth:nth-child(odd) { transform: translateX(-14px) rotate(-7deg); }
.jaw-scene.open .lower-jaw .tooth:nth-child(odd) { transform: translateX(14px) rotate(187deg); }
.tongue-claim {
  position: absolute;
  bottom: 168px;
  max-width: 330px;
  padding: 18px 22px;
  background: var(--vellum);
  color: var(--ink);
  border: 2px solid var(--amber);
  transform: rotate(-3deg);
  box-shadow: 10px 10px 0 rgba(90,40,70,.55);
  font-size: 18px;
}
.investigate {
  cursor: pointer;
  justify-self: start;
  margin-left: 9vw;
  color: var(--ink);
  background: var(--amber);
  border: 0;
  padding: 14px 22px;
  font-family: "Recursive", monospace;
  text-transform: uppercase;
  letter-spacing: .1em;
  box-shadow: 7px 7px 0 var(--plum);
}
.mono-note { margin-left: 9vw; color: rgba(183,240,74,.8); }

.rib-archive {
  width: min(520px, 80vw);
  margin-top: 20px;
  transform: rotate(-2deg);
}
.archive-drawer {
  cursor: pointer;
  display: grid;
  width: 100%;
  grid-template-columns: 118px 1fr 0fr;
  gap: 18px;
  align-items: center;
  margin: 10px 0;
  padding: 14px;
  color: var(--ink);
  background: var(--vellum);
  border: 2px solid var(--ink);
  box-shadow: 8px 8px 0 rgba(46,125,115,.45);
  font-size: 18px;
  transition: transform .35s ease, grid-template-columns .35s ease;
}
.archive-drawer b, .archive-drawer em { font-family: "Recursive", monospace; font-size: 12px; color: var(--plum); }
.archive-drawer em { overflow: hidden; white-space: nowrap; color: var(--verdigris); }
.archive-drawer.open { transform: translateX(44px); grid-template-columns: 118px 1fr 110px; }
.string-board {
  position: absolute;
  right: 8vw; bottom: 10vh;
  width: min(44vw, 540px);
  opacity: .85;
}
.string-board circle, .stars circle { fill: var(--amber); }
.draw-line { fill: none; stroke: var(--venom); stroke-width: 2; stroke-dasharray: 900; stroke-dashoffset: 900; transition: stroke-dashoffset 1.8s ease; }
.scene.active .draw-line { stroke-dashoffset: 0; }

.jar-laboratory { display: flex; gap: 34px; align-items: end; margin-top: 36px; }
.assumption-jar {
  width: 158px; height: 230px;
  border: 3px solid rgba(232,220,193,.76);
  border-radius: 36px 36px 20px 20px;
  background: linear-gradient(180deg, rgba(232,220,193,.08), rgba(46,125,115,.2));
  position: relative;
  display: grid;
  place-items: center;
  color: var(--vellum);
  box-shadow: inset 0 -70px 40px rgba(46,125,115,.22), 0 0 26px rgba(46,125,115,.14);
}
.assumption-jar.tall { height: 290px; }
.assumption-jar span { width: 86%; text-align: center; font-size: 22px; font-style: italic; }
.assumption-jar small { position: absolute; top: 12px; font-family: "Recursive", monospace; color: var(--venom); }
.assumption-jar i {
  position: absolute; bottom: 18px;
  width: 88px; height: 36px;
  border-radius: 50%;
  background: rgba(183,240,74,.25);
  animation: digest 3.7s ease-in-out infinite;
}
@keyframes digest { 50% { transform: scale(1.2,.72); filter: blur(2px); } }
.moth-field { position: absolute; inset: 0; pointer-events: none; }
.moth-field i {
  position: absolute;
  width: 18px; height: 12px;
  background: var(--venom);
  clip-path: polygon(50% 45%, 0 0, 12% 100%, 50% 55%, 88% 100%, 100% 0);
  opacity: .72;
  filter: drop-shadow(0 0 9px var(--venom));
}
.wax-seal {
  position: absolute;
  right: 18vw; bottom: 17vh;
  width: 116px; height: 116px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle, var(--amber), #8b432c);
  color: var(--ink);
  font: 18px "Cinzel Decorative", serif;
  transform: rotate(14deg);
}

.observatory { position: relative; width: min(720px, 72vw); }
.horns-svg { width: 100%; overflow: visible; }
.horn, .compass { fill: none; stroke: var(--vellum); stroke-width: 5; stroke-linecap: round; }
.compass { stroke: rgba(217,154,49,.55); stroke-width: 2; transform-origin: 360px 310px; animation: sweep 5s ease-in-out infinite alternate; }
@keyframes sweep { to { transform: rotate(6deg); } }
.counter-tag {
  position: absolute;
  right: 4%; top: 30%;
  background: var(--vellum);
  color: var(--ink);
  border-left: 5px solid var(--venom);
  padding: 12px 16px;
  transform: rotate(5deg);
}

.verdict-nest { position: relative; width: min(650px, 76vw); height: 390px; margin-top: 28px; }
.curled-beast {
  position: absolute; inset: 0;
  border: 24px solid rgba(232,220,193,.62);
  border-left-color: var(--plum);
  border-bottom-color: var(--verdigris);
  border-radius: 54% 46% 50% 48%;
  box-shadow: inset 0 0 46px rgba(11,14,22,.82), 0 0 34px rgba(217,154,49,.18);
  animation: breathe 4.8s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.025) rotate(-1deg); } }
.conclusion-orb {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 310px; min-height: 180px;
  border-radius: 50%;
  display: grid; place-items: center;
  padding: 36px;
  text-align: center;
  background: radial-gradient(circle, #E8DCC1 0%, #D99A31 56%, rgba(217,154,49,.08) 72%);
  color: var(--ink);
  box-shadow: 0 0 60px rgba(217,154,49,.62), 0 0 120px rgba(183,240,74,.18);
  font-size: 23px;
  line-height: 1.16;
}
.closing-marginalia { color: var(--amber); }

@media (max-width: 850px) {
  .lair-map { position: fixed; inset: auto 0 0 0; height: 72px; width: auto; flex-direction: row; align-items: center; justify-content: space-around; background: rgba(11,14,22,.86); border-left: 0; border-top: 1px solid rgba(232,220,193,.2); }
  .map-title { display: none; }
  .map-mark { padding: 6px; font-size: 0; }
  .map-mark span { margin: 0; }
  .scene { padding: 12vh 7vw 16vh; }
  .chapter-initial { left: 5vw; }
  .monster-silhouette { width: 140vw; right: -56vw; opacity: .24; }
  .jaw-stage { width: 100%; }
  .tooth { width: 54px; font-size: 8px; }
  .string-board { position: relative; right: auto; bottom: auto; width: 90vw; margin-top: 20px; }
  .jar-laboratory { flex-wrap: wrap; gap: 18px; }
  .assumption-jar { width: 130px; }
}
