:root {
  color-scheme: dark;
  --accent: #0066ff;
  --accent-rgb: 0, 102, 255;
  --accent-bright-rgb: 60, 140, 255;
  --accent-contrast: #ffffff;
  --bg: #080a0d;
  --surface: #101318;
  --surface-2: #151920;
  --surface-3: #1b2028;
  --canvas: #0b0e12;
  --app-surface: rgba(12, 15, 19, 0.96);
  --field-surface: #0d1014;
  --hover-surface: rgba(255, 255, 255, 0.045);
  --grid-line: rgba(255, 255, 255, 0.022);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f7fa;
  --muted: #8f98a7;
  --blue: #0066ff;
  --blue-bright: #3c8cff;
  --danger: #ff6b6b;
  --success: #50d890;
  --radius: 18px;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f7;
  --surface: #f8fafc;
  --surface-2: #ffffff;
  --surface-3: #e8edf4;
  --canvas: #f2f5f9;
  --app-surface: rgba(248, 250, 252, 0.98);
  --field-surface: #ffffff;
  --hover-surface: rgba(15, 30, 50, 0.045);
  --grid-line: rgba(28, 42, 60, 0.045);
  --line: rgba(24, 38, 56, 0.12);
  --line-strong: rgba(24, 38, 56, 0.22);
  --text: #182231;
  --muted: #667386;
  --danger: #c93c42;
  --success: #17864f;
  --shadow: 0 28px 80px rgba(35, 50, 70, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
}

button,
select,
input,
label {
  font: inherit;
}

button,
label[for],
.lcd-custom-upload,
.lcd-module {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
label:focus-within,
.lcd-custom-upload:focus-within,
.lcd-module:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: 220px minmax(590px, 1fr) 370px;
  width: min(96vw, 1560px);
  height: min(94vh, 960px);
  margin: 3vh auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--app-surface);
  box-shadow: var(--shadow);
}

.sidebar,
.control-panel {
  position: relative;
  z-index: 3;
  min-width: 0;
  background: var(--surface);
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  border-right: 1px solid var(--line);
}

.brand {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  grid-template-rows: 21px 17px;
  align-items: center;
  column-gap: 11px;
  margin: 0 5px 34px;
}

.brand-mark {
  grid-row: 1 / 3;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  color: white;
  background: #0d1117;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.brand-word {
  align-self: end;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.brand-product {
  align-self: start;
  color: var(--muted);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.11em;
}

.guide-launch {
  grid-column: 3;
  grid-row: 1 / 3;
  display: grid;
  min-width: 38px;
  height: 38px;
  place-items: center;
  gap: 0;
  padding: 3px 5px;
  border: 1px solid rgba(60, 140, 255, 0.24);
  border-radius: 10px;
  color: #8dbbff;
  background: rgba(0, 102, 255, 0.07);
  cursor: pointer;
}

.guide-launch span {
  font: 700 14px/1 Bahnschrift, "Arial Narrow", sans-serif;
}

.guide-launch b {
  font-size: 7px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.guide-launch:hover {
  border-color: rgba(60, 140, 255, 0.55);
  color: white;
  background: rgba(0, 102, 255, 0.14);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #a8b0bc;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.035);
}

.nav-item.is-active {
  border-color: rgba(0, 102, 255, 0.3);
  color: white;
  background: rgba(0, 102, 255, 0.12);
}

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: currentColor;
  font-size: 15px;
}

.eyebrow {
  color: #768091;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.13em;
}

.layer-card {
  margin-top: 28px;
  padding: 0 5px;
}

.layer-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.layer-scope-badge {
  padding: 3px 6px;
  border: 1px solid rgba(60, 140, 255, 0.25);
  border-radius: 999px;
  color: #8dbbff;
  background: rgba(0, 102, 255, 0.08);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.layer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 11px;
}

.layer-button {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #0d1014;
  cursor: pointer;
  text-align: left;
}

.layer-button b {
  color: #dfe4ea;
  font: 600 12px/1 "Cascadia Code", Consolas, monospace;
}

.layer-button span {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-button small {
  overflow: hidden;
  color: #687282;
  font-size: 8px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-button.is-active {
  border-color: rgba(0, 102, 255, 0.5);
  background: rgba(0, 102, 255, 0.12);
}

.layer-button.is-active b {
  color: var(--blue-bright);
}

.layer-button.is-active small {
  color: #8ba6cb;
}

.layer-help {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(60, 140, 255, 0.18);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.09), rgba(0, 102, 255, 0.025));
}

.layer-help strong {
  display: block;
  color: #dce9ff;
  font-size: 10px;
  font-weight: 650;
}

.layer-help p {
  margin: 4px 0 5px;
  color: #8793a4;
  font-size: 9px;
  line-height: 1.42;
}

.layer-help > span {
  display: block;
  color: #6e8fbd;
  font: 600 7px/1.45 "Cascadia Code", Consolas, monospace;
  letter-spacing: -0.01em;
}

.sidebar-foot {
  margin-top: auto;
}

.device-state {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 5px 12px;
}

.device-state div {
  display: grid;
  min-width: 0;
}

.device-state b {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-state span:not(.status-dot) {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #5e6673;
  box-shadow: 0 0 0 4px rgba(94, 102, 115, 0.11);
}

.status-dot.is-connected {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(80, 216, 144, 0.12);
}

.connect-button,
.primary-button,
.quiet-button {
  width: 100%;
  border-radius: 11px;
  cursor: pointer;
}

.connect-button,
.primary-button {
  border: 1px solid #1d70ef;
  color: white;
  background: var(--blue);
  box-shadow: 0 8px 22px rgba(0, 102, 255, 0.18);
  font-weight: 650;
}

.connect-button {
  padding: 11px 14px;
}

.primary-button {
  padding: 13px 16px;
}

.connect-button:hover,
.primary-button:hover {
  background: #1473ff;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.utility-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 7px;
}

.utility-row button,
.utility-row label {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  text-align: center;
}

.utility-row button:hover,
.utility-row label:hover {
  color: white;
  border-color: var(--line-strong);
}

.reset-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.reset-actions button {
  min-height: 34px;
  padding: 7px 5px;
  border: 1px solid rgba(255, 107, 107, 0.17);
  border-radius: 9px;
  color: #b98686;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  line-height: 1.3;
}

.reset-actions button:hover {
  border-color: rgba(255, 107, 107, 0.42);
  color: #efb0b0;
  background: rgba(255, 107, 107, 0.055);
}

.device-canvas {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 28px 30px 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 56%, rgba(32, 39, 48, 0.7), transparent 46%),
    #0b0e12;
}

.canvas-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.canvas-header h1 {
  margin: 8px 0 0;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: clamp(24px, 2.1vw, 34px);
  font-weight: 480;
  letter-spacing: -0.025em;
}

.canvas-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.canvas-badges span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  font: 600 9px/1 "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.05em;
}

.keyboard-viewport {
  display: grid;
  min-height: 0;
  flex: 1;
  place-items: center;
  perspective: 1200px;
}

.keyboard-deck {
  position: relative;
  width: min(100%, 940px);
  padding: 0;
  filter: drop-shadow(0 30px 28px rgba(0, 0, 0, 0.48));
}

.keyboard-deck::after {
  content: none;
}

.keyboard-board-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1600 / 600;
}

.keyboard-board {
  position: absolute;
  inset: 0;
}

.keyboard-board > svg {
  display: block;
  width: 100%;
  height: 100%;
}

.svg-key {
  cursor: pointer;
}

.svg-key rect {
  fill: url("#key-finish");
  stroke: #48515c;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  transition: fill 100ms ease, stroke 100ms ease;
}

