/* Rajdhani (SIL OFL 1.1, assets/fonts/OFL.txt): the Click's own display font, used for the wordmark. */
@font-face { font-family: 'Rajdhani'; font-weight: 400; font-style: normal; font-display: swap; src: url('../assets/fonts/Rajdhani-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 700; font-style: normal; font-display: swap; src: url('../assets/fonts/Rajdhani-Bold.woff2') format('woff2'); }

/* Click Studio for the web: the same look as the Mac app (ClickStudio/Sources/ClickStudio/UI/Theme.swift). */
:root {
  --bg: #f0f0f0;
  --bg-2: #e6e6e6;
  --card: #ffffff;
  --ink: #121212;
  --ink-2: #4b4b4b;
  --mute: #8a8a8a;
  --line: rgba(0, 0, 0, 0.09);
  --yellow: #f4c421;
  --yellow-hi: #ffd84a;
  --yellow-lo: #c99a0a;
  --green: #4fae6c;
  --blue: #3b6df0;
  --red: #db4537;
  --orange: #e8890c;
  --code-bg: #14181c;
  --code-ink: #d7dde4;
  --font-ui: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --shadow-card: 0 8px 14px -6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--font-body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
h2, h3 { font-family: var(--font-ui); margin: 0; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: 8px; top: -48px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

.eyebrow { display: block; font: 500 11px/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--mute); margin: 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--mute); }
.small { font-size: 12px; }
.caption { font-size: 11.5px; color: var(--mute); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mute); flex: none; }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--yellow); }
.dot.blue { background: var(--blue); }
.dot.red { background: var(--red); }
.dot.amber { background: var(--yellow-lo); }

/* ---------- Layout: top bar, then library | centre | pipeline ---------- */
.app {
  display: grid;
  grid-template-columns: 310px minmax(380px, 1fr) minmax(480px, 640px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top top" "lib center pipe";
  height: 100vh; height: 100dvh;
  min-width: 0;
}
.topbar { grid-area: top; display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--bg); min-width: 0; }
.library { grid-area: lib; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.center { grid-area: center; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px; min-width: 0; overflow-y: auto; }
.pipeline { grid-area: pipe; display: flex; flex-direction: column; gap: 12px; padding: 20px; min-width: 0; min-height: 0; }

/* ---------- Top bar ---------- */
.brand { display: flex; align-items: center; gap: 6px; flex: none; }
.brand-mark { display: inline-flex; gap: 3px; padding: 5px 6px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.brand-mark i { width: 9px; height: 20px; border-radius: 4px; background: var(--yellow); }
.brand-name { font: 700 25px/1 'Rajdhani', var(--font-ui); text-transform: uppercase; }
.brand-sub { margin-left: -6px; font: 400 25px/1 'Rajdhani', var(--font-ui); text-transform: uppercase; color: var(--ink-2, #4b4b4b); }
.step-strip { flex: 1; display: flex; justify-content: center; gap: 8px; margin: 0; font: 500 12px/1 var(--font-mono); color: var(--mute); white-space: nowrap; }
.step-strip b { font-weight: 700; color: var(--ink); }
.step-strip .done { color: var(--green); }
.step-strip .arrow { opacity: 0.6; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------- Buttons ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 12px/1 var(--font-ui); padding: 7px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
}
.pill:active { opacity: 0.75; box-shadow: none; }
.pill:disabled { opacity: 0.45; }
.pill.icon { padding: 6px 9px; }
.key-btn {
  position: relative; font: 700 16px/1 var(--font-ui); color: var(--ink);
  padding: 12px 22px; border-radius: 16px; border: 1px solid rgba(201, 154, 10, 0.55);
  background: linear-gradient(var(--yellow-hi), var(--yellow));
  box-shadow: 0 4px 0 var(--yellow-lo);
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
}
.key-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--yellow-lo); }
.key-btn:disabled { color: rgba(18, 18, 18, 0.38); background: linear-gradient(#faf0c9, #f7e8ad); border-color: rgba(201, 154, 10, 0.25); box-shadow: 0 4px 0 #e8d9a3; }
.key-btn.compact { font-size: 13px; padding: 8px 14px; border-radius: 11px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font-size: 12px; }
.link-btn:disabled { color: var(--mute); }
.plain-btn { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 13px; }
.plain-btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.plain-btn.danger { color: var(--red); }
.plain-btn:disabled { opacity: 0.5; }

.segmented { display: inline-flex; background: rgba(0, 0, 0, 0.06); border-radius: 9px; padding: 2px; gap: 2px; max-width: 100%; }
.segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); font-weight: 600; }
.tabs { align-self: flex-start; width: 360px; }
.tabs button { flex: 1; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card); padding: 14px; }
.card > h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.chip { display: inline-block; font: 500 10px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); background: rgba(138, 138, 138, 0.1); padding: 4px 8px; border-radius: 999px; }
.chip.green { color: var(--green); background: rgba(79, 174, 108, 0.12); }

