:root {
  color-scheme: dark;
  --bg: #04050c;
  --ink: #d8f3ff;
  --dim: #6b7fa8;
  --line: #1a2240;
  --pink: #ff6ad5;
  --cyan: #5ce1ff;
  --lime: #a8ff60;
  --gold: #ffd25a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  font: 600 14px/1.3 ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 18px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.brand { margin-right: auto; color: var(--dim); text-decoration: none; }
.brand span { color: #3b4a6b; }
.stat { color: var(--dim); }
.stat b { color: var(--ink); font-weight: 700; }
#lives { color: var(--gold); letter-spacing: .15em; }

.mute {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid #2a3556;
  padding: 3px 10px;
  cursor: pointer;
}
.mute[aria-pressed="true"] { color: var(--dim); text-decoration: line-through; }

.stage {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
}

.screen-wrap {
  position: relative;
  width: 224px;
  height: 256px;
  container-type: inline-size;
  box-shadow: 0 0 0 1px var(--line), 0 0 48px rgba(92, 225, 255, .07);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6%;
  text-align: center;
  background: rgba(4, 5, 12, .8);
  cursor: pointer;
}
.overlay[hidden], .overlay [hidden] { display: none !important; }
.overlay.soft {
  align-items: flex-end;
  padding-bottom: 34%;
  background: transparent;
  pointer-events: none;
}

.overlay p { margin: 0 0 .6em; }

h1 {
  margin: 0 0 .35em;
  font-size: 12cqw;
  line-height: 1.05;
  letter-spacing: .1em;
  color: var(--pink);
  text-shadow: 0 0 14px rgba(255, 106, 213, .45);
}

.tag { font-size: 4.4cqw; }

.legend {
  display: grid;
  justify-items: center;
  gap: .55em;
  margin: 1.1em 0 1.3em;
  padding: 0;
  list-style: none;
  font-size: 4.2cqw;
}
.legend li { display: flex; align-items: center; gap: .9em; }
.legend img { width: 9cqw; image-rendering: pixelated; }
.legend .note { max-width: 24em; font-size: 3.4cqw; color: var(--dim); text-transform: none; letter-spacing: .02em; }

.big { font-size: 8cqw; color: var(--gold); text-shadow: 0 0 12px rgba(255, 210, 90, .4); }
.start { font-size: 4cqw; color: var(--cyan); }
.record { font-size: 4.6cqw; color: var(--lime); }

.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.controls { padding: 6px 12px max(10px, env(safe-area-inset-bottom)); }
.help { margin: 0; text-align: center; font-size: 12px; color: var(--dim); }

.touch { display: none; }
.touch .pad { display: flex; gap: 10px; }
.touch button {
  width: 76px;
  height: 64px;
  font: inherit;
  font-size: 22px;
  color: var(--ink);
  background: #0c1124;
  border: 1px solid #2a3556;
  border-radius: 12px;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.touch .fire { width: 112px; color: var(--gold); }
.touch button.on { background: #1b2650; border-color: var(--cyan); }

@media (pointer: coarse) {
  .touch { display: flex; justify-content: space-between; gap: 12px; }
  .help { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .blink { animation: none; }
}
