/* ============================================================================
   websynap.se v3.0 — Chroma Hardware Studio Design System
   Original MIT-Licensed Stylesheet · Self-Hosted DM Sans Variable Font
   8 Chroma Studio Themes · Ambient Matrix Backdrop · Zero External Assets
   ============================================================================ */

@font-face {
  font-family: "DM Sans";
  src: url("./fonts/DMSans-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ============================================================================
   Core Studio Tokens & Default Theme: Razer Venom (venom)
   ============================================================================ */
:root,
[data-ws-theme="venom"] {
  color-scheme: dark;

  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", ui-monospace, SFMono-Regular, Consolas, monospace;

  --bg-0: #07090b;
  --ink-0: #07090b;
  --ink-1: #0c0f13;
  --ink-2: #12161c;
  --ink-3: #181d25;
  --solid-1: #10141a;
  --solid-2: #161b23;
  --ground:
    radial-gradient(65% 48% at 76% 0%, rgb(0 230 118 / 0.08), transparent 72%),
    radial-gradient(50% 42% at 15% 100%, rgb(0 230 118 / 0.04), transparent 70%),
    linear-gradient(180deg, #0b0e12 0%, #07090b 100%);

  --tint-rgb: 238 245 252;
  --shade-rgb: 0 0 0;

  --surface-1: rgb(var(--tint-rgb) / 0.032);
  --surface-2: rgb(var(--tint-rgb) / 0.055);
  --surface-3: rgb(var(--tint-rgb) / 0.082);
  --surface-4: rgb(var(--tint-rgb) / 0.115);
  --glint: rgb(var(--tint-rgb) / 0.04);

  --well: rgb(var(--shade-rgb) / 0.42);
  --key: #1b212a;
  --btn: rgb(var(--tint-rgb) / 0.065);
  --btn-hover: rgb(var(--tint-rgb) / 0.105);

  --line-1: rgb(var(--tint-rgb) / 0.065);
  --line-2: rgb(var(--tint-rgb) / 0.11);
  --line-3: rgb(var(--tint-rgb) / 0.17);

  --text-1: #edf2f7;
  --text-2: #a5b1bf;
  --text-3: #6c7888;
  --text-4: #495362;

  --accent: #00e676;
  --accent-rgb: 0 230 118;
  --accent-soft: rgb(var(--accent-rgb) / 0.13);
  --accent-line: rgb(var(--accent-rgb) / 0.34);
  --on-accent: #04140b;

  --ok: #00e676;
  --warn: #ffb300;
  --bad: #ff5252;
  --info: #40c4ff;

  --sheen: linear-gradient(180deg, rgb(var(--tint-rgb) / 0.028), transparent 42%);
  --stage-light: radial-gradient(58% 52% at 50% 42%, rgb(var(--tint-rgb) / 0.045), transparent 74%);
  --lit: inset 0 1px 0 rgb(var(--tint-rgb) / 0.065), inset 0 0 0 1px var(--line-1);
  --inset-shadow: inset 0 1px 2px rgb(var(--shade-rgb) / 0.42), inset 0 0 0 1px rgb(var(--tint-rgb) / 0.045);
  --key-shadow: inset 0 1px 0 rgb(var(--tint-rgb) / 0.1), 0 1px 3px rgb(var(--shade-rgb) / 0.38);
  --btn-shadow: inset 0 1px 0 rgb(var(--tint-rgb) / 0.075), inset 0 0 0 1px rgb(var(--tint-rgb) / 0.065);
  --primary-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25), 0 2px 10px rgb(var(--accent-rgb) / 0.28);
  --shadow-float: 0 20px 48px rgb(0 0 0 / 0.56);

  --r-xs: 5px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  --sidebar-w: 224px;
  --sidebar-rail-w: 60px;
  --content-w: 1120px;
  --page-x: 24px;
  --page-top: 20px;
  --panel-pad: 16px;
  --panel-gap: 14px;
  --control-h: 32px;
  --nav-h: 36px;
  --nav-icon: 16px;
  --tab-well-h: 40px;
  --tab-h: 32px;
  --tab-pad: 4px;
  --tab-gap: 4px;
  --switch-w: 38px;
  --switch-h: 22px;
  --switch-thumb: 18px;

  --fs-title: 18px;
  --fs-h2: 14px;
  --fs-body: 13px;
  --fs-meta: 12px;
  --fs-small: 11px;
  --fs-figure: clamp(20px, 1.9vw, 25px);

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 110ms;
  --t-base: 170ms;
}

/* ============================================================================
   8 Original websynap.se Chroma Studio Palettes
   ============================================================================ */

/* 2. Chroma Cyber — Neon Cyan on Deep Navy-Slate */
[data-ws-theme="chroma-cyber"] {
  --bg-0: #060a10;
  --ink-0: #060a10;
  --ink-1: #0b111a;
  --ink-2: #101925;
  --ink-3: #162131;
  --solid-1: #0e1621;
  --solid-2: #141f2e;
  --ground:
    radial-gradient(62% 46% at 75% 0%, rgb(0 212 255 / 0.1), transparent 72%),
    linear-gradient(180deg, #091019 0%, #060a10 100%);
  --tint-rgb: 220 240 255;
  --key: #182536;
  --text-1: #ecf5ff;
  --text-2: #9db4cc;
  --text-3: #647b94;
  --text-4: #44566b;
  --accent: #00d4ff;
  --accent-rgb: 0 212 255;
  --on-accent: #03131a;
  --ok: #26e6a6;
}

/* 3. Stealth Carbon — Monochrome Tactical Silver on Matte Black */
[data-ws-theme="stealth"] {
  --bg-0: #080809;
  --ink-0: #080809;
  --ink-1: #0e0e10;
  --ink-2: #151518;
  --ink-3: #1c1c20;
  --solid-1: #121215;
  --solid-2: #19191d;
  --ground:
    radial-gradient(60% 42% at 74% 0%, rgb(255 255 255 / 0.045), transparent 72%),
    linear-gradient(180deg, #0d0d0f 0%, #080809 100%);
  --tint-rgb: 245 245 247;
  --key: #212126;
  --text-1: #f2f2f5;
  --text-2: #a8a8b2;
  --text-3: #6e6e78;
  --text-4: #4b4b54;
  --accent: #e2e5ec;
  --accent-rgb: 226 229 236;
  --on-accent: #09090b;
  --ok: #4cd97b;
}

/* 4. Quartz Rose — Razer Quartz Pink on Dark Plum */
[data-ws-theme="quartz"] {
  --bg-0: #0c080b;
  --ink-0: #0c080b;
  --ink-1: #140d12;
  --ink-2: #1c131a;
  --ink-3: #251922;
  --solid-1: #181016;
  --solid-2: #21161e;
  --ground:
    radial-gradient(62% 46% at 74% 0%, rgb(255 107 157 / 0.11), transparent 72%),
    linear-gradient(180deg, #130c11 0%, #0c080b 100%);
  --tint-rgb: 255 232 242;
  --key: #291c26;
  --text-1: #faedf3;
  --text-2: #bfa3b1;
  --text-3: #856a78;
  --text-4: #5c4651;
  --accent: #ff6b9d;
  --accent-rgb: 255 107 157;
  --on-accent: #1c050e;
  --ok: #4ce095;
}

/* 5. Optical Amber — Analog Switch Gold on Warm Carbon */
[data-ws-theme="amber"] {
  --bg-0: #0b0907;
  --ink-0: #0b0907;
  --ink-1: #13100c;
  --ink-2: #1b1611;
  --ink-3: #231d16;
  --solid-1: #16120e;
  --solid-2: #1f1913;
  --ground:
    radial-gradient(62% 46% at 74% 0%, rgb(255 179 0 / 0.1), transparent 72%),
    linear-gradient(180deg, #120e0a 0%, #0b0907 100%);
  --tint-rgb: 255 242 224;
  --key: #272018;
  --text-1: #f8f1e7;
  --text-2: #baa995;
  --text-3: #827260;
  --text-4: #594d40;
  --accent: #ffb300;
  --accent-rgb: 255 179 0;
  --on-accent: #191000;
  --ok: #4ce085;
}

/* 6. Chroma Ultraviolet — Electric Purple on Deep Void */
[data-ws-theme="ultraviolet"] {
  --bg-0: #08070d;
  --ink-0: #08070d;
  --ink-1: #0f0d18;
  --ink-2: #161324;
  --ink-3: #1e1a30;
  --solid-1: #13101e;
  --solid-2: #1a1629;
  --ground:
    radial-gradient(62% 46% at 74% 0%, rgb(179 136 255 / 0.11), transparent 72%),
    linear-gradient(180deg, #0e0b17 0%, #08070d 100%);
  --tint-rgb: 238 230 255;
  --key: #231e36;
  --text-1: #f1edff;
  --text-2: #ada3c9;
  --text-3: #746a91;
  --text-4: #4e4666;
  --accent: #b388ff;
  --accent-rgb: 179 136 255;
  --on-accent: #110724;
  --ok: #46e099;
}

/* 7. Esports Crimson — High-Contrast Laser Red on Dark Basalt */
[data-ws-theme="crimson"] {
  --bg-0: #0b0708;
  --ink-0: #0b0708;
  --ink-1: #130c0e;
  --ink-2: #1b1114;
  --ink-3: #24171b;
  --solid-1: #170e11;
  --solid-2: #201418;
  --ground:
    radial-gradient(62% 46% at 74% 0%, rgb(255 71 87 / 0.1), transparent 72%),
    linear-gradient(180deg, #120b0d 0%, #0b0708 100%);
  --tint-rgb: 255 232 235;
  --key: #28191d;
  --text-1: #faecef;
  --text-2: #bda2a7;
  --text-3: #84696f;
  --text-4: #5b454a;
  --accent: #ff4757;
  --accent-rgb: 255 71 87;
  --on-accent: #1c0406;
  --ok: #3ee088;
}

/* 8. Mercury Light — Clean Daylight Hardware Studio */
[data-ws-theme="mercury"] {
  color-scheme: light;
  --bg-0: #eef1f5;
  --ink-0: #e5e9ef;
  --ink-1: #f5f7fa;
  --ink-2: #ffffff;
  --ink-3: #ffffff;
  --solid-1: #f5f7fa;
  --solid-2: #ffffff;
  --ground:
    radial-gradient(62% 48% at 75% 0%, rgb(0 168 84 / 0.08), transparent 70%),
    linear-gradient(180deg, #f4f6f9 0%, #e9edf3 100%);
  --tint-rgb: 15 23 35;
  --shade-rgb: 15 23 35;
  --surface-1: rgb(255 255 255 / 0.78);
  --surface-2: rgb(255 255 255 / 0.94);
  --surface-3: rgb(var(--tint-rgb) / 0.055);
  --surface-4: rgb(var(--tint-rgb) / 0.095);
  --glint: rgb(var(--tint-rgb) / 0.045);
  --well: rgb(var(--tint-rgb) / 0.065);
  --key: #ffffff;
  --btn: rgb(255 255 255 / 0.88);
  --btn-hover: #ffffff;
  --line-1: rgb(var(--tint-rgb) / 0.085);
  --line-2: rgb(var(--tint-rgb) / 0.14);
  --line-3: rgb(var(--tint-rgb) / 0.22);
  --text-1: #111722;
  --text-2: #414d5c;
  --text-3: #6f7c8c;
  --text-4: #96a2b2;
  --accent: #00a854;
  --accent-rgb: 0 168 84;
  --accent-soft: rgb(var(--accent-rgb) / 0.12);
  --accent-line: rgb(var(--accent-rgb) / 0.34);
  --on-accent: #ffffff;
  --ok: #00994d;
  --warn: #c77c00;
  --bad: #d9303e;
  --info: #0077c2;
  --sheen: linear-gradient(180deg, rgb(255 255 255 / 0.7), rgb(255 255 255 / 0) 45%);
  --stage-light: radial-gradient(56% 52% at 50% 42%, rgb(255 255 255 / 0.9), transparent 74%);
  --lit: inset 0 1px 0 rgb(255 255 255 / 0.85), 0 1px 3px rgb(15 23 35 / 0.05), inset 0 0 0 1px var(--line-1);
  --inset-shadow: inset 0 1px 2px rgb(15 23 35 / 0.07), inset 0 0 0 1px rgb(15 23 35 / 0.06);
  --key-shadow: 0 1px 2px rgb(15 23 35 / 0.1), inset 0 0 0 1px rgb(15 23 35 / 0.07);
  --btn-shadow: 0 1px 2px rgb(15 23 35 / 0.07), inset 0 0 0 1px rgb(15 23 35 / 0.1);
  --shadow-float: 0 18px 42px rgb(15 23 35 / 0.14);
}

/* ============================================================================
   Base Reset & Studio Typography
   ============================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink-0);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

h1, h2, h3, p, figure {
  margin: 0;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgb(var(--tint-rgb) / 0.12);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--tint-rgb) / 0.22);
}

/* ============================================================================
   Studio Shell, Chroma Matrix Backdrop & Collapsible Navigation Sidebar
   ============================================================================ */
.ws-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--ground);
  transition: grid-template-columns var(--t-base) var(--ease);
}

.ws-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-rail-w) minmax(0, 1fr);
}

.ws-shell.reduce-interface-motion *,
.ws-shell.reduce-interface-motion *::before,
.ws-shell.reduce-interface-motion *::after {
  animation-duration: 0.01ms !important;
  transition-duration: 0.01ms !important;
}

/* Ambient Chroma Geometric Matrix Backdrop */
.ws-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  width: 52vw;
  height: 360px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  opacity: 0.85;
}

.ws-backdrop-matrix {
  width: 100%;
  height: 100%;
  display: block;
}

.ws-backdrop-matrix.is-pulsing {
  animation: ws-matrix-fade 560ms var(--ease) both;
}

@keyframes ws-matrix-fade {
  from {
    opacity: 0.15;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Sidebar */
.ws-sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 12px 12px;
  background: var(--ink-0);
  border-inline-end: 1px solid var(--line-1);
  min-width: 0;
  overflow: hidden;
}

.ws-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding-inline: 6px 2px;
}

.ws-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ws-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
  flex: none;
}

.ws-brand-text {
  display: grid;
  min-width: 0;
}

.ws-brand-name {
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-brand-build {
  color: var(--text-3);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ws-nav {
  display: grid;
  gap: 3px;
}

.ws-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: var(--nav-h);
  padding-inline: 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-body);
  font-weight: 500;
  text-align: start;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.ws-nav-item:hover:not(:disabled) {
  background: var(--glint);
  color: var(--text-1);
}

.ws-nav-item:disabled {
  opacity: 0.42;
  cursor: default;
}

.ws-nav-item.is-active {
  background: var(--surface-2);
  color: var(--text-1);
  box-shadow: var(--lit);
}

.ws-nav-icon {
  width: var(--nav-icon);
  height: var(--nav-icon);
  color: var(--text-3);
  flex: none;
  transition: color var(--t-fast) var(--ease);
}

.ws-nav-item:hover:not(:disabled) .ws-nav-icon {
  color: var(--text-2);
}

.ws-nav-item.is-active .ws-nav-icon {
  color: var(--accent);
}

.ws-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-nav-badge {
  margin-inline-start: auto;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Sidebar Devices Switcher */
.ws-side-devices {
  display: grid;
  gap: 6px;
  min-height: 0;
}

.ws-side-heading {
  padding-inline: 10px;
  color: var(--text-3);
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
}

.ws-side-device-list {
  display: grid;
  gap: 3px;
}

.ws-side-device {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 8px 6px 6px;
  border-radius: var(--r-sm);
  text-align: start;
  transition: background var(--t-fast) var(--ease);
}

.ws-side-device:hover {
  background: var(--glint);
}

.ws-side-device.is-active {
  background: var(--surface-2);
  box-shadow: var(--lit);
}

.ws-side-device-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-2);
}

.ws-side-device.is-active .ws-side-device-art {
  color: var(--accent);
  background: var(--accent-soft);
}

.ws-side-device-live {
  position: absolute;
  inset-inline-end: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--ink-0);
}

.ws-side-device-text {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.ws-side-device-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-1);
}

.ws-side-device-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Sidebar Footer & WebHID Status */
.ws-sidebar-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line-1);
}

