/* Rune Spark: Neo-Arcane Glassmorphism & High-Precision HUD */
:root {
  --bg-dark: #050714;
  --cyan-arcane: #00f5ff;
  --cyan-glow: rgba(0, 245, 255, 0.4);
  --gold-arcane: #ffd166;
  --gold-glow: rgba(255, 209, 102, 0.45);
  --fire-crimson: #ff3366;
  --fire-glow: rgba(255, 51, 102, 0.45);
  --lightning-yellow: #ffee55;
  --refresh-green: #06d6a0;
  --purple-arcane: #9d4edd;
  --hud-bg: rgba(9, 14, 30, 0.82);
  --card-bg: rgba(14, 20, 44, 0.9);
  --font-cyber: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', Consolas, Monaco, monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: #e0f2fe;
  font-family: var(--font-cyber);
  touch-action: none;
  overscroll-behavior: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 25%, #0f1738 0%, #050714 85%);
}

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

/* TOP HUD (BOSS & PLAYER STATS) */
#top-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}

.boss-bar-container {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 51, 102, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.boss-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.boss-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ff3366;
  display: flex;
  align-items: center;
  gap: 6px;
}

.boss-intent {
  font-size: 11px;
  color: var(--gold-arcane);
  background: rgba(255, 209, 102, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 209, 102, 0.3);
}

.hp-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.hp-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff3366, #ff8844);
  box-shadow: 0 0 10px var(--fire-glow);
  transition: width 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.hud-chips-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  font-family: var(--font-mono);
}

.hud-chip {
  background: var(--hud-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid rgba(0, 245, 255, 0.25);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.hud-chip.stage {
  color: var(--cyan-arcane);
  border-color: var(--cyan-glow);
}

.hud-chip.damage {
  color: var(--gold-arcane);
  border-color: var(--gold-glow);
}

.hud-chip.orbs {
  color: #06d6a0;
  border-color: rgba(6, 214, 160, 0.35);
}

/* TOP RIGHT QUICK BUTTONS */
.hud-btn-group {
  position: absolute;
  top: 14px;
  right: 18px;
  display: flex;
  gap: 8px;
  z-index: 12;
  pointer-events: auto;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--hud-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: all 0.2s;
}

.icon-btn:hover, .icon-btn:active {
  color: var(--cyan-arcane);
  border-color: var(--cyan-arcane);
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* BOTTOM HUD & MANUAL FIRE BUTTON */
#bottom-hud {
  position: absolute;
  bottom: 22px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 15;
}

.fire-btn {
  pointer-events: auto;
  padding: 12px 36px;
  border-radius: 28px;
  background: linear-gradient(135deg, #00f5ff, #0077ff);
  border: 1.5px solid #ffffff;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 4px 20px var(--cyan-glow);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fire-btn:active {
  transform: scale(0.94);
  box-shadow: 0 0 30px var(--cyan-arcane);
}

.fire-btn.disabled {
  opacity: 0.45;
  background: #334155;
  border-color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}

/* MODAL OVERLAYS */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 6, 16, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--card-bg);
  border: 1.5px solid rgba(0, 245, 255, 0.35);
  border-radius: 22px;
  padding: 30px 24px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 245, 255, 0.15);
  animation: modalScale 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.2);
}

@keyframes modalScale {
  0% { transform: scale(0.9) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 8px;
  background: linear-gradient(120deg, #fff, var(--cyan-arcane), var(--gold-arcane));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-subtitle {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 22px;
  line-height: 1.5;
}

/* RELIC SELECTION CARDS */
.relics-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
}

.relic-card {
  background: rgba(18, 26, 52, 0.8);
  border: 1.5px solid rgba(0, 245, 255, 0.25);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 14px;
}

.relic-card:hover, .relic-card:active {
  background: rgba(26, 42, 85, 0.95);
  border-color: var(--cyan-arcane);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 22px var(--cyan-glow);
}

.relic-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(0, 245, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 245, 255, 0.3);
}

.relic-info {
  flex: 1;
}

.relic-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.relic-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 209, 102, 0.2);
  color: var(--gold-arcane);
  font-family: var(--font-mono);
}

.relic-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

/* STATS GRID & BUTTONS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 18px 0;
  font-family: var(--font-mono);
}

.stat-box {
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-label {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
}

.stat-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--cyan-arcane);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #00f5ff, #0077ff);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 245, 255, 0.4);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover, .btn-primary:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 245, 255, 0.6);
}

.controls-hint {
  font-size: 11px;
  color: #64748b;
  margin-top: 14px;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .modal-content {
    padding: 24px 18px;
  }
  .modal-title {
    font-size: 24px;
  }
  .relic-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}