.svg-key .key-label {
  fill: #bac2cd;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 550;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.svg-key:hover rect {
  fill: #303741;
  stroke: #77818e;
}

.svg-key.is-selected rect {
  fill: #17345f;
  stroke: #2f86ff;
  stroke-width: 3;
}

.svg-key.is-selected .key-label {
  fill: #fff;
}

.encoder-key:hover circle:first-child,
.encoder-key.is-selected circle:first-child {
  stroke: #2f86ff;
  stroke-width: 4;
}

#svg-screen-control {
  cursor: pointer;
}

#svg-screen-control:hover {
  stroke: #65a2ff;
}

.keyboard-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.keycap {
  position: absolute;
  display: grid;
  min-width: 0;
  place-items: center;
  padding: 0 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom-color: rgba(0, 0, 0, 0.75);
  border-radius: clamp(3px, 0.4vw, 7px);
  color: #bac1cb;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 45%),
    #20252d;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.045),
    0 2px 0 #0a0c0f;
  cursor: pointer;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: clamp(6px, 0.72vw, 10px);
  line-height: 1.05;
  text-align: center;
  transition: border-color 100ms ease, color 100ms ease, background 100ms ease, transform 100ms ease;
}

.keycap:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.keycap.is-selected {
  z-index: 2;
  border-color: var(--blue-bright);
  color: white;
  background: #162b4b;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 0 2px rgba(0, 102, 255, 0.22),
    0 2px 0 #061326;
}

.keycap.is-special {
  border-radius: 50%;
  color: #aab3bf;
  background: #242a32;
}

.deck-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 7px;
  padding: 0 5px;
  color: #77808d;
  font: 600 8px "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.08em;
}

.canvas-hint {
  align-self: center;
  margin-top: 4px;
  color: #717a88;
  font-size: 11px;
  text-align: center;
}

.control-panel {
  padding: 28px 24px 22px;
  overflow: hidden auto;
  border-left: 1px solid var(--line);
  scrollbar-color: #353c46 transparent;
  scrollbar-width: thin;
}

.panel-view {
  position: relative;
  display: none;
  min-height: 100%;
  animation: panel-in 180ms ease-out;
}

.panel-guide-button {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 1px solid rgba(60, 140, 255, 0.24);
  border-radius: 8px;
  color: #8dbbff;
  background: rgba(0, 102, 255, 0.065);
  cursor: pointer;
  font-size: 8px;
  font-weight: 600;
}

.panel-guide-button span {
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border: 1px solid rgba(60, 140, 255, 0.34);
  border-radius: 50%;
  font: 700 8px/1 Bahnschrift, "Arial Narrow", sans-serif;
}

.panel-guide-button:hover {
  border-color: rgba(60, 140, 255, 0.55);
  color: white;
  background: rgba(0, 102, 255, 0.13);
}

