* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #050d0c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #f8fafc;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background-color: #050d0c;
}

#stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: grab;
}

#stage:active {
  cursor: grabbing;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* SlayArcade-tier Minimalist Floating Glassmorphism HUD (Top-Left) */
#slay-hud {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20;
  pointer-events: none;
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.icon-tool-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.15s ease;
}

.icon-tool-btn:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.icon-tool-btn:active {
  transform: translateY(1px);
}

.hud-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.hud-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.theme-pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
}

.hud-score-card {
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: fit-content;
  min-width: 90px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.score-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.star-glyph {
  color: #f59e0b;
  font-size: 15px;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.6));
}

.score-num {
  font-size: 20px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.best-subtext {
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.04em;
  margin-top: 3px;
}

.hud-progress-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 10px;
  backdrop-filter: blur(12px);
  width: 130px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #34d399;
  border-radius: 9999px;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

/* Floating Combo Banner */
#combo-banner {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  padding: 6px 20px;
  border-radius: 9999px;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.7);
  z-index: 25;
  pointer-events: none;
  animation: pulseCombo 0.4s infinite alternate;
}

@keyframes pulseCombo {
  0% { transform: translateX(-50%) scale(0.96); }
  100% { transform: translateX(-50%) scale(1.06); }
}

.hidden {
  display: none !important;
}

/* Modal Overlays */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 10, 15, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  padding: 16px;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 28px;
  border-radius: 20px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.hero-ball, .hero-fire {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.game-title, .modal-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 8px;
}

.game-subtitle, .modal-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.45;
  margin-bottom: 20px;
}

.rules-box {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.rule-item {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.4;
}

.rule-item b {
  color: #ffffff;
}

.action-btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.primary-btn {
  background: #38bdf8;
  color: #0f172a;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.4);
}

.primary-btn:hover {
  background: #7dd3fc;
  transform: translateY(-2px);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 10px;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.danger-card .danger-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.stars-row {
  display: flex;
  gap: 8px;
  font-size: 28px;
  color: #f59e0b;
  margin-bottom: 12px;
}

.stats-box {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #94a3b8;
}

.stat-row b {
  color: #ffffff;
}
