:root {
  /* compliance vocabulary: command line types `inspect localhost`. Bubbles rise from the bottom edge; IBM Plex Mono**; Interrogate the Request**; Space Mono** compact labels */
  --ink: #2B2533;
  --paper: #FFF4E8;
  --blue: #BFE8F7;
  --rose: #F6B7C8;
  --mint: #CDEFC7;
  --lavender: #D8C7FF;
  --brass: #B9904A;
  --glow: #7AF7D4;
  --display: "Cinzel Decorative", Georgia, serif;
  --mono: "IBM Plex Mono", "Space Mono", monospace;
  --body: "Spectral", Georgia, serif;
  --tag: "Space Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  background:
    radial-gradient(circle at 16% 12%, rgba(216, 199, 255, .65), transparent 24rem),
    radial-gradient(circle at 86% 6%, rgba(191, 232, 247, .72), transparent 26rem),
    linear-gradient(135deg, #FFF4E8 0%, #F6B7C8 52%, #CDEFC7 100%);
  overflow-x: hidden;
}

.desk-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .36;
  background-image:
    repeating-linear-gradient(90deg, rgba(43, 37, 51, .035) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(0deg, rgba(185, 144, 74, .05) 0 1px, transparent 1px 18px);
  mix-blend-mode: multiply;
  z-index: 0;
}

.case-cartouche {
  position: fixed;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 20;
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 104px;
  padding: 12px 18px;
  background: rgba(255, 244, 232, .88);
  border: 1px solid var(--brass);
  border-radius: 30px 12px 30px 12px;
  box-shadow: 0 24px 70px rgba(43, 37, 51, .16), inset 0 0 0 8px rgba(216, 199, 255, .26);
  backdrop-filter: blur(10px);
  animation: ledgerSlide .9s cubic-bezier(.16, .84, .25, 1) both;
}

.case-cartouche::before,
.case-cartouche::after {
  content: "✦ ❦ ✦";
  position: absolute;
  color: var(--brass);
  font-family: var(--display);
  letter-spacing: .8em;
  opacity: .72;
}

.case-cartouche::before { left: 30px; bottom: 6px; }
.case-cartouche::after { right: 24px; top: 6px; transform: rotate(180deg); }

.badge-seal {
  display: grid;
  justify-items: center;
  gap: 2px;
  font: 700 .66rem var(--tag);
  letter-spacing: .08em;
  color: var(--ink);
}

.badge-seal svg { width: 70px; height: 70px; filter: drop-shadow(0 7px 0 rgba(185, 144, 74, .14)); }
.badge-seal path:first-child { fill: var(--mint); stroke: var(--brass); stroke-width: 3; }
.badge-seal path:not(:first-child) { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }

.title-block { text-align: center; }
.case-id, .mono-tag, .drop-label { margin: 0; font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--brass); }
h1, h2 { font-family: var(--display); margin: 0; line-height: .98; }
h1 { font-size: clamp(2.1rem, 5vw, 5.4rem); text-shadow: 2px 2px 0 var(--lavender); }

