:root {
  --blue: #0052ff;
  --blue-deep: #0033a8;
  --blue-soft: rgba(0, 82, 255, 0.14);
  --blue-line: rgba(0, 82, 255, 0.35);
  --ink: #04070f;
  --ink-2: #080d1c;
  --paper: #f4f6ff;
  --dim: #8a93b8;
  --faint: #2a3352;
  --line: rgba(244, 246, 255, 0.09);
  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --body: "Space Grotesk", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(0, 82, 255, 0.18), transparent 70%),
    var(--ink);
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.tape {
  position: relative;
  height: 28px;
  overflow: hidden;
  background: repeating-linear-gradient(-45deg, var(--blue) 0 18px, #fff 18px 36px);
}

.tape-run {
  display: flex;
  white-space: nowrap;
  animation: tape 28s linear infinite;
}

.tape-run span {
  padding: 0 0.4em;
  font-family: var(--display);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.28em;
  line-height: 28px;
  color: #041a00;
}

@keyframes tape {
  to {
    transform: translateX(-50%);
  }
}

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.brand-hat {
  width: 32px;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7));
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mute {
  min-height: 44px;
  min-width: 64px;
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper);
  border: 1px solid var(--blue-line);
  background: rgba(4, 7, 15, 0.55);
}

.mute:hover,
.mute[aria-pressed="true"] {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.buy {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--blue);
  padding: 11px 16px 11px 12px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow: 0 14px 40px #0052ff59;
  overflow: hidden;
}

.buy img {
  width: 22px;
  height: auto;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

.buy:hover {
  background: #1a64ff;
}

.buy--wide {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
}

.buy--ghost {
  background: transparent;
  border: 1px solid var(--blue-line);
  box-shadow: none;
  clip-path: none;
}

.buy--ghost:hover {
  background: var(--blue-soft);
}

.shell {
  width: min(1080px, 100% - 24px);
  margin: 0 auto 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--blue);
}

.eyebrow i {
  width: 8px;
  height: 8px;
  background: var(--blue);
  box-shadow: 0 0 12px var(--blue);
}

h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(28px, 8vw, 52px);
  letter-spacing: -0.03em;
  line-height: 0.95;
  margin-top: 6px;
}

h1 em {
  font-style: normal;
  color: var(--blue);
  text-shadow: 0 0 26px rgba(0, 82, 255, 0.55);
}

.lede {
  margin-top: 10px;
  color: var(--dim);
  font-size: 15px;
  max-width: 42em;
}

.stage-wrap {
  position: relative;
  margin-top: 16px;
  background: #020616;
  border: 1px solid var(--blue-line);
  overflow: hidden;
  box-shadow: 0 30px 90px #0052ff2e, 0 0 0 1px rgba(255, 180, 80, 0.08);
}

.stage-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    repeating-linear-gradient(transparent 0 3px, rgba(0, 0, 0, 0.045) 3px 4px),
    radial-gradient(120% 80% at 50% 40%, transparent 55%, rgba(4, 7, 15, 0.35) 100%);
}

#game {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 480;
  touch-action: none;
  background: #1a140c;
  cursor: pointer;
}

.hud {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 2;
}

.hud-score,
.hud-best {
  background: #04070fb8;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 8px 12px;
  backdrop-filter: blur(8px);
}

.hud-score small,
.hud-best small {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--blue);
}

.hud-score b,
.hud-best b {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.hud-score span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #8fb1ff;
}

.hud-lives {
  display: flex;
  align-items: center;
  gap: 3px;
  background: #04070fb8;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 6px 8px;
  backdrop-filter: blur(8px);
}

.hud-lives img {
  width: 18px;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.hud-lives img.off {
  opacity: 0.22;
  filter: grayscale(1);
}

.panel {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 16px;
  background:
    linear-gradient(180deg, rgba(4, 7, 15, 0.55), rgba(4, 7, 15, 0.78)),
    url("../assets/bg-army.png") center 42% / cover;
  text-align: center;
}

.panel[hidden],
.hud[hidden],
.toast[hidden],
.challenge[hidden],
.install[hidden],
.install-hint[hidden],
#installBtn[hidden] {
  display: none !important;
}

.panel-k {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--blue);
}

.panel h2 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(22px, 5vw, 34px);
  letter-spacing: -0.03em;
  max-width: 16em;
}

.how {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 8px;
}

.how li {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--blue-line);
  padding: 7px 10px;
}

.how b {
  color: var(--paper);
}

.challenge {
  color: #8fb1ff;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.run-stat {
  font-family: var(--display);
  font-size: 18px;
}

.run-stat b {
  font-size: 36px;
  letter-spacing: -0.03em;
}

.best-line {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 6px;
}

.row {
  display: flex;
  gap: 8px;
  width: min(420px, 100%);
}

.row .buy {
  flex: 1;
}

.ghost {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8fb1ff;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.hint {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--dim);
}

.install {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.install[hidden] {
  display: none !important;
}

.install .buy {
  min-height: 44px;
}

.install-hint {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #8fb1ff;
  line-height: 1.45;
}

@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
  }

  .install {
    display: none !important;
  }
}

.foot {
  width: min(1080px, 100% - 24px);
  margin: 0 auto;
  padding: 8px 0 calc(22px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}

.foot a {
  color: var(--blue);
}

.safe {
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.5;
  color: #5f6f9c;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  padding: 12px 18px;
  background: var(--blue);
  font-family: var(--display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  box-shadow: 0 20px 60px #0052ff80;
}

@media (min-width: 820px) {
  .shell {
    width: min(1080px, 100% - 48px);
  }

  .top {
    padding: 16px 28px 8px;
  }

  .how {
    gap: 10px;
  }
}

@media (max-width: 700px) {
  #game {
    min-height: 220px;
    aspect-ratio: 960 / 480;
  }

  .panel {
    position: relative;
    inset: auto;
    border-top: 1px solid var(--blue-line);
    padding: 16px 14px 18px;
  }

  .row {
    flex-direction: column;
  }

  .hud-score b,
  .hud-best b {
    font-size: 18px;
  }

  .hud-lives img {
    width: 14px;
  }
}

@media (max-width: 520px) {
  .panel h2 {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tape-run {
    animation: none;
  }
}