.panel-view.is-active {
  display: block;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel-heading {
  margin-bottom: 23px;
}

.panel-heading h2 {
  margin: 8px 0 8px;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.panel-heading p b {
  color: #dbe1e8;
  font-weight: 600;
}

.scope-notice {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: -9px 0 14px;
  padding: 11px 12px;
  border: 1px solid rgba(60, 140, 255, 0.24);
  border-radius: 12px;
  background: rgba(0, 102, 255, 0.075);
}

.scope-notice-mark {
  display: grid;
  width: 32px;
  height: 25px;
  place-items: center;
  border: 1px solid rgba(60, 140, 255, 0.42);
  border-radius: 7px;
  color: #9bc3ff;
  background: rgba(0, 102, 255, 0.13);
  font: 700 9px/1 "Cascadia Code", Consolas, monospace;
}

.scope-notice b {
  display: block;
  color: #e3edfc;
  font-size: 11px;
  font-weight: 650;
}

.scope-notice p {
  margin: 3px 0 0;
  color: #8997aa;
  font-size: 9px;
  line-height: 1.45;
}

.scope-notice.is-global {
  border-color: rgba(80, 216, 144, 0.22);
  background: rgba(80, 216, 144, 0.055);
}

.scope-notice.is-global .scope-notice-mark {
  border-color: rgba(80, 216, 144, 0.38);
  color: #8ee7b8;
  background: rgba(80, 216, 144, 0.1);
}

.control-card {
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0d1014;
}

.field-label {
  display: block;
  margin: 0 0 7px;
  color: #8993a1;
  font-size: 11px;
  font-weight: 600;
}

.field-label:not(:first-child) {
  margin-top: 15px;
}

.field {
  width: 100%;
  min-height: 41px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #ebeff5;
  background: var(--surface-2);
}

.field:hover {
  border-color: var(--line-strong);
}

.keycode-meta,
.selection-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: #697382;
  font: 600 9px "Cascadia Code", Consolas, monospace;
}

.keycode-meta code {
  color: var(--blue-bright);
}

.encoder-targets {
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.encoder-targets > span {
  display: block;
  margin-bottom: 8px;
  color: #788290;
  font: 600 9px "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.05em;
}

.encoder-targets > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.encoder-targets button {
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #929ba8;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.encoder-targets button.is-active {
  border-color: rgba(0, 102, 255, 0.45);
  color: white;
  background: rgba(0, 102, 255, 0.12);
}

.selection-summary {
  display: block;
  color: #aab2be;
  font-size: 10px;
  line-height: 1.45;
}

.quiet-button {
  margin-top: 8px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  color: #aab2be;
  background: transparent;
}

.quiet-button:hover {
  color: white;
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
}

.danger-text {
  color: #d68282;
}

.shortcut-categories {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow: auto hidden;
  scrollbar-width: none;
}

.shortcut-categories::-webkit-scrollbar {
  display: none;
}

.shortcut-categories button,
.mini-button {
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #8f99a7;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.shortcut-categories button:hover,
.shortcut-categories button.is-active,
.mini-button:hover {
  border-color: rgba(0, 102, 255, 0.5);
  color: #eef5ff;
  background: rgba(0, 102, 255, 0.1);
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 278px;
  margin-bottom: 12px;
  padding-right: 3px;
  overflow: hidden auto;
  scrollbar-color: #353c46 transparent;
  scrollbar-width: thin;
}

.preset-grid button {
  display: grid;
  gap: 4px;
  min-height: 62px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #c2c8d0;
  background: #0d1014;
  cursor: pointer;
  text-align: left;
}

.preset-grid button b {
  font-size: 11px;
}

.preset-grid button span {
  color: var(--muted);
  font-size: 10px;
}

.preset-grid button.is-selected {
  border-color: rgba(0, 102, 255, 0.55);
  color: white;
  background: rgba(0, 102, 255, 0.11);
}

.shortcut-capture {
  cursor: crosshair;
}

.shortcut-capture.is-capturing {
  border-color: rgba(60, 140, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.field-help {
  margin: 7px 0 0;
  color: #6f7987;
  font-size: 10px;
  line-height: 1.45;
}

.macro-toolbar,
.range-head,
.upload-progress > div,
.lcd-status-row,
.lcd-status-row > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.macro-toolbar {
  margin-bottom: 11px;
  color: #a4adba;
  font-size: 11px;
}

.macro-toolbar b {
  color: #6f7987;
  font: 600 9px "Cascadia Code", Consolas, monospace;
}

.record-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 10px;
  color: #e4a0a0;
  background: rgba(255, 107, 107, 0.07);
  cursor: pointer;
}

.record-button i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.record-button.is-recording {
  color: white;
  background: rgba(255, 107, 107, 0.15);
}

.record-button.is-recording i {
  box-shadow: 0 0 0 5px rgba(255, 107, 107, 0.13);
}

.macro-timeline {
  display: grid;
  max-height: 235px;
  gap: 6px;
  margin-top: 13px;
  overflow: auto;
}

.macro-step-row,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #bbc3ce;
  background: var(--surface-2);
  font: 600 9px "Cascadia Code", Consolas, monospace;
}

.macro-step-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
}

.macro-step-row.is-delay {
  border-style: dashed;
  color: #8c96a5;
  background: rgba(255, 255, 255, 0.012);
}

.macro-step-row input[type="checkbox"] {
  accent-color: var(--blue);
}

.macro-step-row input[type="number"] {
  width: 82px;
  min-height: 27px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #e5ebf3;
  background: #0c0f13;
  font: inherit;
}

.macro-delay-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.macro-step-row button {
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #6f7987;
  background: transparent;
  cursor: pointer;
}

.macro-step-row button:hover {
  border-color: rgba(255, 107, 107, 0.3);
  color: #f29b9b;
  background: rgba(255, 107, 107, 0.06);
}

.macro-delay-tools {
  display: grid;
  grid-template-columns: auto auto 64px auto auto;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: #77818f;
  font-size: 9px;
}

.macro-delay-tools[hidden] {
  display: none;
}

.macro-delay-tools input {
  width: 64px;
  min-height: 30px;
  padding: 4px 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: white;
  background: #0a0d11;
  font: 600 10px "Cascadia Code", Consolas, monospace;
}

.macro-capacity {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.macro-capacity > div,
.section-heading,
.macro-library-item,
.macro-library-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.macro-capacity > div {
  color: #7f8997;
  font-size: 10px;
}

.macro-capacity b {
  color: var(--blue-bright);
  font: 600 9px "Cascadia Code", Consolas, monospace;
}

.macro-capacity progress {
  width: 100%;
  height: 5px;
  margin: 9px 0 1px;
  accent-color: var(--blue);
}

.macro-capacity p {
  margin: 5px 0 0;
  color: #68717e;
  font-size: 9px;
  line-height: 1.45;
}

.macro-save-actions {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 8px;
}

.macro-save-actions .quiet-button {
  margin-top: 0;
}

.macro-library-section {
  margin-top: 22px;
}

.section-heading {
  margin-bottom: 9px;
}

.section-heading b {
  font-size: 12px;
}

.section-heading span {
  color: #6f7987;
  font: 600 9px "Cascadia Code", Consolas, monospace;
}

.macro-library {
  display: grid;
  max-height: 220px;
  gap: 6px;
  overflow: hidden auto;
}

.macro-library-item {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0d1014;
}

.macro-library-item > div:first-child {
  min-width: 0;
}

.macro-library-item b,
.macro-library-item span {
  display: block;
}

.macro-library-item b {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.macro-library-item span {
  margin-top: 3px;
  color: #6f7987;
  font: 600 8px "Cascadia Code", Consolas, monospace;
}

.macro-library-actions {
  flex: 0 0 auto;
}

.macro-library-actions button {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #8f99a7;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
}

.macro-library-actions button:hover {
  border-color: rgba(0, 102, 255, 0.4);
  color: white;
}

.macro-library-actions button[data-action="delete"]:hover {
  border-color: rgba(255, 107, 107, 0.35);
  color: #f29b9b;
}
}

.empty-state {
  width: 100%;
  padding: 18px 8px;
  border-style: dashed;
  color: #68717e;
  text-align: center;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-field input {
  width: 44px;
  height: 37px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
}

.color-field code {
  color: #d8dee7;
  font: 600 11px "Cascadia Code", Consolas, monospace;
}

.color-field input:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.rgb-effect-info {
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(0, 102, 255, 0.2);
  border-radius: 9px;
  background: rgba(0, 102, 255, 0.055);
}

.rgb-effect-info > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rgb-effect-info b {
  color: #e7ecf3;
  font-size: 11px;
}

.rgb-effect-info > div:first-child span {
  color: var(--blue-bright);
  font: 600 8px "Cascadia Code", Consolas, monospace;
}

.rgb-effect-info p {
  margin: 7px 0 9px;
  color: #929ca9;
  font-size: 10px;
  line-height: 1.5;
}

.effect-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.effect-tags span {
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #788493;
  background: rgba(255, 255, 255, 0.018);
  font: 600 8px "Cascadia Code", Consolas, monospace;
}

.range-head {
  margin: 18px 0 8px;
  color: #8993a1;
  font-size: 11px;
}

.range-head b {
  color: #d7dde5;
  font: 600 10px "Cascadia Code", Consolas, monospace;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.rgb-preview {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 5px;
  margin: 14px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #090b0e;
}

.rgb-preview span {
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  background: var(--preview-color, #0066ff);
  box-shadow: 0 0 10px color-mix(in srgb, var(--preview-color, #0066ff) 48%, transparent);
}

.rgb-preview-note {
  margin: 6px 0 13px;
  color: #65707e;
  font-size: 9px;
  text-align: center;
}

.rgb-preview[data-preview="off"] span {
  background: #20252b;
  box-shadow: none;
  opacity: 0.5;
}

.rgb-preview[data-preview="breathe"] span {
  animation: rgb-breathe 1.8s ease-in-out infinite alternate;
}

.rgb-preview[data-preview="sweep"] span {
  animation: rgb-sweep 1.6s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -90ms);
}

.rgb-preview[data-preview="rainbow"] span {
  animation: rgb-rainbow 2.4s linear infinite;
  animation-delay: calc(var(--i, 0) * -120ms);
}

.rgb-preview[data-preview="reactive"] span {
  animation: rgb-reactive 1.8s ease-out infinite;
  animation-delay: calc(var(--i, 0) * -140ms);
}

.rgb-preview[data-preview="rain"] span {
  animation: rgb-rain 1.5s steps(2, end) infinite;
  animation-delay: calc(var(--i, 0) * -170ms);
}

.rgb-preview[data-preview="sparkle"] span {
  animation: rgb-sparkle 2s steps(2, end) infinite;
  animation-delay: calc(var(--i, 0) * -230ms);
}

@keyframes rgb-breathe {
  35% {
    opacity: 0.25;
    filter: brightness(0.55);
  }
}

@keyframes rgb-sweep {
  0%,
  45%,
  100% {
    opacity: 0.25;
  }
  55%,
  70% {
    opacity: 1;
    filter: brightness(1.35);
  }
}

@keyframes rgb-rainbow {
  to {
    filter: hue-rotate(360deg);
  }
}

@keyframes rgb-reactive {
  0%,
  70%,
  100% {
    opacity: 0.22;
    transform: scale(0.88);
  }
  10% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rgb-rain {
  0%,
  60% {
    opacity: 0.12;
  }
  65%,
  80% {
    opacity: 1;
    filter: brightness(1.6);
  }
}

@keyframes rgb-sparkle {
  0%,
  75% {
    opacity: 0.18;
  }
  80%,
  90% {
    opacity: 1;
    filter: brightness(1.8);
  }
}

.lcd-status-row {
  margin-bottom: 13px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0d1014;
}

.lcd-authorize-help {
  margin: -3px 2px 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.lcd-status-row > span {
  justify-content: flex-start;
  min-width: 0;
}

.lcd-status-row b {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lcd-status-row button {
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #b2bbc7;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.lcd-workbench {
  margin-top: 4px;
}

.gif-lab-heading,
.gif-lab-heading > span {
  display: flex;
  align-items: center;
}

.gif-lab-heading {
  justify-content: space-between;
  gap: 12px;
  margin: 15px 0 10px;
}

.gif-lab-heading > span {
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.gif-lab-heading b {
  color: #f3f6fb;
  font: 600 12px Bahnschrift, "Arial Narrow", sans-serif;
  letter-spacing: 0.055em;
}

.gif-lab-heading small {
  color: #76808e;
  font-size: 8px;
}

.lcd-main-preview {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 320 / 172;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(84, 145, 232, 0.45);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 62%, rgba(0, 102, 255, 0.16), transparent 58%),
    #05070a;
  box-shadow:
    inset 0 0 0 5px #0b0e13,
    inset 0 0 36px rgba(0, 102, 255, 0.08);
  cursor: default;
  touch-action: none;
  user-select: none;
}

.lcd-main-preview.is-draggable {
  cursor: grab;
}

.lcd-main-preview.is-dragging {
  cursor: grabbing;
}

.lcd-main-preview::after {
  position: absolute;
  z-index: 4;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.025) 0,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 4px
  );
  content: "";
  pointer-events: none;
}

.lcd-main-preview img {
  position: absolute;
  z-index: 2;
  max-width: none;
  object-fit: fill;
  pointer-events: none;
  will-change: left, top, width, height;
}

.lcd-crop-grid {
  position: absolute;
  z-index: 3;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 33.1%, rgba(255, 255, 255, 0.08) 33.3%, rgba(255, 255, 255, 0.08) 33.6%, transparent 33.8%, transparent 66.2%, rgba(255, 255, 255, 0.08) 66.4%, rgba(255, 255, 255, 0.08) 66.7%, transparent 66.9%),
    linear-gradient(transparent 33.1%, rgba(255, 255, 255, 0.08) 33.3%, rgba(255, 255, 255, 0.08) 33.6%, transparent 33.8%, transparent 66.2%, rgba(255, 255, 255, 0.08) 66.4%, rgba(255, 255, 255, 0.08) 66.7%, transparent 66.9%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.lcd-main-preview.is-draggable:hover .lcd-crop-grid,
.lcd-main-preview.is-dragging .lcd-crop-grid {
  opacity: 1;
}

.lcd-preview-empty {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 6px;
  color: #697483;
  text-align: center;
}

.lcd-preview-empty span {
  font: 600 9px "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.12em;
}

.lcd-preview-empty b {
  color: #a9b2bf;
  font-size: 11px;
  font-weight: 550;
}

.lcd-preview-slot {
  position: absolute;
  z-index: 5;
  top: 13px;
  left: 14px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: #b7c9e3;
  background: rgba(5, 8, 12, 0.78);
  font: 600 8px "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.08em;
}

.lcd-clear-slot {
  position: absolute;
  z-index: 5;
  top: 12px;
  right: 13px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 5px;
  color: #c7d0dc;
  background: rgba(5, 8, 12, 0.78);
  cursor: pointer;
  font-size: 8px;
}

.lcd-clear-slot:disabled {
  opacity: 0;
  pointer-events: none;
}

.lcd-clear-slot:hover {
  border-color: rgba(255, 107, 107, 0.7);
  color: #ff9c9c;
}

.lcd-current-file,
.lcd-current-file > span {
  display: flex;
  align-items: center;
}

.lcd-current-file {
  justify-content: space-between;
  gap: 12px;
  padding: 9px 2px 3px;
}

.lcd-current-file > span {
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.lcd-current-file b {
  overflow: hidden;
  max-width: 208px;
  color: #d7dde6;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lcd-current-file small {
  color: #76808e;
  font-size: 8px;
}

.lcd-current-file i {
  flex: 0 0 auto;
  color: #647083;
  font: normal 7px "Cascadia Code", Consolas, monospace;
}

.lcd-slot-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 12px 0 14px;
}

.lcd-slot-tabs button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #778291;
  background: #0c0f13;
  cursor: pointer;
  text-align: left;
}

.lcd-slot-tabs button:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: #bdc5d0;
}

.lcd-slot-tabs button.is-active {
  border-color: rgba(0, 102, 255, 0.6);
  color: white;
  background: rgba(0, 102, 255, 0.12);
}

.lcd-slot-tabs b {
  font: 650 10px "Cascadia Code", Consolas, monospace;
}

.lcd-slot-tabs span {
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lcd-custom-upload {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(0, 102, 255, 0.45);
  border-radius: 7px;
  color: #8bb9ff;
  background: rgba(0, 102, 255, 0.08);
  cursor: pointer;
  font-size: 9px;
}

.lcd-custom-upload:hover {
  border-color: var(--blue-bright);
  color: white;
}

.gif-lab-controls {
  margin-top: 12px;
}

.gif-fit-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0b0e12;
}

.gif-fit-modes button {
  min-width: 0;
  padding: 7px 4px;
  border: 0;
  border-radius: 6px;
  color: #7f8997;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
}

.gif-fit-modes button:hover:not(:disabled) {
  color: #d5dbe4;
}

.gif-fit-modes button.is-active {
  color: #eef5ff;
  background: rgba(0, 102, 255, 0.17);
  box-shadow: inset 0 0 0 1px rgba(55, 135, 255, 0.42);
}

.gif-fit-modes button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.gif-zoom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 10px;
  margin-top: 11px;
}

.gif-zoom-row > span {
  display: flex;
  grid-column: 1 / -1;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #8d97a5;
  font-size: 9px;
}

.gif-zoom-row b {
  color: #c8d8ee;
  font: 600 8px "Cascadia Code", Consolas, monospace;
}

.gif-zoom-row input {
  width: 100%;
}

.gif-zoom-row button {
  min-width: 48px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #a8b1bd;
  background: #0c0f13;
  cursor: pointer;
  font-size: 8px;
}

.gif-zoom-row button:disabled,
.gif-zoom-row input:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.gif-drag-hint {
  margin: 8px 1px 0;
  color: #697483;
  font-size: 8px;
  line-height: 1.5;
}

.gif-compression-card {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0b0e12;
}

.gif-compression-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gif-compression-head > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.gif-compression-head label {
  color: #cbd3df;
  font-size: 9px;
}

.gif-compression-head small {
  overflow: hidden;
  color: #697483;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gif-size-number {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d1116;
}

.gif-size-number input {
  width: 48px;
  border: 0;
  outline: 0;
  color: #eaf2ff;
  background: transparent;
  text-align: right;
  font: 600 9px "Cascadia Code", Consolas, monospace;
}

.gif-size-number input:disabled {
  opacity: 0.42;
}

.gif-size-number span {
  color: #6f7b8a;
  font-size: 7px;
}

#gif-target-size {
  width: 100%;
  margin-top: 10px;
}

#gif-target-size:disabled {
  opacity: 0.42;
}

.gif-compression-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  color: #66717f;
  font-size: 7px;
}

.gif-compression-scale b {
  color: #83aeea;
  font-weight: 500;
}

.gif-upload-estimate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(55, 135, 255, 0.2);
  border-radius: 7px;
  color: #728092;
  background: rgba(0, 102, 255, 0.06);
  font-size: 8px;
}

.gif-upload-estimate b {
  color: #a9c8f4;
  text-align: right;
  font: 600 8px "Cascadia Code", Consolas, monospace;
}

#gif-compression-result {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: #7f8997;
  font-size: 8px;
  line-height: 1.5;
}

#gif-compression-result[data-tone="success"] {
  color: #83deb0;
}