.ws-bridge-line {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 32px;
  padding-inline: 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-small);
  white-space: nowrap;
  text-align: start;
}

.ws-bridge-line:hover {
  background: var(--glint);
  color: var(--text-1);
}

.ws-bridge-line-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-bridge-line-flag {
  flex: none;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
}

/* Collapsed Sidebar State */
.ws-sidebar.is-collapsed {
  padding-inline: 10px;
}
.ws-sidebar.is-collapsed .ws-sidebar-head {
  flex-direction: column;
  padding: 0;
  gap: 8px;
}
.ws-sidebar.is-collapsed .ws-brand {
  justify-content: center;
}
.ws-sidebar.is-collapsed .ws-brand-text,
.ws-sidebar.is-collapsed .ws-nav-label,
.ws-sidebar.is-collapsed .ws-nav-badge,
.ws-sidebar.is-collapsed .ws-side-heading,
.ws-sidebar.is-collapsed .ws-side-device-text,
.ws-sidebar.is-collapsed .ws-bridge-line-text,
.ws-sidebar.is-collapsed .ws-bridge-line-flag {
  display: none;
}
.ws-sidebar.is-collapsed .ws-nav-item,
.ws-sidebar.is-collapsed .ws-side-device,
.ws-sidebar.is-collapsed .ws-bridge-line {
  justify-content: center;
  padding-inline: 0;
}

