/* R176: deck-specific original art and a single, aligned count row. */
#deck-body[data-mode=list]>.deck-sheet-header{position:relative;display:grid;grid-template-columns:1fr;grid-template-rows:64px;min-height:64px;padding:0 12px;gap:0}
#deck-body[data-mode=list] .sheet-title{grid-area:1/1;margin:0;padding:0 60px;text-align:center}
#deck-body[data-mode=list] .deck-slot-count{grid-area:1/1;justify-self:start;display:flex;gap:4px;align-items:baseline;margin:0 0 0 12px;font:500 12px/1.2 var(--font-ui);color:#6d6455}
#deck-body[data-mode=list] .deck-slot-count b{font-size:20px;color:#342c20}
#deck-body[data-mode=list]>.deck-sheet-scroll{padding:12px 16px 18px}
.saved-deck-list{display:grid;gap:12px;margin:0}
.saved-deck-list>.saved-deck{--control-kind:deck-entry-ivory;position:relative;display:grid;grid-template-columns:minmax(0,1.48fr) minmax(94px,1fr);align-items:stretch;gap:10px;min-width:0;min-height:168px;padding:12px;border:0;border-radius:0;background:none;box-shadow:none;isolation:isolate}
.saved-deck>.saved-deck-playmat{position:absolute;inset:5px;width:calc(100% - 10px);height:calc(100% - 10px);max-width:none;object-fit:cover;opacity:.32;pointer-events:none;mask-image:linear-gradient(90deg,transparent,#000 15%,#000 70%,transparent),linear-gradient(0deg,transparent,#000 20%,#000 80%,transparent);mask-composite:intersect}
.saved-deck>.saved-deck-playmat[data-hero-art=true]{object-fit:cover;object-position:35% 25%;opacity:.34}
.saved-deck-visuals{position:relative;display:grid;grid-template-columns:minmax(0,.92fr) minmax(0,1fr);align-items:end;gap:7px;min-width:0;z-index:1}
.saved-deck .saved-deck-preview{--control-kind:none;display:grid;place-items:end center;width:100%;min-width:0;min-height:112px;padding:0;border:0;background:none;box-shadow:none;touch-action:pan-y pinch-zoom}
.saved-deck-preview>.game-card{width:100%;max-width:100%;pointer-events:none;transform:none;filter:drop-shadow(1px 3px 3px #382b1e45)}
.saved-deck .saved-deck-info{position:relative;z-index:1;display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:6px;min-width:0;text-align:right}
.saved-deck-info>.saved-deck-name{display:block;overflow:hidden;margin:0;font-size:16px;line-height:1.3;font-weight:750;color:#342c20;text-overflow:ellipsis;white-space:nowrap}
.saved-deck-info>.saved-deck-hero{display:block;overflow:hidden;margin:0;font-size:11px;line-height:1.3;color:#75664d;text-overflow:ellipsis;white-space:nowrap}
.saved-deck-loadout{display:flex;align-self:stretch;flex-direction:column;justify-content:flex-end;gap:10px;min-width:0;margin:0}
.saved-deck-gear{display:flex;flex:1;align-items:flex-end;justify-content:center;gap:2px;min-width:0;min-height:54px}
.saved-deck-gear>.game-card{width:calc((100% - 34px)/2);max-width:38px;min-width:0;flex:1 1 0;pointer-events:none}
.saved-deck .saved-deck-stack{--control-kind:none;position:relative;display:grid;place-items:center;align-self:stretch;align-content:end;width:32px;min-width:32px;min-height:44px;padding:0;margin:0;border:0;background:none;box-shadow:none;touch-action:pan-y pinch-zoom}
.saved-deck-stack>.button-icon{display:block;width:32px;height:45px;max-width:none;margin:0}
.saved-deck-stack>.saved-deck-size{position:absolute;right:-3px;bottom:-3px;display:grid;place-items:center;box-sizing:border-box;width:25px;height:25px;padding:0;border:1px solid #bd9c59;border-radius:50%;background:#243332;color:#fff3d0;box-shadow:0 2px 3px #0004;text-align:center;font:700 13px/1 var(--font-stats);font-variant-numeric:tabular-nums}
.saved-deck-cosmetics{display:flex;order:-1;flex:none;align-items:center;justify-content:center;gap:9px;min-width:0;height:32px}
.saved-deck-cosmetic{display:block;object-fit:contain;max-width:none;filter:drop-shadow(0 2px 2px #332b2440)}
.saved-deck-coin{width:31px;height:31px}.saved-deck-cardBack{width:21px;height:31px}
.saved-deck-info>.saved-deck-budget{display:block;margin:4px 0 0;padding:0}
.saved-deck-budget>.deck-size{display:none}
.saved-deck-budget .deck-cost-label{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:baseline;gap:2px 6px;margin:0 0 5px;font-size:10px;line-height:1.25;color:#51452f}
.saved-deck-budget .deck-cost-value{font:750 14px/1.2 var(--font-stats);font-variant-numeric:tabular-nums;color:#51452f}
.saved-deck-budget .deck-cost-track{height:8px;background:#312a20}
.saved-deck-budget .deck-cost-fill{background:#c5a35d;box-shadow:none}
.saved-deck-budget .deck-cost-thumb{width:6px;height:6px;right:-3px}
.saved-deck-info>.saved-deck-actions{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:5px;align-items:center;margin:3px 0 0}
#deck-dialog .saved-deck-actions>.saved-deck-choose{--control-kind:deck-action-ivory;width:100%;min-width:0;min-height:44px;margin:0;padding:5px 4px;border:0;background:none;box-shadow:none;color:#342c20;font:750 12px/1.2 var(--font-ui);letter-spacing:0;white-space:nowrap}
#deck-dialog .saved-deck[data-selected=true] .saved-deck-choose{--control-kind:deck-action-dark;opacity:1;color:#fff6e6;cursor:default}
.saved-deck[data-selected=true] .saved-deck-choose::before{content:none}
#deck-dialog .saved-deck-actions>.saved-deck-edit{--control-kind:deck-stepper-ivory;display:grid;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;margin:0;border:0;background:none;color:#51412b;box-shadow:none}
.saved-deck-edit>.button-icon{width:22px;height:22px;margin:0}
.saved-deck-info>.saved-deck-status{margin:0;color:#934326;font-size:10px;line-height:1.3}
.saved-deck-info>.saved-deck-status[hidden]{display:none}
.saved-deck-empty{display:grid;place-items:center;width:100%;aspect-ratio:2/3;border:1px dashed #aa906b;border-radius:7px;background:#d6c9ac33;color:#806c47}
.saved-deck-empty>.button-icon{width:28px;height:28px}

/* All ordinary deck actions share one jewel-free silhouette. */
#deck-dialog .deck-sheet-footer :is(.primary-action,.secondary-action),
.deck-delete-confirm :is(.deck-delete-confirm-action,.deck-delete-cancel){--control-kind:deck-action-ivory;border:0;border-image:none;background:none;box-shadow:none;border-radius:0;color:#342c20;min-height:48px;padding:8px 14px}
.deck-delete-confirm .deck-delete-confirm-action.primary-action{--control-kind:deck-action-dark;color:#fff1df}
.deck-delete-confirm .deck-sheet-actions{grid-template-columns:1fr 1fr}
#deck-dialog .deck-sheet-actions{grid-template-columns:1fr 1fr}

/* The playmat owns the entire fixed region. Insets belong to its controls. */
#deck-dialog .editor-fixed{padding:10px 16px 6px;border:0;min-width:0}
#deck-dialog .editor-fixed.has-cosmetics{background-size:100% 100%,100% 100%;background-repeat:no-repeat;background-origin:border-box;background-clip:border-box}
#deck-dialog .editor-fixed>.deck-name-input{margin-bottom:8px}
#deck-dialog .editor-tabs{gap:8px;margin-top:6px}
#deck-dialog .editor-types{gap:8px;margin-top:6px}
#deck-dialog .cosmetics-editor-controls{gap:8px;margin:4px 0}
#deck-dialog .editor-fixed .cosmetics-control{--control-kind:deck-action-ivory;min-width:0;padding-inline:6px}
#deck-dialog .editor-fixed .editor-filters>.editor-delete-chip{--control-kind:deck-action-dark;color:#fff1df}
#deck-dialog :is(.deck-status .deck-size,.editor-fixed .deck-size){font-size:14px;line-height:1.3;font-weight:750}
#deck-dialog .deck-status .deck-cost-label{font-size:12px;line-height:1.3}
#deck-dialog .deck-status .deck-cost-value{font:750 15px/1.3 var(--font-stats);font-variant-numeric:tabular-nums}
#deck-dialog .editor-fixed .deck-status :is(.deck-size,.deck-cost-label,.deck-cost-value){color:#fff4de;text-shadow:0 1px 3px #000}
#deck-dialog .editor-fixed>.deck-status{padding:6px 0 8px}
#deck-dialog :is(.editor-copy-remove,.editor-unequip){--control-kind:deck-remove-round;border-radius:50%;color:#fff6df;font-size:19px;line-height:1}
#deck-dialog :is(.editor-copy-remove,.editor-unequip)>.control-art-layer{inset:8px!important;width:28px;height:28px}
#deck-dialog :is(.editor-copy-remove,.editor-unequip)>.button-icon{width:14px;height:14px}
#deck-dialog .editor-copy-strip{height:112px}
#deck-dialog .editor-copy-track{padding-top:18px;padding-bottom:4px}
#deck-dialog .editor-copy{width:52px;flex-basis:52px}
#deck-dialog .editor-card-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:18px 12px}
#deck-dialog .editor-scroll{padding:14px 16px 18px}
#deck-dialog .editor-card-controls{grid-template-columns:repeat(3,minmax(0,1fr));align-items:stretch;gap:0;height:auto;min-height:0;margin-top:6px;overflow:visible}
#deck-dialog #deck-body .editor-card-controls .quantity-button{--control-kind:deck-stepper-ivory;justify-self:stretch;align-self:stretch;width:100%;height:auto;min-width:0;min-height:0;aspect-ratio:1;margin:0;padding:0;font-size:21px;line-height:1;color:#342c20}
#deck-dialog #deck-body .editor-card-controls .quantity-button>.button-icon{width:18px;height:18px;margin:0}
#deck-dialog .editor-card .editor-card-controls .editor-card-used{--control-kind:deck-stepper-ivory;position:relative;inset:auto;transform:none;align-self:stretch;width:100%;min-width:0;min-height:0;margin:0;padding:0;border:0;border-radius:0;background:none;box-shadow:none;color:#342c20;font:800 18px/1 var(--font-ui);font-variant-numeric:tabular-nums}
#deck-dialog .editor-card-selected .editor-card-controls .editor-card-used{--control-kind:deck-counter-gold;color:#fff;font-weight:850;text-shadow:0 1px 2px #6f420a}
#deck-dialog .editor-card-remaining{top:6px;right:3px;display:grid;place-items:center;min-width:30px;min-height:26px;padding:3px 6px;background:#191611e8;color:#fff5df;font:750 14px/1 var(--font-ui);font-variant-numeric:tabular-nums;border:0;border-radius:5px}
#deck-dialog .editor-card-controls:has(>.editor-choose-hero){display:flex}
#deck-dialog .editor-card-controls>.editor-choose-hero{--control-kind:deck-action-ivory;color:#342c20;font-size:13px;flex:1 1 0;width:100%;min-width:0;max-width:none;margin-inline:0}
#deck-dialog .editor-card-controls>.editor-choose-hero[aria-pressed=true]{--control-kind:deck-action-dark;color:#fff6e6}

@media(max-width:350px){
 #deck-body[data-mode=list]>.deck-sheet-scroll{padding-inline:10px}
 .saved-deck-list>.saved-deck{grid-template-columns:minmax(0,1.55fr) minmax(91px,1fr);gap:8px;padding:10px;min-height:154px}
 .saved-deck .saved-deck-info{gap:5px}.saved-deck-visuals{gap:5px}.saved-deck-loadout{gap:8px}
 .saved-deck-info>.saved-deck-name{font-size:14px}
 .saved-deck-info>.saved-deck-hero{font-size:11px}
 .saved-deck-info>.saved-deck-actions{gap:4px}
 #deck-dialog .saved-deck-actions>.saved-deck-choose{font-size:12px;padding-inline:3px}
 #deck-dialog .editor-fixed{padding-inline:12px}
 #deck-dialog .editor-scroll{padding-inline:10px}
 #deck-dialog .editor-card-grid{grid-template-columns:repeat(4,minmax(0,1fr));column-gap:6px}
}
@media(max-height:640px){
 #deck-dialog .editor-fixed{padding-top:6px;padding-bottom:0;row-gap:0}
 #deck-dialog .editor-fixed>.deck-name-input{margin-bottom:0}
 #deck-dialog .editor-copy-strip{height:84px}
 #deck-dialog .editor-copy{width:40px;flex-basis:40px}
 #deck-dialog .editor-copy-track{padding-top:16px;padding-bottom:0}
 #deck-dialog .editor-fixed :is(.editor-tabs,.editor-types){gap:4px;margin-top:4px}
 #deck-dialog .editor-fixed>.deck-status{padding:4px 0 5px}
 #deck-dialog .editor-scroll{padding-top:10px}
}
/* On phones the name and cosmetic icons share a row; six short tabs share
   another. This gives the catalogue its height without moving any controls out
   of the fixed overview or shrinking a touch target. */
@media(max-width:569px){
 #deck-dialog .editor-fixed{display:grid;grid-template-columns:minmax(0,1fr) 140px;column-gap:8px;row-gap:0}
 #deck-dialog .editor-fixed>*{grid-column:1/-1;min-width:0}
 #deck-dialog .editor-fixed>.deck-name-input{grid-column:1;grid-row:1;margin-bottom:0;font-size:14px;padding-inline:8px}
 #deck-dialog .editor-fixed>.cosmetics-editor-controls{grid-column:2;grid-row:1;margin:0;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr))}
 #deck-dialog .editor-fixed .cosmetics-control{--control-kind:deck-stepper-ivory;padding:0;gap:0;min-width:44px;width:44px;height:44px}
 #deck-dialog .editor-fixed .cosmetics-control>span:not(.cosmetics-control-thumb){display:none}
 #deck-dialog .editor-fixed>.editor-tabs{grid-row:4;grid-column:1}
 #deck-dialog .editor-fixed>.editor-types{grid-row:4;grid-column:2;margin-top:4px}
 #deck-dialog .editor-fixed:not(:has(>.editor-types))>.editor-tabs{grid-column:1/-1}
 #deck-dialog .editor-fixed :is(.editor-tabs,.editor-types){gap:4px;margin-top:4px}
 #deck-dialog .editor-fixed :is(.editor-tab,.editor-type){padding-inline:2px;font-size:12px}
 #deck-dialog .editor-fixed>.editor-filters{grid-row:5}
 #deck-dialog .editor-copy-strip{height:90px}
 #deck-dialog .editor-copy{width:42px;flex-basis:42px}
 #deck-dialog .editor-copy-track{padding-top:16px;padding-bottom:0}
}
@media(min-width:570px){
 #deck-dialog .editor-copy-strip{height:96px}
 #deck-dialog .editor-fixed>.deck-name-input{margin-bottom:0}
 #deck-dialog .editor-fixed{padding-top:8px;padding-bottom:2px}
 #deck-dialog .editor-copy-track{padding-top:15px;padding-bottom:0}
}
/* Small-height devices retain a complete quantity-row viewport even with the
   largest tested system insets; the existing catalogue remains scrollable. */
@media(max-height:640px){
 #deck-dialog{--popup-bar-height:52px}
 #deck-dialog>.dialog-close{top:4px}
 #deck-body[data-mode]>.deck-sheet-header{min-height:52px;grid-template-rows:52px}
 #deck-dialog .editor-copy-strip{height:76px}
 #deck-dialog .editor-copy{width:36px;flex-basis:36px}
 #deck-dialog .editor-copy-track{gap:10px}
 #deck-dialog .deck-sheet-footer{padding-block:8px}
}

/* The long portrait overview remains unchanged. Short screens keep the footer
   in its own row and let the complete composition/catalogue scroll together. */
#deck-dialog .editor-workspace{display:contents}
@media(orientation:portrait) and (max-height:700px){
 #deck-body[data-mode=edit]{grid-template-rows:auto minmax(0,1fr) auto}
 #deck-dialog .editor-workspace{display:block;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:thin}
 #deck-dialog .editor-workspace>.editor-scroll{overflow:visible;min-height:0;height:auto;max-height:none}
 #deck-dialog .editor-workspace>.editor-fixed{min-height:0}
 #deck-body[data-mode=edit]>.deck-sheet-footer{grid-row:3}
}
/* Landscape gives composition controls their own left lane and leaves a whole
   card/control row visible in the catalogue on the right. Both lanes scroll. */
@media(orientation:landscape) and (max-height:520px){
 #deck-dialog:has(#deck-body[data-mode=edit]){--popup-bar-height:48px}
 #deck-body[data-mode=edit]{grid-template-rows:48px minmax(0,1fr) 60px}
 #deck-body[data-mode=edit]>.deck-sheet-header{min-height:48px;grid-template-rows:48px;padding-block:0}
 #deck-dialog .editor-workspace{display:grid;grid-template-columns:minmax(160px,.72fr) minmax(0,1.28fr);min-height:0;min-width:0;overflow:hidden}
 #deck-dialog .editor-workspace>.editor-fixed{display:flex;flex-direction:column;align-items:stretch;gap:4px;min-height:0;padding:6px 8px;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:thin}
 #deck-dialog .editor-workspace>.editor-fixed>*{flex-shrink:0}
 #deck-dialog .editor-workspace .cosmetics-editor-controls{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin:0}
 #deck-dialog .editor-workspace .cosmetics-control{--control-kind:deck-stepper-ivory;width:44px;height:44px;min-width:44px;margin:auto;padding:0}
 #deck-dialog .editor-workspace .cosmetics-control>span:not(.cosmetics-control-thumb){display:none}
 #deck-dialog .editor-workspace .editor-copy-strip{height:78px}
 #deck-dialog .editor-workspace .editor-filters{flex-wrap:wrap}
 #deck-dialog .editor-workspace .editor-filter-group{flex-wrap:wrap;gap:4px}
 #deck-dialog .editor-workspace .editor-tabs,#deck-dialog .editor-workspace .editor-types{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin:0}
 #deck-dialog .editor-workspace .editor-loadout{gap:10px;min-height:90px}
 #deck-dialog .editor-workspace>.editor-scroll{min-height:0;min-width:0;padding:2px 6px;overflow:auto;overscroll-behavior:contain;touch-action:pan-y}
 #deck-dialog .editor-workspace .editor-card-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px 6px}
 #deck-dialog .editor-workspace .editor-card-controls{margin-top:4px}
 #deck-dialog .editor-workspace .editor-card-remaining{min-width:22px;min-height:20px;top:3px;font-size:11px;padding:2px 4px}
 #deck-dialog .editor-workspace .editor-card-controls>.editor-choose-hero{font-size:11px}
 #deck-body[data-mode=edit]>.deck-sheet-footer{grid-row:3;min-height:0;padding:6px 10px}
 #deck-body[data-mode=edit]>.deck-sheet-footer .deck-sheet-actions{height:48px}
 #deck-body[data-mode=edit]>.deck-sheet-footer .deck-sheet-actions>button{height:48px;min-height:48px}
}
@media(orientation:landscape) and (max-height:520px) and (min-width:700px){#deck-dialog .editor-workspace .editor-card-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(orientation:landscape) and (max-height:520px){
 #deck-dialog .editor-workspace .editor-card-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat){grid-template-columns:minmax(130px,.8fr) minmax(0,1.2fr);grid-template-rows:48px 48px minmax(0,1fr) 60px}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat)>.cosmetics-picker-header{grid-column:1/-1;grid-row:1;min-height:48px;padding-block:2px}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat)>.cosmetics-picker-preview{grid-column:1;grid-row:2/4;display:flex;flex-direction:column;gap:3px;height:100%;min-height:0;padding:4px 8px}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat) .cosmetics-preview-art{height:min(96px,60%);max-width:100%}
 #deck-dialog .cosmetics-picker-coin .cosmetics-preview-art{height:min(70px,44%)}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat) .cosmetics-preview-name{max-width:100%;margin:0;align-self:center;font-size:11px;line-height:1.2;text-align:center}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat) .cosmetics-coin-flip{--control-kind:deck-action-ivory;position:relative;inset:auto;align-self:center;flex:none;width:110px;max-width:100%;min-height:44px;height:44px;padding:4px 12px}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat)>.cosmetics-picker-filters{grid-column:2;grid-row:2;align-items:center;flex-wrap:nowrap;gap:4px;padding:2px 6px}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat) .cosmetics-filter{min-width:0;min-height:44px;padding:4px 2px;font-size:10px}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat)>.cosmetics-picker-scroll{grid-column:2;grid-row:3;padding:4px 6px}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat) .cosmetics-picker-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 5px}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat)>.cosmetics-picker-footer{grid-column:1/-1;grid-row:4;height:60px;min-height:0;padding:6px 12px}
 #deck-dialog .cosmetics-picker:not(.cosmetics-picker-playmat)>.cosmetics-picker-footer>button{height:48px;min-height:48px}
}

/* Deck list, loadout and editing are full panels with fixed bottom Back controls. */
#deck-dialog[data-ui-surface=panel]{position:fixed!important;inset:0!important;width:100vw!important;height:100dvh!important;min-width:0!important;max-width:none!important;max-height:none!important;margin:0!important;padding:var(--safe-top,0px) var(--safe-right,0px) var(--safe-bottom,0px) var(--safe-left,0px)!important;border:0!important;border-image:none!important;border-radius:0!important;box-sizing:border-box;background:#f4f0e6;transform:none!important}
#deck-dialog[data-ui-surface=panel]::before,#deck-dialog[data-ui-surface=panel]::after{display:none!important}
#deck-dialog[data-ui-surface=panel]>.dialog-close{display:none!important}
#deck-dialog .deck-sheet-footer:has(>.deck-panel-back){display:flex;align-items:center;gap:14px}
#deck-dialog .deck-sheet-footer:has(>.deck-panel-back)>.deck-sheet-actions{flex:1;min-width:0;grid-template-columns:minmax(0,1fr)}
#deck-dialog .deck-panel-back{--control-kind:none;display:block;position:relative;flex:none;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:0;border-image:none;box-shadow:none;background:url('assets/pass-ui-charcoal/back-button.png') 50% 48.4%/124% 124% no-repeat}
#deck-dialog .deck-panel-back::before,#deck-dialog .deck-panel-back::after{display:none}
#deck-dialog .editor-fixed>.deck-name-input{grid-column:1/-1}
#deck-dialog .editor-fixed .deck-status :is(.deck-size,.deck-cost-label,.deck-cost-value){color:var(--kit-ink,#292724);text-shadow:none}
#deck-dialog .editor-card-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:14px 6px}
#deck-dialog .editor-card-controls>.editor-choose-hero{min-height:34px;height:auto;font-size:11px}
#deck-dialog .editor-card-remaining{min-width:23px;min-height:20px;top:4px;padding:3px;font-size:11px}
#deck-dialog #deck-body .editor-card-controls .quantity-button{font-size:17px}
#deck-dialog .editor-card .editor-card-controls .editor-card-used{font-size:14px}

/* Match the current pass return face, including the original gold frame. */
#deck-dialog .deck-panel-back::after{content:'';display:block;position:absolute;inset:0;pointer-events:none;background:url('assets/pass-ui-charcoal/return-button-face.png') 50% 48.4%/124% 124% no-repeat;mask-image:linear-gradient(to right,transparent 6.47px,#000 7.47px,#000 calc(100% - 6.77px),transparent calc(100% - 5.77px)),linear-gradient(to bottom,transparent 7.94px,#000 8.94px,#000 calc(100% - 9.21px),transparent calc(100% - 8.21px));mask-composite:intersect}
#deck-dialog .deck-panel-back{visibility:visible!important;opacity:1!important;align-self:center}
#deck-dialog .editor-autobuild{--control-kind:deck-action-ivory;flex:none;min-height:36px;padding:5px 12px;font-size:12px;white-space:nowrap}
#deck-dialog .editor-filters{gap:6px;flex-wrap:wrap}
/* View actions share one footer row; recovered height belongs to the card scroller. */
#deck-dialog #deck-body[data-mode=view]>.deck-sheet-footer{gap:10px}
#deck-dialog #deck-body[data-mode=view]>.deck-sheet-footer>.deck-sheet-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
#deck-dialog #deck-body[data-mode=view]>.deck-sheet-footer>.deck-sheet-actions>button{min-width:0;min-height:48px;padding-inline:10px;white-space:nowrap}

/* One stable overview geometry across Hero / Equipment / Deck. */
#deck-dialog .editor-workspace>.editor-fixed{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto 128px auto 44px 44px auto;gap:6px;align-content:start}
#deck-dialog .editor-workspace>.editor-fixed>*{grid-column:1/-1;grid-row:auto;margin:0;min-width:0}
#deck-dialog .editor-workspace>.editor-fixed>.deck-name-input{grid-row:1}
#deck-dialog .editor-workspace>.editor-fixed>:is(.editor-loadout,.editor-copy-strip){grid-row:2;height:128px;min-height:128px}
#deck-dialog .editor-workspace>.editor-fixed>.deck-status{grid-row:3}
#deck-dialog .editor-workspace>.editor-fixed>.editor-tabs{grid-row:4}
#deck-dialog .editor-workspace>.editor-fixed>.editor-types{grid-row:5;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
#deck-dialog .editor-workspace>.editor-fixed>.editor-types[data-available=false]{visibility:hidden;pointer-events:none}
#deck-dialog .editor-workspace>.editor-fixed>:is(.editor-tabs,.editor-types)>button{height:44px;min-height:44px;min-width:0;white-space:nowrap;padding-inline:3px}
#deck-dialog .editor-workspace .editor-type{--control-kind:tab-dark;color:#eee4d1}
#deck-dialog .editor-workspace .editor-type[aria-pressed=true]{--control-kind:tab-ivory;color:#342c20}
#deck-dialog .editor-workspace>.editor-fixed>.editor-filters{grid-row:6;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:32px 36px;gap:4px 8px;padding:0}
#deck-dialog .editor-workspace .editor-filter-group{grid-column:1/-1;display:flex;flex-wrap:nowrap;gap:4px}
#deck-dialog .editor-workspace .editor-filter{white-space:nowrap;font-size:10px}
#deck-dialog .editor-workspace .editor-copy-track{padding-top:16px;padding-bottom:8px}
#deck-dialog .editor-workspace .editor-copy{width:68px;flex-basis:68px}
#deck-dialog .editor-workspace .editor-loadout{align-items:center}

#deck-dialog .editor-workspace .editor-tab{--control-kind:action-dark;color:#eee4d1}
#deck-dialog .editor-workspace .editor-tab[aria-pressed=true]{--control-kind:action-selected-ivory;color:#342c20}

.deck-unsaved-confirm .deck-sheet-actions{grid-template-columns:1fr}

/* Editor actions share one row; warnings float over the scroll viewport. */
#deck-dialog .editor-workspace{position:relative}
#deck-dialog .editor-workspace>.editor-fixed>.editor-filters{grid-template-columns:minmax(0,1.35fr) minmax(0,1fr) minmax(0,.85fr);grid-template-rows:40px;gap:6px;align-items:stretch}
#deck-dialog .editor-workspace .editor-filter-group{grid-column:auto;display:flex;gap:4px;min-width:0;height:40px}
#deck-dialog .editor-workspace .editor-filters :is(.editor-filter,.editor-autobuild,.editor-delete-chip){height:40px;min-height:40px;max-height:40px;margin:0;min-width:0;padding:4px;font-size:clamp(9px,2.8cqw,12px);line-height:1.15;white-space:normal;flex:1}
#deck-dialog .editor-workspace .editor-filter{background:none;box-shadow:none;text-shadow:none;color:#514a3e}
#deck-dialog .editor-workspace .editor-filter::before{width:15px;height:15px;flex:0 0 15px}
#deck-dialog .editor-validation-chip,html body .deck-validation-drawer .editor-validation-chip{--control-kind:none;position:absolute;z-index:8;bottom:10px;left:50%;transform:translateX(-50%);display:flex;align-items:center;justify-content:center;gap:8px;max-width:calc(100% - 32px);min-height:40px;margin:0;padding:7px 16px;border:1px solid #ceaa62;border-radius:20px;background:linear-gradient(145deg,#853d3d,#542d34);color:#ffe29b;box-shadow:0 4px 12px #1c101066,0 0 0 2px #f1d99324;font:700 13px/1.2 var(--font-ui);animation:editor-warning-arrive .3s ease-out}
html body .editor-validation-chip[hidden]{display:none}
.editor-warning-icon{display:grid;place-content:center;width:22px;height:20px;padding-top:3px;background:#f3d27b;color:#693434;clip-path:polygon(50% 0,100% 100%,0 100%);font:900 14px/1 sans-serif}
@keyframes editor-warning-arrive{from{opacity:0;scale:.8}to{opacity:1;scale:1}}
html body dialog.deck-validation-drawer{position:fixed;inset:0!important;width:100vw!important;height:100dvh!important;min-width:0;max-width:none!important;max-height:none!important;margin:0!important;padding:0!important;border:0;border-radius:0;border-image:none;background:transparent;box-shadow:none;overflow:hidden;color:#342c20;transform:none!important}
.deck-validation-drawer::backdrop{background:transparent}
html body .deck-validation-drawer::before,html body .deck-validation-drawer::after{display:none!important}
.editor-warning-dim{position:absolute;inset:0;background:#061014b3}
.editor-warning-sheet{position:absolute;box-sizing:border-box;margin:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;padding:18px 20px;background:#f3eedf;border:1px solid #b89a62;border-radius:16px;box-shadow:0 8px 30px #0005}
.editor-warning-sheet h2{font-size:18px;line-height:1.3;margin:0 0 12px}
.editor-warning-list{display:grid;gap:9px;padding-left:18px;margin:0;font-size:13px;line-height:1.55}.editor-warning-list li::marker{color:#994f40}
html body .deck-validation-drawer>.editor-validation-close{position:absolute;inset:auto;max-width:none;margin:0;transform:none;animation:none;box-sizing:border-box}
@media(prefers-reduced-motion:reduce){html body .editor-validation-chip{animation:none}}

/* The share action occupies the title row and clears the same device inset. */
#deck-body[data-mode=view]>.deck-sheet-header{grid-template-rows:64px;min-height:64px;padding:0 16px;align-items:center}
#deck-body[data-mode=view]>.deck-sheet-header .sheet-title{padding-inline:80px}
#deck-body[data-mode=view]>.deck-sheet-header>.deck-share-action{--control-kind:deck-action-ivory;grid-area:1/1;justify-self:end;align-self:center;width:76px;height:44px;min-height:44px;min-width:0;margin:0;padding:6px 8px;border:0;border-image:none;border-radius:0;background:none;box-shadow:none;color:#342c20;font-size:12px;line-height:1.2}

/* Fill the shared 128px overview without moving the three tab layouts. */
#deck-dialog .editor-workspace .editor-loadout{box-sizing:border-box;padding:4px 0 0;gap:clamp(18px,5vw,28px)}
#deck-dialog .editor-workspace .editor-loadout-slot{width:64px}
#deck-dialog .editor-workspace .editor-loadout-slot.editor-leader{width:72px}
#deck-dialog .editor-workspace .editor-slot-label{font-size:10px;line-height:1.2;margin-top:3px}
