/* Card interaction surface: transform-only motion, no page scroll while dragging. */
.match-shell{height:var(--game-height,100dvh);overscroll-behavior:none}
.match-shell .workspace{height:calc(var(--game-height,100dvh) - 46px);overscroll-behavior:none}
.match-shell .game-page{position:relative;isolation:isolate}
.match-shell .table{touch-action:none;overscroll-behavior:none}
.game-page [data-selection-id],.game-page [data-drag-card],.game-page [data-drag-pokemon]{touch-action:none;-webkit-touch-callout:none;user-select:none;-webkit-user-select:none;cursor:grab}
.game-page img{user-select:none;-webkit-user-select:none;-webkit-user-drag:none;pointer-events:none}
.match-shell button{touch-action:manipulation}
.match-shell button[data-selection-id],.match-shell button[data-drag-card]{touch-action:none}
.match-shell .hand{touch-action:pan-x;overscroll-behavior:contain;scroll-behavior:smooth;scrollbar-width:none}
.match-shell .hand-heading{display:flex;align-items:center;gap:5px}
.match-shell .hand-heading .hand-page{font-size:20px;min-width:34px;min-height:30px;padding:0 7px}
.match-shell .hand{padding-top:28px}.match-shell .hand-panel{height:132px}
.match-shell .hand-card:hover{transform:none}
.drag-card-ghost{position:fixed;z-index:1500;pointer-events:none!important;transform-origin:50% 50%;will-change:transform;contain:layout style;backface-visibility:hidden;border-radius:5px;box-shadow:0 12px 20px #0005}
.drag-card-ghost img{display:block;width:100%;height:100%;object-fit:contain;border-radius:5px}
.drag-source{opacity:.2!important}
.drop-ready{outline:2px dashed #80cbfacc!important;outline-offset:4px;transition:outline-color .12s,box-shadow .12s;opacity:1!important}
.drop-hover{outline:3px solid #ffda80!important;box-shadow:0 0 0 5px #ffda8030,0 0 22px #ffcf7070!important}
.is-dragging{overscroll-behavior:none;user-select:none;-webkit-user-select:none;cursor:grabbing}
.drag-hud{position:fixed;z-index:1700;left:8px;top:45px;max-width:calc(100vw - 16px);padding:5px 9px;background:#071521e8;border-radius:6px;font:11px ui-monospace,monospace;color:#a4f3d3;pointer-events:none}

/* Card choices belong to the table, not a separate modal or panel. */
.match-shell .table>.inline-selection:not(:empty){position:absolute;inset:8px;z-index:25;max-height:none;min-height:0;margin:0;padding:0;background:none!important;border:0!important;box-shadow:none!important;border-radius:0;overflow:visible;display:block;pointer-events:none}
.match-shell .inline-selection>*{pointer-events:auto}
.match-shell .inline-selection .choice-tabs{position:absolute;top:0;left:50%;transform:translateX(-50%);display:flex;max-width:100%;width:max-content;margin:0;padding:2px 0 7px;gap:5px;flex-wrap:nowrap;overflow-x:auto;touch-action:pan-x;scrollbar-width:none}
.match-shell .inline-selection .choice-tabs .btn{background:#0b202cb8;border:0;border-bottom:2px solid transparent;border-radius:3px;min-height:34px;font-size:12px;padding:5px 9px;white-space:nowrap;color:#d8e8ef}
.match-shell .inline-selection .choice-tabs .btn.selected{color:#ffe19a;border-bottom-color:#ffe19a;background:#183545a3}
.match-shell .selection-cloud{--choice-card:clamp(64px,calc((100vw - 220px)/6),110px);position:absolute;top:46%;left:50%;transform:translate(-50%,-50%);display:grid;grid-template-columns:repeat(var(--choice-columns,6),var(--choice-card));justify-content:center;gap:14px;padding:6px;animation:cards-materialize .2s ease-out}
.match-shell .selection-cloud .selection-option{min-width:0;width:var(--choice-card);display:block;position:relative;background:none;border:0;padding:0}
.match-shell .selection-cloud .choice-card{display:block;width:100%;max-width:none;padding:0;border:0;border-radius:6px;background:none;box-shadow:0 9px 18px #0006}
.match-shell .selection-cloud .choice-card img{width:100%;height:auto;aspect-ratio:245/342;object-fit:contain}
.match-shell .selection-cloud .choice-card:has(img) small{display:none}
.match-shell .selection-cloud .choice-card:not(:has(img)):not(.card-back){min-height:44px;padding:10px;background:#152b3cc9;border:1px solid #6babc6}
.match-shell .selection-toolbar{position:absolute;bottom:-70px;left:50%;transform:translateX(-50%);display:flex;align-items:center;justify-content:center;gap:12px;max-width:100%;width:max-content;padding:8px 10px;color:#fff;text-shadow:0 1px 5px #000,0 2px 8px #000;background:none}
.match-shell .inline-selection .selection-heading{display:flex;align-items:center;justify-content:center;gap:9px;text-align:center}
.match-shell .inline-selection .selection-heading h2{font-size:14px;line-height:1.3;max-width:420px;margin:0}
.match-shell .selection-count{white-space:nowrap;font-size:12px}
.match-shell .selection-controls{display:flex;flex-wrap:nowrap;margin:0;gap:6px}
.match-shell .selection-controls:empty{display:none}
.match-shell .selection-controls .btn{min-height:38px;font-size:13px;padding:7px 14px;white-space:nowrap}
.match-shell .selection-controls .ghost{background:#09202da8}
.match-shell .selection-drop{position:absolute;bottom:62px;left:50%;transform:translateX(-50%);border:1px dashed #b3daf1a1;border-radius:10px;padding:10px 20px;min-width:130px;min-height:44px;text-align:center;color:#fff;font-size:13px;background:#06192555}
.match-shell .floating-pages{position:absolute;top:42px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:14px;text-shadow:0 1px 5px #000;font-size:12px}
.floating-pages .btn{min-width:44px;min-height:36px;font-size:20px;padding:3px;background:#0718249c}
/* Keep the actual board, HP, Bench and piles legible behind the cards. */
.match-shell .table:has(>.inline-selection[data-floating="true"]:not(:empty))>.table-half,.match-shell .table:has(>.inline-selection[data-floating="true"]:not(:empty))>.stadium,.match-shell .table:has(>.inline-selection[data-floating="true"]:not(:empty))>.opponent-hand{filter:brightness(.8);transition:filter .18s}
.match-shell .table:has(>.inline-selection[data-floating="true"]) .ineligible-target{opacity:.85}
.match-shell .table:has(>.inline-selection[data-floating="true"]) .side-piles,.match-shell .table:has(>.inline-selection[data-floating="true"]) .prize-zone,.match-shell .table:has(>.inline-selection[data-floating="true"])>.stadium{opacity:.85}
.match-shell .table:has(>.inline-selection:not(:empty))>.board-turn-control{visibility:hidden}
.match-shell .table-wrap:has(.inline-selection:not(:empty)) .turn-banner{visibility:hidden}
.is-dragging .match-shell .table>.table-half,.is-dragging .match-shell .table>.stadium{filter:none!important}
.is-dragging .selection-cloud,.is-dragging .selection-browse{opacity:.08;transition:opacity .1s;pointer-events:none}
.is-dragging .selection-cloud *{pointer-events:none!important}
.is-dragging .inline-selection .choice-tabs,.is-dragging .floating-pages,.is-dragging .selection-toolbar{opacity:.1;pointer-events:none}
.match-shell .table>.inline-selection[data-floating="false"]:not(:empty){inset:auto 2px -122px;height:110px}
.match-shell .inline-selection[data-floating="false"] .selection-toolbar{bottom:0}
.match-shell .inline-selection[data-floating="false"] .selection-drop{bottom:52px}
.match-shell .table-wrap:has(.inline-selection:not(:empty)) .hand-panel{visibility:hidden;display:block}
.is-dragging .match-shell .hand-panel.drop-ready{visibility:visible}
.match-shell .selection-browse{position:absolute;inset:45px 0 78px;display:flex;justify-content:center;align-items:center;pointer-events:none}
.match-shell .selection-browse>*{pointer-events:auto;max-height:100%;overflow:auto;touch-action:pan-y}
.match-shell .inline-selection .compact-gallery{justify-content:center;margin:0}
.match-shell .inline-selection .detail-grid,.match-shell .inline-selection .inspection-board{background:#071824e8;border-radius:10px;padding:14px;max-width:650px}
.match-shell .selection-mode-active [data-selection-id]{animation:none}
.match-shell .selection-mode-active .valid-target{box-shadow:0 0 8px #78caff80}
.match-shell .selection-mode-active .selected-target{box-shadow:0 0 12px #ffda8080;opacity:.55}
.selection-preview-slot{position:relative}
.selection-preview{position:absolute;inset:0;display:block;pointer-events:none;z-index:6;outline:2px solid #ffda80;outline-offset:1px;border-radius:4px;box-shadow:0 0 12px #ffda8055}
.selection-preview img{display:block;width:100%;height:100%;object-fit:contain;border-radius:4px}
.pile .selection-preview{bottom:15px}
@keyframes cards-materialize{from{opacity:0}to{opacity:1}}
@media(max-width:600px){
 .match-shell .workspace{height:calc(var(--game-height,100dvh) - 40px)}
 .match-shell .site-header{padding-top:env(safe-area-inset-top)}
 .match-shell .game-page{padding-bottom:max(5px,env(safe-area-inset-bottom))}
 .match-shell .selection-cloud{--choice-card:80px;gap:12px;top:46%}
 .match-shell .inline-selection .choice-tabs{justify-content:flex-start;left:0;transform:none;width:100%}
 .match-shell .inline-selection .choice-tabs .btn{min-height:36px;padding:4px 8px;font-size:11px}
 .match-shell .selection-toolbar{bottom:-100px;width:100%;padding:5px 2px;flex-wrap:wrap;gap:5px}
 .match-shell .inline-selection .selection-heading h2{font-size:12px;max-width:260px}
 .match-shell .selection-controls .btn{min-height:36px;font-size:12px;padding:7px 15px}
 .match-shell .hand-panel{height:126px}.match-shell .hand{padding-top:30px}
 .match-shell .selection-browse{inset:42px 0 86px}
 .match-shell .table>.inline-selection[data-floating="false"]:not(:empty){bottom:-118px;height:110px}
}
@media(max-width:600px) and (max-height:740px){.match-shell .selection-cloud{--choice-card:62px;gap:11px;top:44%}.match-shell .floating-pages{top:40px}}
@media(prefers-reduced-motion:reduce){.match-shell .selection-cloud{animation:none}.match-shell .hand{scroll-behavior:auto}.drop-ready,.is-dragging .selection-cloud,.match-shell .table>.table-half{transition:none!important}}

.match-shell .table:has(>.inline-selection[data-view="board"]) .ineligible-target,.match-shell .table:has(>.inline-selection[data-view="board"]) .side-piles,.match-shell .table:has(>.inline-selection[data-view="board"]) .prize-zone,.match-shell .table:has(>.inline-selection[data-view="board"])>.stadium{opacity:1}
@media(max-width:600px) and (max-height:650px){.match-shell .table>.inline-selection[data-floating="false"]:not(:empty){bottom:-102px;height:98px}.match-shell .selection-toolbar{bottom:-86px}.match-shell .inline-selection[data-floating="false"] .selection-toolbar{bottom:0}}

/* Compact choices are attached to their card, with no bottom instruction bar. */
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.match-shell .inline-selection .selection-toolbar{position:fixed;bottom:auto!important;transform:none;max-width:calc(100vw - 16px);width:max-content;padding:0;gap:6px;z-index:60}
.match-shell .selection-controls .btn{min-height:44px}
.match-shell .selection-cloud:empty{display:none}
.deleted-decks>div{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 0}

.match-shell .inline-selection[data-kind="effect-discard-energy"] .choice-card small{display:block;background:#0a1a27e8;padding:5px;border-radius:4px;font-size:11px;color:white;line-height:1.2}
