/* ═══════════════════════════════════════════════════════
   KPOP DEMON HUNTER — Style
   Dark concert stage + neon supernatural theme
   Full SVG/CSS graphics — no emoji
   ═══════════════════════════════════════════════════════ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --pink: #FF2D78;
  --purple: #B026FF;
  --cyan: #00F0FF;
  --gold: #FFD700;
  --dark-bg: #0a0a14;
  --dark-surface: #12122a;
  --dark-card: #161636;
  --text: #e8e8f0;
  --text-dim: #7777aa;
  --danger: #ff4444;
  --success: #44ff88;
  --bar-bg: #1e1e3a;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--dark-bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(176, 38, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(255, 45, 120, 0.06) 0%, transparent 50%);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ---------- Screens ---------- */
.screen {
  display: none;
  min-height: 100dvh;
  padding: 1rem;
}
.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- START SCREEN ---------- */
.start-container {
  text-align: center;
  max-width: 500px;
  width: 100%;
}

.title-glow {
  margin-bottom: 1.5rem;
}

.logo-icon {
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 15px rgba(176, 38, 255, 0.5));
}

.game-title {
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 3px;
  background: linear-gradient(135deg, var(--pink), var(--purple), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(176, 38, 255, 0.4));
  animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(176, 38, 255, 0.4)); }
  50% { filter: drop-shadow(0 0 35px rgba(255, 45, 120, 0.6)); }
}

.game-subtitle {
  font-size: 1rem;
  color: var(--cyan);
  margin-top: 0.5rem;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
  letter-spacing: 1px;
}

.start-narrative {
  background: var(--dark-card);
  border: 1px solid rgba(176, 38, 255, 0.2);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-dim);
  font-style: italic;
}

.start-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
}

.start-form label {
  font-size: 0.95rem;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.25);
}

.start-form input {
  width: 100%;
  max-width: 300px;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(176, 38, 255, 0.4);
  border-radius: 8px;
  background: var(--dark-surface);
  color: var(--text);
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.start-form input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 20px rgba(255, 45, 120, 0.3);
}

.high-score-display {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--gold);
  opacity: 0.8;
}

/* ---------- BUTTONS ---------- */
.btn-neon {
  display: inline-block;
  padding: 0.75rem 2rem;
  border: 2px solid;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.btn-pink {
  border-color: var(--pink);
  box-shadow: 0 0 12px rgba(255, 45, 120, 0.15), inset 0 0 12px rgba(255, 45, 120, 0.08);
}
.btn-pink:hover, .btn-pink:active {
  background: rgba(255, 45, 120, 0.15);
  box-shadow: 0 0 25px rgba(255, 45, 120, 0.35), inset 0 0 15px rgba(255, 45, 120, 0.15);
  transform: scale(1.03);
}

.btn-cyan {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15), inset 0 0 12px rgba(0, 240, 255, 0.08);
}
.btn-cyan:hover, .btn-cyan:active {
  background: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.35), inset 0 0 15px rgba(0, 240, 255, 0.15);
  transform: scale(1.03);
}

.btn-gold {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.15), inset 0 0 12px rgba(255, 215, 0, 0.08);
}
.btn-gold:hover, .btn-gold:active {
  background: rgba(255, 215, 0, 0.15);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.35), inset 0 0 15px rgba(255, 215, 0, 0.15);
  transform: scale(1.03);
}

.btn-neon:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- GAME SCREEN ---------- */
#screen-game.active {
  align-items: flex-start;
  padding-top: 0.8rem;
}

.game-container {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  position: relative;
}

/* ---------- HUD ---------- */
.hud {
  background: var(--dark-card);
  border-radius: 12px;
  padding: 0.6rem 1rem;
  margin-bottom: 0.8rem;
  border: 1px solid rgba(176, 38, 255, 0.15);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.hud-header-row {
  padding-bottom: 0.3rem;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid rgba(176, 38, 255, 0.1);
}

.hud-player-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--pink);
  text-shadow: 0 0 8px rgba(255, 45, 120, 0.4);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.hud-row + .hud-row {
  margin-top: 0.35rem;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
}

.hud-icon {
  flex-shrink: 0;
}


.hud-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hud-tier {
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.3);
}

.hud-combo {
  font-size: 0.8rem;
  color: var(--pink);
  font-weight: 700;
  min-width: 50px;
  text-align: right;
}

.hud-combo.combo-fire {
  animation: comboFire 0.5s ease-in-out;
  text-shadow: 0 0 10px rgba(255, 45, 120, 0.8);
}

@keyframes comboFire {
  0% { transform: scale(1); }
  50% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* ---------- Bars ---------- */
.bar-container {
  flex: 1;
  height: 18px;
  background: var(--bar-bg);
  border-radius: 9px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.bar-fill {
  height: 100%;
  border-radius: 9px;
  transition: width 0.5s ease;
  position: relative;
}

.bar-fill::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 4px;
  right: 4px;
  height: 40%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent);
  border-radius: 8px;
}

.bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.6rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  letter-spacing: 0.5px;
}

.bar-hp .bar-fill {
  background: linear-gradient(90deg, #cc1155, var(--pink), #ff6bab);
  box-shadow: inset 0 0 8px rgba(255, 45, 120, 0.5);
}

.bar-xp .bar-fill {
  background: linear-gradient(90deg, #cc9900, var(--gold), #ffe066);
  box-shadow: inset 0 0 8px rgba(255, 215, 0, 0.5);
}

.bar-demon .bar-fill {
  background: linear-gradient(90deg, #8811cc, var(--purple), #d066ff);
  box-shadow: inset 0 0 8px rgba(176, 38, 255, 0.5);
}

.bar-demon {
  height: 10px;
  max-width: 180px;
  margin: 0.3rem auto 0;
}

/* ---------- STAGE TRACK ---------- */
.stage-track {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0;
  gap: 0;
}

.stage-track svg {
  width: 100%;
  max-width: 400px;
  height: 32px;
}

/* ---------- DEMON AREA ---------- */
.demon-area {
  text-align: center;
  padding: 1rem 1rem 0.8rem;
  margin-bottom: 0.8rem;
  background: var(--dark-card);
  border-radius: 12px;
  border: 1px solid rgba(176, 38, 255, 0.15);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

/* Ambient glow behind demon */
.demon-area::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(176, 38, 255, 0.15), transparent 70%);
  pointer-events: none;
  border-radius: 50%;
}

.demon-sprite {
  width: 120px;
  height: 120px;
  margin: 0 auto 0.3rem;
  position: relative;
  z-index: 1;
  transition: transform 0.3s, filter 0.3s;
}

.demon-sprite svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 10px rgba(176, 38, 255, 0.4));
}

.demon-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--purple);
  text-shadow: 0 0 8px rgba(176, 38, 255, 0.4);
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}

.demon-flavor {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 0.15rem;
}

/* Demon hit animation */
.demon-hit .demon-sprite {
  animation: demonHit 0.5s ease;
}

@keyframes demonHit {
  0% { transform: scale(1); filter: brightness(1); }
  15% { transform: scale(0.85) rotate(-8deg); filter: brightness(3) saturate(2); }
  40% { transform: scale(1.1) rotate(4deg); filter: brightness(1.5); }
  70% { transform: scale(0.95); filter: brightness(1.2); }
  100% { transform: scale(1) rotate(0); filter: brightness(1); }
}

/* Demon shatter */
.demon-shatter .demon-sprite {
  animation: demonShatter 0.8s ease forwards;
}

@keyframes demonShatter {
  0% { transform: scale(1); opacity: 1; filter: brightness(1); }
  25% { transform: scale(1.2); opacity: 1; filter: brightness(4) hue-rotate(90deg); }
  50% { transform: scale(1.4); opacity: 0.5; filter: brightness(5) hue-rotate(180deg); }
  100% { transform: scale(0.2); opacity: 0; filter: brightness(8) blur(5px); }
}

/* ---------- ROULETTE WHEEL ---------- */
.wheel-section {
  text-align: center;
  margin-bottom: 0.8rem;
}

.wheel-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 0.6rem;
}

.wheel-pointer-wrap {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.6));
}

.wheel-canvas {
  border-radius: 50%;
  filter: drop-shadow(0 0 15px rgba(176, 38, 255, 0.35));
  transition: transform 0.05s;
}

.wheel-canvas.spinning {
  transition: transform 4s cubic-bezier(0.15, 0.85, 0.25, 1);
}

