:root {
  /* Fonts specified: IBM Plex Mono only for tiny coordinates; Space Grotesk** Grotesk* Groteskk with wide tracking and variable scale. */
  --deep: #041019;
  --cyan: #7EF7FF;
  --green: #B7FF5A;
  --violet: #8B6DFF;
  --amber: #FFC46B;
  --milk: #EAF7F3;
  --coral: #FF5E7A;
  --space: 'Space Grotesk', sans-serif;
  --literata: 'Literata', serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--deep); }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--milk);
  font-family: var(--space);
  background: radial-gradient(circle at 50% 20%, rgba(126, 247, 255, 0.08), transparent 32rem), var(--deep);
}

.chamber-bg, .caustics, .aurora, .simarium-shell, .rail-nav, .glass-header, .cursor-ripple { position: fixed; pointer-events: none; }

.chamber-bg { inset: 0; z-index: 0; overflow: hidden; }

.chamber-bg::before {
  content: "";
  position: absolute;
  inset: -20%;
  background-image: linear-gradient(rgba(126,247,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(126,247,255,.035) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: rotate(-10deg) scale(1.2);
  filter: blur(.2px);
  mask-image: radial-gradient(circle at 60% 45%, black, transparent 70%);
}

.aurora {
  width: 58vw;
  height: 28vh;
  border-radius: 999px;
  filter: blur(58px);
  opacity: .32;
  mix-blend-mode: screen;
  animation: auroraDrift 12s ease-in-out infinite alternate;
}

.aurora-one { left: -12vw; top: 12vh; background: linear-gradient(90deg, var(--cyan), var(--violet)); }
.aurora-two { right: -18vw; bottom: 6vh; background: linear-gradient(90deg, var(--green), var(--coral), var(--amber)); animation-duration: 15s; }

.caustics {
  inset: -10%;
  background: repeating-radial-gradient(ellipse at 20% 30%, rgba(234,247,243,.035) 0 2px, transparent 3px 22px), repeating-linear-gradient(120deg, transparent 0 34px, rgba(126,247,255,.035) 36px 38px, transparent 42px 78px);
  opacity: .55;
  animation: causticSwim 18s linear infinite;
}

.glass-header {
  top: 24px;
  left: 28px;
  right: 28px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border: 1px solid rgba(126, 247, 255, .22);
  border-radius: 24px;
  background: linear-gradient(110deg, rgba(234,247,243,.08), rgba(126,247,255,.025));
  box-shadow: inset 0 1px 0 rgba(234,247,243,.24), 0 20px 60px rgba(0,0,0,.24);
  backdrop-filter: blur(18px);
}

.wordmark {
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1px rgba(234,247,243,.85);
  text-shadow: 0 0 22px rgba(126,247,255,.45);
}

.header-note, .kicker, .tank-label, .rail-light span, .rule-strip, .acrylic-panel, .log-tape, .seed-packet {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .12em;
}

.header-note { font-size: 11px; color: rgba(234,247,243,.62); }

.rail-nav {
  left: 32px;
  bottom: 34px;
  z-index: 9;
  display: grid;
  gap: 15px;
  transform: rotate(-24deg);
  pointer-events: auto;
}

.rail-nav::before {
  content: "";
  position: absolute;
  left: 12px;
  top: -22px;
  bottom: -22px;
  width: 1px;
  background: linear-gradient(var(--cyan), var(--violet), var(--green));
  opacity: .45;
}

.rail-light {
  position: relative;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(126,247,255,.4);
  border-radius: 50%;
  background: rgba(4,16,25,.8);
  box-shadow: inset 0 0 14px rgba(126,247,255,.16);
  transition: transform .35s ease, box-shadow .35s ease, background .35s ease;
}

.rail-light span {
  position: absolute;
  left: 34px;
  top: 6px;
  transform: rotate(24deg);
  font-size: 9px;
  color: rgba(234,247,243,.5);
}

.rail-light.active {
  transform: scale(1.45);
  background: var(--green);
  box-shadow: 0 0 24px var(--green), 0 0 50px rgba(183,255,90,.4);
}

.world-rehearsal { position: relative; z-index: 2; }

.bay {
  min-height: 100vh;
  position: relative;
  display: grid;
  align-items: center;
  padding: 16vh 8vw 12vh;
  overflow: hidden;
}

.bay::before {
  content: "";
  position: absolute;
  width: 55vw;
  height: 55vw;
  border: 1px solid rgba(126,247,255,.16);
  border-radius: 50%;
  right: -18vw;
  top: 14vh;
  background: radial-gradient(circle, rgba(234,247,243,.035), transparent 60%);
}

.bay:nth-child(even)::before { left: -18vw; right: auto; border-color: rgba(139,109,255,.18); }

.scene-copy {
  width: min(620px, 50vw);
  position: relative;
  z-index: 3;
  padding: 34px;
  border: 1px solid rgba(234,247,243,.13);
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(234,247,243,.09), rgba(4,16,25,.18) 58%, rgba(126,247,255,.05));
  backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(234,247,243,.22), 0 30px 90px rgba(0,0,0,.28);
}

.offset-copy { margin-left: auto; margin-right: 4vw; }
.final-copy { margin: 0 auto; text-align: center; }

.kicker { margin: 0 0 18px; font-size: 11px; color: var(--amber); }

h1, h2 {
  font-family: var(--space);
  margin: 0;
  line-height: .9;
  letter-spacing: -.055em;
  text-transform: uppercase;
}

h1 { font-size: clamp(58px, 9vw, 142px); max-width: 820px; }
h2 { font-size: clamp(48px, 7vw, 112px); }

.literary {
  font-family: var(--literata);
  font-size: clamp(18px, 1.8vw, 25px);
  line-height: 1.55;
  color: rgba(234,247,243,.82);
  margin: 24px 0 0;
}

.diegetic-button {
  margin-top: 28px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--deep);
  border: 0;
  border-radius: 999px;
  padding: 15px 22px;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  box-shadow: 0 0 24px rgba(183,255,90,.42), inset 0 1px 0 rgba(234,247,243,.8);
  cursor: pointer;
}

