/* =========================================================
   TANK BATTLE — arcade cabinet UI
   ========================================================= */

:root {
  --ink-0: #030708;
  --ink-1: #050d10;
  --ink-2: #08151a;
  --ink-3: #0c1c22;
  --panel: #0a171c;
  --line: rgba(127, 219, 238, 0.14);
  --line-strong: rgba(127, 219, 238, 0.3);
  --text: #e2f3f5;
  --muted: #6f9098;
  --muted-bright: #9bb7be;
  --amber: #ffc857;
  --amber-hot: #ff9f1c;
  --amber-deep: #d97b13;
  --cyan: #61e8ff;
  --cyan-dim: #2da7bd;
  --red: #ff5f6d;
  --green: #6ef3a5;
  --font-ui: "Bahnschrift", "DIN Alternate", "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-mono: "Consolas", "SFMono-Regular", "Cascadia Mono", "Courier New", monospace;
  --shadow-deep: 0 34px 90px rgba(0, 0, 0, 0.62);
  --arcade-width: min(92vw, 860px, calc(100vh - 250px));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink-0);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  font-family: var(--font-ui);
  background:
    radial-gradient(120% 80% at 50% -20%, rgba(29, 78, 86, 0.3) 0%, transparent 58%),
    linear-gradient(180deg, #050c0f 0%, #030809 46%, #020506 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
  touch-action: manipulation;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.35em;
  padding: 0.1em 0.36em;
  border: 1px solid rgba(182, 230, 237, 0.22);
  border-bottom-color: rgba(182, 230, 237, 0.38);
  border-radius: 4px;
  color: #cfe8ec;
  background: rgba(1, 8, 10, 0.45);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.5);
  font-family: var(--font-mono);
  font-size: 0.66em;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* ---------- background atmosphere ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient__grid {
  position: absolute;
  inset: -40% -20% -30%;
  background-image:
    linear-gradient(rgba(100, 218, 233, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 218, 233, 0.055) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 55% 48% at 50% 46%, #000 0%, transparent 76%);
  transform: perspective(680px) rotateX(61deg) scale(1.65);
  transform-origin: 50% 55%;
  opacity: 0.8;
}

.ambient__glow {
  position: absolute;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.12;
}

.ambient__glow--cyan {
  top: 14%;
  left: -19%;
  background: var(--cyan);
}

.ambient__glow--amber {
  right: -18%;
  bottom: -8%;
  background: var(--amber-hot);
  opacity: 0.085;
}

.ambient__noise {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

/* ---------- page shell ---------- */

.page {
  width: var(--arcade-width);
  margin-inline: auto;
  padding:
    max(clamp(14px, 2.4vh, 26px), env(safe-area-inset-top, 0px))
    0
    max(22px, env(safe-area-inset-bottom, 0px));
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(12px, 1.9vh, 20px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand__mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 200, 87, 0.32);
  border-radius: 10px;
  color: var(--amber);
  background:
    linear-gradient(145deg, rgba(255, 200, 87, 0.12), transparent 50%),
    #071115;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 24px rgba(255, 174, 51, 0.08);
}

.brand__mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(255, 200, 87, 0.12);
  border-radius: 6px;
}

.brand__mark svg {
  width: 25px;
  height: 25px;
  filter: drop-shadow(0 0 7px rgba(255, 200, 87, 0.35));
}

.brand__copy {
  min-width: 0;
}

.brand__eyebrow,
.brand__title,
.footer,
.deck,
.hud__label {
  font-family: var(--font-mono);
}

.brand__eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.22em;
  white-space: nowrap;
}

.brand__title {
  margin: 0;
  color: #e6f4f6;
  font-family: var(--font-ui);
  font-size: clamp(15px, 1.7vw, 18px);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
}

.brand__title span {
  margin-left: 7px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.63em;
  font-weight: 700;
  letter-spacing: 0.13em;
  vertical-align: 2px;
}

.masthead__actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.tool-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted-bright);
  background: rgba(8, 20, 24, 0.72);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.tool-button:hover:not(:disabled) {
  color: var(--amber);
  border-color: rgba(255, 200, 87, 0.32);
  background: rgba(255, 200, 87, 0.07);
}

.tool-button:active:not(:disabled) {
  transform: translateY(1px);
}

.tool-button:disabled {
  opacity: 0.34;
  cursor: default;
}

.tool-button .icon {
  width: 18px;
  height: 18px;
}