/* ============================================================================
   Main Column, Top Bar & Onboard Memory Slots Strip
   ============================================================================ */
.ws-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.ws-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 50px;
  padding: 8px var(--page-x);
  border-bottom: 1px solid var(--line-1);
  background: rgb(7 9 11 / 0.62);
  backdrop-filter: blur(12px);
}

.ws-slot-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ws-slot-strip-label {
  color: var(--text-3);
  font-size: var(--fs-small);
  font-weight: 600;
}

.ws-slot-pills {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--well);
  box-shadow: var(--inset-shadow);
}

.slot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding-inline: 10px;
  border-radius: 5px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.slot-pill:hover {
  color: var(--text-1);
}
.slot-pill.active {
  background: var(--key);
  box-shadow: var(--key-shadow);
  color: var(--text-1);
}

.slot-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--slot-color, var(--accent));
  box-shadow: 0 0 6px var(--slot-color, var(--accent));
}

.slot-name-tag {
  color: var(--text-2);
  font-size: var(--fs-meta);
  font-weight: 500;
}

.ws-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.ws-page {
  width: 100%;
  max-width: calc(var(--content-w) + 2 * var(--page-x));
  margin-inline: auto;
  padding: var(--page-top) var(--page-x) 110px;
  display: grid;
  gap: var(--panel-gap);
  align-content: start;
  animation: ws-fade var(--t-base) var(--ease) both;
}