.rule-strip {
  position: absolute;
  right: 7vw;
  bottom: 18vh;
  display: grid;
  gap: 10px;
  color: var(--cyan);
  font-size: 10px;
  transform: rotate(-8deg);
}

.rule-strip span, .log-tape span, .acrylic-panel, .seed-packet {
  padding: 12px 14px;
  border: 1px solid rgba(126,247,255,.24);
  border-radius: 18px;
  background: rgba(234,247,243,.07);
  backdrop-filter: blur(14px);
}

.acrylic-panel {
  position: absolute;
  left: 9vw;
  bottom: 18vh;
  width: 260px;
  color: rgba(234,247,243,.72);
  transform: rotate(7deg);
}

.acrylic-panel b { display: block; color: var(--green); margin-bottom: 12px; }

.city-silhouette {
  position: absolute;
  right: 8vw;
  bottom: 18vh;
  width: 360px;
  height: 120px;
  display: flex;
  align-items: end;
  gap: 10px;
  filter: drop-shadow(0 0 24px rgba(126,247,255,.5));
}

.city-silhouette span {
  flex: 1;
  height: var(--h, 70px);
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, rgba(126,247,255,.75), rgba(139,109,255,.16));
}
.city-silhouette span:nth-child(2) { --h: 110px; }
.city-silhouette span:nth-child(3) { --h: 84px; }
.city-silhouette span:nth-child(4) { --h: 120px; }
.city-silhouette span:nth-child(5) { --h: 66px; }

.pressure-gauge {
  position: absolute;
  left: 10vw;
  top: 22vh;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 2px solid rgba(255,94,122,.4);
  background: conic-gradient(from 20deg, var(--coral), transparent 38%, rgba(255,196,107,.5), transparent 70%);
  box-shadow: 0 0 50px rgba(255,94,122,.24);
  animation: pressurePulse 2.4s ease-in-out infinite;
}

.pressure-gauge span { position: absolute; inset: 42px; border-radius: 50%; background: var(--deep); border: 1px solid rgba(255,94,122,.25); }

.branch-svg {
  position: absolute;
  right: 4vw;
  top: 18vh;
  width: min(520px, 42vw);
  overflow: visible;
}
.branch-svg path {
  fill: none;
  stroke: var(--violet);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 650;
  stroke-dashoffset: 650;
  filter: drop-shadow(0 0 12px rgba(139,109,255,.8));
  animation: drawBranch 5s ease-in-out infinite alternate;
}
.branch-svg path:nth-child(2) { stroke: var(--cyan); animation-delay: .4s; }
.branch-svg path:nth-child(3) { stroke: var(--coral); animation-delay: .8s; }
.branch-svg path:nth-child(4) { stroke: var(--green); animation-delay: 1.2s; }

.log-tape {
  position: absolute;
  left: 9vw;
  bottom: 14vh;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  width: 430px;
  font-size: 10px;
  color: var(--amber);
}

.pause-glyph {
  position: absolute;
  right: 13vw;
  top: 28vh;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: radial-gradient(circle, rgba(255,196,107,.26), rgba(255,196,107,.03) 60%, transparent);
  border: 1px solid rgba(255,196,107,.4);
  box-shadow: 0 0 55px rgba(255,196,107,.25);
}
.pause-glyph i { width: 20px; height: 78px; border-radius: 999px; background: var(--amber); box-shadow: 0 0 24px var(--amber); }

.seed-packet {
  position: absolute;
  right: 11vw;
  bottom: 16vh;
  color: var(--green);
  transform: rotate(8deg);
}
.seed-packet b { display: block; margin-top: 10px; color: var(--milk); }

