*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0d27;
  --bg2: #0f1336;
  --surface: #2b2f5e;
  --surface2: #1d214e;
  --surface3: #171b47;
  --border: #ffffff1a;
  --text: #f4f4ff;
  --muted: #9ca0bd;
  --label: #be8fff;
  --accent: #7d11ff;
  --accent-2: #5f0cff;
  --accent-dim: #7d11ff4d;
  --danger: #e05c5c;
  --danger-dim: #e05c5c22;
  --success: #4fc97e;
  --radius: 15px;
  --pill-radius: 999px;
  --sidebar-w: 248px;
}

html, body { height: 100%; overflow: hidden; }

/* Everything interactive must opt out of the body-level drag region */
button, input, select, textarea, a, label, [role="button"],
.device-item, .cat-nav, .settings-content, .device-list,
.flags-panel, .auth-bar, ul, li { -webkit-app-region: no-drag; }

body {
  -webkit-app-region: drag;
  background:
    radial-gradient(1200px 800px at -10% -20%, #2b31604f, transparent 65%),
    radial-gradient(1000px 700px at 120% 10%, #3d125a42, transparent 70%),
    linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
  color: var(--text);
  font-family: 'Roboto', 'Avenir Next', 'Segoe UI', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* Windows caption buttons for the custom title bar. macOS keeps its native
   traffic lights so each platform follows its own window conventions. */
.window-controls {
  display: none;
}
body.is-windows .window-controls {
  -webkit-app-region: drag;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 38px;
  border-bottom: 1px solid #ffffff17;
  background: #181d49;
}
.window-control {
  -webkit-app-region: no-drag;
  position: relative;
  width: 46px;
  height: 37px;
  min-width: 46px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #f5f5fa;
  background: transparent;
  cursor: default;
  transition: background-color 80ms linear, color 80ms linear;
}
body.is-windows:not(.window-focused) .window-control {
  color: #8f92ab;
}
.window-control::before,
.window-control::after {
  content: '';
  position: absolute;
  display: block;
  left: 50%;
  top: 50%;
}
.window-minimize::before {
  width: 10px;
  height: 1px;
  background: currentColor;
  transform: translate(-50%, 4px);
}
.window-maximize::before {
  width: 10px;
  height: 10px;
  border: 1px solid currentColor;
  transform: translate(-50%, -50%);
}
body.window-maximized .window-maximize::before {
  width: 8px;
  height: 8px;
  transform: translate(-3px, -5px);
}
body.window-maximized .window-maximize::after {
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  background: #181d49;
  transform: translate(-6px, -3px);
}
.window-close::before,
.window-close::after {
  width: 12px;
  height: 1px;
  background: currentColor;
}
.window-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.window-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.window-control:hover { background: #ffffff18; }
.window-control:active { background: #ffffff0d; }
.window-close:hover {
  color: #fff;
  background: #c42b1c;
}
.window-close:active { background: #b52617; }
.window-control:focus-visible {
  outline: 2px solid #ffffffb8;
  outline-offset: -2px;
}

/* ── Screens ──────────────────────────────────────────────────────────────── */
.screen        { display: none; height: 100vh; }
.screen.active { display: flex; }
body.is-windows .screen {
  height: calc(100vh - 38px);
  margin-top: 38px;
}
body.is-windows .settings-shell {
  height: 100%;
}

/* ── Connect screen ───────────────────────────────────────────────────────── */
.connect-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto;
  width: min(980px, calc(100vw - 28px));
  padding: 36px 0;
  gap: 20px;
}
.connect-main {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.connect-left,
.connect-right {
  width: 100%;
}
.connect-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#screen-connect.scanning .connect-main {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  height: min(560px, calc(100vh - 110px));
  max-height: calc(100vh - 110px);
  overflow: hidden;
}
#screen-connect.room-mode .connect-main {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  height: min(560px, calc(100vh - 110px));
  max-height: calc(100vh - 110px);
  overflow: hidden;
}
#screen-connect.scanning .connect-left,
#screen-connect.scanning .connect-right {
  background: #202454;
  border: 1px solid #ffffff1c;
  border-radius: 12px;
  padding: 12px;
  min-height: 0;
}
#screen-connect.room-mode .connect-left,
#screen-connect.room-mode .connect-right {
  background: #202454;
  border: 1px solid #ffffff1c;
  border-radius: 12px;
  padding: 12px;
  min-height: 0;
}
#screen-connect.scanning .connect-right {
  display: flex;
}
#screen-connect.room-mode .connect-right {
  display: flex;
}

