@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/press-start-2p.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "VT323";
  src: url("fonts/vt323.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000000;
  --gold: #ffd700;
  --purple: #9b59b6;
  --cyan: #00ffff;
  --navy: #0a0a2e;
  --lime: #39ff14;
  --red: #ff073a;
  --white: #ffffff;
  --dim: #67789e;
  --pixel: "Press Start 2P", "Courier New", monospace;
  --term: "VT323", "Courier New", monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--white);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--pixel);
  touch-action: manipulation;
  background:
    radial-gradient(circle at 50% 35%, #06122a 0%, #02040c 45%, #000 100%);
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
  background: #000;
}

.fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}
.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.24) 0px,
    rgba(0, 0, 0, 0.24) 1px,
    rgba(0, 0, 0, 0) 1px,
    rgba(0, 0, 0, 0) 3px
  );
  opacity: 0.95;
}
.scanlines::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -160px;
  height: 150px;
  background: linear-gradient(
    to bottom,
    rgba(170, 255, 255, 0) 0%,
    rgba(170, 255, 255, 0.05) 50%,
    rgba(170, 255, 255, 0) 100%
  );
  animation: scanSweep 5.5s linear infinite;
}
@keyframes scanSweep {
  0% { top: -160px; }
  100% { top: 100%; }
}
.glow-edge {
  position: absolute;
  inset: 0;
  box-shadow:
    inset 0 0 92px rgba(0, 255, 255, 0.07),
    inset 0 0 32px rgba(155, 89, 182, 0.09),
    inset 0 0 7px rgba(0, 255, 255, 0.16);
}
.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 44%, rgba(0, 0, 0, 0.7) 100%);
}
.flicker {
  position: absolute;
  inset: 0;
  background: #b9f6ff;
  opacity: 0.012;
  animation: flick 5.5s steps(2, end) infinite;
}
@keyframes flick {
  0%, 92%, 100% { opacity: 0.01; }
  93% { opacity: 0.035; }
  94% { opacity: 0.008; }
  96% { opacity: 0.03; }
}

.flash {
  position: fixed;
  inset: 0;
  background: var(--red);
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  mix-blend-mode: screen;
  transition: opacity 0.16s ease-out;
}


.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: none;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  padding:
    calc(8px + var(--safe-t))
    calc(12px + var(--safe-r))
    0
    calc(12px + var(--safe-l));
  pointer-events: none;
  font-family: var(--pixel);
  text-shadow: 0 0 9px rgba(0, 255, 255, 0.7), 0 0 26px rgba(0, 255, 255, 0.3);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
  padding-bottom: 18px;
}
.hud.on { display: grid; }
.hud-cell { min-width: 0; }
.hud-left { justify-self: start; }
.hud-mid { justify-self: center; text-align: center; }
.hud-right {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.hud-label {
  font-size: clamp(6px, 0.9vw, 9px);
  letter-spacing: 1px;
  color: var(--cyan);
  opacity: 0.85;
}
.hud-score {
  font-size: clamp(14px, 2.3vw, 26px);
  color: var(--gold);
  line-height: 1.25;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.75), 0 0 22px rgba(255, 215, 0, 0.35);
  font-variant-numeric: tabular-nums;
}
.hud-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.mult {
  font-size: clamp(7px, 1vw, 11px);
  color: var(--lime);
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.7);
}
.size-meter {
  display: block;
  width: clamp(38px, 5vw, 74px);
  height: 5px;
  border: 1px solid rgba(0, 255, 255, 0.45);
  background: rgba(0, 20, 30, 0.65);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}
