:root {
  color-scheme: dark;
  --white: #f5f7f2;
  --paper: #dfe6df;
  --ink: #020304;
  --panel: rgba(4, 7, 8, 0.88);
  --line: rgba(223, 238, 232, 0.26);
  --line-hot: rgba(245, 255, 249, 0.84);
  --muted: rgba(216, 229, 223, 0.58);
  --cyan: #92fff0;
  --danger: #ff547a;
  --safe-top: max(14px, env(safe-area-inset-top));
  --safe-right: max(14px, env(safe-area-inset-right));
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
  --safe-left: max(14px, env(safe-area-inset-left));
  --deck-pad: clamp(9px, 1.15vw, 14px);
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", "Liberation Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  color: var(--white);
  font-family: var(--mono);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: inherit;
}

button {
  touch-action: manipulation;
}

.experiment {
  position: relative;
  isolation: isolate;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #020304;
}

.render-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #020304;
}

.experiment-chrome {
  position: relative;
  z-index: 6;
  display: grid;
  min-width: 0;
  grid-template-areas: "nav renderer audio";
  grid-template-columns: minmax(166px, 0.32fr) minmax(420px, 1fr) minmax(300px, 0.48fr);
  align-items: stretch;
  gap: 10px;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    10px
    max(12px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(245, 247, 242, 0.18);
  background: #020304;
}

.chrome-nav-space {
  grid-area: nav;
  min-width: 0;
  min-height: 56px;
}

.render-surface {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.render-surface.is-active {
  visibility: visible;
  opacity: 1;
}

#signalCanvas {
  background: #020304;
  image-rendering: auto;
}

.svg-surface {
  overflow: hidden;
  background: #020304;
  color: #f5f7f2;
  shape-rendering: geometricPrecision;
}

.svg-pixel-group,
.svg-silhouette-path {
  fill: currentColor;
  stroke: none;
}

.css-surface {
  overflow: hidden;
  background: #020304;
  image-rendering: auto;
}

.css-frame {
  position: absolute;
  display: grid;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

.css-row {
  display: block;
  min-width: 0;
  min-height: 0;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.ascii-surface {
  margin: 0;
  overflow: hidden;
  background: #020304;
  color: #f5f7f2;
  font: 700 clamp(4px, 0.72vw, 11px)/0.78 var(--mono);
  letter-spacing: 0;
  white-space: pre;
  text-align: center;
  text-rendering: geometricPrecision;
}

.html-surface {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #020304;
}

.html-checkbox-grid {
  display: grid;
  width: 1152px;
  height: 864px;
  grid-template-columns: repeat(var(--html-columns, 96), var(--html-cell-size, 12px));
  grid-template-rows: repeat(var(--html-rows, 72), var(--html-cell-size, 12px));
  gap: 0;
  overflow: hidden;
  color-scheme: dark;
  contain: strict;
  line-height: 0;
  pointer-events: none;
}

.html-checkbox {
  -webkit-appearance: auto;
  appearance: auto;
  width: 100%;
  height: 100%;
  display: block;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  accent-color: #f5f7f2;
  pointer-events: none;
}

/* Keep the decoded source attached to a real, non-zero composited surface.
   WebKit may stop advancing video frames when the element uses display:none,
   visibility:hidden, or has no rendered dimensions. */
.source-video {
  position: fixed;
  top: -1px;
  left: -1px;
  z-index: 0;
  display: block;
  width: 2px;
  height: 2px;
  max-width: none;
  opacity: 0.001;
  pointer-events: none;
  object-fit: cover;
  transform: translateZ(0);
  user-select: none;
  -webkit-user-drag: none;
}

.telemetry {
  position: absolute;
  z-index: 4;
  top: var(--safe-top);
  right: var(--safe-right);
  left: var(--safe-left);
  display: flex;
  align-items: start;
  justify-content: flex-end;
  pointer-events: none;
  text-transform: uppercase;
}

.telemetry__readouts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(111, 227, 255, 0.36);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(5, 17, 25, 0.92), rgba(0, 7, 12, 0.88));
  box-shadow:
    inset 0 0 18px rgba(72, 205, 244, 0.08),
    0 8px 26px rgba(0, 0, 0, 0.34),
    0 0 18px rgba(39, 141, 203, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.telemetry__readouts span {
  display: grid;
  min-width: clamp(62px, 7vw, 92px);
  min-height: 44px;
  align-content: center;
  gap: 4px;
  padding: 7px 9px 6px;
  border: 1px solid rgba(112, 223, 247, 0.36);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(26, 53, 66, 0.78), rgba(3, 15, 23, 0.92));
  box-shadow: inset 0 0 12px rgba(89, 218, 248, 0.06);
}

.telemetry__readouts i {
  color: rgba(134, 229, 247, 0.62);
  font-size: 0.47rem;
  font-style: normal;
  letter-spacing: 0.16em;
}

.telemetry__readouts b {
  color: #a3f0ff;
  font-size: clamp(0.62rem, 0.92vw, 0.82rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-shadow: 0 0 10px rgba(89, 218, 248, 0.32);
}

.transport {
  display: grid;
  min-width: 0;
  grid-template-columns: 44px max-content minmax(120px, 1fr) max-content;
  align-items: center;
  gap: 9px;
  pointer-events: auto;
}

.transport__toggle {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(112, 223, 247, 0.36);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(26, 53, 66, 0.78), rgba(3, 15, 23, 0.92));
  color: rgba(224, 249, 255, 0.88);
  cursor: pointer;
  box-shadow:
    inset 0 0 12px rgba(89, 218, 248, 0.06),
    0 3px 14px rgba(0, 0, 0, 0.34);
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

.transport__toggle:hover {
  border-color: rgba(163, 240, 255, 0.9);
  background: linear-gradient(180deg, rgba(34, 75, 91, 0.9), rgba(4, 22, 32, 0.96));
  color: #fff;
  transform: translateY(-1px);
}

.transport__icon {
  position: absolute;
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.transport__icon--play,
.transport__icon--pause {
  display: none;
}

.transport__toggle[data-playing="true"] .transport__icon--pause,
.transport__toggle[data-playing="false"] .transport__icon--play {
  display: block;
}

.transport__time {
  width: 5ch;
  color: rgba(231, 241, 236, 0.62);
  font-size: clamp(0.56rem, 0.68vw, 0.62rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  text-align: center;
  text-shadow: 0 2px 6px #000;
}

.transport__seek {
  --seek-progress: 0%;
  width: 100%;
  height: 44px;
  min-width: 0;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  cursor: ew-resize;
}

.transport__seek::-webkit-slider-runnable-track {
  height: 3px;
  border: 0;
  background: linear-gradient(
    90deg,
    rgba(246, 250, 247, 0.92) 0 var(--seek-progress),
    rgba(238, 248, 243, 0.18) var(--seek-progress) 100%
  );
  box-shadow: 0 1px 5px #000, 0 0 8px rgba(255, 255, 255, 0.12);
}

.transport__seek::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -8px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #050607;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.52);
}

.transport__seek::-moz-range-track {
  height: 3px;
  border: 0;
  background: rgba(238, 248, 243, 0.18);
  box-shadow: 0 1px 5px #000;
}

.transport__seek::-moz-range-progress {
  height: 3px;
  background: rgba(246, 250, 247, 0.92);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.36);
}

.transport__seek::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #050607;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.52);
}

.transport__seek:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.control-deck {
  position: relative;
  z-index: 6;
  inset: auto;
  display: grid;
  width: 100%;
  gap: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 44px;
  align-items: stretch;
  margin: 0;
  padding:
    4px
    max(var(--deck-pad), env(safe-area-inset-right))
    max(4px, env(safe-area-inset-bottom))
    max(var(--deck-pad), env(safe-area-inset-left));
  border: 1px solid var(--line);
  border-top: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 35%),
    rgba(3, 6, 7, 0.88);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(11px) saturate(0.7);
  -webkit-backdrop-filter: blur(11px) saturate(0.7);
}

.mode-bank,
.track-bank {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: stretch;
  gap: 5px;
  margin-top: 0;
  padding: 5px;
  border: 1px solid rgba(111, 227, 255, 0.36);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(5, 17, 25, 0.94), rgba(0, 7, 12, 0.9));
  box-shadow:
    inset 0 0 18px rgba(72, 205, 244, 0.08),
    0 8px 26px rgba(0, 0, 0, 0.34),
    0 0 18px rgba(39, 141, 203, 0.12);
  pointer-events: auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.mode-bank {
  grid-area: renderer;
}

.track-bank {
  grid-area: audio;
}

.control-label {
  position: static;
  z-index: 1;
  align-self: center;
  display: block;
  padding: 0 5px;
  background: transparent;
  color: rgba(163, 240, 255, 0.72);
  font-size: clamp(0.47rem, 0.65vw, 0.58rem);
  line-height: 1.2;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mode-buttons {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 5px;
}

.track-buttons {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 5px;
}

.track-choice {
  position: relative;
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}

.track-choice span {
  display: grid;
  min-width: 0;
  min-height: 44px;
  place-items: center;
  padding: 8px 7px;
  overflow: hidden;
  border: 1px solid rgba(112, 223, 247, 0.36);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(26, 53, 66, 0.78), rgba(3, 15, 23, 0.92));
  color: rgba(224, 249, 255, 0.88);
  box-shadow: inset 0 0 12px rgba(89, 218, 248, 0.06);
  font-size: clamp(0.53rem, 0.72vw, 0.65rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.track-choice:hover span {
  border-color: rgba(163, 240, 255, 0.9);
  background: linear-gradient(180deg, rgba(34, 75, 91, 0.9), rgba(4, 22, 32, 0.96));
  color: #fff;
  transform: translateY(-1px);
}

.track-choice input:checked + span {
  border-color: rgba(163, 240, 255, 0.94);
  background: linear-gradient(180deg, rgba(38, 86, 103, 0.94), rgba(5, 27, 38, 0.98));
  color: #a3f0ff;
  box-shadow: inset 0 0 16px rgba(89, 218, 248, 0.12);
}

.track-choice input:disabled + span {
  opacity: 0.42;
  cursor: not-allowed;
}

.mode-buttons button {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  width: auto;
  place-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 8px 6px;
  overflow: hidden;
  border: 1px solid rgba(112, 223, 247, 0.36);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(26, 53, 66, 0.78), rgba(3, 15, 23, 0.92));
  color: rgba(224, 249, 255, 0.88);
  cursor: pointer;
  box-shadow: inset 0 0 12px rgba(89, 218, 248, 0.06);
  font-size: clamp(0.53rem, 0.72vw, 0.65rem);
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.mode-buttons button b {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-buttons button b {
  color: inherit;
  font-size: 1em;
  font-weight: 700;
}

.mode-buttons button:hover {
  border-color: rgba(163, 240, 255, 0.9);
  background: linear-gradient(180deg, rgba(34, 75, 91, 0.9), rgba(4, 22, 32, 0.96));
  color: #fff;
  transform: translateY(-1px);
}

.mode-buttons button[aria-pressed="true"] {
  border-color: rgba(163, 240, 255, 0.94);
  background: linear-gradient(180deg, rgba(38, 86, 103, 0.94), rgba(5, 27, 38, 0.98));
  color: #a3f0ff;
  box-shadow: inset 0 0 16px rgba(89, 218, 248, 0.12);
}

.mode-buttons button.is-renderer-active {
  border-color: rgba(163, 240, 255, 0.94);
  background: linear-gradient(180deg, rgba(38, 86, 103, 0.94), rgba(5, 27, 38, 0.98));
  color: #a3f0ff;
  box-shadow: inset 0 0 16px rgba(89, 218, 248, 0.12);
}

.transport__toggle:focus-visible,
.mode-buttons button:focus-visible,
.track-choice input:focus-visible + span {
  border-color: #fff;
  color: #fff477;
  outline: 2px solid rgba(255, 255, 255, 0.94);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

noscript {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: #020304;
  color: #fff;
  font: 0.85rem/1.6 var(--mono);
  text-align: center;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (max-width: 980px) {
  .experiment-chrome {
    grid-template-columns: minmax(166px, 0.34fr) minmax(360px, 1fr) minmax(228px, 0.45fr);
    gap: 4px;
  }

  .chrome-nav-space {
    min-height: 52px;
  }

  .mode-bank,
  .track-bank {
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 4px;
  }
}

@media (max-width: 700px) {
  .experiment-chrome {
    grid-template-areas:
      "nav audio"
      "renderer renderer";
    grid-template-columns: minmax(166px, 0.42fr) minmax(0, 1fr);
  }

  .experiment.is-embedded .telemetry__readouts {
    display: grid;
  }

  .telemetry {
    align-items: start;
  }

  .telemetry__readouts {
    display: grid;
    width: min(184px, 48vw);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
  }

  .telemetry__readouts span:nth-child(n + 3) {
    display: none;
  }

  .telemetry__readouts span {
    min-width: 0;
    gap: 2px;
    padding: 5px 6px;
  }

  .control-deck {
    --deck-pad: 7px;
  }

  .mode-bank,
  .track-bank {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 4px;
  }

  .control-label {
    display: none;
  }

  .mode-buttons {
    display: flex;
    width: 100%;
    max-width: none;
    justify-self: stretch;
    gap: 3px;
  }

  .mode-buttons button {
    width: auto;
    min-height: 44px;
    padding: 5px 7px;
    font-size: clamp(0.43rem, 2vw, 0.58rem);
    letter-spacing: 0.03em;
  }

  .mode-buttons button[data-mode="HTML"] {
    letter-spacing: 0;
  }

  .track-buttons {
    display: flex;
    width: 100%;
    height: auto;
    gap: 4px;
  }

  .track-choice span {
    height: 100%;
    padding: 5px 2px;
    font-size: clamp(0.43rem, 2vw, 0.58rem);
    letter-spacing: 0.03em;
  }

  .transport {
    grid-template-columns: 44px auto minmax(0, 1fr) auto;
    gap: 6px;
  }

  .transport__toggle {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 480px) {
  :root {
    --safe-top: max(9px, env(safe-area-inset-top));
    --safe-right: max(8px, env(safe-area-inset-right));
    --safe-bottom: max(8px, env(safe-area-inset-bottom));
    --safe-left: max(8px, env(safe-area-inset-left));
  }

  .experiment-chrome {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      8px
      max(8px, env(safe-area-inset-left));
  }

  .experiment.is-embedded .telemetry {
    left: max(174px, calc(env(safe-area-inset-left) + 166px));
  }

  .telemetry__readouts {
    width: min(184px, 100%);
    padding: 3px;
  }

  .telemetry__readouts span {
    min-width: 0;
    padding: 4px;
  }

  .telemetry__readouts b {
    overflow: hidden;
    font-size: clamp(0.54rem, 2.6vw, 0.68rem);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

}

@media (pointer: coarse) {
  .transport__seek::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -11px;
  }

  .transport__seek::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .telemetry__readouts,
  .experiment.is-embedded .telemetry__readouts {
    display: grid;
    width: min(258px, calc(100vw - 190px));
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
  }

  .telemetry__readouts span,
  .telemetry__readouts span:nth-child(2),
  .telemetry__readouts span:nth-child(3) {
    display: grid;
    min-width: 0;
    gap: 2px;
    padding: 4px 5px;
  }

  .telemetry__readouts span:nth-child(n + 4) {
    display: none;
  }

  .telemetry__readouts b {
    overflow: hidden;
    font-size: clamp(0.54rem, 1.5vw, 0.7rem);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .control-deck {
    --deck-pad: 6px;
    inset: auto;
    width: 100%;
    max-width: none;
    margin: 0;
    transform: none;
  }

  .mode-bank,
  .track-bank {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 4px;
  }

  .control-label {
    display: none;
  }

  .mode-buttons {
    display: flex;
    width: 100%;
    max-width: none;
    justify-self: stretch;
    gap: 4px;
  }

  .mode-buttons button {
    width: auto;
    min-height: 44px;
    padding: 4px 8px;
  }

  .mode-buttons button[data-mode="HTML"] {
    letter-spacing: 0.03em;
  }

  .track-buttons {
    display: flex;
    width: 100%;
    height: auto;
    gap: 4px;
  }

  .track-choice span {
    min-height: 44px;
    padding: 4px 2px;
  }

  .transport {
    grid-template-columns: 44px auto minmax(80px, 1fr) auto;
    gap: 6px;
  }

  .transport__toggle {
    width: 44px;
    height: 44px;
  }

  .transport__seek {
    height: 44px;
  }

}

@media (max-width: 760px) and (max-height: 620px) and (orientation: landscape) {
  .telemetry {
    left: max(174px, calc(env(safe-area-inset-left) + 166px));
  }

  .telemetry__readouts,
  .experiment.is-embedded .telemetry__readouts {
    width: min(258px, 100%);
  }

  .control-deck {
    width: 100%;
  }

  .mode-buttons {
    gap: 3px;
  }

  .mode-buttons button {
    padding: 3px 7px;
    font-size: clamp(0.42rem, 1.7vw, 0.52rem);
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }

  .mode-buttons button:hover {
    transform: none;
  }

  .track-choice:hover span {
    transform: none;
  }
}