.brand { text-align: center; }
.brand-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  display: block;
  margin: 0 auto 12px;
  filter: drop-shadow(0 10px 20px #6106cd33);
}
.brand-name { font-size: 32px; font-weight: 700; letter-spacing: -0.3px; }
.brand-sub  { color: var(--muted); margin-top: 6px; }

.scan-status { color: var(--muted); font-size: 12px; text-align: center; min-height: 16px; }
.ws-conn-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 16px;
  font-size: 12px;
  color: #cfd2ea;
}
.ws-conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d85353;
  box-shadow: 0 0 0 2px #00000020;
}
.ws-conn-status.connected .ws-conn-dot {
  background: #3fd47a;
}
.ws-conn-status.reconnecting .ws-conn-dot {
  background: #f0c14f;
}
.scan-status.spinning::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  border: 2px solid var(--muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.scan-row {
  width: 100%;
  display: block;
}
.scan-btn-wrap {
  position: relative;
  width: 100%;
}
.scan-btn-wrap .btn-primary {
  width: 100%;
  min-height: 46px;
  font-size: 15px;
}
#btn-demo {
  width: 100%;
  align-self: stretch;
  margin-top: 4px;
  min-height: 46px;
  font-size: 15px;
}
#btn-remote-demo {
  width: 100%;
  align-self: stretch;
  min-height: 42px;
  font-size: 14px;
}
#btn-remote {
  width: 100%;
  align-self: stretch;
  min-height: 46px;
  font-size: 15px;
}
.remote-actions {
  width: 100%;
  display: flex;
}
#btn-leave-room {
  min-height: 44px;
  font-size: 14px;
  width: 100%;
}
#btn-leave-room {
  background: #ffffff18;
  border: 1px solid #ffffff40;
  box-shadow: 0 5px 16px #00000030;
}
#btn-leave-room:hover:not(:disabled) {
  background: #ffffff24;
  border-color: #ffffff66;
}
#btn-leave-room:active:not(:disabled) {
  background: #ffffff2e;
}
.remote-auth-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.remote-share-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}
.remote-share-qr-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 2px 0 0;
}
.room-share-qr {
  width: 142px;
  height: 142px;
  border-radius: 12px;
  border: 1px solid #ffffff22;
  background: #f5f6ff;
  object-fit: contain;
  padding: 6px;
}
.room-share-link {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid #ffffff2d;
  background: #161a42;
  color: #d8dcff;
  font-family: inherit;
  font-size: 12px;
  padding: 0 10px;
}
.room-share-link:focus {
  outline: 1px solid #7d11ff;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #ffffff30;
  background: #ffffff14;
  color: #e8eaff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .1s ease;
}
.icon-btn svg {
  width: 17px;
  height: 17px;
}
.icon-btn:hover:not(:disabled) {
  background: #ffffff22;
  border-color: #ffffff58;
}
.icon-btn:active:not(:disabled) {
  transform: scale(.97);
}
#screen-connect .icon-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
#screen-connect .remote-auth-row .btn-google,
#screen-connect .remote-auth-row .btn-apple {
  min-height: 40px;
  font-size: 13px;
}
#screen-connect.scanning #btn-demo {
  width: 100%;
}
#screen-connect.room-mode .scan-row,
#screen-connect.room-mode #btn-remote-demo,
#screen-connect.room-mode #btn-demo,
#screen-connect.room-mode #btn-remote {
  display: none !important;
}
#screen-connect.room-mode.remote-controller .scan-row {
  display: block !important;
}
#screen-connect.room-mode.remote-controller #btn-remote-demo {
  display: block !important;
}
/* ── Device list ──────────────────────────────────────────────────────────── */
.device-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Leave room for the raised hover state and keyboard focus ring so the
     scroll container does not clip the first or last device card. */
  padding: 4px;
  max-height: 360px;
  overflow-y: auto;
  width: 100%;
}
#screen-connect.scanning .device-list {
  flex: 1;
  max-height: none;
  min-height: 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
#screen-connect.room-mode .device-list {
  flex: 1;
  max-height: none;
  min-height: 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