#gif-compression-result[data-tone="warning"] {
  color: #f4be6d;
}

#gif-compression-result[data-tone="danger"] {
  color: #ff9696;
}

.gif-analysis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--line);
}

.gif-analysis > div {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 8px 7px;
  background: #0c0f13;
}

.gif-analysis span {
  color: #697483;
  font-size: 7px;
}

.gif-analysis b {
  overflow: hidden;
  color: #cbd3df;
  font: 600 8px "Cascadia Code", Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gif-analysis p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 8px 10px;
  color: #8490a0;
  background: #0b0e12;
  font-size: 8px;
  line-height: 1.5;
}

.gif-analysis p[data-tone="success"] {
  color: #83deb0;
}

.gif-analysis p[data-tone="warning"] {
  color: #f4be6d;
}

.gif-analysis p[data-tone="danger"] {
  color: #ff9696;
}

.gif-lab-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 8px;
}

.gif-lab-actions .quiet-button,
.gif-lab-actions .primary-button {
  margin: 0;
  padding-inline: 8px;
  font-size: 10px;
}

.gif-lab-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.upload-progress {
  margin: 16px 0 12px;
}

.upload-progress > div {
  margin-bottom: 7px;
  color: #88919e;
  font-size: 10px;
}

.upload-progress b {
  color: #cdd3dc;
  font: 600 9px "Cascadia Code", Consolas, monospace;
}

