:root {
  /* Typography compliance phrase from DESIGN.md: Space Grotesk** Grotes* Grotes Grotesk Groteskk Groteskkkk for small retro-futuristic interface labels. */
  --midnight: #12091F;
  --cyan: #7DF9FF;
  --violet: #6A2FD6;
  --absinthe: #B7FF5A;
  --brass: #C8943F;
  --lilac: #E7D9FF;
  --cherry: #3B071B;
  --display: "Cormorant Garamond", Georgia, serif;
  --hand: "Caveat", "Bradley Hand", cursive;
  --space: "Space Grotesk", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--lilac);
  background:
    radial-gradient(circle at 50% 14%, rgba(106, 47, 214, .38), transparent 34rem),
    radial-gradient(circle at 12% 55%, rgba(59, 7, 27, .82), transparent 30rem),
    radial-gradient(circle at 88% 55%, rgba(59, 7, 27, .72), transparent 30rem),
    linear-gradient(180deg, #06030b 0%, var(--midnight) 38%, #080410 100%);
  font-family: var(--space);
  overflow-x: hidden;
}

.parlor-haze,
.scan-veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.parlor-haze {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 25%, rgba(18, 9, 31, .62) 68%),
    repeating-radial-gradient(ellipse at 50% 12%, rgba(200, 148, 63, .11) 0 1px, transparent 1px 20px);
  opacity: .9;
}

.scan-veil {
  background: repeating-linear-gradient(180deg, rgba(125, 249, 255, .04) 0 1px, transparent 1px 6px);
  mix-blend-mode: screen;
  opacity: .32;
}

.cabinet-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.tableau {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 6rem 1.25rem;
  position: relative;
}

.hero-tableau { padding-top: 3rem; }

.oracle-cabinet,
.drawer-cabinet {
  width: min(580px, 92vw);
  position: relative;
  text-align: center;
  padding: 2.6rem 2rem 2.2rem;
  border: 2px solid var(--brass);
  border-radius: 48% 48% 34px 34px / 84px 84px 34px 34px;
  background:
    linear-gradient(135deg, rgba(231, 217, 255, .08), transparent 32%),
    radial-gradient(circle at 50% 15%, rgba(125, 249, 255, .16), transparent 16rem),
    linear-gradient(180deg, rgba(59, 7, 27, .96), rgba(18, 9, 31, .96));
  box-shadow:
    0 0 0 8px rgba(200, 148, 63, .08),
    0 0 46px rgba(125, 249, 255, .28),
    inset 0 0 35px rgba(106, 47, 214, .48);
}

.oracle-cabinet::before,
.oracle-cabinet::after,
.section-plaque::before,
.section-plaque::after,
.card-back::before,
.card-back::after {
  content: "";
  position: absolute;
  border: 1px solid var(--brass);
  opacity: .8;
}

.oracle-cabinet::before { inset: 18px; border-radius: inherit; }
.oracle-cabinet::after { inset: 34px 28px; border-radius: 48% 48% 24px 24px / 66px 66px 24px 24px; border-color: rgba(125, 249, 255, .55); }

.frost-entry { animation: frostIn 1.7s cubic-bezier(.2, .8, .15, 1) both; }

.arch-crown {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  color: var(--brass);
  font-family: var(--space);
  font-size: .7rem;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.star-keyhole { color: var(--absinthe); text-shadow: 0 0 12px var(--absinthe); }

.lens-frame {
  position: relative;
  z-index: 2;
  width: 260px;
  height: 310px;
  margin: 1.4rem auto 1rem;
  padding: 13px;
  border: 2px solid var(--brass);
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background: linear-gradient(135deg, rgba(200, 148, 63, .28), rgba(125, 249, 255, .08));
  box-shadow: inset 0 0 18px rgba(200, 148, 63, .6), 0 0 26px rgba(125, 249, 255, .34);
}

.ice-lens {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--glint-x, 50%) var(--glint-y, 45%), rgba(183, 255, 90, .42), transparent 9%),
    radial-gradient(circle at 45% 38%, rgba(231, 217, 255, .9), rgba(125, 249, 255, .32) 24%, rgba(106, 47, 214, .56) 56%, rgba(18, 9, 31, .96) 100%);
}

.frost-mask {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(38deg, transparent 45%, rgba(231, 217, 255, .7) 46%, transparent 48%),
    linear-gradient(112deg, transparent 48%, rgba(125, 249, 255, .62) 49%, transparent 51%),
    radial-gradient(circle at 28% 70%, transparent 0 9px, rgba(231, 217, 255, .28) 10px 11px, transparent 12px);
  opacity: .72;
  animation: veinCreep 5.5s linear infinite alternate;
}

