/* Desktop grounding is independent of the touch arena's layout and offsets. */
html:not(.battlemon-mobile) #battleScreen .duel-sprite {
  position: absolute;
  left: 50%;
  bottom: var(--desktop-sprite-bottom, -1rem);
  margin: 0;
  translate: calc(-50% + var(--desktop-sprite-x, 0px)) 0;
}

/* Tactical team is always three slots; the arena anchors remain unchanged. */
html:not(.battlemon-mobile) #battlePartySwitchGrid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.35rem; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .party-switch-btn { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:.15rem; min-width:0; height:6rem; padding:1rem .25rem .35rem; border:1px solid #3683c0; background:linear-gradient(145deg,#14304a,#102238); opacity:1; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .party-switch-btn.active-member { border-color:#34d399; background:linear-gradient(145deg,#105742,#103a35); box-shadow:inset 0 0 .8rem #34d39922; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .party-switch-btn.fainted-member { filter:grayscale(.75); opacity:.65; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .party-switch-btn img { width:3.5rem; height:3.5rem; max-width:100%; object-fit:contain; image-rendering:pixelated; margin:0; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .psb-name { position:static; max-width:100%; margin:0; font-size:.68rem; line-height:1.15; text-align:center; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .psb-hp { top:.25rem; left:.25rem; font-size:.5rem; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .empty-member { justify-content:center; border-style:dashed; background:#0e1e31; color:#5d82a3; }
.empty-member .empty-slot-plus { font:300 2rem/1 var(--font-clean); }
html:not(.battlemon-mobile) #battleBagRow { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.25rem; overflow:visible; }
html:not(.battlemon-mobile) #battleBagRow .bag-more-btn { color:#8ed8ff; border-color:#3899c8; justify-content:center; }
.hud-hp-track { position:relative; isolation:isolate; }
.hud-hp-trail { position:absolute; inset:0; background:#f4f7ff; transform-origin:left center; z-index:-1; border-radius:inherit; }
.hud-hp-progress { position:relative; z-index:1; transition:transform .22s ease,background .22s; }
.hud-hp-label { display:inline-flex; align-items:center; gap:.4rem; }
.hud-hp-label .status-pill { margin:0; padding:.05rem .3rem; font:inherit; line-height:1.1; }
.battle-extra-items { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.5rem; max-height:45vh; overflow:auto; }
.battle-extra-items>div { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:.35rem; padding:.6rem; border:1px solid #35547a; border-radius:.5rem; background:#12243b; }
.battle-extra-items svg { width:1.4rem; height:1.4rem; }
.battle-extra-items strong { font-size:.7rem; }
.battle-extra-items small { grid-column:1/-1; font:.65rem/1.5 var(--font-clean); color:#a5bed3; }
@media(prefers-reduced-motion:reduce){.hud-hp-progress,.hud-hp-trail{transition:none !important}}

html:not(.battlemon-mobile) #battlePartySwitchGrid .party-switch-btn img { transform:scale(1.45); transform-origin:center; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .psb-name { z-index:1; }
html:not(.battlemon-mobile) .tactical-side-panel .tactical-section+.tactical-section { margin-top:.4rem; }

/* Party content stays within its allocated row; its caption never reaches the bag heading. */
html:not(.battlemon-mobile) #battlePartySwitchGrid { align-items:stretch; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .party-switch-btn { display:grid; grid-template-rows:minmax(0,1fr) 1.3rem; align-items:center; justify-items:center; gap:0; height:100%; min-height:0; padding:0; box-sizing:border-box; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .party-switch-btn img { grid-row:1; width:3.5rem; height:100%; max-height:100%; transform:scale(1.35); }
html:not(.battlemon-mobile) #battlePartySwitchGrid .psb-name { display:flex; align-items:center; justify-content:center; grid-row:2; align-self:stretch; width:100%; max-width:100%; height:100%; margin:0; padding:.15rem .2rem; box-sizing:border-box; border-top:1px solid #3683c080; background:#102238cc; border-radius:0 0 .3rem .3rem; font-size:.62rem; line-height:1; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .active-member .psb-name { border-top-color:#34d39988; background:#0e4336cc; }
html:not(.battlemon-mobile) #battlePartySwitchGrid .empty-member { grid-template-rows:1fr; }
html:not(.battlemon-mobile) .tactical-side-panel { gap:.65rem; }
html:not(.battlemon-mobile) .tactical-side-panel .tactical-section+.tactical-section { margin-top:0; }
html:not(.battlemon-mobile) #battleBagRow { grid-template-rows:repeat(3,minmax(1.375rem,auto)); }
html:not(.battlemon-mobile) #battleBagRow .bag-empty-slot { display:flex; align-items:center; justify-content:center; border-style:dashed; border-color:#355979; background:#0e1e31; color:#6489a8; cursor:default; }
html:not(.battlemon-mobile) #battleBagRow .bag-empty-slot>span { font:300 1.1rem/1 var(--font-clean); }
html:not(.battlemon-mobile) #battleBagRow .bag-more-btn { display:flex; align-items:center; justify-content:center; gap:.3rem; background:#112c45; }
html:not(.battlemon-mobile) #battleBagRow .bag-more-btn svg { width:1rem; height:1rem; flex-shrink:0; }
.battle-bag-choices { display:grid; gap:.45rem; max-height:45vh; overflow-y:auto; padding:.2rem; }
.battle-bag-choices>button { display:flex; align-items:center; gap:.65rem; padding:.65rem; min-width:0; border:1px solid #3b6487; border-radius:.5rem; background:#11243c; color:#e1efff; cursor:pointer; text-align:left; }
.battle-bag-choices>button:hover:not(:disabled) { border-color:#7dd3fc; box-shadow:0 0 .5rem #38bdf833; }
.battle-bag-choices>button:disabled { opacity:.45; cursor:not-allowed; }
.battle-bag-choice-icon { width:1.7rem; flex-shrink:0; }
.battle-bag-choice-icon svg { width:1.7rem; height:1.7rem; }
.battle-bag-choices>button>span:nth-child(2) { display:flex; flex-direction:column; gap:.25rem; min-width:0; flex:1; }
.battle-bag-choices strong { font-size:.8rem; }
.battle-bag-choices small { color:#a6bed7; font:.65rem/1.4 var(--font-clean); }
.battle-bag-choices b { color:#fbbf24; }

html:not(.battlemon-mobile) #battlePartySwitchGrid .party-switch-btn { grid-template-columns:minmax(0,1fr); justify-content:stretch; }

/* Equal optical insets: the first and last HUD rows use the same line box. */
html:not(.battlemon-mobile) #battleScreen :is(#playerHudCard,#enemyHudCard) { --hud-vertical-inset:clamp(.4375rem,1.1dvh,.625rem); padding-top:var(--hud-vertical-inset); padding-bottom:var(--hud-vertical-inset); }
html:not(.battlemon-mobile) #battleScreen :is(#playerHudCard,#enemyHudCard) .hud-trainer-row { margin-top:0; line-height:1.2; }
html:not(.battlemon-mobile) #battleScreen :is(#playerHudCard,#enemyHudCard) .hud-hp-numbers { margin-bottom:0; line-height:1.2; }

/* Type icons use the card's bottom inset (.25rem) as their left inset too. */
html:not(.battlemon-mobile) #movesGrid .move-card-btn .m-meta { margin-inline-start:-.25rem; }

/* Identical tracks and item dimensions, including empty and backpack slots. */
html:not(.battlemon-mobile) #battleBagRow { grid-template-columns:repeat(3,minmax(0,1fr)); grid-template-rows:repeat(3,minmax(1.5rem,1fr)); align-items:stretch; }
html:not(.battlemon-mobile) #battleBagRow .bag-item-btn { width:100%; height:100%; min-width:0; min-height:0; box-sizing:border-box; padding:.125rem .25rem; margin:0; }
html:not(.battlemon-mobile) #battleBagRow .bag-item-btn svg { width:1rem; height:1rem; flex-shrink:0; vertical-align:middle; transition:transform .25s cubic-bezier(.3,1.6,.5,1); }
/* Hover da mochila em batalha: brilho dourado, varredura de luz e ícone animado, sem alterar o tamanho. */
html:not(.battlemon-mobile) #battleBagRow .bag-item-btn { position:relative; isolation:isolate; transition:border-color .18s, background .18s, box-shadow .18s, color .18s; }
html:not(.battlemon-mobile) #battleBagRow .bag-item-btn::after { content:""; position:absolute; top:-50%; bottom:-50%; left:-70%; width:40%; z-index:-1; transform:rotate(20deg); background:linear-gradient(90deg,transparent,#fde04733,transparent); pointer-events:none; }
html:not(.battlemon-mobile) #battleBagRow .bag-item-btn:hover:not(:disabled), html:not(.battlemon-mobile) #battleBagRow .bag-item-btn:focus-visible:not(:disabled) { color:#fff; border-color:#fbbf24; background:linear-gradient(180deg,#2a2210,#151c2c); box-shadow:inset 0 0 .6rem #fbbf2433, 0 0 .7rem #fbbf2455; }
html:not(.battlemon-mobile) #battleBagRow .bag-item-btn:hover:not(:disabled)::after { animation:bagItemShine .7s ease-out; }
html:not(.battlemon-mobile) #battleBagRow .bag-item-btn:hover:not(:disabled) svg { transform:scale(1.18) rotate(-8deg); }
html:not(.battlemon-mobile) #battleBagRow .bag-item-btn:hover:not(:disabled) strong { color:#fde047; text-shadow:0 0 .4rem #fbbf24aa; }
html:not(.battlemon-mobile) #battleBagRow .bag-item-btn:active:not(:disabled) { background:#3a2c0e; box-shadow:inset 0 0 .8rem #fbbf2455; }
html:not(.battlemon-mobile) #battleBagRow .bag-item-btn:disabled:hover { border-color:#475569; }
@keyframes bagItemShine { from { left:-70%; } to { left:140%; } }

html:not(.battlemon-mobile) #battleScreen #btnFlee { margin-inline-end:.5rem; }

/* Popup "Novo Pokémon liberado" centralizado na arena, não só na coluna do meio. */
@media (min-width: 761px) {
  html:not(.battlemon-mobile) #battleScreen .arena-top-bar { grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); }
  html:not(.battlemon-mobile) #battleScreen .arena-match-info { justify-self:start; }
  html:not(.battlemon-mobile) #battleScreen .arena-unlock-slot { width:min(24rem,38vw); height:2.9rem; align-self:center; justify-self:center; }
  html:not(.battlemon-mobile) #battleScreen .pokemon-unlock-toast { width:100%; justify-content:center; padding-inline:.75rem 1rem; }
  html:not(.battlemon-mobile) #battleScreen .unlock-toast-text { align-items:flex-start; }
}

html:not(.battlemon-mobile) .battle-end-header { display:flex; flex-direction:column; align-items:center; }
html:not(.battlemon-mobile) .battle-end-header #modalTitle { order:-1; }
html:not(.battlemon-mobile) #battleEndSquadSection .battle-end-section-label { text-align:center; }
html:not(.battlemon-mobile) #battleEndSquadGrid .end-poke-name { max-width:none; white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; flex:1; text-align:left; }
html:not(.battlemon-mobile) #battleEndSquadGrid .end-poke-name-row { gap:.4rem; }
html:not(.battlemon-mobile) #battleEndSquadGrid .end-poke-level { flex-shrink:0; }

/* Empty item slots share the empty party slot's blue lift and glow. */
html:not(.battlemon-mobile) #battleBagRow .bag-empty-slot { transition:all .15s ease; }
html:not(.battlemon-mobile) #battleBagRow .bag-empty-slot:hover { border-color:#38bdf8; background:rgba(56,189,248,.16); box-shadow:0 0 .625rem rgba(56,189,248,.35); transform:translateY(-.125rem); }

/* Botão "Pokémon nocauteado": painel escuro com o nome e a etiqueta NOCAUTEADO, e uma barra de ação dourada */
html:not(.battlemon-mobile) .player-fainted-action-container { width: 96%; max-width: 19rem; }
html:not(.battlemon-mobile) .btn-pokemon-fainted-red {
  padding: 0; gap: 0; overflow: hidden; border: 2px solid #fb7185; border-radius: .95rem;
  background: linear-gradient(180deg, #2c1223, #150b19);
  box-shadow: 0 .6rem 1.4rem #000a, 0 0 1.2rem #fb718550, inset 0 1px 0 #ffffff1a;
  animation: faintedGlow 1.8s ease-in-out infinite alternate;
}
html:not(.battlemon-mobile) .btn-pokemon-fainted-red:hover { transform: translateY(-2px); filter: brightness(1.08); border-color: #fecdd3; box-shadow: 0 .8rem 1.6rem #000b, 0 0 1.8rem #fb7185aa; }
html:not(.battlemon-mobile) .btn-pokemon-fainted-red:active { transform: translateY(1px) scale(.98); }
html:not(.battlemon-mobile) .fainted-btn-badge {
  display: flex; align-items: center; justify-content: center; gap: .55rem; width: 100%; box-sizing: border-box; padding: .55rem .8rem .5rem;
  background: repeating-linear-gradient(135deg, #ffffff07 0 6px, transparent 6px 12px); border-bottom: 1px solid #fb718545; text-shadow: none; letter-spacing: 0;
}
html:not(.battlemon-mobile) .fb-skull { display: grid; place-items: center; flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; color: #fecdd3; background: #fb71851f; border: 1px solid #fb718566; }
html:not(.battlemon-mobile) .fb-skull svg { width: 1.05rem; height: 1.05rem; }
html:not(.battlemon-mobile) .fb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font: 800 .86rem var(--font-pixel-ui); text-transform: none; }
html:not(.battlemon-mobile) .fb-ko { flex: none; padding: .15rem .5rem; border-radius: .4rem; background: #ef44441f; border: 1px solid #ef4444aa; color: #fca5a5; font: 800 .52rem var(--font-pixel-ui); letter-spacing: .1em; }
html:not(.battlemon-mobile) .fainted-btn-main {
  position: relative; overflow: hidden; width: 100%; box-sizing: border-box; padding: .6rem .8rem; gap: .5rem;
  color: #2b1500; text-shadow: 0 1px 0 #ffffff55; letter-spacing: .08em; font-size: .82rem;
  background: linear-gradient(180deg, #fde68a, #f59e0b 55%, #d97706); box-shadow: inset 0 1px 0 #ffffffaa;
}
html:not(.battlemon-mobile) .fainted-btn-main::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 40%, #ffffff77 50%, transparent 60%); transform: translateX(-120%); animation: faintedShine 2.6s ease-in-out infinite; }
html:not(.battlemon-mobile) .fainted-btn-arrow { color: #2b1500; width: 1rem; height: 1rem; }
@keyframes faintedGlow { from { box-shadow: 0 .6rem 1.4rem #000a, 0 0 .9rem #fb718540, inset 0 1px 0 #ffffff1a; } to { box-shadow: 0 .6rem 1.4rem #000a, 0 0 1.8rem #fb7185a0, inset 0 1px 0 #ffffff1a; } }
@keyframes faintedShine { 0%, 50% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@media (prefers-reduced-motion: reduce) { html:not(.battlemon-mobile) .btn-pokemon-fainted-red, html:not(.battlemon-mobile) .fainted-btn-main::after { animation: none; } }
html:not(.battlemon-mobile) .fb-ko { background: #450a0acc; border-color: #fca5a5; color: #fecaca; }
html:not(.battlemon-mobile) .fb-skull { background: #450a0a99; border-color: #fca5a5; }
