/* Turn-based battle HUD (js/battle/ui.js). Three layouts, picked from the window shape by BattleUI.layoutFor():
   .lay-portrait  - phones upright: the 3D field fills the top, the message line + command dock sit in the bottom
                    third within thumb reach
   .lay-landscape - short sideways phones: message line bottom-left, dock bottom-right, both HP cards along the top
   .lay-desktop   - wide screens: message line bottom-left, dock bottom-right, your HP card just above the dock
   The camera framing (js/battle/index.js HUD_LAYOUT) keeps both Pokémon out from under these. */
#battle-ui {
  --bt-gold: var(--gold, #ffcf4a);
  --bt-hp: #3ee07a;
  --bt-glass: rgba(12, 19, 42, .84);
  --bt-line: rgba(255, 255, 255, .14);
  --bt-muted: #a9b8da;
  --b-sat: env(safe-area-inset-top, 0px); --b-sab: env(safe-area-inset-bottom, 0px);
  --b-sal: env(safe-area-inset-left, 0px); --b-sar: env(safe-area-inset-right, 0px);
  position: fixed; inset: 0; pointer-events: none; z-index: 6; font-family: Nunito, system-ui, sans-serif; color: #f4f7ff;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
#battle-ui > * { pointer-events: auto; }
#battle-ui .bt-bottom { pointer-events: none; }
#battle-ui .bt-bottom > * { pointer-events: auto; }
#battle-ui button { font: inherit; color: inherit; cursor: pointer; }
#battle-ui svg { display: block; }

/* Everything else on the HUD steps aside during a battle (the chat stays: chatscene.css moves it clear of the battle HUD) */
body.battle-active #movebar, body.battle-active #hotbar, body.battle-active #menu, body.battle-active #prompt,
body.battle-active #quests, body.battle-active #party, body.battle-active #help-card, body.battle-active #hunt-chip, body.battle-active #top-right { display: none !important; }

/* keyboard badges (desktop): a small key cap in a corner */
#battle-ui .k { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 4px; background: #e8eefc; color: #12264d;
  font: 900 10px/1 Nunito, system-ui, sans-serif; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
html.touch #battle-ui .k { display: none; }

/* ================================================================ HP cards */
.bt-panel {
  position: absolute; width: 250px; padding: 7px 11px 8px; border-radius: 14px; box-sizing: border-box;
  background: linear-gradient(rgba(24, 36, 74, .9), rgba(12, 20, 46, .9)); border: 1px solid var(--bt-line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: transform .3s, opacity .3s;
}
.bt-panel[hidden] { display: none; }
.bt-panel.out { opacity: 0; transform: translateY(-6px); }
.bt-panel.hurt { animation: bt-hurt .38s; }
@keyframes bt-hurt { 20% { transform: translateX(-3px); box-shadow: 0 0 0 2px rgba(255, 80, 80, .55), 0 6px 18px rgba(0,0,0,.35); } 50% { transform: translateX(3px); } 80% { transform: translateX(-1px); } }
.bt-top { display: flex; align-items: baseline; gap: 6px; font-size: 14px; line-height: 1.2; }
.bt-top .bt-name { flex: 1; min-width: 0; font-weight: 900; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-lv { color: var(--bt-gold); font-weight: 900; font-size: 12px; font-variant-numeric: tabular-nums; }
.bt-st { align-self: center; font-size: 9.5px; font-weight: 900; padding: 1px 5px; border-radius: 5px; letter-spacing: .5px; line-height: 1.4; }
.bt-st:empty { display: none; }
.st-PAR { background: #e6c21f; color: #3a2a00; } .st-BRN { background: #ef6a3a; } .st-PSN, .st-TOX { background: #a04fc8; }
.st-SLP { background: #8a97a8; } .st-FRZ { background: #6fd0ff; color: #0a2a3a; } .st-FNT { background: #c43c3c; }
.bt-hp { height: 8px; margin-top: 5px; background: rgba(0, 0, 0, .5); border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.bt-hp.small { height: 6px; margin: 4px 0 2px; }
.bt-hp-fill { height: 100%; width: 100%; border-radius: 6px; background: linear-gradient(#7ff7a8, var(--bt-hp)); }
.bt-hp-fill.mid { background: linear-gradient(#ffe36e, #f0b71c); }
.bt-hp-fill.low { background: linear-gradient(#ff8c8c, #e83b3b); }
.bt-sub { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.bt-exp-bar { flex: 1; height: 3px; background: rgba(0, 0, 0, .5); border-radius: 2px; overflow: hidden; }
.bt-exp-bar div { height: 100%; width: 0; background: linear-gradient(90deg, #7fd0ff, #3b8cff); }
.bt-hpnum { font-weight: 900; font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: .3px; }
/* stat stages ("Atk +1", "Def −1"): one small row under the HP bar, only while something isn't 0 */
.bt-stages { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.bt-stages:empty { display: none; }
.bt-stages span { font-size: 10px; font-weight: 900; line-height: 1.35; padding: 0 5px; border-radius: 5px; letter-spacing: .2px; white-space: nowrap;
  font-variant-numeric: tabular-nums; animation: bt-stage-in .25s ease-out; }
.bt-stages .up { background: rgba(62, 224, 122, .2); color: #8dffb4; box-shadow: inset 0 0 0 1px rgba(125, 255, 159, .35); }
.bt-stages .down { background: rgba(255, 90, 90, .2); color: #ffadad; box-shadow: inset 0 0 0 1px rgba(255, 140, 140, .35); }
@keyframes bt-stage-in { from { opacity: 0; transform: scale(.7); } }
.lay-landscape .bt-stages { margin-top: 3px; }
.lay-landscape .bt-stages span { font-size: 9.5px; padding: 0 4px; }
/* battle effects (js/battle/effects.js): Reflect, Spikes, Leech Seed... on the side's card; weather in the field strip.
   Same chip language as the stat stages; tap / hover / focus opens the tooltip below (.bt-tip) */
.bt-fx { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.bt-fx:not(.on):not(:has(.bt-chip)) { display: none; }
.bt-stages:empty + .bt-fx { margin-top: 5px; }
#battle-ui .bt-chip { display: inline-flex; align-items: center; height: auto; margin: 0; border: 0; font: 900 10px/1.35 Nunito, system-ui, sans-serif; padding: 0 5px;
  border-radius: 5px; letter-spacing: .2px; white-space: nowrap; font-variant-numeric: tabular-nums; cursor: help; position: relative;
  background: rgba(127, 176, 255, .18); color: #cfe0ff; box-shadow: inset 0 0 0 1px rgba(150, 190, 255, .35); animation: bt-stage-in .25s ease-out;
  transition: opacity .2s, transform .2s; }
#battle-ui .bt-chip::after { content: ''; position: absolute; inset: -6px -2px; }   /* a bigger tap target than the chip looks */
#battle-ui .bt-chip i { font-style: normal; opacity: .85; white-space: pre; }
#battle-ui .bt-chip.t-good { background: rgba(62, 224, 122, .16); color: #a6ffc6; box-shadow: inset 0 0 0 1px rgba(125, 255, 159, .32); }
#battle-ui .bt-chip.t-bad { background: rgba(255, 90, 90, .2); color: #ffb4b4; box-shadow: inset 0 0 0 1px rgba(255, 140, 140, .38); }
#battle-ui .bt-chip.t-rain { background: rgba(70, 140, 255, .28); color: #d5e6ff; box-shadow: inset 0 0 0 1px rgba(120, 175, 255, .5); }
#battle-ui .bt-chip.t-sun { background: rgba(255, 170, 40, .3); color: #ffe6b0; box-shadow: inset 0 0 0 1px rgba(255, 196, 90, .55); }
#battle-ui .bt-chip.t-sand { background: rgba(205, 165, 95, .3); color: #f5e3bd; box-shadow: inset 0 0 0 1px rgba(225, 190, 120, .5); }
#battle-ui .bt-chip.t-hail { background: rgba(150, 225, 255, .26); color: #e4f8ff; box-shadow: inset 0 0 0 1px rgba(170, 235, 255, .5); }
#battle-ui .bt-chip.t-off { opacity: .55; text-decoration: line-through; }
#battle-ui .bt-chip:focus-visible, #battle-ui .bt-st[data-tip]:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
#battle-ui .bt-chip[aria-expanded="true"] { filter: brightness(1.25); }
#battle-ui .bt-chip.gone { opacity: 0; transform: scale(.7); pointer-events: none; }
.bt-st[data-tip] { cursor: help; }
.lay-landscape .bt-fx { margin-top: 3px; }
#battle-ui.lay-landscape .bt-chip { font-size: 9.5px; padding: 0 4px; }
/* field strip: top centre on wide screens (between the cards), top right under the speed button on upright phones */
.bt-field { position: absolute; z-index: 2; display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: calc(46 * var(--uvw, 1vw)); pointer-events: none; }
.bt-field > * { pointer-events: auto; }
.bt-field:not(:has(.bt-chip)) { display: none; }
#battle-ui .bt-field .bt-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  background-color: rgba(12, 20, 46, .72); }
.lay-desktop .bt-field { top: 18px; left: 50%; transform: translateX(-50%); }
.lay-landscape .bt-field { top: calc(var(--b-sat) + 8px); left: 50%; transform: translateX(-50%); max-width: calc(calc(100 * var(--uvw, 1vw)) - 2 * 230px); }
.lay-portrait .bt-field { top: calc(var(--b-sat) + 10px); right: calc(var(--b-sar) + 8px); max-width: calc(calc(100 * var(--uvw, 1vw)) - min(calc(54 * var(--uvw, 1vw)), 224px) - 28px); justify-content: flex-end; }
.lay-portrait:has(.bt-speed:not([hidden])) .bt-field { top: calc(var(--b-sat) + 46px); }
.lay-desktop:has(.bt-speed:not([hidden])) .bt-field { top: 18px; }
/* the tooltip */
.bt-tip { position: absolute; z-index: 7; width: max-content; max-width: min(270px, calc(calc(100 * var(--uvw, 1vw)) - 24px)); box-sizing: border-box; padding: 7px 10px 8px; border-radius: 10px;
  background: rgba(10, 17, 40, .96); border: 1px solid rgba(255, 255, 255, .2); box-shadow: 0 8px 22px rgba(0, 0, 0, .5); pointer-events: none;
  font-size: 12.5px; line-height: 1.35; color: #e9efff; animation: bt-pop-in .12s ease-out; user-select: text; -webkit-user-select: text; }
.bt-tip[hidden] { display: none; }
.bt-tip.up { animation-name: bt-tip-up; }
@keyframes bt-tip-up { from { opacity: 0; transform: translateY(-4px); } }
.bt-tip b { display: block; font-size: 13px; font-weight: 900; margin-bottom: 2px; color: #fff; }
.bt-tip b.t-good { color: #8dffb4; } .bt-tip b.t-bad { color: #ffadad; } .bt-tip b.t-sun { color: #ffd27a; } .bt-tip b.t-rain { color: #9cc7ff; }
.bt-tip p { margin: 0; color: #cdd8f2; }
@media (prefers-reduced-motion: reduce) { #battle-ui .bt-chip, .bt-tip { animation: none; transition: none; } }
.bt-balls { display: flex; align-items: center; gap: 4px; margin-top: 5px; }
.bt-balls:empty, .bt-panel.me .bt-balls { display: none; }   /* yours: the party strip in the dock says it all */
.bb { flex: none; width: 11px; height: 11px; border-radius: 50%; box-sizing: border-box;
  background: radial-gradient(circle at 50% 50%, #fff 0 17%, #222 18% 30%, transparent 31%), linear-gradient(#ef4242 0 44%, #222 44% 56%, #f4f4f4 56%);
  box-shadow: 0 0 0 1px #0a1630; }
.bb.status { filter: hue-rotate(50deg) saturate(1.3); }
.bb.fnt { filter: grayscale(1) brightness(.5); opacity: .7; }
.bb.empty { display: none; }

/* ================================================================ message line + dock */
.bt-bottom { position: absolute; display: flex; gap: 8px; }
.bt-dialog { position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; box-sizing: border-box; padding: 8px 10px 8px 16px; cursor: pointer;
  border-radius: 14px; background: rgba(8, 13, 30, .8); border: 1px solid var(--bt-line); box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-size: 15px; font-weight: 800; line-height: 1.32; }
.bt-text { flex: 1; min-width: 0; white-space: pre-wrap; text-shadow: 0 1px 2px #000; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bt-dialog.prompt .bt-text { color: #dfe8ff; }
.bt-next { flex: none; color: var(--bt-gold); opacity: 0; font-size: 11px; }
.bt-next.on { opacity: 1; animation: bt-bob .7s infinite alternate; }
@keyframes bt-bob { to { transform: translateY(3px); } }
.bt-line-act:empty { display: none; }
/* PvP turn timer: a quiet pill, red for the last 10 s */
.bt-timer { flex: none; min-width: 30px; padding: 2px 7px; border-radius: 10px; text-align: center; font-size: 11px; font-weight: 900;
  font-variant-numeric: tabular-nums; color: var(--bt-muted); background: rgba(255, 255, 255, .07); border: 1px solid var(--bt-line); }
.bt-timer.low { color: #ffd2d2; background: rgba(230, 60, 60, .35); border-color: rgba(255, 120, 120, .5); }
.bt-run { position: relative; display: flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px 0 9px; border-radius: 16px; font-size: 12px; font-weight: 900;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22); color: #dfe6f5; }
.bt-run svg { width: 15px; height: 15px; }
.bt-run::after { content: ''; position: absolute; inset: -7px -4px; }
.bt-run .k { position: absolute; right: -5px; top: -6px; }
.bt-run:hover { background: rgba(255, 255, 255, .16); }

.bt-menu { position: relative; box-sizing: border-box; padding: 8px; border-radius: 16px; background: var(--bt-glass); border: 1px solid var(--bt-line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: bt-dock-in .2s ease-out; }
/* the dock keeps its place while hidden, so nothing jumps between turns */
.bt-menu[hidden] { display: block; visibility: hidden; animation: none; }
.bt-menu.confirm, .bt-menu:not(.dock) { display: flex; flex-direction: column; justify-content: center; }
.bt-menu[hidden]:not(.dock) { display: block; }
@keyframes bt-dock-in { from { opacity: 0; transform: translateY(10px); } }

/* moves: four big cards, the type colour fills them */
.bt-moves4 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bt-mv { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; height: 56px; padding: 6px 10px 6px 11px; text-align: left;
  border-radius: 12px; border: 1px solid color-mix(in srgb, var(--c) 55%, #fff 20%);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 82%, #0b1430), color-mix(in srgb, var(--c) 40%, #0b1430));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 3px 8px rgba(0, 0, 0, .3); transition: transform .08s, filter .15s; }
.bt-mv:active { transform: scale(.97); }
.bt-mv:hover { filter: brightness(1.08); }
.bt-mv.sel { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 0 0 2px var(--bt-gold), 0 3px 10px rgba(0, 0, 0, .35); }
html.touch .bt-mv.sel { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 3px 8px rgba(0, 0, 0, .3); }   /* no keyboard cursor on phones */
.bt-mv.info { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 0 0 2px #fff; }
.bt-mv.off { filter: grayscale(.85) brightness(.7); }
.bt-mv-name { display: block; padding-right: 26px; font-size: 15px; font-weight: 900; line-height: 1.15; text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-mv-meta { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bt-mv .bt-type { font-size: 9.5px; font-weight: 900; letter-spacing: .6px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, .3); color: #fff; line-height: 1.5; }
.bt-mv .bt-pp { margin-left: auto; font-size: 11.5px; font-weight: 900; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.bt-pp.low { color: #ffd08a; } .bt-pp.zero { color: #ffb0b0; }
.bt-mv .bt-eff { font-size: 10.5px; line-height: 15px; padding: 0 5px; }
.bt-mv .k { position: absolute; left: -5px; top: -6px; }
.bt-mi { position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font: italic 800 12px/1 Georgia, serif; color: #0d1b3d; background: rgba(255, 255, 255, .88); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); cursor: help; }
.bt-mi::after { content: ''; position: absolute; inset: -11px -9px -9px -11px; }   /* 40px tap target */
.bt-mv.struggle { grid-column: span 2; }

/* effectiveness: 2× / 4× green, ½× / ¼× grey, 0× red */
.bt-eff { display: inline-block; padding: 0 6px; border-radius: 8px; font: 900 11px/17px Nunito, system-ui, sans-serif; letter-spacing: .2px; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.bt-eff.up { background: #23b866; color: #fff; }
.bt-eff.up2 { background: #0f9c52; color: #fff; box-shadow: 0 0 0 1px #8dffbf, 0 0 8px rgba(80, 255, 160, .6); }
.bt-eff.down { background: rgba(20, 26, 48, .75); color: #c8d2ea; }
.bt-eff.none { background: #5a1f2a; color: #ffb3bd; }
.bt-eff.even { background: rgba(255, 255, 255, .12); color: #dfe6f5; }

/* the "i" popover: category · power · effectiveness · damage */
.bt-pop { position: absolute; z-index: 3; display: flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 10px; white-space: nowrap;
  background: rgba(5, 9, 22, .96); border: 1px solid rgba(255, 255, 255, .2); box-shadow: 0 6px 16px rgba(0, 0, 0, .45); font-size: 12px; font-weight: 800; pointer-events: none;
  animation: bt-pop-in .12s ease-out; }
.bt-pop[hidden] { display: none; }
.bt-pop:has(.bt-pop-desc) { flex-wrap: wrap; row-gap: 4px; max-width: min(300px, calc(calc(100 * var(--uvw, 1vw)) - 32px)); }
.bt-pop-desc { flex-basis: 100%; margin: 0; white-space: normal; font-size: 11.5px; font-weight: 700; line-height: 1.3; color: #cdd8f2; }
@keyframes bt-pop-in { from { opacity: 0; transform: translateY(4px); } }
.bt-cat { display: inline-flex; align-items: center; gap: 4px; }
.bt-cat svg, .bt-cat-i svg { width: 13px; height: 13px; }
.c-Physical { color: #ffa36a; } .c-Special { color: #86bcff; } .c-Status { color: #c9cfe0; }
.bt-pow { display: inline-flex; align-items: baseline; gap: 3px; font-variant-numeric: tabular-nums; }
.bt-pow small { font-size: 10px; color: var(--bt-muted); font-weight: 800; }
.bt-dmg { color: var(--bt-muted); font-size: 11px; }

/* bottom row of the dock: party strip + Bag */
.bt-foot { display: flex; gap: 6px; margin-top: 6px; height: 50px; }
.bt-team { flex: 1; min-width: 0; display: flex; gap: 4px; }
.bt-pm { position: relative; flex: 1 1 0; min-width: 0; max-width: 58px; padding: 0; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); transition: transform .08s; }
.bt-pm img { width: 36px; height: 36px; object-fit: contain; margin-top: -6px; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
.bt-pm .bt-pball { width: 22px; height: 22px; margin: -6px 0 0; }
.bt-pm-hp { position: absolute; left: 6px; right: 6px; bottom: 5px; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, .55); overflow: hidden; }
.bt-pm-hp s { display: block; height: 100%; background: var(--bt-hp); text-decoration: none; }
.bt-pm-hp s.mid { background: #f0b71c; } .bt-pm-hp s.low { background: #e83b3b; }
.bt-pm em { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1.5px #0b1430; }
.bt-pm.active { background: rgba(255, 207, 74, .16); border-color: var(--bt-gold); cursor: default; }
.bt-pm.fnt { opacity: .4; filter: grayscale(1); cursor: not-allowed; }
.bt-pm:not(.active):not(.fnt):hover { background: rgba(255, 255, 255, .14); }
.bt-pm:not(.active):not(.fnt):active { transform: scale(.94); }
.bt-bag { position: relative; flex: none; width: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 12px;
  border: 1px solid #ffe9a8; background: linear-gradient(#ffd75e, #f2a93b); color: #2a1a00; font-size: 11.5px; font-weight: 900; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }
.bt-bag svg { width: 21px; height: 21px; }
.bt-bag:disabled { opacity: .4; filter: grayscale(1); cursor: not-allowed; }
.bt-bag:active { transform: scale(.95); }
.bt-bag .k { position: absolute; right: -5px; top: -6px; }
/* Mega Evolve toggle (js/battle/ui.js turnMenu canMega): lit when on, the move then Mega Evolves first */
.bt-mega { position: relative; flex: none; width: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .35); background: linear-gradient(#3a2a5c, #1f1638); color: #e9dcff; font-size: 11.5px; font-weight: 900; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }
.bt-mega .bt-mega-gem { width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(#ff5f9a, #ffd23f, #5fe08a, #4fa8ff, #b26bff, #ff5f9a); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .55); }
.bt-mega.on { border-color: #fff3b0; background: linear-gradient(#ffb3e0, #8f6bff); color: #fff; box-shadow: 0 0 0 2px #fff3b0, 0 0 16px rgba(255, 210, 120, .8); }
.bt-mega.on .bt-mega-gem { animation: bt-mega-spin 1.6s linear infinite; }
.bt-mega:active { transform: scale(.95); }
.bt-mega .k { position: absolute; right: -5px; top: -6px; }
@keyframes bt-mega-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bt-mega.on .bt-mega-gem { animation: none; } }
.bt-pm.nope, .bt-mv.nope, .bt-pcard.nope { animation: bt-nope .3s; }
@keyframes bt-nope { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* old-style menus still used by Safari Zone, confirmations and the stand-alone move picker */
.bt-cmd, .bt-yesno { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bt-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 6px 12px;
  font-weight: 900; font-size: 16px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); }
.bt-btn:hover, .bt-btn.sel { border-color: var(--bt-gold); }
html.touch .bt-btn.sel { border-color: rgba(255, 255, 255, .2); }
.bt-btn:disabled { opacity: .4; cursor: not-allowed; }
.bt-btn.c-fight, .bt-btn.yes { background: linear-gradient(#e2574a, #a8322a); }
.bt-btn.c-bag { background: linear-gradient(#e0a838, #a8761a); }
.bt-btn.c-pokemon { background: linear-gradient(#45b062, #26793f); }
.bt-btn.c-run { background: linear-gradient(#4a78d8, #2a52a2); }
/* yes / no in the dock: two big stacked thumb buttons on phones, side by side elsewhere */
.lay-portrait .bt-menu.confirm .bt-yesno { grid-template-columns: 1fr; grid-auto-rows: 1fr; height: 100%; gap: 8px; }
.lay-portrait .bt-menu.confirm .bt-btn { font-size: 17px; }
.bt-menu.confirm .bt-btn.no { background: rgba(255, 255, 255, .08); }
.bt-btn.ghost { background: transparent; min-height: 44px; font-size: 14px; color: #dfe6f5; }
.bt-btn .k { position: absolute; left: 6px; top: 6px; }
.bt-btn.ghost .k { position: static; margin-left: 6px; }
.bt-back { margin-top: 6px; width: 100%; min-height: 36px; border-radius: 10px; border: 1px solid var(--bt-line); background: rgba(255, 255, 255, .06); font-size: 12px; font-weight: 800; color: #c8d4ee; }

/* ================================================================ layouts */
/* --- desktop: line bottom-left, dock bottom-right, your card above the dock --- */
.lay-desktop .bt-panel.foe { top: 16px; left: 16px; width: 280px; }
.lay-desktop .bt-panel.me { right: 16px; bottom: calc(16px + 210px + 10px); width: 280px; }
.lay-desktop .bt-bottom { left: 16px; right: 16px; bottom: 16px; align-items: flex-end; }
.lay-desktop .bt-dialog { flex: 1; max-width: 720px; margin-right: auto; }
.lay-desktop .bt-menu { width: 470px; height: 210px; padding: 9px; }
.lay-desktop .bt-mv { height: 62px; }
.lay-desktop .bt-mv-name { font-size: 16px; }
.lay-desktop .bt-foot { height: 52px; margin-top: 8px; }
.lay-desktop .bt-moves4 { gap: 8px; }
.lay-desktop .bt-speed { top: 16px; right: 16px; }

/* --- portrait phones: the field on top, line + dock in the bottom third --- */
.lay-portrait .bt-panel { width: min(calc(54 * var(--uvw, 1vw)), 224px); padding: 6px 10px 7px; }
.lay-portrait .bt-panel.foe { top: calc(var(--b-sat) + 8px); left: calc(var(--b-sal) + 8px); }
.lay-portrait .bt-panel.me { right: calc(var(--b-sar) + 8px); bottom: calc(var(--b-sab) + 8px + 188px + 6px + 44px + 8px); }
.lay-portrait .bt-top { font-size: 13.5px; }
.lay-portrait .bt-bottom { left: calc(var(--b-sal) + 8px); right: calc(var(--b-sar) + 8px); bottom: calc(var(--b-sab) + 8px); flex-direction: column; gap: 6px; }
.lay-portrait .bt-dialog { font-size: 14px; }
.lay-portrait .bt-menu { height: 188px; padding: 7px; }
.lay-portrait .bt-speed { top: calc(var(--b-sat) + 8px); right: calc(var(--b-sar) + 8px); }
@media (max-width: 360px) {
  .lay-portrait .bt-mv { padding-left: 9px; }
  .lay-portrait .bt-mv-name { font-size: 14px; }
  .lay-portrait .bt-bag { width: 56px; }
  .lay-portrait .bt-mega { width: 50px; }
}

/* --- short landscape phones: both cards along the top, line bottom-left, dock bottom-right --- */
.lay-landscape .bt-panel { width: 214px; padding: 5px 10px 6px; }
.lay-landscape .bt-panel.foe { top: calc(var(--b-sat) + 6px); left: calc(var(--b-sal) + 8px); }
.lay-landscape .bt-panel.me { top: calc(var(--b-sat) + 6px); right: calc(var(--b-sar) + 8px); }
.lay-landscape .bt-top { font-size: 13px; }
.lay-landscape .bt-bottom { left: calc(var(--b-sal) + 8px); right: calc(var(--b-sar) + 8px); bottom: calc(var(--b-sab) + 6px); align-items: flex-end; }
.lay-landscape .bt-dialog { flex: 1; font-size: 14px; }
.lay-landscape .bt-menu { width: min(400px, calc(52 * var(--uvw, 1vw))); height: 162px; padding: 6px; }
.lay-landscape .bt-mv { height: 46px; padding-top: 4px; padding-bottom: 4px; gap: 1px; }
.lay-landscape .bt-mv-name { font-size: 14px; }
.lay-landscape .bt-foot { height: 46px; }
.lay-landscape .bt-speed { top: calc(var(--b-sat) + 64px); right: calc(var(--b-sar) + 8px); }
.lay-landscape .bt-flash { top: 30%; }

/* the turn pill: the dock coming up is the cue now */
.bt-turn { display: none !important; }

/* battle speed (Battle Speed Pass / GM): » 2× */
.bt-speed { position: absolute; z-index: 5; display: flex; align-items: center; gap: 2px; height: 30px; padding: 0 10px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .3); background: rgba(10, 18, 42, .8); color: #fff; font: 800 12px/1 Nunito, system-ui, sans-serif; cursor: pointer; }
.bt-speed[hidden] { display: none; }
.bt-speed span { font-size: 14px; margin-right: 2px; }
.bt-speed.on { background: linear-gradient(#ffd75e, #f2a93b); color: #2a1a00; border-color: #ffe9a8; }
.lay-portrait:has(.bt-speed:not([hidden])) .bt-panel.foe { max-width: calc(calc(100 * var(--uvw, 1vw)) - 96px); }

/* ================================================================ sheets (bag / party / learn move) */
.bt-overlay { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgba(4, 8, 20, .5); animation: bt-fade .15s; }
.bt-overlay[hidden] { display: none; }
@keyframes bt-fade { from { opacity: 0; } }
.bt-sheet { width: min(640px, calc(calc(100 * var(--uvw, 1vw)) - 32px)); max-height: calc(calc(100 * var(--udvh, 1dvh)) - 80px); overflow: auto; box-sizing: border-box; padding: 0 0 12px; border-radius: 18px;
  background: linear-gradient(#18264c, #0e1733); border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 16px 40px rgba(0, 0, 0, .55); overscroll-behavior: contain; }
.bt-sheet.small { width: min(440px, calc(calc(100 * var(--uvw, 1vw)) - 32px)); }
/* phones: sheets rise from the bottom edge, inside thumb reach */
.lay-portrait .bt-overlay.sheet-bottom, .lay-landscape .bt-overlay.sheet-bottom { place-items: end center; }
.lay-portrait .sheet-bottom .bt-sheet { width: 100%; max-height: calc(74 * var(--udvh, 1dvh)); border-radius: 20px 20px 0 0; padding-bottom: calc(12px + var(--b-sab)); animation: bt-rise .22s ease-out; }
.lay-landscape .sheet-bottom .bt-sheet { width: min(560px, calc(100 * var(--uvw, 1vw))); max-height: calc(calc(100 * var(--udvh, 1dvh)) - 12px); border-radius: 18px 18px 0 0; animation: bt-rise .22s ease-out; }
@keyframes bt-rise { from { transform: translateY(40px); opacity: .4; } }
.bt-sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px 16px; font-size: 16px;
  background: linear-gradient(#1b2a54, #18264c); border-bottom: 1px solid rgba(255, 255, 255, .1); }
.bt-sheet-head b { flex: 1; min-width: 0; font-weight: 900; }
.bt-sheet-head b small { display: block; margin-top: 2px; font-size: 12px; font-weight: 800; color: var(--bt-muted); }
.bt-x { flex: none; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .2); font-size: 13px; font-weight: 900; }
.bt-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, .3); }
.bt-tabs button { padding: 6px 10px; border-radius: 9px; border: 0; background: transparent; font-weight: 900; font-size: 12px; color: var(--bt-muted); }
.bt-tabs button.on { background: rgba(255, 255, 255, .14); color: #fff; }
.bt-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 8px; padding: 12px; }
.bt-item { position: relative; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; min-height: 54px; padding: 6px 10px 6px 8px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .06); text-align: left; font-weight: 800; font-size: 13.5px; }
.bt-item:hover { background: rgba(255, 255, 255, .12); }
.bt-item:active { transform: scale(.98); }
.bt-item img { width: 34px; height: 34px; object-fit: contain; }
.bt-item-name { min-width: 0; line-height: 1.2; }
.bt-item-name small { display: block; margin-top: 1px; font-size: 11px; font-weight: 800; color: #9fe8b8; }
.bt-item em { font-style: normal; color: var(--bt-gold); font-weight: 900; font-size: 12px; }
.bt-item .k { position: absolute; left: -4px; top: -5px; }
.bt-empty { padding: 20px; color: var(--bt-muted); }
.bt-party { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
.lay-portrait .bt-party { grid-template-columns: 1fr; }
.bt-pcard { position: relative; display: grid; grid-template-columns: 46px 1fr; gap: 10px; align-items: center; min-height: 60px; padding: 7px 12px 7px 8px; text-align: left;
  border-radius: 14px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); }
.bt-pcard .k { position: absolute; left: -5px; top: -6px; }
.bt-pcard img { width: 46px; height: 46px; border-radius: 10px; object-fit: contain; background: radial-gradient(rgba(120, 160, 255, .35), rgba(20, 40, 90, .2)); }
.bt-pball, .bt-pm .bt-pball { display: block; width: 30px; height: 30px; margin: 8px; border-radius: 50%; background: linear-gradient(#ee4040 0 45%, #222 45% 55%, #f5f5f5 55%); }
.bt-pcard.active { border-color: var(--bt-gold); background: rgba(255, 207, 74, .1); }
.bt-pcard.fnt { filter: grayscale(.85) brightness(.8); }
.bt-pcard:not([data-why]):hover { background: rgba(255, 255, 255, .12); }
.bt-pcard[data-why] { opacity: .6; }
.bt-ptop, .bt-pbot { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 14px; }
.bt-ptop b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-ptop span { color: var(--bt-gold); font-weight: 900; font-size: 12px; }
.bt-pbot { font-size: 11.5px; font-weight: 800; color: #c8d8f8; font-variant-numeric: tabular-nums; }
.bt-pbot em { margin-right: auto; font-size: 10.5px; color: #ffb4b4; font-style: normal; font-weight: 900; }
.bt-pbot .bt-st:empty + em { margin-left: 0; }
.bt-row { display: flex; justify-content: center; padding: 8px 12px 0; }
/* move rows in sheets (learn a move, Ether): the type colour as an edge */
.bt-sheet .bt-moves { display: grid; gap: 6px; padding: 12px; }
.bt-move { position: relative; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; min-height: 52px;
  padding: 6px 12px 6px 14px; text-align: left; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 30%, #111b3a), #111b3a 70%); box-shadow: inset 4px 0 0 var(--c); }
.bt-move .k { grid-column: 1; grid-row: 1 / 3; }
.bt-move b { grid-column: 2; grid-row: 1; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-move .bt-pp { grid-column: 2; grid-row: 2; display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 800; color: #dfe6f5; }
.bt-move .bt-type { grid-column: 3; grid-row: 1 / 3; font-size: 9.5px; font-weight: 900; letter-spacing: .5px; background: var(--c); color: #0a1630; padding: 2px 7px; border-radius: 6px; }
.bt-move:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 42%, #111b3a), #16224a 70%); }
.bt-move.new { border-color: var(--bt-gold); cursor: default; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 40%, #2a2410), #1a1a2a 80%); }
.bt-newtag { position: absolute; right: 10px; top: -8px; padding: 0 6px; border-radius: 6px; background: var(--bt-gold); color: #2a1a00; font: 900 10px/16px Nunito, sans-serif; font-style: normal; }
.bt-cat-i { display: inline-block; }
.bt-sep { padding: 4px 4px 0; font-size: 11px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; color: var(--bt-muted); }

/* ================================================================ level up pop */
.bt-lvl { position: absolute; left: 50%; top: 38%; z-index: 3; transform: translate(-50%, -50%); cursor: pointer; }
.lay-portrait .bt-lvl { top: 34%; }
.lay-landscape .bt-lvl { top: 42%; left: 38%; }
.bt-lvl[hidden] { display: none; }
.bt-lvl-card { position: relative; min-width: 220px; padding: 12px 18px 12px; border-radius: 18px; text-align: center; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, rgba(255, 214, 102, .35), rgba(14, 22, 48, .94) 62%); border: 1px solid rgba(255, 226, 140, .6);
  box-shadow: 0 0 0 3px rgba(255, 207, 74, .14), 0 14px 36px rgba(0, 0, 0, .5), 0 0 40px rgba(255, 200, 80, .25); }
.bt-lvl-rays { position: absolute; left: 50%; top: 34px; width: 340px; height: 340px; margin: -170px 0 0 -170px; pointer-events: none; opacity: .45;
  background: repeating-conic-gradient(from 0deg, rgba(255, 226, 140, .55) 0 7deg, transparent 7deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 0 20%, transparent 60%); mask: radial-gradient(circle, #000 0 20%, transparent 60%); animation: bt-spin 6s linear infinite; }
@keyframes bt-spin { to { transform: rotate(360deg); } }
.bt-lvl-card small { position: relative; display: block; font-size: 11px; font-weight: 900; letter-spacing: 2.4px; color: var(--bt-gold); }
.bt-lvl-lv { position: relative; display: block; font: 400 40px/1.05 'Lilita One', Nunito, system-ui, sans-serif; letter-spacing: 1px;
  background: linear-gradient(#fff6c8, #ffc93c 60%, #f0951c); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 #6a3a00); }
.bt-lvl-name { position: relative; font-size: 13px; font-weight: 900; color: #fff; margin-top: 1px; }
.bt-lvl-stats { position: relative; display: grid; grid-template-columns: repeat(3, auto); justify-content: center; gap: 4px 6px; margin-top: 8px; }
.bt-lvl-stats span { display: inline-flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 58px; padding: 2px 8px; border-radius: 8px;
  background: rgba(0, 0, 0, .3); font-size: 12px; font-weight: 900; color: #9aa6c4; font-variant-numeric: tabular-nums; }
.bt-lvl-stats span i { font-style: normal; font-size: 10px; letter-spacing: .4px; color: #c8d2ea; }
.bt-lvl-stats span.up { color: #7dff9f; }
.bt-lvl.go .bt-lvl-card { animation: bt-lvl-in .42s cubic-bezier(.2, 1.4, .4, 1); }
.bt-lvl.go .bt-lvl-stats span { animation: bt-lvl-chip .3s ease-out backwards; }
.bt-lvl.go .bt-lvl-stats span:nth-child(2) { animation-delay: .05s; } .bt-lvl.go .bt-lvl-stats span:nth-child(3) { animation-delay: .1s; }
.bt-lvl.go .bt-lvl-stats span:nth-child(4) { animation-delay: .15s; } .bt-lvl.go .bt-lvl-stats span:nth-child(5) { animation-delay: .2s; }
.bt-lvl.go .bt-lvl-stats span:nth-child(6) { animation-delay: .25s; }
.bt-lvl.leave .bt-lvl-card { transition: opacity .18s, transform .18s; opacity: 0; transform: scale(.92) translateY(-8px); }
@keyframes bt-lvl-in { 0% { opacity: 0; transform: scale(.5); } 100% { opacity: 1; transform: scale(1); } }
@keyframes bt-lvl-chip { from { opacity: 0; transform: translateY(6px); } }

/* log (L) */
.bt-log { position: absolute; left: 50%; top: 80px; transform: translateX(-50%); width: min(720px, calc(calc(100 * var(--uvw, 1vw)) - 28px)); max-height: calc(40 * var(--uvh, 1vh)); overflow: auto; box-sizing: border-box;
  background: rgba(4, 10, 24, .88); border: 1px solid var(--bt-line); border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 700; color: #c8d8f8; }
.bt-log[hidden] { display: none; }
.bt-log div { padding: 1px 0; border-bottom: 1px solid rgba(111, 166, 255, .12); }

/* floating numbers */
.bt-float { position: fixed; z-index: 7; transform: translate(-50%, -50%); pointer-events: none; font-weight: 900; font-size: 22px; color: #ffdd55;
  text-shadow: 0 2px 0 #3a2400, 0 0 6px #000; animation: bt-float 1.2s ease-out forwards; white-space: nowrap; font-family: Nunito, system-ui, sans-serif; }
.bt-float.crit { font-size: 30px; color: #ff9a3d; }
.bt-float.heal { color: #7dff9f; text-shadow: 0 2px 0 #0a3a1a, 0 0 6px #000; }
.bt-float.miss { color: #e8eefc; font-size: 18px; }
.bt-float.eff { color: #ffe14d; font-size: 16px; }
.bt-float.weak { color: #a9bde6; font-size: 15px; }
.bt-float.stat { color: #6fd0ff; font-size: 15px; }
.bt-float.statdown { color: #ff8c8c; font-size: 15px; }
@keyframes bt-float { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }

/* banner + flash */
.bt-banner { position: absolute; left: 0; right: 0; top: 34%; padding: 18px 0; text-align: center; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(16, 32, 64, .92) 20%, rgba(16, 32, 64, .92) 80%, transparent); border-top: 3px solid var(--bt-gold); border-bottom: 3px solid var(--bt-gold); }
.bt-banner[hidden] { display: none; }
.bt-banner.go { animation: bt-banner 1.6s ease-out; }
@keyframes bt-banner { 0% { transform: scaleY(0); opacity: 0; } 12% { transform: scaleY(1); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
.bt-vs { font-size: 46px; font-weight: 900; color: var(--bt-gold); text-shadow: 0 3px 0 #7a4a00, 0 0 18px rgba(255,207,74,.6); letter-spacing: 4px; font-style: italic; }
.bt-bn-title { font-size: 26px; font-weight: 900; }
.bt-bn-sub { font-size: 14px; color: #c8e7ff; font-weight: 800; }
.bt-flash { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); padding: 10px 24px; border-radius: 24px; background: linear-gradient(#ffd85e, #f3a51e);
  color: #3a2400; font-weight: 900; font-size: 18px; box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: bt-pop 2.2s ease-out forwards; pointer-events: none; }
@keyframes bt-pop { 0% { opacity: 0; transform: translate(-50%, 10px); } 10% { opacity: 1; transform: translate(-50%, 0); } 85% { opacity: 1; } 100% { opacity: 0; } }

/* reduced motion: no sliding, popping or spinning */
html.reduce-motion #battle-ui *, html.reduce-motion #battle-ui *::before { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { #battle-ui *, #battle-ui *::before { animation: none !important; transition: none !important; } }

/* PvP lobby (js/battle/index.js openLobby) */
.bt-lobby { position: fixed; right: 16px; top: 120px; width: 280px; z-index: 6; padding: 0 0 10px; font-family: Nunito, system-ui, sans-serif; color: #f4f7ff;
  background: linear-gradient(#152c5c, #0f2148); border: 3px solid #6c7cff; border-radius: 10px; box-shadow: 0 0 0 3px #0a1630; }
.bt-lobby h4 { margin: 0; padding: 8px 12px; border-bottom: 2px solid #2d5bb3; display: flex; justify-content: space-between; align-items: center; }
.bt-lobby h4 button { background: #0f2552; border: 2px solid #6fa6ff; border-radius: 8px; color: #fff; font-weight: 900; cursor: pointer; }
.bt-lobby .peer { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; font-weight: 800; font-size: 13px; }
.bt-lobby .peer button, .bt-lobby .invite button { border-radius: 8px; border: 2px solid #2d5bb3; background: linear-gradient(#c8473a, #8f2a22); color: #fff; font-weight: 900; padding: 3px 10px; cursor: pointer; }
.bt-lobby .invite { margin: 6px 10px; padding: 8px; border: 2px solid var(--gold, #ffcf4a); border-radius: 8px; font-size: 13px; font-weight: 800; }
.bt-lobby .invite div { display: flex; gap: 6px; margin-top: 6px; }
.bt-lobby .invite button + button { background: linear-gradient(#3f6fd0, #234a98); }
.bt-lobby .empty { padding: 8px 12px; font-size: 12px; color: #a9bde6; }

/* ---------- real-time wild battles (js/battle/realtime.js) ---------- */
.nametag.bt-np { padding: 2px 6px; border-radius: 6px; border: 2px solid transparent; background: rgba(10, 22, 48, .45); }
.nametag.bt-np.bt-target { border-color: #ff3b3b; box-shadow: 0 0 8px rgba(255, 59, 59, .6); }
.nametag.bt-np .np-lv { color: var(--gold, #ffcf4a); font-size: 10px; }
.nametag.bt-np .np-mood { font-size: 10px; margin-left: 2px; }
.nametag.bt-np .np-mood.ag { color: #ff6b6b; }
.nametag.bt-np .np-st { margin-left: 3px; font-size: 8.5px; padding: 0 4px; vertical-align: 1px; }
.nametag.bt-np .np-stages { justify-content: center; margin-top: 2px; gap: 2px; }
.nametag.bt-np .np-stages span { font-size: 9px; padding: 0 3px; animation: none; }
.nametag.bt-np .np-hp { width: 70px; height: 5px; margin: 2px auto 0; background: #0a1838; border-radius: 3px; overflow: hidden; border: 1px solid #2c4f96; }
.nametag.bt-np .np-hp i { display: block; height: 100%; background: linear-gradient(#6ff59d, #3ee07a); }
.nametag.bt-np .np-hp i.mid { background: linear-gradient(#ffe36e, #f0b71c); }
.nametag.bt-np .np-hp i.low { background: linear-gradient(#ff8c8c, #e83b3b); }
.nametag.bt-np .np-catch { font-size: 10px; color: #ffe9a8; }
.nametag.bt-np .np-catch b { color: #12264d; background: #e8eefc; border-radius: 3px; padding: 0 3px; }
/* cooldown sweep over the town move bar buttons */
#movebar .move { overflow: hidden; }
#movebar .move .bt-cd { position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: conic-gradient(rgba(5, 10, 25, .62) var(--p, 0deg), transparent 0); }
#movebar .move .bt-cd[hidden] { display: none; }
/* status chip on party cards */
#party .pm .bt-chip { position: absolute; top: -6px; right: 6px; font-size: 9px; font-weight: 900; padding: 0 5px; border-radius: 6px; line-height: 14px; }

/* clean battle stage: no floating name tags over the fight */
body.battle-stage #labels { display: none; }

/* the bought-Pokémon level cap (js/boughtcap.js): over-cap party members stay visible, dimmed, with a small lock */
.bt-pm.capped { opacity: .55; cursor: not-allowed; }
.bt-pm .bt-capl { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; fill: none; stroke: #ffd56a; stroke-width: 4; stroke-linecap: round;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6)); pointer-events: none; }
.bt-pcard.capped { opacity: .6; }

/* the PvP turn countdown bar along the top of the message line (js/battle/ui.js timer) */
.bt-dialog { position: relative; }
.bt-tbar { position: absolute; left: 10px; right: 10px; top: -7px; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, .35); overflow: hidden; pointer-events: none; }
.bt-tbar i { display: block; height: 100%; width: 100%; border-radius: 3px; background: linear-gradient(90deg, #4ad66d, #ffd23f); transition: width 1s linear; }
.bt-tbar.low i { background: #ff4d5e; animation: bt-tbar-blink .5s ease-in-out infinite alternate; }
@keyframes bt-tbar-blink { to { opacity: .45; } }
html.reduce-motion .bt-tbar i { transition: none; animation: none; }

/* ================================================================ double battles (#battle-ui.dbl, js/battle/ui.js open({ doubles }))
   Each side's two HP cards stack in its corner (the lead's card as usual, the partner's compact); the target picker fills
   the dock with big buttons and lights up the cards it can aim at (tap either). */
.dbl .bt-pair { position: absolute; display: flex; flex-direction: column; gap: 5px; pointer-events: none; }
.dbl .bt-pair > * { pointer-events: auto; }
.dbl .bt-pair .bt-panel { position: relative; inset: auto; width: 100%; }
.dbl .bt-panel.foe2, .dbl .bt-panel.me2 { padding: 4px 10px 5px; }
.dbl .bt-panel.foe2 .bt-top, .dbl .bt-panel.me2 .bt-top { font-size: 12.5px; }
.dbl .bt-panel.foe2 .bt-hp, .dbl .bt-panel.me2 .bt-hp { height: 6px; margin-top: 3px; }
.dbl .bt-panel.me2 .bt-sub { justify-content: flex-end; margin-top: 2px; }
.dbl .bt-panel.me2 .bt-hpnum { font-size: 11px; }
.dbl .bt-panel.me .bt-sub { margin-top: 3px; }
.lay-desktop.dbl .bt-pair.foe { top: 16px; left: 16px; width: 260px; }
.lay-desktop.dbl .bt-pair.me { right: 16px; bottom: calc(16px + 210px + 10px); width: 260px; }
.lay-landscape.dbl .bt-pair.foe { top: calc(var(--b-sat) + 6px); left: calc(var(--b-sal) + 8px); width: 200px; }
.lay-landscape.dbl .bt-pair.me { top: calc(var(--b-sat) + 6px); right: calc(var(--b-sar) + 8px); width: 200px; }
.lay-landscape.dbl .bt-panel.foe .bt-fx, .lay-landscape.dbl .bt-panel.me .bt-fx { display: none; }
.lay-portrait.dbl .bt-pair { gap: 4px; }
.lay-portrait.dbl .bt-pair.foe { top: calc(var(--b-sat) + 8px); left: calc(var(--b-sal) + 8px); width: min(calc(48 * var(--uvw, 1vw)), 200px); }
.lay-portrait.dbl .bt-pair.me { right: calc(var(--b-sar) + 8px); bottom: calc(var(--b-sab) + 8px + 188px + 6px + 44px + 8px); width: min(calc(48 * var(--uvw, 1vw)), 200px); }
.lay-portrait.dbl .bt-pair .bt-panel { padding: 4px 9px 5px; }
.lay-portrait.dbl .bt-pair .bt-top { font-size: 12.5px; }
.lay-portrait.dbl .bt-pair .bt-hp { height: 6px; margin-top: 3px; }
.dbl .bt-panel.foe2 .bt-balls, .dbl .bt-panel.me2 .bt-balls { display: none; }
/* the cards a move can be aimed at */
.dbl .bt-panel.pick { cursor: pointer; box-shadow: 0 0 0 2px var(--bt-gold), 0 6px 18px rgba(0, 0, 0, .35); animation: bt-pick 1s ease-in-out infinite alternate; }
.dbl .bt-panel.pick::after { content: ''; position: absolute; inset: -4px; }   /* a bigger tap target */
@keyframes bt-pick { to { box-shadow: 0 0 0 3px #fff3b0, 0 0 16px rgba(255, 210, 90, .6); } }
@media (prefers-reduced-motion: reduce) { .dbl .bt-panel.pick { animation: none; } }
.dbl .bt-panel.pick .bt-top { padding-left: 9px; }
.bt-pickk { position: absolute; left: -7px; top: -7px; z-index: 1; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bt-gold); color: #2a1a00; font: 900 11px/1 Nunito, system-ui, sans-serif; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.bt-menu.targets { display: flex; flex-direction: column; justify-content: center; }
.bt-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.bt-tg { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 64px; padding: 7px 11px 10px; text-align: left;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, .22); background: linear-gradient(135deg, #8a2f3c, #4a1a2a); box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }
.bt-tg.ally { background: linear-gradient(135deg, #2f5e9a, #1a2f5a); }
.bt-tg small { font-size: 10px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; opacity: .8; }
.bt-tg b { font-size: 15px; font-weight: 900; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.bt-tg .bt-pm-hp { left: 11px; right: 11px; bottom: 6px; }
.bt-tg .k { position: absolute; right: 6px; top: 6px; }
.bt-tg:hover { filter: brightness(1.1); }
.bt-tg:active { transform: scale(.97); }
.bt-mv .bt-spread { font-size: 9.5px; font-weight: 900; line-height: 15px; padding: 0 5px; border-radius: 6px; background: rgba(255, 255, 255, .22); color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bt-back2 { position: relative; flex: none; width: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 12px;
  border: 1px solid var(--bt-line); background: rgba(255, 255, 255, .08); color: #dfe6f5; font-size: 11.5px; font-weight: 900; }
html:not(.touch) .bt-back2 .k { position: static; }

/* co-op battle set-up (js/coopui.js pickCoopTeam): tap up to 3 Pokémon, Go */
.coop-pick { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(4, 8, 20, .55); font-family: Nunito, system-ui, sans-serif; color: #f4f7ff; }
.coop-sheet { width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); overflow: auto; box-sizing: border-box; padding: 14px; border-radius: 18px;
  background: linear-gradient(#18264c, #0e1733); border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 16px 40px rgba(0, 0, 0, .55); }
.coop-sheet > b { display: block; font-size: 15px; font-weight: 900; margin-bottom: 10px; }
.coop-mons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.coop-mon { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06); color: inherit; font: 800 12.5px Nunito, system-ui, sans-serif; cursor: pointer; min-width: 0; }
.coop-mon img { width: 48px; height: 48px; object-fit: contain; }
.coop-mon span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coop-mon small { color: #a9b8da; font-size: 11px; }
.coop-mon.on { border-color: #ffcf4a; background: rgba(255, 207, 74, .16); box-shadow: 0 0 0 1px #ffcf4a; }
.coop-mon:disabled { opacity: .4; filter: grayscale(1); cursor: not-allowed; }
.coop-ball { width: 30px; height: 30px; margin: 9px; border-radius: 50%; background: linear-gradient(#ef4242 0 44%, #222 44% 56%, #f4f4f4 56%); }
.coop-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* friendly battle choice (js/battlechoice.js pickBattleType): Single / Double / Co-op cards with an (i) each, Cancel.
   Phones: a bottom sheet in thumb reach; wider screens: centred. */
.bc-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(4, 8, 20, .55);
  font-family: Nunito, system-ui, sans-serif; color: #f4f7ff; animation: bc-fade .14s ease-out; }
.bc-wrap.out { opacity: 0; transition: opacity .14s ease-in; }
@media (min-width: 700px) and (min-height: 520px) { .bc-wrap { align-items: center; } }
.bc-sheet { width: min(440px, calc(100vw - 16px)); max-height: calc(100dvh - 24px); overflow: auto; box-sizing: border-box; padding: 14px;
  margin: 8px 8px max(8px, env(safe-area-inset-bottom)); border-radius: 20px; background: linear-gradient(#1a2952, #0e1733);
  border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 16px 40px rgba(0, 0, 0, .55); animation: bc-up .18s cubic-bezier(.2, .8, .3, 1); }
.bc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-width: 0; }
.bc-head > .ic-tile { width: 34px; height: 34px; flex: none; }
.bc-head > b { flex: 1 1 auto; min-width: 0; font-size: 17px; font-weight: 900; line-height: 1.25; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }   /* German and long names: two lines, never cut short at one */
.bc-name { color: #ffcf4a; }
.bc-x { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06); color: #cfd8ff; cursor: pointer; padding: 0; }
.bc-x .ic { width: 18px; height: 18px; }
.bc-list { display: grid; gap: 8px; }
.bc-opt { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06); transition: border-color .12s, background .12s; }
html:not(.touch) .bc-opt.focus:not(.off), .bc-opt:not(.off):active { border-color: #ffcf4a; background: rgba(255, 207, 74, .12); }
.bc-opt.open { background: rgba(255, 255, 255, .09); }
.bc-card { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 64px; padding: 10px 4px 10px 10px; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer; border-radius: 14px; }
.bc-card:focus-visible { outline: none; box-shadow: none !important; }   /* the gold .focus border of its card shows it */
.bc-i:focus-visible, .bc-x:focus-visible, .bc-cancel:focus-visible { outline: 2px solid #ffcf4a; outline-offset: 2px; }
.bc-ic { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 2px 0 rgba(0, 0, 0, .25); }
.bc-red { background: linear-gradient(#ff7a6b, #d63a3a); }
.bc-violet { background: linear-gradient(#a98bff, #6a4fd8); }
.bc-teal { background: linear-gradient(#4fd8c8, #1f9a8f); color: #fff; }
.bc-ic img { width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.bc-ic.bc-two { grid-template-columns: auto auto; }
.bc-ic.bc-two img { width: 24px; height: 24px; }
.bc-ic.bc-two img + img { margin-left: -6px; margin-top: 10px; }
.bc-ic .ic { width: 28px; height: 28px; }
.bc-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bc-txt b { font-size: 15px; font-weight: 900; line-height: 1.2; overflow-wrap: anywhere; }
.bc-txt small { font-size: 12.5px; font-weight: 700; color: #a9b8da; line-height: 1.3; overflow-wrap: anywhere; }
.bc-txt small .ic { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.bc-i { flex: none; width: 40px; height: 40px; margin-right: 8px; display: grid; place-items: center; border-radius: 50%; border: 1px solid transparent;
  background: none; color: #a9b8da; cursor: pointer; padding: 0; }
.bc-i .ic { width: 22px; height: 22px; }
.bc-i[aria-expanded="true"] { color: #ffcf4a; border-color: rgba(255, 207, 74, .5); background: rgba(255, 207, 74, .12); }
.bc-more { grid-column: 1 / -1; margin: 0 12px 12px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 13px; font-weight: 600;
  line-height: 1.45; color: #dbe4ff; overflow-wrap: anywhere; }
.bc-opt.off .bc-card { cursor: not-allowed; }
.bc-opt.off .bc-ic { filter: grayscale(1); opacity: .5; }
.bc-opt.off .bc-txt b { color: #a9b8da; }
.bc-opt.off .bc-txt small { color: #ffb4a8; }
.bc-opt.nudge { animation: bc-nudge .3s; }
.bc-cancel { display: flex; width: 100%; justify-content: center; margin-top: 12px; min-height: 44px; font-weight: 800; }
@keyframes bc-fade { from { opacity: 0; } }
@keyframes bc-up { from { transform: translateY(24px); opacity: 0; } }
@keyframes bc-nudge { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .bc-wrap, .bc-sheet, .bc-opt.nudge { animation: none; } }
