/* Arena presentation is scoped: campaign and wild battles keep their layout. */
#screen #battle.pvp-battle {
  --pbh-gold:#e4cc91; --pbh-muted:#a4bcb1; --pbh-line:#89ba9c30;
  display:block; padding:0; overflow:auto; overscroll-behavior:contain;
  bottom:0;
  background:#081c19!important; color:#eff7ed; border:1px solid #759382!important;
  border-radius:8px!important; box-shadow:inset 0 1px #d5ebbe19,0 12px 40px #0006;
  font:14px/1.45 system-ui,-apple-system,'Segoe UI',sans-serif; text-shadow:none;
  scrollbar-width:thin; scrollbar-color:#4b7361 #0d241f; container-type:size;
}
#screen #battle.pvp-battle[hidden] { display:none; }
#screen #battle.pvp-battle * { box-sizing:border-box; }
#screen #battle.pvp-battle :is(h2,h3,p) { margin:0; color:inherit; font-family:inherit; text-shadow:none; }
#screen #battle.pvp-battle :is(button,select,summary) { font:inherit; text-shadow:none; touch-action:manipulation; }
#screen #battle.pvp-battle button {
  margin:0; border:1px solid var(--pbh-line); border-radius:10px!important; background:#16342c; color:#f3f7ee;
  box-shadow:inset 0 1px #ffffff09; padding:10px 14px; min-height:44px; cursor:pointer;
  transition:background .18s,border-color .18s,box-shadow .18s,transform .18s;
}
#screen #battle.pvp-battle button:hover:not(:disabled) { background:#244d3e; border-color:#e4cc9180; box-shadow:0 4px 18px #0003,inset 0 1px #e4cc9120; }
#screen #battle.pvp-battle button:active:not(:disabled) { transform:translateY(1px); }
#screen #battle.pvp-battle :is(button,select,summary):focus-visible { outline:2px solid var(--pbh-gold); outline-offset:3px; }
#screen #battle.pvp-battle button:disabled { cursor:default; opacity:.42; }
#screen #battle.pvp-battle .pbh-shell { min-height:100%; padding:18px clamp(12px,2.4cqw,30px) 44px; background:radial-gradient(ellipse at 0 0,#22624e33,transparent 55%); }
/* Keep the existing online/audio controls above the arena instead of overlapping it. */
#screen:has(#server-presence):has(#battle.pvp-battle:not([hidden])) #battle.pvp-battle .pbh-shell { padding-top:58px; }
#screen:has(#battle.pvp-battle:not([hidden])) #server-presence { background:#0b211ef2; border-color:#749c7d66; box-shadow:0 3px 10px #0003; }
body:has(#battle.pvp-battle:not([hidden])) :is(#touch-controls,#touch-controls *,#companion-chat-toggle,#chat-toggle,#exit-immersive-btn) { visibility:hidden!important; pointer-events:none!important; }
#screen #battle.pvp-battle .pbh-header { display:flex; align-items:center; gap:18px; padding-bottom:18px; }
#screen #battle.pvp-battle .pbh-brand { display:flex; gap:12px; align-items:center; margin-right:auto; min-width:0; }
#screen #battle.pvp-battle .pbh-emblem { color:var(--pbh-gold); font-size:30px; width:48px; height:48px; display:grid; place-items:center; border:1px solid #b4cd913f; border-radius:14px; background:linear-gradient(135deg,#b0cd7122,#162f2a); text-shadow:0 0 20px #bedc9c77; }
#screen #battle.pvp-battle .pbh-eyebrow { display:block; color:var(--pbh-gold); font-size:10px; font-weight:700; letter-spacing:.16em; }
#screen #battle.pvp-battle h2 { font-size:clamp(18px,2.3cqw,25px); font-weight:650; letter-spacing:-.025em; }
#screen #battle.pvp-battle .pbh-tags { display:flex; align-items:center; gap:9px; color:var(--pbh-muted); font-size:12px; }
#screen #battle.pvp-battle .pbh-mode { background:#6ec79915; color:#b9e3c4; border:1px solid #6ec7993a; border-radius:5px; padding:4px 8px; font-weight:700; }
#screen #battle.pvp-battle .pbh-clock { min-width:78px; text-align:center; padding-left:18px; border-left:1px solid var(--pbh-line); font-variant-numeric:tabular-nums; }
#screen #battle.pvp-battle .pbh-clock small { display:block; color:var(--pbh-muted); font-size:10px; letter-spacing:.1em; }
#screen #battle.pvp-battle .pbh-clock strong { display:block; color:#f4deb2; font-size:24px; font-weight:600; line-height:1.15; }
#screen #battle.pvp-battle .pbh-clock[data-urgent=true] strong { color:#ffac91; animation:pbh-clock 1s ease-in-out infinite; }

#screen #battle.pvp-battle .pbh-field.verdant-field {
  position:relative; isolation:isolate; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:clamp(20px,7cqw,88px);
  min-height:300px; padding:20px 24px 44px; border:1px solid #86b39940; border-radius:16px; overflow:hidden;
  background:radial-gradient(ellipse at 50% 130%,#427a4e80,transparent 65%),linear-gradient(170deg,#0d3029,#173e31 46%,#0a231f);
  box-shadow:inset 0 1px #d6e6c22b,inset 0 -25px 60px #01100a44;
}
#screen #battle.pvp-battle .pbh-field .battle-backdrop {
  background:repeating-linear-gradient(90deg,transparent 0 12%,#b9eec506 12% 12.2%,transparent 12.2% 24%),radial-gradient(ellipse at 50% -30%,#bed79130,transparent 70%)!important;
  opacity:1; image-rendering:auto;
}
#screen #battle.pvp-battle .pbh-field::before { content:''; position:absolute; left:12%; right:12%; height:65%; top:40%; border:1px solid #e5ce9220; border-radius:50%; background:radial-gradient(ellipse,#79a67113,transparent 68%); pointer-events:none; }
#screen #battle.pvp-battle .pbh-side { display:flex; align-items:stretch; justify-content:center; gap:12px; min-width:0; z-index:2; }
#screen #battle.pvp-battle .pbh-mon { flex:1; min-width:0; display:flex; flex-direction:column; position:relative; padding:0; background:none; border:0; text-align:left; }
#screen #battle.pvp-battle .pbh-mon-hud { position:relative; z-index:3; padding:12px 16px 10px; border:1px solid #bbd6a740; border-radius:10px; background:linear-gradient(125deg,#122b27eb,#0e2421db); box-shadow:0 5px 16px #0003,inset 0 1px #ffffff09; backdrop-filter:blur(12px); }
#screen #battle.pvp-battle .pbh-owner { display:flex; align-items:center; justify-content:space-between; gap:8px; color:#adc6b6; font-size:12px; overflow-wrap:anywhere; }
#screen #battle.pvp-battle .pbh-owner small { font-size:9px; letter-spacing:.1em; color:#83a895; text-align:right; }
#screen #battle.pvp-battle .pbh-mon-title { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:3px 0 7px; }
#screen #battle.pvp-battle .pbh-mon-title strong { font-size:clamp(16px,2.2cqw,22px); letter-spacing:-.025em; overflow-wrap:anywhere; }
#screen #battle.pvp-battle .pbh-mon-title>span { color:var(--pbh-gold); font-size:12px; white-space:nowrap; }
#screen #battle.pvp-battle .pbh-mon-meta { display:flex; gap:5px; flex-wrap:wrap; margin-bottom:8px; align-items:center; }
#screen #battle.pvp-battle .pbh-type { display:inline-flex; align-items:center; width:max-content; color:var(--type); border:1px solid color-mix(in srgb,var(--type) 24%,transparent); border-radius:4px; padding:1px 7px; font-size:10px; font-weight:650; line-height:1.5; background:color-mix(in srgb,var(--type) 8%,transparent); }
#screen #battle.pvp-battle :is(.pbh-shiny,.pbh-status) { display:inline; color:#ffe09b; font-size:10px; }
#screen #battle.pvp-battle .pbh-status { color:#f8bcaa; }
#screen #battle.pvp-battle progress.pbh-hp { width:100%; height:7px; margin:0; border:0; background:#030f0d; border-radius:5px; box-shadow:0 1px #ffffff0d; }
#screen #battle.pvp-battle progress.pbh-hp::-webkit-progress-bar { background:#041410; }
#screen #battle.pvp-battle progress.pbh-hp::-webkit-progress-value { background:linear-gradient(90deg,#54b98d,#b4dfa0); border-radius:5px; transition:width .45s ease; }
#screen #battle.pvp-battle progress.pbh-hp[data-health=medium]::-webkit-progress-value { background:linear-gradient(90deg,#d29b4c,#f1d98d); }
#screen #battle.pvp-battle progress.pbh-hp[data-health=low]::-webkit-progress-value { background:linear-gradient(90deg,#d56d63,#ffb49b); }
#screen #battle.pvp-battle .pbh-hp-numbers { display:flex; justify-content:space-between; margin-top:4px; color:#afc4b5; font-size:10px; font-variant-numeric:tabular-nums; }
#screen #battle.pvp-battle .pbh-hp-numbers b { font-weight:500; color:#dfeada; }
#screen #battle.pvp-battle .pbh-portrait { display:grid; place-items:center; position:relative; flex:1; min-height:136px; margin:5px 0 -10px; }
#screen #battle.pvp-battle .pbh-portrait::before { content:''; position:absolute; width:70%; height:26px; bottom:4px; border:1px solid #c4dba440; border-radius:50%; box-shadow:0 0 25px #8de4a220,inset 0 0 20px #a5da7229; background:radial-gradient(ellipse,#afcf803d,#376e4c22 70%); }
#screen #battle.pvp-battle .pbh-mon .pbh-portrait canvas.battle-pokemon { display:block; width:clamp(104px,18cqw,188px)!important; height:clamp(104px,18cqw,188px)!important; max-width:100%; object-fit:contain; aspect-ratio:1; margin:0 auto; z-index:1; filter:drop-shadow(0 9px 5px #00120e70); transform-origin:50% 100%; }
#screen #battle.pvp-battle .pbh-mon[data-fainted=true] .pbh-portrait { opacity:.35; filter:grayscale(.85); }
#screen #battle.pvp-battle .pbh-versus { position:absolute; left:50%; top:58%; transform:translate(-50%,-50%); color:#e4ce9990; font-size:20px; font-weight:300; letter-spacing:.1em; z-index:1; }
#screen #battle.pvp-battle .pbh-teams { position:absolute; display:flex; justify-content:space-between; align-items:center; bottom:14px; left:24px; right:24px; z-index:3; color:#9bb79d; font-size:9px; font-weight:600; letter-spacing:.16em; }
#screen #battle.pvp-battle .pbh-team-dots { display:flex; gap:5px; }
#screen #battle.pvp-battle .pbh-ball { position:relative; width:11px; height:11px; border:1px solid #a7ccae; background:linear-gradient(#99ca98 0 43%,#a7ccae 43% 56%,#2e5747 56%); border-radius:50%; }
#screen #battle.pvp-battle .pbh-ball::after { content:''; position:absolute; top:3px; left:3px; width:3px; height:3px; border:1px solid #8ab296; border-radius:50%; background:#233f34; }
#screen #battle.pvp-battle .pbh-ball[data-ready=false] { opacity:.25; }

#screen #battle.pvp-battle .pbh-history { margin:12px 0 18px; border-bottom:1px solid var(--pbh-line); }
#screen #battle.pvp-battle .pbh-history summary { display:flex; align-items:center; gap:16px; min-height:44px; padding:4px 0 12px; cursor:pointer; list-style:none; }
#screen #battle.pvp-battle .pbh-history summary::-webkit-details-marker { display:none; }
#screen #battle.pvp-battle .pbh-latest { flex:1; min-width:0; color:#d3e2d4; font-size:13px; }
#screen #battle.pvp-battle .pbh-history-hint { color:#a6bfa8; font-size:11px; white-space:nowrap; }
#screen #battle.pvp-battle .pbh-history-hint::after { content:' ＋'; color:var(--pbh-gold); }
#screen #battle.pvp-battle .pbh-history[open] .pbh-history-hint::after { content:' −'; }
#screen #battle.pvp-battle .pbh-log { max-height:150px; overflow:auto; margin:0 0 12px; padding:4px 0 4px 20px; font-size:12px; color:#b8cbbd; }
#screen #battle.pvp-battle .pbh-log li { padding:3px 4px; }
#screen #battle.pvp-battle .pbh-command+.pbh-command { margin-top:22px; padding-top:18px; border-top:1px solid var(--pbh-line); }
#screen #battle.pvp-battle .pbh-command-title { display:flex; justify-content:space-between; gap:10px; align-items:center; margin-bottom:12px; }
#screen #battle.pvp-battle .pbh-command-title h3 { font-size:15px; font-weight:600; }
#screen #battle.pvp-battle .pbh-feedback { color:var(--pbh-muted); font-size:11px; }
#screen #battle.pvp-battle .pbh-deck { display:grid; grid-template-columns:minmax(0,1.55fr) minmax(0,1fr); gap:18px; }
#screen #battle.pvp-battle .pbh-move-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
#screen #battle.pvp-battle button.pbh-move { display:flex; flex-direction:column; align-items:stretch; gap:6px; padding:12px 14px; text-align:left; background:linear-gradient(115deg,color-mix(in srgb,var(--type) 10%,#0d211d),#102720); border-color:color-mix(in srgb,var(--type) 25%,#19382c); min-height:96px; }
#screen #battle.pvp-battle button.pbh-move:hover:not(:disabled) { background:linear-gradient(115deg,color-mix(in srgb,var(--type) 20%,#10251e),#1c3b2d); border-color:var(--type); box-shadow:0 0 18px color-mix(in srgb,var(--type) 10%,transparent); transform:translateY(-2px); }
#screen #battle.pvp-battle .pbh-move-top { display:flex; justify-content:space-between; align-items:center; gap:6px; }
#screen #battle.pvp-battle .pbh-pp { font-size:11px; color:#d0dccb; font-variant-numeric:tabular-nums; }
#screen #battle.pvp-battle .pbh-move strong { font-weight:600; font-size:16px; overflow-wrap:anywhere; }
#screen #battle.pvp-battle .pbh-move-stats { display:flex; justify-content:space-between; flex-wrap:wrap; gap:4px; font-size:10px; color:#abc1b4; }
#screen #battle.pvp-battle .pbh-bench { min-width:0; }
#screen #battle.pvp-battle .pbh-bench>.pbh-eyebrow { margin-bottom:8px; }
#screen #battle.pvp-battle .pbh-bench-list { display:grid; gap:6px; }
#screen #battle.pvp-battle button.pbh-reserve { display:flex; align-items:center; gap:10px; padding:5px 10px; min-width:0; min-height:57px; text-align:left; background:#142e26; }
#screen #battle.pvp-battle button.pbh-reserve[data-active=true] { opacity:1; border-color:#799f6f6b; background:#324b302b; }
#screen #battle.pvp-battle .pbh-reserve canvas { width:45px!important; height:45px!important; object-fit:contain; flex-shrink:0; image-rendering:pixelated; margin:0!important; }
#screen #battle.pvp-battle .pbh-reserve-info { flex:1; min-width:0; display:grid; grid-template-columns:1fr auto; align-items:center; column-gap:8px; }
#screen #battle.pvp-battle .pbh-reserve-info strong { font-size:13px; font-weight:600; overflow-wrap:anywhere; }
#screen #battle.pvp-battle .pbh-reserve-info small { font-size:10px; color:var(--pbh-muted); }
#screen #battle.pvp-battle .pbh-reserve-info .pbh-health { grid-column:1/-1; margin-top:5px; }
#screen #battle.pvp-battle .pbh-reserve-info .pbh-hp-numbers { display:none; }
#screen #battle.pvp-battle .pbh-reserve-info progress.pbh-hp { height:4px; }
#screen #battle.pvp-battle .pbh-target { display:flex; flex-direction:column; gap:4px; margin:0 0 8px; color:var(--pbh-muted); font-size:12px; }
#screen #battle.pvp-battle .pbh-target select { width:100%; min-width:0; min-height:44px; background:#132f27!important; color:#f3f5e8!important; border:1px solid #6d927766!important; border-radius:8px!important; padding:8px; }
#screen #battle.pvp-battle .pbh-waiting { min-height:90px; display:grid; align-items:center; padding:16px; background:#7ebd8110; border:1px solid var(--pbh-line); border-radius:10px; }
#screen #battle.pvp-battle .pbh-waiting .pbh-feedback::before { content:'● '; color:#9cdbac; }
#screen #battle.pvp-battle .pbh-footer { display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap; margin-top:16px; padding-top:10px; border-top:1px solid var(--pbh-line); color:#91ad9c; font-size:11px; }
#screen #battle.pvp-battle button.pbh-forfeit { background:transparent; border-color:transparent; color:#c8ab9b; font-size:12px; padding:6px 12px; }
#screen #battle.pvp-battle .pbh-forfeit-confirm { width:100%; display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
#screen #battle.pvp-battle button.pbh-danger { border-color:#b8756055; background:#4c3028; color:#ffdac4; }
#screen #battle.pvp-battle .pbh-result { text-align:center; padding:20px 16px 30px; }
#screen #battle.pvp-battle .pbh-result-mark { display:block; font-size:44px; color:#a8b8a9; }
#screen #battle.pvp-battle .pbh-result[data-won=true] .pbh-result-mark { color:var(--pbh-gold); text-shadow:0 0 40px #d7e09f66; }
#screen #battle.pvp-battle .pbh-result h2 { font-size:32px; margin:5px 0; }
#screen #battle.pvp-battle .pbh-result p { color:var(--pbh-muted); margin:6px 0; font-size:13px; }
#screen #battle.pvp-battle .pbh-reward { display:block; color:var(--pbh-gold); font-size:18px; margin:12px 0; }
#screen #battle.pvp-battle button.pbh-primary { min-width:180px; margin-top:16px; border-color:#dfce8c77; background:linear-gradient(135deg,#416448,#254b39); color:#fff1c8; font-weight:650; }
@keyframes pbh-clock { 50% { opacity:.6; } }
@container (max-width:680px) {
  #screen #battle.pvp-battle .pbh-header { flex-wrap:wrap; gap:8px; padding-bottom:12px; }
  #screen #battle.pvp-battle .pbh-brand { flex:1; }
  #screen #battle.pvp-battle .pbh-emblem { display:none; }
  #screen #battle.pvp-battle .pbh-tags { order:3; width:100%; font-size:11px; }
  #screen #battle.pvp-battle .pbh-clock { min-width:62px; }
  #screen #battle.pvp-battle .pbh-field.verdant-field { gap:12px; padding:10px 10px 32px; min-height:258px; border-radius:12px; }
  #screen #battle.pvp-battle .pbh-mon-hud { padding:9px 10px 7px; }
  #screen #battle.pvp-battle .pbh-owner small { display:none; }
  #screen #battle.pvp-battle .pbh-owner { font-size:11px; }
  #screen #battle.pvp-battle .pbh-mon-title { flex-wrap:wrap; gap:2px 5px; margin-top:4px; }
  #screen #battle.pvp-battle .pbh-mon-title strong { font-size:16px; }
  #screen #battle.pvp-battle .pbh-mon-title>span { font-size:10px; }
  #screen #battle.pvp-battle .pbh-type { font-size:9px; padding:1px 5px; }
  #screen #battle.pvp-battle .pbh-portrait { min-height:110px; }
  #screen #battle.pvp-battle .pbh-versus { font-size:13px; top:72%; }
  #screen #battle.pvp-battle .pbh-teams { left:14px; right:14px; bottom:10px; font-size:8px; letter-spacing:.05em; }
  #screen #battle.pvp-battle .pbh-history { margin:8px 0 12px; }
  #screen #battle.pvp-battle .pbh-history summary { gap:8px; padding-bottom:8px; }
  #screen #battle.pvp-battle .pbh-history summary>.pbh-eyebrow { display:none; }
  #screen #battle.pvp-battle .pbh-latest { font-size:12px; }
  #screen #battle.pvp-battle .pbh-command-title { display:block; }
  #screen #battle.pvp-battle .pbh-command-title h3 { font-size:14px; }
  #screen #battle.pvp-battle .pbh-deck { grid-template-columns:1fr; gap:16px; }
  #screen #battle.pvp-battle button.pbh-move { padding:9px 10px; min-height:96px; }
  #screen #battle.pvp-battle .pbh-move strong { font-size:15px; }
  #screen #battle.pvp-battle .pbh-bench-list { grid-template-columns:repeat(3,minmax(0,1fr)); }
  #screen #battle.pvp-battle button.pbh-reserve { flex-direction:column; gap:2px; padding:6px; align-items:stretch; }
  #screen #battle.pvp-battle .pbh-reserve canvas { align-self:center; }
  #screen #battle.pvp-battle .pbh-reserve-info { display:flex; flex-direction:column; gap:2px; text-align:center; }
  #screen #battle.pvp-battle .pbh-reserve-info strong { font-size:11px; }
  #screen #battle.pvp-battle .pbh-reserve-info small { font-size:9px; }
  #screen #battle.pvp-battle .pbh-reserve-info .pbh-health { width:100%; }
  #screen #battle.pvp-battle .pbh-side:has(.pbh-mon:nth-child(2)) { flex-direction:column; }
  #screen #battle.pvp-battle .pbh-footer>span { max-width:72%; }
}
/* Wide, short windows place commands beside the stage so attacks stay visible. */
@container (min-width:700px) and (max-height:740px) {
  #screen #battle.pvp-battle .pbh-shell { display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,1fr); align-content:start; gap:10px 18px; padding:12px 16px 36px; }
  #screen #battle.pvp-battle .pbh-header { grid-column:1/-1; padding-bottom:4px; }
  #screen #battle.pvp-battle .pbh-field { grid-column:1; grid-row:2; }
  #screen #battle.pvp-battle .pbh-field.verdant-field { padding:12px 12px 36px; gap:12px; min-height:250px; }
  #screen #battle.pvp-battle .pbh-actions { grid-column:2; grid-row:2; }
  #screen #battle.pvp-battle .pbh-mon-hud { padding:10px; }
  #screen #battle.pvp-battle .pbh-mon-title { flex-wrap:wrap; gap:2px 6px; }
  #screen #battle.pvp-battle .pbh-mon-title strong { font-size:17px; }
  #screen #battle.pvp-battle .pbh-owner small { display:none; }
  #screen #battle.pvp-battle .pbh-mon .pbh-portrait canvas.battle-pokemon { width:130px!important; height:130px!important; }
  #screen #battle.pvp-battle .pbh-command-title { display:block; margin-bottom:8px; }
  #screen #battle.pvp-battle .pbh-command-title h3 { font-size:14px; }
  #screen #battle.pvp-battle .pbh-deck { grid-template-columns:1fr; gap:10px; }
  #screen #battle.pvp-battle .pbh-move-grid { gap:6px; }
  #screen #battle.pvp-battle button.pbh-move { min-height:78px; padding:8px 10px; gap:3px; }
  #screen #battle.pvp-battle .pbh-move strong { font-size:14px; }
  #screen #battle.pvp-battle .pbh-bench-list { grid-template-columns:repeat(3,minmax(0,1fr)); }
  #screen #battle.pvp-battle .pbh-bench>.pbh-eyebrow { margin-bottom:5px; }
  #screen #battle.pvp-battle button.pbh-reserve { padding:5px 6px; gap:5px; }
  #screen #battle.pvp-battle .pbh-reserve canvas { width:30px!important; height:30px!important; }
  #screen #battle.pvp-battle .pbh-reserve-info { display:flex; flex-direction:column; gap:0; align-items:stretch; }
  #screen #battle.pvp-battle .pbh-reserve-info strong { font-size:11px; }
  #screen #battle.pvp-battle .pbh-reserve-info small { font-size:9px; }
  #screen #battle.pvp-battle .pbh-history { grid-column:1/-1; grid-row:3; margin:0; }
  #screen #battle.pvp-battle .pbh-history summary { min-height:36px; padding:4px 0; }
  #screen #battle.pvp-battle .pbh-footer { grid-column:1/-1; margin:0; padding:0; border:0; }
  #screen #battle.pvp-battle .pbh-result { grid-column:2; grid-row:2; align-self:center; }
}
/* On phones the battle uses the available screen, then restores the world layout. */
@media (max-width:680px), (max-width:960px) and (max-height:540px) {
  body:has(#battle.pvp-battle:not([hidden])) { overflow:hidden; }
  html body main.game-shell #screen:has(#battle.pvp-battle:not([hidden])) {
    position:fixed!important; inset:0!important; z-index:45; width:100%!important; height:100dvh!important;
    min-width:0!important; min-height:0!important; max-width:none!important; max-height:none!important;
    margin:0!important; padding:0!important; border:0!important; border-radius:0!important; box-shadow:none!important; transform:none!important;
  }
  #screen #battle.pvp-battle { border:0!important; border-radius:0!important; }
  body:has(#battle.pvp-battle:not([hidden])) .game-frame-ornaments { visibility:hidden; }
  #screen #battle.pvp-battle .pbh-shell {
    padding-top:max(12px,env(safe-area-inset-top));
    padding-left:max(12px,env(safe-area-inset-left)); padding-right:max(12px,env(safe-area-inset-right));
    padding-bottom:max(48px,calc(env(safe-area-inset-bottom) + 36px));
  }
  #screen:has(#server-presence) #battle.pvp-battle .pbh-shell { padding-top:max(58px,calc(env(safe-area-inset-top) + 48px)); }
  #screen:has(#battle.pvp-battle:not([hidden])) #server-presence { top:max(6px,env(safe-area-inset-top)); }
}
body:has(#battle.pvp-battle:not([hidden])) #move-tooltip {
  background:#102820f5; border:1px solid #90b89066; border-radius:12px; box-shadow:0 12px 40px #0006;
  color:#eaf3e6; padding:14px; font:13px/1.5 system-ui,sans-serif; text-shadow:none; max-width:min(310px,calc(100vw - 20px));
}
@container (min-width:700px) and (max-height:450px) {
  #screen #battle.pvp-battle .pbh-shell { padding-top:8px; padding-bottom:8px; gap:6px 14px; }
  #screen:has(#server-presence) #battle.pvp-battle .pbh-shell { padding-top:max(52px,calc(env(safe-area-inset-top) + 48px)); }
  #screen #battle.pvp-battle .pbh-header { gap:10px; padding:0; }
  #screen #battle.pvp-battle .pbh-emblem,#screen #battle.pvp-battle .pbh-brand .pbh-eyebrow { display:none; }
  #screen #battle.pvp-battle .pbh-header h2 { font-size:18px; }
  #screen #battle.pvp-battle .pbh-clock { display:flex; align-items:center; gap:8px; }
  #screen #battle.pvp-battle .pbh-clock strong { font-size:20px; }
  #screen #battle.pvp-battle .pbh-field.verdant-field { min-height:200px; padding:8px 8px 25px; gap:9px; }
  #screen #battle.pvp-battle .pbh-mon-hud { padding:6px 8px; }
  #screen #battle.pvp-battle .pbh-mon-title { margin:1px 0 3px; }
  #screen #battle.pvp-battle .pbh-mon-title strong { font-size:14px; }
  #screen #battle.pvp-battle .pbh-owner { font-size:10px; }
  #screen #battle.pvp-battle .pbh-mon-meta { margin-bottom:5px; }
  #screen #battle.pvp-battle .pbh-mon-meta .pbh-type { padding:0 4px; font-size:9px; }
  #screen #battle.pvp-battle .pbh-portrait { min-height:84px; margin:0; }
  #screen #battle.pvp-battle .pbh-mon .pbh-portrait canvas.battle-pokemon { width:84px!important; height:84px!important; }
  #screen #battle.pvp-battle .pbh-teams { left:12px; right:12px; bottom:8px; font-size:8px; }
  #screen #battle.pvp-battle .pbh-command-title { margin-bottom:5px; }
  #screen #battle.pvp-battle .pbh-command-title h3 { font-size:13px; }
  #screen #battle.pvp-battle .pbh-command:not(.pbh-waiting):not([aria-busy=true]) .pbh-feedback { display:none; }
  #screen #battle.pvp-battle .pbh-deck { gap:7px; }
  #screen #battle.pvp-battle button.pbh-move { min-height:60px; padding:5px 8px; gap:0; }
  #screen #battle.pvp-battle .pbh-move strong { font-size:13px; }
  #screen #battle.pvp-battle .pbh-move .pbh-type { font-size:9px; padding:0 4px; }
  #screen #battle.pvp-battle .pbh-bench>.pbh-eyebrow { display:none; }
  #screen #battle.pvp-battle button.pbh-reserve { min-height:44px; padding:3px 4px; gap:4px; }
  #screen #battle.pvp-battle .pbh-reserve canvas { width:24px!important; height:24px!important; }
  #screen #battle.pvp-battle .pbh-reserve-info strong { font-size:10px; }
  #screen #battle.pvp-battle .pbh-reserve-info small { display:none; }
  #screen #battle.pvp-battle .pbh-history { grid-column:1; grid-row:3; }
  #screen #battle.pvp-battle .pbh-history summary { gap:6px; }
  #screen #battle.pvp-battle .pbh-history summary>.pbh-eyebrow { display:none; }
  #screen #battle.pvp-battle .pbh-latest { font-size:11px; }
  #screen #battle.pvp-battle .pbh-footer { grid-column:2; grid-row:3; font-size:10px; }
  #screen #battle.pvp-battle .pbh-footer>span { flex:1; }
  #screen #battle.pvp-battle .pbh-result { padding:4px; }
  #screen #battle.pvp-battle .pbh-result-mark { display:none; }
}
@media (prefers-reduced-motion:reduce) {
  #screen #battle.pvp-battle *,#screen #battle.pvp-battle *::before { animation:none!important; transition:none!important; }
}

#screen #battle.pvp-battle .pbh-move-description { display:block; font-size:12px; line-height:1.45; color:#c6dcd2; font-weight:400; white-space:normal; overflow-wrap:anywhere; margin-top:7px; text-align:left; }

/* Native Emerald viewport maintains its exact aspect ratio at every screen size. */
#screen #battle.pvp-battle .pbh-field.emerald-native-persistent{display:grid!important;grid-template-columns:1fr 1fr;gap:12px;padding:14px;}
#screen #battle.pvp-battle .pbh-field.emerald-native-persistent .pbh-portrait,#screen #battle.pvp-battle .pbh-field.emerald-native-persistent .pbh-versus{display:none;}
#screen #battle.pvp-battle .pbh-field.emerald-native-persistent .pbh-side{position:relative;min-height:0;}
#screen #battle.pvp-battle .pbh-field.emerald-native-persistent .pbh-mon{min-height:0;}
.emerald-native-stage{image-rendering:pixelated;pointer-events:none;object-fit:contain;}
#screen #battle.pvp-battle .pbh-field.emerald-native-persistent>.emerald-native-stage{position:relative;grid-column:1/-1;grid-row:2;width:100%;height:auto;max-height:360px;aspect-ratio:240/112;border-radius:10px;background:#c6edda;z-index:2;}
#screen #battle.pvp-battle .pbh-field.emerald-native-persistent .pbh-teams{position:relative;grid-column:1/-1;grid-row:3;bottom:auto;left:auto;transform:none;}
.emerald-native-playing{position:relative;}
.emerald-native-playing>.emerald-native-stage{position:absolute;inset:0;width:100%;height:100%;z-index:20;background:#c6edda;}
@media(max-width:600px){#screen #battle.pvp-battle .pbh-field.emerald-native-persistent{gap:6px;padding:6px;}#screen #battle.pvp-battle .pbh-field.emerald-native-persistent .pbh-mon-hud{padding:8px;}#screen #battle.pvp-battle .pbh-field.emerald-native-persistent .pbh-owner,#screen #battle.pvp-battle .pbh-field.emerald-native-persistent .pbh-mon-title{flex-wrap:wrap;}}