@keyframes ws-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ws-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.ws-page-head h1 {
  font-size: var(--fs-title);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ws-page-head .ws-meta {
  margin-top: 3px;
}

/* ============================================================================
   Studio Panels, Typography & Controls
   ============================================================================ */
.ws-panel, .setting-card {
  position: relative;
  background: var(--sheen), linear-gradient(var(--surface-1), var(--surface-1)), var(--ink-1);
  box-shadow: var(--lit);
  border-radius: var(--r-md);
  min-width: 0;
}

.ws-panel.is-lit, .setting-card.is-lit {
  background:
    linear-gradient(180deg, rgb(var(--accent-rgb) / 0.072), transparent 55%),
    linear-gradient(var(--surface-1), var(--surface-1)), var(--ink-1);
}

.setting-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: var(--panel-pad);
}

.setting-card.is-staged {
  box-shadow: var(--lit), inset 0 0 0 1px var(--accent-line);
}

.ws-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px var(--panel-pad) 8px;
}

.ws-panel-head h2, .setting-heading h2, .setting-heading h3 {
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ws-panel-head .ws-end {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
}
.setting-heading > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.setting-heading p, .setting-note, .ws-meta {
  color: var(--text-3);
  font-size: var(--fs-meta);
  line-height: 1.45;
}
.ws-label {
  color: var(--text-3);
  font-size: var(--fs-meta);
  font-weight: 500;
}

.setting-heading output, .val-pill {
  padding: 4px 9px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ws-fig {
  font-size: var(--fs-figure);
  font-weight: 600;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
}
.ws-fig .ws-unit {
  margin-inline-start: 4px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
}
.ws-fig.is-sm {
  font-size: 18px;
}

/* Buttons & Badges */
.ws-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--control-h);
  padding-inline: 13px;
  border-radius: var(--r-sm);
  background: var(--btn);
  box-shadow: var(--btn-shadow);
  color: var(--text-1);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.ws-btn:hover:not(:disabled) {
  background: var(--btn-hover);
}
.ws-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.ws-btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}
.ws-btn.is-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--primary-shadow);
}
.ws-btn.is-primary:hover:not(:disabled) {
  filter: brightness(1.07);
}
.ws-btn.is-ghost {
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
}
.ws-btn.is-ghost:hover:not(:disabled) {
  background: var(--glint);
  color: var(--text-1);
}
.ws-btn.is-danger {
  color: var(--bad);
}
.ws-btn.is-sm {
  height: 27px;
  padding-inline: 10px;
  font-size: 12px;
}

