/* Compact controls; each help button has a separate 44px touch target. */
#quick-settings-tray { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 20px; }
.qs-navigation-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 100%; }
.qs-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.qs-group-label { color: #94a3b8; font-size: .65rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.qs-setting { display: inline-flex; align-items: center; min-width: 0; }
.qs-pill-chip { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 12px; border-radius: 24px; font-family: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; background: rgba(30,41,59,.5); border: 1px solid rgba(148,163,184,.22); color: #a6b4c7; transition: transform .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease; }
.qs-pill-chip svg, .qs-help-button svg { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.qs-pill-chip.active { background: rgba(56,189,248,.14); border-color: rgba(56,189,248,.5); color: #7dd3fc; box-shadow: 0 0 10px rgba(56,189,248,.1); }
.pill-dot { width: 5px; height: 5px; flex-shrink: 0; border-radius: 50%; background: #64748b; }
.qs-pill-chip.active .pill-dot { background: #38bdf8; box-shadow: 0 0 5px rgba(56,189,248,.6); }
.qs-pill-chip:disabled { cursor: default; border-style: dashed; color: #bae6fd; }
.qs-pill-copy { display: flex; flex-direction: column; align-items: center; line-height: 1.2; gap: 2px; }
.qs-required { font-size: .6rem; font-weight: 500; color: #bae6fd; }
.qs-required[hidden] { display: none; }
.qs-help-button { display: inline-flex; justify-content: center; align-items: center; width: 44px; height: 44px; flex-shrink: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #94a3b8; cursor: pointer; transition: color .18s ease, background-color .18s ease; }
.qs-help-button[aria-expanded="true"] { color: #d8b4fe; background: rgba(168,85,247,.12); }
.qs-pill-chip:focus-visible, .qs-help-button:focus-visible, .qs-help-close:focus-visible, #quick-settings-toggle-btn:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 3px; }
#quick-settings-toggle-btn { min-height: 44px; }
#search-newtab-btn:not(.collapsed) { min-height: 44px; }
.qs-help-popover { position: fixed; z-index: 10000; width: 296px; padding: 13px 15px; border: 1px solid rgba(192,132,252,.38); border-radius: 14px; background: rgba(25,19,44,.97); color: #e9d5ff; box-shadow: 0 10px 28px rgba(0,0,0,.4); font-family: inherit; font-size: .78rem; line-height: 1.55; overflow-y: auto; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .14s ease, transform .14s ease; }
.qs-help-popover[hidden] { display: none; }
.qs-help-popover.is-open { pointer-events: auto; opacity: 1; transform: translateY(0); }
.qs-help-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.qs-help-title { font-size: .8rem; color: #f3e8ff; font-weight: 600; }
.qs-help-close { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; margin: -9px -9px -5px 0; border: 0; border-radius: 10px; color: #d8b4fe; background: transparent; font-size: 1.3rem; cursor: pointer; }
@media (hover: hover) { .qs-pill-chip:not(:disabled):hover { border-color: #38bdf8; transform: translateY(-1px); } .qs-help-button:hover, .qs-help-close:hover { color: #e9d5ff; background: rgba(168,85,247,.12); } }
@media (max-width: 420px) { #quick-settings-tray { gap: 10px; } .qs-pill-chip { padding: 8px 9px; gap: 5px; font-size: .72rem; } .qs-controls { gap: 2px; } }
@media (prefers-reduced-motion: reduce) { .qs-pill-chip, .qs-help-button, .qs-help-popover { transition: none; transform: none; } #quick-settings-toggle-arrow { transition: none !important; } }
.qs-help-button[hidden], .qs-panel-status:empty, [hidden].qs-editor-backdrop, .qs-editor-backdrop [hidden] { display: none; }
.qs-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.qs-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; }
.qs-header-action { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 44px; min-width: 44px; padding: 4px 7px; background: transparent; border: 0; border-radius: 10px; color: #94a3b8; font-family: inherit; font-size: .75rem; font-weight: 600; cursor: pointer; }
.qs-header-action svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.qs-header-action:hover, .qs-header-action[aria-expanded="true"] { color: #7dd3fc; background: rgba(56,189,248,.07); }
.qs-header-action:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 2px; }
.qs-panel-status, .qs-empty { flex-basis: 100%; margin: 0; color: #94a3b8; font-size: .7rem; line-height: 1.5; }
.qs-help-entry + .qs-help-entry { margin-top: 12px; }
.qs-help-entry h3 { margin: 0 0 3px; font-size: .78rem; color: #f3e8ff; }
.qs-editor-backdrop { position: fixed; inset: 0; z-index: 20000; display: flex; align-items: center; justify-content: center; background: rgba(3,7,18,.8); padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.qs-editor-card { display: flex; flex-direction: column; width: 100%; max-width: 580px; max-height: calc(100vh - 24px); max-height: min(90dvh, calc(100vh - 24px)); border: 1px solid rgba(56,189,248,.35); border-radius: 22px; background: rgba(15,23,42,.98); color: #e2e8f0; box-shadow: 0 16px 48px rgba(0,0,0,.5); font-family: inherit; font-size: .83rem; line-height: 1.5; overflow: hidden; animation: qs-editor-enter .16s ease; }
.qs-editor-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 20px 20px 12px; }
.qs-editor-header h2 { font-size: 1.16rem; color: #bae6fd; margin: 0 0 5px; }
.qs-editor-header p, .qs-editor-note { color: #94a3b8; font-size: .77rem; }
.qs-editor-body { padding: 0 20px 16px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.qs-editor-body h3 { color: #cbd5e1; font-size: .75rem; font-weight: 600; margin: 10px 0 6px; }
.qs-editor-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.qs-editor-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 6px 5px 10px; border: 1px solid rgba(148,163,184,.18); background: rgba(30,41,59,.38); border-radius: 12px; }
.qs-editor-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.qs-editor-name svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: #7dd3fc; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.qs-editor-actions { display: flex; align-items: center; flex-shrink: 0; }
.qs-editor-card button, .qs-editor-card summary { min-height: 44px; min-width: 44px; padding: 7px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #cbd5e1; font-family: inherit; font-size: .8rem; cursor: pointer; }
.qs-editor-card button:hover, .qs-editor-card summary:hover { color: #7dd3fc; background: rgba(56,189,248,.08); }
.qs-editor-card button:disabled { color: #64748b; cursor: default; background: transparent; }
.qs-editor-card button:focus-visible, .qs-editor-card summary:focus-visible, .qs-editor-card input:focus-visible, .qs-editor-card select:focus-visible { outline: 2px solid #38bdf8; outline-offset: 1px; }
.qs-editor-card .qs-editor-handle { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; font-size: 1.2rem; color: #94a3b8; }
.qs-editor-handle.is-dragging { color: #38bdf8; background: rgba(56,189,248,.16); cursor: grabbing; }
.qs-editor-row.qs-drop-before { border-top-color: #38bdf8; box-shadow: 0 -2px 0 #38bdf8; }
.qs-editor-row.qs-drop-after { border-bottom-color: #38bdf8; box-shadow: 0 2px 0 #38bdf8; }
#qs-editor-more { margin: 12px 0; }
#qs-editor-more summary { color: #7dd3fc; }
#qs-editor-available { margin-top: 6px; }
.qs-editor-info { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; cursor: pointer; }
.qs-editor-info > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.qs-editor-footer { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; border-top: 1px solid rgba(148,163,184,.15); }
.qs-editor-footer > div { display: flex; gap: 6px; margin-left: auto; }
.qs-editor-card .qs-primary { background: rgba(56,189,248,.16); color: #7dd3fc; border-color: rgba(56,189,248,.45); }
#qs-editor-conflict { margin: 0 0 10px; padding: 10px; border: 1px solid rgba(192,132,252,.35); border-radius: 12px; background: rgba(88,28,135,.15); color: #e9d5ff; }
#qs-editor-error { color: #fca5a5; }
.qs-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes qs-editor-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 480px) { .qs-editor-header { padding: 16px 12px 10px; } .qs-editor-body { padding: 0 12px 12px; } .qs-editor-row { flex-wrap: wrap; } .qs-editor-actions { margin-left: auto; } .qs-header { flex-wrap: wrap; } .qs-header-actions { margin-left: auto; } }
@media (prefers-reduced-motion: reduce) { .qs-editor-card { animation: none; } }
.qs-header-action[hidden] { display: none; }
.qs-group-heading { display: flex; align-items: center; justify-content: flex-start; gap: 4px; min-height: 20px; }
.qs-config-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-width: 44px; min-height: 44px; padding: 7px; border: 0; border-radius: 12px; color: #94a3b8; background: transparent; font-family: inherit; font-size: .75rem; cursor: pointer; }
.qs-config-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.qs-config-button:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 2px; }
.qs-context-card { max-width: 440px; }
.qs-context-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 4px 0; font-size: .82rem; color: #cbd5e1; }
.qs-context-field select { width: 54%; min-width: 0; min-height: 44px; padding: 7px; border: 1px solid rgba(148,163,184,.25); border-radius: 10px; background: #0f172a; color: #e2e8f0; font-family: inherit; font-size: 16px; }
.qs-context-field input:disabled, .qs-context-field select:disabled { opacity: .5; cursor: default; }
.qs-cloak-preview { margin: 10px 0; padding: 12px; background: rgba(56,189,248,.06); border-radius: 12px; }
.qs-cloak-preview > div { display: flex; align-items: center; gap: 8px; margin-top: 6px; overflow-wrap: anywhere; }
.qs-cloak-preview img { flex-shrink: 0; object-fit: contain; }
.qs-context-notice { color: #c4b5fd; font-size: .76rem; line-height: 1.5; margin-bottom: 10px; }
#qs-context-conflict { padding: 10px; margin-bottom: 10px; border: 1px solid rgba(192,132,252,.35); border-radius: 12px; color: #e9d5ff; }
#qs-context-error { color: #fca5a5; }
#qs-context-advanced { color: #7dd3fc; min-height: 44px; display: inline-flex; align-items: center; padding: 7px; font-size: .77rem; text-decoration: none; border-radius: 10px; }
#qs-context-advanced:focus-visible { outline: 2px solid #7dd3fc; }
@media (hover: hover) { .qs-config-button:hover { color: #7dd3fc; background: rgba(56,189,248,.08); } }

#quick-settings-tray.qs-has-widget-settings .qs-group-heading { min-height: 44px; }
/* The guide scrolls independently while its title and dismissal remain visible. */
.qs-help-guide { display: flex; flex-direction: column; overflow: hidden; padding: 16px; }
.qs-help-guide .qs-help-heading, #qs-help-intro { flex-shrink: 0; }
.qs-help-guide .qs-help-title { font-size: .95rem; }
#qs-help-intro { color: #b5a9c9; margin: 4px 0 12px; font-size: .77rem; line-height: 1.6; }
#qs-help-intro[hidden] { display: none; }
.qs-help-guide #qs-help-text { min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.qs-guide-category + .qs-guide-category { margin-top: 14px; }
.qs-guide-category h3 { margin: 0 0 5px; color: #b5a9c9; }
.qs-help-guide .qs-help-entry { margin: 0; border-bottom: 1px solid rgba(192,132,252,.12); }
.qs-help-guide summary { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 8px 4px; list-style: none; cursor: pointer; color: #f3e8ff; font-weight: 600; border-radius: 7px; }
.qs-help-guide summary::-webkit-details-marker { display: none; }
.qs-help-guide summary svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: #c4b5fd; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.qs-help-guide summary .qs-guide-arrow { width: 13px; height: 13px; margin-left: auto; transition: transform .14s ease; }
.qs-help-guide details[open] .qs-guide-arrow { transform: rotate(90deg); }
.qs-help-guide summary:focus-visible { outline: 2px solid #7dd3fc; outline-offset: -2px; }
.qs-help-guide details p { margin: 2px 4px 12px 29px; color: #d8cbe8; line-height: 1.65; overflow-wrap: anywhere; }
/* Match Settings switches without inheriting its global slider/input rules. */
.qs-switch { position: relative; display: inline-flex; width: 48px; height: 26px; flex: 0 0 48px; }
.qs-switch input[type="checkbox"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; z-index: 1; }
.qs-switch-track { position: absolute; inset: 0; border: 1px solid #64748b; border-radius: 30px; background: #334155; pointer-events: none; transition: background-color .16s ease, border-color .16s ease; }
.qs-switch-track::before { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: #cbd5e1; transition: transform .16s ease; }
.qs-switch input:checked + .qs-switch-track { background: #0284c7; border-color: #38bdf8; }
.qs-switch input:checked + .qs-switch-track::before { transform: translateX(22px); background: #fff; }
.qs-switch input:focus-visible + .qs-switch-track { outline: 2px solid #7dd3fc; outline-offset: 3px; }
.qs-switch input:disabled { cursor: default; }
.qs-switch input:disabled + .qs-switch-track { opacity: .5; }
@media (hover: hover) { .qs-switch input:not(:disabled):hover + .qs-switch-track { border-color: #7dd3fc; } }
@media (prefers-reduced-motion: reduce) { .qs-switch-track, .qs-switch-track::before { transition: none; } }
@media (forced-colors: active) {
  .qs-switch input[type="checkbox"] { opacity: 1; appearance: auto; accent-color: auto; }
  .qs-switch-track { display: none; }
}
.qs-context-field input[type="text"] { width: 54%; min-width: 0; min-height: 44px; height: auto; padding: 7px; border: 1px solid rgba(148,163,184,.25); border-radius: 10px; background: #0f172a; color: #e2e8f0; font-family: inherit; font-size: 16px; cursor: text; }
#qs-context-master-link[hidden] { display: none; }
#qs-context-master-link { display: inline-flex; align-items: center; min-height: 44px; color: #7dd3fc; font-size: .8rem; }
.qs-pill-chip:disabled:not(.active) { color: #94a3b8; }
@media (hover: hover) { .qs-help-guide summary:hover { background: rgba(168,85,247,.08); } }
@media (prefers-reduced-motion: reduce) { .qs-help-guide summary .qs-guide-arrow { transition: none; } }

/* Native scrollbars, scoped to the actual Quick Settings scrolling surfaces. */
.qs-editor-body, .qs-help-popover:not(.qs-help-guide), .qs-help-guide #qs-help-text {
  --qs-scroll-thumb: #64748b;
  color-scheme: dark;
  scrollbar-width: thin;
  scrollbar-color: var(--qs-scroll-thumb) transparent;
  scrollbar-gutter: stable;
}
.qs-editor-body::-webkit-scrollbar, .qs-help-popover:not(.qs-help-guide)::-webkit-scrollbar, .qs-help-guide #qs-help-text::-webkit-scrollbar { width: 8px; height: 8px; }
.qs-editor-body::-webkit-scrollbar-track, .qs-help-popover:not(.qs-help-guide)::-webkit-scrollbar-track, .qs-help-guide #qs-help-text::-webkit-scrollbar-track { background: transparent; margin-block: 4px; }
.qs-editor-body::-webkit-scrollbar-thumb, .qs-help-popover:not(.qs-help-guide)::-webkit-scrollbar-thumb, .qs-help-guide #qs-help-text::-webkit-scrollbar-thumb { background: var(--qs-scroll-thumb); border: 2px solid transparent; border-radius: 10px; background-clip: padding-box; }
.qs-editor-body:focus-within, .qs-help-popover:not(.qs-help-guide):focus-within, .qs-help-guide #qs-help-text:focus-within { --qs-scroll-thumb: #38bdf8; }
@media (hover: hover) {
  .qs-editor-body:hover, .qs-help-popover:not(.qs-help-guide):hover, .qs-help-guide #qs-help-text:hover { --qs-scroll-thumb: #38bdf8; }
}
@media (forced-colors: active) {
  .qs-editor-body, .qs-help-popover:not(.qs-help-guide), .qs-help-guide #qs-help-text { scrollbar-color: auto; }
}
/* Purple information surfaces share native scrollbar geometry, not editor colors. */
.qs-help-popover:not(.qs-help-guide), .qs-help-guide #qs-help-text { --qs-scroll-thumb: #8975a5; }
.qs-help-guide #qs-help-text { padding-right: 5px; }
.qs-help-popover:not(.qs-help-guide):focus-within, .qs-help-guide #qs-help-text:focus-within { --qs-scroll-thumb: #c084fc; }
@media (hover: hover) { .qs-help-popover:not(.qs-help-guide):hover, .qs-help-guide #qs-help-text:hover { --qs-scroll-thumb: #c084fc; } }
/* Only the homepage viewport; leave Settings and other scrolling regions alone. */
html.qs-homepage { color-scheme: dark; scrollbar-width: thin; scrollbar-color: #475569 #030712; }
html.qs-homepage::-webkit-scrollbar { width: 8px; height: 8px; }
html.qs-homepage::-webkit-scrollbar-track { background: #030712; }
html.qs-homepage::-webkit-scrollbar-thumb { background: #475569; border: 2px solid #030712; border-radius: 10px; }
html.qs-homepage::-webkit-scrollbar-thumb:hover { background: #64748b; }
@media (forced-colors: active) { html.qs-homepage { scrollbar-color: auto; } }
/* Consistent compact forms and a fixed, wrapping footer above the scrolling body. */
.qs-context-field > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.qs-context-form-field { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 0; }
.qs-context-form-field select, .qs-context-form-field input[type="text"] { width: 100%; }
.qs-context-card .qs-editor-header, .qs-context-card .qs-editor-footer { flex-shrink: 0; }
.qs-context-card .qs-editor-body { min-height: 0; }
.qs-context-card .qs-editor-header p { margin: 0; line-height: 1.5; }
.qs-context-card .qs-editor-body h3 { color: #94a3b8; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; margin: 14px 0 6px; }
.qs-context-card .qs-editor-body h3:first-child { margin-top: 2px; }
.qs-context-card .qs-editor-note { margin: 12px 0 0; line-height: 1.6; }
.qs-context-card select:focus-visible, .qs-context-card input[type="text"]:focus-visible { outline-offset: 2px; }
.qs-context-card .qs-editor-footer { background: rgba(15,23,42,.98); }
/* The same native pool chips serve Settings and the staged quick editor. */
.cloak-pool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 6px; }
.cloak-pool-chip { display: flex; align-items: center; gap: 7px; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid rgba(148,163,184,.22); border-radius: 12px; color: #94a3b8; background: rgba(30,41,59,.5); font: inherit; font-size: .8rem; cursor: pointer; }
.cloak-pool-chip img { flex-shrink: 0; object-fit: contain; border-radius: 3px; }
.cloak-pool-chip > span:not(.cloak-pool-mark) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloak-pool-chip .cloak-pool-mark { margin-left: auto; flex-shrink: 0; }
.cloak-pool-chip[aria-pressed="true"], .qs-editor-card .cloak-pool-chip[aria-pressed="true"] { color: #bae6fd; border-color: rgba(56,189,248,.45); background: rgba(56,189,248,.14); }
.cloak-pool-chip:focus-visible { outline: 2px solid #38bdf8; outline-offset: 1px; }
#qs-context-pool { margin-top: 12px; }
#qs-context-pool summary { color: #7dd3fc; }
#qs-context-pool-count { color: #94a3b8; font-size: .72rem; margin-left: 6px; }
.qs-pool-actions { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
#qs-context-pool-note { margin-top: 8px; }
