:root {
  --void: #04050c;
  --deep: #070913;
  --panel: rgba(5, 8, 18, 0.78);
  --ice: #eefcff;
  --muted: rgba(212, 236, 248, 0.58);
  --faint: rgba(196, 228, 242, 0.34);
  --cyan: #4ef5ff;
  --cyan-soft: #a4fbff;
  --magenta: #ff3fd4;
  --amber: #ffb25f;
  --red: #ff5d78;
  --hairline: rgba(148, 239, 255, 0.16);
  --display: "DIN Condensed", "Avenir Next Condensed", "Arial Narrow", Impact, sans-serif;
  --body: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", "Roboto Mono", Menlo, Consolas, monospace;
  --pad-x: clamp(22px, 5vw, 76px);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}

button {
  font: inherit;
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 64% 44%, rgba(57, 18, 70, 0.5), transparent 46%),
    linear-gradient(180deg, #05060e 0%, #03040a 100%);
  isolation: isolate;
}

#scene {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#scene canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.fx-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 53% 43%, transparent 28%, rgba(2, 3, 9, 0.16) 59%, rgba(2, 3, 9, 0.78) 100%),
    linear-gradient(180deg, rgba(2, 3, 9, 0.4), transparent 19%, transparent 72%, rgba(2, 3, 9, 0.6));
}

.fx-scanlines {
  position: absolute;
  inset: 0;
  opacity: 0.34;
  mix-blend-mode: soft-light;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.055) 0,
    rgba(255, 255, 255, 0.055) 1px,
    transparent 1px,
    transparent 3px
  );
}

.fx-sweep {
  position: absolute;
  top: -30%;
  left: 0;
  width: 100%;
  height: 22%;
  opacity: 0.55;
  background: linear-gradient(to bottom, transparent, rgba(79, 245, 255, 0.035), transparent);
  animation: scanSweep 11s linear infinite;
}

.fx-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  opacity: 0.44;
}

.fx-corner--tl {
  top: 22px;
  left: 22px;
  border-top: 1px solid var(--cyan);
  border-left: 1px solid var(--cyan);
}

.fx-corner--br {
  right: 22px;
  bottom: 22px;
  border-right: 1px solid var(--magenta);
  border-bottom: 1px solid var(--magenta);
}

@keyframes scanSweep {
  0% { transform: translateY(0); }
  100% { transform: translateY(640%); }
}

/* Utility rail */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(19px, 2.5vw, 34px) var(--pad-x);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  pointer-events: auto;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 20px;
  height: 24px;
}

.brand-mark i {
  display: block;
  width: 4px;
  transform: skewX(-20deg);
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(78, 245, 255, 0.65);
}

.brand-mark i:nth-child(1) { height: 13px; opacity: 0.64; }
.brand-mark i:nth-child(2) { height: 22px; background: var(--ice); }
.brand-mark i:nth-child(3) { height: 17px; background: var(--magenta); box-shadow: 0 0 10px rgba(255, 63, 212, 0.6); }

.brand-word {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1;
  letter-spacing: 0.16em;
  color: var(--ice);
  white-space: nowrap;
}

.brand-word span {
  color: var(--cyan);
  margin-left: 0.38em;
}

.brand-code {
  margin-left: 8px;
  padding-left: 13px;
  border-left: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--faint);
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  pointer-events: auto;
}

.svg-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.theme-switcher {
  display: flex;
  align-items: center;
  height: 42px;
  padding-left: 11px;
  border: 1px solid rgba(140, 238, 255, 0.2);
  background: rgba(5, 10, 19, 0.46);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.theme-switcher__label {
  padding-right: 9px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.16em;
  color: rgba(187, 231, 244, 0.4);
  white-space: nowrap;
}

.theme-choice {
  height: 30px;
  padding: 0 9px;
  border: 0;
  background: transparent;
  color: rgba(214, 244, 250, 0.5);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

.theme-choice:hover {
  color: var(--ice);
}

.theme-choice.is-active {
  background: var(--cyan);
  color: #04111a;
}

.theme-choice:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: -2px;
}

.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(140, 238, 255, 0.24);
  background: rgba(5, 10, 19, 0.46);
  color: rgba(226, 250, 255, 0.8);
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
  backdrop-filter: blur(8px);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, opacity 200ms ease, visibility 200ms ease;
}

.icon-button::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 255, 255, 0.035);
  pointer-events: none;
}

.icon-button:hover {
  color: var(--ice);
  border-color: rgba(78, 245, 255, 0.62);
  background: rgba(12, 27, 39, 0.68);
}

.icon-button:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 4px;
}

.button:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 2px #041119,
    inset 0 0 0 4px var(--ice),
    0 0 40px rgba(78, 245, 255, 0.3);
}

.icon-button.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.icon {
  width: 20px;
  height: 20px;
  overflow: visible;
}

.icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sound > path:first-child {
  fill: currentColor;
  stroke: none;
}

.sound-slash {
  opacity: 0;
  transition: opacity 140ms ease;
  color: var(--magenta);
}

.sound-wave {
  transition: opacity 140ms ease;
}

.icon-button.is-muted .sound-wave {
  opacity: 0;
}

.icon-button.is-muted .sound-slash {
  opacity: 1;
}

.icon-pause path,
.icon-play path {
  fill: currentColor;
  stroke: none;
}

.icon-play {
  display: none;
}

.icon-button.is-paused .icon-pause {
  display: none;
}

.icon-button.is-paused .icon-play {
  display: block;
}

/* HUD */
.hud {
  position: fixed;
  top: clamp(20px, 2.6vw, 32px);
  left: 50%;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: max-content;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -10px);
  transition: opacity 260ms ease, transform 260ms ease, visibility 260ms;
}

.hud.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.gate-toast {
  position: fixed;
  top: clamp(104px, 10vw, 132px);
  left: 50%;
  z-index: 60;
  min-width: 230px;
  padding: 9px 20px 10px;
  border: 1px solid rgba(117, 231, 255, 0.62);
  background: rgba(3, 8, 16, 0.96);
  color: #d8feff;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -7px);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  transition: opacity 160ms ease, transform 160ms ease;
}

.gate-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

[data-theme="charcoal"] .gate-toast {
  border-color: rgba(16, 17, 20, 0.65);
  background: rgba(247, 244, 238, 0.98);
  color: #101114;
  box-shadow: 0 10px 24px rgba(16, 17, 20, 0.14);
}

@media (max-height: 700px) {
  .gate-toast {
    top: 86px;
  }
}

.hud-metrics {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.4vw, 30px);
  min-width: 322px;
  padding: 9px 22px 10px;
  border: 1px solid rgba(117, 231, 255, 0.19);
  background:
    linear-gradient(110deg, rgba(7, 13, 24, 0.82), rgba(5, 8, 18, 0.56) 58%, rgba(9, 9, 22, 0.77)),
    rgba(3, 6, 14, 0.65);
  clip-path: polygon(0 0, calc(100% - 17px) 0, 100% 17px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
  backdrop-filter: blur(9px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
}

.hud-metrics::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  width: 64px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 16px rgba(78, 245, 255, 0.8);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 82px;
}

.metric-label {
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1;
  letter-spacing: 0.21em;
  color: rgba(187, 231, 244, 0.5);
}

.metric-reading {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.metric-value {
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  line-height: 0.96;
  letter-spacing: 0.055em;
  font-variant-numeric: tabular-nums;
  color: var(--ice);
  text-shadow: 0 0 20px rgba(78, 245, 255, 0.18);
  display: inline-block;
}

.metric-unit {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--cyan);
  letter-spacing: 0.1em;
}

.metric-divider {
  width: 1px;
  height: 26px;
  background: linear-gradient(to bottom, transparent, rgba(140, 230, 250, 0.32), transparent);
}

.energy-diamond {
  width: 7px;
  height: 7px;
  border: 1px solid var(--cyan);
  transform: rotate(45deg) translateY(-2px);
  box-shadow: 0 0 10px rgba(78, 245, 255, 0.7);
}

.hud-run {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.15em;
  color: rgba(203, 235, 242, 0.38);
}

.hud-run b {
  color: rgba(222, 250, 255, 0.7);
  font-weight: 400;
}

.hud-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hud-live i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: blink 1.6s steps(2, end) infinite;
}

@keyframes blink {
  50% { opacity: 0.25; }
}

/* Screens */
.screen {
  position: fixed;
  inset: 0;
  z-index: 15;
  overflow: hidden;
  transition: opacity 320ms ease, visibility 320ms ease;
}

.screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.screen--menu {
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 5, 12, 0.97) 0%, rgba(3, 5, 12, 0.9) 28%, rgba(3, 5, 12, 0.46) 48%, rgba(3, 5, 12, 0.04) 70%, transparent 84%),
    linear-gradient(0deg, rgba(3, 5, 12, 0.76) 0%, transparent 28%),
    linear-gradient(180deg, rgba(3, 5, 12, 0.65) 0%, transparent 22%);
}

.screen--menu::before {
  content: "";
  position: absolute;
  top: 10%;
  bottom: 10%;
  left: 41.5%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(78, 245, 255, 0.12) 24%, rgba(255, 63, 212, 0.15) 72%, transparent);
  opacity: 0.8;
}

.menu-grid {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: clamp(92px, 12vh, 138px) var(--pad-x) 72px;
}

.menu-copy {
  width: min(630px, 52vw);
  pointer-events: none;
}

