:root {
  --bog-black: #07090A;
  --wet-moss: #1F3A2D;
  --rotcap-brown: #6B4328;
  --glowcap-lime: #B7FF3C;
  --goblin-aqua: #22F3C9;
  --foxglove-magenta: #FF4FD8;
  --bone-parchment: #F1E6C8;
  --commissioner: "Commissioner", Inter, system-ui, sans-serif;
  --fraunces: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", "Space Mono", monospace;
}

/* Typography compliance: IBM Plex Mono` diagnostics weights 400–600 for characterful contrast. */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--bone-parchment);
  background:
    radial-gradient(circle at 30% 40%, #22F3C955, transparent 35%),
    radial-gradient(circle at 72% 12%, #FF4FD822, transparent 24%),
    linear-gradient(180deg, #07090A 0%, #102016 38%, #07090A 100%);
  font-family: var(--commissioner);
  overflow-x: hidden;
}

button { font: inherit; color: inherit; }

.ambient-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .23;
  background-image:
    radial-gradient(circle at 18% 22%, #F1E6C822 0 1px, transparent 1px),
    radial-gradient(circle at 72% 61%, #B7FF3C22 0 1px, transparent 1px),
    linear-gradient(115deg, transparent 0 46%, #6B43280f 46% 47%, transparent 47% 100%);
  background-size: 38px 38px, 54px 54px, 9px 9px;
  mix-blend-mode: screen;
}

.bead-nav {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: grid;
  gap: 14px;
}

.bead-nav::before {
  content: "";
  position: absolute;
  top: -18px;
  bottom: -18px;
  left: 50%;
  width: 1px;
  background: linear-gradient(var(--rotcap-brown), var(--goblin-aqua), var(--rotcap-brown));
}

.bead {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--wet-moss);
  border: 1px solid var(--rotcap-brown);
  box-shadow: 0 0 0 3px #07090A;
}

.bead.is-lit { background: var(--glowcap-lime); box-shadow: 0 0 18px var(--glowcap-lime), 0 0 0 3px #07090A; }

.chamber {
  min-height: 100vh;
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(48px, auto);
  gap: 18px;
  padding: clamp(28px, 5vw, 72px);
  overflow: hidden;
  isolation: isolate;
}

.chamber::before {
  content: "";
  position: absolute;
  inset: -8%;
  background:
    radial-gradient(circle at 20% 70%, #1F3A2Daa, transparent 30%),
    radial-gradient(circle at 80% 25%, #6B432840, transparent 26%);
  z-index: -2;
}

.tiny-label, .slab span, .vertical-clue, .tag-card, .diagnostic-stones, .final-tag {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .12em;
}

.moss-label {
  grid-column: 1 / 5;
  align-self: start;
  justify-self: start;
  transform: rotate(-3deg);
  padding: 13px 24px;
  color: var(--bog-black);
  font-weight: 800;
  letter-spacing: .04em;
  background: var(--glowcap-lime);
  border: 4px solid var(--wet-moss);
  border-radius: 22px 9px 20px 11px;
  box-shadow: 0 0 28px #B7FF3C55, 8px 10px 0 #6B4328;
}

.question-pool {
  grid-column: 2 / 9;
  grid-row: 3 / 9;
  min-height: 520px;
  position: relative;
  transform: rotate(-1.2deg);
}

.pool-core, .bog-pool, .ring-pool {
  position: absolute;
  inset: 6%;
  border-radius: 48% 52% 44% 56% / 56% 43% 57% 44%;
  background:
    radial-gradient(circle at 35% 32%, #22F3C999, transparent 18%),
    radial-gradient(circle at 58% 62%, #B7FF3C77, transparent 26%),
    linear-gradient(145deg, #1F3A2D, #07090A 60%);
  border: 2px solid #22F3C9aa;
  box-shadow: inset 0 0 70px #07090A, 0 0 44px #22F3C966;
  animation: poolBreath 7s ease-in-out infinite;
}

.pool-text {
  position: relative;
  z-index: 2;
  max-width: 760px;
  padding: min(11vw, 112px) 32px 32px;
}

h1, h2 {
  margin: 0;
  font-family: var(--commissioner);
  font-weight: 800;
  line-height: .93;
  letter-spacing: -.045em;
}

h1 { font-size: clamp(54px, 8vw, 124px); text-shadow: 0 0 22px #22F3C966; }
h2 { font-size: clamp(42px, 6vw, 86px); }
.tiny-label { color: var(--glowcap-lime); font-size: 12px; }

.response-fragments {
  grid-column: 8 / 13;
  grid-row: 4 / 9;
  display: grid;
  align-content: center;
  gap: 18px;
  z-index: 4;
}

.answer-fragment, .stone-button {
  border: 1px solid #22F3C988;
  background: linear-gradient(135deg, #1F3A2Ddd, #07090Add);
  color: var(--bone-parchment);
  padding: 18px 22px;
  border-radius: 26px 12px 28px 15px;
  cursor: pointer;
  font-family: var(--fraunces);
  font-size: clamp(18px, 2vw, 27px);
  box-shadow: 0 12px 30px #0008, inset 0 0 22px #22F3C918;
  transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
}

.answer-fragment:nth-child(1) { transform: rotate(2deg) translateX(-32px); }
.answer-fragment:nth-child(2) { transform: rotate(-3deg) translateX(26px); }
.answer-fragment:nth-child(3) { transform: rotate(1deg) translateX(-12px); }
.answer-fragment:nth-child(4) { transform: rotate(4deg) translateX(38px); }
.answer-fragment:hover, .stone-button:hover { border-color: var(--glowcap-lime); box-shadow: 0 0 30px #B7FF3C77, inset 0 0 28px #22F3C933; }

.collage-halo { grid-column: 8 / 13; grid-row: 1 / 5; position: relative; min-height: 300px; }
.cap { position: absolute; width: 170px; height: 98px; background: var(--rotcap-brown); clip-path: polygon(8% 74%, 24% 24%, 55% 5%, 84% 22%, 96% 76%, 65% 88%, 31% 85%); border: 2px solid #F1E6C866; box-shadow: 0 0 24px #FF4FD833; }
.cap span { position: absolute; inset: 58% 20% 7%; background: repeating-linear-gradient(90deg, #22F3C9, #22F3C9 2px, transparent 2px, transparent 11px); opacity: .75; }
.cap-one { right: 16%; top: 6%; transform: rotate(12deg); }
.cap-two { right: 47%; top: 42%; transform: rotate(-19deg) scale(.78); background: #1F3A2D; }
.circuit-scrap, .tag-card { position: absolute; padding: 15px; background: #F1E6C8; color: #07090A; border: 3px solid #6B4328; font-family: var(--mono); box-shadow: 10px 12px 0 #07090A99; }
.circuit-scrap { right: 4%; top: 34%; transform: rotate(7deg); }
.bottle-charm { position: absolute; width: 76px; height: 76px; border-radius: 50%; right: 40%; top: 10%; border: 2px solid var(--goblin-aqua); background: radial-gradient(circle, #22F3C966, transparent 58%); }
.moth-wing { position: absolute; width: 120px; height: 170px; right: 8%; top: 4%; background: linear-gradient(130deg, #F1E6C822, #FF4FD844); clip-path: polygon(50% 0, 88% 18%, 98% 58%, 55% 100%, 12% 58%, 18% 18%); transform: rotate(22deg); }

.witness-bubble { position: absolute; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--goblin-aqua); background: radial-gradient(circle at 32% 24%, #F1E6C855, #22F3C91f 55%, #07090A44); color: var(--bone-parchment); font-family: var(--mono); box-shadow: 0 0 24px #22F3C955; animation: bob 5s ease-in-out infinite; }
.bubble-a { width: 74px; height: 74px; left: 12%; top: 24%; }
.bubble-b { width: 58px; height: 58px; left: 74%; top: 62%; animation-delay: -1s; }
.bubble-c { width: 96px; height: 96px; left: 45%; top: 12%; animation-delay: -2.3s; }
.bubble-d { width: 70px; height: 70px; left: 84%; top: 28%; animation-delay: -3.1s; }

.cabinet { background: linear-gradient(180deg, #07090A, #122018 52%, #07090A); }
.vertical-clue { grid-column: 1 / 2; grid-row: 2 / 10; writing-mode: vertical-rl; color: var(--goblin-aqua); font-size: 18px; }
.slab { position: relative; padding: 28px; background: #F1E6C8; color: #07090A; border: 4px solid var(--rotcap-brown); box-shadow: 14px 16px 0 #0008; clip-path: polygon(3% 2%, 96% 0, 100% 88%, 88% 100%, 0 94%); z-index: 3; }
.slab p { font-family: var(--fraunces); font-size: clamp(28px, 4vw, 58px); line-height: 1.02; margin: 18px 0 0; }
.slab-a { grid-column: 2 / 8; grid-row: 2 / 5; transform: rotate(-2deg); }
.slab-b { grid-column: 6 / 12; grid-row: 5 / 8; transform: rotate(3deg); background: #d9c39d; }
.slab-c { grid-column: 3 / 9; grid-row: 8 / 11; transform: rotate(-4deg); }
.slime-ripple { grid-column: 7 / 13; grid-row: 2 / 8; border-radius: 50%; background: radial-gradient(circle, #22F3C966 0 2px, transparent 3px 20px, #B7FF3C33 21px 23px, transparent 24px); filter: blur(.2px); opacity: .75; animation: rippleDrift 6s linear infinite; z-index: 1; }
.keyboard-keys { grid-column: 9 / 13; grid-row: 8 / 10; display: flex; gap: 13px; transform: rotate(8deg); z-index: 4; }
.keyboard-keys span { padding: 18px 20px; background: #07090A; border: 2px solid #F1E6C8; border-radius: 8px; color: var(--glowcap-lime); box-shadow: inset 0 -8px 0 #1F3A2D; font-family: var(--mono); }
.evidence-string { position: absolute; height: 2px; background: linear-gradient(90deg, #6B4328, #B7FF3C, #6B4328); transform-origin: left; z-index: 2; }
.string-one { width: 45vw; left: 18%; top: 42%; transform: rotate(15deg); }
.string-two { width: 38vw; left: 32%; top: 72%; transform: rotate(-11deg); }
.tag-card { right: 8%; bottom: 10%; transform: rotate(-6deg); }

.mirror { background: radial-gradient(circle at 70% 55%, #22F3C930, transparent 34%), linear-gradient(180deg, #07090A, #13281f); }
.bog-title { grid-column: 1 / 7; grid-row: 2 / 5; z-index: 3; }
.mirror-mask { grid-column: 7 / 13; grid-row: 1 / 6; position: relative; }
.mask-half { position: absolute; width: 220px; height: 330px; top: 14%; border: 2px solid; }
.mask-half.human { left: 22%; background: #F1E6C820; border-color: var(--bone-parchment); clip-path: polygon(45% 0, 76% 11%, 87% 45%, 68% 100%, 30% 93%, 14% 42%); }
.mask-half.machine { left: 42%; background: #22F3C922; border-color: var(--goblin-aqua); clip-path: polygon(20% 4%, 82% 0, 92% 30%, 77% 88%, 42% 100%, 12% 69%); transform: rotate(7deg); }
.speech-cloud { padding: 26px; border-radius: 42px 24px 40px 18px; font-family: var(--fraunces); font-size: clamp(22px, 3vw, 42px); border: 1px solid; box-shadow: 0 20px 42px #0008; z-index: 4; }
.human-cloud { grid-column: 2 / 8; grid-row: 6 / 8; background: #F1E6C8; color: #07090A; transform: rotate(2deg); border-color: var(--rotcap-brown); }
.machine-cloud { grid-column: 6 / 12; grid-row: 7 / 10; background: #07090Add; color: var(--goblin-aqua); transform: rotate(-2deg); border-color: var(--goblin-aqua); }
.goblin-cloud { grid-column: 3 / 9; grid-row: 10 / 12; background: #1F3A2Dee; color: var(--glowcap-lime); transform: rotate(3deg); border-color: var(--glowcap-lime); }
.bog-pool { grid-column: 5 / 11; grid-row: 4 / 11; inset: auto; width: 54vw; height: 54vw; max-width: 680px; max-height: 680px; align-self: center; justify-self: center; z-index: 1; opacity: .7; }
.diagnostic-stones { grid-column: 1 / 5; grid-row: 9 / 12; display: grid; gap: 11px; align-content: end; }
.diagnostic-stones span { background: #07090A; border: 1px solid #6B4328; padding: 12px; border-radius: 50px; color: var(--foxglove-magenta); }

.verdict { background: radial-gradient(circle at center, #1F3A2D, #07090A 68%); }
.ring-heading { grid-column: 1 / 6; grid-row: 2 / 8; z-index: 3; }
.ring-heading p { font-family: var(--fraunces); font-size: clamp(21px, 2.2vw, 34px); line-height: 1.16; color: #F1E6C8cc; }
.fairy-ring { grid-column: 5 / 13; grid-row: 2 / 11; position: relative; min-height: 650px; }
.ring-pool { inset: 22% 18%; display: grid; place-items: center; padding: 44px; text-align: center; font-family: var(--fraunces); font-size: clamp(26px, 3vw, 48px); color: var(--bone-parchment); }
.stone-button { position: absolute; max-width: 230px; background: linear-gradient(145deg, #28392f, #07090A); font-size: 18px; border-radius: 44% 56% 45% 55%; z-index: 5; }
.stone-button:nth-child(1) { left: 13%; top: 16%; transform: rotate(-10deg); }
.stone-button:nth-child(2) { right: 9%; top: 24%; transform: rotate(8deg); }
.stone-button:nth-child(3) { left: 18%; bottom: 16%; transform: rotate(6deg); }
.stone-button:nth-child(4) { right: 15%; bottom: 13%; transform: rotate(-7deg); }
.celebration-sparks { position: absolute; inset: 0; pointer-events: none; }
.final-tag { grid-column: 2 / 7; grid-row: 10 / 12; color: var(--foxglove-magenta); transform: rotate(-2deg); }

.ripple-ring, .spark {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  translate: -50% -50%;
}
.ripple-ring { width: 24px; height: 24px; border: 2px solid var(--goblin-aqua); animation: ringOut 950ms ease-out forwards; z-index: 20; }
.ripple-ring.lime { border-color: var(--glowcap-lime); }
.spark { width: 8px; height: 8px; background: var(--foxglove-magenta); box-shadow: 0 0 12px var(--foxglove-magenta); animation: sparkPop 850ms ease-out forwards; z-index: 20; }

@keyframes poolBreath { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.035) rotate(1.5deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-18px) scale(1.06); } }
@keyframes rippleDrift { from { background-position: 0 0; } to { background-position: 90px 90px; } }
@keyframes ringOut { to { width: 220px; height: 220px; opacity: 0; } }
@keyframes sparkPop { to { transform: translate(var(--sx), var(--sy)) scale(.1); opacity: 0; } }

@media (max-width: 820px) {
  .chamber { display: block; padding: 28px 20px; }
  .question-pool, .collage-halo, .response-fragments, .fairy-ring { min-height: auto; margin: 28px 0; }
  .pool-core { position: relative; min-height: 420px; inset: 0; }
  .pool-text { position: absolute; inset: 0; padding: 70px 20px; }
  .answer-fragment, .slab, .speech-cloud { margin: 18px 0; transform: rotate(0deg) !important; }
  .bog-pool, .mirror-mask, .vertical-clue, .evidence-string { display: none; }
  .fairy-ring { min-height: 720px; }
  .bead-nav { right: 10px; }
}