.tool-button .icon--sound-off,
.tool-button .icon--play {
  display: none;
}

.tool-button.is-muted .icon--sound-on {
  display: none;
}

.tool-button.is-muted .icon--sound-off {
  display: block;
}

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

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

/* ---------- cabinet ---------- */

.arcade {
  position: relative;
}

.cabinet {
  position: relative;
  padding: clamp(7px, 1vw, 12px);
  border: 1px solid rgba(136, 211, 225, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 16%),
    linear-gradient(145deg, #0e1d22 0%, #071216 38%, #050b0e 100%);
  box-shadow:
    var(--shadow-deep),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(0, 0, 0, 0.45);
}

.cabinet::before,
.cabinet::after {
  content: "";
  position: absolute;
  z-index: 2;
  width: 8px;
  height: 8px;
  border-color: rgba(255, 200, 87, 0.55);
  pointer-events: none;
}

.cabinet::before {
  top: 5px;
  left: 5px;
  border-top: 1px solid;
  border-left: 1px solid;
  border-top-left-radius: 3px;
}

.cabinet::after {
  right: 5px;
  bottom: 5px;
  border-right: 1px solid;
  border-bottom: 1px solid;
  border-bottom-right-radius: 3px;
}

/* ---------- HUD ---------- */

.hud {
  display: grid;
  grid-template-columns: minmax(76px, 1.1fr) minmax(76px, 1.1fr) minmax(62px, 0.9fr) minmax(58px, 0.72fr) minmax(66px, 0.8fr) minmax(58px, 0.7fr);
  align-items: stretch;
  gap: 8px;
  padding: 8px clamp(8px, 1.2vw, 14px) 10px;
}

.hud__block {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 2px 2px 2px clamp(8px, 1.2vw, 12px);
}

.hud__block + .hud__block::before {
  content: "";
  position: absolute;
  top: 10%;
  bottom: 10%;
  left: 0;
  width: 1px;
  background: linear-gradient(transparent, var(--line-strong), transparent);
}

.hud__label {
  display: block;
  color: var(--muted);
  font-size: clamp(6px, 0.72vw, 8px);
  font-weight: 700;
  letter-spacing: 0.17em;
  line-height: 1;
  white-space: nowrap;
}

.hud__number {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.8vw, 19px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  line-height: 1.06;
  white-space: nowrap;
  text-shadow: 0 0 14px rgba(97, 232, 255, 0.12);
}

.hud__number--hi {
  color: var(--amber);
  text-shadow: 0 0 14px rgba(255, 200, 87, 0.13);
}

.stage-readout {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
}

.stage-readout small {
  overflow: hidden;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: clamp(6px, 0.67vw, 7.5px);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.power-meter {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 15px;
}

.power-meter i {
  display: block;
  width: clamp(9px, 1.1vw, 13px);
  height: 5px;
  border: 1px solid rgba(255, 200, 87, 0.2);
  border-radius: 1px;
  background: rgba(255, 200, 87, 0.05);
  transition: background 180ms ease, box-shadow 180ms ease;
}

.power-meter i.is-on {
  border-color: var(--amber);
  background: var(--amber);
  box-shadow: 0 0 9px rgba(255, 200, 87, 0.55);
}

.lives {
  display: flex;
  min-height: 15px;
  align-items: center;
  gap: 4px;
}

.life-tank {
  display: block;
  width: clamp(12px, 1.45vw, 16px);
  height: auto;
  color: var(--amber);
  filter: drop-shadow(0 0 4px rgba(255, 200, 87, 0.24));
}

.life-extra {
  color: var(--muted-bright);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.enemy-readout {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 15px;
}

.enemy-readout strong {
  min-width: 1.6em;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.5vw, 16px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 95, 109, 0.2);
}

.enemy-meter {
  position: relative;
  display: block;
  width: 100%;
  min-width: 20px;
  height: 4px;
  overflow: hidden;
  border-radius: 1px;
  background: rgba(255, 95, 109, 0.12);
}

.enemy-meter i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber-hot), var(--red));
  box-shadow: 0 0 8px rgba(255, 95, 109, 0.35);
  transform-origin: left;
  transition: width 200ms ease;
}

/* ---------- screen ---------- */

.screen-frame {
  position: relative;
  padding: clamp(5px, 0.8vw, 8px);
  border: 1px solid rgba(121, 204, 219, 0.18);
  border-radius: 12px;
  background: #020607;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.8),
    inset 0 0 32px rgba(0, 0, 0, 0.7),
    0 12px 40px rgba(0, 0, 0, 0.3);
}

