* {
  box-sizing: border-box;
}
:root {
  color-scheme: dark;
  --accent: 100, 255, 218;
  --charge: 0;
  --ambient: 1;
  --degrees: 0deg;
  --flow: 0;
}
body {
  margin: 0;
  background: #070b12;
  color: #edf5f3;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Hiragino Sans", sans-serif;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
input:focus-visible {
  outline: 2px solid #f6c879;
  outline-offset: 6px;
}
.experiment {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 32px 36px 20px;
}
.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.17em;
  color: rgb(var(--accent));
  margin: 0 0 20px;
}
.eyebrow span {
  color: #718287;
}
h1 {
  font-size: clamp(32px, 6vw, 62px);
  letter-spacing: -0.06em;
  line-height: 1.02;
  margin: 0;
  font-weight: 800;
}
h1 > span {
  color: rgb(var(--accent));
}
.unit {
  text-align: right;
  line-height: 1.6;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #91a5a7;
}
.unit b {
  font-size: 30px;
  color: #e1eeea;
  font-weight: 400;
}
.intro {
  font-family: system-ui, sans-serif;
  color: #a2b4b6;
  font-size: 14px;
  margin: 18px 0 24px;
}
.stage {
  position: relative;
  height: 420px;
  border: 1px solid #203137;
  border-radius: 16px;
  background:
    radial-gradient(ellipse at center, rgba(var(--accent), 0.045), transparent 65%), #080f16;
  overflow: hidden;
  isolation: isolate;
}
.stage-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(#91ddcf09 1px, transparent 1px),
    linear-gradient(90deg, #91ddcf09 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: var(--ambient);
}
.wires,
#particles {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  pointer-events: none;
}
.wires path {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-width: 1;
}
.wire-track {
  stroke: #27413f;
}
.wire-flow {
  stroke: rgb(var(--accent));
  stroke-dasharray: 9 25;
  stroke-dashoffset: var(--flow);
  opacity: calc(var(--charge) * 0.7);
}
.supply {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 110px;
  text-align: center;
  color: rgb(var(--accent));
  opacity: calc(0.17 + var(--ambient) * 0.83);
}
.supply-a {
  left: 15%;
  top: 23%;
}
.supply-b {
  left: 85%;
  top: 23%;
}
.supply-c {
  left: 15%;
  top: 77%;
}
.supply-d {
  left: 85%;
  top: 77%;
}
.supply small {
  font-size: 9px;
  letter-spacing: 0.05em;
  color: #a1b7b6;
}
.tube {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid rgba(var(--accent), 0.55);
  border-radius: 4px;
  padding: 8px 4px;
  margin: 10px 0;
  box-shadow:
    0 0 15px rgba(var(--accent), 0.1),
    inset 0 0 16px rgba(var(--accent), 0.06);
  text-shadow: 0 0 14px rgba(var(--accent), 0.6);
}
.cells {
  display: flex;
  gap: 4px;
  justify-content: center;
}
.cells i {
  height: 4px;
  width: 12px;
  background: rgb(var(--accent));
  border-radius: 1px;
  transform: scaleY(var(--ambient));
  transform-origin: bottom;
}
.core-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
}
.core-halo {
  position: absolute;
  inset: -35px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent), 0.32), transparent 68%);
  opacity: var(--charge);
  transform: scale(calc(1 + var(--charge) * 0.45));
}
.charge-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(rgb(var(--accent)) var(--degrees), #203137 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
  transform: rotate(-90deg);
}
#charge {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 166px;
  height: 166px;
  border: 1px solid rgba(var(--accent), calc(0.3 + var(--charge) * 0.7));
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 70%,
    rgba(var(--accent), calc(0.04 + var(--charge) * 0.16)),
    #0a141b
  );
  color: rgb(var(--accent));
  box-shadow:
    0 0 calc(var(--charge) * 70px) rgba(var(--accent), 0.25),
    inset 0 0 30px rgba(var(--accent), 0.06);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transform: scale(calc(1 - var(--charge) * 0.035));
}
.core-caption {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #a7c3be;
}
#core-value {
  font-size: 58px;
  font-weight: 400;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 calc(var(--charge) * 24px) rgba(var(--accent), 0.8);
}
.core-action {
  font-size: 8px;
  letter-spacing: 0.1em;
}
.stage-corner,
.stage-number {
  position: absolute;
  bottom: 16px;
  font-size: 8px;
  letter-spacing: 0.08em;
  color: #687e82;
  line-height: 1.8;
}
.stage-corner {
  left: 18px;
}
.stage-number {
  right: 18px;
}
.telemetry {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 22px;
}
.telemetry > div {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.telemetry span {
  font-size: 10px;
  color: #a1b7b6;
}
.telemetry b {
  font-size: 14px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  min-width: 26px;
  text-align: right;
}
.meter {
  height: 5px;
  flex: 1;
  background: #213039;
  overflow: hidden;
}
.meter i {
  display: block;
  width: 100%;
  height: 100%;
  background: #97b9b0;
  transform-origin: left;
}
#core-meter {
  transform: scaleX(0);
  background: rgb(var(--accent));
}
.message {
  text-align: center;
  margin: 26px 0 10px;
  min-height: 24px;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  color: rgb(var(--accent));
}
.instructions {
  text-align: center;
  font-size: 11px;
  color: #8a9fa4;
  line-height: 1.9;
  margin: 0;
}
.mobile-break {
  display: none;
}
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 22px 0 26px;
}
.controls button {
  border: 1px solid #344b50;
  border-radius: 6px;
  padding: 11px 14px;
  background: #0e1b22;
  color: #d4e4df;
  font-size: 11px;
}
.controls button:hover {
  border-color: rgb(var(--accent));
}
.controls button:first-child {
  color: rgb(var(--accent));
}
.controls label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #a1b7b6;
  font-size: 11px;
  padding: 8px;
}
.controls input {
  accent-color: rgb(var(--accent));
  width: 16px;
  height: 16px;
}
.footer {
  font-size: 9px;
  color: #8a9fa4;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid #203137;
  padding-top: 18px;
}
.footer span {
  color: #657d82;
}
.reduced #particles {
  display: none;
}
.reduced .core-halo {
  display: none;
}
.reduced #charge {
  transform: none;
  box-shadow: none;
}
.reduced .wire-flow {
  stroke-dasharray: none;
}
[data-state="charged"] {
  --accent: 255, 198, 103;
}
@media (max-width: 560px) {
  .experiment {
    padding: 22px 16px 18px;
  }
  .heading {
    align-items: flex-end;
  }
  .eyebrow {
    font-size: 9px;
    margin-bottom: 16px;
  }
  .unit {
    font-size: 8px;
  }
  .unit b {
    font-size: 25px;
  }
  .intro {
    font-size: 12px;
  }
  .stage {
    height: 400px;
  }
  .supply {
    width: 66px;
  }
  .supply small {
    font-size: 7px;
  }
  .tube {
    font-size: 15px;
    padding: 7px 1px;
  }
  .cells {
    gap: 3px;
  }
  .cells i {
    width: 8px;
  }
  .core-wrap {
    width: 160px;
    height: 160px;
  }
  #charge {
    width: 138px;
    height: 138px;
  }
  #core-value {
    font-size: 46px;
  }
  .core-action {
    font-size: 7px;
  }
  .stage-corner,
  .stage-number {
    font-size: 7px;
  }
  .telemetry {
    gap: 12px;
  }
  .telemetry > div {
    gap: 8px;
  }
  .mobile-break {
    display: block;
  }
  .footer span {
    display: none;
  }
  .message {
    font-size: 12px;
  }
  .controls {
    gap: 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stage-grid {
    background-size: 56px 56px;
  }
}

.demo-nav {
  margin-bottom: 28px;
}
.demo-nav a,
.demo-links a {
  color: #a8f9eb;
  text-decoration: none;
  font-size: 13px;
}
.demo-nav a:hover,
.demo-links a:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}
a:focus-visible {
  outline: 2px solid #a8f9eb;
  outline-offset: 6px;
}
.demo-resources {
  border-top: 1px solid #203137;
  margin-top: 28px;
  padding-top: 22px;
}
.demo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin-bottom: 18px;
}
.demo-resources p {
  color: #9daeb5;
  font-size: 12px;
  line-height: 1.9;
}
.is-embedded .demo-nav,
.is-embedded .demo-resources {
  display: none;
}
