/* Battle prototype (design/combat/DESIGN.md §9, mock design/battle-mock/side.html): 丹寧拼貼 on a phone-sized frame.
   The grey world is halftone photos + geometry; the team stands on the one warm thing, a wooden board. Denim for
   everything ordinary, coral only for alerts and money (a foe's big hit, theft). Outside #ui, so it sets its own type.
   The frame is drawn at 390×844 and scaled to fit (ui/battle.js). Text is never cut or stacked on other text. */
#battle { position: fixed; inset: 0; height: var(--app-h, auto);z-index: 60; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(rgba(255, 255, 255, .08) 28%, transparent 31%) 0 0 / 8px 8px, var(--os-ink);
  font-family: var(--os-font); color: var(--os-ink); font-weight: 400; touch-action: manipulation; }
#battle * { box-sizing: border-box; font-weight: 400; }
:where(#battle) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.bt-frame { position: relative; flex: none; width: 390px; height: 844px; overflow: hidden; isolation: isolate; transform-origin: 50% 50%;
  background: radial-gradient(rgba(63, 93, 170, .11) 28%, transparent 31%) 0 0 / 8px 8px, var(--os-paper); }
.bt-layer { position: absolute; inset: 0; }
.bt-geo { pointer-events: none; }
.bt-geo svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.bt-slice { position: absolute; height: 9px; background: var(--os-denim); }