/* ---------- CHALLENGE AREA ---------- */
.challenge-area {
  background: var(--dark-card);
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 0.8rem;
  border: 1px solid rgba(0, 240, 255, 0.15);
  text-align: center;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.challenge-type {
  font-size: 0.8rem;
  color: var(--cyan);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}

.challenge-prompt {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

.answer-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.8rem;
}

.answer-input {
  width: 100%;
  max-width: 320px;
  padding: 0.7rem 1rem;
  border: 2px solid rgba(176, 38, 255, 0.3);
  border-radius: 8px;
  background: var(--dark-surface);
  color: var(--text);
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.answer-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.answer-input.correct {
  border-color: var(--success);
  box-shadow: 0 0 15px rgba(68, 255, 136, 0.3);
}

.answer-input.wrong {
  border-color: var(--danger);
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.3);
}

/* ---------- FEEDBACK AREA ---------- */
.feedback-area {
  background: var(--dark-card);
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 0.8rem;
  text-align: center;
  border: 1px solid rgba(176, 38, 255, 0.15);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.feedback-message {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feedback-message.correct {
  color: var(--success);
  text-shadow: 0 0 10px rgba(68, 255, 136, 0.4);
}

.feedback-message.wrong {
  color: var(--danger);
  text-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}

.feedback-correct {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
  line-height: 1.5;
}

.feedback-expected {
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid rgba(255, 68, 68, 0.25);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 0.6rem;
  font-size: 1.1rem;
  color: var(--gold);
}

.feedback-expected .expected-label {
  display: block;
  font-size: 0.7rem;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.3rem;
}

.feedback-verb-table {
  text-align: left;
  margin: 0.5rem auto;
  max-width: 320px;
  font-size: 0.8rem;
  line-height: 1.8;
}

/* ---------- OVERLAYS ---------- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-content {
  background: var(--dark-card);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.levelup-content {
  border: 2px solid var(--gold);
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.2);
}

.levelup-content h2 {
  font-size: 1.3rem;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
  margin-bottom: 0.5rem;
  letter-spacing: 2px;
}

.levelup-icon {
  margin-bottom: 0.3rem;
  animation: starsFloat 1s ease-in-out infinite alternate;
}

@keyframes starsFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.levelup-hp {
  font-size: 0.85rem;
  color: var(--pink);
  margin: 0.5rem 0 1rem;
}

.defeated-content {
  border: 2px solid var(--cyan);
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.2);
}

.defeated-content h2 {
  font-size: 1.3rem;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
  margin-bottom: 0.5rem;
  letter-spacing: 2px;
}

.defeated-icon {
  margin-bottom: 0.3rem;
}

/* ---------- GAME OVER SCREEN ---------- */
.gameover-container {
  text-align: center;
  max-width: 500px;
  width: 100%;
}

.gameover-icon {
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 15px rgba(255, 68, 68, 0.4));
}

.gameover-title {
  font-size: 1.8rem;
  color: var(--danger);
  text-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
  margin-bottom: 1.5rem;
  letter-spacing: 2px;
}

.gameover-stats {
  background: var(--dark-card);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(176, 38, 255, 0.15);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  color: var(--text-dim);
}

.stat-value {
  color: var(--gold);
  font-weight: 700;
}

.gameover-record {
  font-size: 1.2rem;
  color: var(--gold);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
  margin-bottom: 1rem;
  animation: recordPulse 0.8s ease-in-out infinite alternate;
  letter-spacing: 2px;
  text-transform: uppercase;
}

@keyframes recordPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* ---------- VICTORY SCREEN ---------- */
.victory-container {
  text-align: center;
  max-width: 500px;
  width: 100%;
}

.victory-icon {
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
  animation: starsFloat 1.5s ease-in-out infinite alternate;
}

.victory-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(135deg, var(--gold), #ffaa00, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.4));
  margin-bottom: 0.3rem;
}

.victory-subtitle {
  font-size: 0.95rem;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
  margin-bottom: 1.5rem;
}

/* ---------- ATTACK EFFECTS ---------- */
.attack-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

.beam-svg {
  width: 100%;
  height: 100%;
}

#effect-beam.active {
  display: block !important;
  animation: beamFlash 0.6s ease-out forwards;
}

@keyframes beamFlash {
  0% { opacity: 0; transform: scaleX(0.5); }
  20% { opacity: 1; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1.5); }
}

#effect-dark.active {
  display: block !important;
  animation: darkWave 0.5s ease-out forwards;
  background: radial-gradient(circle at 50% 40%, rgba(120, 0, 0, 0.5), transparent 60%);
}

@keyframes darkWave {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

/* Screen shake */
.screen-shake {
  animation: screenShake 0.4s ease;
}

@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px) translateY(2px); }
  30% { transform: translateX(6px) translateY(-2px); }
  45% { transform: translateX(-4px) translateY(1px); }
  60% { transform: translateX(4px) translateY(-1px); }
  75% { transform: translateX(-2px); }
}

/* ---------- PARTICLES ---------- */
#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg) scale(0.5); opacity: 0; }
}

/* Sparkle particles for correct answers */
.sparkle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkleFloat 0.8s ease-out forwards;
}

@keyframes sparkleFloat {
  0% { transform: scale(0) translateY(0); opacity: 1; }
  50% { transform: scale(1.5) translateY(-20px); opacity: 1; }
  100% { transform: scale(0) translateY(-40px); opacity: 0; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 480px) {
  .game-title {
    font-size: 2.2rem;
  }

  .wheel-canvas {
    width: 220px;
    height: 220px;
  }

  .demon-sprite {
    width: 100px;
    height: 100px;
  }

  .challenge-prompt {
    font-size: 1.2rem;
  }

  .hud {
    padding: 0.5rem 0.7rem;
  }

  .btn-neon {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
  }

  .logo-icon svg {
    width: 80px;
    height: 80px;
  }
}

@media (max-width: 360px) {
  html {
    font-size: 14px;
  }

  .wheel-canvas {
    width: 190px;
    height: 190px;
  }
}