.menu-copy .button,
.menu-copy .control-deck {
  pointer-events: auto;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(8px, 0.7vw, 9.5px);
  line-height: 1.4;
  letter-spacing: 0.2em;
  color: rgba(155, 239, 250, 0.68);
  text-transform: uppercase;
}

.eyebrow-rule {
  display: inline-block;
  width: 34px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(78, 245, 255, 0.6);
}

.game-title {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: clamp(15px, 2.2vh, 26px) 0 clamp(16px, 2.4vh, 25px);
  font-family: var(--display);
  font-size: clamp(5.6rem, 10.6vw, 10.4rem);
  font-weight: 700;
  line-height: 0.76;
  letter-spacing: 0.012em;
  text-transform: uppercase;
  filter: drop-shadow(0 22px 52px rgba(0, 0, 0, 0.28));
}

.title-neon {
  position: relative;
  display: block;
  padding-right: 0.06em;
  color: var(--ice);
  text-shadow:
    0 0 36px rgba(78, 245, 255, 0.1),
    3px 0 0 rgba(255, 63, 212, 0.04);
}

.title-escape {
  position: relative;
  display: block;
  margin-top: 0.08em;
  padding-right: 0.08em;
  color: rgba(78, 245, 255, 0.025);
  -webkit-text-stroke: 1.5px rgba(107, 248, 255, 0.82);
  text-shadow: 0 0 32px rgba(78, 245, 255, 0.08);
}

.title-escape::before {
  content: attr(data-text);
  position: absolute;
  top: 0.035em;
  left: 0.035em;
  z-index: -1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 63, 212, 0.48);
  pointer-events: none;
}

.title-escape::after {
  content: "";
  position: absolute;
  bottom: 0.08em;
  right: 0.03em;
  width: 16%;
  height: 2px;
  background: var(--magenta);
  box-shadow: 0 0 16px rgba(255, 63, 212, 0.8);
  opacity: 0.85;
}

.menu-lede {
  margin: 0;
  font-family: var(--body);
  font-size: clamp(15px, 1.35vw, 18px);
  line-height: 1.52;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: rgba(205, 233, 245, 0.62);
}

.menu-lede strong {
  color: rgba(238, 252, 255, 0.92);
  font-weight: 500;
}

.launch-row {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: clamp(24px, 3.7vh, 38px);
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  min-height: 58px;
  padding: 0 24px;
  border: 0;
  cursor: pointer;
  text-transform: uppercase;
  font-family: var(--display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.08em;
  line-height: 1;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.button--primary {
  min-width: 222px;
  background: linear-gradient(108deg, #58f7ff 0%, #a8fcff 56%, #e7ffff 100%);
  color: #04111a;
  clip-path: polygon(0 0, 100% 0, calc(100% - 13px) 100%, 0 100%);
  box-shadow: 0 0 40px rgba(78, 245, 255, 0.22), inset 0 -3px rgba(14, 96, 111, 0.18);
}

.button--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, 0.52) 48%, transparent 61%);
  transform: translateX(-130%);
  transition: transform 480ms cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}

.button--primary:hover {
  transform: translateX(3px);
  filter: brightness(1.06);
  box-shadow: 0 0 54px rgba(78, 245, 255, 0.36), inset 0 -3px rgba(14, 96, 111, 0.18);
}

.button--primary:hover::before {
  transform: translateX(130%);
}

.button--primary:active {
  transform: translateX(1px) translateY(1px);
}

.button--ghost {
  min-height: 46px;
  margin-top: 10px;
  padding: 0 18px;
  border: 1px solid rgba(139, 235, 250, 0.24);
  background:
    linear-gradient(100deg, rgba(12, 26, 39, 0.62), rgba(6, 12, 22, 0.42));
  color: rgba(222, 249, 255, 0.68);
  clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
  font-size: 18px;
  letter-spacing: 0.1em;
  transition: transform 160ms ease, color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button--ghost:hover {
  transform: translateX(2px);
  border-color: rgba(255, 63, 212, 0.58);
  background:
    linear-gradient(100deg, rgba(30, 16, 40, 0.74), rgba(9, 18, 29, 0.5));
  color: var(--ice);
}

.button--ghost:active {
  transform: translateX(1px) translateY(1px);
}

.button--ghost .button-arrow {
  color: var(--magenta);
  font-size: 16px;
}

.button-index {
  align-self: flex-start;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: rgba(3, 21, 28, 0.52);
}

.button-label {
  display: block;
  white-space: nowrap;
}

.button-arrow {
  margin-left: auto;
  padding-left: 16px;
  font-family: var(--body);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -0.05em;
  color: rgba(3, 21, 28, 0.72);
  transform: translateY(-1px);
}

.button-key {
  margin-left: auto;
  padding: 3px 5px;
  border: 1px solid rgba(2, 20, 27, 0.26);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(3, 21, 28, 0.62);
}

.button--full {
  width: 100%;
  min-width: 0;
}

.launch-note {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 15px;
  border-left: 1px solid rgba(255, 63, 212, 0.42);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.25;
  letter-spacing: 0.16em;
  color: rgba(185, 224, 237, 0.38);
}

.launch-note strong {
  color: rgba(224, 249, 255, 0.67);
  font-weight: 400;
  letter-spacing: 0.11em;
}

.control-deck {
  width: 100%;
  max-width: 594px;
  margin-top: clamp(20px, 3.4vh, 34px);
  padding-top: 14px;
  border-top: 1px solid rgba(142, 230, 249, 0.14);
  pointer-events: none;
}

.control-deck__title {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.19em;
  color: rgba(189, 228, 242, 0.35);
}

.control-deck__title span:first-child {
  color: rgba(219, 251, 255, 0.58);
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 13px;
}

.control {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 0 12px;
  border-left: 1px solid rgba(122, 224, 242, 0.12);
}

.control:first-child {
  padding-left: 0;
  border-left: 0;
}

.keycaps {
  display: flex;
  flex: none;
  gap: 3px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border: 1px solid rgba(147, 235, 250, 0.26);
  border-bottom-color: rgba(159, 247, 255, 0.52);
  border-radius: 1px;
  background:
    linear-gradient(180deg, rgba(18, 30, 44, 0.76), rgba(5, 10, 20, 0.78));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.38), 0 0 12px rgba(78, 245, 255, 0.04);
  color: rgba(230, 253, 255, 0.78);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
}

kbd.keycap--wide {
  font-size: 7px;
  letter-spacing: 0.04em;
  padding: 0 7px;
}

.control-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.control-copy strong {
  font-family: var(--body);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.11em;
  color: rgba(228, 251, 255, 0.78);
  white-space: nowrap;
}

.control-copy small {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.09em;
  line-height: 1.25;
  color: rgba(188, 225, 237, 0.33);
  white-space: nowrap;
}

.menu-rail {
  position: absolute;
  top: 50%;
  right: clamp(23px, 3.2vw, 52px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  height: 43vh;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.2em;
  color: rgba(189, 226, 238, 0.36);
  pointer-events: none;
}

.rail-code {
  font-family: var(--display);
  font-size: clamp(42px, 5vw, 70px);
  font-weight: 700;
  line-height: 0.8;
  letter-spacing: 0.02em;
  color: rgba(78, 245, 255, 0.1);
  -webkit-text-stroke: 1px rgba(78, 245, 255, 0.28);
}

.rail-copy {
  order: 3;
  writing-mode: vertical-rl;
  text-transform: uppercase;
  line-height: 1.8;
}

.rail-line {
  flex: 1;
  width: 1px;
  min-height: 40px;
  background: linear-gradient(to bottom, rgba(78, 245, 255, 0.14), rgba(255, 63, 212, 0.4), rgba(255, 63, 212, 0.08));
}

.rail-state {
  order: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  writing-mode: vertical-rl;
  color: rgba(155, 245, 255, 0.46);
}

.rail-state i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.menu-footer {
  position: absolute;
  right: var(--pad-x);
  bottom: clamp(18px, 3vh, 28px);
  left: var(--pad-x);
  display: flex;
  align-items: center;
  gap: 13px;
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1;
  letter-spacing: 0.17em;
  color: rgba(186, 225, 237, 0.29);
  pointer-events: none;
}

.footer-dash {
  width: 22px;
  height: 1px;
  background: rgba(78, 245, 255, 0.25);
}

.footer-spacer {
  flex: 1;
}

.footer-hint {
  color: rgba(186, 225, 237, 0.2);
}

/* Pause */
.screen--center {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 45%, rgba(18, 33, 50, 0.26), transparent 45%),
    rgba(2, 4, 10, 0.55);
  backdrop-filter: blur(6px) saturate(0.86);
}