.screen-frame::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: -1px;
  left: 14%;
  width: 26%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(97, 232, 255, 0.55), transparent);
  pointer-events: none;
}

.screen {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 7px;
  background: #040b0d;
  container-type: inline-size;
  isolation: isolate;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  background: #040b0d;
  image-rendering: auto;
}

.screen-fx {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.screen-fx--scanlines {
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.19) 0,
    rgba(0, 0, 0, 0.19) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

.screen-fx--vignette {
  border-radius: inherit;
  box-shadow:
    inset 0 0 70px 12px rgba(0, 0, 0, 0.55),
    inset 0 0 2px 1px rgba(140, 230, 240, 0.08);
  background: radial-gradient(ellipse at center, transparent 54%, rgba(0, 4, 6, 0.28) 100%);
}

.screen-fx--glare {
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0.055) 0%, transparent 19%, transparent 76%, rgba(255, 255, 255, 0.018) 100%);
  opacity: 0.7;
}

/* ---------- overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 4cqw, 42px);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(5, 17, 20, 0.55), rgba(1, 5, 6, 0.91)),
    repeating-linear-gradient(0deg, transparent 0 12px, rgba(105, 220, 236, 0.018) 12px 13px);
  transition: opacity 240ms ease, visibility 240ms ease;
}

.overlay.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.overlay--title {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(14, 39, 44, 0.55), rgba(1, 6, 8, 0.93) 72%),
    linear-gradient(0deg, rgba(255, 200, 87, 0.03), transparent 50%);
}

.title-panel {
  display: flex;
  width: min(100%, 620px);
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: title-in 620ms cubic-bezier(0.18, 0.85, 0.25, 1) both;
}

@keyframes title-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.title-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 clamp(10px, 2cqw, 20px);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: clamp(6px, 1.15cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.title-kicker span {
  width: clamp(16px, 4cqw, 38px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(97, 232, 255, 0.6));
}

.title-kicker span:last-child {
  transform: scaleX(-1);
}

.title-zh {
  position: relative;
  margin: 0;
  color: #f0fafb;
  font-family: var(--font-ui);
  font-size: clamp(42px, 11.5cqw, 92px);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 0.98;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.35),
    0 0 45px rgba(255, 255, 255, 0.08);
}

.title-zh span {
  color: var(--amber);
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.35),
    0 0 36px rgba(255, 200, 87, 0.2);
}

.title-zh::after {
  content: "";
  position: absolute;
  right: -4%;
  bottom: 8%;
  width: 15%;
  height: 3%;
  background: rgba(97, 232, 255, 0.8);
  box-shadow: 0 0 16px rgba(97, 232, 255, 0.5);
  transform: skewX(-28deg);
}

.title-en {
  margin: clamp(7px, 1.4cqw, 14px) 0 0;
  color: rgba(205, 232, 236, 0.78);
  font-family: var(--font-mono);
  font-size: clamp(10px, 2.15cqw, 18px);
  font-weight: 700;
  letter-spacing: 0.56em;
  text-indent: 0.56em;
  line-height: 1;
}

.title-en em {
  color: var(--amber);
  font-style: normal;
}

.title-desc {
  margin: clamp(12px, 2.4cqw, 22px) 0 clamp(16px, 3cqw, 28px);
  color: var(--muted-bright);
  font-size: clamp(10px, 1.55cqw, 14px);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.6;
}

.button {
  position: relative;
  display: inline-flex;
  min-height: clamp(38px, 6.4cqw, 50px);
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.7cqw, 14px);
  padding: 0 clamp(16px, 3.2cqw, 26px);
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: clamp(11px, 1.6cqw, 15px);
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button kbd {
  margin-left: 2px;
  border-color: rgba(10, 26, 22, 0.25);
  color: rgba(11, 29, 23, 0.7);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

.button--primary {
  color: #172210;
  background: linear-gradient(180deg, #ffe28b 0%, var(--amber) 52%, #eda22a 100%);
  box-shadow:
    0 5px 0 #9f5f10,
    0 12px 30px rgba(255, 171, 41, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.button--primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow:
    0 6px 0 #9f5f10,
    0 16px 38px rgba(255, 171, 41, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.button--primary:active {
  transform: translateY(3px);
  box-shadow:
    0 2px 0 #9f5f10,
    0 6px 16px rgba(255, 171, 41, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.button--ghost {
  border-color: rgba(159, 194, 200, 0.18);
  color: var(--muted-bright);
  background: rgba(3, 12, 14, 0.5);
}

.button--ghost:hover {
  border-color: rgba(97, 232, 255, 0.3);
  color: var(--cyan);
}

.title-meta {
  display: flex;
  margin-top: clamp(16px, 3cqw, 26px);
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 4cqw, 30px);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: clamp(7px, 1.15cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.title-meta span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.title-meta b {
  color: var(--amber);
  font-size: 1.35em;
  font-weight: 700;
}

.title-hints {
  display: flex;
  margin-top: clamp(10px, 2cqw, 18px);
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  color: rgba(142, 174, 180, 0.7);
  font-family: var(--font-mono);
  font-size: clamp(6.5px, 1.02cqw, 9px);
  letter-spacing: 0.04em;
}

.title-hints span {
  white-space: nowrap;
}

.title-hints kbd {
  color: rgba(196, 226, 231, 0.78);
  font-size: 1em;
}

/* pause / results */