.ws-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  background: transparent;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.ws-icon-btn:hover:not(:disabled) {
  background: var(--glint);
  color: var(--text-1);
}
.ws-icon-btn svg {
  width: 16px;
  height: 16px;
}

.ws-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding-inline: 8px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-small);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ws-badge.is-ok {
  color: var(--ok);
  background: rgb(var(--accent-rgb) / 0.14);
}
.ws-badge.is-warn {
  color: var(--warn);
  background: rgb(255 179 0 / 0.15);
}
.ws-badge.is-accent {
  color: var(--accent);
  background: var(--accent-soft);
}

.ws-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-4);
  flex: none;
}
.ws-dot.is-ok {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.ws-dot.is-warn {
  background: var(--warn);
  box-shadow: 0 0 8px var(--warn);
}

.ws-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  min-width: 56px;
  padding-inline: 10px;
  border-radius: var(--r-sm);
  background: var(--well);
  box-shadow: var(--inset-shadow);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.ws-chip:hover {
  color: var(--text-1);
}
.ws-chip.is-on {
  background: var(--key);
  box-shadow: var(--key-shadow);
  color: var(--text-1);
}
.ws-chip.is-on::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Workspace Sub-Tabs */
.ws-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--tab-gap);
  min-height: var(--tab-well-h);
  padding: var(--tab-pad);
  border-radius: var(--r-md);
  background: linear-gradient(var(--well), var(--well)), var(--ink-1);
  box-shadow: var(--inset-shadow);
  justify-self: start;
}
.ws-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--tab-h);
  padding-inline: 13px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.ws-tab svg {
  width: 15px;
  height: 15px;
  color: var(--text-3);
}
.ws-tab:hover {
  background: var(--glint);
  color: var(--text-1);
}
.ws-tab.is-active {
  background: var(--key);
  color: var(--text-1);
  box-shadow: var(--key-shadow);
}
.ws-tab.is-active svg {
  color: var(--accent);
}

/* ============================================================================
   Overview Telemetry Figures & Response Curve Sparkline Panel
   ============================================================================ */
.ws-overview-top {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 1080px) {
  .ws-overview-top {
    grid-template-columns: 1fr;
  }
}