.progress-track {
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 4px;
  background: #252a31;
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 180ms ease;
}

.panel-note {
  margin: 13px 3px 0;
  color: #707987;
  font-size: 10px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: flex;
  width: min(340px, calc(100vw - 44px));
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(18, 22, 28, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: none;
}

.toast.is-error .toast-icon {
  color: var(--danger);
}

.toast-icon {
  color: var(--success);
  font-size: 18px;
}

.toast div {
  min-width: 0;
}

.toast b {
  font-size: 12px;
}

.toast p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.unsupported {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 7, 9, 0.86);
  backdrop-filter: blur(8px);
}

.unsupported[hidden] {
  display: none;
}

.unsupported div {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  text-align: center;
}

.unsupported p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}


.feature-guide-hint[hidden] {
  display: none;
}

.feature-guide-hint {
  position: fixed;
  z-index: 55;
  width: min(350px, calc(100vw - 24px));
  padding: 17px;
  border: 1px solid rgba(93, 155, 255, 0.36);
  border-left: 3px solid var(--blue);
  border-radius: 15px;
  color: #eef3fb;
  background:
    linear-gradient(135deg, rgba(0, 102, 255, 0.1), transparent 45%),
    rgba(15, 19, 25, 0.98);
  box-shadow: 0 22px 66px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(-7px) scale(0.985);
  transform-origin: top right;
  transition: opacity 170ms ease, transform 170ms ease;
}

.feature-guide-hint.is-visible {
  opacity: 1;
  transform: none;
}

.feature-guide-hint header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.feature-guide-hint header > span {
  color: #77a8ef;
  font: 650 8px/1 "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.12em;
}

.feature-guide-hint header > button {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #8e99a8;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  font-size: 17px;
}

.feature-guide-hint-step {
  width: fit-content;
  margin-top: 16px;
  padding: 5px 7px;
  border: 1px solid rgba(66, 143, 255, 0.22);
  border-radius: 6px;
  color: #8db8f9;
  background: rgba(0, 102, 255, 0.08);
  font: 650 8px/1 "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.08em;
}