.dialog {
  position: relative;
  display: flex;
  width: min(100%, 440px);
  flex-direction: column;
  align-items: stretch;
  padding: clamp(18px, 4.4cqw, 34px);
  border: 1px solid rgba(151, 213, 225, 0.15);
  border-radius: 10px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), transparent 30%),
    rgba(4, 14, 17, 0.92);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
  animation: dialog-in 260ms ease both;
}

.dialog::before,
.dialog::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border-color: var(--amber);
  opacity: 0.65;
}

.dialog::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.dialog::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(5px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dialog__kicker {
  margin: 0 0 clamp(6px, 1.4cqw, 10px);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: clamp(6.5px, 1.05cqw, 9px);
  font-weight: 700;
  letter-spacing: 0.3em;
}

.dialog__title {
  margin: 0 0 clamp(8px, 1.8cqw, 14px);
  color: var(--text);
  font-size: clamp(27px, 5.5cqw, 46px);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.05;
}

.dialog--over .dialog__title {
  color: var(--red);
  text-shadow: 0 0 32px rgba(255, 95, 109, 0.22);
}

.dialog__copy {
  margin: 0 0 clamp(14px, 2.8cqw, 22px);
  color: var(--muted-bright);
  font-size: clamp(9px, 1.3cqw, 12px);
  letter-spacing: 0.06em;
  line-height: 1.6;
}

.dialog .button {
  width: 100%;
}

.dialog .button + .button {
  margin-top: 8px;
}

.result-grid {
  display: grid;
  margin: 0 0 clamp(16px, 3cqw, 22px);
  grid-template-columns: 1fr auto;
  gap: 7px 18px;
  padding: clamp(10px, 2cqw, 15px) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.result-grid span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: clamp(7px, 1.02cqw, 9px);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.result-grid strong {
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: clamp(9px, 1.32cqw, 12px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-align: right;
}

.dialog__foot {
  margin: clamp(10px, 1.8cqw, 14px) 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: clamp(6.5px, 1cqw, 8px);
  font-weight: 700;
  letter-spacing: 0.15em;
}

/* stage intro */

.stage-banner {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text);
  background: linear-gradient(180deg, transparent 30%, rgba(1, 7, 9, 0.64) 50%, transparent 70%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.stage-banner.is-visible {
  visibility: visible;
  animation: stage-in 2.25s ease both;
}

.stage-banner__kicker,
.stage-banner__ready {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: clamp(6px, 1.2cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
}

.stage-banner__stage {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(21px, 4.4cqw, 38px);
  font-weight: 900;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  text-shadow: 0 0 28px rgba(97, 232, 255, 0.2);
}

.stage-banner__name {
  color: var(--amber);
  font-size: clamp(11px, 2cqw, 17px);
  font-weight: 700;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
}

.stage-banner__ready {
  margin-top: 9px;
  color: var(--amber);
  animation: blink-soft 700ms steps(2, end) infinite;
}

@keyframes stage-in {
  0% {
    opacity: 0;
    transform: translateX(-10px);
    filter: blur(3px);
  }
  10% {
    opacity: 1;
    transform: translateX(3px);
    filter: blur(0);
  }
  15% {
    transform: translateX(0);
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-5px);
  }
}

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

/* power-up toast */

.toast {
  position: absolute;
  z-index: 7;
  top: clamp(12px, 2.5cqw, 20px);
  left: 50%;
  display: flex;
  min-width: 150px;
  max-width: calc(100% - 40px);
  align-items: center;
  gap: 10px;
  padding: 8px clamp(12px, 2.4cqw, 18px);
  border: 1px solid color-mix(in srgb, var(--toast-color, var(--amber)) 45%, transparent);
  border-radius: 7px;
  color: var(--text);
  background: rgba(2, 10, 12, 0.9);
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 200ms ease, transform 200ms ease;
  backdrop-filter: blur(8px);
}

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

.toast__glyph {
  display: grid;
  width: clamp(22px, 3.2cqw, 27px);
  height: clamp(22px, 3.2cqw, 27px);
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--toast-color, var(--amber)) 50%, transparent);
  border-radius: 4px;
  color: var(--toast-color, var(--amber));
  background: color-mix(in srgb, var(--toast-color, var(--amber)) 11%, transparent);
  font-size: clamp(12px, 1.8cqw, 16px);
  font-weight: 900;
  line-height: 1;
}

.toast__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.toast__copy strong {
  overflow: hidden;
  color: var(--toast-color, var(--amber));
  font-size: clamp(9px, 1.3cqw, 12px);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast__copy span {
  overflow: hidden;
  color: var(--muted-bright);
  font-family: var(--font-mono);
  font-size: clamp(6px, 0.9cqw, 8px);
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- cabinet deck ---------- */

.deck {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px clamp(8px, 1.2vw, 14px) 1px;
  color: var(--muted);
  font-size: clamp(6.5px, 0.8vw, 8px);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.deck__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.deck__legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.deck__legend kbd {
  font-size: 0.9em;
  color: var(--muted-bright);
}

.deck__status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--green);
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.status-led {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: led-pulse 2.4s ease-in-out infinite;
}

.deck__status[data-tone="idle"] {
  color: var(--muted);
}

.deck__status[data-tone="pause"] {
  color: var(--amber);
}

.deck__status[data-tone="over"] {
  color: var(--red);
}

.deck__status[data-tone="clear"] {
  color: var(--cyan);
}

@keyframes led-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.38;
  }
}

/* ---------- touch controls ---------- */

.touch-controls {
  display: none;
  margin-top: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(6px, 3vw, 22px);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, clamp(42px, 13vw, 56px));
  grid-template-rows: repeat(3, clamp(42px, 13vw, 56px));
  gap: 5px;
  transform: rotate(0deg);
}

.dpad__key,
.dpad__hub {
  position: relative;
  border-radius: 9px;
}

.dpad__key {
  border: 1px solid rgba(154, 210, 220, 0.19);
  color: var(--muted-bright);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    #0a171b;
  box-shadow:
    0 4px 0 #020708,
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  cursor: pointer;
  touch-action: none;
}

.dpad__key:active,
.dpad__key.is-active {
  color: var(--amber);
  border-color: rgba(255, 200, 87, 0.45);
  background: #15201c;
  box-shadow:
    0 1px 0 #020708,
    inset 0 0 18px rgba(255, 200, 87, 0.12);
  transform: translateY(3px);
}

.dpad__key span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-right: 6px solid transparent;
  border-bottom: 8px solid currentColor;
  border-left: 6px solid transparent;
  transform: translate(-50%, -55%);
}