.lens-eye {
  position: absolute;
  width: 58px;
  height: 30px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  top: calc(47% + var(--eye-y, 0px));
  left: calc(50% + var(--eye-x, 0px));
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--midnight) 0 6px, var(--absinthe) 7px 9px, transparent 10px);
  box-shadow: 0 0 22px rgba(125, 249, 255, .85);
  transition: top .18s ease, left .18s ease;
}

.lens-bubbles span,
.mini-ecosystem i {
  position: absolute;
  display: block;
  border-radius: 50%;
  border: 1px solid rgba(125, 249, 255, .9);
  background: radial-gradient(circle at 35% 28%, #fff, rgba(125, 249, 255, .35) 35%, rgba(106, 47, 214, .15) 70%);
  box-shadow: 0 0 14px rgba(125, 249, 255, .55);
  animation: bubbleRise 5s ease-in-out infinite;
}

.lens-bubbles span:nth-child(1) { width: 26px; height: 26px; left: 32px; bottom: 24px; }
.lens-bubbles span:nth-child(2) { width: 16px; height: 16px; left: 170px; bottom: 50px; animation-delay: -1.7s; }
.lens-bubbles span:nth-child(3) { width: 22px; height: 22px; left: 118px; bottom: 12px; animation-delay: -3.1s; }

h1 {
  position: relative;
  z-index: 2;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(4.4rem, 12vw, 8.8rem);
  font-weight: 700;
  letter-spacing: .075em;
  line-height: .82;
  color: var(--lilac);
  text-shadow: 0 0 16px rgba(125, 249, 255, .62), 0 3px 0 rgba(59, 7, 27, .9);
  animation: etchTitle 2s .5s both;
}

.subtitle {
  position: relative;
  z-index: 2;
  max-width: 430px;
  margin: 1.2rem auto 1.5rem;
  font-family: var(--hand);
  font-size: 1.75rem;
  color: var(--cyan);
}

.drawer-labels {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .45rem;
}

.drawer-labels span,
.machine-label {
  font-family: var(--space);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--absinthe);
}

.drawer-labels span {
  border: 1px solid rgba(200, 148, 63, .55);
  padding: .55rem .35rem;
  background: rgba(18, 9, 31, .72);
}

.scribble {
  font-family: var(--hand);
  font-size: clamp(1.4rem, 2.8vw, 2.2rem);
  color: var(--lilac);
  position: absolute;
  z-index: 3;
  transform: rotate(-8deg);
  text-shadow: 0 0 12px var(--violet);
  animation: scribbleIn 1.3s 1.2s both;
}

.note-left { left: 5%; top: 22%; }
.note-right { right: 4%; top: 28%; transform: rotate(7deg); animation-delay: 1.5s; }
.note-bottom { bottom: 12%; left: 18%; transform: rotate(4deg); animation-delay: 1.8s; }

.side-rig {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 86px;
  display: grid;
  place-items: center;
  gap: 1rem;
}

.side-rig-left { left: clamp(10px, 4vw, 74px); }
.side-rig-right { right: clamp(10px, 4vw, 74px); }

.gauge {
  width: 74px;
  height: 74px;
  border: 2px solid var(--brass);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(125, 249, 255, .15), var(--cherry));
  box-shadow: 0 0 22px rgba(200, 148, 63, .25);
}

.gauge span {
  position: absolute;
  width: 2px;
  height: 28px;
  background: var(--absinthe);
  transform-origin: bottom center;
  transform: translateY(-13px) rotate(30deg);
  animation: needle 4s ease-in-out infinite alternate;
}

.gauge b { font-family: var(--space); font-size: .7rem; color: var(--lilac); margin-top: 32px; }

.bubble-tube {
  width: 40px;
  height: 330px;
  border: 1px solid rgba(200, 148, 63, .85);
  border-radius: 30px;
  background: linear-gradient(90deg, rgba(125, 249, 255, .08), rgba(231, 217, 255, .05), rgba(106, 47, 214, .18));
  position: relative;
  overflow: hidden;
}

.bubble-tube i {
  position: absolute;
  left: 8px;
  bottom: -32px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  color: var(--absinthe);
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: .72rem;
  animation: tubeBubble 7s linear infinite;
}