/* ---------- Library ---------- */
.library h2 { font-size: 24px; line-height: 1.15; }
.library .lead { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.sample {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: var(--shadow-card);
  transition: transform 0.12s ease-out;
}
.sample:hover:not(:disabled) { transform: translateY(-2px); }
.sample:disabled { opacity: 0.55; }
.sample .glyph { flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 26px; }
.sample .body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sample .title { font: 700 15px/1.2 var(--font-ui); }
.sample .blurb { font-size: 12px; color: var(--ink-2); }
.sample .glyph.fw { background: rgba(244, 196, 33, 0.28); color: var(--yellow-lo); font-size: 20px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.15); border-top-color: var(--ink-2); animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.game-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 13px; background: #fff; border: 1px solid var(--line);
}
.game-row[aria-current="true"] { background: rgba(244, 196, 33, 0.16); border: 1.5px solid var(--yellow); }
.game-row .names { flex: 1; min-width: 0; }
.game-row .name { font: 600 13px/1.2 var(--font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-row .cls { font: 400 10px/1.3 var(--font-mono); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-row .ico { color: var(--yellow-lo); }
.game-row .ico.off { color: var(--mute); }
.ok-mark { color: var(--green); }
.warn-mark { color: var(--yellow-lo); }

/* ---------- Centre: device ---------- */
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06); font: 600 12.5px/1 var(--font-ui); }
.device-host { position: relative; width: 100%; flex: 1 1 430px; min-height: 300px; max-height: 520px; }
.device-3d { position: absolute; inset: 0; }
.device-3d .stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; cursor: grab; touch-action: none; }
.device-3d .stage-canvas:active { cursor: grabbing; }
.recenter { position: absolute; top: 6px; right: 6px; }
.device-error { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font: 10px var(--font-mono); color: var(--mute); margin: 0; }
.sim-bar { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; flex-wrap: wrap; }
.sim-bar .sim-status { font: 10.5px var(--font-mono); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.sim-bar label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 420px; }
.pad { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 12px 12px; border: 1px solid #c99a00; border-radius: 14px;
  background: linear-gradient(#ffd84a, #f4c421); color: #3a2a00; font: 600 14px var(--font-ui, inherit); cursor: pointer; user-select: none; touch-action: none;
  box-shadow: 0 4px 0 #c99a00, 0 6px 12px rgba(0,0,0,0.12); transition: transform 60ms, box-shadow 60ms; }
.pad .pad-label { letter-spacing: 0.08em; }
.pad .pad-hint { font: 10.5px var(--font-mono); color: #6b5300; }
.pad.down, .pad:active { transform: translateY(3px); box-shadow: 0 1px 0 #c99a00, 0 2px 4px rgba(0,0,0,0.12); }
.pad:focus-visible { outline: 2px solid var(--blue, #2f6fde); outline-offset: 2px; }
.keys-hint { margin: 0; font: 10.5px var(--font-mono); color: var(--mute); text-align: center; }

.composer { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.prompt-box textarea {
  width: 100%; height: 92px; resize: none; padding: 14px; font-size: 14px; line-height: 1.4;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; outline: none;
}
.prompt-box textarea:focus { border: 2px solid var(--blue); padding: 13px; }
.reuse-note { margin: 0; font: 600 11.5px/1.3 var(--font-ui); color: var(--green); }
.composer-row { display: flex; align-items: center; gap: 12px; }
.composer-row .segmented { max-width: 270px; }
.spacer { flex: 1; }

/* ---------- Banners and status rows ---------- */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 8px; font-size: 13px; }
.banner .text { flex: 1; user-select: text; }
.banner .ico { flex: none; font-weight: 700; }
.banner.info { background: rgba(59, 109, 240, 0.12); } .banner.info .ico { color: var(--blue); }
.banner.warning { background: rgba(232, 137, 12, 0.12); } .banner.warning .ico { color: var(--orange); }
.banner.error { background: rgba(219, 69, 55, 0.12); } .banner.error .ico { color: var(--red); }
.banner.success { background: rgba(79, 174, 108, 0.12); } .banner.success .ico { color: var(--green); }
.banner button { flex: none; }
.status-row { display: flex; gap: 10px; align-items: baseline; }
.status-row .ico { width: 18px; flex: none; text-align: center; font-weight: 700; }
.status-row .ico.good { color: var(--green); }
.status-row .ico.warning { color: var(--orange); }
.status-row .ico.bad { color: var(--red); }
.status-row .ico.pending { color: var(--mute); }
.status-row .detail { font-size: 13px; color: var(--mute); user-select: text; overflow-wrap: anywhere; }
.status-row .spinner { width: 12px; height: 12px; }

/* ---------- Pipeline ---------- */
.pipe-head { display: flex; align-items: center; gap: 8px; }
.pipe-head h2 { font-size: 15px; flex: 1; }
.usage { font: 10.5px var(--font-mono); color: var(--mute); }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; }
.stepper li { flex: 1; display: flex; align-items: flex-start; }
.stepper .step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.stepper .disc { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); font: 700 11px var(--font-mono); color: var(--mute); }
.stepper .label { font: 500 9.5px var(--font-mono); color: var(--mute); letter-spacing: 0.02em; }
.stepper .active .disc { background: var(--yellow); border: 2px solid var(--yellow-lo); color: var(--ink); }
.stepper .active .label { font-weight: 700; color: var(--ink); }
.stepper .done .disc { background: var(--green); color: #fff; border-color: var(--green); }
.stepper .failed .disc { background: var(--red); color: #fff; border-color: var(--red); }
.stepper .rail { height: 2px; width: 18px; background: var(--line); margin-top: 14px; flex: none; }
.stepper .rail.done { background: var(--green); }
.tab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tab-body > .scroll { overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 2px; }
.placeholder { flex: 1; display: grid; place-items: center; text-align: center; color: var(--mute); background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-card); padding: 16px; }
.pipe-foot { display: flex; align-items: center; gap: 10px; }
.pipe-foot .what { flex: 1; min-width: 0; }
.pipe-foot .what b { display: block; font: 700 12.5px/1.3 var(--font-ui); }
.pipe-foot .what span { display: block; font: 10.5px/1.3 var(--font-mono); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Console */
.console { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--code-bg); border-radius: 18px; box-shadow: 0 10px 16px rgba(0, 0, 0, 0.18); }
.console-head { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.console-head i { width: 10px; height: 10px; border-radius: 50%; }
.console-head span { margin-left: 8px; font: 11px var(--font-mono); color: var(--mute); }
.console-lines { flex: 1; overflow-y: auto; padding: 14px; font: 12px/1.45 var(--font-mono); color: var(--code-ink); user-select: text; white-space: pre-wrap; overflow-wrap: anywhere; }
.console-lines .l { min-height: 1.45em; }
.console-lines .header { font-weight: 700; letter-spacing: 0.12em; color: var(--yellow); margin-top: 10px; }
.console-lines .command { font-weight: 600; color: #fff; }
.console-lines .command::before { content: "$ "; color: #7de887; }
.console-lines .output { font-size: 11.5px; color: rgba(215, 221, 228, 0.85); }
.console-lines .claude { color: #a6d6ff; }
.console-lines .thinking { font-size: 11px; font-style: italic; color: var(--mute); }
.console-lines .info { color: #e3b340; }
.console-lines .success { font-weight: 600; color: #7de887; }
.console-lines .error { color: #ff7a73; }
.console-lines .empty { color: var(--mute); }

/* Code editor */
.code-area { width: 100%; min-height: 360px; height: 460px; resize: vertical; padding: 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--code-bg); color: var(--code-ink); font: 12px/1.5 var(--font-mono); tab-size: 4; white-space: pre; overflow: auto; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Lights */
.lights-grid { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.lights-controls { display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 240px; max-width: 420px; }
.field { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.field > span:first-child { width: 86px; flex: none; }
.field select, .field input[type="text"] { flex: 1; padding: 5px 8px; border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.field input[type="range"] { flex: 1; }
.field output { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.field input[type="color"] { width: 44px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.led-preview { width: 190px; height: 96px; background: rgba(0, 0, 0, 0.88); border-radius: 14px; display: flex; justify-content: center; align-items: center; gap: 34px; }
.led-preview i { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); }
.presets { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.presets button { flex: none; }

/* ---------- Dialogs ---------- */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--bg); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); }
dialog::backdrop { background: rgba(0, 0, 0, 0.28); }
.sheet { width: min(780px, calc(100vw - 32px)); height: min(680px, calc(100dvh - 32px)); border-radius: 14px; }
.sheet[open] { display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 16px; flex: 1; }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.sheet-foot { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); }
#dlg-burn { width: min(600px, calc(100vw - 32px)); height: min(660px, calc(100dvh - 32px)); }
.alert { width: min(420px, calc(100vw - 32px)); border-radius: 14px; padding: 20px; }
.alert h3 { font-size: 15px; margin-bottom: 8px; }
.alert p { margin: 0 0 16px; font-size: 13px; color: var(--ink-2); white-space: pre-line; }
.alert .row { justify-content: flex-end; }
.settings-tabs { display: flex; gap: 4px; justify-content: center; }
.key-list { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.key-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.key-item:last-child { border-bottom: 0; }
.key-item .who { flex: 1; min-width: 0; }
.key-item .who b { display: block; }
.key-item .who span { font-size: 11.5px; color: var(--mute); }
.badge { font: 700 11px/1 var(--font-body); padding: 4px 8px; border-radius: 999px; }
.badge.active { background: rgba(79, 174, 108, 0.2); }
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.form input, .form select { padding: 7px 9px; border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.form .check { flex-direction: row; align-items: center; gap: 8px; }
.burn-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.burn-row[aria-checked="true"] { background: rgba(244, 196, 33, 0.14); border: 1.5px solid var(--yellow); }
.burn-row:disabled { opacity: 0.5; }
.burn-row .box { font-size: 18px; color: var(--mute); width: 18px; }
.burn-row[aria-checked="true"] .box { color: var(--yellow-lo); }
.burn-row .names { flex: 1; min-width: 0; }
.burn-row .names b { font: 700 14px/1.3 var(--font-ui); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
progress { width: 100%; accent-color: var(--blue); }

/* ---------- Narrow screens: one column ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "top top" "lib center" "pipe pipe"; height: auto; }
  .pipeline { min-height: 640px; }
  .step-strip { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "center" "lib" "pipe"; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; }
  .topbar-actions { flex-wrap: wrap; width: 100%; }
  .library, .center, .pipeline { padding: 16px; }
  .device-host { flex-basis: 360px; }
  .tabs { width: 100%; }
  .composer-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Prompt-only samples (need an API key to make): greyed out, still clickable to fill the prompt box. */
.sample.locked { opacity: 0.55; filter: grayscale(0.85); }
.sample.locked:hover { opacity: 0.8; }
.chip.muted { background: transparent; border: 1px dashed var(--line); }
.sample[aria-current="true"] { outline: 2px solid var(--yellow, #f4c421); outline-offset: -2px; }

.pipe-foot .credit a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.pipe-foot .credit a:hover { text-decoration-color: currentColor; }

/* Burn: device settings */
.device-opts { gap: 10px; }
.device-opts .field > span:first-child { width: 104px; }
.device-opts .field input[type="text"] { font-family: var(--font-mono); letter-spacing: 0.04em; }
.opt-toggle { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 4px 0; background: none; border: 0; cursor: pointer; }
.opt-toggle:disabled { opacity: 0.5; cursor: default; }
.opt-toggle .opt-text { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.opt-toggle .opt-text b { font: 600 13px/1.3 var(--font-ui); }
.opt-toggle .switch { width: 38px; height: 22px; border-radius: 11px; background: #d6d6d6; position: relative; flex: none; transition: background 0.15s; }
.opt-toggle .switch i { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.opt-toggle[aria-checked="true"] .switch { background: var(--yellow, #f4c421); }
.opt-toggle[aria-checked="true"] .switch i { transform: translateX(16px); }
.diag { margin: 0; padding: 8px 10px; border-radius: 8px; background: #1b1b1b; color: #ffb4a8; font-size: 11.5px; white-space: pre-wrap; overflow-x: auto; user-select: text; }

/* The × in the top-right corner of every popup */
.close-x { flex: none; margin-left: auto; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1; color: var(--ink-2, #4b4b4b); cursor: pointer; }
.close-x:hover:not(:disabled) { background: #f3f3f3; color: var(--ink, #121212); }
.close-x:disabled { opacity: 0.4; cursor: default; }
.alert { position: relative; }
.alert > .close-x { position: absolute; top: 12px; right: 12px; }
.alert h3 { padding-right: 34px; }