.modal {
  position: relative;
  width: min(392px, 92vw);
  padding: 28px 28px 25px;
  border: 1px solid rgba(128, 236, 255, 0.25);
  background:
    linear-gradient(135deg, rgba(10, 20, 33, 0.9), rgba(5, 8, 18, 0.91) 56%, rgba(15, 8, 26, 0.9));
  clip-path: polygon(0 0, calc(100% - 23px) 0, 100% 23px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.modal::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 27px;
  width: 94px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(78, 245, 255, 0.8);
}

.screen--center:not(.is-hidden) .modal {
  animation: modalIn 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(11px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
  color: rgba(184, 231, 245, 0.4);
}

.modal-meta span:first-child {
  color: var(--cyan);
}

.modal-title {
  margin: 21px 0 14px;
  font-family: var(--display);
  font-size: 82px;
  font-weight: 700;
  line-height: 0.78;
  letter-spacing: 0.04em;
  color: rgba(78, 245, 255, 0.02);
  -webkit-text-stroke: 1.5px rgba(126, 250, 255, 0.88);
}

.modal-copy {
  margin: 0 0 26px;
  font-size: 14px;
  line-height: 1.48;
  color: rgba(211, 239, 247, 0.6);
}

.modal .button--full {
  justify-content: flex-start;
}

.modal-footnote {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.6;
  letter-spacing: 0.08em;
  color: rgba(190, 226, 237, 0.32);
}

/* Game over */
.screen--over {
  pointer-events: auto;
  background:
    linear-gradient(90deg, rgba(3, 5, 12, 0.56) 0%, rgba(3, 5, 12, 0.7) 38%, rgba(3, 5, 12, 0.9) 65%, rgba(3, 5, 12, 0.95) 100%),
    radial-gradient(circle at 28% 42%, rgba(255, 63, 119, 0.1), transparent 44%);
  backdrop-filter: blur(3px) saturate(0.8);
}

.over-layout {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  height: 100%;
  padding: 92px var(--pad-x) 54px;
}

.over-backdrop-word {
  position: absolute;
  top: 50%;
  left: 5vw;
  transform: translateY(-50%);
  font-family: var(--display);
  font-size: clamp(9rem, 19vw, 18rem);
  font-weight: 700;
  line-height: 0.73;
  letter-spacing: -0.015em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 63, 167, 0.1);
  pointer-events: none;
  animation: backdropDrift 8s ease-in-out infinite alternate;
}

@keyframes backdropDrift {
  from { transform: translateY(-50%) translateX(-8px); }
  to { transform: translateY(-50%) translateX(8px); }
}

.result-panel {
  position: relative;
  z-index: 2;
  width: min(438px, 94vw);
  padding: 24px 28px 26px;
  border: 1px solid rgba(133, 236, 255, 0.22);
  background:
    linear-gradient(145deg, rgba(9, 17, 29, 0.92), rgba(5, 8, 18, 0.88) 52%, rgba(18, 7, 24, 0.9));
  clip-path: polygon(0 0, calc(100% - 27px) 0, 100% 27px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.52);
}

.screen--over:not(.is-hidden) .result-panel {
  animation: resultIn 450ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes resultIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-panel::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 28px;
  width: 112px;
  height: 1px;
  background: var(--magenta);
  box-shadow: 0 0 20px rgba(255, 63, 212, 0.8);
}

.result-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(137, 230, 248, 0.12);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.4;
  letter-spacing: 0.13em;
  color: rgba(183, 225, 237, 0.38);
}

.result-topline span:first-child {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 123, 154, 0.7);
}

.result-topline i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 93, 120, 0.8);
}

.result-eyebrow {
  margin-top: 21px;
  color: rgba(255, 133, 164, 0.48);
}

.result-eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: rgba(255, 93, 120, 0.6);
}

.result-title {
  margin: 13px 0 12px;
  font-family: var(--display);
  font-size: clamp(58px, 5.4vw, 76px);
  font-weight: 700;
  line-height: 0.78;
  letter-spacing: 0.03em;
  color: var(--ice);
}

.result-title em {
  color: transparent;
  font-style: normal;
  -webkit-text-stroke: 1px rgba(255, 93, 149, 0.76);
}

.result-reason {
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(210, 237, 245, 0.56);
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 0 22px;
  border-top: 1px solid rgba(133, 230, 248, 0.14);
  border-bottom: 1px solid rgba(133, 230, 248, 0.14);
}

.result-stat {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 0 15px;
}

.result-stat + .result-stat {
  padding-left: 20px;
  border-left: 1px solid rgba(133, 230, 248, 0.14);
}

.result-stat strong {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 700;
  line-height: 0.85;
  letter-spacing: 0.035em;
  color: var(--ice);
}

.result-stat:last-child strong {
  color: var(--cyan);
  text-shadow: 0 0 22px rgba(78, 245, 255, 0.26);
}

.result-panel .button {
  margin-top: 1px;
}

/* Damage feedback */
.impact-flash {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 51% 48%, rgba(255, 122, 112, 0.32), transparent 35%),
    linear-gradient(90deg, transparent 0%, rgba(78, 245, 255, 0.06) 16%, transparent 32%, rgba(255, 63, 120, 0.16) 54%, transparent 78%);
  mix-blend-mode: screen;
}

.impact-flash.is-active {
  animation: impact 520ms ease-out both;
}

@keyframes impact {
  0% { opacity: 0.92; }
  18% { opacity: 0.58; }
  100% { opacity: 0; }
}


/* --------------------------------------------------------------------------
   CHARCOAL / GRAPHITE THEME
   A paper-and-pencil alternative to the neon palette. The WebGL layer is
   converted by the CharcoalShader; these rules carry the same language into
   the interface.
   -------------------------------------------------------------------------- */

:root[data-theme="charcoal"] {
  color-scheme: light;
  --void: #e8e6e0;
  --deep: #f1efe9;
  --panel: rgba(245, 243, 237, 0.88);
  --ice: #171717;
  --muted: rgba(22, 22, 22, 0.64);
  --faint: rgba(22, 22, 22, 0.42);
  --cyan: #1b1b1b;
  --cyan-soft: #3d3d3d;
  --magenta: #565656;
  --amber: #3e3e3e;
  --red: #1d1d1d;
  --hairline: rgba(18, 18, 18, 0.18);
}

html[data-theme="charcoal"],
html[data-theme="charcoal"] body {
  background: var(--void);
}

[data-theme="charcoal"] #app {
  background:
    radial-gradient(ellipse at 64% 44%, rgba(255, 255, 255, 0.7), transparent 52%),
    linear-gradient(180deg, #f0eee8 0%, #dfddd7 100%);
}

[data-theme="charcoal"] .fx-vignette {
  background:
    radial-gradient(ellipse at 53% 43%, transparent 34%, rgba(255, 255, 255, 0.12) 64%, rgba(35, 35, 35, 0.14) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 20%, transparent 76%, rgba(35, 35, 35, 0.05));
}

[data-theme="charcoal"] .fx-scanlines {
  opacity: 0.18;
  mix-blend-mode: multiply;
  background: repeating-linear-gradient(
    to bottom,
    rgba(20, 20, 20, 0.1) 0,
    rgba(20, 20, 20, 0.1) 1px,
    transparent 1px,
    transparent 4px
  );
}

[data-theme="charcoal"] .fx-sweep {
  display: none;
}

[data-theme="charcoal"] .fx-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.55;
  mix-blend-mode: multiply;
  background:
    repeating-linear-gradient(43deg, rgba(20, 20, 20, 0.035) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(-47deg, rgba(20, 20, 20, 0.022) 0 1px, transparent 1px 7px);
}

[data-theme="charcoal"] .fx-corner--tl,
[data-theme="charcoal"] .fx-corner--br {
  border-color: rgba(20, 20, 20, 0.46);
}

[data-theme="charcoal"] .brand-mark i {
  background: #6c6c6c;
  box-shadow: none;
}

[data-theme="charcoal"] .brand-mark i:nth-child(2) {
  background: #151515;
}

[data-theme="charcoal"] .brand-mark i:nth-child(3) {
  background: #969696;
}

[data-theme="charcoal"] .brand-word {
  color: #161616;
}

[data-theme="charcoal"] .brand-word span {
  color: #575757;
}

[data-theme="charcoal"] .brand-code {
  color: rgba(20, 20, 20, 0.38);
}

[data-theme="charcoal"] .icon-button {
  border-color: rgba(20, 20, 20, 0.28);
  background: rgba(255, 255, 255, 0.38);
  color: rgba(22, 22, 22, 0.74);
}

[data-theme="charcoal"] .icon-button::after {
  border-color: rgba(20, 20, 20, 0.08);
}

[data-theme="charcoal"] .icon-button:hover {
  border-color: rgba(20, 20, 20, 0.66);
  background: rgba(255, 255, 255, 0.7);
  color: #101010;
}

[data-theme="charcoal"] .theme-switcher {
  border-color: rgba(20, 20, 20, 0.3);
  background: rgba(255, 255, 255, 0.38);
}

[data-theme="charcoal"] .theme-switcher__label {
  color: rgba(20, 20, 20, 0.52);
}

[data-theme="charcoal"] .theme-choice {
  color: rgba(20, 20, 20, 0.63);
}

[data-theme="charcoal"] .theme-choice:hover {
  color: #111;
}

[data-theme="charcoal"] .theme-choice.is-active {
  background: #1a1a1a;
  color: #f4f2ec;
}

[data-theme="charcoal"] .theme-choice:focus-visible {
  outline-color: #161616;
}

[data-theme="charcoal"] .hud-metrics {
  border-color: rgba(20, 20, 20, 0.28);
  background:
    linear-gradient(110deg, rgba(250, 248, 242, 0.9), rgba(239, 237, 231, 0.73) 58%, rgba(248, 246, 240, 0.88)),
    rgba(240, 238, 232, 0.78);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.08);
}

[data-theme="charcoal"] .hud-metrics::before {
  background: #181818;
  box-shadow: none;
}

[data-theme="charcoal"] .metric-label {
  color: rgba(20, 20, 20, 0.58);
}

[data-theme="charcoal"] .metric-value {
  color: #151515;
  text-shadow: none;
}

