/* ==========================================================================================
   battle-theme-iron-hud.css — 战斗主题「乌萨斯齐心团」(ac_n_iron), phase 2: the top HUD band (js/ui/ironHud.js).
   The boxes, sprites, end poses and the trans_* / hud_lose_hp / hud_tag_miss_enemy keyframes are GENERATED from the
   official group_hud prefab (battle-theme-iron-hud.gen.css, tools/battle-theme/iron_hud_gen.py). This file holds what
   the prefab leaves to scripts and fonts: the unit, the texts, the two layout groups (回合 / LP) and group switching.
   ========================================================================================== */

html[data-battle-theme="ac_n_iron"] .gm .ihud {
  /* one native canvas px: the official band (510×68 at 1920-wide UI) ≈ 6.8rem wide */
  --hu: .0134rem;
  position: relative; flex: none; width: calc(510 * var(--hu)); height: calc(68 * var(--hu));
  font-family: var(--font-cjk); line-height: 1; color: #e3e3e3; pointer-events: auto;
}
.ihud__root { position: absolute; inset: 0; }
.ihud :where(div) { position: absolute; box-sizing: border-box; }
.ihud .is-hidden { display: none; }

/* only the current phase's mid-screen group shows (the prefab toggles them with SetActive) */
.ihud .ih-grest, .ihud .ih-gbattle, .ihud .ih-gcoop, .ihud .ih-gboss { display: none; visibility: visible; }
.ihud .ih-grest.is-on, .ihud .ih-gbattle.is-on, .ihud .ih-gcoop.is-on, .ihud .ih-gboss.is-on { display: block; }
/* RectMask2D roots clip their transition sprites */
.ihud :is(.ih-grest-rmask, .ih-gbattle-rmask, .ih-gcoop-rmask, .ih-gboss-gtrans-rmask, .ih-gboss-gtrans-rstencil, .ih-rhp-light-mask) { overflow: hidden; }
/* num_layout's three Text children are drawn by the runtime as one flex row */
.ihud [class*="num-layout-text-"] { display: none; }

/* texts: centred in their boxes like Unity's MiddleCenter */
.ihud .ihud__txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; white-space: nowrap; font-weight: 700; }
.ihud .ih-grest-m-gnormal-text .ihud__txt { letter-spacing: .06em; }
.ihud :is(.ih-gbattle-m-gtrans-rstage2-text, .ih-gcoop-m-gtrans-rstage2-text, .ih-gboss-gtrans-m-rstage2-text) .ihud__txt { letter-spacing: .08em; text-shadow: 0 0 calc(6 * var(--hu)) currentColor; }

/* the n/m counters (num_layout: HorizontalLayoutGroup, MiddleCenter) — official colours per group */
.ihud :is(.ih-gbattle-m-gnormal-num-layout, .ih-gcoop-m-gnormal-num-layout, .ih-gboss-gnormal-rnum-num-layout) {
  display: flex; align-items: center; justify-content: center; gap: calc(2 * var(--hu));
  font-family: var(--font-num); font-size: calc(20 * var(--hu)); color: #cfcfcf;
}
.ihud .ihud__cur { font-weight: 700; }
.ihud .ih-gbattle-m-gnormal-num-layout .ihud__cur { color: #e8b524; }
.ihud .ih-gcoop-m-gnormal-num-layout .ihud__cur { color: #ef612e; }
.ihud .ih-gboss-gnormal-rnum-num-layout .ihud__cur { color: #cc4426; }

/* 回合 N (root_round: title + the mint plate, laid out right-to-left of the anchor) */
.ihud .ih-rround {
  left: calc(255 * var(--hu) - 171 * var(--hu)); top: calc(34 * var(--hu) - 1 * var(--hu)); transform: translate(-50%, -50%);
  height: calc(35 * var(--hu)); display: flex; align-items: center; gap: calc(6 * var(--hu));
}
.ihud .ihud__title { font-size: calc(14 * var(--hu)); color: #a8a8a8; letter-spacing: .1em; }
.ihud .ihud__round {
  position: relative; display: grid; place-items: center; width: calc(54 * var(--hu)); height: calc(29 * var(--hu));
  background: var(--iron-asset-hud-bg-round, none) center / 100% 100% no-repeat;
}
.ihud .ihud__roundnum { font-size: calc(16 * var(--hu)); color: #1c1c1c; font-weight: 700; }

/* LP (root_hp: icon + number, laid out from its anchor; the -N tag hangs after it) */
.ihud .ih-rhp {
  left: calc(255 * var(--hu) + 158 * var(--hu)); top: calc(34 * var(--hu) - 1 * var(--hu)); transform: translate(-50%, -50%);
  height: calc(35 * var(--hu)); display: flex; align-items: center; gap: calc(4 * var(--hu)); transform-origin: 50% 50%;
}
.ihud .ihud__hpicon { flex: none; width: calc(12 * var(--hu)); height: calc(19 * var(--hu)); background: var(--iron-asset-hud-icon-hp, none) center / 100% 100% no-repeat; }
.ihud .ihud__hp { font-size: calc(21 * var(--hu)); color: #e3e3e3; font-weight: 700; }
.ihud.is-low .ihud__hp { color: #ff6a52; }
.ihud .ih-rhp-rlost-hp-text-lost .ihud__txt { font-family: var(--font-num); color: #fff; }
.ihud .ih-rhp-glow, .ihud .ih-rhp-light-mask { pointer-events: none; }

/* boss: the HP bar's fill grows from the right edge like the official Slider (direction RightToLeft fill area) */
.ihud .ih-gboss-gnormal-rhp-hp-slider-fill-area { left: calc(2 * var(--hu)); right: calc(2 * var(--hu)); width: auto; }
.ihud .ih-gboss-gnormal-rhp-hp-slider-fill-area-fill { left: auto; right: 0; height: 100%; transition: width .25s linear; }

/* the boss stripes (repeat_bg tiles the hatch horizontally) */
.ihud .ih-gboss-gtrans-rstencil-repeat-bg { left: calc(1 * var(--hu)); right: calc(1 * var(--hu)); width: auto; background-size: auto 100% !important; background-repeat: repeat-x !important; }

/* the leak count on the official tag_miss (runner + ×, number on its right half) */
.ihud .ih-gbattle-tag-miss-text-num .ihud__txt, .ihud .ih-gcoop-tag-miss-text-num .ihud__txt { font-family: var(--font-num); font-size: calc(15 * var(--hu)); color: #ff7533; }
.ihud .ih-gbattle-tag-miss-add, .ihud .ih-gcoop-tag-miss-add { mix-blend-mode: screen; pointer-events: none; }

/* place the band in the top bar instead of the default round / capsule / LP band */
html[data-battle-theme="ac_n_iron"] .gm .gtop__center--east-layout { gap: .04rem; }

@media (prefers-reduced-motion: reduce) {
  .ihud *, .ihud *::before, .ihud *::after { animation: none !important; }
}
@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  html[data-battle-theme="ac_n_iron"] .gm .ihud { --hu: min(.0134rem, calc((100vw - 300px) / 510)); }
}
