/* v0.85 final match presentation. This versioned asset is loaded last so a
   deployed browser cannot reuse the obsolete pre-rebuild tabletop cache. */
@media (min-width:781px){
 body.duel-active #duel:not(.hidden){
  --match-rail:clamp(292px,27vw,382px);--hand-row:clamp(196px,27dvh,274px);
  grid-template-columns:minmax(0,1fr) var(--match-rail)!important;
  grid-template-rows:auto minmax(0,1fr) var(--hand-row)!important;
  column-gap:10px;row-gap:7px;
 }
 body.duel-active #duel>.toolbar{grid-column:1/-1;grid-row:1}
 body.duel-active #duel>.stage{grid-column:1;grid-row:2;min-height:0}
 body.duel-active #duel>.below,body.duel-active #duel>.below>.main-column{display:contents!important}
 body.duel-active #duel>.below>.main-column>.hand-panel{grid-column:1;grid-row:3}
 body.duel-active #duel>.below>.side-column{grid-column:2;grid-row:2}
 body.duel-active #duel>.below>.main-column>.turn-actions-panel{grid-column:2;grid-row:3}
 body.duel-active .stage .arena-layout,body.duel-active .stage .arena-field{height:100%;min-height:0}
 body.duel-active .stage .arena-field{display:grid;grid-template-rows:minmax(0,1fr) 8px minmax(0,1fr);gap:4px}
 body.duel-active .stage .territory{
  position:relative;isolation:isolate;overflow:hidden;border:4px solid #35414e;border-radius:15px;
  box-shadow:inset 0 0 0 1px #9ab46755,inset 0 0 32px #102b1980,0 3px 9px #0008;
 }
 body.duel-active .stage .territory::before{
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:linear-gradient(90deg,#13291635,transparent 22%,transparent 78%,#13291635),radial-gradient(ellipse at center,#89a95018,transparent 64%);
 }
 body.duel-active .stage .territory::after{
  content:"STADIUM";position:absolute;right:124px;top:50%;transform:translateY(-50%);
  display:grid;place-items:center;width:48px;height:68px;border:2px dashed #d9e8d247;border-radius:7px;
  background:#20352961;color:#e6efde9c;font-size:8px;font-weight:900;letter-spacing:.07em;pointer-events:none;
 }
 body.duel-active .stage .trainerbar,body.duel-active .stage .trainerbar.player{
  position:absolute;inset:0;z-index:20;margin:0;padding:0;min-height:0;border:0;background:transparent;box-shadow:none;pointer-events:none;
 }
 body.duel-active .stage .trainerbar .trainerlabel,body.duel-active .stage .trainerbar .pile-tools{position:absolute;left:8px;pointer-events:auto}
 body.duel-active .stage .opponent-territory .trainerlabel{bottom:7px}
 body.duel-active .stage .opponent-territory .pile-tools{top:7px}
 body.duel-active .stage .player-territory .trainerlabel{top:7px}
 body.duel-active .stage .player-territory .pile-tools{bottom:7px}
 body.duel-active .stage .trainerlabel{gap:7px;padding:4px 9px 4px 5px;border:1px solid #44515e;border-radius:9px;background:#202833f2;box-shadow:0 3px 8px #0007}
 body.duel-active .stage .trainerlabel>span{width:27px;height:27px;flex-basis:27px}
 body.duel-active .stage .trainerlabel small{max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 body.duel-active .stage .pile-tools{gap:6px}
 body.duel-active .stage .deck-counter,body.duel-active .stage .pile-button{height:43px;min-height:43px;padding:3px 7px;border-radius:7px;background:#202833f2;box-shadow:0 3px 8px #0007}
 body.duel-active .stage .deck-counter::before{width:25px;height:35px}
 body.duel-active .stage .territory .field-row,body.duel-active .stage .territory .field-row.bottom{
  display:grid!important;height:100%;min-height:0;gap:1px;padding:5px 86px 5px 112px;
 }
 body.duel-active .stage .opponent-territory .field-row{grid-template-rows:minmax(0,.34fr) minmax(0,.66fr)}
 body.duel-active .stage .player-territory .field-row.bottom{grid-template-rows:minmax(0,.66fr) minmax(0,.34fr)}
 body.duel-active .stage .territory .zone{min-height:0;justify-content:center}
 body.duel-active .stage .territory .zone h3{margin:0 0 2px;color:#f2f7e6c4;font-size:8px;letter-spacing:.12em}
 body.duel-active .stage .territory .bench-zone .pokemon-strip{
  display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr));align-items:center;justify-content:center;
  gap:clamp(5px,.8vw,11px);width:min(72%,620px);min-height:52px;padding:3px 5px;border-radius:8px;
  background:repeating-linear-gradient(90deg,#17261c52 0 calc(20% - 5px),transparent calc(20% - 5px) 20%);
 }
 body.duel-active .stage .territory .bench-zone .pokemon-strip>.empty{
  grid-column:1/-1;width:100%;height:100%;min-height:48px;border:0;background:transparent;color:#edf4e078;
  font-size:9px;text-transform:uppercase;letter-spacing:.11em;
 }
 body.duel-active .stage .territory .bench-zone .poke{width:100%;max-width:105px;justify-self:center;padding:2px;gap:2px;--attachment-height:clamp(48px,6.8dvh,75px)}
 body.duel-active .stage .territory .active-zone .pokemon-strip{padding:0;min-height:0}
 body.duel-active .stage .territory .active-zone .poke{width:clamp(112px,10.5vw,148px);padding:2px;gap:3px;--attachment-height:clamp(96px,12.8dvh,142px)}
 body.duel-active .stage .territory .poke .pokemon-face{border-radius:6px;box-shadow:0 5px 12px #07190da8;transition:transform .16s ease,box-shadow .16s ease}
 body.duel-active .stage .territory .poke:hover .pokemon-face,body.duel-active .stage .territory .poke:focus-visible .pokemon-face{transform:translateY(-3px);box-shadow:0 9px 18px #06140dc7,0 0 0 2px #dce9b980}
 body.duel-active .stage .territory .active-with-attacks{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(112px,148px) minmax(155px,1fr);gap:12px;width:100%;align-items:center}
 body.duel-active .stage .territory .active-with-attacks .active-slot{grid-column:2;justify-self:center}
 /* The dock is a direct grid child; the attack panel lives *inside* it.
    Position the wrapper to the right of the Active card, not the panel. */
 body.duel-active .stage .territory .active-with-attacks #fieldAttackDock{
  grid-column:3;grid-row:1;align-self:center;justify-self:start;
  width:min(100%,300px);min-width:0;max-width:100%;
 }
 body.duel-active .stage .territory .active-with-attacks .inline-attack-panel{grid-column:3;width:min(100%,300px);padding:6px 8px;background:#17251fe8;border:1px solid #78906f85;border-radius:8px;box-shadow:0 4px 12px #08180f80}
 body.duel-active .stage .battleline{height:8px;min-height:8px;background:#202832}
 body.duel-active .stage .battleline #turnChip{animation:referenceTurnPulse 2.2s ease-in-out infinite}
 body.duel-active .stage .prize-group{right:8px;width:96px;padding:5px;display:block!important;background:#202833ed}
 body.duel-active .stage .prize-group:first-child{top:calc(25% - 57px)}
 body.duel-active .stage .prize-group:last-child{bottom:calc(25% - 57px)}
 body.duel-active .stage .prize-group h3{font-size:8px;margin:0 0 3px!important;text-align:center}
 body.duel-active .stage .prize-group .prize-count{font-size:10px;text-align:center;margin-bottom:3px}
 body.duel-active .stage .prize-group .prize-grid{display:grid!important;grid-template-columns:repeat(2,30px)!important;justify-content:center;gap:3px!important;width:100%!important;height:auto!important}
 body.duel-active .stage .prize-group .prize-back{display:block!important;width:30px!important;height:42px!important;min-height:42px!important}
 body.duel-active .stage .prize-group .prize-taken{visibility:hidden}
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan-card{
  aspect-ratio:245/342!important;height:100%!important;width:auto!important;
  max-width:none!important;flex:0 0 auto!important;overflow:hidden;
  transition:transform .15s ease,box-shadow .15s ease,filter .15s ease;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan-card img{
  display:block;width:100%!important;height:100%!important;
  max-width:100%;max-height:100%;object-fit:contain!important;object-position:center;
 }
 body.duel-active .hand-fan-card:is(:hover,:focus-visible),body.duel-active .hand-fan-card.selected{z-index:12!important}
 body.duel-active .stage .poke.legal .pokemon-face{animation:referenceLegalTarget 1.05s ease-in-out infinite}
 body.duel-active .stage .poke{animation:referenceCardArrive .2s ease-out both}
}
@media (max-width:780px){
 body.duel-active .stage .territory::after{display:none}
 body.duel-active .stage .territory .bench-zone .pokemon-strip{background:repeating-linear-gradient(90deg,#17261c45 0 calc(20% - 3px),transparent calc(20% - 3px) 20%);border-radius:6px}
 body.duel-active .stage .territory .bench-zone .pokemon-strip>.empty{grid-column:1/-1;width:100%;min-height:30px;border:0;background:transparent;color:#eff6e071;font-size:8px;text-transform:uppercase}
 body.duel-active .stage .prize-group .prize-back{display:block!important}
 body.duel-active .stage .poke.legal .pokemon-face{animation:referenceLegalTarget 1.05s ease-in-out infinite}
 body.duel-active .below .hand-panel .hand-fan-card{
  aspect-ratio:245/342!important;height:100%!important;width:auto!important;
  flex:0 0 auto!important;max-width:none!important;
 }
 body.duel-active .below .hand-panel .hand-fan-card img{object-fit:contain!important}
}
@keyframes referenceCardArrive{from{opacity:.25;transform:translateY(7px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes referenceLegalTarget{0%,100%{box-shadow:0 5px 12px #07190da8,0 0 0 2px #63eeb999}50%{box-shadow:0 7px 18px #07190dc7,0 0 0 4px #75ffd0c4}}
@keyframes referenceTurnPulse{0%,100%{filter:brightness(1);transform:translateX(-50%) scale(1)}50%{filter:brightness(1.12);transform:translateX(-50%) scale(1.025)}}
@media (prefers-reduced-motion:reduce){body.duel-active .stage .poke,body.duel-active .stage .poke.legal .pokemon-face,body.duel-active .stage .battleline #turnChip{animation:none!important}}

/* v0.82 — reference composition pass.
   Treat the duel as a game table, not as a dashboard: a fixed-proportion board,
   a quiet utility rail, and a frameless hand sharing one visual baseline. */
@media (min-width:781px){
 body.duel-active{overflow:hidden;background:#181d25!important}
 body.duel-active .masthead,body.duel-active>footer{display:none!important}
 body.duel-active main{
  width:100%;height:100dvh;max-width:none!important;margin:0!important;
  padding:8px 14px!important;overflow:hidden;background:#181d25!important;
 }
 body.duel-active #duel:not(.hidden){
  --match-rail:clamp(320px,22vw,368px);--hand-row:clamp(142px,18dvh,166px);
  width:min(100%,1450px);height:calc(100dvh - 16px);margin-inline:auto;
  display:grid!important;grid-template-columns:minmax(680px,1040px) var(--match-rail)!important;
  grid-template-rows:34px minmax(0,1fr) var(--hand-row)!important;
  justify-content:center;column-gap:14px;row-gap:7px;
 }
 body.duel-active #duel>.toolbar{
  grid-column:1/-1;grid-row:1;min-height:34px!important;height:34px;margin:0!important;
  padding:2px 8px!important;border:0!important;border-bottom:1px solid #3a414b!important;
  border-radius:0!important;background:transparent!important;box-shadow:none!important;
 }
 body.duel-active #duel>.toolbar .turn-summary{font-size:11px!important}
 body.duel-active #duel>.toolbar .tag,body.duel-active #duel>.toolbar #scoreline{
  padding:4px 7px!important;background:#222933!important;border-color:#3c4653!important;
 }
 body.duel-active #duel>.toolbar #reset{min-height:26px!important;padding:3px 10px!important}
 body.duel-active #duel>.stage{grid-column:1;grid-row:2;overflow:visible!important;position:relative}
 body.duel-active .stage>.turn-coach{
  position:absolute;z-index:80;top:8px;left:50%;transform:translateX(-50%);
  width:max-content;max-width:58%;min-height:0!important;padding:5px 10px!important;
  border:1px solid #61716499!important;border-radius:7px!important;
  background:#202a27e8!important;box-shadow:0 4px 14px #0007!important;
 }
 body.duel-active .stage>.turn-coach .coach-message{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 body.duel-active .stage>.turn-coach .coach-message strong{font-size:9px!important;letter-spacing:.12em}
 body.duel-active .stage>.turn-coach .coach-message span{font-size:9px!important}
 body.duel-active .stage>.turn-coach .coach-chips{display:none!important}
 body.duel-active .stage>.opponent-activity-status{
  position:absolute;z-index:79;top:8px;left:50%;transform:translateX(-50%);
  width:max-content;max-width:55%;min-height:26px!important;margin:0!important;
 }
 body.duel-active .stage .arena-layout{height:100%!important;flex:1 1 auto!important}
 body.duel-active .stage .arena-field{grid-template-rows:minmax(0,1fr) 8px minmax(0,1fr)!important;gap:6px!important}
 body.duel-active .stage .territory{
  border-width:3px!important;border-color:#46515a!important;border-radius:12px!important;
  background-color:#477f2e!important;
  background-image:linear-gradient(90deg,#18351d33,transparent 20%,transparent 80%,#18351d33),radial-gradient(ellipse at 50% 50%,#a7ba681d,transparent 68%),url('neo_duel_grass.svg')!important;
  background-size:100% 100%,100% 100%,180px 180px!important;
  box-shadow:inset 0 0 0 1px #9eb56a66,inset 0 0 34px #17341d70,0 4px 14px #0009!important;
 }
 body.duel-active .stage .territory .field-row,body.duel-active .stage .territory .field-row.bottom{
  padding:7px 104px 7px 86px!important;
 }
 body.duel-active .stage .territory .zone h3{font-size:8px!important;margin-bottom:3px!important;color:#eef4e0c7!important}
 body.duel-active .stage .territory .bench-zone .pokemon-strip{
  width:min(72%,560px)!important;min-height:58px!important;gap:10px!important;
  padding:4px 6px!important;border-radius:7px!important;
 }
 body.duel-active .stage .territory .bench-zone .pokemon-strip>.empty{min-height:55px!important}
 body.duel-active .stage .territory .active-zone .poke{width:clamp(104px,8vw,128px)!important;--attachment-height:clamp(91px,11.5dvh,125px)!important}
 body.duel-active .stage .territory .bench-zone .poke{max-width:90px!important;--attachment-height:clamp(48px,6.2dvh,67px)!important}
 body.duel-active .stage .territory .active-with-attacks{
  grid-template-columns:minmax(0,1fr) minmax(104px,128px) minmax(0,1fr)!important;gap:12px!important;
 }
 body.duel-active .stage .territory .active-with-attacks .inline-attack-panel{
  width:min(100%,270px)!important;padding:5px 7px!important;opacity:.96;
 }
 body.duel-active .stage .territory .active-with-attacks .inline-attack-panel:not(:has(button:not(:disabled))){display:none!important}
 body.duel-active .stage .territory .active-with-attacks:has(.inline-attack-panel:not(:has(button:not(:disabled)))) .active-slot{grid-column:2!important}
 body.duel-active .stage .trainerlabel{padding:4px 8px 4px 5px!important}
 body.duel-active .stage .trainerlabel>span{width:28px!important;height:28px!important;flex-basis:28px!important}
 body.duel-active .stage .pile-tools{left:8px!important}
 body.duel-active .stage .deck-counter,body.duel-active .stage .pile-button{height:42px!important;min-height:42px!important}
 body.duel-active .stage .prize-group{right:10px!important;width:82px!important;padding:5px!important;background:transparent!important;border:0!important;box-shadow:none!important}
 body.duel-active .stage .prize-group:first-child{top:calc(25% - 61px)!important}
 body.duel-active .stage .prize-group:last-child{bottom:calc(25% - 61px)!important}
 body.duel-active .stage .prize-group h3{color:#fff!important;text-shadow:0 1px 3px #000!important}
 body.duel-active .stage .prize-group .prize-count{display:none!important}
 body.duel-active .stage .prize-group .prize-grid{grid-template-columns:repeat(2,29px)!important;gap:3px!important}
 body.duel-active .stage .prize-group .prize-back{width:29px!important;height:41px!important;min-height:41px!important}
 body.duel-active .stage .territory::after{right:112px!important;width:50px!important;height:70px!important}
 body.duel-active #duel>.below>.main-column>.hand-panel{
  padding:8px 6px 0!important;border:0!important;border-radius:0!important;
  background:transparent!important;box-shadow:none!important;overflow:visible!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-toggle{
  inset:0 auto auto 6px!important;height:25px!important;background:#252d37!important;border-color:#4a5665!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan:not(.hidden){
  position:absolute!important;inset:31px 0 0!important;height:auto!important;overflow-x:auto!important;overflow-y:visible!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan-track{
  justify-content:center!important;align-items:flex-end!important;gap:8px!important;padding:0 12px!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan-card{
  height:100%!important;max-height:135px!important;width:auto!important;aspect-ratio:245/342!important;
  border:1px solid #e1c853!important;border-radius:5px!important;box-shadow:0 4px 10px #000a!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan-card img{object-fit:contain!important;background:#10151c!important}
 body.duel-active #duel>.below>.side-column{border:1px solid #3b444f;border-radius:11px;background:#222832!important;padding:0!important}
 body.duel-active #choiceDock>#decisionBox{border:0!important;border-bottom:1px solid #3b444f!important;border-radius:0!important;background:transparent!important;box-shadow:none!important}
 body.duel-active #choiceDock>#logDrawer{border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important}
 body.duel-active #duel>.below>.main-column>.turn-actions-panel{
  border:1px solid #3b444f!important;border-radius:11px!important;background:#222832!important;
 }
 body.duel-active #duel>.below .turn-actions-panel .turn-actions{gap:7px!important}
 body.duel-active #duel>.below .turn-actions-panel .turn-actions button{border-radius:7px!important;font-size:12px!important}
}

@media (min-width:781px) and (max-height:760px){
 body.duel-active #duel:not(.hidden){--hand-row:126px;grid-template-rows:32px minmax(0,1fr) var(--hand-row)!important}
 body.duel-active #duel>.toolbar{height:32px;min-height:32px!important}
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan-card{max-height:104px!important}
 body.duel-active .stage .territory .active-zone .poke{--attachment-height:74px!important}
 body.duel-active .stage .territory .bench-zone .poke{--attachment-height:42px!important}
}

/* v0.83 — one desktop action rail. The same live attack buttons are reparented
   at the desktop breakpoint; mobile keeps them alongside the Active Pokémon. */
@media (min-width:781px){
 body.duel-active.attacks-in-rail .stage .field-attack-dock{display:none!important}
 body.duel-active.attacks-in-rail .stage .active-with-attacks{
  display:grid!important;grid-template-columns:minmax(0,1fr) minmax(104px,128px) minmax(0,1fr)!important;
 }
 body.duel-active.attacks-in-rail .stage .active-with-attacks .active-slot{grid-column:2!important}
 body.duel-active .desktop-attack-dock{display:block;min-height:0;overflow:auto;scrollbar-width:thin}
 body.duel-active .desktop-attack-dock:empty{display:none}
 body.duel-active .desktop-attack-dock .inline-attack-panel{
  display:block!important;width:100%!important;min-width:0!important;max-width:none!important;
  margin:0!important;padding:0 0 6px!important;border:0!important;border-bottom:1px solid #3d4854!important;
  border-radius:0!important;background:transparent!important;box-shadow:none!important;
 }
 body.duel-active .desktop-attack-dock .inline-attack-panel:not(:has(button:not(:disabled))){display:none!important}
 body.duel-active .desktop-attack-dock .inline-attack-panel h4{
  margin:0 0 5px!important;color:#aeb9c7!important;font-size:9px!important;letter-spacing:.14em!important;
 }
 body.duel-active .desktop-attack-dock .inline-attacks{display:grid!important;gap:4px!important}
 body.duel-active .desktop-attack-dock button.attack-action{
  min-height:33px!important;padding:4px 7px!important;border-radius:6px!important;
  grid-template-columns:minmax(0,1fr) auto auto!important;gap:5px!important;
  background:#294b39!important;border-color:#557b62!important;
 }
 body.duel-active .desktop-attack-dock button.attack-action:not(:disabled):hover{background:#35694b!important;border-color:#70b886!important}
 body.duel-active .desktop-attack-dock .attack-name{font-size:10px!important}
 body.duel-active .desktop-attack-dock .attack-damage{font-size:11px!important}
 body.duel-active .desktop-attack-dock .energy-pip{width:15px!important;height:15px!important;font-size:8px!important}
 body.duel-active .desktop-attack-dock .attack-effect,
 body.duel-active .desktop-attack-dock .attack-warning{display:none!important}
 body.duel-active #duel>.below>.main-column>.turn-actions-panel{
  display:flex!important;flex-direction:column!important;gap:6px!important;padding:8px!important;overflow:hidden!important;
 }
 body.duel-active #duel>.below .turn-actions-panel .turn-actions{
  display:grid!important;flex:1 1 auto;min-height:0;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  grid-template-rows:repeat(2,minmax(30px,1fr))!important;gap:5px!important;
 }
 body.duel-active #duel>.below .turn-actions-panel .turn-actions button{
  min-height:30px!important;padding:3px 5px!important;font-size:10px!important;
 }
 body.duel-active #duel>.below .turn-actions-panel #powersToggle{grid-column:1;grid-row:1}
 body.duel-active #duel>.below .turn-actions-panel #undoBtn{grid-column:2;grid-row:1}
 body.duel-active #duel>.below .turn-actions-panel #retreatBtn{grid-column:3;grid-row:1}
 body.duel-active #duel>.below .turn-actions-panel #endBtn{grid-column:1 / 3!important;grid-row:2}
 body.duel-active #duel>.below .turn-actions-panel #concedeBtn{grid-column:3!important;grid-row:2}
}

/* v0.84 — screenshot corrections: panels stay in their cells, Bench cards are
   artwork-first, and the hand control no longer consumes a card-height row. */
@media (min-width:781px){
 /* Match guidance already lives in the decision rail. Duplicate banners over
    the playmat hide cards and make the board feel cramped. */
 body.duel-active .stage>.turn-coach,
 body.duel-active .stage>.opponent-activity-status{display:none!important}
 body.duel-active #duel>.below>.side-column{
  position:relative!important;min-height:0!important;overflow:hidden!important;
 }
 body.duel-active #duel>.below>.side-column>#choiceDock{
  position:static!important;display:flex!important;flex:1 1 auto!important;
  width:100%!important;min-height:0!important;overflow:hidden!important;
 }
 body.duel-active #choiceDock>#logDrawer,
 body.duel-active #choiceDock>#logDrawer:not(.hidden){
  position:static!important;inset:auto!important;z-index:auto!important;
  width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;
  margin:0!important;transform:none!important;box-shadow:none!important;overflow:hidden!important;
 }
 body.duel-active #choiceDock>#logDrawer .log-scroll{
  min-height:0!important;max-height:none!important;overflow:auto!important;
 }
 body.duel-active .stage .player-territory .trainerlabel{display:none!important}
 body.duel-active .stage .opponent-territory .trainerlabel small{display:none!important}
 body.duel-active .stage .opponent-territory .trainerlabel{
  padding:4px 8px 4px 5px!important;max-width:190px!important;
 }
 body.duel-active .stage .territory .bench-zone .poke{
  width:clamp(64px,5.7vw,78px)!important;max-width:78px!important;
  min-height:0!important;padding:0!important;gap:0!important;overflow:visible!important;
  --attachment-height:clamp(68px,8.5dvh,92px)!important;
 }
 body.duel-active .stage .territory .bench-zone .poke .pokemon-face{
  width:100%!important;height:var(--attachment-height)!important;margin:0!important;
  aspect-ratio:245/342!important;border-radius:5px!important;
 }
 body.duel-active .stage .territory .bench-zone .poke .pokemon-face img{object-fit:contain!important}
 body.duel-active .stage .territory .bench-zone .poke>strong,
 body.duel-active .stage .territory .bench-zone .poke>.stats,
 body.duel-active .stage .territory .bench-zone .poke>.vitals,
 body.duel-active .stage .territory .bench-zone .poke>.hp-track,
 body.duel-active .stage .territory .bench-zone .poke>.hp-count{display:none!important}
 body.duel-active .stage .territory .bench-zone .pokemon-strip{
  align-items:center!important;min-height:96px!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel{
  padding:0!important;min-height:0!important;overflow:visible!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-toggle{
  inset:6px auto auto 5px!important;width:32px!important;height:32px!important;min-width:32px!important;
  min-height:32px!important;padding:0!important;border-radius:50%!important;
  display:grid!important;place-items:center!important;background:#252d37e8!important;
  box-shadow:0 3px 9px #0008!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-toggle #handVisibilityText,
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-toggle .hand-toggle-label,
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-toggle .hand-peek{display:none!important}
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-toggle #handVisibilityIcon{
  display:block!important;font-size:14px!important;line-height:1!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan:not(.hidden){
  inset:0!important;height:100%!important;padding:0!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan-track{
  height:100%!important;padding:0 42px 0!important;
 }
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan-card{max-height:154px!important}
}

@media (min-width:781px) and (max-height:760px){
 body.duel-active #duel>.below>.main-column>.hand-panel .hand-fan-card{max-height:118px!important}
 body.duel-active .stage .territory .bench-zone .poke{--attachment-height:58px!important}
 body.duel-active .stage .territory .bench-zone .pokemon-strip{min-height:64px!important}
}

/* v0.87 — Restore battlefield-first composition.
   The old desktop grid reserved the whole right side for a forced-open log.
   Utility history is a bounded opt-in drawer; setup/target guidance remains
   accessible without reserving a column through the whole match. */
body.duel-active #choiceDock>#logDrawer.hidden{
 display:none!important;
}
body.duel-active #choiceDock>#logDrawer:not(.hidden){
 display:flex!important;flex-direction:column!important;
 position:fixed!important;inset:auto 12px 12px auto!important;
 z-index:850!important;
 width:min(350px,calc(100vw - 24px))!important;
 height:min(330px,55dvh)!important;min-height:0!important;max-height:min(330px,55dvh)!important;
 margin:0!important;padding:0!important;
 overflow:hidden!important;transform:none!important;
 border:1px solid #536475!important;border-radius:12px!important;
 background:#1e2733f8!important;box-shadow:0 16px 50px #000b!important;
}
body.duel-active #choiceDock>#logDrawer .log-scroll{
 flex:1 1 auto;min-height:0!important;max-height:none!important;
 overflow-y:auto!important;overscroll-behavior:contain;
}
body.duel-active #choiceDock>#logDrawer header{
 flex:0 0 auto;display:flex!important;align-items:center;
 gap:10px;justify-content:space-between;
 background:#273241!important;color:#e9f0f7!important;
}
body.duel-active #choiceDock>#logDrawer #closeLog{
 display:inline-flex!important;align-items:center;justify-content:center;
 min-width:38px;min-height:34px;cursor:pointer;
}
body.duel-active #logToggle{
 display:inline-flex!important;align-items:center;justify-content:center;
 cursor:pointer;
}
body.duel-active .duel-utility-toolbar{justify-content:flex-end;gap:8px}
body.duel-active .duel-utility-toolbar>.turn-summary{margin-right:auto}
body.duel-active .duel-utility-toolbar #stadiumText:empty{display:none!important}

@media (min-width:781px){
 body.duel-active #duel:not(.hidden){
  --hand-row:clamp(162px,22dvh,228px);
  width:min(100%,1500px)!important;
  grid-template-columns:minmax(0,1fr) clamp(258px,23vw,342px)!important;
  grid-template-rows:34px minmax(0,1fr) var(--hand-row)!important;
 }
 body.duel-active #duel:not(.hidden):not(:has(> .toolbar)){
  grid-template-rows:minmax(0,1fr) var(--hand-row)!important;
 }
 body.duel-active #duel>.toolbar{
  grid-column:1/-1!important;grid-row:1!important;
 }
 body.duel-active #duel>.stage{
  grid-column:1/-1!important;grid-row:2!important;
  min-width:0!important;max-width:100%!important;
 }
 body.duel-active #duel:not(:has(> .toolbar))>.stage{grid-row:1!important}
 body.duel-active #duel>.below>.main-column>.hand-panel{
  grid-column:1!important;grid-row:3!important;
 }
 body.duel-active #duel:not(:has(> .toolbar))>.below>.main-column>.hand-panel{
  grid-row:2!important;
 }
 body.duel-active #duel>.below>.main-column>.turn-actions-panel{
  grid-column:2!important;grid-row:3!important;
 }
 body.duel-active #duel:not(:has(> .toolbar))>.below>.main-column>.turn-actions-panel{
  grid-row:2!important;
 }
 /* Remove the phantom right rail. Contents are fixed only while requested. */
 body.duel-active #duel>.below>.side-column,
 body.duel-active #duel>.below>.side-column>#choiceDock,
 body.duel-active #duel>.below>.side-column>#choiceDock>#chatDuelDock{
  display:contents!important;
  border:0!important;box-shadow:none!important;background:none!important;
 }
 body.duel-active #choiceDock>#decisionBox.hidden{display:none!important}
 body.duel-active #choiceDock>#decisionBox:not(.hidden){
  position:fixed!important;inset:52px 14px auto auto!important;
  z-index:510!important;
  width:min(315px,calc(100vw - 28px))!important;
  height:auto!important;max-height:min(48dvh,370px)!important;
  margin:0!important;padding:12px!important;overflow:auto!important;
  background:#202b37f5!important;border:1px solid #586779!important;
  border-radius:11px!important;box-shadow:0 10px 30px #000a!important;
 }
 body.duel-active #choiceDock>#logDrawer:not(.hidden){
  bottom:calc(var(--hand-row) + 20px)!important;
 }
 /* Preserve the player's room to inspect hand cards while the log is open. */
 body.duel-active #duel>.below>.main-column>.turn-actions-panel{
  justify-content:space-between!important;
 }
}
@media (max-width:780px){
 body.duel-active #choiceDock>#logDrawer:not(.hidden){
  bottom:calc(clamp(186px,28dvh,244px) + 9px)!important;
  max-height:min(300px,calc(100dvh - 245px))!important;
  height:min(300px,calc(100dvh - 245px))!important;
 }
 body.duel-active #logToggle{min-height:34px}
}
@media (max-height:660px) and (max-width:780px){
 body.duel-active #choiceDock>#logDrawer:not(.hidden){
  bottom:168px!important;
  height:min(220px,calc(100dvh - 185px))!important;
  max-height:min(220px,calc(100dvh - 185px))!important;
 }
}