[data-theme="charcoal"] .metric-unit {
  color: #3d3d3d;
}

[data-theme="charcoal"] .metric-divider {
  background: linear-gradient(to bottom, transparent, rgba(20, 20, 20, 0.35), transparent);
}

[data-theme="charcoal"] .energy-diamond {
  border-color: #1b1b1b;
  box-shadow: none;
}

[data-theme="charcoal"] .hud-run {
  color: rgba(20, 20, 20, 0.48);
}

[data-theme="charcoal"] .hud-run b {
  color: rgba(20, 20, 20, 0.7);
}

[data-theme="charcoal"] .hud-live i {
  background: #202020;
  box-shadow: none;
}

[data-theme="charcoal"] .screen--menu {
  background:
    linear-gradient(90deg, rgba(239, 237, 231, 0.98) 0%, rgba(239, 237, 231, 0.93) 28%, rgba(239, 237, 231, 0.53) 48%, rgba(239, 237, 231, 0.05) 72%, transparent 86%),
    linear-gradient(0deg, rgba(239, 237, 231, 0.88) 0%, transparent 32%),
    linear-gradient(180deg, rgba(239, 237, 231, 0.82) 0%, transparent 23%);
}

[data-theme="charcoal"] .screen--menu::before {
  background: linear-gradient(to bottom, transparent, rgba(20, 20, 20, 0.13) 24%, rgba(20, 20, 20, 0.16) 72%, transparent);
}

[data-theme="charcoal"] .eyebrow {
  color: rgba(20, 20, 20, 0.57);
}

[data-theme="charcoal"] .eyebrow-rule {
  background: #252525;
  box-shadow: none;
}

[data-theme="charcoal"] .game-title {
  filter: url(#pencil-rough);
}

[data-theme="charcoal"] .title-neon {
  color: #151515;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.08);
}

[data-theme="charcoal"] .title-escape {
  color: rgba(20, 20, 20, 0.02);
  -webkit-text-stroke: 1.5px rgba(22, 22, 22, 0.86);
  text-shadow: none;
}

[data-theme="charcoal"] .title-escape::before {
  -webkit-text-stroke: 1px rgba(20, 20, 20, 0.26);
}

[data-theme="charcoal"] .title-escape::after {
  background: #2a2a2a;
  box-shadow: none;
}

[data-theme="charcoal"] .menu-lede {
  color: rgba(20, 20, 20, 0.67);
}

[data-theme="charcoal"] .menu-lede strong {
  color: #151515;
}

[data-theme="charcoal"] .button--primary {
  background: linear-gradient(108deg, #151515 0%, #303030 58%, #0e0e0e 100%);
  color: #f1efe9;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), inset 0 -3px rgba(0, 0, 0, 0.28);
}

[data-theme="charcoal"] .button--primary::before {
  background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, 0.14) 48%, transparent 61%);
}

[data-theme="charcoal"] .button--primary:hover {
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.24), inset 0 -3px rgba(0, 0, 0, 0.28);
}

[data-theme="charcoal"] .button-index {
  color: rgba(245, 243, 237, 0.46);
}

[data-theme="charcoal"] .button-arrow {
  color: rgba(245, 243, 237, 0.7);
}

[data-theme="charcoal"] .button-key {
  border-color: rgba(245, 243, 237, 0.3);
  color: rgba(245, 243, 237, 0.65);
}

[data-theme="charcoal"] .launch-note {
  border-left-color: rgba(20, 20, 20, 0.35);
  color: rgba(20, 20, 20, 0.45);
}

[data-theme="charcoal"] .launch-note strong {
  color: rgba(20, 20, 20, 0.72);
}

[data-theme="charcoal"] .control-deck {
  border-top-color: rgba(20, 20, 20, 0.18);
}

[data-theme="charcoal"] .control-deck__title {
  color: rgba(20, 20, 20, 0.4);
}

[data-theme="charcoal"] .control-deck__title span:first-child {
  color: rgba(20, 20, 20, 0.65);
}

[data-theme="charcoal"] .control {
  border-left-color: rgba(20, 20, 20, 0.15);
}

[data-theme="charcoal"] kbd {
  border-color: rgba(20, 20, 20, 0.32);
  border-bottom-color: rgba(20, 20, 20, 0.55);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(228, 226, 219, 0.8));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
  color: #242424;
}

[data-theme="charcoal"] .control-copy strong {
  color: #1c1c1c;
}

[data-theme="charcoal"] .control-copy small {
  color: rgba(20, 20, 20, 0.4);
}

[data-theme="charcoal"] .menu-rail {
  color: rgba(20, 20, 20, 0.42);
}

[data-theme="charcoal"] .rail-code {
  color: rgba(20, 20, 20, 0.03);
  -webkit-text-stroke-color: rgba(20, 20, 20, 0.25);
}

[data-theme="charcoal"] .rail-line {
  background: linear-gradient(to bottom, rgba(20, 20, 20, 0.14), rgba(20, 20, 20, 0.38), rgba(20, 20, 20, 0.08));
}

[data-theme="charcoal"] .rail-state {
  color: rgba(20, 20, 20, 0.48);
}

[data-theme="charcoal"] .rail-state i {
  background: #2b2b2b;
  box-shadow: none;
}

[data-theme="charcoal"] .menu-footer {
  color: rgba(20, 20, 20, 0.35);
}

[data-theme="charcoal"] .footer-dash {
  background: rgba(20, 20, 20, 0.28);
}

[data-theme="charcoal"] .footer-hint {
  color: rgba(20, 20, 20, 0.25);
}

[data-theme="charcoal"] .screen--center {
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.2), transparent 45%),
    rgba(231, 229, 223, 0.6);
  backdrop-filter: blur(6px) saturate(0.2);
}

[data-theme="charcoal"] .modal {
  border-color: rgba(20, 20, 20, 0.28);
  background:
    linear-gradient(135deg, rgba(249, 247, 241, 0.97), rgba(236, 234, 228, 0.95) 56%, rgba(246, 244, 238, 0.97));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.16);
}

[data-theme="charcoal"] .modal::before {
  background: #181818;
  box-shadow: none;
}

[data-theme="charcoal"] .modal-meta {
  color: rgba(20, 20, 20, 0.45);
}

[data-theme="charcoal"] .modal-meta span:first-child {
  color: #242424;
}

[data-theme="charcoal"] .modal-title {
  color: rgba(20, 20, 20, 0.015);
  -webkit-text-stroke-color: rgba(22, 22, 22, 0.9);
  filter: url(#pencil-rough);
}

[data-theme="charcoal"] .modal-copy {
  color: rgba(20, 20, 20, 0.64);
}

[data-theme="charcoal"] .modal-footnote {
  color: rgba(20, 20, 20, 0.4);
}

[data-theme="charcoal"] .button--ghost {
  border-color: rgba(20, 20, 20, 0.3);
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.32), rgba(229, 227, 220, 0.3));
  color: rgba(20, 20, 20, 0.68);
}

[data-theme="charcoal"] .button--ghost:hover {
  border-color: rgba(20, 20, 20, 0.72);
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.68), rgba(230, 228, 221, 0.48));
  color: #101010;
}

[data-theme="charcoal"] .button--ghost .button-arrow {
  color: #3d3d3d;
}

[data-theme="charcoal"] .screen--over {
  background:
    linear-gradient(90deg, rgba(235, 233, 227, 0.66) 0%, rgba(235, 233, 227, 0.78) 38%, rgba(235, 233, 227, 0.93) 65%, rgba(235, 233, 227, 0.97) 100%),
    radial-gradient(circle at 28% 42%, rgba(20, 20, 20, 0.08), transparent 44%);
  backdrop-filter: blur(3px) saturate(0.15);
}

[data-theme="charcoal"] .over-backdrop-word {
  -webkit-text-stroke: 1px rgba(20, 20, 20, 0.11);
}

[data-theme="charcoal"] .result-panel {
  border-color: rgba(20, 20, 20, 0.26);
  background:
    linear-gradient(145deg, rgba(250, 248, 242, 0.97), rgba(237, 235, 229, 0.95) 52%, rgba(247, 245, 239, 0.97));
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.18);
}

[data-theme="charcoal"] .result-panel::before {
  background: #191919;
  box-shadow: none;
}

[data-theme="charcoal"] .result-topline {
  border-bottom-color: rgba(20, 20, 20, 0.15);
  color: rgba(20, 20, 20, 0.45);
}

[data-theme="charcoal"] .result-topline span:first-child {
  color: rgba(20, 20, 20, 0.68);
}

[data-theme="charcoal"] .result-topline i {
  background: #232323;
  box-shadow: none;
}

[data-theme="charcoal"] .result-eyebrow {
  color: rgba(20, 20, 20, 0.5);
}

[data-theme="charcoal"] .result-eyebrow::before {
  background: rgba(20, 20, 20, 0.55);
}