.ws-setup-figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 4px var(--panel-pad) var(--panel-pad);
}
.ws-setup-figure {
  display: grid;
  gap: 5px;
  align-content: start;
  padding-inline: 14px;
  border-inline-start: 1px solid var(--line-1);
}
.ws-setup-figure:first-child {
  padding-inline-start: 0;
  border-inline-start: 0;
}
.ws-setup-stages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px var(--panel-pad) 14px;
  border-top: 1px solid var(--line-1);
}
.ws-setup-stage-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ws-sparkline-card {
  display: flex;
  flex-direction: column;
}
.ws-sparkline-chart {
  display: grid;
  gap: 6px;
  padding: 4px var(--panel-pad) 12px;
  margin-top: auto;
}
.ws-sparkline-chart svg {
  width: 100%;
  height: 86px;
  overflow: visible;
}
.ws-chart-guide {
  stroke: var(--line-1);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.ws-chart-area {
  fill: rgb(var(--accent-rgb) / 0.15);
}
.ws-chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ws-sparkline-axis {
  display: flex;
  justify-content: space-between;
  color: var(--text-3);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   Interactive TKL Keyboard Stage & Optical Mouse Stage
   ============================================================================ */
.device-stage-card {
  padding: 16px 18px 18px;
}
.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.stage-toolbar-left, .stage-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented, .preset-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--well);
  box-shadow: var(--inset-shadow);
}
.segmented > button, .preset-btn, .toolbar-chip {
  flex: 1 0 auto;
  min-height: 28px;
  padding-inline: 11px;
  border-radius: 5px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.segmented > button:hover, .preset-btn:hover, .toolbar-chip:hover {
  color: var(--text-1);
}
.segmented > button.selected, .segmented > button.active,
.preset-btn.active, .toolbar-chip.active {
  background: var(--key);
  box-shadow: var(--key-shadow);
  color: var(--text-1);
}

/* TKL Keyboard Chassis */
.keyboard-chassis {
  --key-color: #00e676;
  --key-glow: rgba(0, 230, 118, 0.16);
  --kbd-glow: rgba(0, 230, 118, 0.14);
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--stage-light), var(--well);
  box-shadow: var(--inset-shadow), inset 0 0 0 1px var(--line-1), 0 0 38px var(--kbd-glow);
  overflow-x: auto;
}
.kbd-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 740px;
}
.kbd-row {
  display: flex;
  gap: 5px;
}
.kbd-spacer {
  width: 14px;
  flex-shrink: 0;
}
.keycap {
  --col-idx: 0;
  position: relative;
  height: 44px;
  min-width: 44px;
  padding: 4px 6px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.055), rgb(255 255 255 / 0.015)), var(--solid-1);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.08),
    0 2px 3px rgb(0 0 0 / 0.45),
    inset 0 0 0 1px var(--line-2),
    inset 0 0 10px var(--key-glow);
  color: var(--key-color, var(--text-1));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
  transition: transform 80ms ease;
}
.keyboard-chassis[data-chroma-effect="breathing"] .keycap,
.keyboard-chassis[data-chroma-effect="breathingDual"] .keycap {
  animation: chroma-breathe 2.8s ease-in-out infinite;
}
.keyboard-chassis[data-chroma-effect="spectrum"] .keycap {
  animation: chroma-spectrum 5s linear infinite;
}
.keyboard-chassis[data-chroma-effect="wave"] .keycap {
  animation: chroma-spectrum 2.4s linear infinite;
  animation-delay: calc(var(--col-idx, 0) * -110ms);
}
.keyboard-chassis[data-chroma-effect="wheel"] .keycap {
  animation: chroma-spectrum 2.8s linear infinite;
  animation-delay: calc((var(--col-idx, 0) + var(--row-idx, 0) * 2) * -95ms);
}
.keyboard-chassis[data-chroma-effect="starlight"] .keycap {
  animation: chroma-breathe 2.0s ease-in-out infinite;
  animation-delay: calc(var(--col-idx, 0) * -210ms);
}
.keyboard-chassis[data-chroma-effect="fire"] .keycap {
  color: hsl(calc(8deg + (5 - var(--row-idx, 3)) * 8deg) 96% 58%);
  animation: chroma-breathe 1.2s ease-in-out infinite;
  animation-delay: calc((var(--col-idx, 0) * -130ms) + (var(--row-idx, 0) * -90ms));
}
.keyboard-chassis[data-chroma-effect="rain"] .keycap {
  animation: chroma-breathe 1.4s linear infinite;
  animation-delay: calc((var(--row-idx, 0) * 140ms) - (var(--col-idx, 0) * 190ms));
}
.keyboard-chassis[data-chroma-effect="scanner"] .keycap {
  animation: chroma-breathe 1.8s ease-in-out infinite;
  animation-delay: calc(var(--col-idx, 0) * -90ms);
}
.keyboard-chassis[data-chroma-effect="aurora"] .keycap,
.keyboard-chassis[data-chroma-effect="gradient"] .keycap {
  color: color-mix(in srgb, var(--key-color) calc((16 - var(--col-idx, 0)) * 6%), var(--key-color-2, #00d2ff));
  animation: chroma-breathe 3.2s ease-in-out infinite;
  animation-delay: calc(var(--col-idx, 0) * -120ms);
}
.keyboard-chassis[data-chroma-effect="disco"] .keycap {
  animation: chroma-spectrum 0.9s steps(6, end) infinite;
  animation-delay: calc((var(--col-idx, 0) * -170ms) + (var(--row-idx, 0) * -230ms));
}
.keycap.is-reactive-lit {
  color: var(--reactive-color, var(--accent)) !important;
  box-shadow:
    inset 0 0 0 1.5px var(--reactive-color, var(--accent)),
    inset 0 0 14px var(--reactive-glow, rgb(var(--accent-rgb) / 0.55)),
    0 0 16px var(--reactive-glow, rgb(var(--accent-rgb) / 0.45)) !important;
  transform: translateY(1px);
}
@keyframes chroma-breathe {
  0%, 100% { filter: brightness(0.7); }
  50% { filter: brightness(1.25); }
}
@keyframes chroma-spectrum {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}
.keycap:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.14), 0 4px 8px rgb(0 0 0 / 0.5), inset 0 0 0 1px var(--line-3);
}
.keycap.selected {
  background: radial-gradient(120% 100% at 50% 0%, rgb(var(--accent-rgb) / 0.28), transparent 75%), var(--solid-2);
  box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 12px rgb(var(--accent-rgb) / 0.35);
}
.keycap.snap-key {
  box-shadow: inset 0 0 0 1.5px var(--warn), 0 0 10px rgb(255 179 0 / 0.25);
}
.keycap.remapped-key {
  box-shadow: inset 0 0 0 1.5px var(--info);
}
.keycap-label {
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
}
.keycap-meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.keycap.has-override .keycap-meta {
  color: var(--accent);
  font-weight: 600;
}
.keycap-rt-dot {
  padding: 0 3px;
  border-radius: 2px;
  background: rgb(64 196 255 / 0.18);
  color: var(--info);
  font-size: 8.5px;
  font-weight: 700;
}

/* ============================================================================
   Studio Grid, Switch Tiles, Stepper Sliders & Rate Bars
   ============================================================================ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr));
  gap: 16px;
  align-items: start;
}

/* Range Inputs with --fill */
input[type="range"] {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) var(--fill), rgb(var(--tint-rgb) / 0.14) var(--fill));
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgb(var(--tint-rgb) / 0.14);
}
input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: var(--text-1);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.25), 0 1px 3px rgb(var(--shade-rgb) / 0.5);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--text-1);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.25), 0 1px 3px rgb(var(--shade-rgb) / 0.5);
}

input[type="text"], input[type="number"], select, textarea {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  background: var(--well);
  box-shadow: var(--inset-shadow);
  color: var(--text-1);
  font-size: 12.5px;
}
select option {
  background: var(--solid-2);
  color: var(--text-1);
}

/* Precision Stepper Slider */
.stepper-slider {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.stepper-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.stepper-slider-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 550;
  color: var(--text-2);
}
.stepper-slider-head output {
  color: var(--text-1);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.stepper-slider-inputs {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  gap: 10px;
}
.stepper-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--btn);
  box-shadow: var(--btn-shadow);
  color: var(--text-2);
  font-weight: 700;
}
.stepper-btn:hover {
  color: var(--text-1);
  background: var(--btn-hover);
}
.stepper-slider-scale {
  display: flex;
  justify-content: space-between;
  padding-inline: 38px;
  color: var(--text-4);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}