/* ---------- top: give up, commission title, route, turn ---------- */
.bt-top { position: absolute; left: 0; right: 0; top: 0; height: 96px; z-index: 6; }
.bt-back { position: absolute; left: 12px; top: 16px; width: 34px; height: 30px; background: var(--os-ink); color: #fff !important; display: grid; place-items: center; font-size: 18px;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); transform: rotate(-6deg); }
.bt-title { position: absolute; left: 50px; top: 10px; max-width: 250px; transform: rotate(-4deg); filter: drop-shadow(3px 3px 0 var(--os-ink)); pointer-events: none; }
.bt-title .k { display: inline-block; max-width: 100%; padding: 2px 10px; background: var(--os-ink); color: #fff; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  clip-path: polygon(0 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.bt-title h1 { margin: -2px 0 0; padding: 5px 22px 6px 12px; background: var(--os-denim); color: #fff; font-size: 20px; line-height: 1.15;
  clip-path: polygon(0 4px, 100% 0, calc(100% - 14px) 100%, 6px 100%); }
.bt-turn { position: absolute; right: 12px; top: 14px; padding: 2px 9px 0; background: var(--os-field); font: 26px/1 var(--os-lcd); transform: rotate(6deg);
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); box-shadow: inset 0 0 0 2px var(--os-ink); }
.bt-turn small { font: 11px var(--os-font); }
.bt-route { position: absolute; left: 58px; top: 70px; display: flex; align-items: center; transform: rotate(-2deg); pointer-events: none; }
.bt-route i { width: 18px; height: 18px; display: grid; place-items: center; font-style: normal; font-size: 10px; background: var(--os-field); border: 2px solid var(--os-ink); }
.bt-route i.done { background: var(--os-ink); color: #fff; }
.bt-route i.now { width: 24px; height: 24px; background: var(--os-denim); color: #fff; transform: rotate(8deg); font-size: 12px; }
.bt-route i.boss { width: 24px; height: 24px; border-radius: 50%; background: var(--os-grey); color: #fff; }
.bt-route i.boss.now { background: var(--os-denim); }
.bt-route b { width: 12px; height: 2px; background: var(--os-ink); }
.bt-route span { margin-left: 8px; font: 11px var(--os-type); white-space: nowrap; }

/* ---------- foes: a group per foe (intent tags, the cut-out, hp + fade gauge, name) ---------- */
.bt-foe { position: absolute; z-index: 3; width: 120px; display: flex; flex-direction: column; align-items: flex-start; transition: opacity .3s; }
.bt-foe.right { align-items: flex-end; }
.bt-foe .tags { display: flex; flex-direction: column; align-items: inherit; gap: 2px; min-height: 22px; z-index: 2; }
.bt-intent { white-space: nowrap; padding: 3px 10px 4px 8px; font-size: 12px; color: #fff; background: var(--os-ink); filter: drop-shadow(2px 2px 0 rgba(31, 42, 74, .35));
  clip-path: polygon(0 3px, 100% 0, calc(100% - 8px) 100%, 4px 100%); transform: rotate(-3deg); }
.bt-foe.right .bt-intent { transform: rotate(3deg); }
.bt-intent b { font: 18px/1 var(--os-lcd); vertical-align: -2px; margin-left: 3px; }
.bt-intent.alert { background: var(--os-coral); }
.bt-intent.ghost { background: var(--os-field); color: var(--os-ink); box-shadow: inset 0 0 0 2px var(--os-ink); font-size: 10px; padding: 2px 9px 3px 7px; }
.bt-intent.calm { background: var(--os-denim); }
.bt-body { position: relative; margin-top: 4px; transition: filter .25s; }
.bt-body img { display: block; width: 100%; filter: drop-shadow(4px 5px 0 rgba(31, 42, 74, .3)); pointer-events: none; }
.bt-eye { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: var(--os-ink); box-shadow: 0 0 0 2px #fff; display: grid; place-items: center; color: #fff; font-size: 12px; line-height: 1; font-style: normal; }
.bt-badge { position: absolute; right: -8px; top: -4px; padding: 1px 5px 0; background: var(--os-coral); color: #fff; font: 16px/1 var(--os-lcd); box-shadow: 0 0 0 2px var(--os-ink); transform: rotate(8deg); }
.bt-loot { position: absolute; left: -6px; bottom: 8px; padding: 1px 5px 0; background: var(--os-coral); color: #fff; font: 15px/1 var(--os-lcd); box-shadow: 0 0 0 2px var(--os-ink); transform: rotate(-6deg); white-space: nowrap; }
.bt-hp { display: flex; align-items: center; gap: 4px; margin-top: 4px; white-space: nowrap; }
.bt-hp .n { padding: 1px 5px 0; background: var(--os-field); font: 16px/1 var(--os-lcd); box-shadow: inset 0 0 0 2px var(--os-ink); }
.bt-fade { display: flex; gap: 2px; transform: skewX(-18deg); }
.bt-fade i { width: 8px; height: 10px; background: #fff; box-shadow: inset 0 0 0 2px var(--os-ink); }
.bt-fade i.c { background: #C8894E; }
.bt-fade i.c:nth-child(3n+2) { background: #E2B26A; }
.bt-fade i.c:nth-child(3n) { background: var(--os-peach); }
.bt-name { margin-top: 2px; padding: 0 4px; font: 11px var(--os-type); background: var(--os-paper); white-space: nowrap; }
/* tap a foe: rings round the ones a chosen card can hit */
.bt-foe.aim .bt-body { animation: bt-aim .8s steps(2, end) infinite; cursor: pointer; }
@keyframes bt-aim { 50% { filter: drop-shadow(0 0 0 var(--os-denim)) drop-shadow(3px 0 0 var(--os-denim)) drop-shadow(-3px 0 0 var(--os-denim)) drop-shadow(0 3px 0 var(--os-denim)); } }
/* colour coming back: a warm print over the grey photo */
.bt-foe.colored .bt-body img { filter: sepia(1) saturate(2.4) hue-rotate(-12deg) brightness(1.05) drop-shadow(4px 5px 0 rgba(31, 42, 74, .3)); }
.bt-foe.hurt .bt-body { animation: bt-shake .3s steps(4, end); }
@keyframes bt-shake { 25% { translate: -5px 0; } 50% { translate: 4px 0; } 75% { translate: -2px 0; } }
.bt-foe.lunge .bt-body { animation: bt-lunge .34s cubic-bezier(.2, .8, .3, 1); }
@keyframes bt-lunge { 40% { translate: -26px 6px; } }
.bt-foe.down { pointer-events: none; animation: bt-down .9s ease-in forwards; }
.bt-foe.down .bt-body img { filter: sepia(1) saturate(2.6) hue-rotate(-12deg) brightness(1.08); }
@keyframes bt-down { 30% { transform: translateY(-8px) scale(1.06); opacity: 1; } 100% { transform: translateY(-46px) scale(.9); opacity: 0; } }
.bt-foe.fled { pointer-events: none; animation: bt-flee .7s ease-in forwards; }
@keyframes bt-flee { to { transform: translateX(160px) rotate(12deg); opacity: 0; } }
.bt-foe.enter { animation: bt-enter .35s cubic-bezier(.2, .8, .3, 1.3); }
@keyframes bt-enter { from { transform: scale(.2) rotate(-20deg); opacity: 0; } }

/* ---------- the team ---------- */
.bt-floor { position: absolute; left: -10px; top: 300px; width: 220px; height: 244px; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(-30deg, #B27A4A 0 22px, #A06C40 22px 24px);
  clip-path: polygon(0 26%, 62% 0, 100% 62%, 30% 100%, 0 100%); }
.bt-floor::after { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255, 220, 170, .4), transparent 60%); }
.bt-mate { position: absolute; z-index: 3; pointer-events: none; }
.bt-mate canvas { position: relative; display: block; image-rendering: pixelated; }
.bt-mate .shadow { position: absolute; left: 18%; right: 18%; bottom: 2px; height: 12px; border-radius: 50%; background: rgba(31, 42, 74, .28); }
.bt-mate .tag { position: absolute; left: 50%; bottom: -10px; translate: -50% 0; white-space: nowrap; padding: 1px 6px; background: var(--os-ink); color: #fff; font-size: 10px; transform: rotate(-3deg); }
.bt-mate .buff { position: absolute; padding: 1px 4px; background: var(--os-field); font-size: 9px; box-shadow: inset 0 0 0 2px var(--os-ink); white-space: nowrap; }
.bt-mate.act canvas { animation: bt-hop .4s cubic-bezier(.2, .8, .3, 1); }
.bt-mate.act .tag { background: var(--os-denim); }
@keyframes bt-hop { 40% { translate: 10px -10px; } }
.bt-mate.ow canvas { animation: bt-shake .3s steps(4, end); }

/* ---------- status: chill, foam, drinks ---------- */
.bt-status { position: absolute; left: 0; right: 0; top: 540px; height: 46px; z-index: 5; }
.bt-chill { position: absolute; left: 12px; top: 4px; width: 176px; transform: rotate(-2deg); }
.bt-chill .lab { font-size: 11px; white-space: nowrap; }
.bt-chill .lab b { font: 20px/1 var(--os-lcd); margin-left: 4px; }
.bt-chill .bar { position: relative; height: 12px; margin-top: 2px; background: var(--os-field); box-shadow: inset 0 0 0 2px var(--os-ink); padding: 2px; }
.bt-chill .bar i { display: block; height: 100%; background: linear-gradient(180deg, var(--os-denim-2) 0 40%, var(--os-denim) 40%); transition: width .3s steps(5, end); }
.bt-chill.low .bar i { background: var(--os-coral); }
.bt-chill.flash .bar { animation: bt-flash .4s steps(2, end) 2; }
@keyframes bt-flash { 50% { box-shadow: inset 0 0 0 2px var(--os-coral), 0 0 0 3px var(--os-coral); } }
.bt-foam { position: absolute; left: 194px; top: 2px; width: 40px; height: 36px; display: grid; place-items: center; background: #fff;
  border-radius: 50% 50% 46% 54% / 60% 60% 40% 40%; box-shadow: inset 0 0 0 2px var(--os-ink), 2px 2px 0 var(--os-ink); font: 20px/1 var(--os-lcd); transition: transform .2s; }
.bt-foam.zero { opacity: .45; }
.bt-foam small { position: absolute; bottom: -13px; padding: 0 3px; background: var(--os-paper); font: 9px var(--os-font); white-space: nowrap; }
.bt-drinks { position: absolute; right: 12px; top: 0; display: flex; gap: 6px; }
.bt-drink { position: relative; width: 36px; height: 34px; background: var(--os-field) !important; box-shadow: inset 0 0 0 2px var(--os-ink), 2px 2px 0 var(--os-ink); display: grid; place-items: center; transform: skewX(-6deg); }
.bt-drink.sel { transform: skewX(-6deg) translateY(-6px); box-shadow: inset 0 0 0 3px var(--os-denim), 2px 2px 0 var(--os-ink); }
.bt-drink.empty { opacity: .35; pointer-events: none; }
.bt-drink small { position: absolute; top: 37px; left: 50%; translate: -50% 0; padding: 0 3px; background: var(--os-paper); font-size: 9px; white-space: nowrap; }

/* ---------- the hand ---------- */
.bt-hand { position: absolute; left: 0; right: 0; top: 598px; height: 180px; z-index: 6; }
.bt-energy { position: absolute; left: 10px; top: 54px; width: 62px; height: 62px; border-radius: 50%; background: var(--os-ink); color: #fff; display: grid; place-items: center; box-shadow: 3px 3px 0 var(--os-denim); z-index: 2; }
.bt-energy b { font: 30px/1 var(--os-lcd); margin-top: 6px; }
.bt-energy .beans { position: absolute; top: -12px; display: flex; gap: 2px; }
.bt-energy .beans svg.off { opacity: .3; }
.bt-energy small { position: absolute; bottom: 7px; font-size: 9px; }
.bt-energy.jam::after { content: attr(data-jam); position: absolute; right: -16px; top: -8px; padding: 1px 5px; background: var(--os-coral); color: #fff; font: 11px var(--os-font); white-space: nowrap; box-shadow: 0 0 0 2px var(--os-ink); }
.bt-piles { position: absolute; left: 14px; top: 126px; font: 10px var(--os-type); color: var(--os-denim-deep); line-height: 1.5; white-space: nowrap; }
.bt-card { position: absolute; top: 18px; width: 98px; height: 150px; isolation: isolate; padding: 30px 8px 8px; text-align: left; transition: transform .15s, top .15s; }
.bt-card::before, .bt-card::after { content: ''; position: absolute; inset: 0; clip-path: polygon(0 8px, 100% 0, 100% calc(100% - 10px), calc(100% - 12px) 100%, 0 100%); }
.bt-card::before { z-index: -1; background: radial-gradient(rgba(63, 93, 170, .11) 28%, transparent 31%) 0 0 / 8px 8px, var(--os-paper); box-shadow: inset 0 0 0 2px var(--os-ink); }
.bt-card::after { z-index: -2; background: var(--os-ink); translate: 4px 5px; }
.bt-card .cost { position: absolute; left: -8px; top: -6px; width: 30px; height: 30px; border-radius: 50%; background: var(--os-denim); color: #fff; display: grid; place-items: center;
  font: 22px/1 var(--os-lcd); box-shadow: 0 0 0 2px var(--os-ink); padding-top: 3px; z-index: 2; }
.bt-card .cost.up { background: var(--os-coral); }
.bt-card .who { position: absolute; z-index: 2; right: 4px; top: -8px; }
.bt-card .who canvas { width: 40px; height: 34px; image-rendering: pixelated; display: block; }
.bt-card h3 { margin: 4px -8px 6px -10px; padding: 3px 8px 4px 10px; background: var(--os-ink); color: #fff; font-size: 13px; line-height: 1.15; transform: rotate(-3deg);
  clip-path: polygon(0 2px, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.bt-card p { margin: 0; font-size: 11px; line-height: 1.35; }
.bt-card .kind { position: absolute; left: 8px; bottom: 9px; font: 9px var(--os-type); color: var(--os-denim-deep); white-space: nowrap; }
.bt-card.off { filter: saturate(.3); }
.bt-card.off .cost { background: var(--os-grey); }
.bt-card.sel { z-index: 4; }
.bt-card.sel::before { background: radial-gradient(rgba(63, 93, 170, .11) 28%, transparent 31%) 0 0 / 8px 8px, #fff; box-shadow: inset 0 0 0 3px var(--os-denim); }
.bt-card.sel h3 { background: var(--os-denim); }
.bt-card.temp::before { box-shadow: inset 0 0 0 2px var(--os-denim); background: repeating-linear-gradient(-45deg, rgba(63, 93, 170, .08) 0 4px, transparent 4px 8px), var(--os-paper); }
.bt-card.junk::before { background: repeating-linear-gradient(-45deg, rgba(31, 42, 74, .14) 0 4px, transparent 4px 8px), var(--os-frame); }
.bt-card.junk .cost { display: none; }
.bt-card.deal { animation: bt-deal .3s cubic-bezier(.2, .8, .3, 1.2) backwards; }
@keyframes bt-deal { from { transform: translate(-120px, 40px) rotate(-30deg); opacity: 0; } }
.bt-card.nope { animation: bt-shake .3s steps(4, end); }
.bt-fly { position: absolute; z-index: 9; pointer-events: none; animation: bt-fly .4s ease-in forwards; }
@keyframes bt-fly { to { transform: translateY(-160px) scale(.6) rotate(-10deg); opacity: 0; } }

/* ---------- bottom bar ---------- */
.bt-modes { position: absolute; left: 14px; bottom: 22px; z-index: 6; display: flex; font-size: 11px; transform: rotate(2deg); }
.bt-modes button { padding: 5px 9px; background: var(--os-field) !important; box-shadow: inset 0 0 0 2px var(--os-ink); white-space: nowrap; }
.bt-modes button.on { background: var(--os-ink) !important; color: #fff !important; }
.bt-dev { position: absolute; left: 124px; bottom: 24px; z-index: 6; padding: 5px 9px; background: var(--os-paper) !important; box-shadow: inset 0 0 0 2px var(--os-denim); color: var(--os-denim) !important; font-size: 11px !important; white-space: nowrap; transform: rotate(-2deg); }
.bt-dev:disabled { opacity: .4; }
.bt-devmenu { position: absolute; left: 118px; bottom: 58px; z-index: 12; display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--os-paper); box-shadow: inset 0 0 0 2px var(--os-denim), 3px 3px 0 var(--os-ink); }
.bt-devmenu button { padding: 6px 10px; text-align: left; font-size: 12px !important; white-space: nowrap; background: var(--os-field) !important; box-shadow: inset 0 0 0 2px var(--os-ink); }
.bt-end { position: absolute; right: 14px; bottom: 16px; z-index: 6; padding: 10px 26px 11px 20px; background: var(--os-denim) !important; color: #fff !important; font-size: 18px !important; white-space: nowrap;
  clip-path: polygon(0 5px, 100% 0, calc(100% - 12px) 100%, 6px 100%); filter: drop-shadow(4px 4px 0 var(--os-ink)); transform: rotate(-3deg); }
.bt-end:disabled { background: var(--os-grey) !important; cursor: default; }
.bt-hint { position: absolute; left: 0; right: 0; top: 514px; z-index: 6; text-align: center; pointer-events: none; }
.bt-hint span { display: inline-block; padding: 2px 10px; background: var(--os-ink); color: #fff; font-size: 11px; white-space: nowrap; transform: rotate(-1deg); }
.bt-hint span:empty { display: none; }

/* ---------- popups, stamps, banners ---------- */
.bt-fx { pointer-events: none; z-index: 8; }
.bt-pop { position: absolute; translate: -50% 0; font: 26px/1 var(--os-lcd); color: var(--os-ink); text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff; white-space: nowrap; animation: bt-pop .8s ease-out forwards; }
.bt-pop.big { font-size: 36px; color: var(--os-coral); }
.bt-pop.good { color: var(--os-denim); }
.bt-pop.word { font: 14px/1 var(--os-font); padding: 3px 8px; background: var(--os-ink); color: #fff; text-shadow: none; }
.bt-pop.word.coral { background: var(--os-coral); }
.bt-pop.word.denim { background: var(--os-denim); }
@keyframes bt-pop { 0% { transform: translateY(6px) scale(.6); opacity: 0; } 20% { transform: translateY(-8px) scale(1.1); opacity: 1; } 100% { transform: translateY(-38px); opacity: 0; } }
.bt-banner { position: absolute; left: -20px; right: -20px; top: 300px; z-index: 9; padding: 10px 0; text-align: center; background: var(--os-ink); color: #fff; font-size: 22px; white-space: nowrap;
  transform: rotate(-4deg); clip-path: polygon(0 6px, 100% 0, 100% calc(100% - 4px), 0 100%); animation: bt-banner .9s cubic-bezier(.2, .8, .3, 1) forwards; pointer-events: none; }
.bt-banner.coral { background: var(--os-coral); }
.bt-banner.denim { background: var(--os-denim); }
@keyframes bt-banner { 0% { transform: rotate(-4deg) translateX(-110%); } 25%, 70% { transform: rotate(-4deg) translateX(0); } 100% { transform: rotate(-4deg) translateX(110%); } }
.bt-frame.shake { animation: bt-shake .3s steps(4, end); }

/* ---------- cards between fights: brief, reward, rest, result ---------- */
.bt-sheet { position: absolute; left: 18px; right: 18px; z-index: 10; padding: 34px 16px 18px; isolation: isolate; }
.bt-sheet::before, .bt-sheet::after { content: ''; position: absolute; inset: 0; z-index: -1; clip-path: polygon(0 12px, 100% 0, 100% calc(100% - 18px), calc(100% - 22px) 100%, 0 100%); }
.bt-sheet::before { background: var(--os-ink); transform: translate(6px, 7px); z-index: -2; }
.bt-sheet::after { background: radial-gradient(rgba(63, 93, 170, .1) 28%, transparent 31%) 0 0 / 8px 8px, var(--os-paper); }
.bt-sheet .bt-head { position: absolute; left: -8px; top: -16px; max-width: calc(100% + 8px); padding: 6px 26px 7px 14px; background: var(--os-denim); color: #fff; font-size: 22px; line-height: 1.1; transform: rotate(-4deg);
  clip-path: polygon(0 4px, 100% 0, calc(100% - 14px) 100%, 6px 100%); filter: drop-shadow(3px 3px 0 var(--os-ink)); }
.bt-sheet .bt-head.coral { background: var(--os-coral); }
.bt-sheet .bt-k { display: inline-block; margin-bottom: 8px; padding: 2px 8px; background: var(--os-ink); color: #fff; font-size: 11px; }
.bt-sheet .bt-plea { margin: 4px 0 12px; padding: 8px 10px; background: #fff; font: 12px/1.5 var(--os-type); box-shadow: 3px 3px 0 rgba(31, 42, 74, .25); transform: rotate(-1deg); }
.bt-sheet .bt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; font-size: 12px; }
.bt-sheet .bt-lab { font: 11px var(--os-type); color: var(--os-denim-deep); width: 100%; }
.bt-sheet .bt-pill { padding: 2px 8px; background: var(--os-field); box-shadow: inset 0 0 0 2px var(--os-ink); white-space: nowrap; font-size: 12px; }
.bt-sheet .bt-pill.coral { background: var(--os-coral); color: #fff; box-shadow: inset 0 0 0 2px var(--os-ink); }
.bt-sheet .bt-pill b { font: 16px/1 var(--os-lcd); margin-left: 3px; }
.bt-sheet .bt-dye { display: inline-block; width: 11px; height: 11px; margin-right: 5px; vertical-align: -1px; box-shadow: 0 0 0 2px var(--os-ink); }
.bt-sheet .bt-mates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 6px 0 4px; }
.bt-sheet .bt-mates div { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; text-align: center; }
.bt-sheet .bt-mates canvas { width: 64px; height: 80px; image-rendering: pixelated; }
.bt-sheet .bt-mates em { font-style: normal; font-size: 9px; color: var(--os-denim-deep); line-height: 1.25; }
.bt-sheet .bt-mates em.bad { color: var(--os-coral); }
.bt-sheet .bt-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.bt-btn { padding: 9px 18px 10px; background: var(--os-field) !important; box-shadow: inset 0 0 0 2px var(--os-ink); font-size: 14px !important; white-space: nowrap;
  clip-path: polygon(0 3px, 100% 0, calc(100% - 8px) 100%, 4px 100%); }
.bt-btn.go { background: var(--os-denim) !important; color: #fff !important; box-shadow: none; filter: drop-shadow(3px 3px 0 var(--os-ink)); }
.bt-sheet .bt-picks { position: relative; height: 170px; margin: 6px 0 0; }
.bt-sheet .bt-picks .bt-card { top: 8px; cursor: pointer; }
.bt-scrim { position: absolute; inset: 0; z-index: 9; background: rgba(31, 42, 74, .35); }

@media (prefers-reduced-motion: reduce) {
  #battle *, #battle *::before, #battle *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------- signature-card cut-ins (ui/ultimate.js) ---------- */
.ult { position: absolute; inset: 0; z-index: 20; overflow: hidden; cursor: pointer; }
.ult-dim { position: absolute; inset: 0; background: radial-gradient(rgba(255, 255, 255, .07) 28%, transparent 31%) 0 0 / 8px 8px, rgba(31, 42, 74, .72); backdrop-filter: grayscale(1); -webkit-backdrop-filter: grayscale(1); }
.ult-clock { position: absolute; left: 63%; top: 206px; width: 560px; height: 560px; transform: translate(-50%, -50%); }
.ult-clock svg { display: block; width: 100%; height: 100%; }
.ult-band { position: absolute; left: -60px; right: -60px; top: 262px; height: 210px; transform: rotate(-10deg); overflow: hidden;
  background: radial-gradient(rgba(255, 255, 255, .14) 28%, transparent 31%) 0 0 / 7px 7px, var(--os-denim);
  border-top: 6px solid var(--os-peach); border-bottom: 6px solid #fff; }
.ult-lines { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .5) 0 2px, transparent 2px 46px, rgba(255, 255, 255, .25) 46px 47px, transparent 47px 118px);
  background-size: 1400px 100%; }
.ult-chara { position: absolute; left: -22px; top: 214px; width: 200px; filter: drop-shadow(5px 0 0 #fff) drop-shadow(-5px 0 0 #fff) drop-shadow(0 5px 0 #fff) drop-shadow(0 -5px 0 #fff) drop-shadow(9px 9px 0 var(--os-ink)); }
.ult-chara:not(.live) canvas { display: block; width: 100%; image-rendering: pixelated; }
.ult-chara.live { left: -46px; top: 150px; width: 340px; }
.ult-chara.live::after { display: none; }
.ult-3d { display: block; width: 340px; height: 472px; image-rendering: pixelated; }
.ult-trail { position: absolute; left: 0; top: 0; opacity: .85; }
/* Pounce moves across the space: its 3D window sits further right, so the run and the foe both fit */
.ult.dash .ult-chara.live, .ult.dash .ult-panel { left: 24px; }
.ult-chara.live .ult-3d:not(.ult-trail) { position: relative; }
/* Pounce: focus lines closing in on the hit, a ring bursting from it; the damage as a big stamp */
.ult-burst { position: absolute; inset: 0; pointer-events: none; }
.ult-burst svg { display: block; width: 100%; height: 100%; }
.ult-stamp.dmg { left: 54%; top: 250px; margin-left: 0; width: auto; padding: 6px 16px 2px; font-size: 72px; letter-spacing: 2px; }
/* the close-up's comic panel: an ink frame round a pale paper window, the same slant as the crop */
.ult-panel { position: absolute; left: -46px; top: 150px; width: 340px; height: 470px; background: var(--os-ink); clip-path: polygon(4% 20%, 102% 9.5%, 98% 68%, -2% 76.5%); }
.ult-panel::after { content: ''; position: absolute; inset: 0; background: radial-gradient(rgba(63, 93, 170, .14) 28%, transparent 31%) 0 0 / 7px 7px, var(--os-paper); clip-path: polygon(6% 22%, 100% 12%, 96% 66%, 0% 74%); }
/* a light dot screen over the figure only: printed, not rendered */
.ult-chara::after { content: ''; position: absolute; inset: 0; background: radial-gradient(rgba(31, 42, 74, .5) 30%, transparent 34%) 0 0 / 6px 6px; mix-blend-mode: multiply; opacity: .35;
  -webkit-mask: var(--art) center / 100% 100% no-repeat; mask: var(--art) center / 100% 100% no-repeat; }
.ult-name { position: absolute; right: 8px; top: 404px; display: flex; flex-direction: column; align-items: flex-end; filter: drop-shadow(5px 5px 0 var(--os-ink)); }
.ult-name small { padding: 3px 12px 2px; background: #fff; color: var(--os-denim); font: 18px/1 var(--os-lcd); letter-spacing: 2px; clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
.ult-name b { margin-top: -2px; padding: 8px 24px 9px 16px; background: var(--os-ink); color: #fff; font-size: 42px; line-height: 1; white-space: nowrap; clip-path: polygon(0 5px, 100% 0, calc(100% - 14px) 100%, 8px 100%); }
.ult-line { position: absolute; left: 14px; right: 14px; top: 540px; text-align: left; }
.ult-line span { display: inline-block; max-width: 100%; padding: 5px 12px; background: #fff; color: var(--os-ink); font: 13px/1.4 var(--os-type); box-shadow: 4px 4px 0 var(--os-denim); transform: rotate(-2deg); }
.ult-stamp { position: absolute; left: 30%; top: 112px; margin-left: -70px; width: 140px; padding: 4px 0 2px; text-align: center; background: #fff; color: var(--os-ink); font: 44px/1 var(--os-lcd); letter-spacing: 4px; box-shadow: inset 0 0 0 4px var(--os-ink), 6px 6px 0 var(--os-denim); }
.ult-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
/* after Time Pause: the foe frozen in a cold blue with a dashed clock ring */
.bt-foe.paused .bt-body img { filter: sepia(.35) hue-rotate(180deg) saturate(2.2) brightness(1.02) drop-shadow(4px 5px 0 rgba(31, 42, 74, .3)); }
.bt-foe.paused .bt-body::after { content: ''; position: absolute; left: 50%; top: 50%; width: 120%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; border: 3px dashed var(--os-denim); pointer-events: none; }
.bt-shard { position: absolute; z-index: 9; pointer-events: none; }

/* ---------- the real-time variant (ui/battlert.js, ?battle&rt) ---------- */
/* energy: the circle fills round its edge towards the next point; a bar of ten in the thumb zone, where End turn was */
.rt .bt-energy { background: conic-gradient(var(--os-denim-2) calc(var(--p, 0) * 1turn), var(--os-ink) 0); }
.rt .bt-energy::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--os-ink); }
.rt .bt-energy b { position: relative; }
.rt .bt-energy .beans { display: none; }
.bt-cost { position: absolute; right: 14px; bottom: 20px; z-index: 6; display: flex; align-items: center; gap: 2px; padding: 7px 10px 7px 12px; background: var(--os-ink);
  clip-path: polygon(0 4px, 100% 0, calc(100% - 8px) 100%, 4px 100%); transform: rotate(-3deg); filter: drop-shadow(3px 3px 0 var(--os-denim)); }
.bt-cost i { position: relative; width: 13px; height: 18px; overflow: hidden; background: rgba(255, 255, 255, .16); transform: skewX(-14deg); }
.bt-cost i::after { content: ''; position: absolute; inset: 0; background: var(--os-denim-2); transform-origin: left; transform: scaleX(var(--f, 0)); }
.bt-cost i.on::after { background: #fff; transform: none; }
.bt-cost b { margin-left: 8px; color: #fff; font: 24px/1 var(--os-lcd); min-width: 22px; text-align: right; }
.rt .bt-dev { left: 12px; bottom: auto; top: 104px; }
.rt .bt-devmenu { left: 12px; bottom: auto; top: 134px; }
/* a card that just became affordable bumps its cost */
.bt-card.ready .cost { animation: bt-ready .36s cubic-bezier(.2, .8, .3, 1.4); }
@keyframes bt-ready { 40% { transform: scale(1.35); } }
/* a foe's move charging up; coral for the big ones, denim while it is frozen or coloured; it blinks just before */
.bt-charge { width: 78px; height: 8px; margin: 2px 0 0 4px; padding: 2px; background: var(--os-field); box-shadow: inset 0 0 0 2px var(--os-ink); transform: skewX(-18deg); }
.bt-charge i { display: block; height: 100%; background: var(--os-ink); }
.bt-charge.alert i { background: var(--os-coral); }
.bt-charge.held i { background: var(--os-denim); }
.bt-charge.near { animation: bt-near .3s steps(2, end) infinite; }
@keyframes bt-near { 50% { box-shadow: inset 0 0 0 2px var(--os-coral), 0 0 0 2px var(--os-coral); } }
.bt-foe.right .bt-charge { margin: 2px 4px 0 0; }
/* the foe the team is swinging at */
.bt-foe.focus .bt-name { background: var(--os-denim); color: #fff; }
.bt-foe.focus .bt-name::before { content: '▸ '; }
/* the team's own swings: a lunge towards the foes, a denim dash across, small numbers */
.bt-mate.swing canvas { animation: bt-swing .3s cubic-bezier(.2, .8, .3, 1); }
@keyframes bt-swing { 35% { translate: 18px -8px; scale: 1.08 .94; } }
.bt-streak { position: absolute; height: 5px; margin-top: -2px; transform-origin: 0 50%; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--os-denim) 55%, #fff 90%); box-shadow: 0 0 0 1px rgba(31, 42, 74, .25); }
/* foes breathe while they charge, tremble just before the move goes off, and stand still when frozen */
.rt .bt-foe:not(.hurt):not(.lunge):not(.aim):not(.paused) .bt-body { animation: bt-bob 1.8s ease-in-out infinite; }
.rt .bt-foe.near:not(.hurt):not(.lunge):not(.aim):not(.paused) .bt-body { animation: bt-tremble .12s steps(2, end) infinite; }
@keyframes bt-bob { 50% { translate: 0 -5px; } }
@keyframes bt-tremble { 50% { translate: 2px -1px; } }
.bt-pop.small { font-size: 17px; }
/* holding a card: time slows, the frame goes denim at the edges */
.rt .bt-frame::before { content: ''; position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0; transition: opacity .15s;
  box-shadow: inset 0 0 0 5px var(--os-denim), inset 0 0 70px rgba(63, 93, 170, .5); }
.rt .bt-frame.slow::before { opacity: 1; }
/* each member's own chill under their name tag; coral when low, grey and napping once they sit out. The passives'
   labels stay in the brief: the stage is busy enough in real time */
.rt .bt-mate .buff { display: none; }
.bt-mhp { position: absolute; left: 50%; bottom: -22px; translate: -50% 0; z-index: 1; }
.bt-mhp b { display: block; width: 52px; height: 8px; padding: 2px; background: var(--os-field); box-shadow: inset 0 0 0 2px var(--os-ink); transform: skewX(-14deg); }
.bt-mhp b i { display: block; height: 100%; background: var(--os-denim); transition: width .2s steps(4, end); }
.bt-mate.low .bt-mhp b i { background: var(--os-coral); }
.bt-mate.ko canvas { filter: grayscale(1) opacity(.75); }
.bt-mate.ko .tag { background: var(--os-grey); }
.bt-mate.ko .bt-mhp { opacity: .45; }
/* Spotlight: a warm cone on Hee Hee while she draws every hit */
.bt-mate.taunt::before { content: ''; position: absolute; left: 50%; top: -50px; width: 104px; height: 168px; translate: -50% 0; pointer-events: none;
  background: linear-gradient(rgba(255, 236, 190, 0), rgba(255, 236, 190, .75)); clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%); }
.bt-sheet .bt-mates em.bt-role { color: var(--os-denim); }
/* hit feel (ui/hitfx.js): shots, sparks and bits on the effects layer; a hit-stop pauses the stage's own loops */
.hx { position: absolute; pointer-events: none; z-index: 9; }
.hx svg { display: block; }
.hx.shot { margin: -6px 0 0 -9px; }
.hx.star, .hx.ring { transform: translate(-50%, -50%); }
.hx.claw { width: 5px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 2px var(--os-ink); transform: rotate(28deg); }
.hx.drop { width: 7px; height: 7px; border-radius: 50%; background: #7A4A2A; box-shadow: 0 0 0 1.5px var(--os-ink); }
.hx.petal { width: 10px; height: 7px; border-radius: 50% 50% 50% 0; background: #F6A6B8; box-shadow: 0 0 0 1.5px var(--os-ink); }
.hx.mote { width: 6px; height: 6px; background: var(--os-denim); box-shadow: 0 0 0 1.5px #fff; }
.hx.chip { width: 5px; height: 5px; background: #fff; box-shadow: 0 0 0 1.5px var(--os-ink); }
.bt-frame.hitstop .bt-foe .bt-body, .bt-frame.hitstop .bt-mate canvas, .bt-frame.hitstop .bt-charge { animation-play-state: paused; }
/* real time: each foe's HP as a bar over its number; the light trail behind shows what the last blows took */
.bt-fhp { display: block; position: relative; height: 10px; margin-top: 4px; background: var(--os-field); box-shadow: inset 0 0 0 2px var(--os-ink); transform: skewX(-18deg); }
.bt-fhp.boss { height: 13px; }
.bt-fhp i { position: absolute; left: 2px; top: 2px; bottom: 2px; }
.bt-fhp .trail { background: var(--os-peach); transition: width .45s ease-in .3s; }
.bt-fhp .fill { background: var(--os-ink); transition: width .06s; }
.bt-foe.colored .bt-fhp .fill { background: #C8894E; }