[data-theme="charcoal"] .result-title {
  color: #151515;
  filter: url(#pencil-rough);
}

[data-theme="charcoal"] .result-title em {
  -webkit-text-stroke-color: rgba(22, 22, 22, 0.82);
}

[data-theme="charcoal"] .result-reason {
  color: rgba(20, 20, 20, 0.64);
}

[data-theme="charcoal"] .result-stats {
  border-color: rgba(20, 20, 20, 0.16);
}

[data-theme="charcoal"] .result-stat + .result-stat {
  border-left-color: rgba(20, 20, 20, 0.16);
}

[data-theme="charcoal"] .result-stat strong {
  color: #151515;
}

[data-theme="charcoal"] .result-stat:last-child strong {
  color: #202020;
  text-shadow: none;
}

[data-theme="charcoal"] .impact-flash {
  background:
    radial-gradient(circle at 51% 48%, rgba(20, 20, 20, 0.3), transparent 38%),
    linear-gradient(90deg, transparent, rgba(20, 20, 20, 0.08) 50%, transparent);
  mix-blend-mode: multiply;
}

[data-theme="charcoal"] .metric-label,
[data-theme="charcoal"] .result-stat .metric-label {
  color: rgba(20, 20, 20, 0.48);
}

[data-theme="charcoal"] .svg-filters {
  display: block;
}

/* Responsive */
@media (max-width: 1220px) {
  .hud {
    top: 82px;
  }

  .menu-copy {
    width: min(610px, 58vw);
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 0;
    margin-top: 12px;
  }

  .control:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .control {
    padding-left: 10px;
  }
}

@media (max-width: 980px) {
  .brand-code {
    display: none;
  }

  .menu-copy {
    width: min(620px, 70vw);
  }

  .menu-rail {
    display: none;
  }

  .screen--menu::before {
    display: none;
  }

  .game-title {
    font-size: clamp(5.4rem, 13.2vw, 8.5rem);
  }

  .menu-footer .footer-hint {
    display: none;
  }
}

@media (max-height: 780px) and (min-width: 760px) {
  .menu-grid {
    padding-top: 82px;
    padding-bottom: 58px;
  }

  .game-title {
    margin-top: 12px;
    margin-bottom: 15px;
    font-size: clamp(4.9rem, 9.4vw, 8rem);
  }

  .launch-row {
    margin-top: 22px;
  }

  .control-deck {
    margin-top: 18px;
  }

  .button {
    min-height: 53px;
    font-size: 22px;
  }

  .menu-footer {
    bottom: 16px;
  }
}

@media (max-width: 760px) {
  :root {
    --pad-x: 20px;
  }

  .topbar {
    padding-top: 18px;
  }

  .brand-word {
    font-size: 14px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .screen--menu {
    background:
      linear-gradient(90deg, rgba(3, 5, 12, 0.92) 0%, rgba(3, 5, 12, 0.76) 60%, rgba(3, 5, 12, 0.2) 100%),
      linear-gradient(0deg, rgba(3, 5, 12, 0.9) 0%, transparent 40%);
  }

  .menu-grid {
    align-items: flex-end;
    padding: 92px var(--pad-x) 52px;
  }

  .menu-copy {
    width: 100%;
  }

  .game-title {
    font-size: clamp(4.7rem, 19vw, 7.2rem);
    line-height: 0.78;
  }

  .menu-lede {
    font-size: 14px;
  }

  .menu-lede br {
    display: none;
  }

  .launch-row {
    gap: 14px;
  }

  .launch-note {
    display: none;
  }

  .button {
    flex: 1;
    min-width: 0;
    min-height: 54px;
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 0;
  }

  .control:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .control {
    padding-left: 10px;
  }

  .menu-footer {
    justify-content: space-between;
    gap: 8px;
    font-size: 6px;
  }

  .menu-footer span:nth-child(2),
  .menu-footer span:nth-child(3),
  .menu-footer span:nth-child(4) {
    display: none;
  }

  .hud {
    top: 72px;
  }

  .hud-metrics {
    min-width: 286px;
    padding: 8px 17px 9px;
  }

  .metric-value {
    font-size: 25px;
  }

  .over-layout {
    justify-content: center;
    align-items: flex-end;
    padding: 84px 18px 24px;
  }

  .over-backdrop-word {
    top: 27%;
    left: 7vw;
    font-size: 26vw;
    opacity: 0.75;
  }

  .result-panel {
    width: 100%;
    padding: 21px 22px 22px;
  }

  .result-title {
    font-size: 58px;
  }
}

@media (max-width: 460px) {
  .controls,
  .control-deck {
    display: none;
  }

  .control-deck {
    margin-top: 17px;
    padding-top: 11px;
  }

  .control-deck__title span:last-child {
    display: none;
  }

  .menu-footer {
    display: none;
  }

  .hud-run {
    display: none;
  }

  .over-backdrop-word {
    top: 22%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   VOXEL / BLOCK THEME
   A daylit, block-built alternative. The WebGL layer swaps to a pixelated
   voxel city with block clouds; the interface becomes a chunky grass-and-
   parchment console rather than a neon overlay.
   -------------------------------------------------------------------------- */

:root[data-theme="voxel"] {
  color-scheme: light;
  --void: #8ab8ff;
  --deep: #efe3c4;
  --panel: rgba(246, 237, 211, 0.94);
  --ice: #241d14;
  --muted: rgba(44, 38, 25, 0.68);
  --faint: rgba(44, 38, 25, 0.45);
  --cyan: #4f8f3a;
  --cyan-soft: #7ab552;
  --magenta: #a85732;
  --amber: #c99328;
  --red: #9b332c;
  --hairline: rgba(57, 43, 26, 0.25);
  --display: "Courier New", "Lucida Console", monospace;
  --body: "Courier New", "Lucida Console", monospace;
  --mono: "Courier New", "Lucida Console", monospace;
}

html[data-theme="voxel"],
html[data-theme="voxel"] body {
  background: #8ab8ff;
}

[data-theme="voxel"] #app {
  background:
    linear-gradient(180deg, #73a9ff 0%, #a8d0ff 46%, #c9e4ff 64%, #7ca85a 100%);
}

[data-theme="voxel"] #scene canvas {
  image-rendering: pixelated;
}

[data-theme="voxel"] .fx-vignette,
[data-theme="voxel"] .fx-scanlines,
[data-theme="voxel"] .fx-sweep,
[data-theme="voxel"] .fx-corner {
  display: none;
}

[data-theme="voxel"] .topbar {
  padding-top: clamp(15px, 2vw, 24px);
}

[data-theme="voxel"] .brand-mark i {
  background: #3f2d1e;
  box-shadow: 2px 2px 0 rgba(255, 245, 214, 0.55);
}

[data-theme="voxel"] .brand-mark i:nth-child(2) {
  background: #4f8f3a;
}

[data-theme="voxel"] .brand-mark i:nth-child(3) {
  background: #a85732;
  box-shadow: 2px 2px 0 rgba(44, 32, 18, 0.35);
}

[data-theme="voxel"] .brand-word,
[data-theme="voxel"] .brand-code {
  color: #2d2417;
  text-shadow: 2px 2px 0 rgba(255, 245, 214, 0.62);
}

[data-theme="voxel"] .brand-word span {
  color: #3d6b2c;
}

[data-theme="voxel"] .theme-switcher,
[data-theme="voxel"] .icon-button {
  border: 3px solid #3b2a1b;
  background: rgba(246, 237, 211, 0.92);
  box-shadow: 4px 4px 0 rgba(45, 37, 24, 0.28);
  clip-path: none;
  backdrop-filter: none;
}

[data-theme="voxel"] .theme-switcher__label {
  color: rgba(43, 34, 21, 0.58);
  font-weight: 700;
}

[data-theme="voxel"] .theme-choice {
  color: rgba(43, 34, 21, 0.68);
  font-weight: 700;
}

[data-theme="voxel"] .theme-choice:hover {
  color: #241d14;
  background: rgba(111, 170, 79, 0.18);
}

[data-theme="voxel"] .theme-choice.is-active {
  background: #4f8f3a;
  color: #fff8dc;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(30, 60, 20, 0.35);
}

[data-theme="voxel"] .icon-button {
  color: #2d2417;
}

[data-theme="voxel"] .icon-button:hover {
  background: #fff8dc;
  border-color: #a85732;
}

[data-theme="voxel"] .screen--menu {
  background:
    linear-gradient(90deg, rgba(246, 237, 211, 0.97) 0%, rgba(246, 237, 211, 0.88) 32%, rgba(246, 237, 211, 0.32) 54%, rgba(246, 237, 211, 0.02) 72%, transparent 88%),
    linear-gradient(0deg, rgba(73, 104, 48, 0.34) 0%, transparent 25%),
    linear-gradient(180deg, rgba(115, 169, 255, 0.1) 0%, transparent 20%);
}

[data-theme="voxel"] .screen--menu::before {
  left: 41%;
  width: 4px;
  background: linear-gradient(to bottom, transparent, #a85732 16%, #4f8f3a 84%, transparent);
  opacity: 0.5;
}

[data-theme="voxel"] .menu-copy {
  width: min(650px, 55vw);
  padding: clamp(18px, 2.1vw, 30px);
  border: 4px solid #3b2a1b;
  background: rgba(246, 237, 211, 0.9);
  box-shadow:
    inset 0 8px 0 #6faa4f,
    inset 0 -8px 0 #8b5a2b,
    12px 12px 0 rgba(45, 60, 30, 0.24);
}

[data-theme="voxel"] .eyebrow {
  color: #4e6b35;
  font-weight: 700;
  font-size: clamp(8px, 0.72vw, 10px);
}

[data-theme="voxel"] .eyebrow-rule {
  width: 30px;
  height: 4px;
  background: #7a5230;
  box-shadow: none;
}

[data-theme="voxel"] .game-title {
  margin: clamp(12px, 1.8vh, 22px) 0 clamp(12px, 2vh, 20px);
  font-family: var(--display);
  font-size: clamp(4.4rem, 8vw, 7.8rem);
  line-height: 0.82;
  letter-spacing: -0.075em;
  filter: none;
}

[data-theme="voxel"] .title-neon {
  color: #2a2116;
  -webkit-text-stroke: 0;
  text-shadow:
    4px 4px 0 #d8a437,
    8px 8px 0 rgba(72, 48, 24, 0.18);
}

[data-theme="voxel"] .title-escape {
  margin-top: 0.06em;
  color: #4f8f3a;
  -webkit-text-stroke: 0;
  text-shadow:
    4px 4px 0 #2e5b22,
    8px 8px 0 rgba(72, 48, 24, 0.18);
}

[data-theme="voxel"] .title-escape::before {
  display: none;
}

[data-theme="voxel"] .title-escape::after {
  height: 8px;
  background: #8b5a2b;
  box-shadow: 3px 3px 0 rgba(72, 48, 24, 0.2);
}

[data-theme="voxel"] .menu-lede,
[data-theme="voxel"] .menu-lede strong {
  color: #403522;
}

[data-theme="voxel"] .menu-lede {
  font-size: clamp(13px, 1.15vw, 16px);
  font-weight: 700;
}

[data-theme="voxel"] .menu-lede strong {
  color: #2d2417;
}

[data-theme="voxel"] .launch-row {
  align-items: stretch;
  gap: 14px;
}

[data-theme="voxel"] .launch-note,
[data-theme="voxel"] .control-deck {
  border: 3px solid #3b2a1b;
  background: rgba(47, 36, 23, 0.93);
  color: #fff6d8;
  clip-path: none;
  box-shadow: 6px 6px 0 rgba(45, 37, 24, 0.22);
  backdrop-filter: none;
}

[data-theme="voxel"] .launch-note {
  width: min(330px, 44vw);
  padding: 18px 20px;
  justify-content: center;
}

[data-theme="voxel"] .launch-note span {
  color: #a9cc83;
  font-weight: 700;
  letter-spacing: 0.12em;
}

[data-theme="voxel"] .launch-note strong {
  color: #fff6d8;
  font-size: clamp(13px, 1.15vw, 16px);
}

[data-theme="voxel"] .control-deck {
  margin-top: clamp(15px, 2.3vh, 24px);
  background: rgba(47, 36, 23, 0.9);
}

[data-theme="voxel"] .control-deck__title {
  border-bottom-color: rgba(255, 246, 216, 0.2);
  color: #d8c9a4;
}

[data-theme="voxel"] .control-deck__title span:first-child {
  color: #9fd071;
}

[data-theme="voxel"] .control {
  border-top-color: rgba(255, 246, 216, 0.12);
}

[data-theme="voxel"] .control-copy strong {
  color: #fff6d8;
}

[data-theme="voxel"] .control-copy small {
  color: rgba(255, 246, 216, 0.55);
}

[data-theme="voxel"] kbd,
[data-theme="voxel"] .keycap--wide {
  border: 2px solid rgba(255, 246, 216, 0.35);
  background: #5e4a31;
  color: #fff6d8;
  border-radius: 0;
  box-shadow: 0 3px 0 #2d2417;
}

[data-theme="voxel"] .button {
  border: 3px solid #2d2417;
  clip-path: none;
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: 0.02em;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.12);
}

[data-theme="voxel"] .button--primary {
  background: linear-gradient(180deg, #79b552 0%, #5a9b3e 55%, #4a8433 100%);
  color: #fff8dc;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.32),
    inset 0 -4px 0 rgba(35, 70, 24, 0.4),
    6px 6px 0 #2f4d22;
  text-shadow: 2px 2px 0 #2f4d22;
}

[data-theme="voxel"] .button--primary:hover {
  transform: translate(1px, 1px);
  filter: brightness(1.08);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.32),
    inset 0 -4px 0 rgba(35, 70, 24, 0.4),
    4px 4px 0 #2f4d22;
}

[data-theme="voxel"] .button--ghost {
  background: #efe3c4;
  color: #3a2b1b;
  border-color: #3b2a1b;
  box-shadow: 4px 4px 0 rgba(45, 37, 24, 0.24);
  text-shadow: none;
}

[data-theme="voxel"] .button--ghost:hover {
  background: #fff6d8;
  border-color: #a85732;
  color: #241d14;
}

[data-theme="voxel"] .button-index,
[data-theme="voxel"] .button-arrow,
[data-theme="voxel"] .button-key {
  color: #fff6d8;
  border-color: rgba(255, 246, 216, 0.35);
  font-family: var(--mono);
}

[data-theme="voxel"] .button--ghost .button-arrow {
  color: #a85732;
}

[data-theme="voxel"] .menu-rail {
  color: #2d2417;
}

[data-theme="voxel"] .rail-code {
  color: #4f8f3a;
  text-shadow: 3px 3px 0 rgba(216, 164, 55, 0.45);
}

[data-theme="voxel"] .rail-copy,
[data-theme="voxel"] .rail-state {
  color: rgba(43, 34, 21, 0.65);
}

[data-theme="voxel"] .rail-line {
  background: #8b5a2b;
  box-shadow: none;
}

[data-theme="voxel"] .menu-footer {
  color: rgba(43, 34, 21, 0.6);
  text-shadow: 1px 1px 0 rgba(246, 237, 211, 0.7);
}

[data-theme="voxel"] .footer-dash {
  background: #8b5a2b;
}

[data-theme="voxel"] .hud-metrics {
  border: 3px solid #3b2a1b;
  background: rgba(246, 237, 211, 0.95);
  color: #2d2417;
  clip-path: none;
  box-shadow:
    inset 0 4px 0 #6faa4f,
    6px 6px 0 rgba(45, 60, 30, 0.25);
  backdrop-filter: none;
}

[data-theme="voxel"] .hud-metrics::before {
  display: none;
}

[data-theme="voxel"] .metric-label,
[data-theme="voxel"] .hud-run {
  color: rgba(43, 34, 21, 0.88);
  font-weight: 700;
}

[data-theme="voxel"] .metric-value {
  color: #2d2417;
  text-shadow: 2px 2px 0 rgba(216, 164, 55, 0.34);
}

[data-theme="voxel"] .metric-divider {
  background: rgba(43, 34, 21, 0.24);
}

[data-theme="voxel"] .energy-diamond {
  background: #a85732;
  box-shadow: 2px 2px 0 rgba(43, 34, 21, 0.2);
}

[data-theme="voxel"] .hud-live {
  color: #4f8f3a;
}

[data-theme="voxel"] .hud-live i {
  background: #4f8f3a;
  box-shadow: none;
}

[data-theme="voxel"] .gate-toast {
  border: 3px solid #3b2a1b;
  background: rgba(246, 237, 211, 0.98);
  color: #2d2417;
  box-shadow: 5px 5px 0 rgba(45, 60, 30, 0.24);
  clip-path: none;
  font-weight: 700;
}

[data-theme="voxel"] .screen--center,
[data-theme="voxel"] .screen--over {
  background:
    linear-gradient(180deg, rgba(69, 101, 48, 0.48), rgba(42, 60, 30, 0.7)),
    repeating-linear-gradient(45deg, rgba(255, 246, 216, 0.03) 0 8px, transparent 8px 16px);
  backdrop-filter: none;
}

[data-theme="voxel"] .modal,
[data-theme="voxel"] .result-panel {
  border: 4px solid #3b2a1b;
  background: rgba(246, 237, 211, 0.97);
  color: #2d2417;
  clip-path: none;
  box-shadow:
    inset 0 8px 0 #6faa4f,
    10px 10px 0 rgba(35, 48, 26, 0.3);
  backdrop-filter: none;
}

[data-theme="voxel"] .modal::before,
[data-theme="voxel"] .result-panel::before {
  height: 5px;
  background: #8b5a2b;
  box-shadow: none;
}

[data-theme="voxel"] .modal-meta,
[data-theme="voxel"] .result-topline,
[data-theme="voxel"] .result-eyebrow,
[data-theme="voxel"] .modal-footnote {
  color: rgba(43, 34, 21, 0.58);
  border-color: rgba(43, 34, 21, 0.18);
}

[data-theme="voxel"] .modal-title,
[data-theme="voxel"] .result-title {
  color: #3d6b2c;
  -webkit-text-stroke: 0;
  text-shadow:
    3px 3px 0 #2e5b22,
    6px 6px 0 rgba(72, 48, 24, 0.16);
}

[data-theme="voxel"] .result-title em {
  color: #a85732;
  -webkit-text-stroke: 0;
}

[data-theme="voxel"] .modal-copy,
[data-theme="voxel"] .result-reason,
[data-theme="voxel"] .result-stat strong,
[data-theme="voxel"] .result-stat .metric-label,
[data-theme="voxel"] .result-stats {
  color: #3a2b1b;
  border-color: rgba(43, 34, 21, 0.18);
}

[data-theme="voxel"] .result-backdrop-word,
[data-theme="voxel"] .over-backdrop-word {
  color: transparent;
  -webkit-text-stroke: 2px rgba(58, 43, 27, 0.14);
}

[data-theme="voxel"] .result-topline span:first-child {
  color: #a85732;
}

[data-theme="voxel"] .result-topline i {
  border-radius: 0;
  background: #a85732;
}

[data-theme="voxel"] .result-stat {
  border-color: rgba(43, 34, 21, 0.16);
}

@media (max-width: 900px) {
  [data-theme="voxel"] .menu-copy {
    width: min(620px, 92vw);
  }
}

@media (max-height: 720px) {
  [data-theme="voxel"] .menu-copy {
    padding: 14px 18px;
  }
  [data-theme="voxel"] .game-title {
    font-size: clamp(3.6rem, 7vw, 6rem);
  }
  [data-theme="voxel"] .control-deck {
    margin-top: 12px;
  }
}

@media (min-width: 901px) and (max-width: 1100px) {
  [data-theme="voxel"] .menu-copy {
    width: min(680px, 74vw);
  }
  [data-theme="voxel"] .launch-note {
    width: min(300px, 40vw);
  }
}

/* --------------------------------------------------------------------------
   TOUCH CONTROLS
   Shown only on devices with a coarse pointer or touch points, and only while
   a run is active. The keyboard path remains untouched.
   -------------------------------------------------------------------------- */

.touch-controls {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 14;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding:
    0 max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  pointer-events: none;
}

html.has-touch .touch-controls.is-visible {
  display: flex;
}

.touch-cluster {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  pointer-events: none;
}

.touch-cluster--actions {
  gap: 10px;
}

.touch-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 66px;
  height: 66px;
  padding: 0;
  border: 1px solid rgba(140, 238, 255, 0.34);
  background: rgba(5, 10, 19, 0.64);
  color: var(--ice);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.26),
    inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(9px);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: none;
  user-select: none;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 80ms ease, filter 80ms ease, background 120ms ease;
}

.touch-control--action {
  width: 76px;
  height: 76px;
}

.touch-control--jump {
  width: 86px;
  height: 86px;
  border-color: rgba(78, 245, 255, 0.9);
  background: linear-gradient(145deg, #57f8ff 0%, #9dfbff 62%, #e8ffff 100%);
  color: #04111a;
  box-shadow:
    0 0 34px rgba(78, 245, 255, 0.24),
    inset 0 -4px 0 rgba(13, 100, 112, 0.2);
}

.touch-control--slide {
  border-color: rgba(255, 178, 95, 0.56);
  background: rgba(33, 20, 9, 0.66);
  color: #ffd7a6;
}

.touch-control:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: -4px;
}

.touch-control.is-pressed,
.touch-control:active {
  transform: translateY(3px) scale(0.97);
  filter: brightness(1.2);
}

.touch-key {
  display: block;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  line-height: 0.9;
}

.touch-control--jump .touch-key {
  font-size: 28px;
}

.touch-name {
  display: block;
  font-family: var(--mono);
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
}

.touch-control--jump .touch-name {
  font-size: 7.5px;
}

html.has-touch,
html.has-touch body {
  overscroll-behavior: none;
}

html.has-touch #game-canvas {
  touch-action: none;
}

