/* battle.css — prep, battle HUD, results. Classes prefixed ba-. */
.ba-ol { font-weight: 900; color: var(--cream); paint-order: stroke fill; -webkit-text-stroke: 3.5px var(--ink); text-shadow: 0 2px 0 var(--ink); }

/* ---------- prep ---------- */
/* top band: back · name · (pause), then mode · zoom. The board sits between it and the bottom panel. */
.ba-back { position: absolute; left: 8px; top: 8px; min-width: 48px; }
.ba-head { position: absolute; left: 66px; top: 8px; right: 72px; pointer-events: none; display: flex; flex-direction: column; gap: 1px; }
.ba-nrow { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ba-lname { font-size: 18px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ba-nrow .stars { flex: 0 0 auto; font-size: 13px; }
.ba-ldesc { font-size: 13px; line-height: 1.3; -webkit-text-stroke: 3px var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ba-tools { position: absolute; left: 8px; right: 8px; top: 62px; display: flex; justify-content: space-between; align-items: center; gap: 8px; pointer-events: none; }
.ba-tools > * { pointer-events: auto; }
.ba-mode { min-height: 44px; padding: 2px 12px; }
.ba-mode .btn-label { font-size: 14px; }
.ba-zoom { display: flex; gap: 6px; }
.ba-zb { min-width: 44px; min-height: 44px; padding: 0; border-width: 9px 10px; border-image-width: 9px 10px; }
.ba-zb .btn-label { font-size: 20px; line-height: 1; }
/* bottom panel */
.ba-prep-panel { position: absolute; left: 6px; right: 6px; bottom: 6px; border-width: 14px; border-image-width: 14px; animation: pop .26s cubic-bezier(.3, 1.6, .5, 1); display: flex; flex-direction: column; gap: 6px; max-height: 40%; }
.ba-r1 { display: flex; align-items: center; gap: 6px; }
.ba-info { flex: 1; min-width: 0; }
.ba-name { font-weight: 900; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ba-sub { font-weight: 800; font-size: 13px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ba-arrows { display: flex; gap: 3px; flex: 0 0 auto; }
.ba-arrows .btn { min-width: 44px; min-height: 44px; padding: 0; border-width: 9px 10px; border-image-width: 9px 10px; }
.ba-arrows .btn-label { font-size: 15px; }
.ba-rb { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.ba-orderbtn { flex: 0 0 auto; max-width: 58%; min-height: 44px; padding: 2px 10px; }
.ba-orderbtn .btn-label { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ba-odesc { flex: 1; min-width: 0; font-size: 12px; font-weight: 700; line-height: 1.25; opacity: .85; pointer-events: none; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.ba-strip { display: flex; gap: 4px; align-items: stretch; padding-top: 8px; }
.ba-pg { flex: 0 0 44px; min-width: 44px; min-height: 44px; padding: 0; border-width: 9px 8px; border-image-width: 9px 8px; }
.ba-pg .btn-label { font-size: 22px; }
.ba-tiles { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.ba-tile { position: relative; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 3px 3px 4px; border-radius: 12px; cursor: pointer;
  background: linear-gradient(#fff8e6, #ecdab2); border: 3px solid var(--brass); box-shadow: 0 3px 0 var(--brass-d); font-family: var(--font); color: var(--ink); transition: transform .12s; }
.ba-tile:active { transform: scale(.94); }
.ba-tile.on { background: linear-gradient(#e9ffd9, #c2e2a0); border-color: var(--moss); box-shadow: 0 3px 0 var(--moss-d); }
.ba-tile.focused { outline: 3px solid var(--cyan); }
.ba-tile.r4 { border-color: #e59adf; } .ba-tile.r5 { border-color: #5fe0ec; }
.ba-tart { width: 34px; height: 34px; border-radius: 9px; background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--el, #888) 45%, #fff), #d9c79c); display: flex; align-items: center; justify-content: center; }
.ba-tart img { width: 100%; height: 100%; object-fit: contain; }
.ba-tart:has(> img[src^="data:"]) { background: transparent; }
.ba-tart > img[src^="data:"] { filter: drop-shadow(0 0 1px #fbf1d8) drop-shadow(0 0 1px #fbf1d8) drop-shadow(0 0 1.2px #3a2414); }
.ba-tname { max-width: 100%; font-size: 12px; font-weight: 900; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ba-tbadge { position: absolute; top: -7px; right: -5px; background: var(--moss); color: var(--cream); font-weight: 900; font-size: 11px; padding: 1px 6px; border-radius: 999px; border: 2px solid var(--cream); pointer-events: none; }
.ba-r3 { display: flex; gap: 6px; align-items: stretch; }
.ba-r3 .btn { min-width: 0; min-height: 48px; padding: 2px 6px; }
.ba-r3 .btn-label { font-size: 13px; line-height: 1.1; white-space: normal; text-align: center; }
.ba-fold-i { flex: 0 0 44px; }
.ba-act { flex: 1 1 0; }
.ba-start { flex: 1.6 1 0; }
.ba-start .btn-label { font-size: 17px; }
.collapsed .ba-fold { flex: 1 1 0; }
.ba-omodal { display: flex; flex-direction: column; gap: 8px; }
.ba-otitle { font-size: 20px; text-align: center; }
.ba-obtn { flex-direction: column; gap: 1px; min-height: 52px; }
.ba-obdesc { font-size: 12px; font-weight: 700; line-height: 1.2; opacity: .9; white-space: normal; }

/* ---------- battle HUD ---------- */
.ba-hud { position: absolute; left: 8px; top: 8px; width: 148px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.ba-hud button { pointer-events: auto; }
.ba-hero { display: flex; align-items: center; gap: 6px; }
.ba-port { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; border: 4px solid var(--brass); background: radial-gradient(circle at 50% 60%, #fff3d6, #cdb78a); overflow: hidden; box-shadow: 0 3px 0 var(--brass-d), 0 0 0 2px var(--ink); position: relative; }
.ba-port img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.ba-hb { flex: 1; min-width: 0; }
.ba-bar { height: 12px; border-radius: 7px; background: rgba(28, 20, 38, .8); border: 2px solid var(--ink); overflow: hidden; }
.ba-bar i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; background: linear-gradient(#ffe28a, #e0a53a); }
.ba-bar.green i { background: linear-gradient(#a6e870, #5aa83a); }
.ba-bar.red i { background: linear-gradient(#ff9a7a, #e0644a); }
.ba-hp { font-size: 16px; font-weight: 900; line-height: 1.1; margin-top: 1px; display: block; }
.ba-ochip { align-self: flex-start; font-size: 14px; padding: 2px 10px; border-radius: 999px; background: rgba(42, 26, 18, .72); border: 2px solid var(--cyan); font-weight: 900; color: var(--cream); text-shadow: 0 1px 0 var(--ink); }
.ba-partners { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.ba-prow { display: flex; align-items: center; gap: 6px; transition: opacity .3s, filter .3s; }
.ba-pport { flex: 0 0 auto; position: relative; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--cyan); background: radial-gradient(circle, #fff3d6, #cdb78a); overflow: hidden; }
.ba-pport img { width: 100%; height: 100%; object-fit: contain; }
.ba-pport b { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; color: #ff6a5a; font-size: 20px; text-shadow: 0 0 3px #000; }
.ba-prow .ba-bar { flex: 1; height: 10px; }
.ba-prow.dead { opacity: .55; filter: grayscale(1); }
.ba-prow.dead .ba-pport b { display: flex; }
.ba-cmd { align-self: flex-start; margin-top: 2px; }
.ba-boss { position: absolute; left: 168px; right: 72px; top: 10px; pointer-events: none; }
.ba-bname { font-size: 15px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ba-boss .ba-bar { height: 16px; border-color: var(--ink); }
.ba-bhint { font-size: 12px; text-align: center; margin-top: 3px; line-height: 1.2; color: #ffe08a; }
.ba-orders-panel { position: absolute; left: 8px; top: 50%; width: 236px; transform: translateY(-50%); border-width: 14px; border-image-width: 14px; z-index: 20; animation: popL .22s cubic-bezier(.3, 1.5, .5, 1); display: flex; flex-direction: column; gap: 6px; }
.ba-orders-panel.hidden { display: none; }
@keyframes popL { from { transform: translateY(-50%) scale(.7); opacity: 0; transform-origin: 0 50%; } to { transform: translateY(-50%); opacity: 1; } }
.ba-orders-panel .btn { flex-direction: column; gap: 0; width: 100%; min-height: 50px; padding: 2px 8px; }
.ba-orders-panel .btn-label { font-size: 16px; }
.ba-odesc2 { font-size: 12px; font-weight: 800; color: var(--cream); -webkit-text-stroke: 2.5px var(--moss-d); paint-order: stroke fill; line-height: 1.2; text-align: center; }
.screen-battle.orders-open .ba-partners, .screen-battle.orders-open .ba-cmd { visibility: hidden; }

.ba-floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ba-fl { position: absolute; left: 0; top: 0; display: none; align-items: center; gap: 3px; white-space: nowrap; will-change: transform, opacity; flex-direction: column; }
.ba-fl.on { display: flex; }
.ba-fl span { font-weight: 900; font-size: 22px; color: var(--cream); paint-order: stroke fill; -webkit-text-stroke: 5px var(--ink); text-shadow: 0 2px 0 var(--ink); line-height: 1; }
.ba-fl small { font-weight: 900; font-size: 14px; color: #ffe08a; paint-order: stroke fill; -webkit-text-stroke: 4px var(--ink); line-height: 1; }
.ba-fl.ally span { color: #ff8a6e; }
.ba-fl.crit span { font-size: 30px; color: #ffd24a; }
.ba-fl.heal span { color: #8cf07a; }
.ba-fl.dodge span { color: #c9e8ff; font-size: 18px; }
.ba-fl img { width: 26px; height: 26px; object-fit: contain; display: none; }
.ba-fl.pick { flex-direction: row; }
.ba-fl.pick img { display: block; }

.ba-rtitle { font-size: 26px; text-align: center; }
.ba-revive { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.ba-rdesc { font-size: 15px; font-weight: 800; text-align: center; line-height: 1.4; }
.ba-rrow { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border-radius: 12px; background: rgba(120, 80, 30, .12); }
.ba-rinfo { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 15px; flex-wrap: wrap; justify-content: center; }
.ba-rinfo img { width: 28px; height: 28px; object-fit: contain; }
.ba-rrow .btn { width: 100%; }

/* ---------- results ---------- */
.ba-res { display: flex; align-items: center; justify-content: center; padding: 12px; pointer-events: none; }
.ba-res-panel { pointer-events: auto; width: min(94%, 380px); max-height: 94%; display: flex; flex-direction: column; border-width: 18px; border-image-width: 18px; animation: pop .3s cubic-bezier(.3, 1.6, .5, 1); }
.ba-res-body { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; display: flex; flex-direction: column; gap: 8px; scrollbar-width: none; }
.ba-res-body::-webkit-scrollbar { display: none; }
.ba-res-title { font-size: 32px; text-align: center; color: #ffe7a0; -webkit-text-stroke: 5px var(--ink); }
.ba-res-title.lose { color: #d9c9ff; }
.ba-tag { align-self: center; padding: 2px 12px; border-radius: 999px; background: var(--moss); color: var(--cream); font-weight: 900; font-size: 14px; border: 2px solid var(--brass); animation: pop .3s; }
.ba-rewards { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ba-line { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-weight: 900; font-size: 15px; }
.ba-line .up { color: #fff; background: var(--moss); border-radius: 999px; padding: 1px 10px; border: 2px solid var(--brass); font-size: 14px; animation: pop .3s; }
.ba-line img { width: 30px; height: 30px; object-fit: contain; }
.ba-mrow { display: flex; align-items: center; gap: 6px; }
.ba-mrow .mcard { flex: 0 0 52%; width: 52%; cursor: default; }
.ba-mstat { flex: 1; display: flex; flex-direction: column; gap: 2px; font-weight: 900; font-size: 14px; min-width: 0; }
.ba-mstat .up { color: var(--moss-d); } .ba-mstat .evo { color: #b0307a; }
.ba-res-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; animation: pop .26s; }
.ba-res-btns .btn { flex: 1 1 40%; min-width: 0; }
.ba-res-btns .btn.primary { flex-basis: 100%; order: -1; }