/* Actuation Visual Travel Gauge */
.actuation-visualizer {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--well);
  box-shadow: var(--inset-shadow);
}
.stem-track {
  position: relative;
  height: 128px;
  width: 52px;
  margin-inline: auto;
  border-radius: var(--r-sm);
  background: var(--ink-0);
  box-shadow: inset 0 0 0 1px var(--line-2);
  overflow: hidden;
}
.stem-fill {
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 30%;
  background: linear-gradient(180deg, rgb(var(--accent-rgb) / 0.12), rgb(var(--accent-rgb) / 0.42));
  transition: height 120ms var(--ease);
}
.stem-marker {
  position: absolute;
  inset-inline: 0;
  top: 30%;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transition: top 120ms var(--ease);
}
.stem-scale {
  position: absolute;
  inset-block: 6px;
  right: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-4);
}

/* Toggle Switch Tiles */
.switch-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.switch-tile {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "icon switch" "label label";
  align-items: start;
  gap: 12px 8px;
  min-height: 86px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--line-1);
  cursor: pointer;
  transition: background var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.switch-tile:hover {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.switch-tile[data-state="on"] {
  background: radial-gradient(120% 90% at 0% 0%, rgb(var(--accent-rgb) / 0.16), transparent 70%), var(--surface-2);
  box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / 0.35), 0 8px 22px -14px rgb(var(--accent-rgb) / 0.7);
}
.switch-tile-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-3);
}
.switch-tile[data-state="on"] .switch-tile-icon {
  background: rgb(var(--accent-rgb) / 0.18);
  box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / 0.3);
  color: var(--accent);
}
.switch-tile-label {
  grid-area: label;
  align-self: end;
  display: grid;
  gap: 2px;
}
.switch-tile-label strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.switch-tile[data-state="on"] .switch-tile-label strong {
  color: var(--text-1);
}
.switch-tile-label small {
  font-size: 11px;
  color: var(--text-3);
}
.switch-tile input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-button {
  grid-area: switch;
  justify-self: end;
  position: relative;
  display: inline-flex;
  align-items: center;
  width: var(--switch-w);
  height: var(--switch-h);
  padding: 2px;
  border-radius: 99px;
  background: var(--well);
  box-shadow: var(--inset-shadow);
  transition: background var(--t-base) var(--ease);
}
.switch-thumb {
  width: var(--switch-thumb);
  height: var(--switch-thumb);
  border-radius: 50%;
  background: var(--key);
  box-shadow: var(--key-shadow);
  transition: transform var(--t-base) var(--ease);
}
.switch-tile[data-state="on"] .switch-button {
  background: var(--accent);
  box-shadow: none;
}
.switch-tile[data-state="on"] .switch-thumb {
  transform: translateX(16px);
  background: var(--on-accent);
  box-shadow: none;
}

/* Bar-Graph Polling Rate Selector */
.rate-slider-buttons {
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: var(--r-sm);
  background: var(--well);
  box-shadow: var(--inset-shadow);
}
.rate-slider-buttons > button {
  --lvl: 1;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  height: 72px;
  padding-block: 8px 9px;
  border-radius: 5px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.rate-slider-buttons > button:nth-child(2) { --lvl: 2; }
.rate-slider-buttons > button:nth-child(3) { --lvl: 3; }
.rate-slider-buttons > button:nth-child(4) { --lvl: 4; }
.rate-slider-buttons > button:nth-child(5) { --lvl: 5; }
.rate-slider-buttons > button:nth-child(6) { --lvl: 6; }
.rate-slider-buttons > button:nth-child(7) { --lvl: 7; }
.rate-slider-buttons > button::before {
  content: "";
  display: block;
  width: min(58%, 32px);
  height: calc(6px + var(--lvl) * 4px);
  border-radius: 3px;
  background: var(--surface-4);
  transition: background var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.rate-slider-buttons > button:has(~ button.is-on)::before {
  background: rgb(var(--accent-rgb) / 0.42);
}
.rate-slider-buttons > button.is-on {
  background: var(--key);
  box-shadow: var(--key-shadow);
  color: var(--accent);
}
.rate-slider-buttons > button.is-on::before {
  background: var(--accent);
  box-shadow: 0 0 14px rgb(var(--accent-rgb) / 0.55);
}

/* ============================================================================
   5-Stage DPI Table Editor (with X/Y Axis Link/Unlink)
   ============================================================================ */
.dpi-editor-list {
  display: grid;
  border-top: 1px solid var(--line-1);
}
.dpi-editor-row {
  display: grid;
  grid-template-columns: 28px 46px 78px 28px 78px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding-inline: 4px 8px;
  border-bottom: 1px solid var(--line-1);
}
.dpi-editor-row.is-active {
  background: rgb(var(--accent-rgb) / 0.065);
}
.dpi-editor-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.dpi-editor-row.is-active .dpi-editor-index {
  color: var(--accent);
  background: var(--accent-soft);
}
.dpi-stage-swatch {
  width: 4px;
  height: 12px;
  border-radius: 2px;
}
.dpi-axis-input {
  width: 100%;
  height: 30px;
  text-align: end;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.dpi-axis-lock {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  color: var(--text-3);
}
.dpi-axis-lock.is-unlinked {
  color: var(--accent);
  background: var(--accent-soft);
}
.dpi-axis-lock:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

/* Color Swatches */
.swatch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.2);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.swatch:hover {
  transform: scale(1.1);
}
.swatch.active {
  box-shadow: 0 0 0 2px var(--ink-1), 0 0 0 4px var(--text-1);
}

/* ============================================================================
   Devices Shelf, Hardware Test Suite & 8-Theme Chroma Studio Gallery
   ============================================================================ */
.ws-shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}
.ws-device-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 390px;
  padding: 18px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(70% 48% at 50% 60%, rgb(var(--accent-rgb) / 0.13), transparent 72%),
    var(--sheen), var(--surface-1);
  box-shadow: var(--lit), inset 0 0 0 1px rgb(var(--accent-rgb) / 0.18);
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.ws-device-block:hover {
  transform: translateY(-2px);
  box-shadow: var(--lit), inset 0 0 0 1px var(--accent-line);
}
.ws-device-block-art {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 180px;
  border-radius: var(--r-md);
  background: var(--stage-light), var(--well);
  box-shadow: var(--inset-shadow);
}

/* Hardware Test Stages */
.hardware-test-stage {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-1);
}
.hardware-test-stage:last-child {
  border-bottom: 0;
}
.hardware-test-stage.pass .hw-stage-badge {
  color: var(--ok);
  background: rgb(var(--accent-rgb) / 0.12);
}
.hardware-test-stage.fail .hw-stage-badge {
  color: var(--bad);
  background: rgb(255 82 82 / 0.14);
}
.hardware-test-stage.running .hw-stage-badge {
  color: var(--accent);
  background: var(--accent-soft);
}
.hw-stage-badge {
  padding: 3px 8px;
  border-radius: var(--r-xs);
  font-size: var(--fs-small);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.hardware-test-progress {
  height: 4px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--well);
  overflow: hidden;
}
.hardware-test-progress > i {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}

