:root {
  --accent: #5ff5ff;
  --accent-2: #ff6fd8;
  --accent-deep: #0a6f8a;
  --text: #eafcff;
  --muted: rgba(234, 252, 255, 0.62);
  --glass: rgba(4, 18, 32, 0.55);
  --glass-border: rgba(120, 240, 255, 0.22);
  --font-display: 'Unbounded', 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: #02101c; color: var(--text);
  font-family: var(--font-body); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; user-select: none; touch-action: none;
}
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 58%, rgba(0, 6, 14, 0.5) 100%);
}
#vignette.hurt { animation: hurt 650ms ease-out; }
@keyframes hurt {
  0% { box-shadow: inset 0 0 120px 60px rgba(255, 40, 60, 0.0); }
  12% { box-shadow: inset 0 0 160px 80px rgba(255, 40, 60, 0.75); }
  100% { box-shadow: inset 0 0 120px 60px rgba(255, 40, 60, 0.0); }
}
#flash { position: fixed; inset: 0; pointer-events: none; background: #fff; opacity: 0; }
.hidden { display: none !important; }

/* HUD */
#hud {
  position: fixed; top: 0; left: 0; right: 0; padding: 22px 28px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}
.hud-center { text-align: center; }
.hud-right { text-align: right; }
.label { font: 600 11px/1 var(--font-body); letter-spacing: 0.22em; color: var(--muted); }
.big { font: 700 40px/1.05 var(--font-display); color: var(--text); margin-top: 6px; }
#timer.urgent { color: #ff7a9a; animation: pulse 500ms ease-in-out infinite alternate; }
.combo {
  display: inline-block; margin-top: 8px; padding: 4px 11px; border-radius: 999px;
  font: 700 14px/1 var(--font-display); color: #031018; background: var(--accent);
  box-shadow: 0 0 18px rgba(95, 245, 255, 0.55);
  transform-origin: left center; transition: transform 120ms ease-out, background 200ms;
}
.combo.hot { background: var(--accent-2); box-shadow: 0 0 22px rgba(255, 111, 216, 0.7); }
.combo.pop { transform: scale(1.4); }
.hull { display: flex; gap: 6px; justify-content: flex-end; margin-top: 10px; }
.hull span {
  width: 26px; height: 10px; border-radius: 999px; background: var(--accent);
  box-shadow: 0 0 12px rgba(95, 245, 255, 0.7); transition: all 200ms ease;
}
.hull span.lost { background: rgba(255,255,255,0.12); box-shadow: none; }
.boost-label { margin-top: 12px; }
.boostbar { width: 120px; height: 7px; margin: 6px 0 0 auto; border-radius: 999px; background: rgba(255,255,255,0.12); overflow: hidden; }
#boost-fill { height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(90deg, #5ff5ff, #ff6fd8); box-shadow: 0 0 10px rgba(255,111,216,0.6); transition: width 80ms linear; }
.boostbar.empty #boost-fill { background: #ff4f6a; }

/* floating score popups */
#popups { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.popup {
  position: absolute; transform: translate(-50%, -50%);
  font: 700 26px/1 var(--font-display); color: var(--accent);
  text-shadow: 0 0 16px rgba(95, 245, 255, 0.8), 0 2px 10px rgba(0,0,0,0.6);
  animation: rise 850ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.popup.hot { color: var(--accent-2); text-shadow: 0 0 18px rgba(255, 111, 216, 0.9); }
.popup.bad { color: #ff5f7a; text-shadow: 0 0 18px rgba(255, 60, 90, 0.8); font-size: 30px; }
@keyframes rise {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1); }
}

/* touch controls */
#touch-ui { position: fixed; inset: 0; pointer-events: none; }
.stick {
  position: absolute; left: 26px; bottom: 26px; width: 120px; height: 120px; border-radius: 50%;
  border: 1.5px solid rgba(120, 240, 255, 0.35); background: rgba(4, 18, 32, 0.35); opacity: 0.5;
  transition: opacity 150ms;
}
.stick.active { opacity: 0.95; }
#stick-knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--accent); box-shadow: 0 0 18px rgba(95, 245, 255, 0.7);
}
.boost-btn {
  position: absolute; right: 26px; bottom: 30px; width: 96px; height: 96px; border-radius: 50%; pointer-events: auto;
  appearance: none; border: 1.5px solid rgba(255, 111, 216, 0.6); background: rgba(255, 111, 216, 0.22); color: var(--text);
  font: 700 13px/1 var(--font-display); letter-spacing: 0.08em; box-shadow: 0 0 24px rgba(255, 111, 216, 0.35);
}
.boost-btn:active { background: rgba(255, 111, 216, 0.6); transform: scale(0.95); }

/* screens */
.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: linear-gradient(180deg, rgba(2, 10, 20, 0.1), rgba(2, 10, 20, 0.5));
}
.card {
  width: min(560px, 100%); padding: 36px 36px 28px; text-align: center;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 26px;
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), 0 0 60px rgba(95, 245, 255, 0.08), inset 0 1px 0 rgba(255,255,255,0.12);
  animation: cardIn 560ms cubic-bezier(0.2, 0.9, 0.2, 1.1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.eyebrow { font: 600 11px/1 var(--font-body); letter-spacing: 0.28em; color: var(--accent); }
h1 { margin: 14px 0 10px; font: 900 54px/1 var(--font-display); letter-spacing: -0.01em; }
h1 span { color: var(--accent); text-shadow: 0 0 28px rgba(95, 245, 255, 0.55); }
.card p { margin: 0 auto 22px; max-width: 420px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.card p b { color: var(--text); font-weight: 600; }
.keys { display: flex; flex-wrap: wrap; gap: 14px 18px; justify-content: center; margin-bottom: 26px; color: var(--muted); font-size: 13px; }
.keys b { color: var(--text); background: rgba(255,255,255,0.1); padding: 2px 7px; border-radius: 6px; font-weight: 600; }
.btn {
  appearance: none; border: 0; cursor: pointer; padding: 16px 44px; border-radius: 999px;
  font: 700 18px/1 var(--font-display); color: #031018;
  background: linear-gradient(135deg, #a9fbff, var(--accent) 55%, #ff6fd8 130%);
  box-shadow: 0 12px 34px rgba(95, 245, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.6);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 16px 44px rgba(95, 245, 255, 0.5); }
.btn:active { transform: translateY(1px) scale(0.98); }
.best { margin-top: 16px; font-size: 13px; color: var(--muted); letter-spacing: 0.08em; }
.loading { position: absolute; bottom: 28px; font-size: 13px; color: var(--muted); letter-spacing: 0.12em; }
.stats { display: flex; gap: 28px; justify-content: center; margin: 18px 0 8px; }
.stats .big { font-size: 32px; }
.newbest {
  display: inline-block; margin: 6px 0 14px; padding: 6px 14px; border-radius: 999px;
  font: 700 12px/1 var(--font-display); letter-spacing: 0.2em; color: #031018; background: var(--accent-2);
  animation: pulse 900ms ease-in-out infinite alternate;
}
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }
.fps { position: fixed; bottom: 10px; right: 12px; font: 500 11px/1 var(--font-body); color: rgba(255,255,255,0.35); pointer-events: none; }

@media (max-width: 600px) {
  h1 { font-size: 38px; }
  .big { font-size: 28px; }
  #hud { padding: 14px 16px; }
  .card { padding: 26px 20px 20px; }
  .keys { display: none; }
  .boostbar { width: 90px; }
}
