:root {
  --bg: #0d0b14;
  --panel: #1c1830;
  --stone: #2a2540;
  --gold: #ffd23f;
  --torch: #ff8c42;
  --teal: #20d2b0;
  --crimson: #e5486a;
  --border: #3a3358;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background:
    radial-gradient(circle at 30% 10%, #241d3d 0%, transparent 55%),
    radial-gradient(circle at 80% 90%, #2b1730 0%, transparent 55%),
    var(--bg);
  color: #e8e4f5;
  font-family: 'VT323', monospace;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#game-wrap {
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* HUD */
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--panel), #14111f);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.4), inset 0 0 20px rgba(143,123,255,0.08);
}
.hud-item { display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.hud-item.left { align-items: flex-start; }
.hud-item.right { align-items: flex-end; }
.hud-item.center { flex: 1; }
.hud-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: #9a92c4;
  margin-bottom: 4px;
}
.hud-val {
  font-family: 'Press Start 2P', monospace;
  font-size: 20px;
  color: var(--gold);
  text-shadow: 0 2px 0 rgba(0,0,0,0.5);
}
#best.hud-val { color: var(--teal); }

.hud-val.pop { animation: pop 0.25s ease; }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.5); color: #fff; }
  100% { transform: scale(1); }
}

.combo {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--torch);
  text-shadow: 0 0 12px rgba(255,140,66,0.7);
  min-height: 14px;
}
.combo.flash { animation: comboFlash 0.4s ease; }
@keyframes comboFlash {
  0% { transform: scale(0.6) rotate(-6deg); opacity: 0.4; }
  50% { transform: scale(1.35) rotate(3deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Stage / canvas */
#stage {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 3px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 8px 0 rgba(0,0,0,0.4),
    inset 0 0 40px rgba(0,0,0,0.6);
  cursor: crosshair;
}
#canvas { display: block; width: 100%; height: 100%; }

#banner {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%) scale(0.6);
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(11px, 3.4vw, 18px);
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255,210,63,0.8), 0 3px 0 rgba(0,0,0,0.7);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
}
#banner.show { animation: banner 2.2s ease forwards; }
@keyframes banner {
  0% { opacity: 0; transform: translateX(-50%) scale(0.4); }
  15% { opacity: 1; transform: translateX(-50%) scale(1.1); }
  25% { transform: translateX(-50%) scale(1); }
  75% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.05); }
}

/* Controls */
#controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  font-family: 'VT323', monospace;
  font-size: 18px;
  background: linear-gradient(180deg, var(--stone), #1a1630);
  color: #e8e4f5;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.4);
  transition: transform 0.08s, background 0.15s;
}
.btn:hover { background: linear-gradient(180deg, #3a3358, #221d3a); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.4); }
#tip {
  font-size: 17px;
  color: #9a92c4;
  margin-left: auto;
}

/* Footer */
#footer {
  text-align: center;
  font-size: 15px;
  color: #6f6899;
  padding: 2px 0 4px;
}
#footer a { color: var(--teal); text-decoration: none; }
#footer a:hover { text-decoration: underline; color: var(--gold); }

@media (max-width: 480px) {
  #tip { display: none; }
  .hud-val { font-size: 16px; }
  .combo { font-size: 9px; }
}
</parameter>