.evidence-tabs { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.evidence-tabs a, .begin-link, .annotation-trigger {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 600;
  border: 1px solid var(--brass);
  background: linear-gradient(180deg, rgba(255,255,255,.45), rgba(246,183,200,.36));
  box-shadow: inset 0 -4px 0 rgba(185, 144, 74, .16);
  cursor: pointer;
}
.evidence-tabs a { padding: 9px 12px; border-radius: 999px; font-size: .76rem; }
.evidence-tabs a:hover, .begin-link:hover, .annotation-trigger:hover { background: linear-gradient(180deg, var(--blue), var(--rose)); transform: translateY(-2px); }

.patrol-margin {
  position: fixed;
  z-index: 15;
  top: 148px;
  left: 24px;
  bottom: 20px;
  width: 156px;
  padding: 18px 12px;
  background: rgba(255, 244, 232, .74);
  border: 1px solid var(--brass);
  border-radius: 72px 72px 22px 22px;
  box-shadow: 0 20px 60px rgba(43, 37, 51, .12), inset 0 0 0 6px rgba(191, 232, 247, .34);
  backdrop-filter: blur(9px);
}

.rail-title { font: 700 .65rem var(--tag); text-transform: uppercase; text-align: center; letter-spacing: .16em; color: var(--brass); margin-bottom: 15px; }
.clue-stamp {
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 7px;
  margin: 8px 0;
  padding: 8px;
  color: var(--ink);
  font: 600 .78rem var(--mono);
  text-align: left;
  background: rgba(205, 239, 199, .35);
  border: 1px dashed var(--brass);
  border-radius: 999px;
  cursor: pointer;
  transition: transform .25s ease, background .25s ease;
}
.clue-stamp span { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; background: var(--paper); border: 1px solid var(--brass); }
.clue-stamp.active { background: var(--glow); transform: translateX(10px) rotate(-2deg); box-shadow: 0 8px 0 rgba(185, 144, 74, .18); }
.vial-stack { display: flex; justify-content: center; gap: 8px; padding-top: 18px; }
.vial-stack i { width: 18px; height: 64px; border: 1px solid var(--brass); border-radius: 999px; background: linear-gradient(180deg, transparent 20%, var(--blue) 21% 62%, var(--rose)); }
.botanical-divider { text-align: center; margin-top: 20px; font-size: 2.6rem; color: var(--brass); }

.ledger { position: relative; z-index: 5; margin-left: 204px; padding: 148px 30px 60px 0; }
.evidence-sheet {
  min-height: calc(100vh - 130px);
  margin: 0 0 34px;
  padding: clamp(24px, 4vw, 54px);
  border: 1px solid var(--brass);
  border-radius: 18px 62px 18px 62px;
  background:
    linear-gradient(135deg, rgba(255, 244, 232, .92), rgba(255, 244, 232, .78)),
    radial-gradient(circle at 92% 12%, rgba(122, 247, 212, .42), transparent 21rem);
  box-shadow: 0 30px 100px rgba(43, 37, 51, .14), inset 0 0 0 10px rgba(216, 199, 255, .25);
  position: relative;
  overflow: hidden;
  transform: translateX(-54px);
  opacity: 0;
  transition: transform .75s cubic-bezier(.16,.84,.25,1), opacity .75s ease;
}
.evidence-sheet.revealed { transform: translateX(0); opacity: 1; }
.evidence-sheet::before { content: attr(data-case); position: absolute; right: 24px; top: 18px; font: 700 7rem var(--tag); color: rgba(185, 144, 74, .11); }
.evidence-sheet::after { content: "❧       ❧       ❧"; position: absolute; left: 28px; right: 28px; bottom: 14px; text-align: center; color: var(--brass); letter-spacing: 2rem; opacity: .45; }

.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 34px; align-items: center; }
.ornate-frame { border: double 7px var(--brass); border-radius: 28px; padding: clamp(24px, 5vw, 60px); background: rgba(255, 244, 232, .55); position: relative; }
.ornate-frame h2 { font-size: clamp(2.6rem, 6.8vw, 7.4rem); max-width: 980px; }
.ornate-frame h2 span, .dropcap { float: left; font-family: var(--display); font-size: 1.25em; line-height: .72; color: var(--brass); text-shadow: 2px 2px 0 var(--lavender); margin-right: 8px; }
.hero-copy { font-size: clamp(1.16rem, 2vw, 1.55rem); max-width: 760px; line-height: 1.55; }
.terminal-box { margin: 28px 0 22px; padding: 18px 20px; border-radius: 18px; background: #2B2533; color: var(--glow); font: 600 clamp(1rem, 2vw, 1.28rem) var(--mono); box-shadow: 0 0 32px rgba(122,247,212,.26), inset 0 0 0 1px rgba(122,247,212,.44); }
.prompt { color: var(--rose); margin-right: 10px; }
.cursor { display: inline-block; width: 10px; height: 1.1em; background: var(--glow); margin-left: 3px; vertical-align: -2px; animation: blink .8s steps(1) infinite; }
.begin-link { display: inline-block; padding: 14px 20px; border-radius: 18px; }

.magnifier-card { justify-self: center; width: min(100%, 360px); padding: 28px; border: 1px solid var(--brass); border-radius: 180px 180px 34px 34px; background: linear-gradient(180deg, rgba(191,232,247,.62), rgba(246,183,200,.45)); text-align: center; }
.lens { width: 230px; max-width: 100%; aspect-ratio: 1; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 50%; border: 12px solid rgba(185,144,74,.65); background: radial-gradient(circle at 30% 22%, rgba(255,255,255,.95) 0 10%, transparent 11%), linear-gradient(135deg, rgba(191,232,247,.85), rgba(246,183,200,.72)); box-shadow: 24px 24px 0 rgba(185,144,74,.25); font: 700 1.6rem var(--mono); }
.lens small { display: block; color: var(--brass); }

.chapter { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 30px; align-items: center; }
.chapter-mark { position: absolute; top: 22px; left: 28px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--brass); background: var(--mint); font: 700 .75rem var(--tag); text-transform: uppercase; letter-spacing: .12em; }
.tutorial-plate { max-width: 890px; padding-top: 38px; }
.plate-heading { display: flex; gap: 14px; align-items: flex-start; border-bottom: 1px solid rgba(185,144,74,.55); padding-bottom: 15px; margin-bottom: 18px; }
.chapter h2 { font-size: clamp(2rem, 4.6vw, 4.8rem); }
.chapter p { font-size: 1.18rem; line-height: 1.65; }
.code-card { margin: 24px 0; padding: 22px; overflow: auto; background: linear-gradient(135deg, #2B2533, #3b3147); color: var(--glow); border-radius: 20px; border: 1px solid var(--brass); box-shadow: inset 0 0 0 1px rgba(122,247,212,.28); font: 600 1rem/1.7 var(--mono); white-space: pre-wrap; }
.annotation-trigger { padding: 12px 16px; border-radius: 999px; }
.annotation-panel { max-height: 0; overflow: hidden; margin-top: 12px; padding: 0 18px; border-left: 4px solid var(--brass); background: rgba(191,232,247,.36); font: 600 1rem var(--mono); transition: max-height .38s ease, padding .38s ease; }
.annotation-panel.open { max-height: 160px; padding: 16px 18px; }

.diagram, .vine-run { min-height: 270px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; border: 1px solid var(--brass); border-radius: 150px; background: rgba(205,239,199,.37); position: relative; }
.diagram span, .vine-run span { padding: 10px 16px; border: 1px solid var(--brass); border-radius: 999px; background: var(--paper); font: 700 .88rem var(--mono); }
.diagram b { width: 2px; height: 42px; background: var(--brass); position: relative; }
.diagram b::after { content: ""; position: absolute; left: -6px; bottom: -2px; width: 14px; height: 14px; border-right: 2px solid var(--brass); border-bottom: 2px solid var(--brass); transform: rotate(45deg); }
.vine-run { border-radius: 34px; background: radial-gradient(circle at 50% 50%, rgba(122,247,212,.32), rgba(205,239,199,.32)); }
.vine-run i { width: 72%; height: 30px; border-bottom: 4px dotted var(--brass); border-radius: 50%; position: relative; }
.vine-run i::before, .vine-run i::after { content: "❧"; position: absolute; color: var(--brass); top: 7px; }
.vine-run i::before { left: 18%; } .vine-run i::after { right: 18%; transform: rotate(180deg); }
.wax-seal { justify-self: center; display: grid; place-items: center; width: 230px; aspect-ratio: 1; text-align: center; border-radius: 50%; color: var(--paper); background: radial-gradient(circle, #B9904A 0 58%, #9a7133 59% 100%); font: 700 1.25rem var(--mono); box-shadow: inset 0 0 0 8px rgba(255,244,232,.25), 0 18px 0 rgba(43,37,51,.12); }
.wax-seal small { font-family: var(--display); font-size: 1.35rem; }

.bubble-field { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.bubble { position: absolute; bottom: -120px; width: var(--size); height: var(--size); left: var(--left); border-radius: 50%; background: radial-gradient(circle at 30% 22%, rgba(255,255,255,.95) 0 12%, transparent 13%), linear-gradient(135deg, rgba(191,232,247,.42), rgba(246,183,200,.36)); border: 1px solid rgba(185,144,74,.42); box-shadow: inset -12px -18px 28px rgba(216,199,255,.25), 0 0 28px rgba(191,232,247,.36); animation: drift var(--dur) linear infinite; }
.bubble::after { content: attr(data-clue); position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink); font: 700 clamp(.68rem, 1.3vw, 1rem) var(--mono); opacity: .74; transform: scale(.9); }
.b1 { --size: 92px; --left: 9%; --dur: 13s; animation-delay: -2s; } .b2 { --size: 128px; --left: 34%; --dur: 18s; animation-delay: -8s; } .b3 { --size: 76px; --left: 72%; --dur: 15s; animation-delay: -4s; } .b4 { --size: 62px; --left: 88%; --dur: 12s; animation-delay: -6s; } .b5 { --size: 110px; --left: 55%; --dur: 20s; animation-delay: -11s; } .b6 { --size: 84px; --left: 22%; --dur: 16s; animation-delay: -1s; }

@keyframes ledgerSlide { from { transform: translateY(-140px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes drift { from { transform: translateY(0) translateX(0) scale(.86); } 45% { transform: translateY(-56vh) translateX(34px) scale(1.08); } to { transform: translateY(-118vh) translateX(-20px) scale(.92); } }

@media (max-width: 920px) {
  .case-cartouche { position: relative; top: auto; left: auto; right: auto; margin: 12px; grid-template-columns: 1fr; text-align: center; }
  .evidence-tabs { justify-content: center; }
  .patrol-margin { position: sticky; top: 8px; left: auto; width: auto; margin: 8px 12px; bottom: auto; display: flex; align-items: center; gap: 6px; overflow-x: auto; border-radius: 24px; }
  .rail-title, .vial-stack, .botanical-divider { display: none; }
  .clue-stamp { min-width: 108px; margin: 0; }
  .ledger { margin-left: 0; padding: 10px 12px 40px; }
  .hero, .chapter { grid-template-columns: 1fr; }
  .evidence-sheet { min-height: auto; }
}