.size-meter i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--lime));
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.8);
  transition: width 0.15s ease-out;
}
.hud-level {
  font-size: clamp(14px, 2.1vw, 24px);
  color: var(--white);
  line-height: 1.2;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.75);
}
.hud-max {
  font-size: 0.48em;
  color: var(--dim);
}
.pips {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 4px;
}
.pips i {
  display: block;
  width: clamp(7px, 1vw, 12px);
  height: clamp(7px, 1vw, 12px);
  border: 1px solid rgba(0, 255, 255, 0.35);
  background: rgba(0, 20, 30, 0.7);
}
.pips i.on {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.9);
}
.lives {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-right: 2px;
}
.life {
  width: clamp(9px, 1.3vw, 15px);
  height: clamp(9px, 1.3vw, 15px);
  border-radius: 50%;
  background: conic-gradient(from 25deg, rgba(0, 0, 0, 0) 0deg 52deg, var(--gold) 52deg 360deg);
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
}
.life.lost {
  background: rgba(255, 255, 255, 0.09);
  filter: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.icon-btn {
  pointer-events: auto;
  width: clamp(28px, 3.2vw, 40px);
  height: clamp(26px, 3vw, 38px);
  padding: 0;
  font-family: var(--pixel);
  font-size: clamp(7px, 0.95vw, 11px);
  color: var(--cyan);
  background: rgba(2, 8, 20, 0.82);
  border: 1px solid rgba(0, 255, 255, 0.55);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.28), inset 0 0 8px rgba(0, 255, 255, 0.1);
  cursor: pointer;
  touch-action: manipulation;
}
.icon-btn:hover, .icon-btn:focus-visible {
  background: var(--cyan);
  color: #001018;
  outline: none;
  box-shadow: 0 0 14px var(--cyan);
}
.icon-btn.off {
  color: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.hintbar {
  position: fixed;
  left: 50%;
  bottom: calc(8px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 18;
  display: none;
  max-width: calc(100% - 24px);
  padding: 7px 12px;
  font-family: var(--pixel);
  font-size: clamp(6px, 0.85vw, 9px);
  line-height: 1.6;
  text-align: center;
  color: rgba(185, 246, 255, 0.86);
  background: rgba(1, 7, 18, 0.72);
  border: 1px solid rgba(0, 255, 255, 0.28);
  border-radius: 3px;
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  letter-spacing: 0.5px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.hintbar.on { display: block; }
.hint-touch { display: none; }
@media (pointer: coarse) {
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
}


.screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding:
    calc(14px + var(--safe-t))
    calc(14px + var(--safe-r))
    calc(14px + var(--safe-b))
    calc(14px + var(--safe-l));
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 50% 42%, rgba(10, 10, 46, 0.82), rgba(0, 0, 0, 0.94) 72%);
  animation: screenIn 0.18s ease-out;
}
.screen.on { display: flex; }
@keyframes screenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.kicker {
  font-size: clamp(7px, 1.1vw, 11px);
  letter-spacing: 2px;
  color: var(--purple);
  text-shadow: 0 0 10px rgba(155, 89, 182, 0.85);
}
.screen-title {
  margin: 8px 0 14px;
  font-size: clamp(20px, 4.4vw, 46px);
  line-height: 1.2;
  color: var(--gold);
  text-shadow:
    0 0 8px rgba(255, 215, 0, 0.9),
    0 0 26px rgba(255, 215, 0, 0.45),
    4px 4px 0 rgba(155, 89, 182, 0.55);
  letter-spacing: 2px;
  text-align: center;
}
.screen-title.small-title {
  font-size: clamp(18px, 3.6vw, 36px);
  margin-bottom: 8px;
}


.title-screen {
  background:
    radial-gradient(circle at 50% 44%, rgba(4, 9, 30, 0.30), rgba(0, 0, 0, 0.88) 78%);
}

.title-wrap {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 1.2vh, 14px);
  text-align: center;
  padding: 2px 0;
}
.game-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  line-height: 0.95;
}
.game-title .t1 {
  font-size: clamp(13px, min(3.6vw, 4.2vh), 34px);
  color: var(--cyan);
  letter-spacing: 0.25em;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.9), 0 0 26px rgba(0, 255, 255, 0.4);
}
.game-title .t2 {
  font-size: clamp(25px, min(9vw, 10vh), 92px);
  color: var(--gold);
  letter-spacing: 0.04em;
  text-shadow:
    0 0 7px rgba(255, 215, 0, 1),
    0 0 24px rgba(255, 215, 0, 0.65),
    0 0 60px rgba(255, 215, 0, 0.28),
    0.07em 0.07em 0 rgba(155, 89, 182, 0.7);
  animation: titlePulse 3.2s ease-in-out infinite;
}
@keyframes titlePulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.16); }
}
.title-sprite {
  width: clamp(150px, min(32vw, 32vh), 300px);
  aspect-ratio: 420 / 300;
}
.title-sprite canvas { width: 100%; height: 100%; display: block; }
.title-sub {
  font-size: clamp(7px, 1.3vw, 11px);
  letter-spacing: 0.3em;
  color: var(--lime);
  text-shadow: 0 0 10px rgba(57, 255, 20, 0.8);
}
.hi-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: clamp(8px, 1.3vw, 12px);
  color: var(--dim);
  letter-spacing: 1px;
}
.hi-row strong {
  color: var(--gold);
  font-size: clamp(13px, 2.1vw, 20px);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.85);
  font-variant-numeric: tabular-nums;
}
.who {
  font-family: var(--term);
  font-size: clamp(13px, 1.7vw, 19px);
  color: rgba(185, 246, 255, 0.9);
  letter-spacing: 0.5px;
}
.who b { color: var(--lime); font-weight: 400; }

.menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 460px;
}
.menu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.arcade-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: clamp(9px, 1.3vh, 14px) clamp(16px, 2.4vw, 28px);
  font-family: var(--pixel);
  font-size: clamp(8px, 1.1vw, 13px);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(2, 8, 22, 0.92);
  border: 2px solid rgba(0, 255, 255, 0.8);
  border-radius: 4px;
  box-shadow:
    0 0 10px rgba(0, 255, 255, 0.45),
    inset 0 0 12px rgba(0, 255, 255, 0.12);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, background 0.1s ease, color 0.1s ease, box-shadow 0.1s ease;
}
.arcade-btn:hover, .arcade-btn:focus-visible {
  color: #001014;
  background: var(--cyan);
  box-shadow: 0 0 22px rgba(0, 255, 255, 0.9), 0 0 50px rgba(0, 255, 255, 0.35);
  outline: none;
  transform: translateY(-1px);
}
.arcade-btn:active { transform: translateY(1px) scale(0.985); }
.arcade-btn.primary {
  color: #1a1200;
  background: linear-gradient(180deg, #ffe767, #ffd700 60%, #e3a800);
  border-color: #ffe97a;
  box-shadow:
    0 0 18px rgba(255, 215, 0, 0.8),
    0 0 46px rgba(255, 215, 0, 0.32),
    inset 0 0 14px rgba(255, 255, 255, 0.35);
  font-size: clamp(10px, 1.4vw, 16px);
  padding: clamp(11px, 1.7vh, 18px) clamp(26px, 4vw, 56px);
  min-height: 48px;
}
.arcade-btn.primary:hover, .arcade-btn.primary:focus-visible {
  background: #fff0a0;
  color: #120c00;
  box-shadow: 0 0 26px rgba(255, 215, 0, 1), 0 0 70px rgba(255, 215, 0, 0.5);
}
.arcade-btn.small {
  font-size: clamp(7px, 0.95vw, 10px);
  padding: 9px 14px;
  min-height: 34px;
  border-width: 1px;
}

.howto {
  width: 100%;
  max-width: 520px;
  margin-top: 2px;
  padding: clamp(7px, 1.4vh, 12px) clamp(10px, 2vw, 16px);
  border: 1px solid rgba(0, 255, 255, 0.18);
  background: rgba(0, 8, 20, 0.55);
  font-family: var(--term);
  font-size: clamp(12px, 1.7vw, 19px);
  line-height: 1.25;
  color: rgba(214, 238, 255, 0.88);
  text-align: left;
}
.howto b {
  display: inline-block;
  min-width: 4.6em;
  color: var(--gold);
  font-family: var(--pixel);
  font-size: 0.64em;
  font-weight: 400;
  letter-spacing: 1px;
  vertical-align: middle;
}
.howto.compact { margin-bottom: 6px; }
.build {
  font-family: var(--term);
  font-size: clamp(11px, 1.4vw, 15px);
  color: rgba(103, 120, 158, 0.75);
  letter-spacing: 1px;
  min-height: 1em;
}


.panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 28px - var(--safe-t) - var(--safe-b));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: clamp(16px, 3vh, 30px) clamp(16px, 3.4vw, 34px);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(10, 10, 46, 0.94), rgba(1, 5, 15, 0.96));
  border: 2px solid rgba(0, 255, 255, 0.55);
  border-radius: 6px;
  box-shadow:
    0 0 0 3px rgba(0, 0, 0, 0.9),
    0 0 34px rgba(0, 255, 255, 0.24),
    inset 0 0 40px rgba(0, 255, 255, 0.06);
}
.panel.wide { max-width: 760px; }
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--gold);
  pointer-events: none;
}
.panel::before { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }

.final-label {
  font-size: clamp(7px, 1vw, 10px);
  letter-spacing: 2px;
  color: var(--dim);
  margin-top: 4px;
}
.final-score {
  font-size: clamp(34px, 7.4vw, 68px);
  line-height: 1.1;
  color: var(--gold);
  text-shadow:
    0 0 10px rgba(255, 215, 0, 0.95),
    0 0 40px rgba(255, 215, 0, 0.5);
  font-variant-numeric: tabular-nums;
}
.new-high {
  font-size: clamp(10px, 1.8vw, 16px);
  color: var(--lime);
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(57, 255, 20, 0.9);
  animation: newHighPulse 0.75s steps(2, end) infinite;
  margin: 4px 0;
}
@keyframes newHighPulse {
  0%, 49% { opacity: 1; filter: brightness(1.2); }
  50%, 100% { opacity: 0.35; filter: brightness(0.9); }
}
.hidden { display: none !important; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  margin: 12px 0 4px;
}
.stats-grid > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 4px;
  border: 1px solid rgba(0, 255, 255, 0.2);
  background: rgba(0, 20, 35, 0.45);
}
.stats-grid span {
  font-size: clamp(6px, 0.82vw, 8px);
  color: var(--cyan);
  letter-spacing: 1px;
}
.stats-grid b {
  font-size: clamp(12px, 1.8vw, 18px);
  color: var(--white);
  font-weight: 400;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}
.post-note {
  margin: 8px 0 6px;
  padding: 7px 10px;
  max-width: 100%;
  font-family: var(--term);
  font-size: clamp(13px, 1.7vw, 18px);
  line-height: 1.2;
  color: rgba(185, 246, 255, 0.9);
  background: transparent;
  border: 1px dashed rgba(0, 255, 255, 0.25);
  border-radius: 3px;
  cursor: default;
}
.post-note.retry {
  color: var(--gold);
  border-color: rgba(255, 215, 0, 0.55);
  cursor: pointer;
}
.post-note.ok {
  color: var(--lime);
  border-color: rgba(57, 255, 20, 0.45);
}
.post-note.guest {
  color: var(--gold);
}
.post-note:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }


