/* Open Headset Control Panel · Web — same G HUB-inspired palette as the desktop app (openheadset/ui/theme.py). */
:root {
  --bg0: #0a0a0b;
  --bg1: #111113;
  --bg2: #18181b;
  --bg3: #222226;
  --bg4: #2c2c31;
  --line: #26262b;
  --text: #f1f1f3;
  --text2: #a3a3ad;
  --text3: #6c6c76;
  --accent: #00b4f5;
  --accent-hi: #3fd0ff;
  --good: #3ddc84;
  --warn: #ffb020;
  --bad: #ff4d5a;
  --tint: #00b4f5;
  --font: "Inter", "Noto Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg0);
  color: var(--text);
  font: 14px/1.45 var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}
/* The app lives in a "window": full-bleed on normal screens, a floating centred
   panel (like the desktop app) once the viewport is much larger than needed. */
.window {
  --win-w: 1360px;
  --win-h: 880px;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, var(--win-w));
  height: min(100%, var(--win-h));
  background: var(--bg0);
  overflow: hidden;
}
@media (min-width: 1440px), (min-height: 960px) {
  body {
    background:
      radial-gradient(1200px 700px at 50% 42%, rgba(0, 180, 245, .07), transparent 70%),
      radial-gradient(circle at 50% 50%, #121215 0%, #050506 75%);
  }
  .window {
    border: 1px solid var(--bg4);
    border-radius: 12px;
    box-shadow: 0 40px 120px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .02);
  }
}
@media (min-width: 1440px) and (max-height: 959px) { .window { height: calc(100% - 48px); } }
@media (min-height: 960px) and (max-width: 1439px) { .window { width: calc(100% - 48px); } }
[hidden] { display: none !important; }
a { color: var(--accent); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* typography */
.h1 { font-size: 26px; font-weight: 300; letter-spacing: 4px; text-transform: uppercase; margin: 0; }
.h2 { font-size: 13px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; margin: 0 0 6px; }
.h3 { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--text3); margin: 0; }
.muted { color: var(--text2); }
.faint { color: var(--text3); font-size: 12.5px; margin: 0; }
.center { text-align: center; }
code { background: var(--bg3); border: 1px solid var(--bg4); border-radius: 4px; padding: 2px 6px; font-size: 12px; display: inline-block; margin-top: 6px; }

/* buttons */
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.primary, .ghost {
  border-radius: 4px; padding: 9px 18px; font-weight: 600; letter-spacing: 1px; border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
}
.primary { background: var(--accent); color: #00131c; }
.primary:hover { background: var(--accent-hi); }
.ghost { background: transparent; border-color: var(--bg4); color: var(--text2); text-decoration: none; }
.ghost:hover { color: var(--text); border-color: var(--text3); }
.small { padding: 6px 14px; font-size: 12.5px; }
.big { padding: 14px 34px; font-size: 15px; letter-spacing: 2px; text-transform: uppercase; }
button:disabled { opacity: .45; cursor: default; }
.icon-btn { background: none; border: 0; color: var(--text2); width: 46px; height: 48px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--bg3); color: var(--text); }

/* title bar */
.titlebar {
  height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 14px 0 6px;
  background: var(--bg1); border-bottom: 1px solid var(--line); position: relative;
}
.brand { display: flex; gap: 6px; align-items: baseline; padding-left: 8px; font-size: 15px; letter-spacing: 3px; }
.brand b { font-weight: 800; }
.brand span { font-weight: 300; color: var(--accent); }
.brand em { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--text3);
  border: 1px solid var(--bg4); border-radius: 3px; padding: 1px 5px; margin-left: 4px; }
.actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.profile-btn {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 14px;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
}
.profile-btn:hover, .profile-btn.open { background: var(--bg2); border-color: var(--bg4); }
.profile-btn.open { border-color: var(--accent); }
.profile-btn svg { width: 15px; height: 15px; color: var(--text2); }
.profile-btn .cap { color: var(--text3); font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.profile-btn .val { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }

main { flex: 1; min-height: 0; display: flex; }

/* landing */
.landing {
  flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 18px 24px 40px; gap: 14px;
  background: radial-gradient(ellipse at 50% 30%, #17171a 0%, var(--bg0) 70%);
}
.landing .lead { max-width: 620px; margin: 0; }
.landing .banner, .landing .faint { max-width: 680px; }
.small-print { margin-top: 18px !important; }
.models { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 980px; }
.model {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 150px; padding: 12px 8px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px;
}
.model img { width: 92px; height: 92px; object-fit: contain; }
.model small { color: var(--text3); font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; }
.model small.ok { color: var(--good); }

/* product stage (spotlight + reflection) */
.stage { position: relative; display: grid; place-items: center; width: min(520px, 90vw); aspect-ratio: 1 / .78; }
.stage::before {
  content: ""; position: absolute; inset: 4% 12%; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tint) 34%, transparent), transparent);
  transition: background .4s;
}
.stage img {
  position: relative; max-width: 78%; max-height: 92%; object-fit: contain;
  -webkit-box-reflect: below 2px linear-gradient(transparent 72%, rgba(0,0,0,.18));
  filter: drop-shadow(0 26px 22px rgba(0,0,0,.7)); transition: transform .25s, filter .4s;
}
.stage.off img { filter: grayscale(1) brightness(.6) drop-shadow(0 26px 22px rgba(0,0,0,.7)); }
.stage.off::before { background: radial-gradient(closest-side, rgba(255,255,255,.06), transparent); }
.stage-card .stage, .stage.small { width: 100%; aspect-ratio: auto; height: clamp(320px, 52vh, 560px); }

