* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #101827 0%, #172033 100%);
  color: #ffffff;
  min-height: 100vh;
}

.battle-page {
  width: min(1100px, 92%);
  margin: 0 auto;
  padding: 24px 0 48px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.top-bar h1 {
  margin: 0;
  font-size: 2rem;
}

.back-link {
  color: #c7d2fe;
  text-decoration: none;
  font-weight: bold;
}

.back-link:hover {
  text-decoration: underline;
}

.battle-arena {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(10px);
  margin-bottom: 24px;
}

.panel {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 16px;
  padding: 16px;
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.panel-top h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.panel-subtext {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.hp-bar {
  width: 100%;
  height: 16px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #84cc16);
  transition: width 0.35s ease;
}

.character-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  min-height: 240px;
  padding: 30px 10px;
}

.character {
  width: 180px;
  height: 180px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: bold;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.enemy-character {
  background: linear-gradient(180deg, #ef4444, #991b1b);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.35);
}

.player-character {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.35);
}

.question-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px;
}

.question-top-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.label {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.streak-display {
  margin: 0;
  font-weight: bold;
  color: #facc15;
}

.question-text {
  margin: 0 0 18px;
  font-size: 2rem;
}

.answer-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.answer-btn {
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  background: #e2e8f0;
  color: #0f172a;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease;
}

.answer-btn:hover {
  transform: translateY(-2px);
}

.answer-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.answer-btn.correct {
  background: #22c55e;
  color: #ffffff;
}

.answer-btn.wrong {
  background: #ef4444;
  color: #ffffff;
}

.answer-btn.reveal-correct {
  background: #16a34a;
  color: #ffffff;
}

.answer-btn.correct,
.answer-btn.wrong,
.answer-btn.reveal-correct {
  transform: scale(1.04);
  transition: transform 0.15s ease;
}

.feedback-text {
  min-height: 28px;
  margin: 18px 0 0;
  font-size: 1rem;
  color: #e2e8f0;
}

.end-screen {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.end-card {
  width: min(420px, 92%);
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 28px;
  text-align: center;
}

.end-card h2 {
  margin-top: 0;
  font-size: 2rem;
}

.restart-btn {
  border: none;
  border-radius: 14px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  background: #22c55e;
  color: white;
}

.hidden {
  display: none;
}

.hit {
  animation: hitShake 0.35s ease;
}

.flash-damage {
  animation: damageFlash 0.35s ease;
}

@keyframes hitShake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
  100% { transform: translateX(0); }
}

@keyframes damageFlash {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.8); }
  100% { filter: brightness(1); }
}

@media (max-width: 700px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .character-row {
    min-height: 180px;
  }

  .character {
    width: 130px;
    height: 130px;
    font-size: 1rem;
  }

  .question-text {
    font-size: 1.6rem;
  }

  .answer-buttons {
    grid-template-columns: 1fr;
  }

  .question-top-row {
    flex-direction: column;
    align-items: flex-start;
  }
}