/* 8-Theme Chroma Studio Gallery (each tile renders in its own [data-ws-theme]) */
.ws-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
}
.ws-theme-tile {
  display: grid;
  gap: 8px;
  padding: 6px 6px 9px;
  border-radius: var(--r-md);
  background: var(--ink-1);
  color: var(--text-1);
  box-shadow: inset 0 0 0 1px rgb(var(--tint-rgb) / 0.12);
  text-align: start;
  transition: box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.ws-theme-tile:hover {
  box-shadow: inset 0 0 0 1px rgb(var(--tint-rgb) / 0.28);
  transform: translateY(-1px);
}
.ws-theme-tile.is-active {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.ws-theme-preview {
  display: grid;
  grid-template-columns: 24% 1fr;
  height: 64px;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--ground);
}
.ws-theme-preview-side {
  background: var(--ink-0);
  border-inline-end: 1px solid var(--line-1);
}
.ws-theme-preview-main {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 8px;
}
.ws-theme-preview-line {
  height: 4px;
  width: 70%;
  border-radius: 2px;
  background: var(--text-3);
}
.ws-theme-preview-line.is-title {
  width: 45%;
  height: 5px;
  background: var(--text-1);
}
.ws-theme-preview-sheet {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  padding: 6px;
  border-radius: 4px;
  background: var(--surface-2);
  box-shadow: var(--lit);
}
.ws-theme-preview-accent {
  width: 18px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
}
.ws-theme-name {
  padding-inline: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Floating Staged Apply Bar & Toast Stack */
.apply-bar {
  position: fixed;
  z-index: 45;
  inset-inline: 0;
  bottom: 20px;
  width: min(640px, calc(100% - 48px));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 16px;
  border-radius: var(--r-md);
  background: var(--solid-2);
  box-shadow: var(--lit), inset 0 0 0 1px var(--accent-line), var(--shadow-float);
}
.apply-bar-label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  font-weight: 600;
}
.apply-bar-summary {
  color: var(--text-3);
  font-size: var(--fs-meta);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-stack {
  position: fixed;
  z-index: 70;
  inset-inline-end: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--solid-2);
  box-shadow: var(--lit), inset 0 0 0 1px var(--line-2), var(--shadow-float);
  font-size: 12.5px;
  font-weight: 550;
}
.toast.is-ok {
  box-shadow: var(--lit), inset 0 0 0 1px var(--accent-line), var(--shadow-float);
}

[hidden] {
  display: none !important;
}

/* Protocol 25 Packet Inspector Drawer */
.inspector-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(500px, 95vw);
  z-index: 65;
  background: var(--solid-1);
  border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
}
.inspector-drawer[hidden] {
  display: none !important;
}
.packet-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.packet-item {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--well);
  box-shadow: var(--inset-shadow);
  font-family: var(--font-mono);
  font-size: 11px;
  display: grid;
  gap: 4px;
}
.packet-hex {
  color: var(--text-3);
  word-break: break-all;
  font-size: 10.5px;
}

/* Mouse Interactive Top-Down Stage */
.mouse-hero-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 960px) {
  .mouse-hero-layout {
    grid-template-columns: 1fr;
  }
}
.mouse-svg-stage {
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--stage-light), var(--well);
  box-shadow: var(--inset-shadow);
}
.mouse-svg-stage svg {
  width: 170px;
  height: auto;
  filter: drop-shadow(0 14px 18px rgb(0 0 0 / 0.55));
}
.mouse-hotspot {
  cursor: pointer;
  transition: fill 120ms ease, stroke 120ms ease;
}
.mouse-hotspot:hover, .mouse-hotspot.selected {
  fill: rgb(var(--accent-rgb) / 0.28) !important;
  stroke: var(--accent) !important;
}
