/* Both breakpoints arrange the same live board, team panels and FX targets. */
.battle-mode #app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(8px, 1.4vw, 22px);
  width: 100%;
  max-width: 1440px;
  padding: 12px max(12px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.arena-teams { display: contents; }
.arena-teams .team { grid-row: 1; padding: clamp(6px, 1vw, 16px); }
.arena-teams .player { grid-column: 1; --seat: #79c9da; }
.arena-teams .enemy { grid-column: 3; --seat: #e18e91; }
.arena-teams .team[data-active="true"] { border-color: var(--seat); box-shadow: inset 0 2px var(--seat); }
.arena-teams .team .team-head strong { color: var(--seat); }
.arena-teams .team-head { flex-wrap: wrap; }
.arena-teams .team .hp-fill { background: var(--seat); }
.arena-teams .monster-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.arena-teams .monster {
  display: grid;
  grid-template-columns: minmax(48px, .9fr) minmax(0, 1fr);
  align-items: center;
}
.arena-teams .portrait-btn { height: auto; min-height: 48px; aspect-ratio: 1; }
.arena-teams .monster-meta { min-width: 0; grid-template-columns: minmax(0, 1fr); border: 0; }
.arena-teams .monster-name, .arena-teams .statuses { overflow-wrap: anywhere; }
.arena-teams .statuses { grid-column: 1 / -1; }
.arena-teams button.quick-feed:enabled { min-height: 44px; }
.battle-mode .battle-center { grid-column: 2; grid-row: 1; width: 100%; max-width: min(100%, max(380px, 69svh)); min-width: 0; margin: 0 auto; }
.arena-turn[data-turn-seat="0"] { border-color: #79c9da; color: #bcebf4; background: #182c35; }
.arena-turn[data-turn-seat="1"] { border-color: #e18e91; color: #f1bdc0; background: #312129; }
.arena-tools { flex-wrap: wrap; }
.arena-tools button, .battle-center summary { min-height: 44px; }
@media (max-width: 820px) {
  .battle-mode #app { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; max-width: 640px; padding-inline: max(6px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-right)); }
  .arena-teams .enemy { grid-column: 2; }
  .battle-mode .battle-center { grid-column: 1 / -1; grid-row: 2; max-width: 540px; }
  .arena-teams .monster { grid-template-columns: clamp(44px, 13vw, 82px) minmax(0, 1fr); }
  .arena-teams .team { padding: 4px; }
  .arena-teams .monster-row { gap: 3px; }
  .arena-teams .monster-meta { padding: 3px; }
  .arena-teams .monster-name { font-size: clamp(13px, 3.5vw, 18px); }
  .arena-teams .quick-feed, .arena-teams .feed-why { max-width: 100%; }
  .arena-teams button.quick-feed { padding-inline: 3px; }
}
.arena-teams .monster-name { white-space: normal; }
.arena-teams .monster { gap: 3px; }
.arena-tools { align-items: flex-start; justify-content: flex-start; }
.arena-tools details { flex: 1; border: 0; }
.arena-tools summary { width: fit-content; }
.duel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Allow document scrolling around the gesture surface and clear phone cutouts. */
@media (max-width: 820px) {
  .battle-mode #app { padding-block-start: 4px; }
  .battle-mode .arena-turn { margin-bottom: 3px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .battle-mode .header, .battle-mode #app {
    padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right));
  }
  .battle-mode #app { padding-block-start: 4px; row-gap: 4px; }
  .battle-mode .header { height: auto; min-height: 42px; }
  .battle-mode .battle-center { max-width: min(100%, 390px); }
}
/* One stable flight destination. The rim and centre stay mounted at every charge. */
.prism-bank .hud-crystal { width: 20px; height: 20px; }
.prism-bank { color: var(--seat); }
.prism-bank .prism-track {
  position: relative; height: 19px; overflow: visible; background: none;
  border: 0; border-radius: 0; box-shadow: none;
}
.prism-channel, .prism-bank svg.prism-outline {
  position: absolute; inset: 3px 0; width: 100%; height: calc(100% - 6px);
}
.prism-channel {
  background: #101720;
  clip-path: polygon(0 50%,3% 4%,22.5% 4%,25% 30%,27.5% 4%,47.5% 4%,50% 30%,52.5% 4%,72.5% 4%,75% 30%,77.5% 4%,97% 4%,100% 50%,97% 96%,77.5% 96%,75% 70%,72.5% 96%,52.5% 96%,50% 70%,47.5% 96%,27.5% 96%,25% 70%,22.5% 96%,3% 96%);
}
.end-charge {
  position: absolute; top: 0; bottom: 0; width: var(--end-fill);
  background: conic-gradient(from 45deg at 50% 50%, #f5fbff, #cfdaea, #f2e9e0, #f6fbff, #c6dedd, #ccd0e5, #f5fbff) 0 0 / 26px 100%;
}
.end-charge.left { left: 0; }
.end-charge.right { right: 0; transform: scaleX(-1); }
.prism-outline { fill: none; stroke: #cdd8e4; stroke-width: 1; }
.prism-core {
  position: absolute; left: 50%; top: 50%; width: 13px; height: 13px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid #d8e0ee; background: #293140;
}
.prism-core::after {
  content: ''; position: absolute; inset: 2px;
  background: linear-gradient(125deg,#fff,#d1e0e3 45%,#e2d9ea 70%,#fff);
}
.prism-track .prism-core { filter: brightness(var(--core-light)); }
.prism-track.complete .prism-core { box-shadow: 0 0 4px #f4f7ffb0; }
.arena-teams .portrait-btn { grid-row: 1 / 3; align-self: center; }
.arena-teams .monster-meta, .companion-action { grid-column: 2; }
.companion-action { min-height: 4px; }
.arena-teams .monster { row-gap: 0; align-content: center; }
.arena-teams button.quick-feed {
  width: 100%; margin: 0; border: 1px solid #e5c487; border-radius: 5px;
  background: linear-gradient(135deg,#ecd5a6,#cda368); color: #291e15;
}
.companion-decision { width: min(26rem, 94vw); max-height: 88svh; overflow: auto; }
.companion-decision .decision-actions button { flex: 1; min-height: 44px; }
@media(max-width:820px) {
  .arena-teams .monster { column-gap: 3px; }
  .arena-teams .monster-meta { padding: 2px 3px; gap: 1px; }
  .arena-teams .monster-row { gap: 2px; }
  .arena-teams .mana-label { font-size: 11px; }
}
/* The portrait and its command share a column; statistics keep their own space. */
.arena-teams .portrait-btn { grid-column: 1; grid-row: 1; }
.arena-teams .monster-meta { grid-column: 2; grid-row: 1 / 3; }
.companion-action { grid-column: 1; grid-row: 2; }
@media (max-width: 820px) {
  .arena-teams .monster { grid-template-columns: clamp(54px, 14vw, 80px) minmax(0, 1fr); min-height: 68px; }
  .arena-teams .portrait-btn { min-height: 44px; }
}

.battle-center details > summary {
  display: flex; align-items: center; gap: .55rem; list-style: none;
  padding: 6px 8px; min-height: 44px;
}
.battle-center details > summary::-webkit-details-marker { display: none; }
.battle-center details > summary::before {
  content: ''; width: 6px; height: 6px; flex: none;
  border: solid currentColor; border-width: 1.5px 1.5px 0 0;
  transform: rotate(45deg);
}
.battle-center details[open] > summary::before { transform: rotate(135deg); }
.arena-tools #hint { margin-inline-start: auto; min-width: 54px; }
@media (max-width: 820px), (orientation: landscape) and (max-height: 520px) {
  .arena-teams .monster { grid-template-columns: clamp(48px, 12vw, 60px) minmax(0,1fr); min-height: 50px; }
  .arena-teams .portrait-btn { grid-row: 1 / 3; }
  .arena-teams .monster-meta { grid-row: 1; }
  .arena-teams .companion-action { grid-column: 2; grid-row: 2; min-height: 0; }
  .arena-teams .companion-action:empty { display: none; }
  .arena-teams .quick-feed:enabled { min-height: 44px; margin: 0; padding: 2px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .arena-teams .team { padding: 4px; }
  .arena-teams .monster-row { gap: 2px; }
  .arena-teams .monster-meta { padding: 2px 3px; gap: 1px; }
}