/* Charcoal touch controls: paper keys with graphite borders. */
[data-theme="charcoal"] .touch-control {
  border-color: rgba(20, 20, 20, 0.32);
  background: rgba(244, 242, 236, 0.91);
  color: #171717;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(8px);
}

[data-theme="charcoal"] .touch-control--jump {
  border-color: #171717;
  background: #1b1b1b;
  color: #f4f2ec;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

[data-theme="charcoal"] .touch-control--slide {
  border-color: rgba(20, 20, 20, 0.5);
  background: rgba(230, 227, 219, 0.94);
  color: #282828;
}

/* Voxel touch controls: chunky parchment and grass blocks. */
[data-theme="voxel"] .touch-control {
  border: 3px solid #3b2a1b;
  background: #efe3c4;
  color: #2d2417;
  clip-path: none;
  box-shadow:
    inset 0 3px 0 rgba(255, 246, 216, 0.7),
    5px 5px 0 rgba(45, 37, 24, 0.3);
  backdrop-filter: none;
}

[data-theme="voxel"] .touch-control--jump {
  border-color: #2d2417;
  background: #4f8f3a;
  color: #fff8dc;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.24),
    inset 0 -4px 0 rgba(35, 70, 24, 0.35),
    5px 5px 0 #2f4d22;
}

[data-theme="voxel"] .touch-control--slide {
  border-color: #3b2a1b;
  background: #f4e8c8;
  color: #5b4327;
}

[data-theme="voxel"] .touch-control.is-pressed,
[data-theme="voxel"] .touch-control:active {
  transform: translate(2px, 2px);
}

@media (max-width: 380px) {
  .touch-controls {
    gap: 10px;
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .touch-cluster,
  .touch-cluster--actions {
    gap: 7px;
  }

  .touch-control {
    width: 56px;
    height: 56px;
  }

  .touch-control--action {
    width: 64px;
    height: 64px;
  }

  .touch-control--jump {
    width: 72px;
    height: 72px;
  }

  .touch-name {
    font-size: 6px;
  }
}

@media (max-height: 500px) {
  .touch-controls {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .touch-control {
    width: 58px;
    height: 58px;
  }

  .touch-control--action {
    width: 68px;
    height: 68px;
  }

  .touch-control--jump {
    width: 76px;
    height: 76px;
  }
}

@media (max-width: 760px) {
  .theme-switcher__label {
    display: none;
  }

  .theme-choice {
    padding: 0 6px;
    font-size: 7px;
  }

  .top-actions {
    gap: 6px;
  }

  html.has-touch .icon-button {
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 380px) {
  .brand-word {
    display: none;
  }
}

/* Gesture-first touch controls. */

.gesture-hint {
  position: fixed;
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 18px));
  left: 50%;
  z-index: 13;
  display: flex;
  visibility: hidden;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid rgba(140, 238, 255, 0.28);
  background: rgba(5, 10, 19, 0.76);
  color: var(--ice);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(9px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.gesture-hint.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}

.gesture-hint__title {
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--cyan-soft);
}

.gesture-hint__row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.gesture-hint__row span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.gesture-hint__row b {
  font-size: 11px;
  line-height: 1;
  color: var(--ice);
}

html:not(.has-touch) .gesture-hint {
  display: none;
}

/* Optional button mode, selectable from the pause screen. */

.touch-mode {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 9px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

html:not(.has-touch) .touch-mode {
  display: none;
}

.touch-mode__label {
  margin-right: auto;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.touch-mode__choice {
  padding: 6px 8px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  touch-action: manipulation;
}

.touch-mode__choice.is-active {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #04111a;
}

.touch-mode__choice:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 2px;
}

[data-theme="charcoal"] .gesture-hint {
  border-color: rgba(20, 20, 20, 0.28);
  background: rgba(244, 242, 236, 0.94);
  color: #171717;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
}

[data-theme="charcoal"] .gesture-hint__title {
  color: #303030;
}

[data-theme="charcoal"] .gesture-hint__row {
  color: #4f4f4f;
}

[data-theme="charcoal"] .gesture-hint__row b {
  color: #171717;
}

[data-theme="charcoal"] .touch-mode__choice.is-active {
  border-color: #1b1b1b;
  background: #1b1b1b;
  color: #f4f2ec;
}

[data-theme="voxel"] .gesture-hint {
  border: 3px solid #3b2a1b;
  background: rgba(246, 237, 211, 0.96);
  color: #2d2417;
  clip-path: none;
  box-shadow:
    inset 0 3px 0 #6faa4f,
    5px 5px 0 rgba(45, 37, 24, 0.25);
  backdrop-filter: none;
}

[data-theme="voxel"] .gesture-hint__title {
  color: #3d6b2c;
}

[data-theme="voxel"] .gesture-hint__row {
  color: rgba(43, 34, 21, 0.7);
}

[data-theme="voxel"] .gesture-hint__row b {
  color: #2d2417;
}

[data-theme="voxel"] .touch-mode__choice.is-active {
  border-color: #2d2417;
  background: #4f8f3a;
  color: #fff8dc;
}

/* Keep the in-game metrics behind the pause overlay on short screens; the
   pause modal must never collide with the HUD. */
#app[data-state="paused"] .hud {
  z-index: 10;
}

/* Compact touch HUD: the run is the focus, so the metrics become a slim
   one-line strip directly under the top bar instead of a tall central panel. */
html.has-touch .topbar {
  padding-top: max(10px, env(safe-area-inset-top));
}

html.has-touch .hud {
  top: max(62px, calc(env(safe-area-inset-top) + 54px));
  gap: 0;
}

html.has-touch .hud-metrics {
  min-width: 0;
  padding: 4px 12px 5px;
  gap: 12px;
}

html.has-touch .metric {
  flex-direction: row;
  align-items: baseline;
  min-width: 0;
  gap: 3px;
}

html.has-touch .metric-label {
  display: none;
}

html.has-touch .metric-reading {
  gap: 4px;
}

html.has-touch .metric-value {
  font-size: 21px;
  line-height: 1;
  letter-spacing: 0.03em;
}

html.has-touch .metric-unit {
  font-size: 7px;
}

html.has-touch .metric-divider {
  height: 18px;
}

html.has-touch .hud-run {
  display: none;
}

html.has-touch .gate-toast {
  top: max(104px, calc(env(safe-area-inset-top) + 96px));
}

/* Lives and the five-second revive countdown. */

.metric--lives .metric-reading {
  gap: 5px;
}

.lives-heart {
  display: inline-block;
  color: var(--red);
  font-family: var(--body);
  font-size: 12px;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 93, 120, 0.35);
}

[data-theme="charcoal"] .lives-heart {
  color: #1b1b1b;
  text-shadow: none;
}

[data-theme="voxel"] .lives-heart {
  color: #9b332c;
  text-shadow: 1px 1px 0 rgba(45, 37, 24, 0.2);
}

.screen--revive {
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(13, 33, 46, 0.68), transparent 54%),
    rgba(2, 5, 12, 0.9);
  backdrop-filter: blur(10px);
}

