/* Advanced Results: one collapsible filter panel and responsive table. */
.advanced-filter-workspace{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;min-width:0}
.advanced-filter-panel,.advanced-results-main{min-width:0;max-width:100%}
.advanced-filter-panel{border:1px solid var(--edge);border-radius:10px;background:var(--paper);padding:12px;}
.advanced-filter-panel-header{display:none;align-items:center;justify-content:space-between;gap:7px}
.advanced-filter-panel-header h3,.advanced-filter-section-title{font-size:13px;margin:0 0 7px;font-weight:750}
.advanced-filter-panel-content{min-width:0;display:grid;gap:10px}
.advanced-mobile-filter-content{display:contents}
.advanced-scope-actions{display:flex;gap:7px;align-items:stretch;min-width:0;flex-wrap:wrap}
.advanced-scope-actions #all-games-filter{flex:1 1 165px;max-width:240px}
.advanced-scope-actions #top-stats{flex:4 1 500px;min-width:0;margin:0;display:flex;gap:7px;flex-wrap:wrap}
.advanced-scope-actions #top-stats button{flex:1 1 145px;min-width:0;}
.advanced-filter-units{font-size:11px;color:var(--muted);margin:5px 0 0}
.advanced-websites{min-width:0}
.advanced-websites .site-filter-buttons{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.advanced-websites .site-filter-buttons button{min-width:0;min-height:36px;flex:0 1 auto}
.advanced-site-select{display:inline-flex;gap:8px;align-items:center;flex-wrap:wrap}
.advanced-search{min-width:0}
.advanced-search>label{display:flex;gap:7px;align-items:center;flex-wrap:wrap;min-width:0;font-size:12px}
.advanced-search #table-search{flex:1 1 160px;min-width:0;width:100%;max-width:100%}
.advanced-search-help{min-width:0}
#advanced-active-summary{display:flex;gap:5px;flex-wrap:wrap;align-items:center;min-width:0}
.advanced-filter-chip{display:inline-block;border:1px solid var(--edge);border-radius:5px;background:var(--fill);font-size:11px;color:var(--muted);padding:3px 7px;overflow-wrap:anywhere;max-width:100%}
.advanced-more-filters{min-width:0;border:1px solid var(--edge);border-radius:8px}
.advanced-more-summary{cursor:pointer;padding:8px 11px;font-size:13px;font-weight:700;color:var(--blue)}
.advanced-more-summary:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.advanced-more-filters[open]{padding-bottom:10px}
.advanced-more-filters>.advanced-filter-section{margin:10px;padding:10px;border:1px solid var(--edge);border-radius:7px;min-width:0}
.advanced-more-filters .advanced-filter-section label{display:inline-flex;flex-wrap:wrap;gap:6px;align-items:center;margin:5px;max-width:100%;font-size:12px}
.advanced-more-filters .advanced-filter-section select,.advanced-more-filters .advanced-filter-section input{min-width:0;max-width:100%;}
.advanced-more-filters #category-stats{margin:8px 0}
.advanced-more-filters #all-tos-filter{width:100%;max-width:330px;text-align:left}
.advanced-more-filters #closure-summary{display:flex;flex-wrap:wrap;gap:6px}
.advanced-more-filters #closure-summary button{min-width:0;flex:1 1 130px}
.advanced-more-filters #date-filter-note,.advanced-more-filters #table-search-help{margin:7px 0;line-height:1.4}
.advanced-more-filters #advanced-game-dates .table-compact-clear,.advanced-more-filters #advanced-table-display .table-compact-clear{margin:5px}
.advanced-mobile-filters-toggle{display:none}
#advanced-results-main>.section-title{margin-top:0}
#advanced-results-main #results-range-panel{min-width:0;max-width:100%;overflow:hidden}
#advanced-results-main #table-resizer{width:100%;max-width:100%;overflow-x:auto}
#advanced-results-main .results-table{min-width:830px}
@media(min-width:1200px){
  .advanced-filter-workspace{grid-template-columns:minmax(235px,275px) minmax(0,1fr);align-items:start}
  .advanced-filter-workspace .advanced-filter-panel{position:sticky;top:10px;align-self:start;min-width:0;max-height:min(75vh,720px);overflow-y:auto;overscroll-behavior:contain;}
  .advanced-filter-workspace .advanced-filter-panel-header{display:flex;margin-bottom:9px}
  .advanced-filter-workspace .advanced-filter-panel-content{display:flex;flex-direction:column;align-items:stretch;gap:10px}
  .advanced-filter-workspace .advanced-mobile-filter-content{display:contents}
  .advanced-filter-workspace .advanced-scope-actions{display:flex;flex-direction:column}
  .advanced-filter-workspace .advanced-scope-actions #all-games-filter{max-width:none;flex:auto}
  .advanced-filter-workspace .advanced-scope-actions #top-stats{display:flex;flex-direction:column;flex:auto;min-width:0}
  .advanced-filter-workspace .advanced-scope-actions #top-stats button{flex:auto;min-width:0}
  .advanced-filter-workspace #advanced-websites .site-filter-buttons{flex-wrap:wrap}
  .advanced-filter-workspace #advanced-more-filters .advanced-filter-section{margin:7px;padding:7px}
  .advanced-filter-workspace #advanced-more-filters #closure-summary{display:flex;flex-direction:column}
  .advanced-filter-workspace #advanced-more-filters #closure-summary button{flex:auto}
  .advanced-filter-workspace[data-sidebar-collapsed=true]{grid-template-columns:52px minmax(0,1fr)}
  .advanced-filter-workspace[data-sidebar-collapsed=true] .advanced-filter-panel{padding:6px}
  .advanced-filter-workspace[data-sidebar-collapsed=true] .advanced-filter-panel-header{writing-mode:vertical-rl;align-items:center;margin:0;gap:6px}
  .advanced-filter-workspace[data-sidebar-collapsed=true] #advanced-filter-panel-label,.advanced-filter-workspace[data-sidebar-collapsed=true] .advanced-filter-panel-content{display:none}
  .advanced-filter-workspace[data-sidebar-collapsed=true] #advanced-sidebar-toggle{width:38px;min-height:120px;padding:8px 6px;white-space:normal}
}
@media(max-width:1199px){
  .advanced-filter-workspace{gap:9px}
  .advanced-filter-panel{padding:9px}
  .advanced-filter-panel-content{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
  .advanced-mobile-filters-toggle{display:inline-flex;height:44px;min-height:44px;align-self:start;align-items:center;justify-content:center;grid-column:2;grid-row:1;white-space:nowrap}
  #advanced-search{grid-column:1;grid-row:1;min-width:0}
  #advanced-search>label{display:block}
  #advanced-active-summary{grid-column:1/-1;grid-row:2}
  .advanced-mobile-filter-content{grid-column:1/-1;grid-row:3;display:flex;flex-direction:column;gap:9px;min-width:0;max-height:min(70vh,460px);overflow:auto;overscroll-behavior:contain;padding-bottom:env(safe-area-inset-bottom, 0px)}
  .advanced-filter-workspace[data-mobile-open=false] .advanced-mobile-filter-content{display:none}
  #advanced-scope .advanced-scope-actions{display:grid;grid-template-columns:minmax(0,1fr)}
  #advanced-scope #all-games-filter{max-width:none}
  #advanced-scope #top-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,135px),1fr))}
  #advanced-scope #top-stats button{min-width:0}
  .advanced-websites .site-filter-buttons{display:flex;flex-wrap:wrap}
  .advanced-more-filters>.advanced-filter-section{padding:8px;margin:7px}
  #advanced-results-main .section-title{align-items:flex-start}
  #advanced-results-main #results-range-panel{padding:8px}
}
@media(max-width:320px){
 .advanced-filter-panel-content{grid-template-columns:minmax(0,1fr)}
 .advanced-mobile-filters-toggle{grid-column:1;grid-row:2;width:100%}
 #advanced-active-summary{grid-row:3}
 .advanced-mobile-filter-content{grid-row:4}
 .advanced-filter-panel{padding:6px}
}
@media(prefers-reduced-motion:reduce){.advanced-filter-workspace *{scroll-behavior:auto}}
/* At 240px even two minimal provider pills must stack rather than widen the page. */
@media(max-width:320px){
  #advanced-websites .site-filter-buttons{flex-direction:column;align-items:stretch;width:100%;min-width:0}
  #advanced-websites .site-filter-buttons button{width:100%;max-width:100%;flex:0 0 auto}
  #advanced-filter-panel .advanced-filter-section{min-width:0;max-width:100%}
}
/* Override the legacy minimum for the extreme narrow Advanced search field. */
#advanced-filter-panel #table-search{min-width:0;width:100%;max-width:100%}
/* Existing scan/log controls otherwise force document-wide overflow at 240px. */
@media(max-width:280px){
  #save-baseline,#rating-history-range-trigger{width:100%;min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
  .log-level-dropdown,.log-level-dropdown-menu{min-width:0;max-width:100%;width:100%;}
  .log-level-dropdown summary{min-width:0;max-width:100%;white-space:normal}
  .scan-grid label{min-width:0;max-width:100%;overflow-wrap:anywhere}
}

.advanced-more-filters>.advanced-collapsible-section{padding:0}
.advanced-collapsible-section>summary{padding:9px 10px;margin:0;cursor:pointer;list-style-position:inside}
.advanced-collapsible-section>summary:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.advanced-collapsible-section[open]{padding:0 9px 9px}
.advanced-collapsible-section[open]>summary{padding-left:1px}

/* Alpha.35 keyboard/touch and empty-state corrections. */
.advanced-filter-panel{min-width:0;max-width:100%;}
.advanced-search .search-sql-toolbar{margin:5px 0 0;}
.advanced-search .search-reference-button{font-size:12px;padding:5px 8px;min-height:36px;}
#advanced-results-main .pager button{min-width:44px;min-height:44px;touch-action:manipulation;}
#advanced-results-main .pager button:focus-visible,.advanced-filter-panel button:focus-visible{outline:2px solid var(--blue);outline-offset:2px;}
#advanced-results-main #table-resizer.advanced-table-empty{height:auto;min-height:0;resize:none;}
#advanced-results-main .advanced-empty-row td{padding:14px 12px;white-space:normal;color:var(--muted);}
@media(max-width:767px){.advanced-mobile-filters-toggle{min-width:72px;max-width:100%;}}

/* Alpha.36: populated Advanced results stay contained at extreme viewport widths.
   Keep the table's own horizontal scrolling; wrap the caption/actions and pager. */
#advanced-results-main{min-width:0;max-width:100%;}
#advanced-results-main .section-title{min-width:0;max-width:100%;}
#advanced-results-main #results-caption{min-width:0;max-width:100%;overflow-wrap:anywhere;word-break:normal;}
#advanced-results-main .section-title>.inline-actions{min-width:0;max-width:100%;flex-wrap:wrap;}
#advanced-results-main .pager{min-width:0;max-width:100%;flex-wrap:wrap;justify-content:space-between;gap:8px;}
#advanced-results-main .pager>span{min-width:0;max-width:100%;overflow-wrap:anywhere;}
#advanced-results-main .pager>div{min-width:0;max-width:100%;flex-wrap:wrap;gap:5px;}
@media(max-width:320px){
  #advanced-results-main .section-title{align-items:stretch;flex-direction:column;gap:8px;}
  #advanced-results-main .section-title>.inline-actions{margin-top:0;}
  #advanced-results-main .pager{justify-content:flex-start;}
}

/* Settings tab rail: horizontal-only overflow. The old negative-bottom-margin
   tab border could create a narrow vertical scroll gutter in Chromium/Windows. */
.settings-tab-nav{box-sizing:border-box;align-items:stretch;min-height:0;overflow:hidden}
.settings-tab-nav .settings-tabbar{
  box-sizing:border-box;display:flex;align-items:stretch;flex-wrap:nowrap;
  overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;
  scrollbar-width:none;scrollbar-gutter:auto;min-height:0;
}
.settings-tab-nav .settings-tabbar::-webkit-scrollbar{display:none;width:0;height:0}
.settings-tab-nav .settings-tabbar button{
  box-sizing:border-box;align-self:stretch;display:inline-flex;align-items:center;
  white-space:nowrap;line-height:1.25;margin-bottom:0;min-height:42px;
  overflow:visible;
}
.settings-tab-nav .settings-tabbar button svg{flex-shrink:0}
.settings-tab-arrow{align-self:stretch}
.settings-essential-note{line-height:1.4}

/* Alpha.37 Scan Setup: readable heading above a compact value-and-gear control. */
.scan-rating-history-range-entry{flex:0 1 250px;min-width:185px;max-width:100%;position:relative}
.scan-rating-history-range-entry>.rating-range-title{margin:0 0 6px;display:block;line-height:1.35}
.rating-range-dropdown{position:relative;min-width:0}
.scan-rating-history-range-entry .rating-history-range-trigger{width:100%;min-width:0;min-height:39px;display:flex;align-items:center;justify-content:space-between;gap:10px;text-align:left;padding:7px 10px;border-radius:8px}
.scan-rating-history-range-entry .rating-history-range-trigger .rating-range-value{flex:1;min-width:0;font-size:13px;color:var(--ink);font-weight:600}
.scan-rating-history-range-entry .rating-history-range-trigger .rating-range-gear{flex:0 0 auto;align-self:center;color:var(--blue)}
.rating-range-dropdown-list{position:absolute;z-index:75;top:calc(100% + 2px);left:0;right:0;max-height:min(50dvh,280px);overflow-y:auto;padding:5px;background:var(--paper);color:var(--ink);border:1px solid var(--edge);border-radius:8px;box-shadow:0 12px 24px #0005}
.rating-range-dropdown-list[hidden]{display:none!important}
.rating-range-dropdown-list button{display:block;width:100%;min-height:36px;text-align:left;border:0;background:transparent;border-radius:5px;font-size:12px;color:inherit;padding:7px 10px}
.rating-range-dropdown-list button:hover,.rating-range-dropdown-list button:focus-visible{background:var(--fill);outline:2px solid var(--blue);outline-offset:-2px}
.rating-range-dropdown-list button[aria-pressed="true"]{font-weight:750;color:var(--blue)}
@media(max-width:750px){.scan-rating-history-controls .scan-rating-history-range-entry{flex:1 1 auto;width:100%;max-width:100%}}

/* 240px stress case: an older scan-range minimum (185px) extended seven
   pixels beyond its grid track. Shrink only at extreme narrow widths. */
@media(max-width:280px){
  .scan-rating-history-range-entry{min-width:0;max-width:100%;width:100%;flex:1 1 100%;}
  .scan-rating-history-range-entry .rating-range-dropdown{min-width:0;max-width:100%;}
}

/* Alpha.43: horizontally align Games and Game date sort controls and their
   arrows across sticky table headers, without affecting table body sizing. */
#results-advanced .results-table thead th{vertical-align:middle;}
#results-advanced .results-table thead th:nth-child(4) button[data-sort=games],
#results-advanced .results-table thead th:nth-child(5) button[data-sort=latest]{
  display:inline-flex;align-items:center;justify-content:flex-start;
  vertical-align:middle;white-space:nowrap;line-height:1.3;min-height:20px;gap:4px;
}
/* The non-sortable Actions heading should use the same face/weight/color as
   the sortable Opponent / Ratings heading, not the subdued default th type. */
#results-advanced .results-table thead th:last-child{
  font-size:12px;font-weight:700;color:var(--ink);
}
