/* Standalone WEB battle surface. Android source styles reused under an active-phase guard. */
/* The battle journal owns the viewport. Only the battlefield scrolls in normal play. */
.battle-hud[data-figures="true"] {
  --paper: #f3e8ce;
  --card: #fff6e1;
  --ink: #293229;
  --muted: #57584a;
  --rule: #b7a887;
  --forest: #314b39;
  --clay: #783c2c;
  --blue: #384d71;
  --type-caption: .875rem;
  --type-body: 1rem;
  --type-heading: clamp(1.35rem,5.7vw,1.8rem);
  --gut: clamp(9px,3.2vw,18px);
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto auto;
  justify-content: center;
  grid-template-columns: minmax(0,46rem);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
  padding: max(env(safe-area-inset-top,0px),var(--app-safe-top,0px))
    max(env(safe-area-inset-right,0px),var(--app-safe-right,0px))
    max(env(safe-area-inset-bottom,0px),var(--app-safe-bottom,0px))
    max(env(safe-area-inset-left,0px),var(--app-safe-left,0px));
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--type-body)/1.35 var(--sans);
  color-scheme: light;
}
.battle-hud[data-figures="true"] *, .battle-hud[data-figures="true"] *::before, .battle-hud[data-figures="true"] *::after { box-sizing: border-box; }
.battle-hud[data-figures="true"] [hidden] { display: none !important; }
.battle-hud[data-figures="true"] :is(button,summary) { min-width: 48px; min-height: 48px; white-space: normal; overflow-wrap: anywhere; }
.battle-hud[data-figures="true"] :is(button,summary,[tabindex]):focus-visible { outline: 3px solid #a96022; outline-offset: 2px; }
.battle-hud[data-figures="true"] .hud-header {
  display: grid;
  grid-template-columns: max-content minmax(0,1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 5px;
  min-width: 0;
  padding: 8px var(--gut);
  background: #243c31;
  color: #fff4d9;
  border-bottom: 2px solid #aa895a;
}
.battle-hud[data-figures="true"] .hud-heading { display: contents; }
.battle-hud[data-figures="true"] .hud-heading :is(p,small,span) { margin: 0; color: #ead7b0; font: 500 var(--type-caption)/1.25 var(--sans); }
.battle-hud[data-figures="true"] .hud-heading .field-state { grid-column: 1; grid-row: 1; align-self: end; padding: 0; border: 0; letter-spacing: 0; text-transform: none; background: transparent; }
.battle-hud[data-figures="true"] .hud-title { grid-column: 1/3; grid-row: 2; margin: 3px 0 0; color: #fff5df; font: 600 var(--type-heading)/1.08 var(--serif); overflow-wrap: anywhere; }
.battle-hud[data-figures="true"] #battle-clock { grid-column: 2; grid-row: 1; align-self: end; margin: 0; color: inherit; font-variant-numeric: tabular-nums; white-space: nowrap; }
.battle-hud[data-figures="true"] .hud-controls { grid-column: 3; grid-row: 1/3; display: flex; flex: 0 0 auto; align-items: center; gap: 4px; }
.battle-hud[data-figures="true"] .hud-controls button {
  display: grid;
  place-content: center;
  padding: 4px 6px;
  margin: 0;
  border: 1px solid #a89f7f;
  border-radius: 4px;
  background: #324b3d;
  color: #fff5df;
  font: 600 var(--type-caption)/1.2 var(--sans);
  box-shadow: none;
}
.battle-hud[data-figures="true"] .hud-controls #speed-button[data-speed-value] { min-width: 48px; width: 48px; padding: 2px; font-size: 0; }
.battle-hud[data-figures="true"] .hud-controls #speed-button[data-speed-value]::after { content: attr(data-speed-value); color: inherit; font: 700 var(--type-body)/1 var(--sans); }
.battle-hud[data-figures="true"] .hud-controls button[aria-pressed="true"] { background: #eddfbb; color: #293b30; }
.battle-hud[data-figures="true"] .hud-body {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding: 8px;
  background: var(--paper);
}
.battle-hud[data-figures="true"] .hud-field {
  position: relative;
  isolation: isolate;
  flex: 1 0 auto;
  display: grid;
  grid-auto-rows: max-content;
  align-content: space-evenly;
  gap: 9px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 11px var(--gut) 10px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background-color: #b1a484;
  background-image: linear-gradient(180deg,#faf0d4a6 0%,#cdbb9566 42%,#e8dcca75 79%,#f3e8cef2 100%),var(--campaign-background,url("assets/backdrop.webp"));
  background-position: center 37%;
  background-size: cover;
}
.battle-hud[data-figures="true"] .hud-side { min-width: 0; }
.battle-hud[data-figures="true"] .hud-side-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 9px;
  min-width: 0;
  padding: 4px 8px;
  color: #fff4de;
  background: var(--forest);
  border-radius: 4px 4px 0 0;
}
.battle-hud[data-figures="true"] .hud-enemies .hud-side-heading { background: #6b3a2d; }
.battle-hud[data-figures="true"] .hud-side-heading :is(h2,strong,p) { margin: 0; color: inherit; font: 600 var(--type-body)/1.2 var(--serif); }
.battle-hud[data-figures="true"] .hud-alive { margin-left: auto; color: #f6e7c9; font: 500 var(--type-caption)/1.2 var(--sans); font-variant-numeric: tabular-nums; }
.battle-hud[data-figures="true"] .hud-roster {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  align-items: stretch;
  gap: 5px;
  padding: 5px 0 0;
  margin: 0;
  min-width: 0;
}
.battle-hud[data-figures="true"] .hud-roster:has(>.hud-unit:nth-child(4)):not(:has(>.hud-unit:nth-child(5))) { grid-template-columns: repeat(2,minmax(0,1fr)); }
.battle-hud[data-figures="true"] .hud-roster>.hud-unit {
  width: 100%;
  max-width: none;
  min-height: 0;
  justify-content: stretch;
  position: relative;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  min-width: 0;
  height: auto;
  gap: 3px;
  padding: 5px;
  border: 1px solid #aa9675;
  border-top: 2px solid #6b785c;
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 1px #3b2e1b20;
}
.battle-hud[data-figures="true"] .hud-enemies .hud-unit { border-top-color: #9c6953; background: #fcf0d9; }
.battle-hud[data-figures="true"] .hud-unit-art {
  display: block;
  align-self: start;
  justify-self: center;
  width: min(100%,clamp(45px,7.9dvh,73px));
  height: auto;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 3px;
  background-color: #e8d6ad;
  background-repeat: no-repeat;
}
.battle-hud[data-figures="true"] .hud-unit-name {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font: 650 var(--type-caption)/1.15 var(--sans);
  overflow-wrap: anywhere;
  white-space: normal;
}
.battle-hud[data-figures="true"] .hud-vitals {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 3px 4px;
  min-width: 0;
  font: 550 var(--type-caption)/1.15 var(--sans);
  font-variant-numeric: tabular-nums;
}
.battle-hud[data-figures="true"] .hud-vitals .hp-track {
  order: -1;
  flex: 1 0 100%;
  height: 7px;
  margin: 1px 0 0;
  overflow: hidden;
  border-radius: 3px;
  background: #d9cfb9;
  outline: 1px solid #b4a98e;
  outline-offset: -1px;
}
.battle-hud[data-figures="true"] .hud-vitals .hp-fill { display: block; height: 100%; background: #496447; transition: width .18s linear; border-radius: inherit; }
.battle-hud[data-figures="true"] .hud-enemies .hud-vitals .hp-fill { background: #8d4635; }
.battle-hud[data-figures="true"] .hud-vitals .hp-text { color: var(--ink); font: inherit; white-space: normal; overflow-wrap: anywhere; }
.battle-hud[data-figures="true"] .hud-vitals .shield-pill { position: static; min-width: 0; margin: 0; padding: 0 3px; border: 0; border-radius: 2px; background: #dfe7e3; color: #294f57; font: inherit; white-space: normal; }
.battle-hud[data-figures="true"] .hud-vitals .shield-pill.hidden { display: none; }
.battle-hud[data-figures="true"] .hud-unit-effect { min-width: 0; color: var(--clay); font: 600 var(--type-caption)/1.15 var(--sans); overflow-wrap: anywhere; }
.battle-hud[data-figures="true"] .hud-unit-effect:empty { display: none; }
.battle-hud[data-figures="true"] .hud-unit .attack-meter { position: static; width: 100%; height: 2px; margin: 1px 0 0; background: #ddd2b8; }
.battle-hud[data-figures="true"] .hud-unit .attack-meter>i { height: 100%; background: #917c56; }
.battle-hud[data-figures="true"] .hud-fallen { justify-self: start; padding: 2px 4px; border-radius: 2px; background: #545348; color: #fff7e1; font: 600 var(--type-caption)/1.2 var(--sans); }
.battle-hud[data-figures="true"] .hud-unit[data-campaign-mark-state="preview"] { outline: 2px dashed var(--clay); outline-offset: -2px; }
.battle-hud[data-figures="true"] .hud-unit[data-campaign-mark-state="windup"] { outline: 3px double #733020; outline-offset: -3px; }
.battle-hud[data-figures="true"] .hud-unit-effect:has(>.enemy-mechanics:empty) { display: none; }
.battle-hud[data-figures="true"] .hud-unit[data-state="fallen"] { border-style: dashed; border-color: #88816d; background: #e0d9c7; opacity: 1; transform: none; }
.battle-hud[data-figures="true"] .hud-unit[data-state="fallen"] .hud-unit-art { filter: grayscale(1); opacity: .62; }
.battle-hud[data-figures="true"] .hud-unit[data-state="fallen"] .hud-unit-name { text-decoration: line-through; color: #47483d; }
.battle-hud[data-figures="true"] .hud-unit[data-state="fallen"] .attack-meter { visibility: hidden; }
.battle-hud[data-figures="true"] .hud-unit[data-state="fallen"] .hp-fill { transition: none; }
.battle-hud[data-figures="true"] .hud-unit:is(.striking,.hit) { animation: none; }
.battle-hud[data-figures="true"] .hud-unit.hit .hud-unit-art { outline: 2px solid var(--clay); outline-offset: -2px; }
.battle-hud[data-figures="true"] .hud-unit .float-number {
  top: 12px;
  padding: 1px 3px;
  border-radius: 3px;
  background: #354137;
  color: #fff4da;
  font: 700 var(--type-caption)/1.15 var(--sans);
  text-shadow: none;
}
.battle-hud[data-figures="true"] .hud-unit .battle-vfx { top: 24px; width: min(65%,48px); }
body:has(.battle-hud[data-figures="true"])>.attack-particle-layer { opacity: .45; }

.battle-hud[data-figures="true"] .hud-field .pause-veil {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 8px;
  background: #1a291fc9;
  color: #fff6df;
  backdrop-filter: blur(2px);
}
.battle-hud[data-figures="true"] .hud-field .pause-veil :is(p,strong) { margin: 3px 0; color: #fff3d9; }
.battle-hud[data-figures="true"] .hud-support { flex: none; padding: 0 var(--gut); border-block-end: 1px solid var(--rule); }
.battle-hud[data-figures="true"] .hud-support summary { display: flex; align-items: center; padding: 3px 0; gap: 8px; list-style: none; cursor: pointer; color: #3c503e; font: 600 var(--type-caption)/1.25 var(--sans); }
.battle-hud[data-figures="true"] .hud-support summary::after { content:"+"; margin-left: auto; font-size: 1.15rem; }
.battle-hud[data-figures="true"] .hud-utilities { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; margin-block: 4px; }
.battle-hud[data-figures="true"] .hud-utilities button { padding: 4px 8px; border: 1px solid var(--rule); border-radius: 4px; background: var(--card); color: var(--forest); font: 600 var(--type-caption)/1.2 var(--sans); }
.battle-hud[data-figures="true"] .hud-support .panel { margin: 6px 0; border: 1px solid var(--rule); background: #2e3b31; color: #f1e8ce; }
.battle-hud[data-figures="true"] .hud-spell-guide { display: grid; gap: 5px; margin: 8px 0; }
.battle-hud[data-figures="true"] .hud-spell-guide :is(p,li,dd) { margin: 0; color: var(--ink); font: 400 var(--type-caption)/1.35 var(--sans); }
.battle-hud[data-figures="true"] .hud-spell-guide strong { font-weight: 700; }
.battle-hud[data-figures="true"] .hud-support[open] summary::after { content:"−"; }
.battle-hud[data-figures="true"] .hud-event { grid-row: 3; margin: 0; padding: 7px var(--gut); color: #463d28; background: #eadbb9; border-block: 1px solid var(--rule); font: 550 var(--type-caption)/1.28 var(--sans); overflow-wrap: anywhere; }
.battle-hud[data-figures="true"] .hud-event:empty { display: none; }

.battle-hud[data-figures="true"] .hud-dock.command-bar {
  grid-row: 4;
  position: static;
  inset: auto;
  z-index: 2;
  display: block;
  min-width: 0;
  width: 100%;
  min-height: 0;
  max-height: 52dvh;
  margin: 0;
  padding: 0 var(--gut) 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-top: 2px solid #9b8664;
  border-radius: 0;
  background: #f2e6c8;
  box-shadow: 0 -2px 5px #4539221b;
}
.battle-hud[data-figures="true"] .hud-magic.spells-panel {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 5px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  max-height: none;
  height: auto;
  padding: 4px 0 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.battle-hud[data-figures="true"] .hud-mana { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-start; gap: 2px 7px; min-width: 0; color: var(--blue); font: 600 var(--type-caption)/1.2 var(--sans); }
.battle-hud[data-figures="true"] .hud-mana #energy-value { font: 750 var(--type-body)/1.15 var(--sans); font-variant-numeric: tabular-nums; }
.battle-hud[data-figures="true"] .hud-spells {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  align-items: stretch;
  gap: 5px;
  min-width: 0;
}
.battle-hud[data-figures="true"] .hud-spell {
  --accent: #8c4c32;
  --rune-position: 0% 0%;
  position: relative;
  display: grid;
  grid-template-columns: 1.4rem minmax(0,1fr);
  grid-template-rows: auto auto 1fr auto;
  align-items: start;
  align-content: start;
  gap: 4px 3px;
  width: 100%;
  min-width: 48px;
  min-height: 78px;
  max-height: none;
  margin: 0;
  padding: 5px;
  border: 1px solid #a99473;
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
  opacity: 1;
  filter: none;
  text-align: left;
  box-shadow: none;
  overflow: visible;
}
.battle-hud[data-figures="true"] .hud-spell[data-id="ward"] { --accent: #445c7e; --rune-position: 50% 0%; }
.battle-hud[data-figures="true"] .hud-spell[data-id="bloom"] { --accent: #4f6744; --rune-position: 100% 0%; }
.battle-hud[data-figures="true"] .hud-spell::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  position: static;
  display: block;
  width: 1.4rem;
  height: auto;
  aspect-ratio: 1;
  border-radius: 2px;
  background: #e5d5ad url("assets/rune-atlas-grimoire.webp") var(--rune-position)/300% 200% no-repeat;
}
.battle-hud[data-figures="true"] .hud-spell-name { grid-column: 1/-1; grid-row: 2; color: var(--ink); font: 700 var(--type-caption)/1.15 var(--sans); overflow-wrap: anywhere; }
.battle-hud[data-figures="true"] .hud-spell-cost { grid-column: 2; grid-row: 1; align-self: center; justify-self: end; color: var(--blue); font: 650 var(--type-caption)/1.15 var(--sans); font-variant-numeric: tabular-nums; }
.battle-hud[data-figures="true"] .hud-spell-effect { grid-column: 1/-1; grid-row: 3; color: #534f3e; font: 400 var(--type-caption)/1.2 var(--sans); overflow-wrap: anywhere; }
.battle-hud[data-figures="true"] .hud-spell-status { grid-column: 1/-1; grid-row: 4; align-self: end; justify-self: start; padding: 2px 4px; border-radius: 3px; color: #fff4dd; background: var(--forest); font: 600 var(--type-caption)/1.15 var(--sans); font-variant-numeric: tabular-nums; }
.battle-hud[data-figures="true"] .hud-spell:not([data-state="ready"]) { border-color: #b3a991; border-top-color: #a59b84; background: #e5decc; color: var(--muted); }
.battle-hud[data-figures="true"] .hud-spell:not([data-state="ready"])::before { filter: grayscale(.7); }
.battle-hud[data-figures="true"] .hud-spell:not([data-state="ready"]) .hud-spell-status { color: #4f4d40; background: #d3cbb6; }
.battle-hud[data-figures="true"] .hud-spell[data-state="mana"] .hud-spell-status { color: #283d57; background: #d2dce0; }
.battle-hud[data-figures="true"] .hud-spell[data-state="ready"]:active { background: #eadbb6; border-color: var(--forest); }
.battle-hud[data-figures="true"] .tutorial-host { margin: 0; }
.battle-hud[data-figures="true"] .tutorial-panel { min-width: 0; padding: 4px 6px; border-radius: 4px; background: #ecdebb; border-color: #b9a27d; }
.battle-hud[data-figures="true"] .tutorial-heading h3 { font-size: var(--type-caption); }
.battle-hud[data-figures="true"] .tutorial-copy { line-height: 1.25; }
@media (max-width: 370px) {
  .battle-hud[data-figures="true"] .hud-controls #pause-button { width: 48px; padding: 0; font-size: 0; }
  .battle-hud[data-figures="true"] .hud-controls #pause-button::after { content: "Ⅱ"; color: inherit; font: 700 1.15rem/1 var(--sans); }
  .battle-hud[data-figures="true"][data-hud-state="paused"] .hud-controls #pause-button::after { content: "▶"; }
  .battle-hud[data-figures="true"] .hud-roster>.hud-unit { padding: 4px; }
}
@media (max-width: 350px), (max-height: 650px) {
  .battle-hud[data-figures="true"] .hud-field { gap: 6px; padding-block: 6px; }
  .battle-hud[data-figures="true"] .hud-unit { padding: 4px; gap: 2px; }
  .battle-hud[data-figures="true"] .hud-unit-art { width: min(100%,45px); }
  .battle-hud[data-figures="true"] .hud-header { padding-block: 4px; }
  .battle-hud[data-figures="true"] .hud-spell { gap: 2px; padding: 4px; }
  .battle-hud[data-figures="true"] .hud-dock.command-bar { padding-bottom: 4px; max-height: 61dvh; }
}
/* A short phone keeps both sides visible. The battle notes retain complete spell descriptions. */
@media (max-width: 350px) and (max-height: 650px) {
  .battle-hud[data-figures="true"] { --type-caption: .8125rem; --type-heading: 1.12rem; }
  .battle-hud[data-figures="true"] .hud-header { padding-block: 3px; }
  .battle-hud[data-figures="true"] .hud-title { margin-top: 1px; }
  .battle-hud[data-figures="true"] .hud-field { grid-template-columns: repeat(2,minmax(0,1fr)); align-content: start; align-items: start; gap: 5px; padding: 6px; }
  .battle-hud[data-figures="true"] .hud-roster, .battle-hud[data-figures="true"] .hud-roster:has(>.hud-unit:nth-child(4)):not(:has(>.hud-unit:nth-child(5))) { grid-template-columns: minmax(0,1fr); padding-top: 3px; gap: 4px; }
  .battle-hud[data-figures="true"] .hud-side-heading { display: grid; gap: 1px; padding: 3px 5px; border-radius: 3px; }
  .battle-hud[data-figures="true"] .hud-side-heading h2 { font-size: var(--type-caption); }
  .battle-hud[data-figures="true"] .hud-alive { margin: 0; }
  .battle-hud[data-figures="true"] .hud-roster>.hud-unit { grid-template-columns: 29px minmax(0,1fr); gap: 2px 4px; padding: 3px; }
  .battle-hud[data-figures="true"] .hud-unit-art { grid-row: 1; grid-column: 1; align-self: center; width: 29px; }
  .battle-hud[data-figures="true"] .hud-unit-name { grid-row: 1; grid-column: 2; align-self: center; }
  .battle-hud[data-figures="true"] .hud-vitals, .battle-hud[data-figures="true"] .hud-fallen, .battle-hud[data-figures="true"] .hud-unit-effect, .battle-hud[data-figures="true"] .attack-meter { grid-column: 1/-1; }
  .battle-hud[data-figures="true"] .hud-unit .battle-vfx { left: 17px; top: 17px; width: 24px; }
  .battle-hud[data-figures="true"] .hud-event { padding-block: 3px; }
  .battle-hud[data-figures="true"] .hud-magic.spells-panel { gap: 3px; }
  .battle-hud[data-figures="true"] .hud-spell { grid-template-columns: 15px minmax(0,1fr); gap: 3px; }
  .battle-hud[data-figures="true"] .hud-spell::before { align-self: center; width: 15px; }
  .battle-hud[data-figures="true"] .hud-spell-cost { justify-self: start; }
  .battle-hud[data-figures="true"] .hud-dock:has(.tutorial-host) .hud-spell { grid-template-rows: auto 1fr auto; min-height: 64px; }
  .battle-hud[data-figures="true"] .hud-dock:has(.tutorial-host) .hud-spell-effect { display: none; }
  .battle-hud[data-figures="true"] .hud-dock:has(.tutorial-host) .hud-spell-status { grid-row: 3; }
}
@media (min-width: 580px) and (max-height: 500px) and (orientation: landscape) {
  .battle-hud[data-figures="true"] { grid-template-columns: minmax(0,1.2fr) minmax(245px,1fr); grid-template-rows: auto minmax(0,1fr) auto; }
  .battle-hud[data-figures="true"] .hud-header { grid-column: 1/-1; grid-row: 1; }
  .battle-hud[data-figures="true"] .hud-body { grid-column: 1; grid-row: 2; }
  .battle-hud[data-figures="true"] .hud-event { grid-column: 1; grid-row: 3; }
  .battle-hud[data-figures="true"] .hud-dock.command-bar { grid-column: 2; grid-row: 2/4; max-height: none; padding-inline: 7px; border-top: 0; border-left: 1px solid var(--rule); }
  .battle-hud[data-figures="true"] .hud-spells { grid-template-columns: minmax(0,1fr); }
  .battle-hud[data-figures="true"] .hud-spell { grid-template-columns: 1.4rem minmax(0,1fr) auto; grid-template-rows: auto auto; min-height: 48px; padding: 4px 6px; gap: 3px 5px; }
  .battle-hud[data-figures="true"] .hud-spell::before { grid-column: 1; grid-row: 1/3; align-self: center; }
  .battle-hud[data-figures="true"] .hud-spell-name { grid-column: 2; grid-row: 1; }
  .battle-hud[data-figures="true"] .hud-spell-effect { grid-column: 2; grid-row: 2; }
  .battle-hud[data-figures="true"] .hud-spell-cost { grid-column: 3; grid-row: 1; }
  .battle-hud[data-figures="true"] .hud-spell-status { grid-column: 3; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .battle-hud[data-figures="true"] .hud-unit, .battle-hud[data-figures="true"] .hud-unit *, .battle-hud[data-figures="true"] .hud-spell, .battle-hud[data-figures="true"] .hud-event { transition: none; animation: none; }
  .battle-hud[data-figures="true"] .hud-unit .battle-vfx, .battle-hud[data-figures="true"] .hud-unit .float-number { display: none; }
}

/* Figure layer, fixed positions and event presentation. */
/* Android active battle only. Native WebView has already applied system insets. */
html:not([data-platform="android"]):has(.battle-hud[data-figures="true"]),html:not([data-platform="android"]):has(.battle-hud[data-figures="true"]) body{width:100%;height:100%;overflow:hidden;overscroll-behavior:none}
html:not([data-platform="android"]):has(.battle-hud[data-figures="true"]) body{position:fixed;inset:0}
html:not([data-platform="android"]):has(.battle-hud[data-figures="true"]) #app{height:100%;overflow:hidden}
html:not([data-platform="android"]) .battle-hud[data-figures="true"]{--figure-height:128px;--figure-filter:drop-shadow(0 2px 2px #0009);--type-caption:14px;--type-body:16px;--type-heading:22px;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:56px minmax(0,1fr) 0 90px;justify-content:center;width:100%;height:100vh;height:100svh;min-height:0;overflow:hidden;padding:max(env(safe-area-inset-top,0px),var(--app-safe-top,0px)) max(env(safe-area-inset-right,0px),var(--app-safe-right,0px)) max(env(safe-area-inset-bottom,0px),var(--app-safe-bottom,0px)) max(env(safe-area-inset-left,0px),var(--app-safe-left,0px));background:#17252a;color:#f0e3c6;color-scheme:dark}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-header{grid-column:1;grid-row:1;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:48px;gap:4px;padding:4px 8px;border-bottom:1px solid #998254;background:#21312e}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-heading{display:flex;grid-column:1;grid-row:1;align-items:center;min-width:0;gap:4px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-controls{grid-column:2;grid-row:1;gap:4px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-controls button{width:48px;height:48px;min-height:48px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-body{grid-column:1;grid-row:2;min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;background:#17252a}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-field{flex:1 0 auto;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(24px,40px) auto;align-content:space-evenly;gap:6px;min-height:100%;padding:8px 6px;border:0;background-image:linear-gradient(#10212c20,#15262220),var(--campaign-background,url("assets/backdrop.webp"));background-position:center;background-size:cover}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-side{min-width:0;min-height:0}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-enemies{grid-column:1;grid-row:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-allies{grid-column:1;grid-row:3}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-side-heading{display:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-auto-rows:max-content;align-items:center;gap:6px 4px;padding:6px 0 0;min-width:0}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster>:is(.hud-unit,.hud-empty-position){grid-column:span 2;grid-row:auto;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:var(--figure-height) 18px 16px 2px;gap:0;align-content:start;min-width:0;min-height:calc(var(--figure-height) + 36px);width:100%;height:auto;margin:0;padding:0 2px;border:0;background:none;box-shadow:none;opacity:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-capacity="4"]>:is(.hud-unit,.hud-empty-position){grid-column:span 3}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"]:is([data-capacity="3"],[data-capacity="5"])>[data-slot="0"]{grid-column:3/5;grid-row:1;translate:0 -6px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"]:is([data-capacity="3"],[data-capacity="5"])>[data-slot="1"]{grid-column:1/3;grid-row:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"]:is([data-capacity="3"],[data-capacity="5"])>[data-slot="2"]{grid-column:5/7;grid-row:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-capacity="5"]>[data-slot="3"]{grid-column:2/4;grid-row:2}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-capacity="5"]>[data-slot="4"]{grid-column:4/6;grid-row:2}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-rig{grid-column:1;grid-row:1;position:relative;display:grid;place-items:center;width:100%;height:var(--figure-height);min-width:0;aspect-ratio:auto;overflow:visible;border:0;border-radius:0;background:none;pointer-events:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-sprite{position:absolute;inset:0;display:block;width:100%;height:100%;min-width:0;min-height:0;max-width:100%;max-height:100%;object-fit:contain;object-position:center bottom;filter:var(--figure-filter);scale:var(--figure-facing,1) 1;pointer-events:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-vitals{grid-column:1;grid-row:2;display:flex;flex-wrap:nowrap;align-items:center;justify-content:center;gap:3px;position:relative;isolation:isolate;min-width:0;height:18px;background:#152220e8;color:#f2ecd8;font:600 var(--type-caption)/18px var(--sans);font-variant-numeric:tabular-nums}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-vitals .hp-track{position:absolute;inset:0;z-index:-1;order:0;width:100%;height:18px;margin:0;outline:0;border-radius:3px;background:#23302b}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-vitals .hp-text{color:#f2ecd8;white-space:nowrap;overflow-wrap:normal;text-shadow:0 1px 2px #000}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-vitals .shield-pill{position:static;display:inline-flex;align-items:center;gap:1px;max-width:100%;padding:0;border:0;background:none;color:#d5e9ff;font:inherit;white-space:nowrap}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-vitals .shield-pill .mobile-symbol{--symbol-size:14px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="enemy"]>.hud-unit{grid-template-rows:18px var(--figure-height) 16px 2px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="enemy"] .hud-vitals{grid-row:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="enemy"] .hud-figure-rig{grid-row:2}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-unit-effect{grid-column:1;grid-row:3;display:flex;align-items:center;justify-content:center;min-width:0;max-height:16px;gap:3px;color:#f1d5a7;font:var(--type-caption)/16px var(--sans)}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-unit-effect .mobile-symbol{--symbol-size:16px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-unit .attack-meter{grid-column:1;grid-row:4;height:2px;margin:0;background:#263a33}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-unit:is([data-marked="true"],[data-campaign-mark-state="windup"]){outline:none;--figure-filter:drop-shadow(1px 0 0 #ff6659) drop-shadow(-1px 0 0 #ff6659) drop-shadow(0 1px 0 #ff6659) drop-shadow(0 -1px 0 #ff6659)}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-unit:is([data-marked="true"],[data-campaign-mark-state="windup"])::after{content:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-unit[data-state="fallen"] .hud-figure-sprite{filter:grayscale(1) brightness(.6) var(--figure-filter);opacity:.65}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-empty-position{visibility:hidden;pointer-events:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-threat{grid-column:1;grid-row:2;min-width:0;max-height:40px;overflow:auto;overscroll-behavior:contain;padding:2px 6px;color:#ffe0b2;background:#172221d9;border-left:2px solid #ce9a5c;font:var(--type-caption)/18px var(--sans);overflow-wrap:anywhere}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-threat[data-state="quiet"]{visibility:hidden;background:none;border-color:transparent}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-effects{position:absolute;inset:0;z-index:2;pointer-events:none;overflow:hidden}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-dock.command-bar{grid-column:1;grid-row:4;position:static;width:100%;height:90px;max-height:none;min-height:0;padding:4px 8px 6px;border-top:1px solid #9e895d;overflow:auto;overscroll-behavior:contain;background:#e9ddbd}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-magic.spells-panel{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:20px 54px;gap:4px;padding:0;min-height:0}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-magic>.hud-mana{grid-column:1;grid-row:1;display:flex;align-items:center;gap:4px;min-height:0;height:20px;padding:0;flex-wrap:nowrap}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-mana>.mobile-symbol{--symbol-size:20px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-mana-segments{display:flex;align-items:center;gap:3px;min-width:0;max-width:100%;height:10px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-mana-segments>i{display:block;width:8px;height:8px;border:1px solid #53657e;border-radius:2px;background:transparent}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-mana-segments>i[data-filled="true"]{background:#536ea1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-magic>.hud-spells{grid-column:1;grid-row:2;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;min-height:0}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-spells .hud-spell:has(>.mobile-symbol){grid-template-columns:minmax(0,1fr) auto;grid-template-rows:32px 8px;min-height:54px;height:54px;padding:4px;gap:2px;align-items:center}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-spell>.mobile-symbol{--symbol-size:30px;grid-column:1;grid-row:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-spell .hud-spell-cost{grid-column:2;grid-row:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-spell .hud-spell-status{grid-column:2;grid-row:2;padding:0;background:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-spell-status .mobile-symbol{--symbol-size:12px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-spell-progress{grid-column:1;grid-row:2;display:block;width:100%;height:3px;background:#b4ac96}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-spell-progress>i{display:block;height:100%;background:#485f7a}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] :is(button,[tabindex]):focus-visible{outline:3px solid #ffe6a3;outline-offset:2px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-select{position:absolute;inset:0;z-index:4;display:block;width:100%;height:100%;min-width:48px;min-height:48px;padding:0;border:0;border-radius:5px;background:transparent;box-shadow:none;color:inherit;touch-action:manipulation}
@media(max-height:650px){html:not([data-platform="android"]) .battle-hud[data-figures="true"]{--figure-height:88px}}
@media(prefers-reduced-motion:reduce){.battle-hud[data-figures="true"] *,.battle-hud[data-figures="true"] *::before,.battle-hud[data-figures="true"] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* Technical integration: single/pair encounters retain centered fixed positions. */
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-capacity="1"]>[data-slot="0"]{grid-column:3/5;grid-row:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-capacity="2"]>[data-slot="0"]{grid-column:2/4;grid-row:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-capacity="2"]>[data-slot="1"]{grid-column:4/6;grid-row:1}
/* Event-owned art ghosts. Health, logical positions and native detail targets stay still. */
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-field{position:relative;isolation:isolate}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-effects{position:absolute;inset:0;z-index:2;pointer-events:none;overflow:hidden}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-effects *{pointer-events:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-unit[data-figure-leaping="true"] .hud-figure-sprite{visibility:hidden}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-leap{position:absolute;left:var(--figure-x);top:var(--figure-y);width:var(--figure-width);height:var(--figure-height);margin-left:calc(var(--figure-width)*-.5);margin-top:calc(var(--figure-height)*-.55);animation:hud-figure-leap var(--figure-leap-duration,560ms) linear both}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-leap>img{display:block;width:100%;height:100%;object-fit:contain;scale:var(--figure-facing,1) 1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"][data-figure-motion="paused"] .hud-figure-leap{animation-play-state:paused}
@keyframes hud-figure-leap{0%{translate:0 0}28%{translate:calc(var(--figure-dx)*.8) calc(var(--figure-dy)*.8 - 14px)}42%,50%{translate:var(--figure-dx) var(--figure-dy)}72%{translate:calc(var(--figure-dx)*.45) calc(var(--figure-dy)*.45 - 10px)}100%{translate:0 0}}
@media(prefers-reduced-motion:reduce){.battle-hud[data-figures="true"] .hud-figure-leap{display:none}.battle-hud[data-figures="true"] .hud-unit[data-figure-leaping="true"] .hud-figure-sprite{visibility:visible}}
/* Keep committed vitals/help above decorative travel; fallen figures keep their own art. */
html:not([data-platform="android"]) .battle-hud[data-figures="true"] :is(.hud-vitals,.hud-unit-effect,.attack-meter,.hud-figure-threat){position:relative;z-index:3}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-rig::after{content:none!important}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-rig>.mobile-life-mark{background:none;box-shadow:inset 0 0 14px #e7d29a80}
/* Three real world planes: chapter art remains the middle atmosphere. */
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-scenery{position:absolute;inset:0;z-index:0;overflow:hidden;pointer-events:none;perspective:600px;background:#17252a}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-plane{position:absolute;inset:-20px;background-size:cover;background-position:center;pointer-events:none;backface-visibility:hidden}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-plane-far{background-image:url("assets/battle-figures/far.webp");transform:translate3d(calc(var(--figure-pan-x,0)*2px),calc(var(--figure-pan-y,0)*2px),-30px) scale(1.06)}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-plane-middle{background-image:linear-gradient(#14212622,#172b2522),var(--campaign-background,url("assets/battle-figures/road.webp"));mask-image:linear-gradient(transparent,#000 28%);transform:translate3d(calc(var(--figure-pan-x,0)*4px),calc(var(--figure-pan-y,0)*4px),0)}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-plane-near{background-image:url("assets/battle-figures/foreground.webp");transform:translate3d(calc(var(--figure-pan-x,0)*7px),calc(var(--figure-pan-y,0)*7px),16px)}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-figure-rig{z-index:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"][data-figure-impact="hit"] .hud-figure-scenery{animation:hud-world-hit var(--figure-world-duration,180ms) ease-out both}
html:not([data-platform="android"]) .battle-hud[data-figures="true"][data-figure-impact="charged"] .hud-figure-scenery{animation:hud-world-charged var(--figure-world-duration,360ms) ease-out both}
html:not([data-platform="android"]) .battle-hud[data-figures="true"][data-figure-motion="paused"] .hud-figure-scenery{animation-play-state:paused}
@keyframes hud-world-hit{0%,100%{translate:0 0}25%{translate:-2px 1px}55%{translate:2px -1px}80%{translate:-1px 0}}
@keyframes hud-world-charged{0%,100%{translate:0 0}18%{translate:-5px 3px}40%{translate:4px -2px}65%{translate:-3px 1px}82%{translate:1px -1px}}
@media(prefers-reduced-motion:reduce){.battle-hud[data-figures="true"] .hud-figure-scenery{animation:none!important;translate:0 0}.battle-hud[data-figures="true"] .hud-figure-plane{transform:none!important}}
html[data-mobile-motion="off"] .battle-hud[data-figures="true"] .hud-figure-scenery{animation:none!important;translate:0 0}
html[data-mobile-motion="off"] .battle-hud[data-figures="true"] .hud-figure-plane{transform:none!important}
/* Minimal symbol vocabulary, scoped to battle rather than the rest of the website. */
.battle-hud[data-figures="true"] .mobile-symbol{display:inline-grid;place-items:center;flex:0 0 auto;width:var(--symbol-size,1.25em);height:var(--symbol-size,1.25em);vertical-align:-.18em;color:inherit;line-height:1;pointer-events:none}
.battle-hud[data-figures="true"] .mobile-symbol>svg{display:block;width:100%;height:100%}
.battle-hud[data-figures="true"] .mobile-symbol:is([data-symbol="flare"],[data-symbol="ward"],[data-symbol="bloom"]){--rune-x:0%;background:#dec795 url("assets/rune-atlas-grimoire.webp") var(--rune-x) 0/300% 200% no-repeat;border-radius:3px}
.battle-hud[data-figures="true"] .mobile-symbol[data-symbol="ward"]{--rune-x:50%}
.battle-hud[data-figures="true"] .mobile-symbol[data-symbol="bloom"]{--rune-x:100%}
.battle-hud[data-figures="true"] .symbol-stat{display:inline-flex;align-items:center;gap:.22em;white-space:nowrap;font-variant-numeric:tabular-nums}
.battle-hud[data-figures="true"] .symbol-sr{position:absolute!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;overflow:hidden!important;clip-path:inset(50%)!important;white-space:nowrap!important;border:0!important}
.battle-hud[data-figures="true"] .hud-controls .symbol-only{display:grid;place-items:center;color:#fff2d2;background:#344c3e}
/* Source sprites travel; the reserved units, health and hit targets do not. */
.battle-hud[data-figures="true"] .mobile-attack-trace{position:absolute;z-index:2;width:23px;height:8px;margin:-4px 0 0 -11.5px;opacity:0;pointer-events:none;animation:mobile-attack-travel var(--motion-duration,240ms) linear both}
.battle-hud[data-figures="true"] .mobile-attack-trace::before,.battle-hud[data-figures="true"] .mobile-attack-trace::after{content:"";position:absolute;display:block;pointer-events:none;clip-path:polygon(0 43%,64% 36%,58% 0,100% 50%,58% 100%,64% 65%,0 58%)}
.battle-hud[data-figures="true"] .mobile-attack-trace::before{inset:0;background:#fff0c4}
.battle-hud[data-figures="true"] .mobile-attack-trace::after{inset:1px 2px;background:var(--trace-ink,#bc7945)}
.battle-hud[data-figures="true"] .mobile-attack-trace[data-faction="moon"]{--trace-ink:#9bb9ec}
.battle-hud[data-figures="true"] .mobile-attack-trace[data-faction="thorn"]{--trace-ink:#99cd95}
.battle-hud[data-figures="true"] .hud-figure-rig>:is(.mobile-spell-mark,.mobile-life-mark){position:absolute;inset:0;display:block;z-index:2;pointer-events:none}
.battle-hud[data-figures="true"] .mobile-spell-mark[data-effect="flare"]{background:url("assets/flare-frames.webp") 0 0/300% 300% no-repeat;animation:mobile-flare-frames var(--motion-duration,360ms) steps(1,end) both,mobile-stamp-fade var(--motion-duration,360ms) linear both}
.battle-hud[data-figures="true"] .hud-figure-rig>.mobile-spell-mark:is([data-effect="ward"],[data-effect="bloom"]){inset:auto;left:50%;top:0;width:24px;height:26px;translate:-50% -35%;background:none;animation:mobile-spell-stamp var(--motion-duration,360ms) ease-out both}
.battle-hud[data-figures="true"] .mobile-spell-mark[data-effect="ward"]::before{content:"";position:absolute;inset:1px 2px;background:#b9ddffb8;clip-path:polygon(50% 0,100% 17%,88% 70%,50% 100%,12% 70%,0 17%)}
.battle-hud[data-figures="true"] .mobile-spell-mark[data-effect="bloom"]::before,.battle-hud[data-figures="true"] .mobile-spell-mark[data-effect="bloom"]::after{content:"";position:absolute;inset:3px 9px;background:#bbefb6b8;border-radius:2px}
.battle-hud[data-figures="true"] .mobile-spell-mark[data-effect="bloom"]::after{inset:10px 2px}
.battle-hud[data-figures="true"] .mobile-life-mark{background:none;animation:mobile-spell-stamp var(--motion-duration,320ms) ease-out both;box-shadow:inset 0 0 12px #e7d29a66}
.battle-hud[data-figures="true"][data-figure-motion="paused"] :is(.mobile-attack-trace,.mobile-spell-mark,.mobile-life-mark){animation-play-state:paused}
@keyframes mobile-attack-travel{0%{opacity:0;transform:translate(0,0) rotate(var(--motion-angle))}15%,76%{opacity:1}100%{opacity:0;transform:translate(var(--motion-x),var(--motion-y)) rotate(var(--motion-angle))}}
@keyframes mobile-flare-frames{0%{background-position:0 0}12%{background-position:50% 0}24%{background-position:100% 0}36%{background-position:0 50%}48%{background-position:50% 50%}60%{background-position:100% 50%}72%{background-position:0 100%}84%{background-position:50% 100%}100%{background-position:100% 100%}}
@keyframes mobile-stamp-fade{0%{opacity:.25}25%,68%{opacity:.8}100%{opacity:0}}
@keyframes mobile-spell-stamp{0%{opacity:0;scale:.8}26%{opacity:.78;scale:1}72%{opacity:.7}100%{opacity:0;scale:1.05}}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-field{overflow:hidden}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-side{width:min(100%,960px);justify-self:center}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster>.hud-unit{max-width:280px;justify-self:center}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] :is(.hud-vitals,.hud-unit>.attack-meter){width:min(100%,180px);justify-self:center}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-unit[data-marked="true"] .hud-figure-sprite{animation:web-figure-marked 1.2s ease-in-out infinite}
html:not([data-platform="android"]) .battle-hud[data-figures="true"][data-figure-motion="paused"] .hud-unit[data-marked="true"] .hud-figure-sprite{animation-play-state:paused}
@keyframes web-figure-marked{0%,100%{filter:drop-shadow(1px 0 0 #ff6659) drop-shadow(-1px 0 0 #ff6659) drop-shadow(0 1px 0 #ff6659) drop-shadow(0 -1px 0 #ff6659)}50%{filter:drop-shadow(1px 0 0 #ff9c88) drop-shadow(-1px 0 0 #ff9c88) drop-shadow(0 1px 0 #ff9c88) drop-shadow(0 -1px 0 #ff9c88) drop-shadow(0 0 3px #d64b4280)}}
@media(min-width:1000px) and (min-height:651px){html:not([data-platform="android"]) .battle-hud[data-figures="true"]{--figure-height:160px}}
@media(min-width:1000px) and (min-height:760px){html:not([data-platform="android"]) .battle-hud[data-figures="true"]{--figure-height:192px}}
@media(prefers-reduced-motion:reduce){.battle-hud[data-figures="true"] :is(.mobile-attack-trace,.mobile-spell-mark,.mobile-life-mark){display:none}.battle-hud[data-figures="true"] .hud-unit[data-marked="true"] .hud-figure-sprite{animation:none!important;filter:var(--figure-filter)}}
html[data-mobile-motion="off"] .battle-hud[data-figures="true"] :is(.mobile-attack-trace,.mobile-spell-mark,.mobile-life-mark){display:none}
/* First-run guidance never displaces or blocks the global spell controls. */
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-dock.command-bar{position:relative;overflow:visible}
.battle-hud[data-figures="true"] .hud-guidance:empty,.battle-hud[data-figures="true"] .hud-guidance:not(:has(.tutorial-panel)){display:none}
.battle-hud[data-figures="true"] .hud-guidance:has(.tutorial-panel){position:absolute;inset:auto 8px calc(100% + 4px);z-index:6;max-height:min(30svh,148px);margin:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;border-radius:6px;background:#efe3c5;color:#302d24;box-shadow:0 -3px 10px #0004}
.battle-hud[data-figures="true"] .hud-guidance .tutorial-panel{margin:0;padding:6px;display:grid;grid-template-columns:minmax(0,1fr);gap:4px;min-width:0;font:var(--type-caption)/18px var(--sans)}
.battle-hud[data-figures="true"] .hud-guidance .tutorial-heading{grid-column:1;min-width:0}
.battle-hud[data-figures="true"] .hud-guidance .tutorial-heading h3{margin:0;color:#302d24;font:600 var(--type-caption)/18px var(--sans)}
.battle-hud[data-figures="true"] .hud-guidance .tutorial-copy{grid-column:1;min-width:0;margin:0;color:#302d24;overflow-wrap:anywhere}
.battle-hud[data-figures="true"] .hud-guidance .tutorial-skip{grid-column:1;grid-row:3;align-self:center;width:100%;min-height:48px;min-width:48px;padding:6px 10px;white-space:normal;word-break:normal;overflow-wrap:normal;line-height:20px;color:#34382e;background:#e0d2ad}
.battle-hud[data-figures="true"]:has(.hud-guidance .tutorial-panel) .hud-body::after{content:"";display:block;flex:0 0 min(30svh,152px);pointer-events:none}
/* LC207: larger figures, grouped health/readiness, and the same art in preparation. */
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster>:is(.hud-unit,.hud-empty-position){grid-template-rows:var(--figure-height) 22px 16px;min-height:calc(var(--figure-height) + 38px)}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="enemy"]>.hud-unit{grid-template-rows:22px var(--figure-height) 16px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-vitals{height:22px;align-items:flex-start;padding-bottom:4px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-vitals>.attack-meter{position:absolute;inset:auto 0 0;grid-row:auto;width:100%;height:2px;margin:0;background:#334038;overflow:hidden}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-vitals>.attack-meter>i{display:block;height:100%;background:#e3bf6b}
.prep-figure-card{--figure-height:128px;position:relative;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:var(--figure-height) 22px;gap:0;align-content:start;width:100%;height:auto;min-height:calc(var(--figure-height) + 22px);max-height:none;margin:0;padding:0 2px;border:0;border-radius:0;background:none;color:#f2ecd8;box-shadow:none;overflow:visible}
.prep-figure-card::before,.prep-figure-card::after{content:none!important}
.prep-figure-card .hud-figure-rig{position:relative;display:block;width:100%;height:var(--figure-height);min-width:0;min-height:0;aspect-ratio:auto;overflow:visible;background:none;border:0;pointer-events:none}
.prep-figure-card .hud-figure-sprite{position:absolute;inset:0;display:block;width:100%;height:100%;min-width:0;min-height:0;max-width:100%;max-height:100%;object-fit:contain;object-position:center bottom;scale:var(--figure-facing,1) 1;filter:drop-shadow(0 2px 2px #0008);pointer-events:none}
.prep-figure-card .hud-vitals{position:relative;display:flex;align-items:flex-start;justify-content:center;flex-wrap:nowrap;gap:3px;isolation:isolate;min-width:0;height:22px;padding-bottom:4px;background:#152220e8;color:#f2ecd8;font:600 var(--type-caption)/18px var(--sans);font-variant-numeric:tabular-nums}
.prep-figure-card .hud-vitals>.hp-track{position:absolute;inset:0 0 auto;z-index:-1;width:100%;height:18px;margin:0;background:#23302b;overflow:hidden;border:0;border-radius:3px}
.prep-figure-card .hp-fill{display:block;height:100%;background:#496447}
.prep-figure-card.enemy-card .hp-fill{background:#8d4635}
.prep-figure-card .hp-text{color:inherit;white-space:nowrap;text-shadow:0 1px 2px #000}
.prep-figure-card .hud-vitals>.shield-pill{position:static;display:inline-flex;align-items:center;gap:1px;min-width:0;max-width:100%;margin:0;padding:0;background:none;border:0;color:#d5e9ff;font:inherit;white-space:nowrap}
.prep-figure-card .hud-vitals>.shield-pill:is([hidden],.hidden){display:none}
.prep-figure-card .hud-vitals>.attack-meter{position:absolute;inset:auto 0 0;width:100%;height:2px;margin:0;background:#334038;overflow:hidden}
.prep-figure-card .attack-meter>i{display:block;height:100%;background:#e3bf6b}
.prep-figure-card.enemy-card{grid-template-rows:22px var(--figure-height);padding-top:48px}
.prep-figure-card.enemy-card>.hud-vitals{grid-row:1}
.prep-figure-card.enemy-card>.hud-figure-rig{grid-row:2}
.prep-figure-card.enemy-card>.enemy-intent{position:absolute;inset:0 0 auto auto;display:flex;align-items:center;justify-content:center;width:48px;min-height:48px;max-height:48px;background:none;border:0}
.prep-figure-card.enemy-card>.enemy-intent .info-trigger{min-height:48px;min-width:48px;z-index:4}
.prep-figure-card.enemy-card>.enemy-boss-mark{position:absolute;top:4px;left:4px;width:24px;height:24px;margin:0;font-size:20px;line-height:24px}
.prep-figure-card .prep-figure-meta{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
html:not([data-platform="android"]) #app #battlefield[data-figures="true"][data-figure-phase="prep"]{--figure-height:128px;min-width:0;max-width:100%;min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-auto-rows:max-content;align-content:start;gap:8px;padding:8px}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"]{display:grid;grid-template-columns:repeat(6,minmax(0,1fr))!important;grid-auto-rows:max-content;align-items:start;gap:8px 4px;width:100%;max-width:960px;min-height:0;margin-inline:auto}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"]>.formation-slot{grid-column:span 2;grid-row:auto;min-width:0;min-height:0;width:100%;max-width:none;align-self:start;align-content:start;align-items:start;justify-content:stretch;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto;gap:2px;outline:none}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-capacity="4"]>.formation-slot{grid-column:span 3}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-content{position:relative;display:block;min-height:0}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-content>.prep-figure-card{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:var(--figure-height) 22px;width:100%;max-width:none;min-height:calc(var(--figure-height) + 22px);height:auto;align-self:start;padding:0 2px;border:0;background:none;box-shadow:none}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-empty{height:calc(var(--figure-height) + 22px);min-height:calc(var(--figure-height) + 22px);max-width:none;aspect-ratio:auto;margin:0}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .prep-figure-info{position:absolute;top:0;right:0;z-index:4}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board:is([data-capacity="3"],[data-capacity="5"])>[data-slot="0"]{grid-column:3/5;grid-row:1}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board:is([data-capacity="3"],[data-capacity="5"])>[data-slot="1"]{grid-column:1/3;grid-row:1}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board:is([data-capacity="3"],[data-capacity="5"])>[data-slot="2"]{grid-column:5/7;grid-row:1}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-capacity="5"]>[data-slot="3"]{grid-column:2/4;grid-row:2}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-capacity="5"]>[data-slot="4"]{grid-column:4/6;grid-row:2}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>.enemy-row{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-auto-rows:max-content;gap:8px 4px;align-items:start;width:100%;max-width:960px;justify-self:center}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>.enemy-row>.prep-figure-card{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:22px var(--figure-height);grid-column:span 2;grid-row:auto;order:0;min-width:0;max-width:none;height:auto;align-self:start;border:0;background:none;box-shadow:none}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>.enemy-row[data-enemy-count="4"]>.prep-figure-card{grid-column:span 3}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>.enemy-row[data-enemy-count="5"]>.prep-figure-card:nth-child(4){grid-column:2/4;grid-row:2}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>.enemy-row[data-enemy-count="5"]>.prep-figure-card:nth-child(5){grid-column:4/6;grid-row:2}
@media(max-height:650px){.prep-figure-card{--figure-height:88px}}
@media(min-width:1000px) and (min-height:651px){.prep-figure-card{--figure-height:160px}}
@media(min-width:1000px) and (min-height:760px){.prep-figure-card{--figure-height:192px}}
@media(max-height:650px){html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]{--figure-height:88px}}
@media(min-width:1000px) and (min-height:651px){html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]{--figure-height:160px}}
@media(min-width:1000px) and (min-height:760px){html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]{--figure-height:192px}}
@media(max-width:699px){
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster{grid-template-columns:repeat(12,minmax(0,1fr))!important}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side][data-capacity]>[data-slot]{grid-column:span 6;grid-row:auto;translate:none}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side]:is([data-capacity="1"],[data-capacity="3"],[data-capacity="5"])>:last-child{grid-column:4/10}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"]{grid-template-columns:repeat(12,minmax(0,1fr))!important}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-capacity]>[data-slot]{grid-column:span 6;grid-row:auto;translate:none}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board:is([data-capacity="1"],[data-capacity="3"],[data-capacity="5"])>:last-child{grid-column:4/10}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>.enemy-row{grid-template-columns:repeat(12,minmax(0,1fr))}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>.enemy-row[data-enemy-count]>.prep-figure-card{grid-column:span 6;grid-row:auto;order:0}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>.enemy-row:is([data-enemy-count="1"],[data-enemy-count="3"],[data-enemy-count="5"])>.prep-figure-card:last-child{grid-column:4/10}
 .battle-hud[data-figures="true"] .hud-roster[data-side="ally"]>[data-slot]:nth-child(odd) .hud-figure-sprite{--figure-facing:1}
 .battle-hud[data-figures="true"] .hud-roster[data-side="ally"]>[data-slot]:nth-child(even) .hud-figure-sprite{--figure-facing:-1}
 .battle-hud[data-figures="true"] .hud-roster[data-side="enemy"]>[data-slot]:nth-child(odd) .hud-figure-sprite{--figure-facing:-1}
 .battle-hud[data-figures="true"] .hud-roster[data-side="enemy"]>[data-slot]:nth-child(even) .hud-figure-sprite{--figure-facing:1}
 .battle-hud[data-figures="true"] .hud-roster:is([data-capacity="1"],[data-capacity="3"],[data-capacity="5"])>:last-child .hud-figure-sprite{--figure-facing:1}
 .formation-board[data-figures="true"]>[data-slot]:nth-child(odd) .hud-figure-sprite{--figure-facing:1}
 .formation-board[data-figures="true"]>[data-slot]:nth-child(even) .hud-figure-sprite{--figure-facing:-1}
 .formation-board[data-figures="true"]:is([data-capacity="1"],[data-capacity="3"],[data-capacity="5"])>:last-child .hud-figure-sprite{--figure-facing:1}
 #battlefield[data-figure-phase="prep"]>.enemy-row>.prep-figure-card:nth-child(odd) .hud-figure-sprite{--figure-facing:-1}
 #battlefield[data-figure-phase="prep"]>.enemy-row>.prep-figure-card:nth-child(even) .hud-figure-sprite{--figure-facing:1}
 #battlefield[data-figure-phase="prep"]>.enemy-row:is([data-enemy-count="1"],[data-enemy-count="3"],[data-enemy-count="5"])>.prep-figure-card:last-child .hud-figure-sprite{--figure-facing:1}
}
@media(max-width:699px){
 html:not([data-platform="android"]) body:has(#battlefield[data-figure-phase="prep"]) #app .sidebar{display:grid;grid-template-columns:minmax(0,1fr);min-width:0;max-width:100%;width:100%}
 html:not([data-platform="android"]) body:has(#battlefield[data-figure-phase="prep"]) #app .sidebar>.panel{min-width:0;max-width:100%;grid-column:1}
}

html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>#pause-overlay:empty{display:none}
/* Five fixed slots use three front positions and a centered rear pair on mobile. */
@media(max-width:699px){
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side][data-capacity="5"]>[data-slot]{grid-column:span 4;grid-row:1;translate:none}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side][data-capacity="5"]>[data-slot="3"]{grid-column:3/7;grid-row:2}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side][data-capacity="5"]>[data-slot="4"]{grid-column:7/11;grid-row:2}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity="5"]>[data-slot="0"]{grid-column:5/9}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity="5"]>[data-slot="1"]{grid-column:1/5}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity="5"]>[data-slot="2"]{grid-column:9/13}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity="5"]>[data-slot]{grid-column:span 4;grid-row:1;translate:none}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity="5"]>[data-slot="0"]{grid-column:5/9}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity="5"]>[data-slot="1"]{grid-column:1/5}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity="5"]>[data-slot="2"]{grid-column:9/13}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity="5"]>[data-slot="3"]{grid-column:3/7;grid-row:2}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity="5"]>[data-slot="4"]{grid-column:7/11;grid-row:2}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity="5"]>:is([data-slot="0"],[data-slot="1"],[data-slot="3"]) .hud-figure-sprite,
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity="5"]>:is([data-slot="0"],[data-slot="1"],[data-slot="3"]) .hud-figure-sprite{--figure-facing:1}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity="5"]>:is([data-slot="2"],[data-slot="4"]) .hud-figure-sprite,
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity="5"]>:is([data-slot="2"],[data-slot="4"]) .hud-figure-sprite{--figure-facing:-1}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="enemy"][data-capacity="5"]>:is([data-slot="0"],[data-slot="3"]) .hud-figure-sprite{--figure-facing:-1}
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="enemy"][data-capacity="5"]>:is([data-slot="1"],[data-slot="2"],[data-slot="4"]) .hud-figure-sprite{--figure-facing:1}
}
/* Canonical allied formation: vanguard centered and advanced; rear slots stay fixed. */
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity]:is([data-capacity="1"],[data-capacity="2"],[data-capacity="3"],[data-capacity="4"],[data-capacity="5"]),
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity]:is([data-capacity="1"],[data-capacity="2"],[data-capacity="3"],[data-capacity="4"],[data-capacity="5"]){grid-template-columns:repeat(12,minmax(0,1fr))!important;padding-top:14px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity]:is([data-capacity="1"],[data-capacity="2"],[data-capacity="3"],[data-capacity="4"],[data-capacity="5"])>[data-slot],
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity]:is([data-capacity="1"],[data-capacity="2"],[data-capacity="3"],[data-capacity="4"],[data-capacity="5"])>[data-slot]{grid-column:span 4;grid-row:1;translate:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity]:is([data-capacity="1"],[data-capacity="2"],[data-capacity="3"],[data-capacity="4"],[data-capacity="5"])>[data-slot="0"],
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity]:is([data-capacity="1"],[data-capacity="2"],[data-capacity="3"],[data-capacity="4"],[data-capacity="5"])>[data-slot="0"]{grid-column:5/9;translate:0 -8px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity]:is([data-capacity="1"],[data-capacity="2"],[data-capacity="3"],[data-capacity="4"],[data-capacity="5"])>[data-slot="1"],
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity]:is([data-capacity="1"],[data-capacity="2"],[data-capacity="3"],[data-capacity="4"],[data-capacity="5"])>[data-slot="1"]{grid-column:1/5}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity]:is([data-capacity="1"],[data-capacity="2"],[data-capacity="3"],[data-capacity="4"],[data-capacity="5"])>[data-slot="2"],
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity]:is([data-capacity="1"],[data-capacity="2"],[data-capacity="3"],[data-capacity="4"],[data-capacity="5"])>[data-slot="2"]{grid-column:9/13}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity][data-capacity="4"]>[data-slot="3"],
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity][data-capacity="4"]>[data-slot="3"]{grid-column:5/9;grid-row:2}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity][data-capacity="5"]>[data-slot="3"],
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity][data-capacity="5"]>[data-slot="3"]{grid-column:3/7;grid-row:2}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity][data-capacity="5"]>[data-slot="4"],
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity][data-capacity="5"]>[data-slot="4"]{grid-column:7/11;grid-row:2}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity] :is([data-slot="0"],[data-slot="1"],[data-slot="3"]) .hud-figure-sprite,
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity] :is([data-slot="0"],[data-slot="1"],[data-slot="3"]) .hud-figure-sprite{--figure-facing:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"][data-capacity] :is([data-slot="2"],[data-slot="4"]) .hud-figure-sprite,
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .formation-board[data-figures="true"][data-capacity] :is([data-slot="2"],[data-slot="4"]) .hud-figure-sprite{--figure-facing:-1}
/* Keep real numeric vitals on one baseline inside the narrow allied figure cell. */
@media(max-width:699px){
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .prep-figure-card .hud-vitals,
 html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-roster[data-side="ally"] .hud-vitals{font-size:11px;gap:1px;white-space:nowrap;overflow:hidden}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .prep-figure-card .hud-vitals>.hp-text,
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .prep-figure-card .hud-vitals>.shield-pill{flex:none;white-space:nowrap;overflow-wrap:normal;line-height:18px}
 html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .prep-figure-card .hud-vitals>.shield-pill{align-self:center;height:18px;width:auto;padding:0;margin:0}
}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>.prep-synergies{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0;padding:0;margin:0;border:0;background:none}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"]>.prep-synergies:empty{display:none}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .prep-synergy-icon{display:grid;place-items:center;flex:0 0 48px;width:48px;min-width:48px;height:48px;padding:0;border:1px solid var(--faction,#c6b17d);border-radius:50%;background:#19281de8;color:var(--faction,#e8cf91);font:600 26px/1 var(--serif);box-shadow:inset 0 0 12px #0006;transform:none}
html:not([data-platform="android"]) #app #battlefield[data-figure-phase="prep"] .prep-synergy-icon:focus-visible{outline:3px solid #f6d993;outline-offset:2px}
/* Only the actual journey talisman rack; reward cards and other headers are separate. */
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row){display:flex;flex-flow:row wrap;align-items:center;align-content:flex-start;gap:4px 6px;flex:0 0 auto;align-self:start;width:100%;height:max-content;min-height:0;padding:8px}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.side-label{display:contents}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.side-label>.small-label{order:0;flex:0 1 auto;min-width:0;font-size:var(--type-caption);line-height:20px;overflow-wrap:normal}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.relic-row{order:2;display:flex;align-items:center;flex:0 1 auto;flex-wrap:wrap;gap:4px;min-width:0;max-width:100%;margin:0}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.relic-row:empty{display:none}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.relic-row>.relic-icon{position:relative;display:grid;place-items:center;flex:0 0 44px;width:44px;min-width:44px;max-width:44px;height:44px;min-height:44px;padding:0;transform:none}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.relic-row>.relic-icon>img{display:block;flex:none;width:32px;height:32px;min-width:0;min-height:0;max-width:32px;max-height:32px;object-fit:contain;object-position:center;border-radius:3px}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.relic-row>.relic-icon[data-relic]::before{inset:auto;left:50%;top:50%;width:32px;height:32px;aspect-ratio:1;transform:translate(-50%,-50%);background-size:300% 300%;background-repeat:no-repeat}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.relic-row>.relic-icon[data-relic]:not(:is([data-relic="ember-heart"],[data-relic="moonstone"],[data-relic="wild-seed"],[data-relic="quick-sand"],[data-relic="sun-flask"],[data-relic="storm-bottle"],[data-relic="iron-root"],[data-relic="everlight"],[data-relic="caravan-heart"],[data-relic="astral-knot"])){color:#ecd29b;background:#29352d;font:24px/1 var(--serif)}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.relic-row>.relic-icon[data-relic]:not(:is([data-relic="ember-heart"],[data-relic="moonstone"],[data-relic="wild-seed"],[data-relic="quick-sand"],[data-relic="sun-flask"],[data-relic="storm-bottle"],[data-relic="iron-root"],[data-relic="everlight"],[data-relic="caravan-heart"],[data-relic="astral-knot"]))::before{content:none}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>:is(.keystone-state,.position-effect-status){order:3;flex:1 0 100%;min-width:0;margin:0}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.position-effect-status:empty{display:none}
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.relic-row>.resource-plus{flex:0 0 44px;width:44px;min-width:44px;height:44px;min-height:44px;margin:0;padding:0;border-radius:50%}
/* The astral knot has a standalone square source despite the shared data attribute. */
html:not([data-platform="android"]) #app .sidebar>.panel:has(>.relic-row)>.relic-row>.relic-icon[data-relic="astral-knot"]::before{content:"";background-image:url("assets/astral-knot.webp");background-size:100% 100%;background-position:center}
/* Dark miniature hero cards retain the existing global spell actions. */
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-dock.command-bar:has(.hud-spells[data-hero-dock="true"]){height:90px;padding:2px 8px;border-top:1px solid #9e895d;background:#192220f5;box-shadow:0 -3px 8px #0004}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-magic:has(>.hud-spells[data-hero-dock="true"]){grid-template-rows:16px 66px;gap:3px;padding:0;background:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-magic:has(>.hud-spells[data-hero-dock="true"])>.hud-mana{height:16px;color:#d8e5fa;font:600 var(--type-caption)/16px var(--sans)}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-magic:has(>.hud-spells[data-hero-dock="true"])>.hud-mana>.mobile-symbol{--symbol-size:16px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-magic:has(>.hud-spells[data-hero-dock="true"]) .hud-mana-segments>i{border-color:#819ac3;background:#29374d}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-magic:has(>.hud-spells[data-hero-dock="true"]) .hud-mana-segments>i[data-filled="true"]{background:#9fbbe8}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-spells[data-hero-dock="true"]{display:flex;align-items:stretch;justify-content:center;gap:4px;min-width:0;height:66px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-spells[data-hero-dock="true"]>.hud-spell.hud-hero-action{position:relative;display:block;flex:1 1 0;width:auto;min-width:48px;max-width:68px;height:66px;min-height:66px;margin:0;padding:1px;overflow:hidden;isolation:isolate;border:1px solid #d8b677;border-radius:6px;background:linear-gradient(#4b513d,#302d23);box-shadow:inset 0 0 0 1px #453a28}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action::before{content:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action::after{content:"";position:absolute;inset:3px;border:1px solid #f4dfac88;border-radius:3px;box-shadow:inset 0 -8px 8px #201b2344;pointer-events:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-portrait{position:absolute;inset:2px;display:block;width:calc(100% - 4px);height:calc(100% - 4px);min-width:0;min-height:0;max-width:100%;max-height:100%;object-fit:cover;object-position:center 35%;border-radius:3px;pointer-events:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action>.mobile-symbol{position:absolute;left:50%;top:45%;translate:-50% -50%;--symbol-size:32px;pointer-events:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action>.hud-spell-cost{position:absolute;right:2px;bottom:2px;z-index:2;display:flex;align-items:center;justify-content:center;gap:2px;min-width:19px;min-height:18px;max-width:100%;padding:1px 4px;border:1px solid #a99165;border-radius:5px 0 3px 0;color:#e4eeff;background:#162638f2;font:600 var(--type-caption)/16px var(--sans);font-variant-numeric:tabular-nums;text-shadow:0 1px #000}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action>.hud-spell-cost .mobile-symbol{--symbol-size:12px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action>.hud-spell-status{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action>.hud-spell-progress{position:absolute;inset:auto 24px 2px 2px;z-index:2;display:block;width:auto;height:2px;background:#465044}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action>.hud-spell-progress>i{background:#e0c788}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-spells[data-hero-dock="true"]>.hud-spell.hud-hero-action:disabled{border-color:#70766a;background:#28302b;box-shadow:none;opacity:1}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action:disabled>.hud-hero-portrait{filter:grayscale(1) brightness(.7)}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action:disabled::after{border-color:#c3c0ac55}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action:disabled>.hud-spell-cost{color:#d1d4cf;background:#28302ff2;border-color:#7f887d}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action:focus-visible{outline:3px solid #ffe6a3;outline-offset:2px;overflow:visible}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action>.hud-action-art{position:absolute;inset:2px;display:grid;place-items:center;min-width:0;min-height:0;overflow:hidden;border-radius:3px;pointer-events:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-action-art>.hud-hero-portrait{inset:0;width:100%;height:100%}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-action-art>.mobile-symbol{--symbol-size:32px}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action:disabled .hud-hero-portrait{filter:grayscale(1) brightness(.7)}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action[data-faction="ember"]::after{border-left:2px solid #bd7148}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action[data-faction="moon"]::after{border-left:2px solid #8198cb}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-hero-action[data-faction="thorn"]::after{border-left:2px solid #789b61}
/* Wave notice is event-owned and never takes a formation grid cell. */
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-field>.hud-wave-status{position:absolute;top:3px;left:50%;translate:-50% 0;z-index:4;max-width:calc(100% - 16px);margin:0;padding:3px 9px;border:1px solid #a58c59;border-radius:5px;background:#192821ed;color:#f4e2b4;font:600 var(--type-caption)/18px var(--sans);font-variant-numeric:tabular-nums;text-align:center;white-space:normal;overflow-wrap:anywhere;box-shadow:0 1px 4px #0005;pointer-events:none;animation:none;transition:none}
html:not([data-platform="android"]) .battle-hud[data-figures="true"] .hud-wave-status[hidden]{display:none!important}