.dpad__key--up {
  grid-column: 2;
  grid-row: 1;
}

.dpad__key--left {
  grid-column: 1;
  grid-row: 2;
}

.dpad__key--left span {
  transform: translate(-50%, -50%) rotate(-90deg);
}

.dpad__key--right {
  grid-column: 3;
  grid-row: 2;
}

.dpad__key--right span {
  transform: translate(-50%, -50%) rotate(90deg);
}

.dpad__key--down {
  grid-column: 2;
  grid-row: 3;
}

.dpad__key--down span {
  transform: translate(-50%, -50%) rotate(180deg);
}

.dpad__hub {
  grid-column: 2;
  grid-row: 2;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 200, 87, 0.18), transparent 60%),
    #081216;
  border: 1px solid rgba(120, 192, 201, 0.11);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.6);
}

.dpad__hub::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 200, 87, 0.4);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.fire-button {
  position: relative;
  display: grid;
  width: clamp(78px, 23vw, 96px);
  height: clamp(78px, 23vw, 96px);
  place-items: center;
  border: 1px solid rgba(255, 95, 109, 0.58);
  border-radius: 50%;
  color: #ffe4e6;
  background:
    radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.18), transparent 28%),
    radial-gradient(circle at 50% 55%, #d83343, #6d0c17 72%);
  box-shadow:
    0 7px 0 #3d040a,
    0 13px 26px rgba(0, 0, 0, 0.34),
    inset 0 2px 0 rgba(255, 255, 255, 0.15);
  font-family: var(--font-mono);
  font-size: clamp(11px, 3.2vw, 14px);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  touch-action: none;
}

