:root {
  --bg: #0a0a1a;
  --cyan: #00f0ff;
  --mag: #ff2fd0;
  --lime: #39ff14;
  --gold: #ffd166;
  --ink: #e8ecff;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: 'Chakra Petch', sans-serif;
  user-select: none;
}
#game-wrap { position: fixed; inset: 0; }
#canvas { display: block; position: absolute; inset: 0; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 14px 18px; pointer-events: none;
  font-family: 'Orbitron', sans-serif;
  z-index: 5;
}
#hud > div { pointer-events: none; }
.hud-left, .hud-right { display: flex; flex-direction: column; gap: 4px; }
.hud-right { align-items: flex-end; }
.hud-attempt, .hud-best { font-size: 12px; letter-spacing: 2px; color: #7f8bc9; }
.hud-score { font-size: 20px; font-weight: 900; color: var(--cyan); text-shadow: 0 0 12px var(--cyan); }
.hud-attempt span, .hud-best span, .hud-score span { color: #fff; }
.hud-best span { color: var(--gold); }
.hud-progress { flex: 1; max-width: 340px; margin: 4px 20px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.progress-track {
  width: 100%; height: 8px; border-radius: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  overflow: hidden;
}
#progressFill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--mag));
  box-shadow: 0 0 12px var(--cyan);
  transition: width 0.15s linear;
}
.progress-pct { font-size: 11px; letter-spacing: 2px; color: #9aa5e0; }
.icon-btn {
  pointer-events: auto;
  margin-top: 6px;
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--cyan); font-size: 16px; cursor: pointer;
}
.icon-btn.muted { color: #ff5470; }

/* ---------- Overlays ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(20,10,50,0.55), rgba(5,4,15,0.9));
  backdrop-filter: blur(2px);
  text-align: center;
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900; font-size: clamp(30px, 8vw, 68px);
  letter-spacing: 4px; line-height: 1;
  background: linear-gradient(90deg, var(--cyan), var(--mag), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(0,240,255,0.5));
  animation: pulseTitle 2.4s ease-in-out infinite;
}
@keyframes pulseTitle { 0%,100% { filter: drop-shadow(0 0 14px rgba(0,240,255,0.4)); } 50% { filter: drop-shadow(0 0 28px rgba(255,47,208,0.6)); } }
.subtitle { font-size: 14px; letter-spacing: 3px; color: #8b97d6; text-transform: uppercase; }

.color-picker { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 6px; }
.picker-label { font-size: 11px; letter-spacing: 3px; color: #6b76b0; font-family: 'Orbitron', sans-serif; }
.swatches { display: flex; gap: 10px; }
.swatch {
  width: 38px; height: 38px; border-radius: 9px; cursor: pointer;
  border: 2px solid rgba(255,255,255,0.15);
  transition: transform 0.12s ease, border 0.12s ease;
}
.swatch:hover { transform: translateY(-3px) scale(1.08); }
.swatch.active { border-color: #fff; transform: translateY(-4px) scale(1.12); box-shadow: 0 0 16px rgba(255,255,255,0.5); }

.mode-row { margin-top: 2px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: 1px; color: #b8c0f0; cursor: pointer; }
.toggle em { color: #6b76b0; font-style: normal; font-size: 11px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--cyan); cursor: pointer; }

.big-btn {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900; font-size: 20px; letter-spacing: 3px;
  padding: 14px 46px; border-radius: 12px; cursor: pointer;
  color: #08131a; border: none;
  background: linear-gradient(135deg, var(--cyan), #00b4ff);
  box-shadow: 0 0 24px rgba(0,240,255,0.55), inset 0 0 8px rgba(255,255,255,0.4);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.big-btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 34px rgba(0,240,255,0.8); }
.big-btn:active { transform: scale(0.97); }
.ghost-btn {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700; font-size: 14px; letter-spacing: 2px;
  padding: 12px 28px; border-radius: 12px; cursor: pointer;
  color: #b8c0f0; background: transparent;
  border: 1.5px solid rgba(255,255,255,0.25);
  transition: background 0.15s ease;
}
.ghost-btn:hover { background: rgba(255,255,255,0.08); }

/* ---------- Leaderboard ---------- */
.leaderboard {
  margin-top: 10px; width: min(90vw, 360px);
  background: rgba(10,8,26,0.7);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; padding: 14px 16px;
}
.lb-title { font-family: 'Orbitron', sans-serif; font-size: 12px; letter-spacing: 3px; color: var(--gold); margin-bottom: 10px; }
#lbList { list-style: none; display: flex; flex-direction: column; gap: 6px; }
#lbList li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.lb-rank { font-family: 'Orbitron', sans-serif; font-weight: 700; width: 20px; color: #7f8bc9; }
.lb-cube { width: 16px; height: 16px; border-radius: 4px; box-shadow: 0 0 6px rgba(0,240,255,0.4); flex-shrink: 0; }
.lb-name { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d6dcff; }
.lb-dist { font-weight: 700; color: var(--cyan); }
.lb-empty { color: #6b76b0; font-size: 13px; justify-content: center; }

/* ---------- Game Over ---------- */
.over-title {
  font-family: 'Orbitron', sans-serif; font-weight: 900;
  font-size: clamp(34px, 9vw, 64px); letter-spacing: 6px;
  color: #ff2f5e; text-shadow: 0 0 22px rgba(255,47,94,0.7);
  animation: shakeIn 0.4s ease;
}
@keyframes shakeIn { 0% { transform: translateX(-8px); } 25% { transform: translateX(8px); } 50% { transform: translateX(-5px); } 75% { transform: translateX(5px); } 100% { transform: translateX(0); } }
.death-msg { font-size: 16px; color: #c8cff5; font-style: italic; max-width: 320px; }
.over-stats { display: flex; gap: 40px; margin: 6px 0; }
.over-stats div { display: flex; flex-direction: column; align-items: center; }
.over-stats span { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 32px; color: var(--cyan); text-shadow: 0 0 14px var(--cyan); }
.over-stats div:last-child span { color: var(--gold); text-shadow: 0 0 14px var(--gold); }
.over-stats em { font-style: normal; font-size: 11px; letter-spacing: 2px; color: #7f8bc9; margin-top: 2px; }
.over-btns { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
.submit-status { font-size: 12px; color: #6b76b0; letter-spacing: 1px; min-height: 16px; }

/* ---------- Footer ---------- */
#footer {
  position: absolute; bottom: 8px; left: 0; right: 0;
  text-align: center; z-index: 6; pointer-events: none;
}
#footer a {
  pointer-events: auto;
  font-size: 11px; letter-spacing: 2px; color: rgba(180,190,240,0.5);
  text-decoration: none; text-transform: uppercase;
}
#footer a:hover { color: var(--cyan); }

@media (max-width: 480px) {
  .hud-progress { margin: 4px 8px 0; }
  .over-stats { gap: 26px; }
  .leaderboard { padding: 10px 12px; }
}
</parameter>
</invoke>