/* boss-battle.css - boss battles on scored tests (boss-battle.js). Calm house colours, line-drawn bosses. */

/* the panel takes its own row at the end of the question header (exam.css lets .ex-qhead wrap) */
.ex-qhead > .ex-hook[data-hook="boss-hud"] { order: 20; flex: 1 0 100%; display: block; }

.mt-boss-hud { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r-md, 12px);
  background: #f7f8fb; border: 1px solid var(--line); color: var(--ink); }
.mt-boss-sprite { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--violet-soft); color: var(--violet); }
.mt-boss-sprite svg { width: 24px; height: 24px; display: block; }
.mt-boss-sprite.is-down { background: var(--go-soft); color: var(--go-deep); }
.mt-boss-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.mt-boss-line { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.mt-boss-name { font-size: .88rem; font-weight: 700; color: var(--violet-deep); }
.mt-boss-status { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.mt-boss-hud.is-won .mt-boss-status { color: var(--go-deep); }

.mt-hp { display: block; height: 8px; border-radius: 99px; background: #e4e8ef; overflow: hidden; }
.mt-hp-fill { display: block; height: 100%; border-radius: inherit; background: var(--coral); transition: width .6s cubic-bezier(.25, .8, .3, 1); }
.mt-boss-hud.is-won .mt-hp-fill { background: var(--go); }

/* a hit: the boss flinches and the marks taken float up */
.mt-boss-sprite.is-hit { animation: mtBossHit .45s ease-out; }
@keyframes mtBossHit { 0% { transform: none; } 25% { transform: translateX(-3px) rotate(-6deg); background: var(--coral-soft); } 60% { transform: translateX(2px) rotate(3deg); } 100% { transform: none; } }
.mt-boss-dmg { position: absolute; left: 34px; top: 2px; font-weight: 800; font-size: .85rem; color: var(--coral); opacity: 0; pointer-events: none; }
.mt-boss-dmg.is-on { animation: mtDmg .85s ease-out forwards; }
@keyframes mtDmg { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-12px); } }

/* papers marked at the end: just the boss and the instruction */
.mt-boss-hud.is-paper { padding: 6px 12px; }
.mt-boss-hud.is-paper .mt-boss-sprite { width: 30px; height: 30px; }
.mt-boss-hud.is-paper .mt-boss-sprite svg { width: 19px; height: 19px; }
.mt-boss-hud.is-calm { background: transparent; border-style: dashed; }

/* results */
.mt-boss-result { display: flex; align-items: flex-start; gap: 18px; padding: 18px 20px; margin: 14px 0 0; border-radius: var(--r-lg); border: 1px solid var(--line); background: #fff; }
.mt-boss-result.is-won { border-color: #bfe0cc; background: linear-gradient(180deg, #fff 0%, var(--go-soft) 100%); }
.mt-boss-result.is-near { border-color: #efdcb4; background: linear-gradient(180deg, #fff 0%, var(--sun-soft) 100%); }
.mt-boss-sprite.is-big { width: 64px; height: 64px; }
.mt-boss-sprite.is-big svg { width: 38px; height: 38px; }
.mt-br-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.mt-br-badge { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 99px; color: #fff; background: var(--sun); }
.mt-boss-result.is-won .mt-br-badge { background: var(--go); }
.mt-br-body h3 { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); margin: 2px 0 0; }
.mt-br-need, .mt-br-next, .mt-br-pending { margin: 0; color: var(--ink-soft); line-height: 1.45; }
.mt-br-need { color: var(--ink); font-weight: 600; }
.mt-br-pending { font-size: .88rem; color: #8a5a12; }
.mt-br-bar { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 420px; margin: 2px 0; }
.mt-br-bar .mt-hp { flex: 1; height: 10px; }
.mt-boss-result.is-won .mt-br-bar .mt-hp-fill { background: var(--go); }
.mt-br-bar .mt-hp-fill { transition-duration: .7s; }
.mt-br-lab, .mt-br-val { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.mt-br-body .btn { margin-top: 6px; }

/* a timed paper: one calm line */
.mt-boss-result.is-calm { align-items: center; gap: 12px; padding: 10px 14px; background: #fff; border-color: var(--line); }
.mt-boss-result.is-calm p { flex: 1; margin: 0; color: var(--ink-soft); line-height: 1.45; }
.mt-boss-result.is-calm p strong { color: var(--ink); }

@media (max-width: 860px) {
  .mt-boss-hud { padding: 6px 10px; gap: 10px; }
  .mt-boss-hud.is-live .mt-boss-sprite { width: 32px; height: 32px; }
  .mt-boss-hud.is-paper .mt-boss-status { font-size: .76rem; }
  .mt-boss-result { flex-direction: column; align-items: center; text-align: center; }
  .mt-br-body { align-items: center; }
  .mt-boss-result.is-calm { flex-direction: row; text-align: left; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .mt-hp-fill { transition: none !important; }
  .mt-boss-sprite.is-hit, .mt-boss-dmg.is-on { animation: none !important; }
  .mt-boss-dmg { display: none; }
}
