/* ================= RPG BATTLE SYSTEM CSS ================= */

#battle-panel {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  width: 94%;
  max-width: 820px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 0 0 3px #fbbf24, 0 0 20px rgba(251, 191, 36, 0.3);
  padding: 16px 22px;
  z-index: 30;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: #1e293b;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#battle-panel.active {
  transform: translateX(-50%) translateY(0);
}

/* Battle Header: Monster name, level, HP bar */
.battle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed #e2e8f0;
  padding-bottom: 10px;
}

.monster-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.monster-avatar-badge {
  font-size: 26px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.monster-avatar-badge.has-art {
  background-color: #dbeafe;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 90%;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 3px 10px rgba(30, 64, 175, 0.2);
}

.monster-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.monster-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.monster-name {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.monster-diff-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-easy { background: #dcfce7; color: #166534; }
.tag-normal { background: #e0e7ff; color: #3730a3; }
.tag-hard { background: #fee2e2; color: #991b1b; }
.tag-boss { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }

/* Monster HP Bar */
.monster-hp-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.monster-hp-track {
  width: 130px;
  height: 12px;
  background: #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  position: relative;
}

.monster-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.monster-hp-fill.danger {
  background: linear-gradient(90deg, #ef4444, #b91c1c);
}

.monster-hp-text {
  font-size: 12px;
  font-weight: 800;
  color: #64748b;
  min-width: 50px;
}

/* Battle Action / Combo status */
.battle-status-tags {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topic-tag {
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid #bfdbfe;
}

/* Boss Phase Indicator */
.boss-phases {
  display: none;
  align-items: center;
  gap: 4px;
}

.boss-phase-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e2e8f0;
}

.boss-phase-pip.active {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
  transform: scale(1.2);
}

/* Question Section */
.question-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 44px;
}

.question-prompt {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  color: #1e293b;
}

.math-highlight {
  font-family: 'Fredoka', monospace;
  font-weight: 800;
  color: #4338ca;
  background: #ede9fe;
  padding: 2px 8px;
  border-radius: 8px;
  display: inline-block;
}

.fraction {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  padding: 0 4px;
  font-size: 0.95em;
  line-height: 1.1;
}

.fraction .num {
  border-bottom: 2px solid currentColor;
  padding-bottom: 1px;
}

.fraction .den {
  padding-top: 1px;
}

/* Optional Geometry / Visual Container */
#visual-aid {
  display: none;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  margin: 4px 0;
}

/* Answer Choices Cards Grid */
.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.answer-card {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.answer-card:hover {
  border-color: #6366f1;
  background: #f5f3ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.15);
}

.answer-card:active {
  transform: translateY(1px);
}

.answer-card.correct-anim {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
  animation: correct-pulse 0.4s ease;
}

.answer-card.wrong-anim {
  border-color: #ef4444;
  background: #fef2f2;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.3);
  animation: shake 0.4s ease;
}

.answer-key-badge {
  width: 28px;
  height: 28px;
  background: #f1f5f9;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  flex-shrink: 0;
}

.answer-card:hover .answer-key-badge {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
}

.answer-text {
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
  flex: 1;
}

/* Battle Action Bar (Hint button, Keypad toggle) */
.battle-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
}

.hint-toggle-btn {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.hint-toggle-btn:hover {
  background: #fef08a;
  transform: translateY(-1px);
}

.attack-flavor-text {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  font-style: italic;
}

/* Hint Box Drawer */
.hint-box {
  display: none;
  background: #fefce8;
  border-left: 4px solid #facc15;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #713f12;
  line-height: 1.4;
  animation: fadeIn 0.3s ease;
}

.hint-box.show {
  display: block;
}

/* Encounter Banner Floating Announcement */
#encounter-banner {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  border: 3px solid #fbbf24;
  border-radius: 24px;
  padding: 16px 36px;
  text-align: center;
  color: #fff;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(251, 191, 36, 0.5);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#encounter-banner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.encounter-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fef08a;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.encounter-sub {
  font-size: 14px;
  color: #cbd5e1;
  font-weight: 700;
}