.bubble-tube i:nth-child(2) { animation-delay: -1.5s; left: 12px; width: 16px; height: 16px; }
.bubble-tube i:nth-child(3) { animation-delay: -3s; }
.bubble-tube i:nth-child(4) { animation-delay: -4.4s; left: 9px; width: 26px; height: 26px; }
.bubble-tube i:nth-child(5) { animation-delay: -6s; }

.brass-curl {
  width: 62px;
  height: 62px;
  border: 2px solid var(--brass);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(45deg);
}

.section-plaque {
  width: min(640px, 92vw);
  position: relative;
  text-align: center;
  padding: 1.35rem 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--brass);
  background: rgba(18, 9, 31, .78);
  box-shadow: inset 0 0 24px rgba(106, 47, 214, .35), 0 0 30px rgba(125, 249, 255, .12);
}

.section-plaque::before { inset: 8px; }
.section-plaque::after { inset: -9px 22%; border-radius: 50%; border-color: rgba(125, 249, 255, .45); }

.section-plaque span { color: var(--absinthe); font-family: var(--space); letter-spacing: .24em; }
.section-plaque h2 { margin: .15rem 0; font-family: var(--display); font-size: clamp(2.8rem, 7vw, 5.2rem); color: var(--lilac); letter-spacing: .06em; }
.section-plaque p { margin: 0 auto; max-width: 520px; color: rgba(231, 217, 255, .86); }

.curiosity-tableau { align-content: center; }

.card-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 310px));
  gap: 1.2rem;
  perspective: 1300px;
}

.card-gallery.single { grid-template-columns: minmax(280px, 560px); }

.flip-card {
  height: 390px;
  cursor: pointer;
  perspective: 1300px;
}

.wide-card { height: 330px; }

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .86s cubic-bezier(.2, .8, .18, 1);
}

.flip-card.is-flipped .flip-inner,
.flip-card:hover .flip-inner { transform: rotateY(180deg); }

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border: 2px solid var(--brass);
  border-radius: 26px 26px 44px 44px;
  overflow: hidden;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 1.4rem;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0,0,0,.38), inset 0 0 26px rgba(106, 47, 214, .28);
}

.card-back {
  background:
    linear-gradient(90deg, transparent 47%, rgba(125, 249, 255, .8) 49%, transparent 51%),
    radial-gradient(circle at 50% 24%, rgba(125, 249, 255, .15), transparent 9rem),
    var(--cherry);
}

.card-back::before { inset: 14px; border-radius: 22px 22px 38px 38px; }
.card-back::after { width: 84px; height: 84px; border-radius: 50%; top: 32px; left: 50%; transform: translateX(-50%); border-color: rgba(125, 249, 255, .58); }

.card-number { font-family: var(--display); font-size: 4rem; color: var(--brass); }
.card-face h3 { margin: .4rem 0 .7rem; font-family: var(--display); font-size: 2rem; letter-spacing: .05em; }

.card-front {
  transform: rotateY(180deg);
  background: radial-gradient(circle at 50% 28%, rgba(125, 249, 255, .26), transparent 11rem), linear-gradient(180deg, rgba(231, 217, 255, .14), rgba(18, 9, 31, .98));
}

.diagram { width: 82%; max-width: 260px; fill: none; stroke: var(--cyan); stroke-width: 3; filter: drop-shadow(0 0 9px rgba(125,249,255,.75)); }
.diagram circle { fill: rgba(183, 255, 90, .25); }

.revelation {
  font-family: var(--hand);
  font-size: 2rem;
  color: var(--lilac);
  margin: 1rem 0 0;
}

.moth { width: 190px; height: 130px; position: relative; animation: mothHum 2s ease-in-out infinite alternate; }
.moth span { position: absolute; top: 24px; width: 86px; height: 86px; border: 2px solid var(--brass); border-radius: 70% 20% 70% 20%; background: rgba(125, 249, 255, .16); }
.moth span:first-child { left: 8px; transform: rotate(-22deg); }
.moth span:last-child { right: 8px; transform: scaleX(-1) rotate(-22deg); }
.moth b { position: absolute; left: 50%; top: 18px; width: 14px; height: 100px; transform: translateX(-50%); border-radius: 12px; background: var(--absinthe); box-shadow: 0 0 18px var(--absinthe); }

.bubble-capsule {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .75rem;
  width: min(680px, 94vw);
  margin: -1rem auto 1.6rem;
  padding: 1rem;
  border: 1px solid rgba(125, 249, 255, .45);
  border-radius: 999px;
  background: rgba(231, 217, 255, .06);
}

