/* Settings — compact, grouped layout (October 2026). Presentation only: every control keeps its
   data-el / data-act hook. Shared by the website and the Windows desktop app; wide screens get a
   section list and cards side by side, phones and tablets one column with touch-size buttons. */

.panel-page[data-panel-view="settings"] { padding: 0.7rem 1rem 1rem; }
.panel-page[data-panel-view="settings"] > .panel-page-head { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 0.35rem; }
.panel-page[data-panel-view="settings"] > .panel-page-head h2 { margin: 0; font-size: 1.3rem; }
.panel-page[data-panel-view="settings"] > .panel-page-head .panel-back-btn { min-height: 2rem; padding: 0.25rem 0.8rem; }
.panel-page[data-panel-view="settings"] > .subtitle { margin: 0 0 0.45rem; font-size: 0.8rem; }

/* ---- sections ------------------------------------------------------------------------------------------- */
.settings-layout { display: block; min-width: 0; }
.settings-nav { display: none; }
@media (min-width: 1280px) {
  .settings-layout { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; padding-top: 0.3rem; }
}
.settings-nav-link {
  appearance: none; background: none; border: 0; border-left: 2px solid transparent; border-radius: 0 6px 6px 0;
  padding: 0.38rem 0.6rem; text-align: left; cursor: pointer;
  color: var(--text-muted, #b9a88a); font: 650 0.84rem/1.25 var(--font-ui, system-ui, sans-serif);
}
.settings-nav-link:hover, .settings-nav-link:focus-visible { color: var(--text-primary, #f3ebd8); border-left-color: var(--accent-gold, #d4af37); background: rgba(212, 175, 55, 0.08); outline: none; }

.settings-form.settings-form--grouped,
.panel-page[data-panel-view="settings"] .settings-form.settings-form--grouped { max-width: none; margin-top: 0.15rem; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.settings-group { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; scroll-margin-top: 0.5rem; }
.settings-group-title {
  margin: 0; padding-bottom: 0.3rem; border-bottom: 1px solid rgba(212, 175, 55, 0.22);
  color: var(--accent-gold, #d4af37); font: 800 0.76rem/1.2 var(--font-ui, system-ui, sans-serif); letter-spacing: 0.12em; text-transform: uppercase;
}
/* Cards side by side when there is room (two on a laptop, three on a wide monitor). */
.settings-group-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 29rem), 1fr)); gap: 0.75rem; align-items: start; min-width: 0; }
.settings-group-body > .settings-skin-row { grid-column: 1 / -1; }
/* A section with one card doesn't stretch it across a wide window. */
.settings-group-body > .settings-card:only-child,
.settings-group-body > section:only-child { max-width: 62rem; }

/* ---- skins: a dense grid of small cards ---------------------------------------------------------------------- */
.settings-form--grouped .settings-skin-row { display: flex; flex-direction: column; gap: 0.4rem; }
.settings-form--grouped .settings-skin-row > .settings-label { font-size: 0.86rem; font-weight: 650; }
.settings-form--grouped .skin-chooser { grid-template-columns: repeat(auto-fill, minmax(9.6rem, 1fr)) !important; gap: 0.5rem !important; }
.settings-form--grouped .skin-card { padding: 0.4rem; gap: 0.28rem; }
.settings-form--grouped .skin-card h4 { font-size: 0.8rem; line-height: 1.2; }
.settings-form--grouped .skin-card p { font-size: 0.66rem; min-height: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.settings-form--grouped .skin-card-meta { font-size: 0.52rem; gap: 0.2rem; }
.settings-form--grouped .skin-card-meta span { padding: 0.06rem 0.32rem; }
.settings-form--grouped .skin-card-actions { gap: 0.3rem; }
.settings-form--grouped .skin-card-actions .btn { min-height: 1.65rem; font-size: 0.6rem; padding: 0 0.3rem; }

/* ---- rows: label on the left, the control as wide as it needs --------------------------------------------------- */
.settings-form--grouped .settings-card { padding: 0.7rem 0.85rem; border-radius: 10px; }
.settings-form--grouped .settings-display-card { display: grid; gap: 0.15rem; }
.settings-form--grouped .settings-row.settings-row--inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 2.15rem; }
.settings-form--grouped .settings-row--inline .settings-label { font-size: 0.88rem; font-weight: 650; }
.settings-form--grouped .settings-row--inline select { width: auto; min-width: 9.5rem; max-width: 15rem; font-size: 0.88rem; }
.settings-form--grouped .settings-row--inline .settings-range { flex: 0 1 15rem; min-width: 9rem; }
.settings-form--grouped .settings-display-card .settings-actions { margin-top: 0.3rem; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* Dropdowns at the size of the rows they sit in. */
.settings-form--grouped select { font-size: 0.86rem; padding-top: 0.3rem; padding-bottom: 0.3rem; min-height: 2rem; height: auto; }
.settings-form--grouped .settings-choice-card select { max-width: min(100%, 18rem); }

/* ---- cards: tighter ------------------------------------------------------------------------------------------------ */
.settings-form--grouped .settings-card-head { gap: 0.75rem; }
.settings-form--grouped .settings-card-head h3 { font-size: 1.05rem; margin: 0.1rem 0 0.15rem; }
.settings-form--grouped .settings-card-head h4 { font-size: 0.98rem; margin: 0.1rem 0 0.15rem; }
.settings-form--grouped .settings-card-head .subtitle { font-size: 0.78rem; }
.settings-form--grouped .settings-quick-grid { grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 0.5rem; margin-top: 0.55rem; }
.settings-form--grouped .settings-choice-card { padding: 0.5rem 0.6rem; }
.settings-form--grouped .settings-subsection { margin-top: 0.65rem; padding-top: 0.55rem; }
.settings-form--grouped .settings-subsection-head { margin-bottom: 0.45rem; }
.settings-form--grouped .settings-range-grid { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.5rem; }
.settings-form--grouped .settings-slider-card { padding: 0.5rem 0.6rem; }
.settings-form--grouped .settings-advanced { margin-top: 0.5rem; }
.settings-form--grouped .settings-save-badge,
.settings-form--grouped .settings-current-view,
.settings-form--grouped .settings-recommended { padding: 0.2rem 0.45rem; font-size: 0.66rem; }

/* Interface view: a compact choice, not three full-width buttons. */
.settings-form--grouped .settings-view-options { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.settings-form--grouped .settings-view-options .btn { flex: 0 0 auto; width: auto; min-width: 6.5rem; min-height: 2rem; }

/* Controllers */
.settings-form--grouped .controllers-settings { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.settings-form--grouped > .settings-group > .settings-group-body > .controllers-settings { padding: 0.65rem 0.85rem; border: 1px solid rgba(212, 175, 55, 0.26); border-radius: 10px; background: rgba(12, 10, 8, 0.72); }
.settings-form--grouped .settings-controllers-card .subtitle,
.settings-form--grouped .settings-account-card .subtitle { margin: 0 0 0.45rem; font-size: 0.78rem; line-height: 1.4; }

/* ---- phones and tablets ------------------------------------------------------------------------------------------- */
[data-studio-shell="mobile"] .settings-form--grouped .skin-chooser { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)) !important; }
@media (max-width: 420px) {
  .settings-form--grouped .skin-chooser { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .settings-form--grouped .settings-row.settings-row--inline { flex-wrap: wrap; }
}
/* Touch screens keep finger-size buttons. */
@media (pointer: coarse) {
  .settings-form--grouped .skin-card-actions .btn,
  .settings-form--grouped .settings-view-options .btn,
  .settings-nav-link { min-height: 44px; }
  .settings-form--grouped .settings-row--inline select { min-height: 40px; }
}

/* Settings → a skin's Preview: its picture, large, over the page (0.5.5). */
.skin-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(6, 5, 4, 0.78);
  backdrop-filter: blur(3px);
}
.skin-preview-dialog {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(1280px, 100%);
  max-height: 100%;
  padding: 0.75rem;
  background: linear-gradient(180deg, #1c1811, #120f0b);
  border: 1px solid rgba(199, 154, 58, 0.45);
  border-radius: 14px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.65);
  color: #f3ead7;
}
.skin-preview-image {
  display: block;
  width: 100%;
  min-height: 0;
  max-height: calc(100vh - 9rem);
  max-height: calc(100dvh - 9rem);
  object-fit: contain;
  border-radius: 8px;
  background: #000;
}
.skin-preview-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.skin-preview-text {
  flex: 1 1 16rem;
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}
.skin-preview-text small {
  color: rgba(243, 234, 215, 0.72);
  line-height: 1.35;
}
.skin-preview-bar [data-act="skin-preview-apply"]:not(:disabled) {
  background: linear-gradient(135deg, #d4af37, #b8891f);
  border-color: transparent;
  color: #1a1205;
  font-weight: 700;
}
@media (max-width: 600px) {
  .skin-preview-overlay { padding: 0.5rem; }
  .skin-preview-bar .btn { flex: 1 1 auto; min-height: 44px; }
}

/* Decks: RESTART (play from the beginning), next to ⏮ (0.5.6). */
.btn.btn-restart-play {
  flex: 0 0 auto;
}
/* Phones: ⏮ Start and ↻ Restart share the first row of the deck's secondary buttons. */
[data-studio-shell="mobile"] .md-secondary .btn.btn-restart {
  grid-column: auto;
}

/* ==== Settings panel (November 2026) ===========================================================================
   One panel for every skin, the mobile shell and the Windows desktop app (studio.js _settingsPanelHtml).
   Header + category list stay put, only the pane scrolls. Dark fields everywhere, gold for focus and the
   active category. Narrow panels: categories become icons, then a dropdown (container queries on .sx). */
.panel-page[data-panel-view="settings"] { padding: 0.75rem 1rem 0.75rem; }
.sx {
  --sx-bg: #0d0d0f; --sx-surface: #141416; --sx-surface-2: #1c1c20; --sx-line: #2c2c31; --sx-line-soft: #212125;
  --sx-text: #ece9e4; --sx-muted: #a29e97; --sx-gold: #d9a935; --sx-gold-2: #f1c75a; --sx-gold-ink: #1b1406;
  --sx-gold-soft: rgba(217, 169, 53, 0.14); --sx-field: #0f0f11; --sx-h-ctl: 2.25rem;
  container-type: inline-size;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  height: var(--sx-h, calc(100vh - 9rem)); min-height: 20rem;
  width: 100%; max-width: 76rem; margin: 0 auto; overflow: hidden;
  background: var(--sx-bg); color: var(--sx-text);
  border: 1px solid var(--sx-line); border-radius: 14px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  font: 400 0.875rem/1.4 var(--font-ui, "Segoe UI", system-ui, -apple-system, sans-serif);
  text-align: left;
}
.sx *, .sx *::before, .sx *::after { box-sizing: border-box; }

/* header */
.sx-head { display: flex; align-items: center; gap: 0.9rem; padding: 0.75rem 1rem; background: var(--sx-surface); border-bottom: 1px solid var(--sx-line); min-width: 0; }
.sx-title { display: flex; flex-direction: column; flex: none; }
.sx-eyebrow { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sx-gold); }
.sx .sx-title h2 { margin: 0; padding: 0; border: 0; background: none; font: 750 1.2rem/1.15 var(--font-ui, "Segoe UI", system-ui, -apple-system, sans-serif) !important; color: var(--sx-text) !important; -webkit-text-fill-color: currentColor; letter-spacing: -0.01em !important; text-transform: none !important; text-shadow: none !important; }
.sx-search { position: relative; flex: 1 1 auto; max-width: 26rem; min-width: 0; }
.sx-search svg { position: absolute; left: 0.7rem; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); fill: none; stroke: var(--sx-muted); stroke-width: 2; pointer-events: none; }
.sx .sx-search input[type="search"] { width: 100%; padding-left: 2.1rem !important; }
.sx-saved { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--sx-muted); font-size: 0.75rem; white-space: nowrap; }
.sx-saved::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3fbf7f; }
.sx .sx-close {
  flex: none; width: var(--sx-h-ctl); height: var(--sx-h-ctl); min-height: 0; padding: 0; display: inline-grid; place-items: center;
  border: 1px solid var(--sx-line); border-radius: 8px; background: transparent; color: var(--sx-text); font-size: 1rem; line-height: 1; cursor: pointer;
}
.sx .sx-close:hover { border-color: var(--sx-gold); color: var(--sx-gold-2); }
.sx-saved + .sx-close { margin-left: 0; }
.sx-search + .sx-close { margin-left: auto; }

