/* 0.22 — stable field geometry and consistent, readable data surfaces. */
:root{--inspector-width:clamp(252px,18vw,320px);--control-height:36px}
input:not([type=checkbox]):not([type=radio]):not([type=range]),select{min-height:var(--control-height);font-size:14px;line-height:1.35}
select{field-sizing:content;width:auto;min-width:max-content;max-width:100%}
.filters{gap:10px;align-items:end}.filters>label{flex:1 1 180px;max-width:340px;min-width:min(100%,180px)}
.filters select,.filters input{width:100%;min-width:0}.filters label:has(select){flex-basis:230px}
.filters label:has(input[type=date]){flex:0 1 170px;min-width:160px}
.table-wrap{scrollbar-gutter:stable;overscroll-behavior:contain}th,td{font-size:14px;padding:10px 12px}th{font-weight:600}
.deck-variant{font-style:italic;color:var(--muted)}
/* A snapshot never participates in the live grid or changes the page width. */
.duel-transition-board{box-sizing:border-box!important;contain:strict!important;overflow:hidden!important}
#main.duel-workspace .duel-center{position:relative;min-width:0;overflow:hidden}
#main.duel-workspace .duel-reference{grid-template-rows:minmax(0,1fr) minmax(0,1fr)!important;gap:8px}
#main.duel-workspace .duel-reference>.duel-log-panel{min-height:0;height:100%;display:flex;flex-direction:column;overflow:hidden}
.duel-log-panel .event-log{flex:1;min-height:0;padding:8px 10px;font-size:13px;line-height:1.5}.duel-log-panel .panel-head{flex:none}
#main.duel-workspace .duel-reference .inspector-copy>p{font-size:13px!important;line-height:1.5!important}
#main.duel-workspace .duel-social>.duel-chat-panel{flex:0 0 25%!important;min-height:150px!important}
#main.duel-workspace .duel-social>.duel-context{min-height:140px!important}
#main.duel-workspace .duel-social>.duel-room-header{overflow:visible}
#main.duel-workspace .duel-social .duel-quick-actions button{flex:0 0 auto;min-width:max-content;white-space:nowrap}
.sound-enabled{background:var(--accent-soft)!important;color:var(--accent)!important;border-color:var(--accent)!important}
#main .duel-quick-actions [data-sound]{margin-left:auto}
#main .duel-field-pass{position:static;order:4;align-self:flex-end;flex:none;min-width:154px;max-width:100%;min-height:38px;margin:3px 0 0;font-size:14px;touch-action:none;user-select:none}
#main .duel-field-pass[aria-disabled=true]{opacity:.38;cursor:default}#main .duel-field-pass.is-holding{opacity:1;box-shadow:0 0 0 2px var(--accent-soft)}
.duel-hand-controls{flex:none;min-height:32px;margin-top:4px}.duel-chain-preference{min-height:32px;max-width:none;font-size:12px;white-space:normal;line-height:1.35;padding:5px 8px}
#main .hand-buttons{display:flex;flex-direction:column;align-self:center;gap:5px;flex:none;margin-left:6px}
#main .hand-buttons .hand-shuffle{margin:0!important;min-width:68px;width:100%;font-size:12px}
#main .hand-buttons .hand-show{min-height:30px;font-size:12px}
.card-action-popover{max-width:calc(100vw - 16px);overscroll-behavior:contain}
#main .sideboard-view-controls{align-self:center;display:flex;gap:10px;flex-wrap:wrap;padding:2px}
#main .sideboard-view-controls label{display:grid!important;grid-template-columns:auto minmax(110px,1fr);align-items:center;gap:10px;position:static!important;font-size:13px;line-height:1.4}
#main .sideboard-view-controls select{position:static!important;display:block;min-width:110px!important;margin:0;padding:6px 28px 6px 10px;height:36px}
#main .sideboard-heading{padding:4px 2px;gap:12px;min-height:58px}#main.is-sideboarding .duel-center>.duel-board{grid-template-rows:64px minmax(0,1fr) calc(var(--side-small-card)/.685 + 44px)!important}
#main .sideboard-ready-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.sideboard-ready-row>span{flex:1 1 220px}
.sideboard-ready-row>button{white-space:nowrap;min-height:38px}
/* Overview fills the available workspace without oversized SVG type. */
body[data-page=stats] .analytics-chart svg text,body[data-page=stats] .rating-control svg text{font:11px var(--font-data)!important;fill:var(--muted)}
body[data-page=stats] .stats-filter-row{gap:12px;align-items:end}.stats-filter-row>.stats-shared{flex:1 1 760px}
.stats-shared .filters{margin:0;gap:10px}.stats-shared .filters>label{flex:1 1 180px;max-width:300px}
.stats-shared .filters>label:has(select){flex-basis:220px}.stats-shared .filters>label:has(input[type=date]){flex:0 1 170px}
.stats-filter-row>.rating-control{margin:0!important;flex:0 1 310px;min-width:240px}.stats-context-row{margin:8px 0}.stats-context-row>.rating-explanation{font-size:13px}
.stats-overview-grid .composition-chart li,.stats-overview-grid .composition-chart li button{font-size:14px;min-height:28px}
.stats-overview-grid .chart-legend button{font-size:13px;min-height:28px;padding:4px}
.stats-overview-grid .chart-values,.stats-overview-grid .chart-readout{font-size:12px}
body[data-page=stats] .table-wrap{max-height:calc(100dvh - 330px);min-height:150px}
body[data-page=stats] .table-wrap th{position:sticky;top:0;background:var(--surface);z-index:1}
.admin-evidence-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));gap:14px;margin:12px 0}
.admin-evidence-card{padding:14px;min-width:0}.admin-deck-preview{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));gap:3px;padding:8px 0}.admin-deck-preview img{width:100%;height:auto}
.admin-full-deck{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:8px}.admin-full-deck img{display:block;width:100%;height:auto}.admin-full-deck span{font-size:11px;line-height:1.3;display:block}
.admin-label-list{max-height:60dvh;overflow:auto;margin-top:12px}.admin-label-list>.between{padding:7px 0;border-bottom:1px solid var(--line);gap:12px}
.demo-tools{padding:16px;margin-top:20px}.demo-tools>p{max-width:90ch}.demo-list>article{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px 0;border-top:1px solid var(--line)}.demo-list>article>div{flex:1 1 240px}.demo-list small{display:block;color:var(--muted)}.demo-list button{white-space:nowrap}
@media(min-width:851px) and (min-height:950px){
 #main.duel-workspace .duel-reference .inspector-heading{grid-template-columns:90px minmax(0,1fr)!important;gap:10px}
 #main.duel-workspace .duel-reference .inspector-heading img{max-height:132px;width:auto}
 #main.duel-workspace .duel-reference .inspector-copy>p{font-size:14px!important;line-height:1.5!important}
 #main .stats-overview-grid .composition-chart>svg{height:230px}#main .stats-overview-grid .composition-chart ul{max-height:290px}
 #main .stats-overview-grid .analytics-chart>svg{height:210px!important}#main .stats-overview-grid .analytics-chart>.chart-legend{max-height:225px!important}
}
@media(min-width:851px) and (max-height:760px){
 #main.duel-workspace .duel-reference{grid-template-rows:minmax(0,55%) minmax(0,45%)!important}
 #main.duel-workspace .duel-social>.duel-chat-panel{min-height:125px!important}
 #main .duel-field-pass{min-height:32px;font-size:13px;margin-top:0}.duel-hand-controls{min-height:28px;margin-top:0}
 #main.duel-workspace .duel-social>.duel-options{padding:5px}.duel-chain-preference{font-size:11px;min-height:28px}
 #main .stats-overview-grid .composition-chart>svg{height:130px}#main .stats-overview-grid .composition-chart ul{max-height:180px}
 #main .stats-overview-grid .analytics-chart>svg{height:105px!important}#main .stats-overview-grid .analytics-chart>.chart-legend{max-height:110px!important}
}
@media(max-width:850px){
 :root{--control-height:40px}input:not([type=checkbox]):not([type=radio]):not([type=range]),select{font-size:16px}
 .filters>label,.stats-shared .filters>label{flex:1 1 145px;max-width:none;min-width:0}.filters label:has(select),.stats-shared .filters>label:has(select){flex-basis:180px}
 #main.duel-workspace .duel-reference{grid-template-rows:minmax(0,55%) minmax(180px,45%)!important}
 #main.duel-workspace .duel-social>.duel-chat-panel{min-height:220px!important}
 #main .duel-field-pass{min-height:36px;font-size:12px;min-width:140px;margin-top:2px}
 .duel-hand-controls{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:6px;padding:2px}
 .duel-hand-controls>label{max-width:none!important;font-size:11px;line-height:1.3;margin:0;gap:4px}.duel-hand-controls>.duel-chain-preference{max-width:none!important;width:100%;font-size:11px;min-height:34px;padding:4px 6px}
 #main .pile-tabs{min-height:19px;height:19px;gap:1px;overflow:hidden}#main .pile-tabs button{min-width:0;min-height:18px!important;height:18px!important;padding:0 2px!important;font-size:8px!important;line-height:18px!important;white-space:nowrap}
 #main .pile-tabs button>b{display:none}
 #main .field-slot>span:not(.stat){font-size:8px!important;white-space:normal;line-height:1.05;text-align:center}
 #main .pile>span:first-child{font-size:8px!important;white-space:normal;line-height:1.1;padding:1px}
 #main .duel-mobile-players .duel-zone-counts{gap:4px;font-size:9px}.duel-mobile-bar{gap:5px}.duel-mobile-bar button{font-size:12px;min-height:34px}
 #main .hand-buttons{gap:3px;margin-left:3px}#main .hand-buttons button{font-size:10px!important;min-width:48px!important;padding:3px!important}
 #main .sideboard-heading{min-height:60px;align-items:center}#main .sideboard-heading h2{font-size:19px}#main .sideboard-heading p{font-size:11px;margin:0}#main .sideboard-heading .eyebrow{font-size:9px}
 #main .sideboard-view-controls label{grid-template-columns:1fr;gap:2px;font-size:11px}#main .sideboard-view-controls select{min-width:90px!important;font-size:14px;min-height:32px;height:32px}
 .sideboard-ready-row>span{flex-basis:100%;font-size:12px}.sideboard-ready-row>button{flex:1;min-height:40px}
 body[data-page=stats] .table-wrap{max-height:65dvh}.stats-overview-grid .composition-chart li,.stats-overview-grid .composition-chart li button{font-size:13px}
 .admin-full-deck{grid-template-columns:repeat(5,minmax(0,1fr))}.stats-filter-row>.rating-control{flex-basis:100%}
}

