/* Category pages share one stable header, tab rail and save/reset footer. */
#shell #settings-panel .settings-dialog{position:relative;display:flex;width:min(1120px,100%);height:min(810px,100%);max-height:100%;overflow:hidden;gap:12px}
#shell #settings-panel .settings-tabs{margin:0;max-width:none;overflow-x:auto;min-height:48px;flex-shrink:0}
#shell #settings-panel .settings-tabs button{flex:1 0 auto;min-height:44px;padding:9px 15px;white-space:nowrap;font-size:.9rem}
#shell #settings-panel .settings-page{min-height:0;min-width:0;flex:1;overflow:auto;overscroll-behavior:contain;overflow-anchor:none;padding:2px 5px 8px 2px;scrollbar-gutter:stable}
#shell #settings-panel .settings-page[hidden]{display:none!important}
#shell #settings-panel .settings-section-heading{margin-bottom:14px}
#shell #settings-panel .settings-section-heading h3{margin:0 0 4px;font-size:1.3rem;color:#fff0d5}
#shell #settings-panel .settings-section-heading p{margin:0;color:#bfd2dc;font-size:.86rem;line-height:1.5}
#shell #settings-panel .settings-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;gap:16px}
#shell #settings-panel .setting-tile{min-width:0;padding:18px;background:linear-gradient(145deg,#243b4b,#172c3b);border:1px solid #accad23b;border-radius:14px;box-shadow:inset 0 1px #ffffff0c}
#shell #settings-panel .setting-tile>h3{font-size:1.03rem;margin:0 0 14px;color:#fff0d5}
#shell #settings-panel .setting-choice{margin:0 0 18px}
#shell #settings-panel .setting-choice:last-child{margin-bottom:0}
#shell #settings-panel h4,#shell #settings-panel .setting-label{display:block;margin:0 0 8px;font-size:.88rem;color:#e4f2f5;line-height:1.4}
#shell #settings-panel p{font-size:.8rem;line-height:1.55;color:#c4d7e1}
#shell #settings-panel .setting-choice p{margin:7px 0 0}
#shell #settings-panel .segmented{min-width:0;flex-wrap:wrap;padding:4px;gap:4px}
#shell #settings-panel .segmented button{flex:1 1 auto;min-width:44px;min-height:44px;font-size:.82rem;padding:8px 10px}
#shell #settings-panel .setting-check{display:flex;align-items:center;gap:11px;min-height:48px;padding:9px 0;margin:0;border-bottom:1px solid #d6e9ed16;font-size:.86rem;line-height:1.4;cursor:pointer}
#shell #settings-panel .setting-check:last-child{border:0}
#shell #settings-panel .setting-check input{flex:0 0 22px;width:22px;height:22px;margin:0;accent-color:#a8e0c9}
#shell #settings-panel .setting-check span{flex:1;min-width:0}
#shell #settings-panel .setting-check small{display:block;margin-top:4px;color:#b6cdd9;font-size:.76rem;line-height:1.45}
#shell #settings-panel .setting-state{flex-shrink:0;color:#aee5cc;font-size:.75rem;font-weight:750;min-width:22px;text-align:right}
#shell #settings-panel .settings-notice{padding:10px 12px;border-left:3px solid #99d7c5;border-radius:0 8px 8px 0;background:#0b202c80;margin:10px 0 16px}
#shell #settings-panel .audio-mixer{grid-template-columns:minmax(115px,.85fr) minmax(90px,1fr);gap:12px;margin:0}
#shell #settings-panel .audio-mixer label{font-size:.83rem;line-height:1.4;flex-wrap:wrap}
#shell #settings-panel .audio-mixer input{min-width:0;min-height:44px;margin:0}
#shell #settings-panel .settings-advanced{grid-column:1/-1;border:1px solid #b7d4df3b;border-radius:12px;overflow:hidden;background:#182d3c}
#shell #settings-panel .settings-advanced>summary{min-height:48px;padding:14px 16px;box-sizing:border-box;cursor:pointer;font-size:.88rem;font-weight:750;color:#d8e9ef}
#shell #settings-panel .settings-advanced[open]>summary{border-bottom:1px solid #c5dee62b;color:#ffe4b0}
#shell #settings-panel .settings-advanced-body{padding:16px;display:grid;gap:12px 22px;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
#shell #settings-panel .settings-advanced-body>p,#shell #settings-panel #joystick-adjustments{grid-column:1/-1}
#shell #settings-panel #joystick-adjustments{margin:0 0 12px;padding:14px;border:1px solid #a4cad837;border-radius:10px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 22px}
#shell #settings-panel #joystick-adjustments:disabled{opacity:.55}
#shell #settings-panel #joystick-adjustments legend{font-size:.85rem;color:#bfd2dc;padding:0 6px}
#shell #settings-panel #steering-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
#shell #settings-panel #steering-options button{min-height:52px;justify-content:center;padding:9px;font-size:.83rem}
#shell #settings-panel #steering-options button span{width:24px;flex-shrink:0}
#shell #settings-panel #steering-options svg{width:24px;height:24px}
#shell #settings-panel #control-description{font-size:1rem;margin-top:16px}
#shell #settings-panel .control-demo{position:relative;height:90px;max-height:90px;overflow:hidden;background:#122635;border-radius:10px;margin-top:10px}
#shell #settings-panel #control-snake-preview{height:75px;width:75%;object-fit:contain}
#shell #settings-panel #control-demo-icon{font-size:1.7rem}
#shell #settings-panel .settings-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-shrink:0;border-top:1px solid #b4d7e12b;padding-top:8px}
#shell #settings-panel #settings-save-status{margin:0;min-width:0;font-size:.75rem;line-height:1.4;color:#afc9d6}
#shell #settings-panel #settings-save-status[data-failed=true]{color:#ffd9ad}
#shell #settings-panel #settings-reset{flex-shrink:0;min-height:44px;padding:8px 12px;font-size:.8rem}
#shell #settings-panel .settings-reset-confirm{flex-shrink:0;max-height:50%;overflow:auto;padding:14px;border:1px solid #f1c78490;border-radius:12px;background:#253b48}
#shell #settings-panel .settings-reset-confirm h3{font-size:1rem;margin:0 0 6px}
#shell #settings-panel .settings-reset-confirm p{margin:0 0 10px}
#shell #settings-panel .settings-reset-confirm>div{display:flex;flex-wrap:wrap;gap:10px}
#shell #settings-panel .settings-reset-confirm button,#shell #settings-guide .secondary{min-height:44px;font-size:.83rem;margin:4px 6px 4px 0;padding:9px 14px}
#shell #settings-panel .guide-grid{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible}
#shell #settings-panel .guide-grid article{padding:16px}
#shell #settings-panel .guide-grid h3{font-size:1rem}
#shell #settings-panel #graphics{min-height:44px;width:100%;font-size:.85rem}
#shell #settings-panel :is(button,summary,input,select):focus-visible{outline:3px solid #ffe0a0;outline-offset:-3px}
#shell.high-contrast #settings-panel :is(.setting-tile,.settings-advanced,.settings-notice){background:#071b28!important;border-color:#e0f0f8!important}
#shell.high-contrast #settings-panel :is(p,small,h4,.setting-label,.settings-section-heading p){color:#fff!important}
@media(orientation:landscape) and (max-height:500px){
 #shell #settings-panel .settings-dialog{gap:8px;padding:10px 14px}
 #shell #settings-panel .settings-section-heading{margin-bottom:10px;display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}
 #shell #settings-panel .settings-section-heading h3{font-size:1.1rem}
 #shell #settings-panel .settings-cards{gap:12px}
 #shell #settings-panel .setting-tile{padding:14px}
 #shell #settings-panel .settings-reset-confirm{max-height:60%;padding:10px 12px}
}
@media(max-width:600px){
 #shell #settings-panel .settings-cards,#shell #settings-panel .settings-advanced-body,#shell #settings-panel #joystick-adjustments,#shell #settings-panel .guide-grid{grid-template-columns:1fr}
 #shell #settings-panel .settings-tabs button{font-size:.83rem;padding:8px 12px}
}
#shell:is([data-text-size=large],[data-text-size=extra]) #settings-panel .settings-cards{grid-template-columns:1fr}
#shell[data-text-size=extra] #settings-panel :is(.settings-advanced-body,#joystick-adjustments){grid-template-columns:1fr}
@media(orientation:landscape) and (max-height:600px){
 #shell #settings-panel .settings-dialog{display:grid;grid-template-columns:142px minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;gap:10px 14px}
 #shell #settings-panel .collection-header{grid-column:1/-1;grid-row:1}
 #shell #settings-panel .settings-tabs{grid-column:1;grid-row:2;flex-direction:column;justify-content:flex-start;overflow-y:auto;overflow-x:hidden;min-height:0;padding:4px;gap:4px}
 #shell #settings-panel .settings-tabs button{flex:0 0 auto;padding:9px 8px;white-space:normal;min-height:44px;font-size:.8rem;text-align:left}
 #shell #settings-panel .settings-page{grid-column:2;grid-row:2;height:100%;box-sizing:border-box}
 #shell #settings-panel .settings-section-heading{display:block}
 #shell #settings-panel .settings-section-heading p{font-size:.78rem}
 #shell #settings-panel .settings-footer{grid-column:1/-1;grid-row:3;padding-top:4px}
 #shell #settings-panel .settings-reset-confirm{grid-column:2;grid-row:2;z-index:2;align-self:end;max-height:100%;box-sizing:border-box;box-shadow:0 -15px 35px #071925b0}
 #shell #settings-panel .audio-mixer{grid-template-columns:1fr;gap:4px}
 #shell #settings-panel .audio-mixer input{margin-bottom:5px}
}
@media(orientation:landscape) and (max-width:740px){
 #shell #settings-panel .settings-dialog{grid-template-columns:116px minmax(0,1fr);gap:8px 10px}
 #shell #settings-panel .settings-cards{grid-template-columns:1fr}
}
/* Enlarged text gets a wider rail; never clip a category name to save space. */
@media(orientation:landscape) and (max-height:600px){
 #shell:is([data-text-size=large],[data-text-size=extra]) #settings-panel .settings-dialog{grid-template-columns:220px minmax(0,1fr)}
 #shell:is([data-text-size=large],[data-text-size=extra]) #settings-panel .settings-tabs button{max-width:100%;overflow-wrap:anywhere;text-align:left;justify-content:flex-start}
}
#shell #settings-panel .settings-reset-confirm:not([hidden]){display:flex;flex-direction:column;overflow:hidden}
#shell #settings-panel .settings-reset-confirm h3,#shell #settings-panel .settings-reset-confirm>div{flex-shrink:0}
#shell #settings-panel #settings-reset-scope{overflow:auto;min-height:0;overscroll-behavior:contain}
#shell #settings-panel .settings-reset-confirm>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
#shell #settings-panel .settings-reset-confirm button{width:auto;max-width:100%;margin:0;white-space:normal}