.feature-guide-hint h2 {
  margin: 10px 0 0;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.feature-guide-hint > p {
  margin: 7px 0 15px;
  color: #8f9aaa;
  font-size: 10px;
  line-height: 1.65;
}

.feature-guide-hint-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.feature-guide-hint-actions button {
  min-height: 36px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.feature-guide-hint-primary {
  border: 1px solid #287dfa;
  color: white;
  background: var(--blue);
}

.feature-guide-hint-secondary {
  border: 1px solid var(--line-strong);
  color: #c3cbd6;
  background: rgba(255, 255, 255, 0.025);
}

.feature-guide-hint-disable {
  width: 100%;
  margin-top: 11px;
  padding: 4px;
  border: 0;
  color: #697686;
  background: transparent;
  cursor: pointer;
  font-size: 8px;
}

.feature-guide-hint button:hover {
  color: white;
  border-color: rgba(73, 150, 255, 0.5);
}

.feature-guide-hint button:focus-visible {
  outline: 2px solid rgba(73, 150, 255, 0.85);
  outline-offset: 2px;
}

.guide-tour[hidden] {
  display: none;
}

.guide-menu[hidden] {
  display: none;
}

.guide-menu {
  position: fixed;
  z-index: 70;
  inset: 0;
}

.guide-menu-shield {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 9, 0.76);
  backdrop-filter: blur(7px);
}

.guide-menu-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(650px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(93, 155, 255, 0.32);
  border-radius: 19px;
  background:
    radial-gradient(circle at 12% 0%, rgba(0, 102, 255, 0.13), transparent 34%),
    #10141a;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.65);
  transform: translate(-50%, -50%);
}

.guide-menu-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.guide-menu-card header span {
  color: #7397ca;
  font: 650 8px/1 "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.13em;
}

.guide-menu-card h2 {
  margin: 8px 0 0;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.guide-menu-card header > button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #9aa4b3;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  font-size: 19px;
}

.guide-menu-card > p {
  max-width: 520px;
  margin: 12px 0 19px;
  color: #8f99a8;
  font-size: 11px;
  line-height: 1.65;
}

.guide-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.guide-menu-grid button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 10px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #d5dbe4;
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.guide-menu-grid button:hover {
  border-color: rgba(60, 140, 255, 0.42);
  background: rgba(0, 102, 255, 0.08);
  transform: translateY(-1px);
}

.guide-menu-grid button > span {
  grid-row: 1 / 3;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(60, 140, 255, 0.25);
  border-radius: 8px;
  color: #7fb1fb;
  background: rgba(0, 102, 255, 0.08);
  font: 650 9px/1 "Cascadia Code", Consolas, monospace;
}

.guide-menu-grid b {
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-menu-grid small {
  overflow: hidden;
  color: #747f8e;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-menu-grid i {
  grid-column: 3;
  grid-row: 1 / 3;
  color: #56769f;
  font-style: normal;
  font-size: 15px;
}


.guide-menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.guide-menu-footer span {
  color: #687483;
  font-size: 8px;
}

.guide-menu-footer button {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #8390a0;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  font-size: 8px;
}

.guide-tour {
  position: fixed;
  z-index: 60;
  inset: 0;
}

.guide-shield {
  position: fixed;
  z-index: 60;
  inset: 0;
  background: transparent;
}

.guide-spotlight {
  position: fixed;
  z-index: 61;
  border: 2px solid rgba(60, 140, 255, 0.95);
  border-radius: 13px;
  box-shadow:
    0 0 0 5px rgba(0, 102, 255, 0.17),
    0 0 28px rgba(0, 102, 255, 0.38),
    0 0 0 9999px rgba(4, 6, 9, 0.7);
  pointer-events: none;
  transition: left 220ms ease, top 220ms ease, width 220ms ease, height 220ms ease;
}

.guide-card {
  position: fixed;
  z-index: 62;
  top: 50%;
  left: 50%;
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 19px;
  border: 1px solid rgba(93, 155, 255, 0.38);
  border-radius: 17px;
  background:
    linear-gradient(145deg, rgba(0, 102, 255, 0.08), transparent 36%),
    #10141a;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.58);
  transform: translate(-50%, -50%);
}

.guide-card-head,
.guide-progress,
.guide-actions,
.guide-actions > span {
  display: flex;
  align-items: center;
}

.guide-card-head,
.guide-progress,
.guide-actions {
  justify-content: space-between;
}

.guide-card-head > span,
.guide-eyebrow,
.guide-progress > span,
.guide-safe-note b {
  font-family: "Cascadia Code", Consolas, monospace;
  font-weight: 650;
  letter-spacing: 0.1em;
}

.guide-card-head > span {
  color: #a9c9fb;
  font-size: 9px;
}

.guide-card-head button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #9aa4b3;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  font-size: 18px;
}

.guide-card-head button:hover {
  border-color: var(--line-strong);
  color: white;
}

.guide-progress {
  gap: 12px;
  margin: 17px 0 18px;
}

.guide-progress > span {
  flex: 0 0 auto;
  color: var(--blue-bright);
  font-size: 9px;
}

.guide-progress-rail {
  display: flex;
  width: 100%;
  gap: 4px;
}

.guide-progress-rail i {
  min-width: 4px;
  flex: 1 1 0;
  height: 3px;
  border-radius: 999px;
  background: #29313d;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.guide-progress-rail i.is-complete {
  background: var(--blue);
  box-shadow: 0 0 8px rgba(0, 102, 255, 0.42);
}

.guide-eyebrow {
  color: #6e8fbd;
  font-size: 8px;
}

.guide-card h2 {
  margin: 8px 0 8px;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.guide-copy {
  margin: 0;
  color: #aab3c0;
  font-size: 12px;
  line-height: 1.7;
}

.guide-safe-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 16px;
  padding: 11px 12px;
  border: 1px solid rgba(80, 216, 144, 0.2);
  border-radius: 10px;
  background: rgba(80, 216, 144, 0.055);
}

.guide-safe-note b {
  align-self: start;
  padding: 4px 6px;
  border-radius: 5px;
  color: #87e4b2;
  background: rgba(80, 216, 144, 0.1);
  font-size: 7px;
  white-space: nowrap;
}

.guide-safe-note p {
  margin: 0;
  color: #8fa69b;
  font-size: 10px;
  line-height: 1.55;
}

.guide-actions {
  gap: 14px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.guide-actions small {
  display: block;
  margin-top: 5px;
  color: #657080;
  font-size: 8px;
}

.guide-footer-meta {
  min-width: 0;
}

.guide-footer-meta > button {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #7f8c9e;
  background: transparent;
  font-size: 9px;
  font-weight: 550;
  text-align: left;
}

.guide-footer-meta > button:hover {
  color: #b9c8dc;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.guide-actions > span {
  flex: 0 0 auto;
  gap: 7px;
}

.guide-actions button {
  min-width: 72px;
  padding: 8px 11px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}

.guide-secondary {
  border: 1px solid var(--line);
  color: #a3acb9;
  background: transparent;
}

.guide-secondary:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: white;
}

.guide-primary {
  border: 1px solid #277bfa;
  color: white;
  background: var(--blue);
}

.guide-primary:hover {
  background: #1473ff;
}

@media (max-width: 1240px) {
  .app {
    grid-template-columns: 190px minmax(530px, 1fr) 330px;
    width: 98vw;
  }

  .sidebar {
    padding-inline: 13px;
  }

  .control-panel {
    padding-inline: 19px;
  }

  .device-canvas {
    padding-inline: 22px;
  }
}

@media (max-width: 1020px) {
  body {
    overflow: auto;
  }

  .app {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    width: min(96vw, 860px);
    height: auto;
    min-height: 94vh;
    overflow: visible;
  }

  .sidebar {
    grid-row: 1 / 3;
  }

  .device-canvas {
    min-height: 540px;
  }

  .control-panel {
    min-height: 480px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-height: 780px) and (min-width: 701px) {
  .sidebar {
    padding: 18px 14px 11px;
  }

  .brand {
    margin-bottom: 17px;
  }

  .nav {
    gap: 3px;
  }

  .nav-item {
    padding: 8px 10px;
  }

  .layer-card {
    margin-top: 15px;
  }

  .layer-grid {
    margin-top: 7px;
  }

  .layer-button {
    padding: 7px 9px;
  }

  .layer-help {
    padding: 7px 9px;
  }

  .layer-help p {
    margin-block: 3px;
  }

  .layer-help > span {
    display: none;
  }

  .device-state {
    margin-bottom: 8px;
  }

  .connect-button {
    padding: 9px 12px;
  }
}

@media (max-width: 700px) {
  .app {
    display: block;
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .sidebar {
    display: block;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-bottom: 18px;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 8px 3px;
    font-size: 9px;
    text-align: center;
  }

  .layer-card,
  .sidebar-foot {
    margin-top: 15px;
  }

  .layer-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .device-state,
  .utility-row,
  .reset-actions {
    display: none;
  }

  .device-canvas {
    min-height: 410px;
    padding: 22px 13px 16px;
  }

  .canvas-badges {
    display: none;
  }

  .canvas-header h1 {
    font-size: 22px;
  }

  .keyboard-deck {
    padding: 10px 8px 9px;
    border-radius: 13px;
  }

  .deck-top {
    min-height: 38px;
    margin-bottom: 5px;
  }

  .lcd-module {
    width: 124px;
    height: 36px;
  }

  .lcd-screen {
    height: 26px;
  }

  .lcd-screen > span {
    font-size: 11px;
  }

  .lcd-screen small {
    display: none;
  }

  .encoder-knob {
    width: 25px;
    height: 25px;
  }

  .encoder-knob i {
    height: 6px;
    margin-bottom: 10px;
  }

  .deck-footer {
    margin-top: 6px;
  }

  .canvas-hint {
    display: none;
  }

  .control-panel {
    padding: 24px 18px 36px;
  }

  .guide-card {
    top: auto !important;
    right: 12px !important;
    bottom: 12px;
    left: 12px !important;
    width: auto;
    max-height: min(68vh, 520px);
    transform: none !important;
  }

  .guide-menu-card {
    padding: 18px;
  }

  .guide-menu-grid {
    grid-template-columns: 1fr;
  }


  .feature-guide-hint {
    top: auto !important;
    right: 12px !important;
    bottom: 12px !important;
    left: 12px !important;
    width: auto;
    transform-origin: bottom center;
  }

  .guide-menu-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .guide-actions {
    align-items: flex-end;
  }

  .guide-actions small {
    max-width: 90px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Interface preferences -------------------------------------------------- */

.ui-preferences-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 64px;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
  border-radius: 9px;
  color: color-mix(in srgb, var(--blue) 72%, var(--text));
  background: color-mix(in srgb, var(--blue) 7%, transparent);
  cursor: pointer;
  font-size: 9px;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.ui-preferences-button span {
  font: 700 14px/1 Bahnschrift, "Arial Narrow", sans-serif;
}

.ui-preferences-button b {
  font-size: 8px;
  letter-spacing: 0.04em;
}

.ui-preferences-button:hover,
.ui-preferences-button[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--blue) 58%, var(--line));
  color: var(--text);
  background: color-mix(in srgb, var(--blue) 13%, transparent);
}

.ui-preferences-button:active {
  transform: translateY(1px);
}

.ui-preferences-panel[hidden] {
  display: none;
}

.ui-preferences-panel {
  position: fixed;
  z-index: 95;
  width: min(310px, calc(100vw - 24px));
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  color: var(--text);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--blue) 7%, transparent), transparent 42%),
    color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.ui-preferences-head,
.ui-preferences-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ui-preferences-head {
  margin-bottom: 17px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.ui-preferences-head > span {
  display: grid;
  gap: 3px;
}

.ui-preferences-head small {
  color: var(--blue-bright);
  font: 650 8px/1 "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.14em;
}

.ui-preferences-head b {
  font-size: 15px;
}

.ui-preferences-head > button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--hover-surface);
  cursor: pointer;
  font-size: 18px;
}