.fire-button::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px dashed rgba(255, 222, 225, 0.23);
  border-radius: 50%;
}

.fire-button:active,
.fire-button.is-active {
  transform: translateY(5px);
  box-shadow:
    0 2px 0 #3d040a,
    0 5px 12px rgba(0, 0, 0, 0.32),
    inset 0 2px 18px rgba(0, 0, 0, 0.28);
}

/* ---------- footer ---------- */

.footer {
  display: flex;
  margin-top: 15px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(111, 144, 152, 0.65);
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
}

.footer__divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 200, 87, 0.45);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  :root {
    --arcade-width: min(94vw, calc(100vh - 235px), 820px);
  }
}

@media (max-width: 680px) {
  :root {
    --arcade-width: 94vw;
  }

  .page {
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }

  .masthead {
    margin-bottom: 10px;
  }

  .brand__mark {
    width: 35px;
    height: 35px;
    border-radius: 8px;
  }

  .brand__mark svg {
    width: 21px;
    height: 21px;
  }

  .brand__eyebrow {
    font-size: 6.5px;
  }

  .brand__title {
    font-size: 14px;
  }

  .brand__title span {
    display: none;
  }

  .tool-button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .tool-button .icon {
    width: 16px;
    height: 16px;
  }

  .hud {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px 8px;
    padding: 9px 7px 10px;
  }

  .hud__block {
    padding-left: 8px;
    gap: 3px;
  }

  .hud__block + .hud__block::before {
    top: 16%;
    bottom: 16%;
  }

  .hud__block:nth-child(4)::before {
    display: none;
  }

  .hud__block--stage {
    grid-column: 3;
    grid-row: 1;
  }

  .hud__block--power {
    grid-column: 1;
    grid-row: 2;
  }

  .hud__block--lives {
    grid-column: 2;
    grid-row: 2;
  }

  .hud__block--enemy {
    grid-column: 3;
    grid-row: 2;
  }

  .hud__label {
    font-size: 6.5px;
  }

  .hud__number {
    font-size: clamp(13px, 4vw, 17px);
  }

  .stage-readout {
    align-items: center;
  }

  .stage-readout small {
    font-size: 6px;
  }

  .deck {
    min-height: 32px;
    padding-inline: 4px;
    font-size: 6px;
  }

  .deck__legend {
    display: none;
  }

  .deck__status {
    width: 100%;
    justify-content: center;
  }

  .footer {
    margin-top: 11px;
    font-size: 6px;
    letter-spacing: 0.08em;
  }

  .footer span:not(.footer__divider) {
    max-width: 46%;
  }
}

@media (max-width: 430px) {
  .title-desc {
    margin-top: 10px;
    margin-bottom: 14px;
  }

  .title-meta {
    margin-top: 13px;
    gap: 15px;
  }

  .title-hints {
    display: none;
  }

  .overlay {
    padding: 16px;
  }

  .dialog {
    padding: 20px 18px;
  }
}

/* Show the D-pad on touch-first devices and compact layouts. */
@media (pointer: coarse) {
  .touch-controls {
    display: flex;
  }

  .deck__legend {
    display: none;
  }

  .deck {
    justify-content: center;
  }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  .masthead,
  .footer {
    display: none;
  }

  :root {
    --arcade-width: min(66vw, 88vh);
  }

  .page {
    padding-top: 8px;
  }

  .touch-controls {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    justify-content: space-between;
    padding: 10px 18px max(10px, env(safe-area-inset-bottom));
    background: linear-gradient(0deg, rgba(2, 7, 8, 0.94), transparent);
    pointer-events: none;
  }

  .touch-controls > * {
    pointer-events: auto;
  }

  .dpad {
    grid-template-columns: repeat(3, 38px);
    grid-template-rows: repeat(3, 38px);
  }

  .fire-button {
    width: 74px;
    height: 74px;
  }
}

@media (max-height: 760px) and (min-width: 681px) {
  .title-hints,
  .title-meta {
    display: none;
  }

  .title-desc {
    margin-bottom: 16px;
  }
}

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