.revive-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 560px;
  text-align: center;
}

.revive-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 clamp(18px, 3vh, 28px);
  color: var(--cyan-soft);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.revive-kicker i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px rgba(255, 93, 120, 0.8);
  animation: reviveBlink 1s steps(2, end) infinite;
}

.revive-count {
  color: var(--cyan);
  font-family: var(--display);
  font-size: clamp(6rem, 18vw, 11rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 60px rgba(78, 245, 255, 0.2),
    5px 5px 0 rgba(255, 63, 212, 0.1);
}

.revive-count.is-tick {
  animation: reviveTick 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.revive-caption {
  margin: clamp(16px, 3vh, 28px) 0 0;
  color: var(--ice);
  font-family: var(--mono);
  font-size: clamp(8px, 0.85vw, 10px);
  letter-spacing: 0.18em;
}

.revive-lives {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.15em;
}

.revive-lives strong {
  color: var(--red);
  font-size: 13px;
}

@keyframes reviveTick {
  0% { opacity: 0.2; transform: scale(0.82); }
  55% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes reviveBlink {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0.3; }
}

[data-theme="charcoal"] .screen--revive {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, 0.65), transparent 56%),
    rgba(233, 231, 224, 0.94);
}

[data-theme="charcoal"] .revive-kicker {
  color: #303030;
}

