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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #06020a;
  color: #fdf4ff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Space Grotesk", sans-serif;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at center, #1b0728 0%, #06020a 100%);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* TOP HUD */
#hud-top {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
  gap: 12px;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vital-bar {
  background: rgba(18, 5, 28, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(168, 85, 247, 0.35);
  padding: 8px 14px;
  border-radius: 10px;
  width: 220px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.vital-label {
  font-size: 9px;
  font-weight: 800;
  color: #c084fc;
  letter-spacing: 0.8px;
}

.vital-val {
  font-size: 10px;
  font-weight: 900;
  color: #fca5a5;
  font-family: monospace;
}

.bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

#hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #dc2626, #ef4444);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  border-radius: 3px;
  transition: width 0.12s ease;
}

#dash-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
  border-radius: 3px;
  transition: width 0.08s linear;
}

/* Combo Pill */
.combo-pill {
  background: rgba(18, 5, 28, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(236, 72, 153, 0.4);
  border-radius: 20px;
  padding: 6px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.combo-label {
  font-size: 8px;
  font-weight: 800;
  color: #f472b6;
  letter-spacing: 1px;
}

.combo-num {
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace;
}

/* Stat Badges */
.hud-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-badge {
  background: rgba(18, 5, 28, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(168, 85, 247, 0.35);
  padding: 8px 14px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 110px;
}

.badge-tag {
  font-size: 8px;
  font-weight: 800;
  color: #a855f7;
  letter-spacing: 0.8px;
}

.badge-val {
  font-size: 16px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace;
}

/* OVERLAYS */
.overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(22, 6, 36, 0.94) 0%, rgba(6, 2, 12, 0.98) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.card {
  background: rgba(26, 8, 42, 0.92);
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 480px;
  width: 92%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(168, 85, 247, 0.25);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #c084fc, #ec4899, transparent);
}

.abyss-badge {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid #c084fc;
  color: #f3e8ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  border-radius: 30px;
  margin-bottom: 12px;
}

.menu-title {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffffff;
  margin-bottom: 4px;
  text-shadow: 0 0 16px rgba(192, 132, 252, 0.7);
}

.subtitle {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #c084fc;
  margin-bottom: 12px;
}

.desc {
  font-size: 13px;
  line-height: 1.5;
  color: #e9d5ff;
  margin-bottom: 20px;
}

.controls-guide {
  background: rgba(12, 3, 20, 0.7);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-around;
  gap: 16px;
  text-align: left;
}

.guide-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-item {
  color: #f3e8ff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  font-family: monospace;
}

.btn-start {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 50%, #6b21a8 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 14px 28px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);
  transition: all 0.2s ease;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(168, 85, 247, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  padding: 12px 24px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 24px;
}

.stat-card {
  background: rgba(12, 3, 20, 0.65);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 9px;
  font-weight: 700;
  color: #c084fc;
  letter-spacing: 0.8px;
}

.stat-val {
  font-size: 20px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace;
  margin-top: 4px;
}

.stat-val.highlight {
  color: #f472b6;
  font-size: 24px;
}

/* TOUCH CONTROLS */
#touch-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 20;
}

@media (pointer: coarse), (max-width: 820px) {
  #touch-controls {
    display: flex;
  }
}

.dpad-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
}

.dpad-mid {
  display: flex;
  gap: 24px;
}

.dpad-btn {
  background: rgba(26, 8, 42, 0.8);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #ffffff;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
}

.action-box {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.act-btn {
  background: rgba(26, 8, 42, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #ffffff;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
}

.red-btn {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.6);
  width: 68px;
  height: 68px;
}

.blue-btn {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
}

.purple-btn {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.6);
}