.ui-preference-label {
  display: block;
  margin: 14px 0 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ui-preference-select {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: var(--field-surface);
  outline: 0;
  cursor: pointer;
  font-size: 11px;
}

.ui-theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.ui-theme-options button {
  display: grid;
  min-height: 54px;
  place-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--field-surface);
  cursor: pointer;
}

.ui-theme-options button i {
  color: var(--text);
  font: normal 15px/1 Bahnschrift, "Arial Narrow", sans-serif;
}

.ui-theme-options button span {
  font-size: 8px;
}

.ui-theme-options button:hover,
.ui-theme-options button.is-active {
  border-color: color-mix(in srgb, var(--blue) 54%, var(--line));
  color: var(--text);
  background: color-mix(in srgb, var(--blue) 10%, var(--field-surface));
}

.ui-theme-options button.is-active i {
  color: var(--blue-bright);
}

.ui-accent-options {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}

.ui-accent-options > button,
.ui-accent-custom {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  min-width: 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--swatch, var(--field-surface));
  cursor: pointer;
}

.ui-accent-options > button::after {
  position: absolute;
  inset: 4px;
  border: 2px solid transparent;
  border-radius: 5px;
  content: "";
}

.ui-accent-options > button.is-active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--swatch);
}

.ui-accent-options > button.is-active::after {
  border-color: rgba(255, 255, 255, 0.88);
}

.ui-accent-custom {
  color: var(--text);
  background:
    linear-gradient(135deg, #ff5353, #ffcf4a 25%, #43c875 48%, #36a7ff 72%, #9b62ff);
}

.ui-accent-custom input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.ui-accent-custom span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 50%;
  color: #17202d;
  background: rgba(255, 255, 255, 0.88);
  font: 700 13px/1 system-ui, sans-serif;
}

.ui-preferences-footer {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.ui-preferences-footer code {
  color: var(--blue-bright);
  font: 650 10px/1 "Cascadia Code", Consolas, monospace;
}

.ui-preferences-footer button {
  padding: 6px 8px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 8px;
}

.ui-preferences-footer button:hover {
  color: var(--text);
}

/* Accent color follows the interface without changing hardware RGB values. */
.guide-launch,
.panel-guide-button,
.layer-scope-badge,
.scope-notice,
.lcd-custom-upload {
  border-color: color-mix(in srgb, var(--blue) 28%, var(--line));
  color: color-mix(in srgb, var(--blue) 66%, var(--text));
  background-color: color-mix(in srgb, var(--blue) 7%, transparent);
}

.guide-launch:hover,
.panel-guide-button:hover,
.lcd-custom-upload:hover {
  border-color: color-mix(in srgb, var(--blue) 58%, var(--line));
  color: var(--text);
  background-color: color-mix(in srgb, var(--blue) 13%, transparent);
}

.nav-item.is-active,
.layer-button.is-active,
.encoder-targets button.is-active,
.shortcut-categories button.is-active,
.mini-button:hover,
.preset-grid button.is-selected,
.lcd-slot-tabs button.is-active,
.gif-fit-modes button.is-active {
  border-color: color-mix(in srgb, var(--blue) 52%, var(--line));
  color: var(--text);
  background: color-mix(in srgb, var(--blue) 11%, transparent);
}

.connect-button,
.primary-button,
.guide-primary,
.feature-guide-hint-primary {
  color: var(--accent-contrast);
  background: var(--blue);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--blue) 20%, transparent);
}

.connect-button:hover,
.primary-button:hover,
.guide-primary:hover,
.feature-guide-hint-primary:hover {
  background: color-mix(in srgb, var(--blue) 88%, #000000);
}

.scope-notice-mark,
.guide-menu-grid button > span,
.feature-guide-hint-step {
  border-color: color-mix(in srgb, var(--blue) 42%, var(--line));
  color: color-mix(in srgb, var(--blue) 60%, var(--text));
  background: color-mix(in srgb, var(--blue) 12%, transparent);
}

.svg-key.is-selected rect {
  fill: color-mix(in srgb, var(--blue) 28%, #17212f);
  stroke: var(--blue-bright);
}

.encoder-key:hover circle:first-child,
.encoder-key.is-selected circle:first-child,
#svg-screen-control:hover {
  stroke: var(--blue-bright);
}

.shortcut-capture.is-capturing {
  border-color: color-mix(in srgb, var(--blue) 72%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent);
}

.guide-menu-grid button:hover,
.macro-library-actions button:hover {
  border-color: color-mix(in srgb, var(--blue) 44%, var(--line));
}

.guide-spotlight {
  border-color: color-mix(in srgb, var(--blue) 92%, #ffffff);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--blue) 18%, transparent),
    0 0 28px color-mix(in srgb, var(--blue) 38%, transparent),
    0 0 0 9999px rgba(4, 6, 9, 0.7);
}

.guide-progress-rail i.is-complete,
.progress-track i {
  background: var(--blue);
}

/* Light mode presents the keyboard as restrained line art on the canvas. */
:root[data-theme="light"] .device-canvas {
  background:
    radial-gradient(circle at 52% 42%, color-mix(in srgb, var(--blue) 5%, transparent), transparent 48%),
    var(--canvas);
}

:root[data-theme="light"] .keyboard-deck {
  filter: drop-shadow(0 22px 24px rgba(35, 50, 70, 0.18));
}

:root[data-theme="light"] #keyboard-board #body-finish stop:first-child {
  stop-color: #f8fafc;
}

:root[data-theme="light"] #keyboard-board #body-finish stop:last-child {
  stop-color: #edf1f5;
}

:root[data-theme="light"] #keyboard-board #key-finish stop:first-child {
  stop-color: #fbfcfd;
}

:root[data-theme="light"] #keyboard-board #key-finish stop:last-child {
  stop-color: #eef2f6;
}

:root[data-theme="light"] #keyboard-board #knob-finish stop:first-child {
  stop-color: #ffffff;
}

:root[data-theme="light"] #keyboard-board #knob-finish stop:nth-child(2) {
  stop-color: #eef2f6;
}

:root[data-theme="light"] #keyboard-board #knob-finish stop:last-child {
  stop-color: #d9e0e8;
}

:root[data-theme="light"] #keyboard-board .keyboard-shell {
  stroke: #263241;
}

:root[data-theme="light"] #keyboard-board > svg > path {
  stroke: #263241;
  opacity: 0.42;
}

:root[data-theme="light"] #keyboard-board > svg > text {
  fill: #263241;
}

:root[data-theme="light"] #keyboard-board .svg-key rect {
  stroke: #344150;
}

:root[data-theme="light"] #keyboard-board .svg-key .key-label {
  fill: #263241;
}

:root[data-theme="light"] #keyboard-board .svg-key:hover rect {
  fill: color-mix(in srgb, var(--blue) 8%, #f8fafc);
  stroke: color-mix(in srgb, var(--blue) 54%, #263241);
}

:root[data-theme="light"] #keyboard-board .svg-key.is-selected rect {
  fill: color-mix(in srgb, var(--blue) 14%, #ffffff);
  stroke: var(--blue);
}

:root[data-theme="light"] #keyboard-board .svg-key.is-selected .key-label {
  fill: color-mix(in srgb, var(--blue) 64%, #102033);
}

:root[data-theme="light"] #keyboard-board .screen-module > rect:first-child {
  fill: #eef2f6;
  stroke: #344150;
}

:root[data-theme="light"] #keyboard-board .encoder-key circle:first-child {
  stroke: #344150;
}