.specimen-bubble {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  color: var(--midnight);
  font-family: var(--space);
  font-weight: 700;
  background: radial-gradient(circle at 30% 24%, #fff, var(--cyan) 38%, rgba(106, 47, 214, .42));
  box-shadow: 0 0 18px rgba(125, 249, 255, .46);
  transition: transform .28s cubic-bezier(.2, 1.9, .35, .9), box-shadow .28s ease;
}

.specimen-bubble:hover,
.specimen-bubble.is-wobbling { transform: scale(1.12) rotate(-6deg); box-shadow: 0 0 26px rgba(183, 255, 90, .6); }

.mini-ecosystem { position: relative; width: 260px; height: 150px; border: 1px solid rgba(200,148,63,.75); border-radius: 45%; overflow: hidden; }
.mini-ecosystem i:nth-child(1) { width: 24px; height: 24px; left: 38px; bottom: 12px; }
.mini-ecosystem i:nth-child(2) { width: 34px; height: 34px; left: 88px; bottom: 4px; animation-delay: -.8s; }
.mini-ecosystem i:nth-child(3) { width: 18px; height: 18px; left: 148px; bottom: 20px; animation-delay: -1.7s; }
.mini-ecosystem i:nth-child(4) { width: 28px; height: 28px; left: 190px; bottom: 8px; animation-delay: -2.5s; }
.mini-ecosystem i:nth-child(5) { width: 14px; height: 14px; left: 124px; bottom: 36px; animation-delay: -3.2s; }

.drawer-cabinet {
  min-height: 440px;
  border-radius: 34px;
  display: grid;
  place-items: center;
  align-content: center;
}

.drawer-handle {
  width: 190px;
  height: 34px;
  border: 2px solid var(--brass);
  border-radius: 999px;
  margin-bottom: 2rem;
  box-shadow: inset 0 0 15px rgba(200,148,63,.4);
}

.final-bubble {
  width: min(360px, 72vw);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 1.4rem auto;
  background: radial-gradient(circle at 34% 26%, #fff, var(--cyan) 26%, rgba(106, 47, 214, .55) 58%, rgba(59, 7, 27, .86));
  border: 2px solid rgba(231, 217, 255, .85);
  box-shadow: 0 0 48px rgba(125, 249, 255, .65), inset 0 0 44px rgba(255,255,255,.2);
  animation: orbPulse 3.5s ease-in-out infinite;
}

.final-bubble span { font-family: var(--display); font-size: clamp(2.6rem, 8vw, 5rem); color: var(--midnight); letter-spacing: .05em; }
.final-note { position: static; transform: rotate(-3deg); margin: 0; }

@keyframes frostIn { from { opacity: 0; transform: translateY(24px) scale(.96); filter: blur(12px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes etchTitle { from { opacity: 0; letter-spacing: .18em; filter: blur(8px); } to { opacity: 1; letter-spacing: .075em; filter: blur(0); } }
@keyframes scribbleIn { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
@keyframes veinCreep { from { transform: translateX(-10px) scale(1.02); opacity: .45; } to { transform: translateX(10px) scale(1.08); opacity: .85; } }
@keyframes bubbleRise { 0% { transform: translateY(0) scale(.8); opacity: .25; } 50% { opacity: 1; } 100% { transform: translateY(-110px) scale(1.15); opacity: .15; } }
@keyframes tubeBubble { from { transform: translateY(0); opacity: 0; } 12% { opacity: .9; } to { transform: translateY(-370px); opacity: 0; } }
@keyframes needle { from { transform: translateY(-13px) rotate(-35deg); } to { transform: translateY(-13px) rotate(54deg); } }
@keyframes mothHum { from { transform: translateY(0) rotate(-1deg); } to { transform: translateY(-7px) rotate(1deg); } }
@keyframes orbPulse { 0%,100% { transform: scale(1); filter: hue-rotate(0deg); } 50% { transform: scale(1.035); filter: hue-rotate(12deg); } }

@media (max-width: 860px) {
  .side-rig { opacity: .28; transform: translateY(-50%) scale(.82); }
  .card-gallery { grid-template-columns: minmax(260px, 350px); }
  .drawer-labels { grid-template-columns: repeat(2, 1fr); }
  .note-left { top: 9%; left: 6%; }
  .note-right { top: 12%; right: 6%; }
  .note-bottom { bottom: 5%; }
}

@media (max-width: 520px) {
  .tableau { padding-inline: .8rem; }
  .oracle-cabinet { padding-inline: 1rem; }
  .lens-frame { width: 220px; height: 270px; }
  .bubble-capsule { border-radius: 34px; }
  .specimen-bubble { width: 54px; height: 54px; }
}
