.quest {
  max-width: 720px;
  margin: 1rem auto 3rem;
  padding: 0 1rem;
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--card);
  border: 3px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(10px);
}

.panel.hidden { display: none; }

.panel h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.1em;
}

.tagline {
  margin: 0 0 1.5rem;
  color: var(--text-soft);
  font-weight: 600;
}

.row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}

.setup-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}

.row select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: white;
  color: #1f1b2e;
  cursor: pointer;
}

.btn-primary {
  font: inherit;
  font-weight: 800;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
  font-size: 1.1rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover { transform: translateY(-3px) scale(1.03); }

.btn-secondary {
  display: inline-block;
  margin-left: 0.75rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--card-border);
  font-weight: 700;
}

/* HUD */
.battle-header {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 0.5rem;
}

.hud-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  font-weight: 700;
}

.hud-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

/* Creature */
.creature-stage {
  margin: 1rem 0 1.5rem;
}

.creature {
  font-size: clamp(4rem, 12vw, 6rem);
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s ease;
  user-select: none;
}

.creature.hit { animation: shake 0.4s ease; }
.creature.defeated { animation: defeat 0.6s ease forwards; }
.creature.appear { animation: appear 0.5s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-12px) rotate(-6deg); }
  40% { transform: translateX(12px) rotate(6deg); }
  60% { transform: translateX(-8px) rotate(-3deg); }
  80% { transform: translateX(8px) rotate(3deg); }
}

@keyframes defeat {
  0%   { transform: scale(1) rotate(0); opacity: 1; }
  100% { transform: scale(0.3) rotate(360deg); opacity: 0; }
}

@keyframes appear {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.hp-bar {
  width: 80%;
  max-width: 320px;
  height: 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  margin: 0.75rem auto 0.25rem;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff5c5c, #ffb347);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.hp-label {
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 700;
}

/* Problem & choices */
.problem {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  margin: 1.5rem 0;
  color: var(--text);
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 0 auto;
  max-width: 420px;
}

.choice-btn {
  font: inherit;
  font-size: 1.4rem;
  font-weight: 800;
  padding: 1rem;
  border-radius: 16px;
  border: 3px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.2s ease;
}

.choice-btn:hover { transform: translateY(-3px); border-color: var(--primary); }
.choice-btn.correct { background: linear-gradient(135deg, #b3ebbf, #6cce85); color: #0a3a17; }
.choice-btn.wrong   { background: linear-gradient(135deg, #ffb6b6, #ff6e6e); color: #5a0a0a; }
.choice-btn:disabled { cursor: default; }

.feedback {
  min-height: 1.5em;
  font-weight: 700;
  margin-top: 1rem;
  font-size: 1.1rem;
}
.feedback.good { color: #2e8b3a; }
.feedback.bad  { color: #b32b2b; }
