:root {
  --accent: #ffb347;
  --accent-deep: #e74008;
  --text: #fff7ea;
  --muted: rgba(255, 247, 234, 0.62);
  --glass: rgba(12, 18, 32, 0.52);
  --glass-border: rgba(255, 220, 170, 0.22);
  --font-display: '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: #1a2338; color: var(--text);
  font-family: var(--font-body); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; user-select: 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) 55%, rgba(10, 8, 20, 0.55) 100%);
}
#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 12px rgba(0,0,0,0.55);
}
.hud-center { text-align: center; }
.hud-right { text-align: right; }
.label { font: 600 11px/1 var(--font-body); letter-spacing: 0.2em; color: var(--muted); }
.big { font: 700 40px/1.05 var(--font-display); color: var(--text); margin-top: 6px; }
#timer.urgent { color: #ff7a4d; }
.combo {
  display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 999px;
  font: 700 14px/1 var(--font-display); color: #1a1208; background: var(--accent);
  transform-origin: left center; transition: transform 120ms ease-out;
}
.combo.pop { transform: scale(1.35); }
.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(255, 179, 71, 0.6); transition: all 200ms ease;
}
.hull span.lost { background: rgba(255,255,255,0.15); box-shadow: none; }

/* 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 2px 10px rgba(0,0,0,0.6);
  animation: rise 800ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.popup.bad { color: #ff6a4d; }
@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%, -160%) scale(1); }
}

/* screens */
.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: linear-gradient(180deg, rgba(8, 10, 20, 0.15), rgba(8, 10, 20, 0.45));
}
.card {
  width: min(520px, 100%); padding: 36px 36px 28px; text-align: center;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 24px;
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 30px 80px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.12);
  animation: cardIn 520ms 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: 700 56px/1 var(--font-display); letter-spacing: -0.02em;
}
h1 span { color: var(--accent); }
.card p { margin: 0 auto 22px; max-width: 380px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.keys { display: flex; gap: 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 40px; border-radius: 999px;
  font: 700 18px/1 var(--font-display); color: #1a1208;
  background: linear-gradient(135deg, #ffd27a, var(--accent) 60%, #ff8a3d);
  box-shadow: 0 12px 30px rgba(255, 150, 60, 0.35), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 16px 40px rgba(255, 150, 60, 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: 34px; }
.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: #1a1208; background: var(--accent);
  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: 42px; }
  .big { font-size: 30px; }
  #hud { padding: 16px 18px; }
  .card { padding: 28px 22px 22px; }
}