/* body: categories + pane */
.sx-body { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); min-height: 0; }
.sx-nav { display: flex; flex-direction: column; gap: 2px; padding: 0.6rem 0.5rem; background: var(--sx-surface); border-right: 1px solid var(--sx-line); overflow-y: auto; min-height: 0; }
.sx .sx-tab {
  position: relative; display: flex; align-items: center; gap: 0.65rem; width: 100%; min-height: 2.4rem; margin: 0; padding: 0 0.75rem;
  border: 0; border-left: 2px solid transparent; border-radius: 8px; background: transparent; box-shadow: none;
  color: #cfcbc4; font: inherit; font-size: 0.86rem; font-weight: 500; text-align: left; cursor: pointer; text-transform: none; letter-spacing: 0;
}
.sx .sx-tab:hover { background: var(--sx-surface-2); color: var(--sx-text); }
.sx .sx-tab[aria-selected="true"] { background: linear-gradient(90deg, rgba(217, 169, 53, 0.2), rgba(217, 169, 53, 0.04)); border-left-color: var(--sx-gold); color: var(--sx-text); font-weight: 650; }
.sx .sx-tab[aria-selected="true"] .sx-ico { stroke: var(--sx-gold-2); opacity: 1; }
.sx.is-searching .sx-tab[aria-selected="true"] { background: transparent; border-left-color: transparent; font-weight: 500; }
.sx-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: 0.8; }
.sx-tab-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-navsel { display: none; }
.sx-pane { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.25rem 1.75rem 2rem; scrollbar-color: #4a3c18 transparent; }

/* categories, sections, rows */
.sx-cat[hidden], .sx .sx-miss { display: none !important; }
.sx-cat-head { padding: 1.1rem 0 0.15rem; }
.sx-cat-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--sx-text); }
.sx-cat-head p { margin: 0.15rem 0 0; color: var(--sx-muted); font-size: 0.8rem; }
.sx.is-searching .sx-cat-head { padding-top: 1.25rem; }
.sx.is-searching .sx-cat-head h3 { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sx-gold); }
.sx.is-searching .sx-cat-head p { display: none; }
.sx-results { margin: 0.9rem 0 0; color: var(--sx-muted); font-size: 0.8rem; }
.sx-results:empty { display: none; }
.sx-empty { margin: 2.5rem 0; text-align: center; color: var(--sx-muted); }
.sx-sec { margin-top: 1.15rem; }
.sx-sec-h { display: flex; align-items: center; gap: 0.5rem; min-height: 1.6rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--sx-line); }
.sx-sec-h h4 { margin: 0; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sx-muted); }
.sx-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.4rem 1.5rem; padding: 0.7rem 0; border-bottom: 1px solid var(--sx-line-soft); min-width: 0; }
.sx-sec > .sx-row:last-child { border-bottom: 0; }
.sx-row--wide, .sx-row--card { grid-template-columns: minmax(0, 1fr); }
.sx-row--card { padding: 0.8rem 0; }
.sx-row-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.sx-label-line { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.sx-label { font-size: 0.86rem; font-weight: 650; color: var(--sx-text); overflow-wrap: anywhere; }
.sx-desc { color: var(--sx-muted); font-size: 0.76rem; line-height: 1.4; overflow-wrap: anywhere; }
.sx-desc code { padding: 0 0.3rem; border-radius: 4px; background: #1f1f23; color: #ddd8cf; font-size: 0.72rem; }
.sx-ctl { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; min-width: 0; }
.sx-row--wide > .sx-ctl { justify-content: flex-start; }
.sx-note { margin: 0.7rem 0 0; padding: 0.55rem 0.75rem; border: 1px solid #3b3122; border-radius: 8px; background: rgba(217, 169, 53, 0.06); color: #ddd2bb; font-size: 0.78rem; }
.sx-note[hidden], .sx.is-searching .sx-note { display: none; }

/* badges, chips, help */
.sx-badge { padding: 0.1rem 0.4rem; border: 1px solid #304262; border-radius: 5px; background: rgba(80, 130, 220, 0.12); color: #a9c8ff; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.sx-chip, .sx .controllers-settings .chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.55rem; border: 1px solid var(--sx-line); border-radius: 999px; background: transparent; color: var(--sx-muted); font-family: inherit; font-size: 0.72rem; font-weight: 600; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.sx-chip--gold { color: var(--sx-gold-2); border-color: #5a4515; background: var(--sx-gold-soft); }
.sx-chip--ok { color: #9fe3bf; border-color: #23573d; }
.sx-chip--ok::before { content: "✓"; }
.sx-chip--warn { color: #f3c36b; border-color: #5a4515; }
.sx-chip--warn::before { content: "!"; font-weight: 900; }
.sx-help { display: inline-grid; place-items: center; width: 1rem; height: 1rem; border: 1px solid var(--sx-line); border-radius: 50%; color: var(--sx-muted); font-size: 0.62rem; font-weight: 800; cursor: help; }
.sx-help:hover, .sx-help:focus-visible { border-color: var(--sx-gold); color: var(--sx-gold-2); }

/* fields: one dark style for every input, select and textarea in Settings (host cards included) */
.sx select, .sx textarea, .sx .sx-field,
.sx input:not([type]), .sx input[type="text"], .sx input[type="search"], .sx input[type="number"], .sx input[type="email"], .sx input[type="url"], .sx input[type="password"] {
  height: var(--sx-h-ctl); min-height: var(--sx-h-ctl); max-width: 100%; margin: 0; padding: 0 0.7rem;
  background-color: var(--sx-field) !important; color: var(--sx-text) !important; border: 1px solid var(--sx-line) !important; border-radius: 8px !important;
  box-shadow: none !important; color-scheme: dark; font: inherit; font-size: 0.82rem; line-height: normal;
}
.sx textarea { height: auto; min-height: 5rem; padding: 0.5rem 0.7rem; }
.sx select {
  padding-right: 1.9rem; appearance: none; -webkit-appearance: none; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--sx-muted) 50%), linear-gradient(135deg, var(--sx-muted) 50%, transparent 50%) !important;
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52% !important; background-size: 5px 5px !important; background-repeat: no-repeat !important;
}
.sx select option, .sx select optgroup { background: #141416; color: var(--sx-text); }
.sx select:hover, .sx input:hover, .sx textarea:hover { border-color: #45454c !important; }
.sx input::placeholder, .sx textarea::placeholder { color: #77736c; opacity: 1; }
.sx-w-sm { width: 9.5rem; }
.sx-w-md { width: 13.5rem; }
.sx-w-lg { width: 20rem; }
.sx-host select { width: 20rem; }

/* focus: a visible gold ring on everything you can reach with the keyboard */
.sx :is(a, button, input, select, textarea, summary, [tabindex]):focus { outline: none; }
.sx :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--sx-gold-2) !important; outline-offset: 2px; }
.sx :is(input, select, textarea):focus-visible { border-color: var(--sx-gold) !important; outline-offset: 1px; }

/* switch: the studio's checkbox, drawn as a switch; ON / OFF is written, not only coloured */
.sx-sw { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; user-select: none; }
.sx .sx-switch { position: absolute; left: 0; top: 50%; z-index: 1; width: 2.4rem; height: 1.4rem; margin: 0; transform: translateY(-50%); opacity: 0; cursor: pointer; }
.sx-sw-track { position: relative; width: 2.4rem; height: 1.4rem; flex: none; border: 1px solid #3c3c42; border-radius: 999px; background: #2a2a2f; transition: background 0.15s, border-color 0.15s; }
.sx-sw-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.4rem - 6px); height: calc(1.4rem - 6px); border-radius: 50%; background: #c4c0b9; transition: transform 0.15s; }
.sx-switch:checked + .sx-sw-track { background: var(--sx-gold); border-color: var(--sx-gold); }
.sx-switch:checked + .sx-sw-track::after { transform: translateX(1rem); background: var(--sx-gold-ink); }
.sx-switch:focus-visible + .sx-sw-track { outline: 2px solid var(--sx-gold-2); outline-offset: 2px; }
.sx-sw-state { width: 1.9rem; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; color: var(--sx-muted); }
.sx-sw-state::before { content: "OFF"; }
.sx-switch:checked ~ .sx-sw-state { color: var(--sx-gold-2); }
.sx-switch:checked ~ .sx-sw-state::before { content: "ON"; }
@media (prefers-reduced-motion: reduce) { .sx-sw-track, .sx-sw-track::after { transition: none; } }

/* sliders */
.sx-range { display: inline-flex; align-items: center; gap: 0.6rem; width: 16rem; max-width: 100%; }
.sx .sx-range input[type="range"] { flex: 1 1 auto; width: auto; min-width: 0; height: 1.4rem; margin: 0; accent-color: var(--sx-gold); background: transparent; }
.sx-range-out { min-width: 3.4rem; text-align: right; font-variant-numeric: tabular-nums; font-size: 0.8rem; font-weight: 650; color: var(--sx-gold-2); }

/* buttons: primary (gold), secondary (dark outline), destructive (red, only where needed) */
.sx .sx-btn, .sx .sx-host .btn, .sx .sx-details > summary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; width: auto; height: var(--sx-h-ctl); min-height: var(--sx-h-ctl); margin: 0; padding: 0 0.9rem;
  border: 1px solid var(--sx-line); border-radius: 8px; background: transparent; box-shadow: none; color: var(--sx-text);
  font: inherit; font-size: 0.8rem; font-weight: 650; letter-spacing: 0; text-transform: none; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.sx .sx-btn:hover, .sx .sx-host .btn:hover, .sx .sx-details > summary:hover { border-color: #4a4a51; background: var(--sx-surface-2); color: var(--sx-text); }
.sx .sx-btn--primary, .sx .controllers-settings .btn-gold, .sx .controllers-settings .ctrl-btn--primary {
  border-color: var(--sx-gold); background: linear-gradient(180deg, var(--sx-gold-2), var(--sx-gold)); color: var(--sx-gold-ink);
}
.sx .sx-btn--primary:hover, .sx .controllers-settings .btn-gold:hover, .sx .controllers-settings .ctrl-btn--primary:hover { background: linear-gradient(180deg, #f6d57a, #e0b345); color: var(--sx-gold-ink); }
.sx .sx-btn--danger { border-color: #6b2a26; color: #ffb3ad; }
.sx .sx-btn--danger:hover { background: rgba(224, 88, 79, 0.12); border-color: #e0584f; }
.sx .sx-btn:disabled, .sx .sx-host .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.sx .controllers-settings .btn-gold, .sx .controllers-settings .ctrl-btn {
  height: var(--sx-h-ctl); min-height: var(--sx-h-ctl); padding: 0 0.9rem; border-radius: 8px; font-size: 0.8rem; font-weight: 700; width: auto;
}
.sx .sx-reset { margin-left: auto; padding: 0.15rem 0.3rem; border: 0; background: transparent; color: var(--sx-muted); font: inherit; font-size: 0.74rem; font-weight: 600; cursor: pointer; min-height: 0; height: auto; width: auto; box-shadow: none; }
.sx .sx-reset:hover { color: var(--sx-gold-2); background: transparent; }

/* segmented choice (Interface view): the chosen one is ticked, not only coloured */
.sx-seg { display: inline-flex; max-width: 100%; border: 1px solid var(--sx-line); border-radius: 8px; overflow: hidden; }
.sx .sx-seg-btn { height: 2.1rem; min-height: 0; margin: 0; padding: 0 0.8rem; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--sx-muted); font: inherit; font-size: 0.8rem; font-weight: 650; cursor: pointer; width: auto; }
.sx .sx-seg-btn + .sx-seg-btn { border-left: 1px solid var(--sx-line); }
.sx .sx-seg-btn:hover { background: var(--sx-surface-2); color: var(--sx-text); }
.sx .sx-seg-btn[aria-pressed="true"] { background: var(--sx-gold-soft); color: var(--sx-gold-2); }
.sx .sx-seg-btn[aria-pressed="true"]::before { content: "✓ "; }

/* DJ Controllers card */
.sx-ctl-card { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem 0.9rem; margin-top: 0.9rem; padding: 0.85rem 1rem; border: 1px solid var(--sx-line); border-radius: 12px; background: var(--sx-surface); }
.sx-ctl-ico { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; flex: none; border-radius: 10px; background: var(--sx-gold-soft); }
.sx-ctl-ico .sx-ico { width: 22px; height: 22px; stroke: var(--sx-gold-2); opacity: 1; }
.sx-ctl-main { flex: 1 1 12rem; min-width: 0; }
.sx-ctl-name { font-size: 0.95rem; font-weight: 700; overflow-wrap: anywhere; }
.sx-ctl-card:not(.is-connected) .sx-ctl-name { color: var(--sx-muted); font-weight: 600; }
.sx-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }
.sx-chips:empty { display: none; }
.sx .controllers-settings, .sx .ctrl-settings-entry { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; border: 0; background: none; }
.sx .ctrl-settings-entry .ctrl-muted { display: none; }

/* web audio facts, details, links */
.sx-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.5rem; }
.sx-info > div { padding: 0.5rem 0.7rem; border: 1px solid var(--sx-line-soft); border-radius: 8px; background: var(--sx-surface); }
.sx-info span { display: block; color: var(--sx-muted); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.sx-info b { font-size: 0.88rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.sx-details > summary { list-style: none; }
.sx-details > summary::-webkit-details-marker { display: none; }
.sx-details[open] > summary { margin-bottom: 0.5rem; }
.sx .settings-scratch-diag-pre { max-height: 16rem; overflow: auto; margin: 0; padding: 0.6rem 0.75rem; border: 1px solid var(--sx-line); border-radius: 8px; background: var(--sx-field); color: #d9d4ca; font: 0.72rem/1.45 ui-monospace, Consolas, Menlo, monospace; white-space: pre-wrap; }
.sx-links { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin: 0; }
.sx-links a { color: var(--sx-gold-2); font-size: 0.8rem; text-decoration: none; }
.sx-links a:hover { text-decoration: underline; }

/* host cards (desktop app: Audio Output, This PC, Updates, Second monitor) */
.sx-host { min-width: 0; }
.sx-host > .settings-card, .sx-host > section {
  margin: 0; padding: 0.85rem 1rem; border: 1px solid var(--sx-line); border-radius: 12px; background: var(--sx-surface); color: var(--sx-text); box-shadow: none; max-width: none;
}
.sx-host .settings-card-head h3, .sx-host .settings-card-head h4 { margin: 0.1rem 0; font-size: 0.95rem; color: var(--sx-text); }
.sx-host .settings-eyebrow { color: var(--sx-gold); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.sx-host .settings-label { color: var(--sx-text); font-size: 0.82rem; font-weight: 650; }
.sx-host p, .sx-host .subtitle, .sx-host small { color: var(--sx-muted); }
.sx-host .subtitle, .sx-host p { font-size: 0.8rem; line-height: 1.45; }
/* the host cards' own checkboxes, drawn as switches: the knob's side shows the state, not only its colour */
.sx-host input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 2.4rem; height: 1.4rem; margin: 0 0.45rem 0 0; vertical-align: middle;
  border: 1px solid #3c3c42; border-radius: 999px; background: #2a2a2f; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.sx-host input[type="checkbox"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.4rem - 6px); height: calc(1.4rem - 6px); border-radius: 50%; background: #c4c0b9; transition: transform 0.15s; }
.sx-host input[type="checkbox"]:checked { background: var(--sx-gold); border-color: var(--sx-gold); }
.sx-host input[type="checkbox"]:checked::after { transform: translateX(1rem); background: var(--sx-gold-ink); }
.sx-host input[type="checkbox"]:disabled { opacity: 0.45; cursor: not-allowed; }

/* skins chooser */
.sx .skin-chooser { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.6rem, 1fr)) !important; gap: 0.5rem !important; width: 100%; }
.sx .skin-card { padding: 0.4rem; gap: 0.28rem; }
.sx .skin-card h4 { font-size: 0.8rem; line-height: 1.2; }
.sx .skin-card p { font-size: 0.66rem; min-height: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sx .skin-card-meta { font-size: 0.52rem; gap: 0.2rem; }
.sx .skin-card-meta span { padding: 0.06rem 0.32rem; }
.sx .skin-card-actions { gap: 0.3rem; }
.sx .skin-card-actions .btn { min-height: 1.65rem; font-size: 0.6rem; padding: 0 0.3rem; }

/* narrower panels: icon categories */
@container (max-width: 860px) {
  .sx-body { grid-template-columns: 3.5rem minmax(0, 1fr); }
  .sx-nav { padding: 0.5rem 0.35rem; align-items: stretch; }
  .sx .sx-tab { justify-content: center; padding: 0; min-height: 2.6rem; }
  .sx .sx-tab .sx-ico { width: 18px; height: 18px; }
  .sx-tab-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sx-saved { display: none; }
  .sx-pane { padding: 0.25rem 1.25rem 1.75rem; }
  .sx-w-md { width: 12rem; }
  .sx-host select { width: 16rem; }
}
/* phones and very narrow windows: a category dropdown, controls under their labels */
@container (max-width: 600px) {
  .sx-head { flex-wrap: wrap; padding: 0.65rem 0.85rem; gap: 0.6rem; }
  .sx-title { flex: 1 1 auto; }
  .sx-search { order: 3; flex-basis: 100%; max-width: none; }
  .sx-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .sx-nav { display: none; }
  .sx-navsel { display: block; padding: 0.55rem 0.85rem; background: var(--sx-surface); border-bottom: 1px solid var(--sx-line); }
  .sx .sx-navsel select { width: 100%; }
  .sx-pane { padding: 0 0.85rem 1.5rem; }
  .sx-row { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .sx-ctl { justify-content: flex-start; }
  .sx-range, .sx-w-md, .sx-w-lg, .sx-host select { width: 100%; }
  .sx-seg { width: 100%; }
  .sx .sx-seg-btn { flex: 1 1 0; padding: 0 0.4rem; }
}
/* the mobile shell: no frame, the panel is the page */
[data-studio-shell="mobile"] .sx { border-radius: 12px; box-shadow: none; }
/* touch: finger-size targets */
@media (pointer: coarse) {
  .sx { --sx-h-ctl: 2.75rem; }
  .sx .sx-tab { min-height: 2.75rem; }
  .sx .sx-seg-btn { height: 2.6rem; }
}