[data-theme="charcoal"] .revive-count {
  color: #1b1b1b;
  text-shadow: 4px 4px 0 rgba(20, 20, 20, 0.08);
}

[data-theme="charcoal"] .revive-caption {
  color: #171717;
}

[data-theme="charcoal"] .revive-lives {
  color: rgba(20, 20, 20, 0.5);
}

[data-theme="charcoal"] .revive-lives strong {
  color: #1b1b1b;
}

[data-theme="voxel"] .screen--revive {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(88, 128, 58, 0.3), transparent 55%),
    rgba(18, 30, 16, 0.9);
}

[data-theme="voxel"] .revive-panel {
  padding: clamp(24px, 5vw, 46px) clamp(26px, 7vw, 64px);
  border: 4px solid #3b2a1b;
  background: #f4e8c8;
  box-shadow:
    inset 0 8px 0 #6faa4f,
    inset 0 -8px 0 #8b5a2b,
    10px 10px 0 rgba(0, 0, 0, 0.28);
}

[data-theme="voxel"] .revive-kicker {
  color: #3d6b2c;
}

[data-theme="voxel"] .revive-count {
  color: #4f8f3a;
  text-shadow: 5px 5px 0 #2e5b22;
}

[data-theme="voxel"] .revive-caption {
  color: #2d2417;
}

[data-theme="voxel"] .revive-lives {
  color: rgba(43, 34, 21, 0.65);
}

[data-theme="voxel"] .revive-lives strong {
  color: #9b332c;
}

@media (prefers-reduced-motion: reduce) {
  .revive-count.is-tick,
  .revive-kicker i {
    animation: none;
  }
}

/* Level badge and progress toward the next circuit-board finish gate. */

.level-tag {
  display: none;
}

.level-progress {
  position: relative;
  width: 100%;
  height: 3px;
  margin-top: 4px;
  overflow: hidden;
  background: rgba(117, 231, 255, 0.14);
}

.level-progress__fill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--cyan-soft));
  box-shadow: 0 0 10px rgba(78, 245, 255, 0.55);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 120ms linear;
}

[data-theme="charcoal"] .level-progress {
  background: rgba(20, 20, 20, 0.14);
}

[data-theme="charcoal"] .level-progress__fill {
  background: #1b1b1b;
  box-shadow: none;
}

[data-theme="voxel"] .level-progress {
  background: rgba(59, 42, 27, 0.18);
}

[data-theme="voxel"] .level-progress__fill {
  background: #4f8f3a;
  box-shadow: 1px 1px 0 rgba(45, 37, 24, 0.25);
}

html.has-touch .level-tag {
  display: inline-block;
  margin-right: 1px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
}

html.has-touch .metric--level .metric-reading {
  gap: 2px;
}

/* Level-clear celebration: a translucent pause with a dancing android. */

.celebration-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding:
    max(22px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(22px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  background:
    linear-gradient(180deg, rgba(2, 5, 12, 0.86) 0%, rgba(2, 5, 12, 0.2) 26%, transparent 45%, transparent 68%, rgba(2, 5, 12, 0.84) 100%);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.celebration-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.celebration-banner {
  width: min(580px, 94vw);
  padding: clamp(14px, 2.2vw, 22px) clamp(18px, 4vw, 40px);
  border: 1px solid rgba(109, 255, 196, 0.5);
  background: rgba(3, 12, 17, 0.8);
  text-align: center;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  box-shadow:
    0 14px 40px rgba(0, 0, 0, 0.36),
    inset 0 0 0 1px rgba(109, 255, 196, 0.08);
  backdrop-filter: blur(10px);
}

.celebration-kicker {
  display: block;
  margin-bottom: 8px;
  color: #6dffc4;
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.celebration-title {
  margin: 0;
  color: var(--ice);
  font-family: var(--display);
  font-size: clamp(2.7rem, 6vw, 5.2rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0.02em;
}

.celebration-title em {
  color: #6dffc4;
  font-style: normal;
  text-shadow: 3px 3px 0 rgba(109, 255, 196, 0.16);
}

.celebration-next {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.celebration-next b {
  color: #e9c46a;
  font-weight: 700;
}

.celebration-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
}

.celebration-continue {
  min-width: min(320px, 74vw);
  justify-content: center;
  border: 1px solid #6dffc4;
  background: linear-gradient(145deg, #6dffc4, #d4fff0);
  color: #04141a;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  box-shadow: 0 0 34px rgba(109, 255, 196, 0.24);
  font-family: var(--display);
  font-size: 22px;
  text-shadow: none;
}

.celebration-continue:hover {
  filter: brightness(1.08);
}

.celebration-hint {
  margin: 0;
  color: rgba(226, 250, 255, 0.56);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
  text-align: center;
}

[data-theme="charcoal"] .celebration-screen {
  background:
    linear-gradient(180deg, rgba(245, 243, 237, 0.94) 0%, rgba(245, 243, 237, 0.2) 26%, transparent 44%, transparent 68%, rgba(245, 243, 237, 0.94) 100%);
}

[data-theme="charcoal"] .celebration-banner {
  border-color: rgba(20, 20, 20, 0.4);
  background: rgba(248, 246, 240, 0.92);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}

[data-theme="charcoal"] .celebration-kicker,
[data-theme="charcoal"] .celebration-title em {
  color: #1b1b1b;
  text-shadow: none;
}

[data-theme="charcoal"] .celebration-title {
  color: #171717;
}

[data-theme="charcoal"] .celebration-next,
[data-theme="charcoal"] .celebration-hint {
  color: rgba(20, 20, 20, 0.58);
}

[data-theme="charcoal"] .celebration-next b {
  color: #3a3a3a;
}

[data-theme="charcoal"] .celebration-continue {
  border-color: #1b1b1b;
  background: #1b1b1b;
  color: #f4f2ec;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

[data-theme="voxel"] .celebration-screen {
  background:
    linear-gradient(180deg, rgba(13, 25, 15, 0.9) 0%, rgba(13, 25, 15, 0.2) 28%, transparent 46%, transparent 66%, rgba(13, 25, 15, 0.9) 100%);
}

[data-theme="voxel"] .celebration-banner {
  border: 4px solid #3b2a1b;
  background: #f4e8c8;
  clip-path: none;
  box-shadow:
    inset 0 7px 0 #6faa4f,
    inset 0 -7px 0 #8b5a2b,
    10px 10px 0 rgba(0, 0, 0, 0.26);
  backdrop-filter: none;
}

[data-theme="voxel"] .celebration-kicker {
  color: #3d6b2c;
}

[data-theme="voxel"] .celebration-title {
  color: #2d2417;
}

[data-theme="voxel"] .celebration-title em {
  color: #4f8f3a;
  text-shadow: 4px 4px 0 #2e5b22;
}

[data-theme="voxel"] .celebration-next {
  color: rgba(43, 34, 21, 0.65);
}

[data-theme="voxel"] .celebration-next b {
  color: #9b332c;
}

[data-theme="voxel"] .celebration-continue {
  border: 3px solid #2d2417;
  background: #4f8f3a;
  color: #fff8dc;
  clip-path: none;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.24),
    inset 0 -4px 0 rgba(35, 70, 24, 0.35),
    6px 6px 0 #2f4d22;
  text-shadow: 2px 2px 0 #2f4d22;
}

[data-theme="voxel"] .celebration-hint {
  color: rgba(255, 246, 216, 0.62);
}

@media (max-width: 460px) {
  .celebration-title {
    font-size: clamp(2.4rem, 12vw, 3.7rem);
  }

  .celebration-continue {
    min-width: min(300px, 82vw);
    font-size: 19px;
  }
}

#app[data-state="celebrating"] .topbar {
  opacity: 0;
  visibility: hidden;
}