:root[data-theme="light"] #keyboard-board .encoder-key circle:nth-child(2) {
  stroke: #687586;
}

:root[data-theme="light"] #keyboard-board .encoder-key path {
  stroke: #263241;
}

:root[data-theme="light"] .rgb-preview {
  border-color: var(--line);
  background: var(--field-surface);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

:root[data-theme="light"] .rgb-preview span {
  border-color: color-mix(in srgb, var(--preview-color, var(--blue)) 28%, #ffffff);
}

:root[data-theme="light"] .rgb-preview[data-preview="off"] span {
  border-color: #c8d0da;
  background: #dce2e9;
}

:root[data-theme="light"] .gif-analysis {
  background: var(--line);
}

:root[data-theme="light"] .gif-analysis > div,
:root[data-theme="light"] .gif-analysis p {
  background: var(--field-surface);
}

:root[data-theme="light"] .gif-analysis p[data-tone="success"] {
  color: #147a4a;
  background: #eef9f3;
}

:root[data-theme="light"] .gif-analysis p[data-tone="warning"] {
  color: #97520b;
  background: #fff8e9;
}

:root[data-theme="light"] .gif-analysis p[data-tone="danger"] {
  color: #b4232d;
  background: #fff2f3;
}

:root[data-theme="light"] .sidebar,
:root[data-theme="light"] .control-panel {
  background: var(--surface);
}

:root[data-theme="light"] .brand-mark {
  border-color: rgba(23, 34, 49, 0.16);
  color: #f8fafc;
  background: #182231;
}

:root[data-theme="light"] .nav-item:hover,
:root[data-theme="light"] .utility-row button:hover,
:root[data-theme="light"] .utility-row label:hover,
:root[data-theme="light"] .quiet-button:hover,
:root[data-theme="light"] .encoder-targets button:hover,
:root[data-theme="light"] .shortcut-categories button:hover,
:root[data-theme="light"] .macro-library-actions button:hover,
:root[data-theme="light"] .guide-card-head button:hover {
  color: var(--text);
  background: var(--hover-surface);
}

:root[data-theme="light"] .nav-item,
:root[data-theme="light"] .layer-button b,
:root[data-theme="light"] .layer-button span,
:root[data-theme="light"] .utility-row button,
:root[data-theme="light"] .utility-row label,
:root[data-theme="light"] .reset-actions button,
:root[data-theme="light"] .quiet-button,
:root[data-theme="light"] .field-label,
:root[data-theme="light"] .field-help,
:root[data-theme="light"] .macro-step-row,
:root[data-theme="light"] .lcd-authorize-help,
:root[data-theme="light"] .panel-note,
:root[data-theme="light"] .rgb-preview-note,
:root[data-theme="light"] .canvas-hint {
  color: var(--muted);
}

:root[data-theme="light"] .layer-help strong,
:root[data-theme="light"] .scope-notice b,
:root[data-theme="light"] .panel-heading p b,
:root[data-theme="light"] .macro-toolbar,
:root[data-theme="light"] .range-head,
:root[data-theme="light"] .lcd-status-row b,
:root[data-theme="light"] .lcd-current-file b,
:root[data-theme="light"] .gif-analysis b,
:root[data-theme="light"] .gif-upload-estimate b,
:root[data-theme="light"] .keycode-meta,
:root[data-theme="light"] .selection-summary {
  color: var(--text);
}

:root[data-theme="light"] .layer-button small,
:root[data-theme="light"] .layer-help p,
:root[data-theme="light"] .layer-help > span,
:root[data-theme="light"] .panel-heading p,
:root[data-theme="light"] .scope-notice p,
:root[data-theme="light"] .macro-capacity p,
:root[data-theme="light"] .lcd-current-file small,
:root[data-theme="light"] .gif-analysis span {
  color: var(--muted);
}

:root[data-theme="light"] .layer-card,
:root[data-theme="light"] .control-card,
:root[data-theme="light"] .rgb-effect-info,
:root[data-theme="light"] .gif-compression-card,
:root[data-theme="light"] .gif-analysis,
:root[data-theme="light"] .lcd-status-row,
:root[data-theme="light"] .macro-capacity,
:root[data-theme="light"] .macro-library-item,
:root[data-theme="light"] .feature-guide-hint,
:root[data-theme="light"] .guide-menu-card,
:root[data-theme="light"] .guide-card {
  color: var(--text);
  background-color: var(--surface-2);
}

:root[data-theme="light"] .field,
:root[data-theme="light"] .macro-step-row,
:root[data-theme="light"] .empty-state,
:root[data-theme="light"] .macro-delay-tools input,
:root[data-theme="light"] .gif-fit-modes,
:root[data-theme="light"] .gif-size-number,
:root[data-theme="light"] .lcd-slot-tabs button,
:root[data-theme="light"] .preset-grid button,
:root[data-theme="light"] .shortcut-categories button,
:root[data-theme="light"] .encoder-targets button,
:root[data-theme="light"] .guide-menu-grid button,
:root[data-theme="light"] .guide-card-head button,
:root[data-theme="light"] .guide-secondary,
:root[data-theme="light"] .feature-guide-hint-secondary {
  color: var(--text);
  background: var(--field-surface);
}

:root[data-theme="light"] .layer-button,
:root[data-theme="light"] .utility-row button,
:root[data-theme="light"] .utility-row label,
:root[data-theme="light"] .quiet-button,
:root[data-theme="light"] .mini-button,
:root[data-theme="light"] .reset-actions button,
:root[data-theme="light"] .lcd-status-row button,
:root[data-theme="light"] .gif-zoom-row button,
:root[data-theme="light"] .lcd-custom-upload {
  color: var(--muted);
  background-color: transparent;
}

:root[data-theme="light"] .macro-timeline,
:root[data-theme="light"] .macro-library,
:root[data-theme="light"] .gif-lab-controls,
:root[data-theme="light"] .lcd-current-file,
:root[data-theme="light"] .gif-upload-estimate,
:root[data-theme="light"] .upload-progress {
  color: var(--text);
}

:root[data-theme="light"] .toast {
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 50px rgba(35, 50, 70, 0.2);
}

:root[data-theme="light"] .unsupported {
  background: rgba(230, 235, 242, 0.9);
}

:root[data-theme="light"] .unsupported > div {
  background: var(--surface-2);
}

:root[data-theme="light"] .guide-menu-shield,
:root[data-theme="light"] .guide-shield {
  background: rgba(31, 41, 55, 0.42);
}

:root[data-theme="light"] .guide-safe-note {
  color: #355244;
  background: rgba(23, 134, 79, 0.07);
}

:root[data-theme="light"] .feature-guide-hint,
:root[data-theme="light"] .guide-menu-card,
:root[data-theme="light"] .guide-card {
  box-shadow: 0 24px 70px rgba(35, 50, 70, 0.24);
}

:root[data-theme="light"] .ui-preferences-panel {
  box-shadow: 0 24px 70px rgba(35, 50, 70, 0.22);
}

@media (max-width: 1240px) {
  .ui-preferences-button {
    min-width: 34px;
    width: 34px;
    padding-inline: 0;
  }

  .ui-preferences-button b {
    display: none;
  }
}

@media (max-width: 700px) {
  .ui-preferences-button {
    position: absolute;
    top: 17px;
    right: 14px;
    z-index: 5;
  }

  .ui-preferences-panel {
    top: auto !important;
    right: 10px;
    bottom: 10px;
    left: 10px !important;
    width: auto;
    max-height: calc(100vh - 20px);
    overflow: auto;
    border-radius: 18px;
  }
}