/* Card-effect decisions were correctly moved into #choiceModal by JS, but
   online_compact.css still applies position:fixed;top/right to #decisionBox.
   Restore normal flow inside the centered dialog in every battle mode. */
body.duel-active #choiceModal:not(.hidden){
 display:grid!important;
 place-items:center!important;
}
body.duel-active #choiceModal .choice-dialog{
 width:min(540px,100%);
 max-width:100%;
 max-height:min(86dvh,760px);
 overflow-y:auto;
}
body.duel-active #choiceModal #decisionBox:not(.hidden){
 position:static!important;
 inset:auto!important;
 top:auto!important;
 right:auto!important;
 bottom:auto!important;
 left:auto!important;
 transform:none!important;
 width:100%!important;
 max-width:none!important;
 max-height:none!important;
 margin:0!important;
 z-index:auto!important;
 overflow:visible!important;
 padding:clamp(14px,3vw,24px)!important;
 border:2px solid #76e7ca!important;
 border-radius:17px!important;
 background:linear-gradient(145deg,#173648,#0f2439)!important;
 box-shadow:0 24px 85px #000e!important;
}
body.duel-active #choiceModal #decisionTitle{font-size:clamp(17px,3vw,22px)!important}
body.duel-active #choiceModal #decisionText{font-size:14px!important;line-height:1.45}