/* device layout */
.app { flex: 1; display: flex; min-height: 0; }
.rail { position: relative; width: 72px; flex: none; background: var(--bg1); border-right: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; gap: 2px; }
.rail button { position: relative; z-index: 1; width: 72px; height: 64px; background: none; border: 0; color: var(--text3); display: grid; place-items: center; }
.rail button svg { width: 24px; height: 24px; }
.rail button:hover { color: var(--text); background: #17171a; }
.rail button.active { color: var(--text); background: none; }
.indicator {
  position: absolute; left: 0; width: 72px; height: 64px; background: var(--bg2); z-index: 0;
  transition: transform .28s cubic-bezier(.22,.61,.36,1);
}
.indicator::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--accent); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dev-header { height: 76px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 36px; border-bottom: 1px solid var(--line); }
.dev-name { font-size: 21px; }
.status { display: flex; align-items: center; gap: 12px; }
.status-text { color: var(--accent); }
.status-text.warn { color: var(--warn); }
.batt-pct { font-size: 15px; font-weight: 600; min-width: 40px; }
.chip { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 4px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text2); }
.chip.warn { color: var(--warn); border-color: rgba(255,176,32,.35); cursor: help; }

/* battery glyph */
.battery { position: relative; width: 34px; height: 16px; border: 1.4px solid var(--text2); border-radius: 3px; }
.battery::after { content: ""; position: absolute; right: -4px; top: 4px; width: 2.5px; height: 5px; background: var(--text2); border-radius: 1px; }
.battery i { position: absolute; left: 2px; top: 2px; bottom: 2px; width: 0; border-radius: 1.5px; background: var(--good); transition: width .4s, background .4s; }
.battery.charging i { background: var(--accent); }
.battery.low i { background: var(--warn); }
.battery.crit i { background: var(--bad); }
.battery.large { width: 58px; height: 26px; }
.battery.large::after { top: 8px; height: 8px; right: -5px; width: 3px; }
.big-batt { display: flex; align-items: center; gap: 16px; }
.big { font-size: 38px; font-weight: 200; }

.pages { flex: 1; min-height: 0; position: relative; }
.page { position: absolute; inset: 0; overflow: auto; padding: 28px 36px; display: none; animation: fade .18s ease-out; }
.page.active { display: block; }
.page.grid2.active { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 20px; align-content: start; }
.device-page.active { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) !important; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.stack { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.stage-card { align-items: center; justify-content: center; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.banner { background: rgba(255,176,32,.10); border: 1px solid rgba(255,176,32,.35); border-radius: 4px; color: var(--warn); padding: 8px 12px; margin: 0; }

/* equalizer */
.eq-page.active { display: flex; padding: 0; }
.presets { width: 250px; flex: none; background: var(--bg1); border-right: 1px solid var(--line); padding: 24px 0 16px; display: flex; flex-direction: column; }
.presets .h3 { padding: 0 20px 10px; }
.preset-list { flex: 1; overflow: auto; }
.preset-list .h3 { padding-top: 18px; }
.preset {
  display: block; width: 100%; text-align: left; padding: 11px 18px; background: none; border: 0;
  border-left: 3px solid transparent; color: var(--text2); letter-spacing: .3px;
}
.preset:hover { background: var(--bg2); color: var(--text); }
.preset.active { background: var(--bg2); color: var(--text); border-left-color: var(--accent); }
.preset-actions { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 0; }
.eq-area { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 28px 36px 24px; }
.eq-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.eq-head-right { display: flex; align-items: center; gap: 16px; }
.preset-name { color: var(--accent); font-size: 15px; font-weight: 600; }
.eq-canvas { flex: 1; min-height: 260px; width: 100%; outline: none; touch-action: none; }
.eq-canvas.disabled { opacity: .55; }

/* sliders */
.slider-row { display: flex; justify-content: space-between; color: var(--text2); }
.slider-row b { color: var(--accent); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: none; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent)) 0/var(--fill, 0%) 100% no-repeat, var(--bg4); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--text); }
input[type=range]:hover::-webkit-slider-thumb { background: var(--accent-hi); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--bg4); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--text); }
input[type=range]:disabled { opacity: .4; }
select { background: var(--bg3); border: 1px solid var(--bg4); border-radius: 4px; padding: 6px 10px; min-width: 130px; }

