:root {
  color-scheme: dark;
  --bg: #07111d;
  --bg-soft: #0b1725;
  --panel: #101f30;
  --panel-2: #14273a;
  --panel-3: #091622;
  --line: #294257;
  --line-soft: #203649;
  --text: #f1f7fa;
  --muted: #91a5b5;
  --mint: #73f0c0;
  --mint-strong: #a1ffda;
  --blue: #80aefc;
  --amber: #ffc36d;
  --danger: #ff8294;
  --shadow: 0 24px 70px rgb(0 0 0 / 36%);
  --sidebar-width: clamp(11rem, 18vw, 15.375rem);
  --page-padding: clamp(1.25rem, 4vw, 3.375rem);
  --panel-padding: clamp(1rem, 2.25vw, 1.3125rem);
  --control-height: 2.5rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 20rem; margin: 0; background: radial-gradient(circle at 88% 2%, #12374a 0, transparent 31rem), var(--bg); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: clamp(4rem, 7vw, 4.75rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1rem, 2vw, 1.5rem);
  padding: 0 clamp(1rem, 5vw, 4.75rem);
  border-bottom: 1px solid rgb(255 255 255 / 7%);
  background: rgb(7 17 29 / 88%);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: .6875rem; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: clamp(2.25rem, 4vw, 2.6875rem); aspect-ratio: 1; border-radius: .75rem; background: linear-gradient(135deg, var(--mint), #b7ffe2); color: #082019; font-size: .875rem; font-weight: 950; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .08em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.topnav { display: flex; align-items: center; gap: 9px; }

.button { min-height: var(--control-height); padding: .5625rem .9375rem; border: 1px solid transparent; border-radius: .625rem; background: none; font-weight: 800; cursor: pointer; transition: .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; }
.button.primary { background: var(--mint); color: #062019; box-shadow: 0 10px 24px rgb(115 240 192 / 14%); }
.button.primary:hover:not(:disabled) { background: var(--mint-strong); }
.button.ghost { border-color: #35536a; background: #14283a; }
.button.danger { border-color: rgb(255 130 148 / 48%); background: rgb(255 130 148 / 8%); color: #ffc3cb; }
.button.small { min-height: 2.125rem; padding: .375rem .6875rem; font-size: .75rem; }
.button.big { min-height: 3.125rem; padding: .8125rem 1.25rem; font-size: 1rem; }
.button.big b { margin-left: 12px; font-size: 19px; }
.text-button { padding: 12px; border: 0; background: transparent; color: var(--mint); font-weight: 800; cursor: pointer; }

.language-control select { min-height: 36px; border: 1px solid #335066; border-radius: 8px; background: #0c1b29; color: var(--text); }
.language-control.compact select { width: 80px; padding: 6px; }

.hero { min-height: calc(100svh - clamp(4rem, 7vw, 4.75rem)); display: grid; grid-template-columns: minmax(0, .88fr) minmax(min(100%, 29rem), 1.12fr); align-items: center; gap: 6vw; padding: 6vw clamp(1.5rem, 8vw, 7.875rem); overflow: hidden; }
.hero-copy { max-width: 40.625rem; }
.eyebrow { margin: 0 0 11px; color: var(--mint); font-size: 11px; font-weight: 950; letter-spacing: .18em; }
.hero h1 { margin: 0 0 1.75rem; font-size: clamp(3.375rem, 7vw, 6rem); line-height: .91; letter-spacing: -.067em; }
.hero h1 span { color: var(--text); }
.hero h1 em { color: var(--mint); font-style: normal; }
.lead { max-width: 36.875rem; color: #b1c0cb; font-size: clamp(1rem, 1.5vw, 1.125rem); line-height: 1.72; }
.hero-actions { display: flex; align-items: center; gap: 9px; margin-top: 30px; }
.compatibility { display: flex; align-items: center; gap: 9px; margin-top: 27px; color: var(--muted); font-size: 13px; }
.compatibility i, .sidebar-note i, .status-strip i { display: block; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px var(--mint); }

.hero-console { position: relative; width: min(100%, 50rem); padding: clamp(1rem, 2.5vw, 1.25rem); border: 1px solid #395a70; border-radius: 1.375rem; background: linear-gradient(145deg, rgb(26 48 66 / 96%), rgb(8 21 34 / 96%)); box-shadow: var(--shadow), inset 0 1px rgb(255 255 255 / 8%); transform: perspective(68.75rem) rotateY(-4deg) rotateX(2deg); }
.hero-console::before { content: ""; position: absolute; z-index: -1; inset: -25%; background: radial-gradient(circle, rgb(115 240 192 / 10%), transparent 67%); }
.console-head { display: flex; justify-content: space-between; margin-bottom: 19px; color: #b4c6d1; font: 800 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .12em; }
.live-dot { color: var(--mint); }
.console-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 18px; }
.console-grid article { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: rgb(7 17 29 / 55%); }
.console-grid span, .console-grid strong { display: block; }
.console-grid span { color: var(--muted); font-size: 10px; }
.console-grid strong { margin-top: 5px; color: var(--mint); font: 800 12px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; }


.workspace { min-height: 100svh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); background: #08131f; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100svh; overflow-y: auto; padding: clamp(1rem, 2vw, 1.4375rem) clamp(.625rem, 1.5vw, .875rem); border-right: 1px solid var(--line); background: #0a1723; scrollbar-width: none; -ms-overflow-style: none; }
.sidebar::-webkit-scrollbar { display: none; }
.device-title { display: flex; align-items: center; gap: .6875rem; padding: 0 .5625rem 1.5rem; }
.device-icon { display: grid; place-items: center; width: 2.4375rem; aspect-ratio: 1; padding: 0; border: 0; border-radius: .625rem; background: #163347; color: var(--mint); font-size: .75rem; font-weight: 950; cursor: pointer; }
.device-icon:hover { background: #1c4258; color: var(--mint-strong); }
.device-title strong, .device-title small { display: block; }
.device-title strong { font-size: 14px; }
.device-title small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav button { display: flex; align-items: center; gap: .6875rem; width: 100%; padding: .6875rem; border: 0; border-radius: .5625rem; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.sidebar nav button b { font-size: 13px; }
.sidebar nav button > span { width: 20px; color: #7190a5; font-size: 17px; text-align: center; }
.sidebar nav button:hover { color: var(--text); background: rgb(255 255 255 / 4%); }
.sidebar nav button.active { color: var(--mint); background: rgb(115 240 192 / 8%); }
.sidebar nav button.active > span { color: var(--mint); }
.sidebar-profile { display: grid; gap: 8px; margin: 18px 8px 0; padding: 14px 0; border-top: 1px solid var(--line); }
.sidebar-profile > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-profile button { padding: 3px 7px; border: 1px solid #35536a; border-radius: 6px; background: #12283a; color: var(--mint); font-size: 8px; font-weight: 850; cursor: pointer; }
.sidebar-profile select { width: 100%; min-width: 0; padding: 8px 9px; border-color: #35536a; background: #081722; font-size: 11px; }
.sidebar-controls { display: grid; gap: 10px; margin: 0 8px; }
.sidebar-controls label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-controls select { width: 100%; min-width: 0; padding: 8px 9px; border-color: #35536a; background: #081722; color: var(--text); font-size: 11px; text-transform: none; }
.sidebar-note { display: flex; gap: 9px; margin: auto 8px 0; padding: 15px 9px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.5; }
.sidebar-note i { margin-top: 4px; }
.sidebar-note p { margin: 0; }
.sidebar-note strong { color: var(--text); }

.work-area { min-width: 0; padding: var(--page-padding); }
.work-chrome { position: sticky; z-index: 12; top: 0; margin: calc(var(--page-padding) * -1) calc(var(--page-padding) * -1) clamp(1rem, 2vw, 1.6875rem); }
.work-header { display: grid; grid-template-columns: minmax(min(100%, 15.625rem), 1fr) auto; align-items: center; gap: .9375rem clamp(1rem, 2vw, 1.5625rem); padding: clamp(.875rem, 2vw, 1.25rem) var(--page-padding) 1rem; border-bottom: 1px solid rgb(41 66 87 / 70%); background: rgb(8 19 31 / 92%); backdrop-filter: blur(1rem); }
.work-heading h1 { margin: 0; font-size: clamp(1.75rem, 3vw, 2.0625rem); letter-spacing: -.04em; }
.work-actions { display: flex; justify-content: flex-end; gap: 8px; }
.status-strip { display: flex; align-items: center; justify-content: flex-start; gap: .75rem; margin: 0; padding: .625rem var(--page-padding); border-bottom: 1px solid var(--line-soft); background: #0b1926; color: var(--muted); font-size: .6875rem; }
.status-strip span:first-child { display: flex; align-items: center; gap: 8px; }
.status-strip #dirtyStatus::before { content: "·"; padding-right: .75rem; color: var(--line); }
.status-strip i.offline { background: #708090; box-shadow: none; }
.status-strip i.busy { background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.status-strip b { color: var(--text); }
.page { max-width: 77.5rem; margin: 0 auto; }
.page-grid { display: grid; grid-template-columns: minmax(min(100%, 26.875rem), 1.24fr) minmax(min(100%, 17.1875rem), .76fr); gap: clamp(.875rem, 2vw, 1.125rem); }
.page-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.full-span { grid-column: 1 / -1; }
.page-grid > .layout-board, .page-grid > .layout-board ~ .panel { grid-column: 1 / -1; }

.panel { min-width: 0; padding: var(--panel-padding); border: 1px solid var(--line); border-radius: .9375rem; background: linear-gradient(145deg, var(--panel), #0d1b29); box-shadow: inset 0 1px rgb(255 255 255 / 4%); }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.panel h2, .panel h3 { margin: 0; }
.panel h2 { font-size: 18px; }
.panel h3 { font-size: 14px; }
.panel p { color: var(--muted); font-size: 12px; line-height: 1.58; }
.panel .subtle { color: var(--muted); }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel-3); color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.badge.ready { border-color: rgb(115 240 192 / 38%); color: var(--mint); }
.badge.experimental { border-color: rgb(255 195 109 / 40%); color: var(--amber); }
.badge.deferred { border-color: rgb(128 174 252 / 35%); color: var(--blue); }
.warning-card { border-color: rgb(255 195 109 / 34%); background: linear-gradient(145deg, rgb(65 46 23 / 45%), #0e1b27); }

.layout-board { position: relative; }
.keyboard-wrap { overflow: auto; padding: 3px 0 7px; }
.key-selection-marquee { position: absolute; z-index: 4; display: none; border: 1px solid var(--mint); border-radius: 5px; background: rgb(115 240 192 / 13%); box-shadow: 0 0 14px rgb(115 240 192 / 16%); pointer-events: none; }
.key-selection-marquee.active { display: block; }
.keyboard { --unit: clamp(1.625rem, 3.6vw, 3.4375rem); --key-gap: clamp(.1875rem, .5vw, .375rem); display: grid; gap: var(--key-gap); width: max-content; margin: .875rem auto .25rem; }
.keyboard-row { display: flex; gap: var(--key-gap); }
.key { position: relative; width: calc((var(--unit) + var(--key-gap)) * var(--u) - var(--key-gap)); height: calc(var(--unit) * .94); flex: 0 0 calc((var(--unit) + var(--key-gap)) * var(--u) - var(--key-gap)); overflow: hidden; padding: clamp(.1875rem, .4vw, .3125rem); border: 1px solid #42647a; border-radius: .4375rem; background: linear-gradient(150deg, #29475d, #14283a); box-shadow: inset 0 -.1875rem rgb(0 0 0 / 27%), inset 0 1px rgb(255 255 255 / 7%); color: var(--text); font-size: clamp(.4375rem, 1vw, .75rem); text-align: left; cursor: pointer; transition: .14s ease; }
.key:hover { transform: translateY(-1px); border-color: #95c5dd; }
.key.selected { border-color: var(--mint); background: linear-gradient(150deg, #285c58, #17413e); box-shadow: inset 0 -3px rgb(0 0 0 / 25%), 0 0 15px rgb(115 240 192 / 24%); }
.key.dirty::after { content: ""; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--amber); }
.key .mapped { display: block; margin-top: 3px; overflow: hidden; color: #91a8b7; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.key .color-dot { position: absolute; right: 5px; bottom: 5px; width: 7px; height: 7px; border: 1px solid rgb(255 255 255 / 50%); border-radius: 50%; background: var(--key-color, transparent); }
.hero-keyboard .keyboard { --unit: clamp(20px, 2.55vw, 38px); --key-gap: 5px; margin: 0 auto; }
.hero-keyboard .key { padding: 4px; font-size: 7px; cursor: default; }
.board-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.selected-name { color: var(--mint); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.summary-card { min-height: clamp(4.75rem, 10vw, 5.375rem); padding: clamp(.75rem, 1.5vw, .875rem); border: 1px solid var(--line-soft); border-radius: .6875rem; background: #091723; }
.summary-card span, .summary-card strong, .summary-card small { display: block; }
.summary-card span { color: var(--muted); font-size: 10px; }
.summary-card strong { margin-top: 7px; color: var(--mint); font-size: 17px; }
.summary-card small { margin-top: 5px; color: #7790a2; font-size: 9px; }
.activity-list, .fact-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.activity-list li, .fact-list li { display: flex; justify-content: space-between; gap: 15px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; }
.activity-list li:last-child, .fact-list li:last-child { border-bottom: 0; }
.activity-list strong, .fact-list strong { color: var(--text); text-align: right; }

.selected-key-card { display: flex; align-items: center; gap: .8125rem; margin: .875rem 0; padding: clamp(.75rem, 1.5vw, .8125rem); border: 1px solid rgb(115 240 192 / 23%); border-radius: .625rem; background: rgb(115 240 192 / 6%); }
.selected-key-card b { display: grid; place-items: center; min-width: clamp(2.25rem, 4vw, 2.625rem); aspect-ratio: 1; border-radius: .5625rem; background: #173c39; color: var(--mint); }
.selected-key-card span, .selected-key-card strong { display: block; }
.selected-key-card span { color: var(--muted); font-size: 9px; letter-spacing: .08em; }
.selected-key-card strong { margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span { color: #d9e6ec; font-size: 11px; font-weight: 800; }
.field small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.field input[type="number"], .field input[type="text"], .field select, .field textarea, .search-input { width: 100%; min-height: clamp(2.25rem, 5vw, 2.4375rem); padding: .5rem .625rem; border: 1px solid #36546a; border-radius: .5rem; background: #091722; color: var(--text); }
.field input[type="range"] { width: 100%; accent-color: var(--mint); }
.range-pair { display: grid; grid-template-columns: 1fr clamp(3.75rem, 8vw, 4.375rem); align-items: center; gap: .5625rem; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.switch-row:last-child { border-bottom: 0; }
.switch-row p { margin: 4px 0 0; }
.toggle { position: relative; width: 44px; height: 24px; flex: none; appearance: none; border-radius: 99px; background: #2a4153; cursor: pointer; transition: .2s; }
.toggle:checked { background: var(--mint); }
.toggle::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: .2s; }
.toggle:checked::before { transform: translateX(20px); }
.apply-row { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.tab-bar { display: flex; gap: 5px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 3px; }
.tab-bar button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: #0a1824; color: var(--muted); font-size: 10px; font-weight: 800; white-space: nowrap; cursor: pointer; }
.tab-bar button.active { border-color: rgb(115 240 192 / 40%); background: rgb(115 240 192 / 8%); color: var(--mint); }

.mapping-browser { display: grid; gap: 11px; }
.mapping-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.mapping-groups button { padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: #0a1824; color: var(--muted); font-size: 10px; cursor: pointer; }
.mapping-groups button.active { color: var(--mint); border-color: rgb(115 240 192 / 38%); }
.mapping-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .375rem; max-height: min(43svh, 21.5625rem); overflow: auto; padding-right: .1875rem; }
.mapping-list button { min-height: clamp(2.25rem, 5vw, 2.625rem); padding: .4375rem; border: 1px solid var(--line-soft); border-radius: .4375rem; background: #091722; color: #cad9e0; font-size: .5625rem; cursor: pointer; }
.mapping-list button:hover, .mapping-list button.active { border-color: var(--mint); color: var(--mint); }
.combination-editor { display: grid; gap: 15px; padding: 15px; border: 1px solid rgb(112 165 255 / 27%); border-radius: 11px; background: radial-gradient(circle at 100% 0, rgb(112 165 255 / 12%), transparent 43%), #081722; }
.combination-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.combination-heading span, .combination-trigger span { display: block; color: #91abc0; font: 800 9px/1.1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
.combination-heading strong { display: block; margin-top: 7px; color: var(--mint); font-size: 14px; }
.combination-heading small, .combination-trigger small { max-width: 230px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.combination-modifiers { display: flex; flex-wrap: wrap; gap: 8px; }
.combination-modifiers button { min-width: clamp(4rem, 10vw, 4.75rem); min-height: clamp(2.25rem, 5vw, 2.4375rem); border: 1px solid #38536a; border-radius: .5rem; background: #0b1a27; color: #c6d5dd; font-weight: 850; cursor: pointer; }
.combination-modifiers button.active { border-color: var(--mint); background: rgb(115 240 192 / 12%); color: var(--mint); box-shadow: 0 0 15px rgb(115 240 192 / 10%); }
.combination-trigger { display: grid; gap: 9px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.combination-trigger > div:first-child { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.combination-key-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .375rem; max-height: min(36svh, 16.25rem); overflow: auto; padding-right: .1875rem; }
.combination-key-grid button { min-height: clamp(2.25rem, 5vw, 2.4375rem); padding: .375rem .25rem; border: 1px solid var(--line-soft); border-radius: .4375rem; background: #091722; color: #cbd9e1; font-size: .5rem; font-weight: 750; cursor: pointer; }
.combination-key-grid button:hover, .combination-key-grid button.active { border-color: var(--mint); background: rgb(115 240 192 / 8%); color: var(--mint); }

.lighting-page { display: grid; gap: 16px; }
.lighting-command { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(225px, auto); align-items: center; gap: 20px 14px; overflow: hidden; background: radial-gradient(circle at 82% -35%, rgb(112 165 255 / 20%), transparent 46%), linear-gradient(135deg, #102638, #0a1825 64%); }
.lighting-command::after { content: ""; position: absolute; right: -70px; bottom: -115px; width: 250px; height: 250px; border: 1px solid rgb(115 240 192 / 12%); border-radius: 50%; box-shadow: 0 0 0 35px rgb(115 240 192 / 3%), 0 0 0 75px rgb(112 165 255 / 3%); pointer-events: none; }
.lighting-command-copy { position: relative; z-index: 1; }
.lighting-command-copy .eyebrow { display: block; margin-bottom: 9px; }
.lighting-command-copy h2 { margin: 0; font-size: clamp(22px, 3vw, 34px); }
.lighting-command-copy p { max-width: 650px; margin-bottom: 0; }
.lighting-command-copy .badge { display: inline-flex; margin-top: 12px; }
.lighting-power { position: relative; z-index: 1; display: flex; align-items: center; gap: 17px; min-width: 215px; padding: 14px 16px; border: 1px solid rgb(115 240 192 / 24%); border-radius: 12px; background: rgb(6 16 25 / 48%); }
.lighting-power span, .lighting-power b, .lighting-power small { display: block; }
.lighting-power span { min-width: 0; flex: 1; }
.lighting-power b { font-size: 12px; }
.lighting-power small { margin-top: 5px; color: var(--muted); font: 9px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; }
.live-rgb-toggle { border-color: rgb(112 165 255 / 28%); }
.lighting-section-nav { padding-block: 12px; }
.lighting-tabs { position: relative; z-index: 1; display: flex; gap: 7px; }
.lighting-tabs button { display: flex; align-items: center; gap: 9px; min-width: 175px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px; background: #0a1824; color: var(--muted); font-size: 11px; font-weight: 850; cursor: pointer; }
.lighting-tabs button span { color: #668197; font: 800 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.lighting-tabs button.active { border-color: rgb(115 240 192 / 44%); background: rgb(115 240 192 / 9%); color: var(--mint); }
.lighting-tabs button.active span { color: var(--mint); }
.lighting-layout { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(300px, .88fr); gap: 16px; }
.lighting-layout > .full-span { grid-column: 1 / -1; }
.area-power-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(120deg, rgb(112 165 255 / 8%), rgb(115 240 192 / 4%)); }
.area-power-panel > div { min-width: 0; }
.area-power-panel p { margin-bottom: 0; }
.unified-lighting-preview { overflow: hidden; background: radial-gradient(circle at 50% 0, rgb(112 165 255 / 10%), transparent 62%), var(--panel); }
.unified-preview-scroll { overflow: auto; padding: 5px; border: 1px solid var(--line-soft); border-radius: 14px; background: #06111b; }
.lighting-preview { position: relative; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 13px; background: radial-gradient(circle at 50% 10%, rgb(112 165 255 / 9%), transparent 55%), #06111b; }
.lighting-preview::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 22%, rgb(255 255 255 / 4%) 48%, transparent 72%); transform: translateX(-100%); animation: lighting-sheen 5s ease-in-out infinite; pointer-events: none; }
.lighting-preview .keyboard { position: relative; z-index: 1; padding: 20px; }
.lighting-preview .key { background: color-mix(in srgb, var(--key-color, #29475d) 58%, #102230); box-shadow: inset 0 -3px rgb(0 0 0 / 26%), 0 0 12px color-mix(in srgb, var(--key-color, transparent) 34%, transparent); transition: background .2s, box-shadow .2s, opacity .2s; }
.lighting-preview .key.custom-light { border-color: color-mix(in srgb, var(--key-color) 72%, white); box-shadow: inset 0 -3px rgb(0 0 0 / 26%), 0 0 16px color-mix(in srgb, var(--key-color) 55%, transparent); }
.lighting-preview .color-dot { background: transparent; }
.lighting-preview .color-dot.custom { background: var(--key-color); box-shadow: 0 0 7px var(--key-color); }
.lighting-page.keyboard-off .lighting-preview .key { opacity: .3; box-shadow: inset 0 -3px rgb(0 0 0 / 26%); }
@keyframes lighting-sheen { 0%, 70%, 100% { transform: translateX(-100%); } 85% { transform: translateX(100%); } }
.lighting-mode-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; max-height: 258px; overflow: auto; padding: 2px 3px 2px 0; }
.lighting-mode-grid button { min-height: 57px; padding: 9px 6px; border: 1px solid var(--line-soft); border-radius: 9px; background: #081722; color: var(--muted); cursor: pointer; }
.lighting-mode-grid button span, .lighting-mode-grid button small { display: block; }
.lighting-mode-grid button span { color: #d7e4ea; font: 850 13px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.lighting-mode-grid button small { margin-top: 7px; color: #617b8e; font-size: 7px; }
.lighting-mode-grid button:hover { border-color: #5b8299; }
.lighting-mode-grid button.active { border-color: var(--mint); background: linear-gradient(145deg, rgb(115 240 192 / 17%), rgb(112 165 255 / 8%)); box-shadow: 0 0 18px rgb(115 240 192 / 10%); }
.lighting-mode-grid button.active span, .lighting-mode-grid button.active small { color: var(--mint); }
.lighting-mode-grid button.experimental { border-color: rgb(255 195 109 / 34%); background: rgb(255 195 109 / 5%); }
.lighting-mode-grid button.experimental span { color: var(--amber); }
.lighting-mode-grid button.experimental small { color: #a98756; }
.lighting-mode-grid button.experimental.active { border-color: var(--amber); box-shadow: 0 0 18px rgb(255 195 109 / 14%); }
.experimental-note { border-color: rgb(255 195 109 / 28%); background: linear-gradient(100deg, rgb(255 195 109 / 9%), rgb(112 165 255 / 4%)); }
.experimental-note strong { color: var(--amber); }
.lighting-tune-panel { display: grid; align-content: start; gap: 20px; }
.lighting-range { display: grid; gap: 9px; }
.lighting-range > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #d9e6ec; font-size: 11px; }
.lighting-range output { min-width: 42px; padding: 5px 7px; border: 1px solid rgb(115 240 192 / 24%); border-radius: 7px; background: rgb(115 240 192 / 7%); color: var(--mint); font: 850 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; }
.lighting-range input { width: 100%; accent-color: var(--mint); }
.lighting-range small, .lighting-direction small { color: var(--muted); font-size: 8px; }
.lighting-direction { display: grid; gap: 10px; padding-top: 17px; border-top: 1px solid var(--line-soft); }
.lighting-direction > span { display: grid; gap: 4px; }
.lighting-direction > span b { font-size: 11px; }
.lighting-direction > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.lighting-direction button { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #081722; color: var(--muted); font-size: 10px; font-weight: 800; cursor: pointer; }
.lighting-direction button.active { border-color: rgb(115 240 192 / 44%); background: rgb(115 240 192 / 9%); color: var(--mint); }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.palette button { position: relative; min-height: 46px; border: 2px solid transparent; border-radius: 9px; background: var(--swatch); cursor: pointer; }
.palette button span { position: absolute; right: 6px; bottom: 5px; color: color-mix(in srgb, var(--swatch) 18%, white); font: 900 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-shadow: 0 1px 3px rgb(0 0 0 / 72%); }
.palette button.active { border-color: white; box-shadow: 0 0 0 2px var(--mint), 0 0 20px color-mix(in srgb, var(--swatch) 38%, transparent); }
.palette-large button { min-height: 62px; }
.palette-editor { display: grid; grid-template-columns: 82px minmax(230px, 1fr) minmax(180px, .7fr); align-items: center; gap: 15px; margin-top: 18px; padding: 15px; border: 1px solid var(--line-soft); border-radius: 11px; background: #081722; }
.palette-editor > input[type="color"], .key-color-editor > input[type="color"] { width: 100%; height: 62px; padding: 3px; border: 1px solid #42647a; border-radius: 9px; background: #07131f; cursor: pointer; }
.palette-note { display: grid; gap: 6px; padding-left: 15px; border-left: 1px solid var(--line); }
.palette-note strong { color: var(--mint); font-size: 10px; }
.palette-note span { color: var(--muted); font-size: 9px; line-height: 1.45; }
.key-color-editor { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: 15px; margin: 18px 0; }
.key-color-editor span, .key-color-editor strong, .key-color-editor small { display: block; }
.key-color-editor span { color: var(--muted); font-size: 9px; }
.key-color-editor strong { margin-top: 6px; color: var(--mint); font: 850 16px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.key-color-editor small { margin-top: 7px; color: var(--muted); font-size: 8px; }
.capture-note { display: flex; align-items: center; gap: 14px; padding-block: 15px; border-color: rgb(112 165 255 / 24%); background: linear-gradient(100deg, rgb(112 165 255 / 9%), rgb(115 240 192 / 4%)); }
.capture-note strong { flex: 0 0 auto; color: #a9c9ff; font-size: 11px; }
.capture-note span { color: var(--muted); font-size: 9px; line-height: 1.5; }
.dual-lighting-switches { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dual-lighting-switches .switch-row { margin: 0; border: 1px solid var(--line-soft); border-radius: 10px; background: #081722; }
.dual-lighting-switches .switch-row span { display: grid; gap: 5px; }
.dual-lighting-switches .switch-row b { font-size: 11px; }
.dual-lighting-switches .switch-row small { color: var(--muted); font-size: 8px; }
.decorative-frame { display: grid; grid-template-areas: ". top ." "left keyboard right" ". bottom ."; grid-template-columns: 23px max-content 23px; grid-template-rows: 23px max-content 23px; gap: 3px; width: max-content; margin: 0 auto; padding: 5px; border-radius: 12px; background: #06111b; user-select: none; }
.decorative-side { display: grid; gap: 3px; }
.decorative-top { grid-area: top; grid-template-columns: repeat(13, minmax(0, 1fr)); }
.decorative-bottom { grid-area: bottom; grid-template-columns: repeat(14, minmax(0, 1fr)); }
.decorative-left { grid-area: left; grid-template-rows: repeat(6, minmax(0, 1fr)); }
.decorative-right { grid-area: right; grid-template-rows: repeat(5, minmax(0, 1fr)); }
.decorative-keyboard-core { grid-area: keyboard; width: max-content; min-width: 0; overflow: visible; border: 0; border-radius: 8px; background: #081722; }
.decorative-keyboard-core::before { display: none; }
.decorative-keyboard-core .keyboard { --unit: clamp(28px, 3.15vw, 47px); margin: 0; padding: 0; }
.decorative-side button { position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0; padding: 0; border: 1px solid color-mix(in srgb, var(--led-color) 62%, #355269); border-radius: 6px; background: color-mix(in srgb, var(--led-color) 63%, #0b1d2a); box-shadow: 0 0 12px color-mix(in srgb, var(--led-color) 42%, transparent), inset 0 -2px rgb(0 0 0 / 25%); color: color-mix(in srgb, var(--led-color) 12%, white); cursor: pointer; transition: transform .15s, box-shadow .15s, opacity .2s; }
.decorative-side button:hover { transform: scale(1.08); }
.decorative-side button.selected { z-index: 2; outline: 2px solid white; outline-offset: 2px; box-shadow: 0 0 0 4px rgb(115 240 192 / 22%), 0 0 22px var(--led-color); }
.decorative-side button.custom::after { content: ""; position: absolute; top: 4px; right: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 6px var(--mint); }
.decorative-side button span { font: 800 7px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.lighting-page.strip-off .decorative-side button { opacity: .28; box-shadow: inset 0 -2px rgb(0 0 0 / 25%); }
.lighting-context-main .unified-lighting-preview [data-key], .lighting-context-main .unified-lighting-preview [data-strip-led] { pointer-events: none; cursor: default; }
.lighting-context-perKey .unified-lighting-preview [data-key] { cursor: crosshair; touch-action: none; }
.lighting-context-perKey .unified-lighting-preview [data-strip-led] { pointer-events: none; cursor: default; }
.lighting-context-strip .unified-lighting-preview [data-key] { pointer-events: none; cursor: default; }
.lighting-context-strip .unified-lighting-preview [data-strip-led] { cursor: crosshair; touch-action: none; }
.strip-editor-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 1fr); align-items: center; gap: 18px; }
.strip-editor-grid .switch-row, .strip-editor-grid .key-color-editor { margin: 0; }

.advanced-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.advanced-card { min-height: 155px; padding: 15px; border: 1px solid var(--line-soft); border-radius: 11px; background: #091723; }
.advanced-card header { display: flex; justify-content: space-between; gap: 8px; }
.advanced-card h3 { color: var(--mint); }
.advanced-card p { min-height: 55px; }
.advanced-card small { color: #6e8799; font: 9px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.raw-output { min-height: 150px; max-height: 330px; overflow: auto; margin: 12px 0 0; padding: 13px; border: 1px solid var(--line-soft); border-radius: 9px; background: #061019; color: #bfead8; font: 10px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.capability-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.capability { padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: #091722; }
.capability span, .capability strong { display: block; }
.capability span { color: var(--muted); font-size: 9px; }
.capability strong { margin-top: 4px; font-size: 11px; }
.capability.yes strong { color: var(--mint); }
.capability.no strong { color: #728798; }

.travel-meter { position: relative; height: 210px; margin: 10px auto; border: 1px solid #36546a; border-radius: 12px; background: linear-gradient(180deg, #0e2633, #09141f); }
.travel-meter .fill { position: absolute; right: 0; bottom: 0; left: 0; height: var(--travel, 0%); border-radius: 0 0 11px 11px; background: linear-gradient(180deg, rgb(115 240 192 / 45%), rgb(115 240 192 / 12%)); transition: height .12s linear; }
.travel-meter .line { position: absolute; right: 0; left: 0; bottom: var(--actuation, 50%); border-top: 1px dashed var(--amber); }
.travel-meter .value { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; color: var(--mint); font: 900 25px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.calibration-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin-top: 12px; }
.calibration-grid i { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 5px; background: #132536; }
.calibration-grid i.done { border-color: var(--mint); background: rgb(115 240 192 / 30%); }

.progress-overlay { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; background: rgb(4 10 16 / 72%); backdrop-filter: blur(7px); }
.app-dialog { width: min(590px, calc(100vw - 34px)); padding: 0; border: 1px solid #42627a; border-radius: 17px; background: #0d1d2b; color: var(--text); box-shadow: 0 28px 80px rgb(0 0 0 / 65%); }
.app-dialog::backdrop { background: rgb(4 10 16 / 78%); backdrop-filter: blur(7px); }
.app-dialog form { display: grid; grid-template-columns: auto 1fr; gap: 0 16px; padding: 25px; }
.app-dialog .dialog-copy h2 { margin: 2px 0 7px; font-size: 22px; }
.app-dialog .dialog-copy p:last-child { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.dialog-icon { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid rgb(255 195 109 / 42%); border-radius: 50%; background: rgb(255 195 109 / 10%); color: var(--amber); font-size: 20px; font-weight: 900; }
.change-review-list { grid-column: 1 / -1; display: grid; gap: 7px; max-height: 280px; overflow: auto; margin: 20px 0 0; padding: 13px 13px 13px 34px; border: 1px solid var(--line-soft); border-radius: 10px; background: #07141f; }
.change-review-list li { color: #c7d8e2; font-size: 11px; line-height: 1.5; }
.change-review-list li::marker { color: var(--mint); }
.dialog-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 19px; }
.compact-dialog { width: min(450px, calc(100vw - 34px)); }
.compact-dialog form { grid-template-columns: 1fr; }
.compact-dialog .field { margin-top: 18px; }
.progress-card { width: min(390px, calc(100vw - 35px)); padding: 28px; border: 1px solid #35556b; border-radius: 16px; background: #0d1d2b; box-shadow: var(--shadow); text-align: center; }
.progress-card strong, .progress-card p { display: block; }
.progress-card p { margin-bottom: 0; color: var(--muted); font-size: 11px; }
.spinner { display: block; width: 28px; height: 28px; margin: 0 auto 14px; border: 3px solid rgb(115 240 192 / 18%); border-top-color: var(--mint); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 60; right: 22px; bottom: 22px; max-width: 380px; padding: 13px 16px; border: 1px solid rgb(115 240 192 / 42%); border-radius: 10px; background: #112b2b; color: #dbffef; box-shadow: 0 16px 35px rgb(0 0 0 / 35%); opacity: 0; transform: translateY(120px); transition: .24s; font-size: 12px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgb(255 130 148 / 50%); background: #321a22; color: #ffd6dc; }

@media (max-width: 65.625em) {
  .hero { grid-template-columns: 1fr; padding-top: clamp(3.5rem, 8vw, 4.6875rem); }
  .hero-copy { max-width: 47.5rem; }
  .hero-console { margin: 0 auto; }
  .work-header { grid-template-columns: 1fr; }
  .work-actions { grid-column: auto; justify-content: start; }
  .summary-grid, .capability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .advanced-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lighting-command { grid-template-columns: 1fr 1fr; }
  .lighting-command-copy { grid-column: 1 / -1; }
  .lighting-layout { grid-template-columns: 1fr; }
  .lighting-layout > .full-span { grid-column: auto; }
}

@media (max-width: 51.25em) {
  .workspace { grid-template-columns: clamp(10.5rem, 25vw, 13.125rem) minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100svh; padding: 1.125rem .625rem; border-right: 1px solid var(--line); border-bottom: 0; }
  .sidebar nav { display: grid; overflow: visible; }
  .sidebar nav button { width: 100%; white-space: normal; }
  .sidebar-profile { grid-template-columns: 1fr; margin-inline: 5px; }
  .sidebar-profile > div { display: flex; }
  .sidebar-profile button { margin-top: 0; }
  .sidebar-controls { grid-template-columns: 1fr; margin-inline: 5px; }
  .sidebar-note { display: flex; margin-inline: 5px; }
  .work-chrome { position: static; }
  .page-grid, .page-grid.three { grid-template-columns: 1fr; }
  .full-span { grid-column: auto; }
  .advanced-grid { grid-template-columns: 1fr; }
  .mapping-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .combination-key-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .keyboard { --unit: clamp(1.75rem, 5vw, 2.125rem); }
  .dual-lighting-switches, .strip-editor-grid { grid-template-columns: 1fr; }
  .decorative-frame { grid-template-columns: 21px max-content 21px; grid-template-rows: 21px max-content 21px; padding: 4px; }
  .palette-editor { grid-template-columns: 72px 1fr; }
  .palette-note { grid-column: 1 / -1; padding: 12px 0 0; border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 35em) {
  .topbar { padding: 0 14px; }
  .brand small, .topnav .ghost, .language-control.compact { display: none; }
  .topnav .primary { padding: 7px 10px; font-size: 11px; }
  .hero { padding: 50px 20px; }
  .hero h1 { font-size: 53px; }
  .hero-console { padding: 12px; }
  .console-grid { grid-template-columns: 1fr; }
  .hero-keyboard .keyboard { --unit: 22px; --key-gap: 3px; }
  .hero-keyboard .key { padding: 2px; font-size: 5px; }
  .workspace { grid-template-columns: clamp(9.5rem, 32vw, 11rem) minmax(0, 1fr); }
  .sidebar { padding: .875rem .5rem; }
  .device-title { gap: 7px; }
  .device-title strong { font-size: 11px; }
  .device-title small { font-size: 9px; }
  .sidebar nav button { gap: 7px; padding: 9px 7px; }
  .sidebar nav button b { font-size: 11px; }
  .sidebar-profile, .sidebar-controls { margin-inline: 2px; }
  .sidebar-note { display: none; }
  .work-actions { display: grid; grid-template-columns: repeat(2, 1fr); width: 100%; }
  .work-actions .button { padding: 7px; font-size: 10px; }
  .status-strip { flex-wrap: wrap; }
  .summary-grid, .capability-grid, .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .mapping-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .combination-heading, .combination-trigger > div:first-child { align-items: start; flex-direction: column; }
  .combination-key-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .keyboard { --unit: clamp(1.5rem, 6vw, 1.6875rem); --key-gap: .25rem; }
  .key { padding: .1875rem; font-size: .4375rem; }
  .key .mapped { display: none; }
  .lighting-command { grid-template-columns: 1fr; }
  .lighting-command-copy { grid-column: auto; }
  .lighting-power { width: 100%; }
  .lighting-tabs { display: grid; grid-template-columns: 1fr; }
  .lighting-tabs button { min-width: 0; }
  .lighting-mode-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .palette { grid-template-columns: repeat(4, 1fr); }
  .palette-editor { grid-template-columns: 64px 1fr; }
  .capture-note { align-items: flex-start; flex-direction: column; }
  .app-dialog form { padding: 20px; }
  .area-power-panel { align-items: stretch; flex-direction: column; }
  .decorative-frame { grid-template-columns: 18px max-content 18px; grid-template-rows: 18px max-content 18px; gap: 2px; padding: 3px; }
  .decorative-side { gap: 2px; }
}