.board-sub {
  font-size: clamp(6px, 0.9vw, 9px);
  letter-spacing: 2px;
  color: var(--purple);
  margin-bottom: 10px;
}
.board-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(0, 255, 255, 0.2);
  background: rgba(0, 8, 20, 0.6);
}
.board {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--pixel);
  font-size: clamp(6px, 0.92vw, 10px);
  white-space: nowrap;
}
.board th {
  padding: 8px 6px;
  color: var(--cyan);
  font-weight: 400;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.3);
  text-align: left;
  background: rgba(0, 30, 50, 0.4);
}
.board td {
  padding: 8px 6px;
  color: rgba(220, 238, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.board tr:last-child td { border-bottom: 0; }
.board .rank { color: var(--gold); }
.board .score-cell {
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}
.board .lvl-cell { color: var(--lime); }
.board .date-cell { color: var(--dim); font-family: var(--term); font-size: 1.35em; }
.board a { color: var(--cyan); text-decoration: none; border-bottom: 1px dotted rgba(0, 255, 255, 0.4); }
.board a:hover { color: var(--white); border-bottom-color: var(--white); }
.board tr.me td {
  color: var(--lime);
  background: rgba(57, 255, 20, 0.07);
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.45);
}
.board tr.me .score-cell, .board tr.me .rank { color: var(--lime); }
.board-empty {
  padding: 22px 10px !important;
  text-align: center !important;
  color: var(--dim) !important;
  font-family: var(--term);
  font-size: 18px;
}
.your-best {
  width: 100%;
  margin: 10px 0 8px;
  font-family: var(--term);
  font-size: clamp(14px, 1.9vw, 20px);
  color: rgba(185, 246, 255, 0.92);
  text-align: center;
}
.your-best b { color: var(--gold); font-weight: 400; }


.level-banner {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 36;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  width: min(86vw, 640px);
}
.level-banner.show { animation: bannerRun 1.9s ease-out forwards; }
.level-banner-inner {
  position: relative;
  padding: clamp(10px, 2vh, 18px) 24px;
  text-align: center;
  background:
    linear-gradient(90deg, rgba(255, 215, 0, 0.16), rgba(0, 255, 255, 0.12), rgba(255, 215, 0, 0.16)),
    rgba(2, 8, 20, 0.94);
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 0 26px rgba(255, 215, 0, 0.35), inset 0 0 22px rgba(0, 255, 255, 0.12);
}
.level-banner-inner::before {
  content: "";
  position: absolute;
  inset: -6px 12px;
  border-top: 1px dashed rgba(0, 255, 255, 0.55);
  border-bottom: 1px dashed rgba(0, 255, 255, 0.55);
}
.level-banner-inner span {
  position: relative;
  font-family: var(--pixel);
  font-size: clamp(16px, 3.6vw, 38px);
  color: var(--gold);
  letter-spacing: 0.12em;
  text-shadow: 0 0 10px rgba(255, 215, 0, 1), 0 0 40px rgba(255, 215, 0, 0.5);
}
.level-banner.boss .level-banner-inner {
  border-color: var(--red);
  box-shadow: 0 0 30px rgba(255, 7, 58, 0.55), inset 0 0 22px rgba(255, 7, 58, 0.16);
  background:
    linear-gradient(90deg, rgba(255, 7, 58, 0.18), rgba(155, 89, 182, 0.16), rgba(255, 7, 58, 0.18)),
    rgba(10, 2, 10, 0.95);
}
.level-banner.boss .level-banner-inner::before {
  border-color: rgba(255, 7, 58, 0.6);
}
.level-banner.boss .level-banner-inner span {
  color: #ff5a7a;
  text-shadow: 0 0 12px rgba(255, 7, 58, 1), 0 0 40px rgba(255, 7, 58, 0.6);
}
@keyframes bannerRun {
  0% { opacity: 0; transform: translate(-50%, -130%) scale(0.9); }
  14% { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  20% { transform: translate(-50%, 0) scale(1); }
  78% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -30%) scale(0.98); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(48px + var(--safe-b));
  transform: translate(-50%, 10px);
  z-index: 44;
  padding: 9px 16px;
  max-width: calc(100vw - 28px);
  font-family: var(--pixel);
  font-size: clamp(7px, 1vw, 10px);
  line-height: 1.5;
  color: var(--gold);
  background: rgba(2, 8, 20, 0.95);
  border: 1px solid rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  text-align: center;
  word-break: break-word;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #000;
  color: var(--gold);
  font-family: var(--pixel);
  font-size: 14px;
  text-align: center;
}


@media (max-width: 620px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu { gap: 7px; }
  .menu-row { gap: 6px; }
  .howto b { min-width: 4em; }
  .hud-mid { margin-top: -1px; }
}

@media (max-height: 560px) {
  .level-banner-inner { padding: 4px 16px; }
  .level-banner-inner span { font-size: clamp(12px, 4.6vh, 22px); }
  .title-wrap { gap: 4px; }
  .title-sprite { width: clamp(96px, 22vh, 170px); }
  .game-title .t2 { font-size: clamp(24px, 9vh, 58px); }
  .howto { line-height: 1.12; padding: 5px 10px; }
  .hi-row { gap: 7px; }
  .menu-row { gap: 5px; }
  .arcade-btn { min-height: 34px; padding-top: 8px; padding-bottom: 8px; }
  .arcade-btn.primary { min-height: 40px; padding-top: 9px; padding-bottom: 9px; }
  .screen {
    align-items: flex-start;
    padding-top: calc(8px + var(--safe-t));
  }
  .panel { margin: auto 0; }
}

@media (max-width: 430px) {
  .board { font-size: 7px; }
  .board th, .board td { padding: 6px 4px; }
  .hud-cell.hud-right { gap: 4px; }
  .hintbar { font-size: 6px; letter-spacing: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .game-title .t2 { animation: none; }
  .new-high { animation: none; }
  .flicker { display: none; }
  .screen { animation: none; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .title-screen { align-items: center; }
  .title-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    grid-template-areas:
      "kicker sprite"
      "title sprite"
      "sub sprite"
      "hi howto"
      "who howto"
      "menu howto"
      "menu howto"
      "build build";
    align-items: center;
    column-gap: clamp(10px, 2vw, 26px);
    row-gap: clamp(3px, 0.8vh, 8px);
    max-width: 1000px;
    text-align: left;
  }
  .title-wrap .kicker { grid-area: kicker; }
  .title-wrap .game-title { grid-area: title; align-items: flex-start; }
  .title-wrap .title-sub { grid-area: sub; }
  .title-wrap .hi-row { grid-area: hi; justify-content: flex-start; }
  .title-wrap .who { grid-area: who; text-align: left; }
  .title-wrap .menu { grid-area: menu; align-items: flex-start; margin-top: 0; }
  .title-wrap .menu-row { justify-content: flex-start; }
  .title-wrap .title-sprite { grid-area: sprite; width: clamp(126px, 24vh, 190px); align-self: center; }
  .title-wrap .howto { grid-area: howto; text-align: left; font-size: clamp(12px, 2.2vh, 17px); line-height: 1.15; }
  .title-wrap .build { grid-area: build; text-align: center; }
  .title-wrap .game-title .t1 { font-size: clamp(11px, 3.4vh, 20px); }
  .title-wrap .game-title .t2 { font-size: clamp(22px, 8.5vh, 52px); }
}