/* The active Stadium is an inspectable card on the original player's Stadium
   position. Only its owner's printed STADIUM label is hidden. */
body.duel-active .stage .territory:has(> .stadium-slot.occupied)::after{display:none!important}
body.duel-active .stage .territory>.stadium-slot{
 position:absolute;z-index:25;top:50%;right:112px;transform:translateY(-50%);
 width:50px;aspect-ratio:245/342;pointer-events:auto;
}
body.duel-active .stage .territory>.stadium-slot[hidden]{display:none!important}
body.duel-active .stage .territory>.stadium-slot>.stadium-card{
 display:block;width:100%;height:100%;padding:0;overflow:hidden;
 border:1px solid #e6d8b4;border-radius:5px;background:#1b2c3c;
 box-shadow:0 3px 10px #000a;cursor:zoom-in;
}
body.duel-active .stage .territory>.stadium-slot>.stadium-card img{
 display:block;width:100%;height:100%;object-fit:contain;
}
body.duel-active .stage .territory>.stadium-slot>.stadium-card:focus-visible{
 outline:3px solid #7affe2;outline-offset:2px;
}
body.duel-active .stage .territory>.stadium-slot>.stadium-card>.stadium-card-fallback{
 display:grid;place-items:center;width:100%;height:100%;padding:2px;
 color:#ffebba;font-size:8px;line-height:1.15;text-align:center;overflow-wrap:anywhere;
}
@media(max-width:780px){
 /* Keep the Stadium to the left of centered Pokémon, away from right Prizes. */
 body.duel-active .stage .territory>.stadium-slot{
  left:clamp(8px,2.5vw,12px);right:auto;top:50%;width:clamp(35px,10vw,46px);
 }
}