.duel-quick-actions .duel-audio-row{display:flex;flex:1 0 100%;gap:6px;align-items:center}#main .duel-audio-row [data-sound]{margin-left:0}

#main[data-proactive-decision=true] .duel-prompt [data-prompt-detail]{display:none}
@media(min-width:851px) and (max-height:760px){#main .duel-prompt{padding:5px 10px!important}#main .duel-options .gameplay-controls{gap:4px!important}}

/* Override the older unrestricted matrix layout: wide labels retain readable
   column widths and large result sets scroll inside their table. */
#stats-content .panel>.table-wrap,#stats-content .stats-content-table .table-wrap,#stats-content .player-directory .table-wrap{
 max-height:clamp(230px,calc(100dvh - 430px),720px);overflow:auto;scrollbar-gutter:stable;
}
#stats-content .panel>.matchup-matrix table{table-layout:auto;width:max-content;min-width:100%}
#stats-content .panel>.matchup-matrix th,#stats-content .panel>.matchup-matrix td{min-width:118px;max-width:160px;white-space:normal;overflow-wrap:normal;font-size:13px;padding:9px 10px}
#stats-content .panel>.matchup-matrix th:first-child,#stats-content .panel>.matchup-matrix td:first-child{min-width:190px;max-width:220px;width:190px;text-align:left}
#stats-content .table-wrap th{position:sticky;top:0;z-index:2;background:var(--surface)}
#main .coach-settings select,#main .coach-settings input{font-size:14px!important}
@media(max-width:850px){#main .coach-settings select,#main .coach-settings input{font-size:16px!important}#stats-content .table-wrap{max-height:65dvh!important}}
@media(min-width:851px) and (max-height:760px){
 body[data-page=stats]:has(.stats-overview-grid) .page-title{height:32px!important;margin-bottom:2px!important}
 #main:has(.stats-overview-grid) .tabs{min-height:0;height:39px;margin-top:3px;margin-bottom:4px;padding:0 0 3px}
 #main:has(.stats-overview-grid) .tabs button{min-height:32px;padding:5px 12px}
 #main:has(.stats-overview-grid) .stats-context-row{margin:0;gap:8px}
 #main:has(.stats-overview-grid) .stats-summary{padding:2px 8px!important;margin:0!important;font-size:12px}
 #main .stats-overview-grid .chart-readout{display:none}
 #main .stats-overview-grid svg text{font-size:20px!important}
 #main .stats-overview-toolbar{margin:0 0 6px;min-height:34px}
}
