/* ============================================================
 * battle.css — 戰鬥畫面樣式（第七階段）
 * AI許願師－iPAS AI考證大冒險
 * ============================================================ */

.battle {
  width: min(760px, 100vw);
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 16px;
  gap: 10px;
}
body.has-debug .battle { padding-bottom: 60px; }   /* 開發模式避開測試列 */

/* ---------- Boss 區 ---------- */
.battle__boss {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 4px;
}
.battle__boss-figure {
  font-size: clamp(3rem, 9vw, 4.6rem);
  line-height: 1;
  filter: drop-shadow(0 0 18px var(--boss-color, #a56bff));
  animation: boss-idle 2.6s ease-in-out infinite;
}
@keyframes boss-idle {
  50% { transform: translateY(-8px) scale(1.04); }
}
/* Boss 受擊：白閃＋抖動 */
.battle__boss-figure--hit {
  animation: boss-hit 0.45s ease;
}
@keyframes boss-hit {
  0%   { transform: translateX(0) scale(1); filter: drop-shadow(0 0 30px #fff) brightness(3); }
  25%  { transform: translateX(-10px) scale(0.96); }
  50%  { transform: translateX(8px) scale(1.02); }
  75%  { transform: translateX(-5px); }
  100% { transform: translateX(0); filter: drop-shadow(0 0 18px var(--boss-color)); }
}
/* Boss 狂暴狀態：紅光＋加速晃動 */
.battle__boss-figure--enraged {
  filter: drop-shadow(0 0 24px var(--danger)) saturate(1.6);
  animation: boss-enraged 0.8s ease-in-out infinite;
}
@keyframes boss-enraged {
  0%, 100% { transform: translateY(0) scale(1.08) rotate(-2deg); }
  50% { transform: translateY(-10px) scale(1.12) rotate(2deg); }
}
.battle__boss-info { flex: 1; min-width: 0; }
.battle__boss-name {
  margin-bottom: 6px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--danger);
  text-shadow: 0 0 8px rgba(255, 84, 112, 0.6);
}

/* ---------- 題目卡 ---------- */
.battle__question {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}
.battle__q-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.battle__q-text {
  margin-bottom: 14px;
  font-size: 1rem;
  line-height: 1.8;
  font-weight: 700;
}

/* ---------- 玩家狀態列 ---------- */
.battle__player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-panel);
  border: 2px solid rgba(77, 141, 255, 0.5);
  border-radius: var(--radius);
}
.battle__player-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.battle__avatar {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  overflow: hidden;
  background: var(--bg-mid);
}
.battle__avatar img, .battle__avatar svg { width: 100%; height: 100%; }
.battle__avatar .teacher-img { object-fit: cover; transform: scale(2); transform-origin: 50% 24%; }
.battle__avatar .teacher-photo { object-fit: cover; object-position: 50% 40%; }
.battle__player-bars { flex: 1; min-width: 0; }
.battle__player-name {
  margin-bottom: 4px;
  font-size: 0.85rem;
  font-weight: 700;
}
.battle__buff {
  margin-left: 8px;
  color: var(--gold);
  font-size: 0.8rem;
}
.battle__player-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* 技能按鈕：充能完成後金光呼吸 */
.battle__skill { line-height: 1.3; }
.battle__skill--ready {
  border-color: var(--gold) !important;
  animation: skill-ready 1s ease-in-out infinite;
}
@keyframes skill-ready {
  50% { box-shadow: 0 0 18px rgba(255, 213, 74, 0.9); transform: scale(1.05); }
}

/* ---------- 受傷紅閃（掛在 .battle 的父層 screen root） ---------- */
.battle--hurt::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 40, 70, 0.35) 100%);
  animation: hurt-flash 0.5s ease both;
}
@keyframes hurt-flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- 手機 ---------- */
@media (max-width: 560px) {
  .battle { padding: 8px 8px 60px; }
  .battle__player { flex-wrap: wrap; }
  .battle__player-right { width: 100%; justify-content: space-between; }
}
