:root {
  --pink: #ff2f9e;
  --cyan: #35f4ff;
  --violet: #a45cff;
  --amber: #ffb03a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #08010f;
  color: #fff;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#c {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 55%, rgba(255, 60, 90, 0) 40%, rgba(255, 40, 80, 0.85) 100%);
  opacity: 0;
  /* el propio juego anima la opacidad cada frame: una transición encima
     obliga a recomponer la capa entera y cuesta un frame */
  z-index: 5;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  /* sin transición: animar la capa del HUD al empezar costaba un frame */
  font-variant-numeric: tabular-nums;
}
#hud.on { opacity: 1; }

.hud-left { position: absolute; top: 22px; left: 26px; }
.hud-right { position: absolute; top: 22px; right: 26px; text-align: right; }

.label {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: rgba(180, 220, 255, 0.7);
  text-transform: uppercase;
}

#score {
  font-size: 46px;
  font-weight: 800;
  font-style: italic;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 0 12px rgba(53, 244, 255, 0.9), 0 0 34px rgba(164, 92, 255, 0.7);
}

.sub { margin-top: 6px; font-size: 12px; letter-spacing: 0.18em; color: rgba(255, 140, 210, 0.85); }

.hud-right .label { font-size: 15px; letter-spacing: 0.2em; color: #fff; text-shadow: 0 0 14px rgba(255, 47, 158, 0.9); }

.hud-bottom {
  position: absolute;
  left: 26px;
  bottom: 24px;
  display: flex;
  align-items: flex-end;
  gap: 26px;
}

.hull { display: flex; gap: 8px; }
.hull span {
  width: 26px;
  height: 12px;
  transform: skewX(-22deg);
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.hull span.off { background: #3a1a3a; box-shadow: none; opacity: 0.5; }

.boost .label { margin-bottom: 6px; }
.bar {
  width: 190px;
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 0 14px rgba(53, 244, 255, 0.8);
  transition: width 0.08s linear;
}
.bar.hot i { background: linear-gradient(90deg, #fff, var(--pink)); box-shadow: 0 0 18px var(--pink); }

#banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 26%;
  text-align: center;
  font-size: 40px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.3em;
  opacity: 0;
  transform: scale(1.06);
  color: #fff;
  text-shadow: 0 0 18px var(--cyan), 0 0 44px var(--violet);
  transition: opacity 0.25s ease, transform 0.5s ease;
}
#banner.on { opacity: 1; transform: scale(1); }
#banner.small { font-size: 24px; letter-spacing: 0.2em; }

#hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 84px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: rgba(200, 220, 255, 0.55);
  transition: opacity 0.6s ease;
}
#hint.off { opacity: 0; }

/* ---------- pantallas ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 62%, rgba(40, 6, 60, 0.28), rgba(6, 1, 14, 0.82) 78%);
}
.screen.on { display: flex; }

.logo {
  display: flex;
  flex-direction: column;
  line-height: 0.84;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
}
.logo .l1 {
  font-size: clamp(46px, 9vw, 96px);
  color: #fff;
  text-shadow: 0 0 18px rgba(53, 244, 255, 0.9), 0 0 60px rgba(53, 244, 255, 0.45);
}
.logo .l2 {
  font-size: clamp(52px, 11vw, 116px);
  color: var(--pink);
  text-shadow: 0 0 22px rgba(255, 47, 158, 0.9), 0 0 70px rgba(255, 47, 158, 0.5);
}

.tag {
  max-width: 460px;
  margin: 22px 0 26px;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(220, 225, 255, 0.78);
}

button.big {
  pointer-events: auto;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.22em;
  font-size: 20px;
  padding: 14px 46px;
  color: #0a0214;
  background: linear-gradient(180deg, #7ff9ff, var(--cyan));
  border: none;
  box-shadow: 0 0 26px rgba(53, 244, 255, 0.6), inset 0 -3px 0 rgba(0, 60, 90, 0.35);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
button.big:hover { box-shadow: 0 0 40px rgba(53, 244, 255, 0.85); }
button.big:active { transform: translateY(2px) scale(0.99); }

.keys {
  list-style: none;
  margin: 30px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  max-width: 560px;
  font-size: 13px;
  color: rgba(215, 225, 255, 0.7);
}
.keys b {
  display: inline-block;
  padding: 2px 7px;
  margin-right: 2px;
  border: 1px solid rgba(53, 244, 255, 0.4);
  color: #bff9ff;
  font-weight: 700;
  font-size: 12px;
}
.pad { margin: 14px 0 0; font-size: 12px; letter-spacing: 0.05em; color: rgba(255, 140, 210, 0.7); }
.rec { margin: 26px 0 0; font-size: 12px; letter-spacing: 0.26em; color: rgba(200, 210, 255, 0.6); }

h2 {
  margin: 0 0 26px;
  font-size: 34px;
  font-style: italic;
  letter-spacing: 0.32em;
  color: #fff;
  text-shadow: 0 0 20px rgba(53, 244, 255, 0.8);
}
h2.warn { color: var(--pink); text-shadow: 0 0 22px rgba(255, 47, 158, 0.9); }

.menu { display: flex; flex-direction: column; gap: 6px; min-width: 280px; }

.mi {
  pointer-events: auto;
  cursor: pointer;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 12px 18px;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(225, 230, 255, 0.72);
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.mi.row { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.mi.sel {
  color: #fff;
  border-color: rgba(53, 244, 255, 0.6);
  background: rgba(53, 244, 255, 0.1);
  text-shadow: 0 0 14px rgba(53, 244, 255, 0.9);
}
.vbar {
  display: block;
  width: 110px;
  height: 8px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.vbar i { display: block; height: 100%; width: 70%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

.hint2 { margin-top: 24px; font-size: 12px; letter-spacing: 0.16em; color: rgba(190, 200, 255, 0.5); }

.statgrid {
  display: flex;
  gap: 16px;
  margin: 6px 0 26px;
  flex-wrap: wrap;
  justify-content: center;
}
.panel {
  min-width: 244px;
  padding: 13px 16px 9px;
  text-align: left;
  border: 1px solid rgba(120, 160, 255, 0.18);
  /* sin backdrop-filter: desenfocar el fondo costaba un frame de ~117 ms
     la primera vez que se mostraba esta pantalla */
  background: rgba(9, 3, 22, 0.93);
}
.panel h3 {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.26em;
  color: rgba(150, 200, 255, 0.7);
}
.prow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 3px 0;
  font-size: 13px;
  color: rgba(220, 228, 255, 0.78);
}
.prow b {
  color: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.prow.top b { color: var(--cyan); text-shadow: 0 0 12px rgba(53, 244, 255, 0.75); }
.new {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 5px;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #17000f;
  background: var(--pink);
  vertical-align: middle;
}

.bigscore {
  font-size: clamp(64px, 13vw, 120px);
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 24px rgba(255, 47, 158, 0.85), 0 0 70px rgba(164, 92, 255, 0.6);
}
.lines { margin: 16px 0 30px; font-size: 13px; letter-spacing: 0.2em; color: rgba(210, 220, 255, 0.72); }

@media (max-width: 560px) {
  #score { font-size: 34px; }
  .bar { width: 130px; }
  .panel { min-width: 0; width: 100%; }
  .statgrid { gap: 10px; margin-bottom: 18px; }
  #hint { display: none; }
}
