/* 决斗体验层：保留全部盘面区域与规则，统一条件弹窗和多步操作反馈。 */
body { --ux-modal-bg:#11121f; --ux-modal-line:rgba(var(--brand-rgb,161,107,255),.36); }
.ux-overlay { padding:16px !important; isolation:isolate; }
.ux-overlay.ux-inactive-dialog { pointer-events:none; }
.ux-overlay .ux-dialog {
    min-width:0 !important; width:min(640px,100%) !important; max-width:100% !important;
    max-height:calc(var(--ux-dialog-height,100dvh) - 32px) !important;
    margin:0; box-sizing:border-box; overflow-y:auto; overscroll-behavior:contain;
    color:#eee9f4; border:1px solid var(--ux-modal-line) !important; border-radius:16px;
    box-shadow:0 24px 90px #0009; scrollbar-width:thin; scrollbar-color:rgba(var(--brand-rgb),.4) transparent;
    background:radial-gradient(ellipse at 100% 0,rgba(var(--brand-rgb),.10),transparent 50%),var(--ux-modal-bg);
}
.ux-overlay .ux-dialog :is(button,input,select,textarea) { font-family:inherit; }
.ux-overlay .ux-dialog button:not(.mulligan-card):not(.cp-tile):not(.fp-tile):not(.rv-tile):not(.detail-tab) {
    min-height:42px; line-height:1.4; touch-action:manipulation;
}
.ux-overlay button:focus-visible, .duel-action-guide button:focus-visible { outline:2px solid #83e3ee; outline-offset:3px; }
.ux-overlay :is(.mulligan-title,.block-decision-title,.charge-select-title,.triple-elimination-title,.orb-pick-title) {
    font-size:18px !important; line-height:1.3; letter-spacing:1px; text-align:left; margin-bottom:8px;
}
.ux-overlay :is(.mulligan-desc,.block-decision-desc,.charge-select-desc,.triple-elimination-desc,.orb-pick-desc) {
    font-size:13px !important; line-height:1.7; color:#b9b3c8; text-align:left;
}
.ux-overlay :is(.mulligan-actions,.block-decision-actions,.triple-elimination-actions,#orb-sort-actions) {
    position:sticky; bottom:-1px; z-index:1; flex-shrink:0; padding:10px 0 0;
    background:linear-gradient(transparent, var(--ux-modal-bg) 12%); margin-top:12px; gap:10px;
}
.ux-overlay :is(.block-instant-title,.block-option-stats,.block-opt-stat) { font-size:12px; }
.ux-overlay .block-instant-btn { min-height:42px; flex:1 0 auto; }
.ux-overlay .block-option-btn.selected { outline:2px solid rgba(var(--brand-rgb),.6); outline-offset:1px; }
.ux-overlay .ux-dialog-note { font-size:12px; line-height:1.5; color:#9ddbe4; margin:8px 0 0; min-height:18px; }
.ux-overlay :is(#cost-pay-body,#fill-cost-body,#reveal-viewer-body) { min-height:0; flex:1 1 auto; overscroll-behavior:contain; }
.ux-overlay :is(#cost-pay-head,#fill-cost-head,#reveal-viewer-head,#cost-pay-foot,#fill-cost-foot,#reveal-viewer-foot) { flex-shrink:0; }
.ux-overlay :is(.cp-tile,.fp-tile,.rv-tile,.mulligan-card) { font-family:inherit; color:inherit; padding:0; -webkit-tap-highlight-color:transparent; }
.ux-overlay :is(.cp-tile,.fp-tile,.rv-tile) { text-align:center; }
.ux-overlay :is(.cp-name,.fp-name,.rv-name) { font-size:12px !important; line-height:1.35; min-height:32px; }
.ux-overlay .mulligan-hands { justify-content:center; overflow-x:auto; padding:10px 4px; gap:12px; }
.ux-overlay .mulligan-card { position:relative; flex:0 0 auto; width:94px; height:132px; border:2px solid #ffffff24; border-radius:9px; overflow:hidden; background:#1b1c2c; }
.ux-overlay .mulligan-card img { width:100%;height:100%;object-fit:cover; }
.ux-overlay .mulligan-card.selected { transform:none; border-color:var(--brand-bright); box-shadow:0 0 0 2px rgba(var(--brand-rgb),.3); }
.ux-overlay .mulligan-card-name { position:absolute;bottom:0;left:0;right:0;background:#080b13dd;padding:4px 2px; font-size:11px;line-height:1.2;color:#f7f3ff; }
.ux-overlay .mulligan-count { font-size:13px; }
.ux-overlay .card-menu { position:relative; top:auto; left:auto; transform:none; padding:20px; max-width:400px !important; }
.ux-overlay#card-menu-overlay.show { display:flex; align-items:center;justify-content:center; }
.ux-overlay .card-menu-actions button { min-height:42px; }
.ux-overlay .card-menu-preview { display:flex;justify-content:center; }
.ux-overlay .card-menu-title { font-size:18px;text-align:center; }
.ux-overlay .orb-pick-panel,.ux-overlay .triple-elimination-panel { padding:20px; }
.ux-overlay .orb-pick-list { max-height:none; }
.ux-triple-groups { display:flex;flex-direction:column;gap:8px;margin:12px 0;text-align:left; }
.ux-triple-group { display:flex;gap:12px;align-items:center;background:#ffffff04;border:1px solid #ffffff20;border-radius:10px;padding:10px;cursor:pointer;color:inherit;width:100%; }
.ux-triple-group.selected { border-color:var(--brand-bright);background:rgba(var(--brand-rgb),.10); }
.ux-triple-cards { display:flex;gap:4px;flex:none; }
.ux-triple-cards img { width:35px;height:49px;object-fit:cover;border-radius:4px; }
.ux-triple-group strong { display:block;font-size:13px;margin-bottom:3px; }
.ux-triple-group small { display:block;font-size:11px;color:#b7b2c3;line-height:1.5; }
.ux-overlay #orb-sort-panel { display:flex;flex-direction:column;padding:18px; }
.ux-overlay #orb-sort-list { min-height:0;overflow-y:auto;overscroll-behavior:contain;flex:1 1 auto; }
.ux-overlay #orb-sort-list button { min-width:42px; }
.ux-overlay #confirm-message { white-space:pre-line;line-height:1.8; }
.ux-overlay#confirm-overlay .ux-dialog { max-width:560px !important; }
.ux-overlay#confirm-overlay .confirm-actions { flex-wrap:wrap; }
.ux-overlay#confirm-overlay .confirm-actions button { flex:1 1 160px;white-space:normal; }
#toast-container { z-index:9000 !important; pointer-events:none; }
#toast-container button { pointer-events:auto; }
/* 盘内弹层提升到同一body层，仅一次旋转，避免嵌套transform的层级隔离。 */
body.force-landscape-battle .ux-overlay:not(#rotate-overlay) {
    inset:auto !important; top:0 !important;left:0 !important;width:100dvh !important;height:100dvw !important;
    transform:rotate(90deg) translateY(-100%);transform-origin:top left;
}
body.force-landscape-battle #toast-container { top:0;left:0;right:auto;bottom:auto;width:100dvh;height:100dvw;transform:rotate(90deg) translateY(-100%);transform-origin:top left;justify-content:flex-start;align-items:center;padding:8px; }
/* 操作条在布局中而非悬浮，保留双战场与资源区的可见性。 */
.duel-action-guide { display:flex;align-items:center;gap:10px;min-height:36px;flex:0 0 auto;padding:6px 10px;border:1px solid rgba(var(--brand-rgb),.2);border-radius:8px;background:rgba(12,14,25,.8); }
.duel-guide-state { font-size:11px;font-weight:700;padding:3px 7px;border-radius:5px;background:rgba(var(--brand-rgb),.13);color:var(--brand-bright);white-space:nowrap; }
.duel-guide-text { font-size:12px;line-height:1.5;color:#c0bbcc;flex:1;min-width:0; }
.duel-action-guide button { flex:none;border:1px solid #ffffff22;background:#ffffff06;color:#eee9f4;border-radius:6px;min-height:30px;padding:3px 10px;cursor:pointer; }
.duel-action-guide button[hidden] { display:none; }
#page-battle.bp-compact .duel-action-guide { min-height:26px;gap:6px;padding:2px 6px;border-radius:4px; }
#page-battle.bp-compact .duel-guide-state { font-size:10px;padding:2px 5px; }
#page-battle.bp-compact .duel-guide-text { font-size:11px;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
#page-battle.bp-compact .duel-action-guide button { font-size:11px;min-height:24px;padding:1px 8px; }
#page-battle.bp-compact .mobile-info-btn { height:22px; font-size:10px; }
#page-battle.bp-compact .mobile-info-rail { height:24px;flex-basis:24px; }
#page-battle.bp-compact .actions-zone .action-btn { font-size:11px;min-height:32px; }
#page-battle.bp-compact .actions-zone { flex-basis:88px;min-width:88px; }
#page-battle.bp-compact :is(.player-name,.info-item,.info-item b) { font-size:10px; }
#page-battle.bp-compact .phase-item { font-size:9px; }
#page-battle.bp-compact .top-bar { height:26px;flex-basis:26px; }
#page-battle.bp-compact .info-strip :is(.cm-label,.cm-value) { font-size:10px; }
#page-battle .sub-steps #btn-log-open { font-size:11px; }
/* 桌面多步出牌不把所有操作堆成五行；保留原按钮，释放双战场高度。 */
#page-battle:not(.bp-compact) .hand-zone { flex:1 1 0;min-width:0; }
#page-battle:not(.bp-compact) .actions-zone { width:196px;min-width:196px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;align-content:end; }
#page-battle:not(.bp-compact) .actions-zone :is(.play-assist-group,.mobile-action-menu) { display:contents; }
#page-battle:not(.bp-compact) .actions-zone .action-btn { min-height:38px;white-space:nowrap; }
#page-battle:not(.bp-compact) .actions-zone #btn-end { grid-column:1/-1; }
@media (max-height:900px) {
    #page-battle:not(.bp-compact) .field-wrap { gap:5px;padding:6px 12px; }
    #page-battle:not(.bp-compact) :is(.opp-row,.my-row) { padding:4px 10px; }
    #page-battle:not(.bp-compact) .battle-slot { min-height:calc(var(--card-h) + 10px); }
    #page-battle:not(.bp-compact) .opp-zone-strip { min-height:46px;padding:2px 8px; }
    #page-battle:not(.bp-compact) .opp-zone-strip .cost-card { width:32px;height:44px; }
    #page-battle:not(.bp-compact) .opp-zone-strip .signal-orb { width:30px;height:42px; }
    #page-battle:not(.bp-compact) .divider-row { padding:0; }
}
.ux-overlay#holo-overlay { padding:0 !important; }
.ux-overlay#holo-overlay .holo-close { min-width:44px;min-height:44px; }
#instant-picker-overlay { position:fixed;inset:0;background:#05060ed9;display:none;align-items:center;justify-content:center; }
.ux-instant-panel { padding:16px; }
.ux-instant-heading { display:flex;gap:12px;align-items:center;justify-content:space-between; }
.ux-instant-heading h3 { font-size:16px; }
.ux-instant-heading button { border:1px solid #ffffff28;border-radius:8px;background:#ffffff08;color:#ded8ec;padding:4px 10px; }
#instant-picker-overlay #instant-zone { display:flex;flex-direction:column;width:auto;gap:10px; }
#instant-picker-overlay .instant-tactics { display:flex;gap:10px;overflow-x:auto; }
#instant-picker-overlay .instant-tactic-card { width:75px;height:105px;flex:none;position:relative;border:2px solid #ffffff22;border-radius:8px;padding:0;overflow:hidden; }
#instant-picker-overlay .instant-tactic-card.selected { border-color:var(--brand-bright); }
#instant-picker-overlay .instant-tactic-card img { width:100%;height:100%;object-fit:cover; }
#instant-picker-overlay .zone-label { position:static;transform:none;font-size:13px; }
#page-battle .instant-tactic-card { padding:0; }
.ux-overlay.graveyard-view { width:100%;max-width:none;max-height:none; }
/* 以实际可用高度（旋转后短边）控制弹窗，不依赖物理竖屏vh。 */
.ux-overlay.ux-short { padding:8px !important; }
.ux-overlay.ux-short .ux-dialog { max-height:calc(var(--ux-dialog-height) - 16px) !important;border-radius:10px; }
.ux-short :is(#cost-pay-head,#fill-cost-head,#reveal-viewer-head) { padding:9px 12px; }
.ux-short :is(#cost-pay-body,#fill-cost-body,#reveal-viewer-body) { padding:8px 12px; }
.ux-short :is(#cost-pay-foot,#fill-cost-foot,#reveal-viewer-foot) { padding:8px 12px;gap:5px; }
.ux-short :is(#cost-pay-grid,#fill-cost-grid,#reveal-viewer-grid) { grid-template-columns:repeat(auto-fill,minmax(78px,1fr));gap:8px; }
.ux-short :is(.mulligan-panel,.block-decision-panel,.orb-pick-panel,.triple-elimination-panel,.charge-select-panel) { padding:12px; }
.ux-short :is(.mulligan-title,.block-decision-title,.charge-select-title,.orb-pick-title,.triple-elimination-title) { font-size:16px !important;margin-bottom:4px; }
.ux-short :is(.mulligan-desc,.block-decision-desc,.charge-select-desc,.triple-elimination-desc,.orb-pick-desc) { font-size:12px !important;margin:4px 0 8px; }
.ux-short .mulligan-hands { flex-wrap:nowrap;justify-content:flex-start;gap:8px;margin:2px 0; }
.ux-short .mulligan-card { width:72px;height:101px; }
.ux-short .ux-dialog-note { font-size:11px;margin:4px 0 0; }
.ux-short .block-decision-options { gap:6px; }
.ux-overlay.ux-short button:not(.mulligan-card):not(.cp-tile):not(.fp-tile):not(.rv-tile):not(.detail-tab) { min-height:36px; }
.ux-short .ux-triple-groups { gap:6px; }
.ux-short .ux-triple-group { padding:6px; }
@media(prefers-reduced-motion:reduce) { .ux-overlay * { animation:none !important;transition:none !important;scroll-behavior:auto !important; } }