/* headset controls */
.controls-page.active { display: flex; flex-direction: column; gap: 20px; }
.controls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.segments.wrap { flex-wrap: wrap; }
.segments.wrap button { flex: 1 1 120px; }
.accent { color: var(--accent); }
.mixbar { position: relative; height: 8px; margin: 10px 9px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), #bf5af2); }
.mixbar i { position: absolute; top: 50%; left: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: #fff; border: 3px solid var(--bg2); transition: left .3s ease; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0; }
.switch { position: relative; flex: none; width: 42px; height: 24px; border-radius: 12px; border: 0; background: var(--bg4); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch[aria-checked=true] { background: var(--accent); }
.switch[aria-checked=true]::after { transform: translateX(18px); }
.card[disabled] { opacity: .5; pointer-events: none; }

/* landing: other brands */
.brands { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 28px; max-width: 980px; width: 100%; text-align: left; }
.brands h4 { margin: 0 0 4px; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--text2); }
.brands ul { margin: 0; padding: 0; list-style: none; color: var(--text3); font-size: 12.5px; line-height: 1.7; }
.brands li small { color: var(--warn); margin-left: 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; }

/* lighting */
.segments { display: flex; gap: 8px; }
.segments button { flex: 1; background: var(--bg3); border: 1px solid var(--bg4); border-radius: 6px; padding: 8px 12px; color: var(--text2); }
.segments button:hover { color: var(--text); }
.segments button.active { background: rgba(0,180,245,.14); border-color: var(--accent); color: var(--text); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; padding: 3px; background: none; }
.swatch i { display: block; width: 100%; height: 100%; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); }
.swatch.active { border-color: var(--text); }
.swatches input[type=color] { width: 34px; height: 34px; border: 0; padding: 0; background: none; cursor: pointer; }

/* key/value lists */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 9px 24px; margin: 0; }
.kv dt { color: var(--text2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.mono dt { font-family: ui-monospace, monospace; font-size: 12.5px; }

/* profile popup */
.popup {
  position: fixed; z-index: 20; width: 280px; padding: 10px 8px 8px; background: var(--bg2); border: 1px solid var(--bg4);
  border-radius: 10px; box-shadow: 0 12px 34px rgba(0,0,0,.6); animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.popup .h3 { padding: 4px 12px 8px; }
.popup button { display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 12px; background: none; border: 0; border-radius: 6px; color: var(--text2); text-align: left; }
.popup button:hover { background: var(--bg3); color: var(--text); }
.popup button.active { background: rgba(0,180,245,.10); color: var(--text); font-weight: 600; }
.popup button.active svg:first-child, .popup .check { color: var(--accent); }
.popup button.danger:hover { color: var(--bad); }
.popup button:disabled { color: var(--text3); background: none; }
.popup .check { margin-left: auto; }
.popup hr { border: 0; border-top: 1px solid var(--bg4); margin: 6px; }

dialog { background: var(--bg1); color: var(--text); border: 1px solid var(--bg4); border-radius: 10px; padding: 20px 22px; min-width: 320px; }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h3 { margin: 0 0 12px; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
dialog label { display: block; color: var(--text2); margin-bottom: 6px; }
dialog input { width: 100%; background: var(--bg3); border: 1px solid var(--bg4); border-radius: 4px; padding: 8px 10px; outline: none; }
dialog input:focus { border-color: var(--accent); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 30; background: var(--bg3); border: 1px solid var(--accent);
  border-radius: 6px; padding: 10px 16px; max-width: 560px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.toast.error { border-color: var(--bad); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }

@media (max-width: 860px) {
  .profile-btn { position: static; transform: none; }
  #desktopLink { display: none; }
  .page.grid2.active, .device-page.active { grid-template-columns: 1fr !important; }
  .eq-page.active { flex-direction: column; }
  .presets { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .preset-list { display: flex; overflow-x: auto; }
  .preset { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .preset.active { border-bottom-color: var(--accent); }
  .dev-header, .page, .eq-area { padding-left: 16px; padding-right: 16px; }
}