#screen-connect.scanning .device-list::-webkit-scrollbar,
#screen-connect.room-mode .device-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, transform .12s;
}
.device-item:hover { border-color: #ffffff55; transform: translateY(-1px); }
.device-item:focus-visible {
  outline: 2px solid #b98aff;
  outline-offset: 2px;
}
.device-item.likely { border-color: var(--accent-dim); }
.room-user-item {
  cursor: default;
}
.room-user-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.room-active-pill {
  border: 1px solid #58d59666;
  border-radius: 999px;
  background: #58d59622;
  color: #8ff3c2;
  font-size: 11px;
  font-weight: 700;
  height: 24px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
}
.room-action-btn {
  border: 1px solid #ffffff2f;
  border-radius: 9px;
  background: #ffffff12;
  color: #e7e9ff;
  font-size: 11px;
  font-weight: 600;
  height: 30px;
  padding: 0 10px;
  cursor: pointer;
  font-family: inherit;
}
.room-action-btn:hover:not(:disabled) {
  background: #ffffff22;
  border-color: #ffffff5a;
}
.room-action-btn:active:not(:disabled) {
  transform: scale(.98);
}
.room-action-btn:disabled {
  opacity: .6;
  cursor: default;
}
.room-action-btn.allow {
  background: linear-gradient(180deg, #7f2fff, #620ef0);
  border-color: #b48dff99;
}
.room-action-btn.allow:hover:not(:disabled) {
  background: linear-gradient(180deg, #8e41ff, #6b19f5);
  border-color: #ccb6ff;
}

.device-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.device-item.likely .device-dot { background: var(--success); }
.device-item .device-dot.signal-good { background: #36d779; }
.device-item .device-dot.signal-warn { background: #f2c34d; }
.device-item .device-dot.signal-poor { background: #ea5966; }
.device-item .device-dot.usb { background: #62a8ff; }

.device-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.device-name { font-weight: 600; }
.device-meta { color: var(--muted); font-size: 11px; }
.device-rssi { color: var(--muted); font-size: 11px; white-space: nowrap; }
.device-overflow {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: -4px -5px -4px 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.device-overflow:hover,
.device-overflow:focus-visible {
  border-color: #ffffff2f;
  background: #ffffff14;
  color: var(--text);
  outline: none;
}
.device-overflow svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  pointer-events: none;
}

.device-connect-menu {
  position: fixed;
  z-index: 1200;
  width: 210px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  border: 1px solid #ffffff30;
  border-radius: 12px;
  background: #171a3c;
  box-shadow: 0 16px 38px #00000066;
}
.device-connect-menu-item {
  min-height: 38px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: 600 13px/1.2 inherit;
  text-align: left;
  cursor: pointer;
}
.device-connect-menu-item:hover,
.device-connect-menu-item:focus-visible {
  background: #ffffff16;
  outline: none;
}
.device-connect-menu-detected {
  color: #9ce9c4;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.room-snackbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translate(-50%, 16px);
  min-width: 260px;
  max-width: min(520px, calc(100vw - 28px));
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #ffffff26;
  background: #1e234f;
  color: #eef0ff;
  box-shadow: 0 10px 24px #0000004d;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
  z-index: 80;
}
.room-snackbar.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.room-snackbar-text {
  flex: 1;
  font-size: 12px;
  line-height: 1.35;
}
.room-snackbar-action {
  border: 1px solid #ffffff3a;
  border-radius: 8px;
  background: #ffffff12;
  color: #f2f3ff;
  font-size: 12px;
  height: 28px;
  padding: 0 10px;
  cursor: pointer;
  font-family: inherit;
}
.room-snackbar-action:hover:not(:disabled) {
  background: #ffffff22;
  border-color: #ffffff66;
}
.room-snackbar-close {
  border: none;
  background: transparent;
  color: #cfd3ee;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.room-snackbar-close:hover {
  background: #ffffff18;
  color: #ffffff;
}

.remote-session-banner {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #7a3fff70;
  background: #1a1f49d9;
  box-shadow: 0 8px 20px #0000004a;
  color: #f0f1ff;
  font-size: 12px;
  font-weight: 600;
}
.remote-session-banner .btn-ghost.btn-xs {
  border-color: #ffffff38;
  height: 24px;
  font-size: 11px;
  padding: 0 8px;
}

/* ── Settings screen ──────────────────────────────────────────────────────── */
.settings-shell {
  display: flex;
  width: 100%;
  height: 100vh;
  background:
    radial-gradient(900px 460px at 20% -15%, #252c5a3d, transparent 72%),
    linear-gradient(180deg, #0f1336 0%, #0a0d27 100%);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  height: 100%;
  background: #202454;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  min-height: 0;
}

.sidebar-header {
  padding: 8px 14px 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  -webkit-app-region: drag;
  position: relative;
  min-height: 36px;
}
.is-mac .sidebar-header {
  min-height: 52px;
  padding: 26px 14px 6px;
}
.conn-name {
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  background: #0fd27a22;
  color: #87f7c1;
  font-weight: 600;
  flex-shrink: 0;
}

.monitor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.monitor-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  background: var(--surface2);
  gap: 2px;
}
.monitor-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.monitor-value { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.monitor-unit  { font-size: 10px; color: var(--muted); }

/* ── Voltage sag row ───────────────────────────────────────────────────────── */
.sag-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.sag-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 6px;
  gap: 2px;
  background: var(--surface2);
}
.sag-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  white-space: normal;
  line-height: 1.3;
  min-height: 2.6em;
}
.sag-value {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sag-value.good   { color: #3ddc84; }
.sag-value.warn   { color: #ffb74d; }
.sag-value.danger { color: #e05252; }
.sag-unit { font-size: 10px; color: var(--muted); }

/* info icon tooltip */
.info-icon {
  font-size: 10px;
  color: var(--muted);
  cursor: help;
  position: relative;
  -webkit-app-region: no-drag;
}
.info-icon::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #f4f4ff;
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 10px;
  width: 180px;
  white-space: normal;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
  z-index: 300;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.info-icon:hover::after { opacity: 1; }
.info-icon-left::after {
  left: auto;
  right: 0;
  transform: none;
}

/* ── Flags panel ───────────────────────────────────────────────────────────── */
.flags-panel {
  position: relative;
  margin: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: visible;
}
.flags-panel.has-fault {
  border-color: var(--danger);
  background: var(--danger-dim);
}
.flags-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
}
.flags-dots { display: grid; grid-template-columns: repeat(11, 10px); gap: 4px; }
.flags-summary { font-size: 11px; color: var(--muted); flex: 1; }
.flags-popover {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: block;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity .12s ease, transform .12s ease;
  z-index: 210;
  padding: 6px 10px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #1d214e;
  box-shadow: 0 10px 24px #00000044;
}
.flags-panel:hover .flags-popover,
.flags-panel:focus-within .flags-popover,
.flags-panel.autoshot-open .flags-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.flags-group-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin: 6px 0 4px;
}
.flags-row { display: flex; flex-wrap: wrap; gap: 6px; }
.flag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  cursor: default;
}
.flags-dots .flag-dot::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #f4f4ff;
  border: 1px solid var(--border);
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
  z-index: 200;
}
.flags-dots .flag-dot:hover::after { opacity: 1; }
.flag-dot.fault    { background: #e05252; box-shadow: 0 0 4px #e0525288; }
.flag-dot.ok       { background: #3ddc8459; }
.flag-dot.active   { background: #3ddc84; }
.flag-dot.inactive { background: #3ddc8430; }
.flag-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}
.flag-item.fault  { color: #e05252; }
.flag-item.active { color: #3ddc84; }

/* ── Flash info rows ───────────────────────────────────────────────────────── */
.flash-info {
  background: transparent;
  flex-shrink: 0;
  margin: 0 0 2px;
  width: 100%;
}
.flash-info-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.flash-info-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid #ffffff12;
}
.flash-info-label {
  font-size: 10px;
  color: var(--label);
  letter-spacing: .3px;
}
.flash-info-value { font-size: 24px; line-height: 1.05; font-weight: 500; }

.cat-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cat-nav.is-overflowing {
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #ffffff52 #11153452;
}
.cat-nav.is-overflowing::-webkit-scrollbar {
  width: 9px;
}
.cat-nav.is-overflowing::-webkit-scrollbar-track {
  background: #11153452;
  border-radius: 999px;
}
.cat-nav.is-overflowing::-webkit-scrollbar-thumb {
  background: #ffffff52;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
.cat-nav.is-overflowing::-webkit-scrollbar-thumb:hover {
  background: #ffffff70;
  background-clip: padding-box;
}
.cat-nav-item {
  flex: 0 0 auto;
  position: relative;
  padding: 7px 9px;
  padding-right: 22px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  transition: background .12s, color .12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-nav-item:hover {
  background: #ffffff0f;
  color: var(--text);
}
.cat-nav-item.active {
  background: linear-gradient(135deg, #7d11ff 0%, #5f0cff 100%);
  color: #fff;
  font-weight: 600;
}
.cat-nav-item.changed::after {
  content: '*';
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--label);
  font-weight: 700;
}
.cat-nav-item.active.changed::after {
  color: #fff;
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-footer-btns {
  display: flex;
  gap: 6px;
}

/* ── Auth bar ─────────────────────────────────────────────────────────────── */
.auth-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
.btn-google,
.btn-apple {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-google:hover,
.btn-apple:hover { background: var(--surface); }
.google-icon { width: 14px; height: 14px; flex-shrink: 0; }
.apple-icon  { width: 14px; height: 14px; flex-shrink: 0; }

.auth-user {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow: hidden;
}
.auth-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.auth-name {
  font-size: 12px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-xs {
  font-size: 11px;
  padding: 3px 8px;
  flex-shrink: 0;
}

/* Main */
.settings-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.telemetry-only-state {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px;
  color: var(--text);
}
.telemetry-only-state h2 {
  margin: 12px 0 8px;
  font-size: 24px;
}
.telemetry-only-state p {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
.telemetry-only-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, #7027ff, #2b8cff);
  box-shadow: 0 18px 40px #5719e84d;
  font-size: 38px;
  font-weight: 700;
}

.settings-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  width: min(920px, calc(100% - 24px));
  margin: 0;
  -webkit-app-region: drag;
  background: transparent;
  border: none;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  pointer-events: auto;
}
.toolbar-right { display: flex; gap: 8px; margin-left: auto; }

.settings-search-wrap {
  width: min(920px, calc(100% - 24px));
  margin: 0;
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid #ffffff24;
  background: #2a2b4d;
  box-shadow: 0 12px 22px #00000033;
}
.settings-search-icon {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.settings-search-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.settings-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}
.settings-search-input::placeholder {
  color: #a2a7ca;
}
.settings-search-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #ffffff2f;
  background: #ffffff12;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}
.settings-search-trash {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #ffffff80;
  background: #ffffff;
  color: #2a2f57;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.settings-search-trash:hover:not(:disabled) {
  background: #f5f7ff;
  border-color: #ffffff;
}
.settings-search-trash svg {
  width: 20px;
  height: 20px;
  display: block;
}
.settings-main.search-active .settings-content {
  padding-top: 156px;
}
.settings-bottom-actions {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 8;
}
.settings-bottom-review {
  flex: 1 1 auto;
  min-height: 52px;
  border-radius: 999px !important;
  padding: 0 24px;
  font-size: 15px !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 22px #0000004a;
}
.settings-bottom-actions .settings-bottom-review {
  background: linear-gradient(90deg, #46499b 0%, #de3657 100%) !important;
  border: 1px solid #ffffff40 !important;
  color: #f6f7ff !important;
}
.settings-search-fab {
  margin-left: auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(90deg, #46499B 0%, #DE3657 100%);
  color: var(--text);
  font-size: 20px;
  box-shadow: 0 12px 22px #0000004a;
  cursor: pointer;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.settings-search-fab svg {
  width: 22px;
  height: 22px;
  display: block;
}
.settings-search-fab:hover {
  filter: brightness(1.06);
}

.progress-wrap {
  width: min(920px, calc(100% - 24px));
  margin: 0 auto;
  padding: 2px 2px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.progress-wrap.progress-centered {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1200;
  width: min(640px, calc(100% - 40px));
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(14, 16, 24, 0.88);
  border: 1px solid #ffffff22;
  box-shadow: 0 16px 36px #0000008a;
  backdrop-filter: blur(4px);
}
.progress-bar-track {
  flex: 1;
  height: 5px;
  background: #ffffff1c;
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 5px;
  width: 0%;
  background: linear-gradient(90deg, #7d11ff 0%, #d63169 100%);
  border-radius: 99px;
  transition: width .1s;
}
.progress-label { font-size: 12px; color: var(--muted); white-space: nowrap; }

.settings-content {
  flex: 1;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 54px 0 120px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(920px, calc(100% - 24px));
  margin: 0 auto;
  -ms-overflow-style: auto;
  scrollbar-width: thin;
  scrollbar-color: #ffffff38 transparent;
}
.settings-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.settings-content::-webkit-scrollbar-thumb {
  background: #ffffff38;
  border-radius: 999px;
}
.settings-content::-webkit-scrollbar-thumb:hover {
  background: #ffffff58;
}

/* ── Category sections ─────────────────────────────────────────────────────── */
.cat-section { margin-bottom: 4px; }
.cat-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #8a8fb8;
  padding: 2px 2px 6px;
}

/* ── Settings card grid ────────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.settings-grid.braking-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.settings-grid.other-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.settings-grid.info-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.grid-break {
  grid-column: 1 / -1;
  height: 0;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 9px 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px solid #ffffff12;
}
.card.span-1 { grid-column: span 1; }
.card.span-2 { grid-column: span 2; }
.card.span-4 { grid-column: 1 / -1; }
.card.changed {
  border-color: #8f5bff;
  box-shadow: inset 0 0 0 1px #8f5bff42;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-head-controls {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card-head-controls .clear-change-btn {
  margin-left: 0;
}
.previous-setting-value {
  flex: 0 0 auto;
  max-width: 38%;
  overflow: hidden;
  color: #9ba0bd;
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  text-decoration: line-through;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: .72;
}
.setting-value-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.setting-value-row .pill-row {
  flex: 1;
  min-width: 0;
}
.setting-value-row .enum-select-row {
  flex: 1;
  min-width: 0;
}

.card-label {
  font-size: 11px;
  color: var(--label);
  letter-spacing: .3px;
}
.card-label.has-tooltip {
  cursor: help;
}
.card-label.has-tooltip:focus-visible {
  outline: 2px solid #9a76ff88;
  outline-offset: 3px;
  border-radius: 2px;
}
.setting-tooltip {
  position: fixed;
  z-index: 2000;
  width: min(360px, calc(100vw - 20px));
  padding: 9px 11px;
  border: 1px solid #ffffff2b;
  border-radius: 9px;
  background: #171a37f5;
  color: #f4f5ff;
  box-shadow: 0 10px 28px #00000066;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
  white-space: pre-line;
  pointer-events: none;
}
.clear-change-btn {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #ffffff33;
  background: #ffffff12;
  color: #f4f4ff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.clear-change-btn:hover {
  background: #ffffff1f;
  border-color: #ffffff59;
}

.card-value {
  font-size: 24px;
  line-height: 1.05;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ── Segmented buttons ─────────────────────────────────────────────────────── */
.pill-row {
  display: flex;
  gap: 0;
  border-radius: var(--pill-radius);
  background: #181c4a;
  padding: 0;
  border: 1px solid #ffffff12;
  overflow: hidden;
}
.pill {
  flex: 1;
  position: relative;
  min-width: 0;
  padding: 8px 6px;
  border: none;
  border-right: 1px solid #ffffff14;
  background: transparent;
  color: #8f94b8;
  font-size: 15px;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .12s, color .12s, box-shadow .12s;
  text-align: center;
}
.pill:last-child { border-right: none; }
.pill.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  z-index: 1;
}
.pill.previous:not(.active) {
  color: #a6aac5;
  text-decoration: line-through;
  text-decoration-color: #d4d7e8;
  text-decoration-thickness: 1px;
}
.pill.active::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid #fff;
  pointer-events: none;
}
.pill:first-child.active::after {
  border-radius: var(--pill-radius) 0 0 var(--pill-radius);
}
.pill:last-child.active::after {
  border-radius: 0 var(--pill-radius) var(--pill-radius) 0;
}
.pill:only-child.active::after {
  border-radius: var(--pill-radius);
}
.pill:disabled { cursor: not-allowed; opacity: .45; }
.pill:hover:not(:disabled):not(.active) { background: #252a5d; color: var(--text); }

/* ── Large enum dropdowns ─────────────────────────────────────────────────── */
.enum-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.enum-dropdown-shell {
  flex: 1;
  min-width: 0;
  position: relative;
}
.enum-dropdown-trigger {
  width: 100%;
  height: 34px;
  padding: 0 38px 0 11px;
  border: 1px solid #ffffff24;
  border-radius: 9px;
  background: linear-gradient(180deg, #202657 0%, #181c4a 100%);
  color: var(--text);
  display: flex;
  align-items: center;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-align: left;
}
.enum-dropdown-trigger:hover,
.enum-dropdown-trigger.open {
  border-color: #ffffff42;
  background: linear-gradient(180deg, #282e63 0%, #1d2251 100%);
}
.enum-dropdown-trigger:focus-visible {
  outline: 2px solid #9a76ff88;
  outline-offset: 2px;
}
.enum-dropdown-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.enum-select-chevron {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 7px;
  height: 7px;
  border-right: 2px solid #a995e9;
  border-bottom: 2px solid #a995e9;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
  transition: transform .14s ease;
}
.enum-dropdown-trigger.open .enum-select-chevron {
  transform: translateY(-30%) rotate(225deg);
}
.enum-undo-btn {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 9px;
  border: 1px solid #9a66ff55;
  border-radius: 8px;
  background: #8f5bff16;
  color: #c8b5ff;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.enum-undo-btn:hover {
  border-color: #a87dff99;
  background: #8f5bff29;
  color: #fff;
}
.enum-dropdown-menu {
  position: fixed;
  z-index: 2100;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #ffffff26;
  border-radius: 12px;
  background: #151936f7;
  box-shadow: 0 18px 48px #050715b8, inset 0 1px 0 #ffffff0d;
  backdrop-filter: blur(18px);
}
.enum-dropdown-option {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #b8bcd5;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.enum-dropdown-option:hover,
.enum-dropdown-option:focus-visible {
  border-color: #a87dff44;
  outline: none;
  background: #292e60;
  color: #fff;
}
.enum-dropdown-option.active {
  background: linear-gradient(135deg, #6e36cf66 0%, #45238c88 100%);
  color: #fff;
}
.enum-dropdown-option.previous:not(.active) .enum-dropdown-option-label {
  color: #a6aac5;
  text-decoration: line-through;
  text-decoration-color: #d4d7e8;
  text-decoration-thickness: 1px;
}
.enum-dropdown-check {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1px solid #ffffff1f;
  border-radius: 50%;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}
.enum-dropdown-option.active .enum-dropdown-check {
  border-color: #baa0ff;
  background: #8f5bff;
  color: #fff;
}
.enum-dropdown-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Boolean switch control ───────────────────────────────────────────────── */
.switch-row {
  width: 52px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.switch-track {
  width: 100%;
  position: relative;
  height: 100%;
  border-radius: 999px;
  background: #2a2f5d;
  border: 1px solid #ffffff30;
  transition: background .15s, border-color .15s;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #c8cee8;
  box-shadow: 0 4px 10px #00000055;
  transition: transform .16s ease, background .15s ease;
}
.switch-row.on .switch-track {
  background: #35105f;
  border-color: #b989ff80;
}
.switch-row.on .switch-thumb {
  transform: translateX(24px);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
}
.switch-row:focus-visible {
  outline: 2px solid #ffffff99;
  outline-offset: 1px;
}

/* ── Slider control ────────────────────────────────────────────────────────── */
.slider-wrap { display: flex; flex-direction: column; gap: 7px; }
.slider-top { display: flex; align-items: center; gap: 8px; }
.slider-val {
  font-size: 26px;
  line-height: 1;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  padding: 3px 6px;
  font-family: inherit;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.slider-val:hover {
  border-color: #ffffff24;
}
.slider-val:focus {
  outline: 2px solid #9a76ff88;
  border-color: #b989ff;
  background: #10132b;
}
.slider-val::-webkit-inner-spin-button,
.slider-val::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.number-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.numeric-setting-input {
  min-width: 0;
  width: 100%;
  border: 1px solid #ffffff24;
  border-radius: 10px;
  background: #10132b;
  color: #f7f8ff;
  padding: 9px 10px;
  font: 600 16px/1.2 inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.numeric-setting-input::-webkit-inner-spin-button,
.numeric-setting-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.numeric-setting-input:focus {
  outline: 2px solid #9a76ff88;
  border-color: #b989ff;
}
.numeric-setting-unit {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

input[type=range].styled-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 14px;
  border-radius: 99px;
  background: linear-gradient(90deg, #5352b8 0%, #d6345f 100%);
  outline: none;
  cursor: pointer;
}
input[type=range].styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f6f7f9;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 16px #0000003a;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
  border: none;
  border-radius: 11px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  font-family: inherit;
}
.btn-sm { padding: 6px 10px; font-size: 11px; border-radius: 9px; }
.btn-primary {
  background: linear-gradient(135deg, #8d22ff 0%, #600eff 100%);
  color: #fff;
}
.btn-secondary { background: #ffffff12; color: var(--text); border: 1px solid #ffffff1f; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
button:hover:not(:disabled) { opacity: .9; }
button:active:not(:disabled) { transform: scale(.98); }
button:disabled { opacity: .4; cursor: not-allowed; }

/* Review modal */
.modal {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 24, .7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: min(520px, calc(100vw - 24px));
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-box h2 { font-size: 17px; }
.review-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.review-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #181d4a;
  border-radius: 10px;
  font-size: 12px;
}
.review-name { flex: 1; }
.review-change { display: flex; align-items: center; gap: 8px; }
.review-old { color: var(--muted); text-decoration: line-through; }
.review-arrow { color: var(--muted); }
.review-new { color: #be8fff; font-weight: 600; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; }
.modal-message { font-size: 14px; color: var(--muted); margin: 8px 0 16px; }
.purchase-modal-box { width: min(500px, calc(100vw - 24px)); }
.purchase-modal-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.purchase-modal-heading .modal-message { margin-bottom: 0; }
.purchase-lock-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #d63487 0%, #711cff 100%);
  border-radius: 12px;
}
.purchase-lock-icon svg { width: 25px; height: 25px; }
.purchase-product-description {
  margin: 0;
  color: var(--text);
  font-size: 13px;
}
.purchase-status-message {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.purchase-status-message.is-error { color: #ff7e9f; }
.purchase-modal-footer { flex-wrap: wrap; }
.purchase-write-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.purchase-write-button svg { width: 15px; height: 15px; }
.usb-driver-box { width: min(540px, calc(100vw - 24px)); }
.usb-driver-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.usb-driver-heading .modal-message { margin-bottom: 0; }
.usb-driver-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #62a8ff55;
  border-radius: 13px;
  background: #62a8ff1c;
  color: #9bc9ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}
.usb-driver-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff08;
  font-size: 12px;
}
.usb-driver-details span { color: var(--muted); }
.usb-driver-details strong { color: var(--text); font-weight: 650; }
.usb-driver-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.demo-controller-box { width: min(780px, calc(100vw - 24px)); }
.demo-controller-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  overflow-y: auto;
}
.demo-controller-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-height: 166px;
  padding: 10px;
  border: 1px solid #ffffff1f;
  border-radius: 12px;
  color: var(--text);
  background: #181d4a;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.demo-controller-image {
  width: 100%;
  height: 92px;
  display: block;
  object-fit: contain;
  box-sizing: border-box;
  padding: 12px 16px;
}
.demo-controller-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 4px 4px;
}
.demo-controller-option:hover,
.demo-controller-option:focus-visible {
  border-color: #9850ff;
  background: #292f69;
  outline: none;
}
.demo-controller-name { font-size: 14px; font-weight: 700; }
.demo-controller-description { color: var(--muted); font-size: 12px; line-height: 1.35; }
.preset-name-input {
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid #ffffff2f;
  background: #141945;
  color: #eef0ff;
  padding: 0 11px;
  font-family: inherit;
  font-size: 14px;
}
.preset-name-input:focus {
  outline: 1px solid #7d11ff;
}
.preset-item {
  cursor: pointer;
}
.preset-item.active {
  border: 1px solid #8b47ff;
  background: #2a2f6a;
}

/* Utilities */
.hidden { display: none !important; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ffffff24; border-radius: 6px; }

@media (max-width: 900px) {
  .demo-controller-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { width: 218px; }
  .flash-info-row { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid.braking-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid.info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid.other-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card.span-1,
  .card.span-2,
  .card.span-4 { grid-column: span 1; }
}

@media (max-width: 560px) {
  .demo-controller-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  #screen-connect.scanning .connect-main {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .sidebar { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid.braking-grid { grid-template-columns: 1fr; }
  .settings-grid.info-grid { grid-template-columns: 1fr; }
  .settings-grid.other-grid { grid-template-columns: 1fr; }
  .card.span-1,
  .card.span-2,
  .card.span-4 { grid-column: span 1; }
  .settings-toolbar,
  .settings-content,
  .flash-info,
  .progress-wrap {
    width: calc(100% - 16px);
  }
  .flash-info-row { grid-template-columns: 1fr 1fr; }
  .card,
  .flash-info-cell { border-radius: 13px; }
  .card-value,
  .flash-info-value,
  .slider-val { font-size: 24px; }
}
