/* v0.39 — online-only floating hand. Field and BOTH Benches get priority. */
body.duel-active #duel:not(.hidden){grid-template-rows:auto auto minmax(0,1fr) 54px}
body.duel-active .below{position:relative;z-index:540;overflow:visible}
body.duel-active .below .main-column{display:flex;flex-direction:row;align-items:stretch;gap:7px;height:54px}
body.duel-active .below .main-column>.panel{display:flex;align-items:center;min-width:0;overflow:visible;padding:0 7px;background:#10283ceF;border:1px solid #4c7892;box-shadow:0 -5px 18px #0006}
body.duel-active .below .hand-panel{flex:0 1 39%;max-width:480px;position:relative;border-color:#51b5b1!important}
body.duel-active .below .turn-actions-panel{flex:1;min-width:0;position:relative;justify-content:flex-end}
body.duel-active .hand-toggle{display:flex;align-items:center;gap:9px;width:100%;height:44px;text-align:left;min-height:0!important;padding:3px 12px;border-color:transparent;background:transparent;overflow:visible;position:relative}
body.duel-active .hand-toggle:hover{background:#265366}
body.duel-active .hand-toggle-label{font-size:clamp(11px,1.4vw,15px);font-weight:900;white-space:nowrap}
body.duel-active .hand-chevron{margin-left:auto;font-size:20px;color:#9af4cf;transition:transform .15s}
body.duel-active .tray-open .hand-chevron{transform:rotate(180deg)}
body.duel-active .hand-peek{position:relative;display:block;flex:0 0 94px;height:33px;pointer-events:none}
body.duel-active .peek-card{position:absolute;bottom:-6px;left:26px;width:34px;height:48px;border-radius:4px;border:1px solid #a8dbe0;overflow:hidden;background:#285579;box-shadow:0 2px 12px #000d;transform-origin:bottom center;display:grid;place-items:center;font-size:14px}
body.duel-active .peek-card img{width:100%;height:100%;object-fit:cover}
body.duel-active .peek-card-0{left:2px;transform:rotate(-16deg)}
body.duel-active .peek-card-1{left:28px;z-index:2;transform:translateY(-5px)}
body.duel-active .peek-card-2{left:54px;transform:rotate(16deg)}
body.duel-active .hand-peek-empty{font-size:10px;color:#adc8d5;white-space:nowrap}
body.duel-active .hand-tray-drawer,body.duel-active .power-drawer{position:fixed;bottom:62px;z-index:610;background:linear-gradient(160deg,#13344beF,#071928FA);border:2px solid #69c6bf;border-radius:17px;box-shadow:0 0 0 100vmax #0006,0 8px 45px #000d;padding:13px;display:flex;flex-direction:column;gap:9px}
body.duel-active .hand-tray-drawer{left:50%;transform:translateX(-50%);width:min(860px,calc(100vw - 18px));max-height:min(420px,70dvh)}
body.duel-active .tray-heading{display:flex;align-items:center;gap:11px;flex-wrap:wrap;color:#c6f8ef}
body.duel-active .tray-heading strong{font-size:12px;letter-spacing:.12em}
body.duel-active .tray-heading .hint{font-size:11px}
body.duel-active .tray-heading button{margin-left:auto;padding:2px 9px;min-height:28px}
body.duel-active .below .hand{display:flex;justify-content:flex-start;align-items:flex-start;gap:8px;width:100%;height:auto;min-height:155px;max-height:calc(min(420px,70dvh) - 80px);overflow-x:auto;overflow-y:auto;flex-wrap:nowrap;padding:8px 5px 12px;overscroll-behavior:contain}
body.duel-active .below .handcard{min-width:99px;width:99px;flex-shrink:0;padding:4px;min-height:144px}
body.duel-active .below .handcard img{height:112px}
body.duel-active .below .handcard strong{font-size:10px}
body.duel-active .below #cardActions{margin:0;flex:none}
body.duel-active .below .turn-actions{display:flex;align-items:center;justify-content:flex-end;gap:6px;max-width:100%;width:100%}
body.duel-active .below .turn-actions button{font-size:11px;white-space:nowrap;min-height:38px;padding:6px clamp(7px,1vw,13px)}
body.duel-active .below .turn-actions #endBtn{background:#1a8a78;border-color:#5ae8c2;font-weight:900}
body.duel-active .power-drawer{right:10px;width:min(410px,calc(100vw - 20px));max-height:min(350px,65dvh);overflow:auto}
body.duel-active .power-drawer #powers{display:flex;flex-wrap:wrap;max-height:none;overflow:visible}
body.duel-active .power-drawer .actions{margin-top:4px}
body.duel-active .power-drawer .actions button{font-size:12px;min-height:35px}
/* Give the original field the height previously allocated to the hand. */
body.duel-active .stage .territory .field-row{display:grid;grid-template-rows:minmax(0,1fr) minmax(0,1fr);gap:3px;align-items:center;padding:2px 8px;min-height:0}
body.duel-active .stage .territory .field-row .zone{min-height:0;max-height:100%;display:flex;flex-direction:column;justify-content:center}
body.duel-active .stage .territory .field-row .pokemon-strip{min-height:0;flex-shrink:1}
body.duel-active .stage .territory .field-row .zone h3{flex:none}
body.duel-active .stage .territory .field-row .poke{min-height:0;flex-shrink:1}
body.duel-active .stage .territory .field-row .empty{padding:9px;min-width:50px}
@media(max-width:780px){
 body.duel-active #duel:not(.hidden){grid-template-rows:auto auto minmax(0,1fr) 52px}
 body.duel-active .below .main-column{height:52px;gap:4px}
 body.duel-active .below .hand-panel{flex:0 0 41%}
 body.duel-active .below .main-column>.panel{padding:0 3px}
 body.duel-active .hand-toggle{padding:3px 4px;gap:3px}
 body.duel-active .hand-peek{flex-basis:68px;transform:scale(.75);transform-origin:left center}
 body.duel-active .hand-toggle-label{font-size:11px}
 body.duel-active .hand-chevron{font-size:15px}
 body.duel-active .below .turn-actions{gap:3px}
 body.duel-active .below .turn-actions button{min-height:35px;font-size:10px;padding:5px 6px}
 body.duel-active .stage .territory .field-row{padding:1px 4px}
 body.duel-active .stage .territory .field-row .zone h3{font-size:8px;margin-bottom:1px}
 body.duel-active .stage .territory .field-row .poke .pokemon-face{height:clamp(36px,7.3dvh,64px)}
 body.duel-active .stage .territory .field-row .poke:not(:has(.energy-peeks)) .pokemon-face{margin-top:8px}
 body.duel-active .hand-tray-drawer,body.duel-active .power-drawer{bottom:58px}
 body.duel-active .below .hand{min-height:140px}
 body.duel-active .below .handcard{min-width:86px;width:86px}
 body.duel-active .below .handcard img{height:100px}
}
@media(max-width:435px){
 body.duel-active .below .hand-panel{flex:0 0 37%}
 body.duel-active .hand-peek{flex-basis:55px;transform:scale(.62)}
 body.duel-active .below .turn-actions button{font-size:9px;padding:5px 4px}
 body.duel-active .below .turn-actions button#retreatBtn{font-size:0}
 body.duel-active .below .turn-actions button#retreatBtn::before{content:'⇆';font-size:17px}
 body.duel-active .stage .territory .field-row .poke .pokemon-face{height:clamp(35px,6.5dvh,56px)}
}
@media(prefers-reduced-motion:reduce){body.duel-active .hand-chevron{transition:none}}

/* The Prize selection is always accessible even if the tiny on-field card is covered. */
body.duel-active .prize-choice-panel{position:fixed;top:48px;left:50%;transform:translateX(-50%);z-index:850;max-width:calc(100vw - 20px);width:max-content;background:#183e4cf5;border:2px solid #9bfbd0;border-radius:12px;box-shadow:0 8px 36px #000c;display:flex;flex-direction:column;align-items:center;gap:5px;padding:10px 14px;color:#e9fff8;text-align:center;font-size:12px}
body.duel-active .prize-choices{display:flex;justify-content:center;gap:6px;flex-wrap:wrap}
body.duel-active .prize-option{min-width:40px;min-height:38px;padding:5px 7px;background:#21635d;border:2px solid #98f6d0;font-size:14px;font-weight:900}
body.duel-active .prize-awaiting{position:relative;z-index:5}
body.duel-active .prize-select{position:relative;z-index:10;pointer-events:auto!important;color:#fff!important;text-shadow:0 1px 3px #000,0 0 6px #000;font-weight:900;border:2px solid #9dfbd7!important;background:#1d5b66 url('neo_card_back.svg') center/100% 100% no-repeat!important}
body.duel-active .prize-back.prize-select:disabled{opacity:.55}
body.duel-active .hand-tray-drawer.hidden,body.duel-active .power-drawer.hidden{display:none!important}
@media(max-width:700px){body.duel-active .prize-choice-panel{top:53px;padding:6px 10px}body.duel-active .prize-choices{gap:4px}body.duel-active .prize-option{min-width:36px;min-height:32px;font-size:12px}}
/* v0.39: arrange each side as Bench + Active (or Active + Bench), not two
   competing columns. The Active Pokémon meet at the central battle line. */
body.duel-active .stage .territory .field-row,
body.duel-active .stage .territory .field-row.bottom{
 grid-template-columns:minmax(0,1fr);
 grid-template-rows:minmax(0,1fr) minmax(0,1.2fr);
}
body.duel-active .stage .territory .field-row .zone{width:100%;align-items:center}
body.duel-active .stage .territory .field-row .pokemon-strip{max-width:100%;justify-content:center}
body.duel-active .stage .territory .active-zone .active-with-attacks{width:100%}
body.duel-active .stage .territory .bench-zone .pokemon-strip{flex-wrap:nowrap}
@media(min-width:1000px) and (min-height:780px){
 body.duel-active .stage .poke{width:clamp(100px,9vw,125px);max-height:185px}
 body.duel-active .stage .poke .pokemon-face{height:clamp(80px,11dvh,104px)}
 body.duel-active .stage .active-with-attacks{grid-template-columns:minmax(0,1fr) 125px minmax(0,1fr)}
 body.duel-active .stage .active-with-attacks .active-slot{max-width:125px}
}
@media(max-width:435px){
 body.duel-active .stage .territory .bench-zone .pokemon-strip{gap:2px}
 body.duel-active .stage .territory .bench-zone .poke{width:min(55px,calc((100vw - 76px)/5 - 2px))}
}
/* A long explanatory coach must never push the battlefield below the fold. */
@media(max-width:780px){
 body.duel-active .stage .turn-coach{display:flex;flex-wrap:nowrap;gap:5px;max-height:44px;min-height:35px;overflow:hidden;padding:3px 7px}
 body.duel-active .stage .coach-message{display:block;flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 body.duel-active .stage .coach-message strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px}
 body.duel-active .stage .coach-message span{display:none}
 body.duel-active .stage .coach-chips{display:none}
 body.duel-active .stage .territory .field-row.bottom{grid-template-rows:minmax(0,1.8fr) minmax(0,1fr)}
 body.duel-active .stage .territory .active-with-attacks .inline-attack-panel{align-self:center}
}
@media(max-width:780px){
 /* Compact Bench cards without hiding their name and HP below the trainer bar. */
 body.duel-active .stage .bench-zone .poke{max-height:82px;min-height:0;overflow:hidden;gap:1px;padding:2px}
 body.duel-active .stage .bench-zone .poke .pokemon-face{height:39px}
 body.duel-active .stage .bench-zone .poke:not(:has(.energy-peeks)) .pokemon-face{margin-top:2px}
 body.duel-active .stage .bench-zone .poke .energy-peeks{height:10px}
 body.duel-active .stage .bench-zone .poke .attached-energy{height:10px}
 body.duel-active .stage .bench-zone .poke strong{font-size:8px;line-height:1.05}
 body.duel-active .stage .bench-zone .poke .hp-count{font-size:8px;line-height:1.1}
}


/* v0.40: compact, non-modal pinned hand and hover-only held-card fan. */
body.duel-active .hand-tray-drawer{
 max-height:min(340px,50dvh);
 box-shadow:0 10px 45px #000d;
}
body.duel-active .below .hand{max-height:calc(min(340px,50dvh) - 78px)}
body.duel-active .hand-panel .hand-fan{
 display:none;position:fixed;bottom:68px;left:clamp(8px,3vw,48px);
 width:min(620px,calc(100vw - 16px));height:225px;z-index:625;
 pointer-events:none;filter:drop-shadow(0 14px 14px #0009);
}
body.duel-active .hand-panel:not(.tray-open):hover .hand-fan:not(.hidden),
body.duel-active .hand-panel:not(.tray-open):focus-within .hand-fan:not(.hidden){display:block}
body.duel-active .hand-fan::before{
 content:'YOUR HAND · click to pin';position:absolute;left:12px;top:4px;
 font-size:11px;letter-spacing:.08em;font-weight:900;color:#c8fff0;
 background:#132e41eF;border:1px solid #5cc8b9;padding:5px 9px;border-radius:8px;
}
body.duel-active .hand-fan-card{
 position:absolute;bottom:10px;left:calc(50% - 47px);
 width:94px;height:132px;overflow:hidden;border-radius:7px;
 border:2px solid #b8e3da;background:#294e66;
 box-shadow:0 3px 15px #000a;
 transform-origin:50% 120%;
 transform:translateX(var(--fan-x)) translateY(var(--fan-y)) rotate(var(--fan-angle));
}
body.duel-active .hand-fan-card img{height:100%;width:100%;object-fit:cover;display:block}
body.duel-active .hand-fan-card span{display:grid;place-items:center;height:100%;padding:6px;text-align:center;font-size:12px;font-weight:800;overflow-wrap:anywhere}
body.duel-active #undoBtn{border-color:#80c6e1;background:#244b62;font-weight:800}
body.duel-active #undoBtn:disabled{opacity:.44;cursor:not-allowed}
@media(max-width:780px){
 body.duel-active .hand-panel .hand-fan{height:190px;bottom:60px;left:7px}
 body.duel-active .hand-fan-card{width:74px;height:105px;left:calc(50% - 37px)}
 body.duel-active .hand-fan::before{font-size:9px}
}
@media(max-width:435px){
 body.duel-active .below .turn-actions #undoBtn{font-size:0;padding:5px 5px}
 body.duel-active .below .turn-actions #undoBtn::before{content:'↶';font-size:19px}
}
@media(hover:none){body.duel-active .hand-panel .hand-fan{display:none!important}}
@media(prefers-reduced-motion:reduce){body.duel-active .hand-fan-card{transition:none}}


/* v0.41 — reserve a permanent, playable card fan below the battle field. */
body.duel-active #duel:not(.hidden){grid-template-rows:auto auto minmax(0,1fr) 170px}
body.duel-active .below .main-column{height:170px;gap:7px}
body.duel-active .below .hand-panel{flex:1 1 auto;max-width:none;min-width:165px;position:relative;isolation:isolate}
body.duel-active .below .turn-actions-panel{flex:0 0 min(390px,36%);min-width:0;align-items:center}
body.duel-active .below .turn-actions-panel .turn-actions{flex-wrap:wrap;justify-content:center;align-content:center;row-gap:8px}
body.duel-active .hand-toggle{
 position:absolute;top:3px;left:8px;z-index:24;width:auto;max-width:calc(100% - 16px);
 min-height:0!important;height:24px;padding:2px 8px;border:1px solid #558c97;
 background:#133b4a;gap:5px;border-radius:7px
}
body.duel-active .hand-toggle:hover{background:#205f6c}
body.duel-active .hand-toggle-label{font-size:11px}
body.duel-active .hand-toggle-label::after{content:' · List';color:#91b7c4;font-weight:600}
body.duel-active .hand-toggle .hand-peek,body.duel-active .hand-toggle .hand-chevron{display:none}
body.duel-active .hand-panel .hand-fan,
body.duel-active .hand-panel:not(.tray-open):hover .hand-fan:not(.hidden),
body.duel-active .hand-panel:not(.tray-open):focus-within .hand-fan:not(.hidden){
 display:block;position:absolute;left:2px;right:2px;top:26px;bottom:0;width:auto;height:auto;
 z-index:15;pointer-events:auto;overflow-x:auto;overflow-y:hidden;filter:none;
 scrollbar-width:thin;scrollbar-color:#76bac2 transparent;
}
body.duel-active .hand-panel .hand-fan.hidden{display:none!important}
body.duel-active .hand-fan::before{display:none}
body.duel-active .hand-fan-track{height:100%;min-height:0;position:relative}
body.duel-active .hand-fan-card{
 position:absolute;bottom:7px;left:calc(50% - 50px);width:100px;height:126px;
 box-sizing:border-box;min-height:0;padding:0;display:block;overflow:hidden;
 border:2px solid #80aeb9;border-radius:8px;background:#183d57;
 transform-origin:center 105%;
 transform:translateX(var(--fan-x)) translateY(var(--fan-y)) rotate(var(--fan-angle));
 transition:transform .13s ease,border-color .13s ease,box-shadow .13s ease;
 box-shadow:0 3px 13px #000b;cursor:pointer;pointer-events:auto;
}
body.duel-active .hand-fan-card img{width:100%;height:100%;display:block;object-fit:fill;pointer-events:none}
body.duel-active .hand-fan-card strong,
body.duel-active .hand-fan-card .handcard-type{display:none}
body.duel-active .hand-fan-card:not(:has(img)) strong{
 display:grid;place-items:center;height:100%;max-width:none;padding:5px;
 font-size:10px;white-space:normal;overflow-wrap:anywhere
}
body.duel-active .hand-fan-card:is(:hover,:focus-visible){
 z-index:200!important;border-color:#c3ffe0;
 transform:translateX(var(--fan-x)) translateY(-9px) rotate(0deg) scale(1.03);
 box-shadow:0 6px 22px #000e,0 0 13px #70e5c5;
}
body.duel-active .hand-fan-card.selected{border-color:#ffdf71;box-shadow:0 0 15px #ffd66c}
body.duel-active .hand-fan-card:focus-visible{outline:2px solid #ffdd65;outline-offset:2px}
body.duel-active .hand-tray-drawer{bottom:175px}
/* Energy is a left-side rail: recognizable types and colors, never a strip above the art. */
body.duel-active .stage .poke{position:relative;overflow:visible}
body.duel-active .stage .pokemon-strip{padding-left:12px}
body.duel-active .stage .poke .pokemon-face,
body.duel-active .stage .poke:not(:has(.energy-peeks)) .pokemon-face{margin-top:0!important}
body.duel-active .stage .poke:has(.energy-peeks){padding-top:3px}
body.duel-active .stage .energy-peeks{
 position:absolute;left:-11px;top:4px;display:flex;flex-direction:column;
 align-items:flex-start;gap:2px;height:auto;min-width:0;width:27px;z-index:6;pointer-events:none
}
body.duel-active .stage .attached-energy{
 position:relative;left:auto;top:auto;width:27px;height:25px;min-width:27px;
 padding:1px;box-sizing:border-box;display:flex;flex-direction:column;
 align-items:center;justify-content:center;gap:0;
 border-radius:7px;border:1px solid #edf2ee99;
 color:white;background:#405c6a;box-shadow:0 2px 5px #000d;
 transform:none;overflow:hidden;flex-shrink:0
}
body.duel-active .stage .energy-symbol{font-size:11px;font-weight:1000;line-height:12px;color:inherit;text-shadow:0 1px 1px #0008}
body.duel-active .stage .energy-label{font-size:7px;line-height:8px;font-weight:900;letter-spacing:0;color:inherit;text-shadow:0 1px 1px #0008}
body.duel-active .stage .energy-overflow{
 position:relative;top:auto;right:auto;background:#d8f4f0;color:#13444b;
 border-radius:5px;font-size:10px;padding:2px 4px;box-shadow:0 2px 4px #0009
}
body.duel-active .stage .energy-type-grass{background:linear-gradient(#489c42,#216d39)}
body.duel-active .stage .energy-type-fire{background:linear-gradient(#f8874c,#ac3d1d)}
body.duel-active .stage .energy-type-water{background:linear-gradient(#42a4e4,#14579c)}
body.duel-active .stage .energy-type-lightning{background:linear-gradient(#f7dd51,#b48e22);color:#372600}
body.duel-active .stage .energy-type-psychic{background:linear-gradient(#be74c9,#733a93)}
body.duel-active .stage .energy-type-fighting{background:linear-gradient(#cd9052,#84532b)}
body.duel-active .stage .energy-type-colorless{background:linear-gradient(#c9cbd4,#717b8b);color:#152e3d}
body.duel-active .stage .energy-type-darkness{background:linear-gradient(#59576a,#232636)}
body.duel-active .stage .energy-type-metal{background:linear-gradient(#acbcc2,#587480);color:#102d3d}
body.duel-active .stage .energy-type-rainbow{background:linear-gradient(125deg,#9c51be,#3c91d7,#5cba74,#edbd56,#d66b83)}
body.duel-active .stage .energy-type-recycle{background:linear-gradient(#8dcb8e,#397b76)}
body.duel-active .stage .energy-type-special{background:linear-gradient(#859ab0,#36586f)}
@media(max-width:780px){
 body.duel-active #duel:not(.hidden){grid-template-rows:auto auto minmax(0,1fr) 126px}
 body.duel-active .below .main-column{height:126px}
 body.duel-active .below .hand-panel{flex:1 1 auto;min-width:120px}
 body.duel-active .below .turn-actions-panel{flex:0 0 125px}
 body.duel-active .hand-toggle{top:2px;left:3px;height:22px;padding:1px 5px}
 body.duel-active .hand-toggle-label{font-size:10px}
 body.duel-active .hand-panel .hand-fan{top:24px}
 body.duel-active .hand-fan-card{width:72px;height:89px;left:calc(50% - 36px);bottom:4px}
 body.duel-active .hand-fan-card:is(:hover,:focus-visible){transform:translateX(var(--fan-x)) translateY(-5px) rotate(0deg) scale(1.02)}
 body.duel-active .hand-tray-drawer{bottom:132px}
 body.duel-active .stage .pokemon-strip{padding-left:7px}
 body.duel-active .stage .energy-peeks{left:-7px;top:2px;width:18px;gap:1px}
 body.duel-active .stage .attached-energy{width:18px;min-width:18px;height:19px;border-radius:4px;padding:0}
 body.duel-active .stage .energy-symbol{font-size:9px;line-height:10px}
 body.duel-active .stage .energy-label{font-size:6px;line-height:7px}
 body.duel-active .stage .energy-overflow{font-size:8px;padding:1px 2px}
}
@media(max-height:690px) and (min-width:781px){
 body.duel-active #duel:not(.hidden){grid-template-rows:auto auto minmax(0,1fr) 130px}
 body.duel-active .below .main-column{height:130px}
 body.duel-active .hand-fan-card{height:91px;width:74px;left:calc(50% - 37px)}
 body.duel-active .hand-tray-drawer{bottom:136px}
}
@media(hover:none){body.duel-active .hand-panel .hand-fan:not(.hidden){display:block!important}}
@media(prefers-reduced-motion:reduce){body.duel-active .hand-fan-card{transition:none}}


/* Compact unusually large Energy stacks while keeping their types visible. */
@media(min-width:781px){
 body.duel-active .stage .energy-peeks:has(.attached-energy:nth-child(5)) .attached-energy{height:19px}
 body.duel-active .stage .energy-peeks:has(.attached-energy:nth-child(5)) .energy-symbol{font-size:9px;line-height:9px}
 body.duel-active .stage .energy-peeks:has(.attached-energy:nth-child(5)) .energy-label{font-size:6px;line-height:7px}
}
@media(max-width:780px){
 body.duel-active .stage .energy-peeks:has(.attached-energy:nth-child(5)){
  display:grid;grid-template-columns:repeat(2,18px);gap:1px;width:38px;left:-11px
 }
 body.duel-active .stage .energy-peeks:has(.attached-energy:nth-child(5)) .energy-overflow{grid-column:span 2;justify-self:start}
}


/* v0.42: hand floats over EMPTY left field space; no bottom hand panel.
   The CPU stylesheet historically forced a 54px last row, clipping the 170px
   inline fan. The floating fan must not depend on the duel grid's last row. */
body.duel-active #duel:not(.hidden){
 grid-template-rows:auto auto minmax(0,1fr) 54px!important;
}
body.duel-active .below,
body.duel-active .below .main-column{
 height:54px;min-height:0;overflow:visible!important;background:transparent;
}
body.duel-active .below .main-column{
 display:flex;justify-content:flex-end;align-items:center;gap:0;
}
body.duel-active .below .hand-panel{
 display:block!important;position:static!important;flex:0 0 0!important;
 width:0!important;min-width:0!important;max-width:0!important;
 height:0!important;min-height:0!important;padding:0!important;
 border:0!important;border-radius:0!important;background:transparent!important;
 box-shadow:none!important;isolation:auto;overflow:visible!important;
 pointer-events:none;
}
body.duel-active .below .turn-actions-panel{
 flex:0 0 auto;width:min(520px,calc(100vw - 24px));height:50px;
 min-width:0;padding:4px 8px;pointer-events:auto;overflow:visible;
}
body.duel-active .below .turn-actions-panel .turn-actions{
 display:flex;align-items:center;justify-content:flex-end;
 flex-wrap:nowrap;gap:4px;min-height:0;
}
body.duel-active .below .turn-actions-panel .turn-actions button{
 flex:0 1 auto;min-width:0;white-space:nowrap;
}
body.duel-active .hand-toggle{
 position:fixed!important;top:auto!important;bottom:9px!important;
 left:13px!important;right:auto!important;width:auto!important;height:36px!important;
 min-height:36px!important;max-width:none!important;padding:4px 11px!important;
 display:flex;align-items:center;gap:7px;pointer-events:auto;
 color:#e1fff8;border:1px solid #6ad2b9;border-radius:10px;
 background:linear-gradient(140deg,#174d58,#0d3145);
 box-shadow:0 6px 19px #000a;z-index:690;
}
body.duel-active .hand-toggle:hover{background:#206777}
body.duel-active .hand-toggle .hand-peek{display:none}
body.duel-active .hand-toggle-label{font-size:12px}
body.duel-active .hand-toggle-label::after{content:none}
body.duel-active #handVisibilityIcon{font-size:17px;color:#b5ffe4}
body.duel-active .hand-panel .hand-fan,
body.duel-active .hand-panel:not(.tray-open):hover .hand-fan:not(.hidden),
body.duel-active .hand-panel:not(.tray-open):focus-within .hand-fan:not(.hidden){
 display:block;position:fixed!important;
 top:auto!important;left:12px!important;right:auto!important;
 bottom:57px!important;width:min(650px,calc(100vw - 24px))!important;
 max-width:calc(100vw - 24px);height:200px!important;
 z-index:680;pointer-events:auto;overflow-x:auto;overflow-y:hidden;
 filter:none;background:transparent;border:0;border-radius:0;
 scrollbar-width:thin;scrollbar-color:#6eb4c588 transparent;
}
body.duel-active .hand-panel .hand-fan.hidden{display:none!important}
body.duel-active .hand-fan-track{height:100%;position:relative}
body.duel-active .hand-fan-card{
 left:16px!important;bottom:9px;width:110px;height:149px;
 transform-origin:50% 111%;
 transform:translateX(var(--fan-x)) translateY(var(--fan-y)) rotate(var(--fan-angle));
}
body.duel-active .hand-fan-card:is(:hover,:focus-visible){
 z-index:200!important;
 transform:translateX(var(--fan-x)) translateY(-18px) rotate(0deg) scale(1.06);
}
body.duel-active .hand-fan-card.hand-inactive:not(.selected){filter:brightness(.65)}
body.duel-active .hand-fan-card.selected{
 border-color:#ffe483;box-shadow:0 0 0 2px #ecc766,0 4px 18px #000b;
}
body.duel-active #handTray{display:none!important}
@media(max-width:780px){
 body.duel-active #duel:not(.hidden){grid-template-rows:auto auto minmax(0,1fr) 78px!important}
 body.duel-active .below,body.duel-active .below .main-column{height:78px}
 body.duel-active .below .turn-actions-panel{
  width:min(100%,calc(100vw - 12px));height:74px;padding:3px 5px;
 }
 body.duel-active .below .turn-actions-panel .turn-actions{
  justify-content:center;flex-wrap:wrap;column-gap:5px;row-gap:3px
 }
 body.duel-active .hand-toggle{bottom:85px!important;left:8px!important;height:30px!important;min-height:30px!important;font-size:11px}
 body.duel-active .hand-panel .hand-fan,
 body.duel-active .hand-panel:not(.tray-open):hover .hand-fan:not(.hidden),
 body.duel-active .hand-panel:not(.tray-open):focus-within .hand-fan:not(.hidden){
  bottom:120px!important;left:8px!important;
  width:calc(100vw - 16px)!important;height:125px!important;
 }
 body.duel-active .hand-fan-card{left:8px!important;bottom:6px;width:72px;height:96px}
 body.duel-active .hand-fan-card:is(:hover,:focus-visible){
  transform:translateX(var(--fan-x)) translateY(-7px) rotate(0deg) scale(1.03)
 }
}
@media(max-height:580px){
 body.duel-active .hand-panel .hand-fan,
 body.duel-active .hand-panel:not(.tray-open):hover .hand-fan:not(.hidden),
 body.duel-active .hand-panel:not(.tray-open):focus-within .hand-fan:not(.hidden){
  height:109px!important
 }
 body.duel-active .hand-fan-card{height:83px;width:64px}
}
@media(prefers-reduced-motion:reduce){
 body.duel-active .hand-fan-card{transition:none}
}


/* v0.44 Physical TCG attachments. Shared by online and CPU/RPG/Cube.
   Energy ART is tucked under the left edge of each Pokémon (not an icon rail).
   The face is drawn above the Energy stack, just like overlapping real cards. */
body.duel-active .stage .poke{
 position:relative;
 overflow:visible;
 isolation:isolate;
}
body.duel-active .stage .poke .pokemon-face{
 position:relative;
 z-index:2;
}
body.duel-active .stage .poke .energy-card-stack{
 --energy-card-width:46px;
 --energy-card-height:64px;
 --energy-peek:29px;
 --energy-step:6px;
 display:block;
 position:absolute;
 top:7px;
 left:calc(-1 * var(--energy-peek));
 min-width:0;
 width:var(--energy-card-width);
 height:calc(var(--energy-card-height) + 5 * var(--energy-step));
 z-index:1;
 pointer-events:none;
 overflow:visible;
 background:none;
}
body.duel-active .stage .poke .energy-card-stack .energy-card-mini{
 display:block;
 box-sizing:border-box;
 position:absolute;
 left:calc(var(--energy-position) * -1.8px);
 top:calc(var(--energy-position) * var(--energy-step));
 width:var(--energy-card-width);
 min-width:0;
 height:var(--energy-card-height);
 padding:0;
 margin:0;
 border:1px solid #d5e1d7;
 border-radius:3px;
 overflow:hidden;
 z-index:var(--energy-position);
 transform:rotate(calc((var(--energy-position) - 2) * -1deg));
 transform-origin:65% 80%;
 box-shadow:-2px 2px 5px #0009;
}
body.duel-active .stage .poke .energy-card-stack .energy-card-art{
 display:block;
 width:100%;
 height:100%;
 max-height:none;
 border:0;
 border-radius:0;
 object-fit:fill;
 background:transparent;
}
body.duel-active .stage .poke .energy-card-stack .energy-card-fallback{
 display:flex;
 width:100%;
 height:100%;
 flex-direction:column;
 align-items:center;
 justify-content:center;
 gap:2px;
 background:transparent;
 color:inherit;
 text-shadow:0 1px 2px #0009;
}
body.duel-active .stage .poke .energy-card-stack .energy-card-fallback .energy-symbol{
 font-size:18px;
 line-height:20px;
}
body.duel-active .stage .poke .energy-card-stack .energy-card-fallback .energy-label{
 font-size:8px;
 font-weight:900;
 line-height:10px;
}
body.duel-active .stage .poke .energy-card-stack .energy-overflow{
 position:absolute;
 top:calc(var(--energy-card-height) + 5 * var(--energy-step) - 10px);
 left:-13px;
 right:auto;
 font-size:10px;
 line-height:13px;
 background:#e9fff4;
 color:#0d4a42;
 border:1px solid #7caea2;
 border-radius:5px;
 padding:1px 4px;
 z-index:8;
 box-shadow:0 2px 5px #000a;
}
body.duel-active .stage .bench-zone .pokemon-strip{
 gap:18px;
 padding-left:31px;
}
body.duel-active .stage .bench-zone .poke .energy-card-stack{
 --energy-card-width:32px;
 --energy-card-height:44px;
 --energy-peek:19px;
 --energy-step:4px;
 top:4px;
}
body.duel-active .stage .bench-zone .poke .energy-card-stack .energy-card-fallback .energy-symbol{
 font-size:12px;
 line-height:14px;
}
body.duel-active .stage .bench-zone .poke .energy-card-stack .energy-card-fallback .energy-label{
 font-size:7px;
 line-height:8px;
}
/* Keep the active slot's center alignment; its energy cards can fan into
   the free space on the left without displacing the Pokémon artwork. */
body.duel-active .stage .active-zone .pokemon-strip{overflow:visible}
@media(max-width:780px){
 body.duel-active .stage .bench-zone .pokemon-strip{
  gap:10px;
  padding-left:22px;
 }
 body.duel-active .stage .poke .energy-card-stack{
  --energy-card-width:30px;
  --energy-card-height:42px;
  --energy-peek:19px;
  --energy-step:4px;
  top:3px;
  display:block;
  width:var(--energy-card-width);
  height:calc(var(--energy-card-height) + 5 * var(--energy-step));
  left:calc(-1 * var(--energy-peek));
 }
 body.duel-active .stage .poke .energy-card-stack .energy-card-mini{
  width:var(--energy-card-width);
  min-width:0;
  height:var(--energy-card-height);
 }
 body.duel-active .stage .bench-zone .poke .energy-card-stack{
  --energy-card-width:24px;
  --energy-card-height:34px;
  --energy-peek:14px;
  --energy-step:3px;
 }
 body.duel-active .stage .poke .energy-card-stack .energy-card-fallback .energy-symbol{
  font-size:11px;line-height:12px
 }
 body.duel-active .stage .poke .energy-card-stack .energy-card-fallback .energy-label{
  font-size:6px;line-height:7px
 }
 body.duel-active .stage .poke .energy-card-stack .energy-overflow{
  font-size:8px;line-height:9px;padding:1px 2px;left:-6px
 }
}

/* Duel readability: Energy is a horizontal, overlapping physical-card fan.
   Keep the Pokémon art unobscured and preserve a visible type on each card. */
body.duel-active .stage .poke .energy-peeks,
body.duel-active .stage .energy-peeks:has(.attached-energy:nth-child(5)){
 display:flex;flex-direction:row;align-items:flex-start;flex-wrap:nowrap;
 position:absolute;top:5px;left:-22px;width:max-content;max-width:none;
 height:29px;gap:0;z-index:7;pointer-events:none
}
body.duel-active .stage .energy-peeks .attached-energy,
body.duel-active .stage .energy-peeks:has(.attached-energy:nth-child(5)) .attached-energy{
 width:24px;min-width:24px;height:28px;margin-right:-10px;
 border:1px solid #faf9dfaa;border-radius:3px;padding:0;
 box-shadow:0 2px 5px #000b;overflow:hidden;
 transform:rotate(calc((var(--energy-position) - 2) * 1deg));
}
body.duel-active .stage .energy-peeks .attached-energy:last-of-type{margin-right:0}
body.duel-active .stage .energy-peeks .energy-overflow{
 display:grid;place-items:center;margin-left:3px;min-width:19px;height:23px;
 border-radius:50%;font-weight:900
}
body.duel-active .stage .poke:has(.energy-peeks){padding-top:3px}
@media(max-width:780px){
 body.duel-active .stage .poke .energy-peeks,
 body.duel-active .stage .energy-peeks:has(.attached-energy:nth-child(5)){
  display:flex;flex-direction:row;left:-11px;top:2px;width:max-content;height:21px;gap:0
 }
 body.duel-active .stage .energy-peeks .attached-energy,
 body.duel-active .stage .energy-peeks:has(.attached-energy:nth-child(5)) .attached-energy{
  width:18px;min-width:18px;height:20px;margin-right:-8px;border-radius:2px
 }
}

/* Attached Pokémon Tools and legacy attached Trainers stay legible without
   adding another full border around the underlying Pokémon card. */
body.duel-active .stage .pokemon-tools{
 position:absolute;right:-5px;bottom:19px;z-index:8;
 display:flex;flex-flow:column nowrap;align-items:flex-end;gap:3px;
 max-width:85%;pointer-events:none
}
body.duel-active .stage .pokemon-tool-badge{
 display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;
 white-space:nowrap;border-radius:999px;padding:2px 6px;
 font-size:9px;font-weight:800;line-height:1.3;
 color:#fff9d9;background:#313f55ed;
 border:1px solid #e9d39c88;box-shadow:0 2px 6px #000b
}
@media(max-width:780px){
 body.duel-active .stage .pokemon-tools{right:-3px;bottom:12px;max-width:78%}
 body.duel-active .stage .pokemon-tool-badge{font-size:8px;padding:2px 4px}
}

/* v0.45 — Full-height physical card attachments.
   Cards extend horizontally behind each Pokémon, rather than tiny badges or
   vertically staggered stacks. Keep each card's exposed edge discernible. */
body.duel-active .stage .poke{
 --attachment-height:calc(100% - 7px);
 --attachment-width:clamp(73px,7.4vw,103px);
 --attachment-peek:clamp(13px,1.65vw,23px);
 --attachment-overlap:clamp(9px,1.1vw,15px);
 border-color:transparent;
 background:transparent;
 box-shadow:none;
 overflow:visible;
}
body.duel-active .stage .poke .pokemon-face{
 z-index:4;
 border:0;
 border-radius:5px;
 box-shadow:0 3px 10px #0009;
}
body.duel-active .stage .poke .energy-peeks.energy-card-stack,
body.duel-active .stage .poke .energy-peeks:has(.attached-energy:nth-child(5)){
 display:block;
 position:absolute;
 top:3px;
 left:calc(-1 * var(--attachment-peek));
 height:var(--attachment-height);
 width:var(--attachment-width);
 min-width:0;
 max-width:none;
 z-index:1;
 overflow:visible;
 pointer-events:none;
}
body.duel-active .stage .poke .energy-card-stack .attached-energy.energy-card-mini,
body.duel-active .stage .energy-peeks:has(.attached-energy:nth-child(5)) .attached-energy{
 display:block;
 position:absolute;
 top:0;
 left:calc(var(--energy-position) * -1 * var(--attachment-overlap));
 width:var(--attachment-width);
 min-width:0;
 height:100%;
 margin:0;
 padding:0;
 border:1px solid #e3eadf;
 border-radius:5px;
 box-shadow:-2px 2px 5px #000b;
 overflow:hidden;
 transform:none;
 z-index:calc(3 - var(--energy-position));
}
body.duel-active .stage .poke .energy-card-stack .energy-card-art{
 display:block;width:100%;height:100%;max-height:none;object-fit:fill;
}
body.duel-active .stage .poke .energy-card-stack .energy-overflow{
 position:absolute;top:auto;bottom:-7px;left:-22px;z-index:12;
}
body.duel-active .stage .poke .pokemon-tools{
 right:calc(-1 * var(--attachment-peek));top:3px;bottom:auto;
 max-width:calc(100% - 12px);z-index:5;
}
body.duel-active .stage .poke .pokemon-tool-badge{
 border-radius:4px;background:#253445ed;
 box-shadow:0 2px 5px #000a;
}
body.duel-active .stage .bench-zone .poke{
 --attachment-width:clamp(65px,6vw,90px);
 --attachment-peek:14px;
 --attachment-overlap:9px;
}
@media(max-width:780px){
 body.duel-active .stage .poke{
  --attachment-width:70px;--attachment-peek:13px;--attachment-overlap:9px;
 }
 body.duel-active .stage .bench-zone .poke{
  --attachment-width:58px;--attachment-peek:11px;--attachment-overlap:7px;
 }
}

/* v0.46 — Attached cards on BOTH sides: Energy left, Trainers right.
   Match the visible Pokémon-card image height rather than the entire button
   (which also contains name/HP). Bounded fans protect five-card mobile benches. */
body.duel-active .stage .poke{
 --attachment-height:108px;
 --attachment-width:clamp(64px,7vw,96px);
 --attachment-peek:18px;
 --attachment-overlap:10px;
 --tool-peek:18px;
 --tool-overlap:10px;
 overflow:visible;
}
body.duel-active .stage .poke .energy-peeks.energy-card-stack{
 top:4px;height:var(--attachment-height);width:var(--attachment-width);
 left:calc(-1 * var(--attachment-peek));z-index:2;
}
body.duel-active .stage .poke .energy-card-stack .attached-energy.energy-card-mini{
 top:0;height:100%;
 left:calc(var(--energy-position) * -1 * var(--attachment-overlap));
 width:var(--attachment-width);
 z-index:calc(8 - var(--energy-position));
 transform:none;
 border-radius:4px;
 border:1px solid #edebdf;
 box-shadow:-2px 2px 5px #000c;
}
body.duel-active .stage .poke .energy-card-stack .energy-overflow{
 top:auto;bottom:-8px;left:calc(-3 * var(--attachment-overlap) - 10px);
 z-index:12;margin:0;min-width:21px;
}
body.duel-active .stage .poke .pokemon-tools.tool-card-stack{
 display:block;position:absolute;top:4px;bottom:auto;
 right:calc(-1 * var(--tool-peek));width:var(--attachment-width);
 height:var(--attachment-height);max-width:none;
 overflow:visible;z-index:2;pointer-events:none;
}
body.duel-active .stage .poke .pokemon-tools .pokemon-tool-card{
 position:absolute;top:0;right:calc(var(--tool-position) * -1 * var(--tool-overlap));
 display:block;width:var(--attachment-width);height:100%;
 border:1px solid #ecedf0;border-radius:4px;
 background:#404f60;box-shadow:2px 2px 5px #000c;
 overflow:hidden;z-index:calc(8 - var(--tool-position));
}
body.duel-active .stage .poke .pokemon-tools .pokemon-tool-card::after{
 content:"";position:absolute;top:5%;bottom:5%;right:0;
 width:calc(var(--tool-peek) - 3px);
 background:linear-gradient(#d7dfe7,#607c95);
 border-left:1px solid #e9eef0aa;
 box-shadow:-1px 0 3px #0006;
 border-radius:1px;
}
body.duel-active .stage .poke .pokemon-tools .tool-card-art{
 display:block;width:100%;height:100%;object-fit:fill;border:0;
}
body.duel-active .stage .poke .pokemon-tools .tool-card-fallback{
 display:flex;flex-direction:column;align-items:center;justify-content:center;
 width:100%;height:100%;gap:4px;
 background:linear-gradient(155deg,#dce7eb,#71899d);
 color:#142d42;font-weight:900;font-size:9px;
}
body.duel-active .stage .poke .pokemon-tools .tool-card-fallback span{
 max-width:96%;font-size:8px;overflow:hidden;line-height:1.1;
}
body.duel-active .stage .poke .pokemon-tools .tool-overflow{
 position:absolute;bottom:-8px;right:calc(-2 * var(--tool-overlap) - 13px);
 z-index:12;min-width:21px;text-align:center;
 padding:2px 4px;border-radius:999px;
 color:#183241;background:#deeff6;font-size:10px;font-weight:900;
 box-shadow:0 2px 4px #000a;
}
body.duel-active .stage .poke:focus-visible,
body.duel-active .stage .poke:hover{z-index:15}
body.duel-active .stage .bench-zone .poke{
 --attachment-height:clamp(55px,7.2dvh,82px);
 --attachment-width:clamp(49px,5.5vw,72px);
 --attachment-peek:12px;--tool-peek:12px;
 --attachment-overlap:7px;--tool-overlap:7px;
 overflow:visible;
}
@media(min-width:1000px) and (min-height:780px){
 body.duel-active .stage .poke{--attachment-height:clamp(80px,11dvh,104px)}
}
@media(max-width:780px){
 body.duel-active .stage .poke{
  --attachment-height:clamp(36px,7.3dvh,64px);
  --attachment-width:clamp(37px,7vw,65px);
  --attachment-peek:11px;--tool-peek:11px;
  --attachment-overlap:6px;--tool-overlap:6px;
 }
 body.duel-active .stage .bench-zone .poke{
  --attachment-height:39px;
  --attachment-width:35px;
  --attachment-peek:9px;--tool-peek:9px;
  --attachment-overlap:5px;--tool-overlap:5px;
  overflow:visible;
 }
 body.duel-active .stage .poke .pokemon-tools .tool-card-fallback{font-size:7px}
 body.duel-active .stage .poke .pokemon-tools .tool-card-fallback span{font-size:6px}
}
@media(max-width:435px){
 body.duel-active .stage .poke{--attachment-height:clamp(35px,6.5dvh,56px)}
 body.duel-active .stage .bench-zone .poke{
  --attachment-peek:6px;--tool-peek:6px;
  --attachment-overlap:3px;--tool-overlap:3px;
 }
 body.duel-active .stage .bench-zone .poke .pokemon-tools .pokemon-tool-card::after{width:5px}
}
