#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #06040f;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ============ HUD ============ */
#hud[hidden] { display: none; }
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  z-index: 20;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.hud-best { align-items: flex-end; text-align: right; }

.hud-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(230, 235, 255, 0.55);
  font-weight: 600;
}
.hud-value {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #eafcff;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.55);
}

#top-controls {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  pointer-events: auto;
  z-index: 21;
}

.icon-btn[hidden] { display: none; }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 4, 16, 0.62);
  border: 1px solid rgba(0, 229, 255, 0.35);
  color: #eafcff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.active { background: rgba(0, 229, 255, 0.28); border-color: #00e5ff; }

.hud-gold-line {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
  color: #ffd23f;
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.55);
}
.hud-gold-line.gold-pulse { animation: goldPulse 0.4s ease; }
@keyframes goldPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); color: #fff3c4; }
  100% { transform: scale(1); }
}

/* ============ SKILL TRAY ============ */
.skill-tray[hidden] { display: none; }
.skill-tray {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 90vw;
}
.skill-chip {
  --chip-color: #00e5ff;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(6, 4, 16, 0.65);
  border: 1px solid var(--chip-color);
  box-shadow: 0 0 10px color-mix(in srgb, var(--chip-color) 55%, transparent);
  font-size: 11px;
  font-weight: 700;
}
.skill-chip-icon { font-size: 13px; }
.skill-chip-time { color: #eafcff; font-variant-numeric: tabular-nums; }

/* ============ SKILL ACTIVATION BANNER ============ */
.skill-banner[hidden] { display: none; }
.skill-banner {
  --banner-color: #00e5ff;
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(6, 4, 16, 0.7);
  border: 1px solid var(--banner-color);
  box-shadow: 0 0 26px color-mix(in srgb, var(--banner-color) 60%, transparent);
  z-index: 25;
  pointer-events: none;
}
.skill-banner-icon { font-size: 24px; }
.skill-banner-label {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #eafcff;
}
.skill-banner-anim { animation: skillBannerPop 1.4s ease; }
@keyframes skillBannerPop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  25% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

.combo-badge[hidden] { display: none; }
.combo-badge {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff2fb0, #ff7a1a);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  box-shadow: 0 0 18px rgba(255, 47, 176, 0.65);
  animation: comboPulse 0.35s ease;
}
@keyframes comboPulse {
  0% { transform: translateX(-50%) scale(0.6); opacity: 0; }
  60% { transform: translateX(-50%) scale(1.12); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ============ TOUCH CONTROLS ============ */
#touch-controls[hidden] { display: none; }
#touch-controls {
  position: absolute;
  bottom: 22px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 20;
  pointer-events: none;
}
.touch-btn {
  pointer-events: auto;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(6, 4, 16, 0.55);
  border: 1px solid rgba(0, 229, 255, 0.35);
  color: #eafcff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.touch-btn:active { background: rgba(0, 229, 255, 0.3); transform: scale(0.94); }

/* ============ COUNTDOWN ============ */
#countdown-screen[hidden] { display: none; }
#countdown-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  pointer-events: none;
}
#countdown-number {
  font-size: 120px;
  font-weight: 900;
  color: #00e5ff;
  text-shadow: 0 0 40px rgba(0, 229, 255, 0.85);
  animation: countdownPop 1s ease;
}
@keyframes countdownPop {
  0% { transform: scale(0.4); opacity: 0; }
  30% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 0.15; }
}

@media (prefers-reduced-motion: reduce) {
  .combo-badge, #countdown-number, .skill-banner-anim, .gold-pulse { animation: none; }
}