.simarium-shell {
  right: 7vw;
  top: 50%;
  z-index: 5;
  transform: translateY(-50%);
  width: min(47vw, 620px);
  aspect-ratio: 1;
  transition: transform .8s ease, filter .8s ease;
}

.observation-window {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid rgba(126,247,255,.42);
  background: radial-gradient(circle at 50% 45%, rgba(126,247,255,.08), rgba(4,16,25,.72) 55%, rgba(4,16,25,.96));
  box-shadow: inset 0 0 50px rgba(126,247,255,.12), inset 0 0 120px rgba(139,109,255,.13), 0 0 70px rgba(126,247,255,.13), 0 35px 95px rgba(0,0,0,.42);
}

.observation-window::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(234,247,243,.12);
  background: radial-gradient(circle at 34% 20%, rgba(234,247,243,.16), transparent 18%), radial-gradient(circle at 65% 72%, rgba(183,255,90,.12), transparent 20%);
}

#simCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.seed-bead {
  position: absolute;
  left: 50%;
  top: 12%;
  width: 20px;
  height: 20px;
  margin: -10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 20px var(--green), 0 0 54px rgba(183,255,90,.58);
  animation: seedDrop 4.8s cubic-bezier(.4,0,.2,1) infinite;
}

.liquid-ripple {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(126,247,255,.55);
  transform: translate(-50%, -50%);
  animation: ripple 4.8s ease-out infinite;
}

.isobars {
  position: absolute;
  inset: 15%;
  border-radius: 45% 55% 48% 52%;
  border: 1px solid rgba(126,247,255,.25);
  box-shadow: 0 0 0 24px rgba(126,247,255,.035), 0 0 0 48px rgba(139,109,255,.03), 0 0 0 74px rgba(255,94,122,.025);
  animation: isobarTurn 9s linear infinite;
}

.rim-glint {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, rgba(234,247,243,.75), transparent 18%, transparent 55%, rgba(126,247,255,.55), transparent 68%);
  mask: radial-gradient(circle, transparent 68%, black 69%, black 72%, transparent 73%);
  animation: glint 8s linear infinite;
}

.tank-label {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  align-items: center;
  color: var(--cyan);
  font-size: 11px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(126,247,255,.22);
  background: rgba(4,16,25,.72);
  backdrop-filter: blur(14px);
}
.tank-label small { color: var(--amber); font: inherit; }

.cursor-ripple {
  z-index: 20;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  margin: -18px;
  border-radius: 50%;
  border: 1px solid rgba(126,247,255,.38);
  transform: translate(-100px, -100px);
  mix-blend-mode: screen;
  transition: width .25s ease, height .25s ease, border-color .25s ease;
}

body.mode-pressure .observation-window { box-shadow: inset 0 0 70px rgba(255,94,122,.18), 0 0 84px rgba(255,94,122,.18); }
body.mode-fork .simarium-shell { filter: hue-rotate(28deg) saturate(1.25); }
body.mode-pause .seed-bead { background: var(--amber); box-shadow: 0 0 26px var(--amber); animation-play-state: paused; }
body.mode-export .simarium-shell { transform: translateY(-50%) scale(.92) rotate(5deg); }

@keyframes auroraDrift { from { transform: translate3d(0,0,0) rotate(-4deg); } to { transform: translate3d(8vw, 4vh, 0) rotate(8deg); } }
@keyframes causticSwim { to { transform: translate3d(-70px, 40px, 0); } }
@keyframes seedDrop { 0% { top: 8%; opacity: 0; } 18% { opacity: 1; } 46% { top: 50%; } 100% { top: 50%; opacity: .28; } }
@keyframes ripple { 0%, 38% { width: 4%; opacity: 0; } 48% { opacity: .9; } 100% { width: 78%; opacity: 0; } }
@keyframes isobarTurn { to { transform: rotate(360deg); } }
@keyframes glint { to { transform: rotate(360deg); } }
@keyframes pressurePulse { 50% { transform: scale(1.08); box-shadow: 0 0 90px rgba(255,94,122,.45); } }
@keyframes drawBranch { to { stroke-dashoffset: 0; } }

@media (max-width: 900px) {
  .glass-header { left: 14px; right: 14px; }
  .header-note { display: none; }
  .simarium-shell { width: 78vw; right: -18vw; opacity: .78; }
  .scene-copy { width: min(92vw, 620px); padding: 24px; }
  .offset-copy { margin-left: 0; margin-right: 0; }
  .rail-nav { left: 18px; bottom: 20px; transform: rotate(-18deg) scale(.88); }
  .rule-strip, .city-silhouette, .pressure-gauge, .branch-svg, .log-tape, .pause-glyph, .seed-packet, .acrylic-panel { opacity: .55; transform: scale(.78); }
}
