:root {
  --night: #06122a;
  --night-soft: #0b2346;
  --cyan: #4bf1e2;
  --blue: #137eb8;
  --violet: #6951a7;
  --red: #ef3f63;
  --red-hot: #ff5572;
  --silver: #dbe0e2;
  --silver-mid: #9da8ad;
  --silver-dark: #56666f;
  --ink: #dcecff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--night);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 78% 42%, rgba(62, 213, 225, 0.16), transparent 25%),
    radial-gradient(circle at 12% 82%, rgba(73, 81, 174, 0.21), transparent 32%),
    linear-gradient(128deg, #0a2a55 0%, var(--night) 43%, #040914 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(75, 241, 226, 0.23) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 241, 226, 0.23) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, transparent, black 42%, transparent);
  transform: perspective(450px) rotateX(63deg) scale(1.5) translateY(35%);
  transform-origin: bottom;
}

.ambient-snake {
  position: fixed;
  z-index: 0;
  top: 50%;
  left: 48%;
  width: 520px;
  height: 220px;
  pointer-events: none;
  opacity: 0.17;
  transform: translate(-50%, -50%) rotate(-7deg);
  filter: drop-shadow(0 0 16px rgba(255, 72, 107, 0.32));
}

.ambient-snake i {
  position: absolute;
  width: 29px;
  height: 29px;
  border: 1px solid rgba(255, 172, 187, 0.55);
  background: var(--red);
  animation: snake-signal 2.25s ease-in-out infinite;
}

.ambient-snake i:nth-child(1) { left: 0; top: 154px; animation-delay: -1.65s; }
.ambient-snake i:nth-child(2) { left: 37px; top: 154px; animation-delay: -1.5s; }
.ambient-snake i:nth-child(3) { left: 74px; top: 154px; animation-delay: -1.35s; }
.ambient-snake i:nth-child(4) { left: 111px; top: 154px; animation-delay: -1.2s; }
.ambient-snake i:nth-child(5) { left: 148px; top: 117px; animation-delay: -1.05s; }
.ambient-snake i:nth-child(6) { left: 185px; top: 80px; animation-delay: -0.9s; }
.ambient-snake i:nth-child(7) { left: 222px; top: 80px; animation-delay: -0.75s; }
.ambient-snake i:nth-child(8) { left: 259px; top: 80px; animation-delay: -0.6s; }
.ambient-snake i:nth-child(9) { left: 296px; top: 80px; animation-delay: -0.45s; }
.ambient-snake i:nth-child(10) { left: 333px; top: 43px; animation-delay: -0.3s; }
.ambient-snake i:nth-child(11) { left: 370px; top: 6px; animation-delay: -0.15s; }
.ambient-snake i:nth-child(12) {
  left: 407px;
  top: 6px;
  width: 37px;
  height: 37px;
  border-radius: 5px;
  background: var(--red-hot);
}

body[data-game-state="running"] .ambient-snake i {
  animation-duration: 1.35s;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
.firmware-option:focus-within,
.stage-option:focus-within {
  outline: 3px solid #75fff0;
  outline-offset: 3px;
}

.stage {
  position: relative;
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding:
    calc(32px + env(safe-area-inset-top))
    calc(clamp(22px, 5vw, 62px) + env(safe-area-inset-right))
    calc(32px + env(safe-area-inset-bottom))
    calc(clamp(22px, 5vw, 62px) + env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(350px, 430px);
  align-items: center;
  gap: clamp(54px, 7vw, 96px);
}

.intro {
  position: relative;
  z-index: 1;
  max-width: 480px;
}

.onsite-return {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45em;
  margin-bottom: 34px;
  color: rgba(220, 236, 255, 0.76);
  font: 800 11px/1.2 "Courier New", monospace;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.onsite-return::before {
  content: "←";
  transition: transform 160ms ease;
}

.onsite-return:hover::before,
.onsite-return:focus-visible::before {
  transform: translateX(-4px);
}

.onsite-return span {
  color: white;
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.archive-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.archive-kicker > span {
  color: rgba(220, 236, 255, 0.48);
  font: 700 9px/1 "Courier New", monospace;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.system-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--cyan);
  font: 700 12px/1 "Courier New", monospace;
  letter-spacing: 0.2em;
}

.system-label i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 9px var(--cyan);
  animation: status-blink 1.8s steps(2, end) infinite;
}

.title-lockup {
  position: relative;
  width: fit-content;
}

h1 {
  margin: 0;
  color: white;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(86px, 11.5vw, 148px);
  font-weight: 900;
  line-height: 0.78;
  letter-spacing: -0.035em;
  text-shadow: 7px 7px 0 rgba(37, 109, 155, 0.62), 0 0 40px rgba(75, 241, 226, 0.08);
}

.title-trail {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 76%;
  margin: 20px 0 0 4px;
}

.title-trail::after {
  content: "ORIGINAL / STAGES 01–15";
  margin-left: 8px;
  color: rgba(220, 236, 255, 0.48);
  font: 700 8px/1 "Courier New", monospace;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.title-trail i {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 1px solid rgba(255, 181, 193, 0.65);
  background: var(--red);
  box-shadow: 0 0 11px rgba(239, 63, 99, 0.32);
}

.title-trail i:nth-child(7) { transform: translateY(-9px); }
.title-trail i:nth-child(8) {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
  transform: translateY(-18px);
  background: var(--red-hot);
}

.intro-copy {
  margin: 24px 0 18px;
  font-size: clamp(18px, 2.1vw, 24px);
  font-weight: 650;
  line-height: 1.55;
  letter-spacing: 0.02em;
}

.firmware-select {
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid rgba(75, 241, 226, 0.42);
  background:
    repeating-linear-gradient(
      0deg,
      rgba(75, 241, 226, 0.035) 0 1px,
      transparent 1px 3px
    ),
    rgba(2, 12, 32, 0.92);
}

.firmware-select legend {
  margin-left: 10px;
  padding: 0 6px;
  color: rgba(220, 236, 255, 0.58);
  background: rgba(2, 12, 32, 0.96);
  font: 700 8px/1 "Courier New", monospace;
  letter-spacing: 0.14em;
}

.firmware-select__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.firmware-option {
  position: relative;
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 8px;
  align-items: start;
  min-height: 54px;
  margin: 0;
  padding: 10px 11px 11px;
  cursor: pointer;
  color: rgba(220, 236, 255, 0.78);
  border-right: 1px solid rgba(75, 241, 226, 0.18);
}

.firmware-option:last-child {
  border-right: 0;
}

.firmware-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.firmware-option > span {
  grid-column: 2;
  display: grid;
  gap: 5px;
  min-width: 0;
}

.firmware-option > span::before {
  content: "·";
  position: absolute;
  left: 11px;
  top: 11px;
  color: rgba(75, 241, 226, 0.45);
  font: 700 11px/1 "Courier New", monospace;
}

.firmware-option b {
  color: var(--cyan);
  font: 800 12px/1.1 "Courier New", monospace;
  letter-spacing: 0.04em;
}

.firmware-option small {
  color: rgba(220, 236, 255, 0.52);
  font: 650 10px/1.35 "Arial Narrow", Arial, sans-serif;
}

.firmware-option:hover {
  background: rgba(75, 241, 226, 0.05);
}

.firmware-option:has(input:checked) {
  color: #041018;
  background: rgba(75, 241, 226, 0.88);
}

.firmware-option:has(input:checked) > span::before {
  content: "*";
  color: #041018;
}

.firmware-option:has(input:checked) b,
.firmware-option:has(input:checked) small {
  color: #041018;
}

.visual-select .firmware-option--hd:has(input:checked) {
  background: linear-gradient(105deg, rgba(157, 255, 133, 0.96), rgba(75, 241, 226, 0.9));
}

.visual-select .firmware-option--hd b::after {
  content: "LIVE";
  display: inline-block;
  margin-left: 7px;
  padding: 2px 4px 1px;
  border: 1px solid currentColor;
  font-size: 7px;
  letter-spacing: 0.12em;
  vertical-align: 1px;
}

.firmware-select.is-locked {
  opacity: 0.55;
}

.firmware-select.is-locked .firmware-option {
  cursor: not-allowed;
}

.stage-select {
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid rgba(75, 241, 226, 0.28);
  background: rgba(2, 10, 27, 0.84);
}

.stage-select legend {
  margin-left: 10px;
  padding: 0 6px;
  color: rgba(220, 236, 255, 0.58);
  background: rgba(2, 12, 32, 0.96);
  font: 700 8px/1 "Courier New", monospace;
  letter-spacing: 0.14em;
}

.stage-select__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: rgba(75, 241, 226, 0.14);
}

.stage-option {
  position: relative;
  min-width: 0;
  min-height: 42px;
  padding: 7px 9px;
  cursor: pointer;
  color: rgba(220, 236, 255, 0.74);
  background: rgba(4, 17, 42, 0.96);
  transition: color 130ms ease, background 130ms ease, box-shadow 130ms ease;
}

.stage-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.stage-option span {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: baseline;
  gap: 6px;
}

.stage-option b {
  color: var(--cyan);
  font: 900 15px/1 Impact, "Arial Narrow Bold", sans-serif;
  letter-spacing: 0.04em;
}

.stage-option[data-set="2"] b {
  color: #ffdf72;
}

.stage-option[data-set="3"] b {
  color: #ff8ba1;
}

.stage-option small {
  overflow: hidden;
  font: 700 7px/1 "Courier New", monospace;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-option:hover {
  color: white;
  background: rgba(8, 49, 72, 0.98);
}

.stage-option:has(input:checked) {
  color: #03131c;
  background: var(--cyan);
  box-shadow: inset 0 -3px rgba(4, 43, 57, 0.35);
}

.stage-option:has(input:checked) b {
  color: #071b25;
}

body[data-surface="back"] {
  background:
    radial-gradient(circle at 74% 35%, rgba(158, 99, 255, 0.23), transparent 28%),
    radial-gradient(circle at 12% 78%, rgba(75, 241, 226, 0.12), transparent 30%),
    linear-gradient(128deg, #201354 0%, #08091e 52%, #03040e 100%);
}

body[data-surface="back"] .live-readout strong,
body[data-surface="back"] .surface-tag b {
  color: #c9a8ff;
}

.stage-select.is-locked {
  opacity: 0.52;
}

.stage-select.is-locked .stage-option {
  cursor: not-allowed;
}

.launch-console {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(190px, 1.1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.launch-actions {
  display: grid;
  align-content: start;
  gap: 7px;
}

.launch-button {
  min-height: 58px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #ff8ba1;
  border-radius: 0;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, #ff4a6b, #b91f49);
  box-shadow: 5px 5px 0 rgba(36, 10, 31, 0.62), inset 0 1px rgba(255, 255, 255, 0.35);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.04em;
  transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.launch-button:hover,
.launch-button:focus-visible {
  filter: brightness(1.08);
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 rgba(36, 10, 31, 0.62), inset 0 1px rgba(255, 255, 255, 0.35);
}

.launch-button:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 rgba(36, 10, 31, 0.62);
}

.launch-button kbd {
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 2px;
  color: white;
  background: rgba(38, 7, 27, 0.3);
  font: 700 8px/1 "Courier New", monospace;
}

.continue-button {
  min-height: 35px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(75, 241, 226, 0.48);
  border-radius: 0;
  cursor: pointer;
  color: var(--cyan);
  background: rgba(3, 13, 34, 0.78);
  box-shadow: 3px 3px 0 rgba(1, 6, 20, 0.55);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.continue-button small {
  color: rgba(220, 236, 255, 0.5);
  font: 700 7px/1 "Courier New", monospace;
}

.continue-button:hover,
.continue-button:focus-visible {
  color: white;
  border-color: var(--cyan);
  background: rgba(8, 54, 77, 0.86);
}

.live-readout {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  border: 1px solid rgba(75, 241, 226, 0.34);
  background: rgba(3, 13, 34, 0.58);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.live-readout span {
  padding: 10px 12px;
  display: grid;
  align-content: center;
  gap: 5px;
}

.live-readout span + span {
  border-left: 1px solid rgba(75, 241, 226, 0.24);
}

.live-readout small {
  color: rgba(220, 236, 255, 0.48);
  font: 700 8px/1 "Courier New", monospace;
  letter-spacing: 0.1em;
}

.live-readout strong {
  overflow: hidden;
  color: var(--cyan);
  font: 900 12px/1 "Courier New", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-help {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border: 1px solid rgba(220, 236, 255, 0.15);
  background: rgba(220, 236, 255, 0.15);
}

.desktop-help div {
  display: block;
  min-width: 0;
  padding: 11px 13px;
  border: 0;
  background: rgba(5, 17, 42, 0.88);
}

.desktop-help dt,
.desktop-help dd {
  margin: 0;
}

.archive-slot {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(210px, 1.1fr);
  border: 1px solid rgba(75, 241, 226, 0.24);
  background:
    linear-gradient(90deg, rgba(75, 241, 226, 0.06), transparent 42%),
    rgba(3, 13, 34, 0.68);
  box-shadow: inset 4px 0 0 rgba(75, 241, 226, 0.34);
}

.archive-slot__save,
.archive-slot__scores {
  min-width: 0;
  padding: 10px 12px;
}

.archive-slot__scores {
  border-left: 1px solid rgba(75, 241, 226, 0.16);
}

.archive-slot p {
  margin: 0 0 7px;
  color: rgba(220, 236, 255, 0.44);
  font: 700 7px/1 "Courier New", monospace;
  letter-spacing: 0.12em;
}

.archive-slot strong {
  display: block;
  overflow: hidden;
  color: var(--cyan);
  font: 800 9px/1.35 "Courier New", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-slot ol {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  list-style: none;
}

.archive-slot li {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding-left: 7px;
  border-left: 1px solid rgba(220, 236, 255, 0.1);
  font: 700 8px/1 "Courier New", monospace;
}

.archive-slot li span {
  color: rgba(220, 236, 255, 0.38);
}

.archive-slot li b {
  overflow: hidden;
  color: rgba(235, 255, 255, 0.84);
  font-size: 8px;
  text-overflow: clip;
}

.archive-slot li small {
  overflow: hidden;
  color: rgba(75, 241, 226, 0.58);
  font: 700 6px/1.25 "Courier New", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-help dt {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 800;
}

.desktop-help dd {
  margin-top: 5px;
  font: 700 12px/1.4 "Courier New", monospace;
}

.playfield-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
  color: rgba(220, 236, 255, 0.66);
  font: 700 9px/1.2 "Courier New", monospace;
  letter-spacing: 0.04em;
}

.playfield-key span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.playfield-key i {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  transform: rotate(45deg);
}

.path-chip { background: #4bf1e2; box-shadow: 0 0 7px rgba(75, 241, 226, 0.8); }
.energy-chip { background: #9dff85; box-shadow: 0 0 7px rgba(157, 255, 133, 0.74); }
.boost-chip { background: #8df36f; box-shadow: 0 0 7px rgba(141, 243, 111, 0.72); }
.wall-chip { background: #9c63ff; box-shadow: 0 0 7px rgba(156, 99, 255, 0.72); }
.solid-chip { background: #7a8791; box-shadow: inset 0 0 0 2px #17232b; }
.speed-chip { background: linear-gradient(135deg, #6aee70 0 50%, #ff5246 50%); }
.letter-chip { background: #f77bdd; box-shadow: 0 0 7px rgba(247, 123, 221, 0.76); }

body[data-level-theme="boss"] {
  background:
    radial-gradient(circle at 78% 42%, rgba(255, 216, 52, 0.2), transparent 25%),
    radial-gradient(circle at 12% 82%, rgba(193, 42, 12, 0.28), transparent 32%),
    linear-gradient(128deg, #7a1b0c 0%, #190910 48%, #06040a 100%);
}

body[data-level-theme="boss"] .system-label,
body[data-level-theme="boss"] .live-readout strong,
body[data-level-theme="boss"] .surface-tag b {
  color: #ffed62;
}

.archive-note {
  margin: 17px 0 0;
  color: rgba(220, 236, 255, 0.48);
  font: 700 10px/1.4 "Courier New", monospace;
  letter-spacing: 0.08em;
}

.phone-wrap {
  position: relative;
  display: grid;
  justify-items: center;
  isolation: isolate;
}

.surface-tag {
  position: absolute;
  z-index: -1;
  top: 78px;
  right: -42px;
  width: 80px;
  padding: 12px 10px 13px 35px;
  border: 1px solid rgba(75, 241, 226, 0.28);
  color: rgba(220, 236, 255, 0.54);
  background: rgba(4, 14, 35, 0.6);
  font: 700 7px/1.4 "Courier New", monospace;
  letter-spacing: 0.1em;
}

.surface-tag b {
  display: block;
  margin-top: 8px;
  color: var(--cyan);
  font-size: 15px;
}

.phone-wrap::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 520px;
  height: 520px;
  top: 30%;
  left: 50%;
  border: 1px solid rgba(75, 241, 226, 0.25);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 46px rgba(75, 241, 226, 0.025),
    0 0 0 47px rgba(75, 241, 226, 0.13),
    0 0 70px rgba(63, 208, 232, 0.13);
}

.phone {
  position: relative;
  width: min(410px, calc(100vw - 30px));
  padding: 24px 27px 34px;
  border: 2px solid #3f5058;
  border-radius: 46px 46px 68px 68px / 35px 35px 76px 76px;
  color: #202c31;
  background:
    linear-gradient(93deg, rgba(255, 255, 255, 0.65), transparent 13% 84%, rgba(39, 51, 57, 0.34)),
    linear-gradient(180deg, #e6e9e9 0%, #b7c0c3 53%, #7d8c92 100%);
  box-shadow:
    inset 0 2px 2px white,
    inset 0 -8px 13px rgba(24, 39, 46, 0.35),
    0 32px 60px rgba(0, 5, 16, 0.58),
    0 7px 0 #33434a;
}

body[data-game-state="running"] .phone {
  animation: device-live 4.2s ease-in-out infinite;
}

.phone::after {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 39px 39px 60px 60px / 29px 29px 68px 68px;
}

.phone-cap {
  position: relative;
  height: 31px;
  display: grid;
  place-items: center;
}

.earpiece {
  display: flex;
  gap: 4px;
  padding: 6px 15px;
  border-radius: 15px;
  background: #69777c;
  box-shadow: inset 0 2px 3px rgba(18, 29, 33, 0.54), 0 1px 0 white;
}

.earpiece i {
  width: 2px;
  height: 8px;
  border-radius: 2px;
  background: #26373e;
}

.front-camera {
  position: absolute;
  right: 14px;
  top: 6px;
  width: 10px;
  height: 10px;
  border: 2px solid #879399;
  border-radius: 50%;
  background: #253943;
  box-shadow: inset 0 0 3px #68a3ac;
}

.wordmark {
  padding: 1px 0 5px;
  color: #33464f;
  font: 900 12px/1 Arial, sans-serif;
  letter-spacing: 0.14em;
  text-align: center;
}

.screen-bezel {
  position: relative;
  padding: 9px;
  overflow: hidden;
  border: 2px solid #24363e;
  border-radius: 10px;
  background: #101d23;
  box-shadow:
    inset 0 0 8px #02070a,
    0 2px 1px rgba(255, 255, 255, 0.76),
    0 0 0 2px #68767b;
}

.screen-bezel::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 9px;
  pointer-events: none;
  opacity: 0;
  border: 1px solid rgba(157, 255, 133, 0.78);
  box-shadow:
    inset 0 0 18px rgba(75, 241, 226, 0.12),
    0 0 18px rgba(75, 241, 226, 0.16);
  transition: opacity 180ms ease;
}

body[data-visual="hd"] .screen-bezel {
  box-shadow:
    inset 0 0 10px #02070a,
    0 2px 1px rgba(255, 255, 255, 0.82),
    0 0 0 2px #68767b,
    0 0 28px rgba(75, 241, 226, 0.22);
}

body[data-visual="hd"] .screen-bezel::after {
  opacity: 1;
}

body[data-visual="hd"] .screen-glare {
  opacity: 0.72;
  background:
    repeating-linear-gradient(to bottom, transparent 0 3px, rgba(0, 3, 14, 0.022) 3px 4px),
    linear-gradient(122deg, rgba(255, 255, 255, 0.1), transparent 15% 76%, rgba(157, 255, 133, 0.08));
}

#gameCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
  background: #081738;
  touch-action: none;
}

.screen-glare {
  position: absolute;
  z-index: 2;
  inset: 9px;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, transparent 0 3px, rgba(0, 3, 14, 0.035) 3px 4px),
    linear-gradient(122deg, rgba(255, 255, 255, 0.14), transparent 17% 78%, rgba(69, 237, 230, 0.06));
}

.softkey-labels {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 25px 3px;
  color: #45555d;
  font: 700 8px/1 Arial, sans-serif;
}

.softkey-labels button {
  min-width: 70px;
  min-height: 24px;
  padding: 2px 6px;
  border: 0;
  border-bottom: 1px solid rgba(56, 76, 84, 0.42);
  cursor: pointer;
  color: #43555d;
  background: transparent;
  font: 800 8px/1 "Courier New", monospace;
  letter-spacing: 0.06em;
}

.softkey-labels button:hover,
.softkey-labels button:focus-visible {
  color: #086f73;
  border-bottom-color: #087e81;
}

.softkey-labels b {
  color: #087e81;
}

.nav-deck {
  display: grid;
  grid-template-columns: 1fr 1.55fr 1fr;
  align-items: center;
  gap: 13px;
  padding: 0 7px 13px;
}

.nav-side {
  display: grid;
  align-content: center;
  gap: 6px;
}

.nav-side .soft-key {
  width: 100%;
}

.hard-turn-key {
  display: none;
  color: #72590b;
}

.hard-turn-key small {
  display: block;
  margin-top: 2px;
  color: #087e81;
  font: 800 6px/1 "Courier New", monospace;
}

body[data-grid="hex"] .hard-turn-key {
  display: block;
  border-color: #aa8e25;
  background: linear-gradient(155deg, #fff8c8, #d4c06d 58%, #9b8635);
}

body[data-grid="hex"] [data-hard-turn].key-pressed {
  color: #4a3800;
  filter: brightness(0.82);
  box-shadow: inset 0 2px 4px rgba(66, 53, 7, 0.35), 0 1px 0 #71601f;
}

.soft-key,
.dpad-key,
.select-key,
.number-key {
  position: relative;
  border: 1px solid #65747a;
  cursor: pointer;
  color: #24343a;
  background: linear-gradient(155deg, #f8fafa, #bec7ca 58%, #8f9ba0);
  box-shadow:
    inset 1px 2px 2px rgba(255, 255, 255, 0.9),
    0 3px 0 #637178,
    0 5px 5px rgba(26, 39, 45, 0.38);
}

.number-key:not(button) {
  cursor: default;
}

.soft-key:active,
.number-key:active,
.soft-key.key-pressed,
.number-key.key-pressed {
  transform: translateY(2px);
  box-shadow: inset 0 2px 3px rgba(53, 67, 74, 0.28), 0 1px 0 #637178;
}

.soft-key {
  min-height: 36px;
  border-radius: 56% 44% 46% 54% / 65% 63% 37% 35%;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.view-key {
  display: grid;
  place-content: center;
  gap: 3px;
}

.view-key small {
  color: #087e81;
  font: 800 6px/1 "Courier New", monospace;
  letter-spacing: 0.08em;
}

.exit-key {
  color: #a51e35;
  font-size: 13px;
}

.dpad {
  position: relative;
  isolation: isolate;
  height: 83px;
  border: 1px solid #6c7a7f;
  border-radius: 48%;
  background: linear-gradient(145deg, #d9dfe1, #869399);
  box-shadow: inset 1px 2px 3px white, 0 4px 5px rgba(26, 39, 45, 0.4);
}

.dpad-key,
.select-key {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  font-size: 11px;
}

.dpad-key.up,
.dpad-key.down {
  width: 42px;
  height: 30px;
  left: 50%;
  transform: translateX(-50%);
}

.dpad-key.up { top: 1px; }
.dpad-key.down { bottom: 1px; }

.dpad-key.left,
.dpad-key.right {
  width: 40px;
  height: 40px;
  top: 50%;
  transform: translateY(-50%);
}

.dpad-key.left { left: 1px; }
.dpad-key.right { right: 1px; }

.select-key {
  width: 42px;
  height: 42px;
  top: 50%;
  left: 50%;
  border: 2px solid #5d6b70;
  border-radius: 50%;
  color: #405158;
  background: linear-gradient(145deg, #edf1f2, #8f9ca0);
  transform: translate(-50%, -50%);
  box-shadow: inset 1px 2px 2px white, 0 2px 2px rgba(24, 37, 42, 0.45);
}

.dpad-key:active,
.dpad-key.key-pressed {
  color: #05858a;
  filter: brightness(0.82);
}

.select-key:active,
.select-key.key-pressed {
  transform: translate(-50%, calc(-50% + 2px));
  box-shadow: inset 0 2px 3px rgba(53, 67, 74, 0.35), 0 1px 0 #637178;
}

.number-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px 13px;
}

.number-key {
  height: 42px;
  padding: 3px 8px;
  border-radius: 43% 43% 34% 34% / 52% 52% 32% 32%;
  text-align: left;
}

.number-key b {
  display: block;
  font-size: 15px;
  line-height: 15px;
}

.number-key span {
  display: block;
  margin-top: 2px;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

.control-key span {
  color: #17666a;
}

.mobile-help {
  display: none;
  margin: 25px 0 0;
  color: rgba(220, 236, 255, 0.68);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.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;
}

@media (max-width: 790px) {
  .stage {
    min-height: auto;
    padding:
      calc(25px + env(safe-area-inset-top))
      calc(15px + env(safe-area-inset-right))
      calc(48px + env(safe-area-inset-bottom))
      calc(15px + env(safe-area-inset-left));
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 25px;
  }

  .intro {
    width: min(410px, 100%);
    text-align: center;
  }

  .onsite-return {
    justify-content: center;
    margin-bottom: 23px;
  }

  .archive-kicker {
    justify-content: center;
  }

  .archive-kicker > span {
    display: none;
  }

  .system-label {
    margin-bottom: 11px;
  }

  h1 {
    font-size: clamp(62px, 20vw, 92px);
    line-height: 0.85;
  }

  .title-lockup {
    margin-inline: auto;
  }

  .title-trail {
    justify-content: center;
    margin-inline: auto;
  }

  .title-trail::after {
    display: none;
  }

  .intro-copy,
  .desktop-help,
  .archive-note {
    display: none;
  }

  .firmware-select {
    width: min(410px, 100%);
    margin: 0 auto 12px;
    text-align: left;
  }

  .stage-select {
    width: min(410px, 100%);
    margin: 0 auto 12px;
    text-align: left;
  }

  .playfield-key {
    justify-content: center;
    margin-top: 12px;
  }

  .launch-console {
    width: min(410px, 100%);
    margin: 0 auto;
  }

  .surface-tag {
    display: none;
  }

  .phone-wrap::before {
    width: 380px;
    height: 380px;
  }

  .mobile-help {
    display: block;
  }

  .nav-deck {
    grid-template-columns: minmax(44px, 1fr) minmax(136px, 1.55fr) minmax(44px, 1fr);
  }

  .soft-key,
  .number-key {
    min-height: 44px;
  }

  .softkey-labels button {
    min-height: 32px;
  }

  .dpad {
    min-width: 136px;
    height: 136px;
  }

  .dpad-key.up,
  .dpad-key.down,
  .dpad-key.left,
  .dpad-key.right,
  .select-key {
    width: 44px;
    height: 44px;
  }

  body:not([data-game-state="idle"]) .stage {
    min-height: 100dvh;
    padding:
      calc(6px + env(safe-area-inset-top))
      calc(5px + env(safe-area-inset-right))
      calc(6px + env(safe-area-inset-bottom))
      calc(5px + env(safe-area-inset-left));
    align-items: start;
    gap: 0;
  }

  body:not([data-game-state="idle"]) .intro,
  body:not([data-game-state="idle"]) .ambient-snake,
  body:not([data-game-state="idle"]) .phone-wrap::before,
  body:not([data-game-state="idle"]) .mobile-help,
  body:not([data-game-state="idle"]) .number-pad {
    display: none;
  }

  body:not([data-game-state="idle"]) .phone-wrap {
    width: 100%;
  }

  body:not([data-game-state="idle"]) .phone {
    width: min(386px, calc(100vw - 10px));
    padding: 8px 14px 12px;
    border-radius: 30px 30px 38px 38px / 25px 25px 43px 43px;
    animation: none;
  }

  body:not([data-game-state="idle"]) .phone::after {
    inset: 4px;
    border-radius: 25px 25px 34px 34px / 21px 21px 39px 39px;
  }

  body:not([data-game-state="idle"]) .phone-cap {
    height: 20px;
  }

  body:not([data-game-state="idle"]) .earpiece {
    padding: 4px 12px;
  }

  body:not([data-game-state="idle"]) .earpiece i {
    height: 6px;
  }

  body:not([data-game-state="idle"]) .front-camera {
    top: 3px;
  }

  body:not([data-game-state="idle"]) .wordmark {
    padding-bottom: 3px;
    font-size: 10px;
  }

  body:not([data-game-state="idle"]) .screen-bezel {
    padding: 5px;
  }

  body:not([data-game-state="idle"]) .screen-glare {
    inset: 5px;
  }

  body:not([data-game-state="idle"]) .screen-bezel::after {
    inset: 5px;
  }

  body:not([data-game-state="idle"]) .softkey-labels {
    padding: 5px 24px 1px;
  }

  body:not([data-game-state="idle"]) .nav-deck {
    grid-template-columns: minmax(44px, 1fr) minmax(132px, 1.45fr) minmax(44px, 1fr);
    gap: 9px;
    padding: 2px 4px 2px;
  }

  body:not([data-game-state="idle"]) .dpad {
    min-width: 136px;
    height: 132px;
  }

  body:not([data-game-state="idle"]) .dpad-key.up,
  body:not([data-game-state="idle"]) .dpad-key.down {
    width: 44px;
    height: 44px;
  }

  body:not([data-game-state="idle"]) .dpad-key.left,
  body:not([data-game-state="idle"]) .dpad-key.right,
  body:not([data-game-state="idle"]) .select-key {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 430px) {
  .launch-console {
    grid-template-columns: 1fr;
  }

  .firmware-select__options {
    grid-template-columns: 1fr;
  }

  .firmware-option {
    border-right: 0;
    border-bottom: 1px solid rgba(75, 241, 226, 0.18);
  }

  .firmware-option:last-child {
    border-bottom: 0;
  }

  .stage-option {
    padding-inline: 7px;
  }

  .stage-select__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stage-option span {
    grid-template-columns: 23px minmax(0, 1fr);
    gap: 4px;
  }

  .stage-option b {
    font-size: 13px;
  }

  .live-readout {
    min-height: 48px;
  }

  .archive-slot {
    grid-template-columns: 1fr;
  }

  .archive-slot__scores {
    border-top: 1px solid rgba(75, 241, 226, 0.16);
    border-left: 0;
  }

  .archive-slot ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 1px;
  }

  .archive-slot li {
    grid-template-columns: 22px 1fr;
    gap: 3px 5px;
    padding-left: 9px;
  }

  .archive-slot li b {
    font-size: 9px;
  }

  .archive-slot li small {
    grid-column: 1 / -1;
    font-size: 7px;
  }

  .ambient-snake {
    left: 50%;
    opacity: 0.1;
    transform: translate(-50%, -50%) rotate(-11deg) scale(0.72);
  }

  .phone {
    padding: 19px 21px 29px;
    border-radius: 39px 39px 55px 55px / 31px 31px 62px 62px;
  }

  .phone-cap {
    height: 25px;
  }

  .nav-deck {
    gap: 10px;
  }

  .number-pad {
    gap: 8px 11px;
  }
}

@media (max-width: 360px) {
  .ambient-snake {
    display: none;
  }

  .phone-wrap::before {
    width: 318px;
    height: 318px;
  }
}

@media (min-width: 791px) and (max-height: 850px) {
  body:not([data-game-state="idle"]) .stage {
    padding-block: 10px;
    grid-template-columns: 1fr;
    justify-items: center;
  }

  body:not([data-game-state="idle"]) .intro,
  body:not([data-game-state="idle"]) .surface-tag,
  body:not([data-game-state="idle"]) .number-pad,
  body:not([data-game-state="idle"]) .mobile-help {
    display: none;
  }

  body:not([data-game-state="idle"]) .phone {
    width: min(360px, calc(100vw - 30px));
    padding: 16px 22px 20px;
    animation: none;
  }
}

@keyframes snake-signal {
  0%, 100% { opacity: 0.34; transform: scale(0.84); }
  45% { opacity: 1; transform: scale(1); }
}

@keyframes status-blink {
  0%, 62% { opacity: 1; }
  63%, 100% { opacity: 0.36; }
}

@keyframes device-live {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

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