/* Nova Keyboard Utility - Main Styles */

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Custom scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }
::-webkit-scrollbar-corner { background: transparent; }

html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg-primary); color: var(--text-normal); overflow: hidden; }
.app { display: flex; flex-direction: column; height: 100vh; }
.content-wrapper { display: flex; flex: 1; overflow: hidden; flex-direction: row; }

/* Header */
header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: var(--bg-tertiary); border-bottom: 1px solid rgba(0,0,0,0.2); -webkit-app-region: drag; }
.header-left { display: flex; align-items: center; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; cursor: pointer; padding: 6px 12px; border-radius: var(--radius-sm); transition: background 0.2s; -webkit-app-region: no-drag; }
.app-logo { width: 18px; height: 18px; flex: 0 0 auto; }
.logo:hover { background: var(--bg-modifier-hover); }
.logo span { color: var(--accent); }
.keyboard-selector-dropdown { position: absolute; top: 50px; left: 20px; background: var(--bg-secondary); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius); padding: 8px 0; min-width: 150px; z-index: 1000; box-shadow: 0 8px 24px rgba(0,0,0,0.3); display: none; }
.keyboard-selector-dropdown.show { display: block; }
.keyboard-selector-item { padding: 10px 16px; font-size: 13px; color: var(--text-muted); cursor: pointer; transition: all 0.1s; display: flex; align-items: center; justify-content: space-between; }
.keyboard-selector-item:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }
.keyboard-selector-item.active { color: var(--accent); font-weight: 600; }
.keyboard-selector-item.active::after { content: '✓'; color: var(--accent); font-weight: 700; }
.connection-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.status-dot.connected { background: var(--green); }
.header-right { display: flex; align-items: center; gap: 16px; -webkit-app-region: no-drag; }
.nova-logo { height: 28px; width: auto; fill: var(--accent); opacity: 0.9; transition: fill 0.3s, opacity 0.3s; }
.nova-logo:hover { opacity: 1; }

/* Window controls */
.window-controls { display: flex; gap: 8px; align-items: center; -webkit-app-region: no-drag !important; pointer-events: auto !important; z-index: 9999; }
.window-control-btn { width: 32px; height: 32px; border: none; background: transparent; color: var(--text-normal); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 4px; transition: background 0.2s, color 0.2s; pointer-events: auto !important; -webkit-app-region: no-drag !important; }
.window-control-btn * { pointer-events: none; }
.window-control-btn:hover { background: rgba(255, 255, 255, 0.1); }
.window-control-btn.close:hover { background: #ff5052; color: white; }

/* Bottom logo container */
.bottom-logo { position: absolute; bottom: 16px; left: 16px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; -webkit-app-region: no-drag; }
.bottom-logo svg { width: 100%; height: 100%; fill: var(--accent); opacity: 0.7; transition: opacity 0.3s; }
.bottom-logo:hover svg { opacity: 1; }
.battery-indicator { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--bg-secondary); border-radius: var(--radius); font-size: 13px; }
.battery-icon { width: 24px; height: 12px; border: 2px solid var(--text-muted); border-radius: 2px; position: relative; }
.battery-icon::after { content: ''; position: absolute; right: -5px; top: 50%; transform: translateY(-50%); width: 2px; height: 6px; background: var(--text-muted); border-radius: 0 1px 1px 0; }
.battery-fill { height: 100%; background: var(--green); border-radius: 1px; transition: width 0.3s; }
.battery-fill.low { background: var(--yellow); }
.battery-fill.critical { background: var(--red); }

/* Navigation tabs */
.nav-tabs { display: flex; background: var(--bg-secondary); padding: 0 20px; border-bottom: 1px solid rgba(0,0,0,0.1); }
.nav-tab { padding: 12px 20px; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s; -webkit-app-region: no-drag; }
.nav-tab:hover { color: var(--text-normal); }
.nav-tab.active { color: var(--text-normal); border-bottom-color: var(--accent); }

.main-content { flex: 1; display: flex; overflow: hidden; position: relative; }

/* Sidebar */
.sidebar { width: 220px; background: var(--bg-secondary); padding: 16px; overflow-y: auto; border-right: 1px solid rgba(0,0,0,0.1); position: relative; }
.sidebar-section { margin-bottom: 20px; }
.sidebar-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; padding: 0 8px; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; color: var(--text-muted); transition: all 0.1s; }
.sidebar-item:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }
.sidebar-item.active { background: var(--bg-modifier-selected); color: var(--text-normal); }

/* Profile list styles */
.profile-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.profile-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text-muted); transition: all 0.1s; position: relative; }
.profile-item:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }
.profile-item.active { background: var(--bg-modifier-selected); color: var(--text-normal); border-left: 2px solid var(--accent); }
.profile-color { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.2); flex-shrink: 0; cursor: pointer; }
.profile-color:hover { transform: scale(1.2); }
.profile-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-delete { opacity: 0; font-size: 12px; color: var(--text-muted); cursor: pointer; padding: 2px 4px; }
.profile-item:hover .profile-delete { opacity: 0.6; }
.profile-item:hover .profile-delete:hover { opacity: 1; color: #ff6b6b; }
.profile-actions { display: flex; gap: 4px; }
.profile-btn { flex: 1; padding: 6px 10px; font-size: 12px; background: var(--bg-tertiary); border: 1px solid var(--bg-modifier-accent); border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; transition: all 0.1s; }
.profile-btn:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }

/* Profile color picker dropdown */
.profile-color-picker { position: absolute; left: 100%; top: 0; margin-left: 4px; background: var(--bg-tertiary); border: 1px solid var(--bg-modifier-accent); border-radius: var(--radius-sm); padding: 8px; display: none; z-index: 1000; flex-wrap: wrap; gap: 4px; width: 100px; }
.profile-color-picker.visible { display: flex; }
.profile-color-option { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all 0.1s; }
.profile-color-option:hover { transform: scale(1.15); border-color: white; }
.profile-color-option.selected { border-color: var(--accent); }

/* Select dropdown styling for dark theme */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px !important;
}
select option {
  background: var(--bg-primary);
  color: var(--text-normal);
  padding: 8px 12px;
}
select option:hover, select option:focus, select option:checked {
  background: var(--bg-modifier-hover);
}

/* Toggle switch */
.toggle-switch { position: relative; width: 40px; height: 24px; background: rgba(0,0,0,0.4); border-radius: 12px; cursor: pointer; transition: background 0.2s; flex-shrink: 0; box-shadow: inset 0 2px 4px rgba(0,0,0,0.3); }
.toggle-switch.active { background: var(--accent); box-shadow: none; }
.toggle-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: rgba(255,255,255,0.7); border-radius: 50%; transition: transform 0.2s, background 0.2s; }
.toggle-switch.active::after { transform: translateX(16px); background: white; }

/* Panels */
.panel-content { flex: 1; display: flex; flex-direction: column; padding: 20px; overflow-y: auto; }
.panel { display: none; flex: 1; flex-direction: column; }
.panel.active { display: flex; }
.macros-subpanel { display: none; }
.macros-subpanel.active { display: block; }

/* Keyboard container */
.keyboard-container { background: var(--bg-secondary); border-radius: 12px; padding: 24px; width: fit-content; margin-right: 20px; }
.keyboard-row { display: flex; gap: 3px; margin-bottom: 3px; }

/* Keys */
.key { height: var(--key-size); width: var(--key-size); background: var(--key-bg); border: 1px solid var(--key-border); border-radius: 5px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; font-weight: 500; cursor: pointer; transition: all 0.1s; user-select: none; box-shadow: 0 2px 0 rgba(0,0,0,0.3); padding: 4px; flex: 0 0 auto; overflow: hidden; text-align: center; }
.key:hover { background: var(--key-bg-hover); }
.key.selected { background: var(--accent); border-color: var(--accent); }
.key.pressed { background: var(--key-bg-pressed); transform: translateY(2px); box-shadow: none; }
.key .top { font-size: 8px; opacity: 0.7; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key .bottom { font-size: 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Keycap inline icon + text (VIA-style) */
.keycap-content { display: inline-flex; align-items: center; justify-content: center; gap: 4px; max-width: 100%; flex-wrap: wrap; min-width: 0; }
.keycap-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 14px; height: 14px; }
.keycap-icon svg { width: 14px; height: 14px; fill: currentColor; }
.keycap-icon img { width: 14px; height: 14px; object-fit: contain; }
.keycap-text {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.1;
  word-break: break-word;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Per-key: shrink-to-fit */
.keycap-text.autoshrink {
  display: block;
  white-space: nowrap;
  word-break: normal;
  line-clamp: 1;
  -webkit-line-clamp: 1;
  -webkit-box-orient: unset;
}

.keycap-content.autoshrink {
  flex-wrap: nowrap;
}

/* Per-key layout: stack icon above text */
.keycap-content.layout-col {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 2px;
}

/* Key width classes */
.key.w-1-25 { width: calc(var(--key-size) * 1.25 + 3px * 0.25); }
.key.w-1-5 { width: calc(var(--key-size) * 1.5 + 3px * 0.5); }
.key.w-1-75 { width: calc(var(--key-size) * 1.75 + 3px * 0.75); }
.key.w-2 { width: calc(var(--key-size) * 2 + 3px); }
.key.w-2-25 { width: calc(var(--key-size) * 2.25 + 3px * 1.25); }
.key.w-2-75 { width: calc(var(--key-size) * 2.75 + 3px * 1.75); }
.key.w-6-25 { width: calc(var(--key-size) * 6.25 + 3px * 5.25); }
.key.gap-left { margin-left: calc(var(--key-size) * 0.5 + 3px * 0.5); }
.key.remapped { border: 2px solid var(--nova-blue-vibrant); box-shadow: 0 0 8px var(--nova-blue-shadow); }
.key.remapped.selected { border-color: var(--accent); }

/* Encoder knob */
.encoder-knob { width: var(--key-size); height: var(--key-size); border-radius: 50%; background: linear-gradient(145deg, #4a4a4a, #3a3a3a); border: 2px solid var(--key-border); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text-muted); box-shadow: 0 3px 6px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.1); transition: all 0.15s; padding: 0; }
.encoder-knob:hover { background: linear-gradient(145deg, #555, #444); }
.encoder-knob.selected { border-color: var(--accent); box-shadow: 0 0 12px rgba(88, 101, 242, 0.5); }
.encoder-knob.pressed { background: var(--key-bg-pressed); transform: translateY(2px); box-shadow: none; }
.matrix-encoder { padding: 0; }

/* Encoder tooltip submenu */
.encoder-tooltip { position: fixed; display: none; background: var(--bg-tertiary); border-radius: var(--radius-sm); padding: 12px; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.3); min-width: 300px; }
.encoder-tooltip.open { display: block; }
.encoder-tooltip-row { display: flex; gap: 10px; margin-bottom: 10px; }
.encoder-tooltip-btn { flex: 1; padding: 10px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; cursor: pointer; border: 1px solid rgba(255,255,255,0.1); background: var(--bg-secondary); color: var(--text-muted); transition: all 0.15s; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.encoder-tooltip-btn:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }
.encoder-tooltip-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.encoder-tooltip-btn-title { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.encoder-tooltip-icon { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; flex: 0 0 auto; opacity: 0.95; }
.encoder-tooltip-icon svg { width: 14px; height: 14px; }
.encoder-tooltip-btn-value { font-size: 11px; opacity: 0.9; line-height: 1.2; }
.encoder-tooltip-done { width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; cursor: pointer; border: 1px solid rgba(255,255,255,0.1); background: var(--bg-secondary); color: var(--text-normal); transition: all 0.15s; }
.encoder-tooltip-done:hover { background: var(--bg-modifier-hover); }

/* Selection count badge */
.selection-count { background: var(--accent); color: white; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; display: inline-block; margin-bottom: 12px; }

/* Live actuation visualization */
.actuation-visualizer { display: flex; gap: 20px; align-items: center; margin-top: 20px; }
.keycap-visual { width: 100px; display: flex; flex-direction: column; align-items: center; }
.keycap-housing { width: 70px; height: 140px; background: linear-gradient(180deg, #3a3a3a, #2a2a2a); border-radius: 8px; position: relative; overflow: hidden; border: 2px solid #555; }
.keycap-stem { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 45px; background: linear-gradient(180deg, #50C878, #3a9a5c); border-radius: 4px 4px 0 0; transition: height 0.1s ease-out; }
.keycap-top { width: 55px; height: 35px; background: linear-gradient(180deg, #555, #444); border-radius: 6px; margin-bottom: -5px; z-index: 1; position: relative; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text-muted); box-shadow: 0 4px 8px rgba(0,0,0,0.3); transition: transform 0.1s ease-out; }
.keycap-top.pressed { transform: translateY(8px); }
.actuation-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 2; transition: bottom 0.1s ease-out; }
.hysteresis-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--yellow); z-index: 2; transition: bottom 0.1s ease-out; }
.actuation-label { position: absolute; left: -45px; font-size: 10px; color: var(--accent); transform: translateY(-50%); white-space: nowrap; }
.hysteresis-label { position: absolute; right: -45px; font-size: 10px; color: var(--yellow); transform: translateY(-50%); white-space: nowrap; }
.vertical-slider-container { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.vertical-slider { -webkit-appearance: none; appearance: none; writing-mode: vertical-lr; direction: ltr; height: 160px; width: 6px; border-radius: 3px; background: var(--slider-track); outline: none; cursor: pointer; }
.vertical-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--slider-thumb); cursor: pointer; }
.vertical-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--slider-thumb); cursor: pointer; border: none; }
.vertical-slider::-moz-range-track { background: transparent; }
.vertical-slider.hysteresis { background: linear-gradient(180deg, #4a4a4a, #3a3a3a); }
.vertical-slider.hysteresis::-webkit-slider-thumb { background: var(--yellow); }
.vertical-slider.hysteresis::-moz-range-thumb { background: var(--yellow); }
.slider-value-label { font-size: 18px; font-weight: 700; margin-bottom: 4px; width: 70px; text-align: center; }
.slider-value-label.actuation { color: var(--accent); }
.slider-value-label.hysteresis { color: var(--yellow); }
.slider-minmax { font-size: 10px; color: var(--text-muted); margin-top: 4px; width: 70px; text-align: center; }

/* Ambient LEDs */
.ambient-container { margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.ambient-title { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; }
.ambient-strip { display: flex; gap: 8px; }
.ambient-led { width: 40px; height: 40px; border-radius: 50%; background: #333; border: 2px solid var(--key-border); cursor: pointer; transition: all 0.15s; }
.ambient-led:hover { transform: scale(1.1); }
.ambient-led.selected { border-color: var(--accent); }

/* Controls panel */
.controls-panel { width: 380px; background: var(--bg-secondary); padding: 20px; border-left: 1px solid rgba(0,0,0,0.2); overflow-y: auto; flex: 0 0 380px; }
.control-section { margin-bottom: 16px; }
.control-title { font-size: 13px; font-weight: 600; color: var(--text-normal); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.control-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.control-label { font-size: 13px; color: var(--text-muted); }

/* Theme selector */
.theme-selector { display: flex; gap: 12px; flex-wrap: wrap; }
.theme-option { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; background: transparent; border: 2px solid transparent; border-radius: var(--radius); cursor: pointer; transition: all 0.15s; }
.theme-option:hover { background: var(--bg-tertiary); }
.theme-option.active { border-color: var(--accent); background: var(--bg-tertiary); }
.theme-preview { width: 48px; height: 48px; border-radius: var(--radius-sm); background-size: cover; background-position: center; }
.theme-name { font-size: 11px; color: var(--text-muted); }
.theme-option.active .theme-name { color: var(--text-normal); }

/* Sliders */
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; background: var(--slider-track); outline: none; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--slider-thumb); cursor: pointer; }
.slider:disabled { opacity: 0.4; cursor: not-allowed; }
.slider:disabled::-webkit-slider-thumb { cursor: not-allowed; background: var(--text-muted); }
input:disabled, button:disabled, .hex-input:disabled { opacity: 0.5; cursor: not-allowed; }

/* Keypress preview */
.keypress-preview { margin-top: 16px; padding: 16px; background: var(--bg-tertiary); border-radius: var(--radius); }
.preview-bar { height: 80px; background: var(--bg-primary); border-radius: var(--radius-sm); position: relative; overflow: hidden; }
.preview-plunger { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 40px; background: linear-gradient(180deg, var(--accent), var(--accent-hover)); border-radius: 4px 4px 0 0; transition: height 0.05s; }
.preview-markers { position: absolute; right: 8px; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 4px 0; font-size: 9px; color: var(--text-muted); }

/* Color controls */
.color-swatch { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 2px solid var(--key-border); cursor: pointer; }
.color-swatch-small { width: 28px; height: 28px; border-radius: var(--radius-sm); border: 2px solid var(--key-border); cursor: pointer; }
.color-control { display: flex; align-items: center; gap: 8px; position: relative; }
.native-color-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.hex-input { width: 92px; padding: 8px 10px; background: var(--bg-tertiary); color: var(--text-normal); border: 1px solid var(--key-border); border-radius: var(--radius-sm); font-size: 12px; }
.hex-input:focus { outline: none; border-color: var(--accent); }

/* Hide hex inputs in color-control (show only in color picker) */
.color-control .hex-input { display: none; }

/* Paint Mode Bar (below keyboard) */
.paint-mode-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; margin-top: 16px; background: var(--bg-secondary); border-radius: var(--radius); }
.paint-mode-left { display: flex; align-items: center; gap: 12px; }
.paint-mode-right { display: flex; align-items: center; gap: 12px; }
.paint-mode-label { font-size: 13px; font-weight: 600; color: var(--text-normal); }
.btn-small { padding: 6px 12px; font-size: 11px; }

/* Transparent key styling */
.key.transparent { border-style: dashed; }
.trns-indicator {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -60%);
  opacity: 0.85;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.trns-indicator img { width: 14px; height: 14px; object-fit: contain; display: block; }

/* Transparent-key resolved label (shown under the triangle/icon) */
.trns-label { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 10px; opacity: 0.9; max-width: 90%; overflow: hidden; }
.trns-label .keycap-content { flex-direction: column; flex-wrap: nowrap; gap: 2px; }
.trns-label .keycap-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-clamp: 1; -webkit-line-clamp: 1; -webkit-box-orient: unset; }

/* Dim transparent indicator + resolved label/icon */
.key.transparent .trns-indicator { opacity: 0.35; }
.key.transparent .trns-label { color: var(--text-muted); opacity: 0.85; }
.key.transparent .trns-label .keycap-icon { display: none; }

/* Dark mode color pickers - Wooting style */
input[type="color"] {
  color-scheme: dark;
  -webkit-appearance: none;
  appearance: none;
  width: 50px;
  height: 30px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-secondary);
  padding: 2px;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: var(--radius-sm);
}
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}
input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}

/* Buttons */
.btn { padding: 10px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-normal); }
.btn-secondary:hover { background: var(--key-bg-hover); }
.btn-danger { background: #a81d1d; color: white; }
.btn-danger:hover { background: #7e0b0b; }
.btn-group { display: flex; gap: 8px; margin-top: 16px; }

/* Layer selector buttons */
.layer-btn-wrapper { display: flex; align-items: center; gap: 6px; }
.layer-btn { position: relative; padding: 8px 30px 8px 14px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; cursor: pointer; border: 0px solid rgba(255,255,255,0.1); background: var(--bg-tertiary); color: var(--text-muted); transition: all 0.15s; }
.layer-btn:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }
.layer-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.layer-led-indicator { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); cursor: pointer; transition: all 0.15s; background: transparent; }
.layer-led-indicator:hover { transform: translateY(-50%) scale(1.1); }
.layer-led-indicator[data-layer="0"] { border-style: dashed; }

/* Layer indicator popover color picker */
.layer-color-popover { position: fixed; display: none; background: var(--bg-tertiary); border: none; border-radius: var(--radius-sm); padding: 8px; z-index: 1100; box-shadow: 0 4px 12px rgba(0,0,0,0.3); min-width: 190px; }
.layer-color-popover.open { display: block; }
.layer-color-popover-title { font-size: 12px; font-weight: 600; color: var(--text-normal); margin-bottom: 8px; }
.layer-color-popover-row { display: flex; align-items: center; gap: 8px; }

/* Custom color picker */
.nw-color-picker { display: grid; grid-template-columns: 1fr; gap: 8px; }
.nw-color-sv-wrap { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: none; background: var(--bg-secondary); }
.nw-color-sv { display: block; width: 100%; height: 96px; touch-action: none; }
.nw-color-sv-wrap, .nw-color-hue-wrap { touch-action: none; user-select: none; -webkit-user-select: none; }
.nw-color-thumb { position: absolute; width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.9); box-shadow: 0 0 0 1px rgba(0,0,0,0.4); pointer-events: none; transform: translate(-6px, -6px); }

.nw-color-hue-wrap { position: relative; height: 14px; border-radius: 999px; overflow: hidden; border: none; background: var(--bg-secondary); }
.nw-color-hue { display: block; width: 100%; height: 14px; touch-action: none; }
.nw-color-hue-thumb { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.9); box-shadow: 0 0 0 1px rgba(0,0,0,0.4); pointer-events: none; transform: translate(-6px, -50%); background: var(--bg-tertiary); }

.nw-color-hex-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; align-items: center; }
.nw-color-hex-label { font-size: 11px; color: var(--text-muted); }
.nw-color-hex-input { width: 100%; background: var(--bg-secondary); border: 1px solid rgba(255,255,255,0.12); color: var(--text-normal); border-radius: var(--radius-sm); padding: 7px 9px; font-size: 13px; }
.nw-color-hex-input:focus { outline: none; border-color: rgba(255,255,255,0.24); }
.nw-color-hex-copy { padding: 7px 9px; font-size: 12px; border-radius: var(--radius-sm); }

.nw-color-recents-title { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.nw-color-recents { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.nw-color-recent { width: 100%; aspect-ratio: 1 / 1; border-radius: 50%; border: 2px solid rgba(255,255,255,0.22); cursor: pointer; background: transparent; }
.nw-color-recent:hover { border-color: rgba(255,255,255,0.6); }
.nw-color-recent.transparent { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.14) 0, rgba(255,255,255,0.14) 3px, rgba(0,0,0,0.0) 3px, rgba(0,0,0,0.0) 6px); }

/* Optional: hide recents for compact pickers (layer dots) */
.layer-color-popover.no-recents .nw-color-recents-title,
.layer-color-popover.no-recents .nw-color-recents { display: none; }
.layer-color-swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.layer-color-swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.22); cursor: pointer; background: transparent; }
.layer-color-swatch:hover { border-color: rgba(255,255,255,0.6); }
.layer-color-swatch.transparent { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.14) 0, rgba(255,255,255,0.14) 3px, rgba(0,0,0,0.0) 3px, rgba(0,0,0,0.0) 6px); }
.layer-color-actions { display: flex; gap: 8px; margin-top: 10px; }
.layer-color-actions .btn { padding: 8px 10px; font-size: 12px; border-radius: var(--radius-sm); }

/* Dropdowns */
.dropdown { position: relative; }
.dropdown-trigger { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--bg-tertiary); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; }
.dropdown-menu { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-tertiary); border-radius: var(--radius-sm); margin-top: 4px; max-height: 200px; overflow-y: auto; z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.dropdown-item:hover { background: var(--bg-modifier-hover); }

/* Effect card */
.effect-card { background: var(--bg-tertiary); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.effect-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.effect-name { font-size: 14px; font-weight: 500; }
.gradient-preview { height: 24px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.gradient-stops { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 8px; }
.gradient-stop { position: relative; }
.gradient-stop label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 4px; }
.gradient-remove-btn { position: absolute; top: 12px; right: -6px; width: 18px; height: 18px; background: var(--red); border: 2px solid var(--bg-primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 10px; color: white; font-weight: bold; opacity: 0; transition: opacity 0.2s; z-index: 10; }
.gradient-stop:hover .gradient-remove-btn { opacity: 1; }
.gradient-remove-btn:hover { background: #dc2626; }

/* Toast notifications */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--bg-tertiary); color: var(--text-normal); padding: 12px 24px; border-radius: var(--radius); font-size: 14px; transition: transform 0.3s; z-index: 1000; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }

.clear-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px 8px; }
.clear-btn:hover { color: var(--red); }

/* Key Picker (Wootility/VIA style) */
.remap-section { margin-top: 20px; background: var(--bg-secondary); border-radius: var(--radius); padding: 20px; display: block; }
.remap-section.active { display: block; }
.remap-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.remap-info { flex: 1; }
.remap-info h3 { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.remap-info p { color: var(--text-muted); font-size: 13px; }
.remap-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.preset-btn { padding: 8px 16px; background: var(--bg-tertiary); border: 1px solid var(--key-border); border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 4px; transition: all 0.15s; }
.preset-btn:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }
.preset-btn.active { border-color: var(--accent); color: var(--accent); }
.preset-icon { font-size: 18px; }
.key-picker-container { display: flex; gap: 20px; }
.key-search-box { flex: 1; }
.key-search-input { width: 100%; padding: 10px 12px; background: var(--bg-tertiary); border: 1px solid var(--key-border); border-radius: var(--radius-sm); color: var(--text-normal); font-size: 13px; margin-bottom: 12px; }
.key-search-input::placeholder { color: var(--text-muted); }
.key-category { margin-bottom: 16px; }
.key-category-header { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.key-category-header:hover { color: var(--text-normal); }
.key-category-header .arrow { transition: transform 0.2s; }
.key-category.collapsed .arrow { transform: rotate(-90deg); }
.key-category.collapsed .key-grid { display: none; }
.key-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.picker-key { min-width: 40px; height: 36px; padding: 4px 8px; background: var(--key-bg); border: 1px solid var(--key-border); border-radius: 4px; cursor: pointer; font-size: 11px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; transition: all 0.1s; }
.picker-key:hover { background: var(--key-bg-hover); color: var(--text-normal); }
.picker-key.selected { background: var(--accent); border-color: var(--accent); color: white; }

/* Key type-in input (for Mod-Tap/DKS) */
.key-typein-input { width: 100%; padding: 12px; background: var(--bg-primary); border: 2px solid var(--key-border); border-radius: var(--radius-sm); color: var(--text-normal); font-size: 14px; font-weight: 600; text-align: center; cursor: pointer; transition: all 0.15s; }
.key-typein-input:hover { border-color: var(--text-muted); }
.key-typein-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(0, 255, 200, 0.2); }
.key-typein-input.listening { border-color: var(--accent); background: rgba(0, 255, 200, 0.1); animation: pulse-border 1s infinite; }
@keyframes pulse-border { 0%, 100% { box-shadow: 0 0 0 3px rgba(0, 255, 200, 0.2); } 50% { box-shadow: 0 0 0 6px rgba(0, 255, 200, 0.4); } }
.key-typein-input::placeholder { color: var(--text-muted); font-weight: 400; }

/* Screen/GIF Upload Panel */
.gif-upload-section { background: var(--bg-secondary); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.gif-upload-title { font-size: 18px; font-weight: 700; color: var(--accent); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.upload-time-info { display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: help; transition: color 0.2s; position: relative; }
.upload-time-info:hover { color: var(--text); }
.upload-time-info:hover::after { 
  content: attr(data-tooltip);
  position: absolute;
  top: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  white-space: pre-line;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  width: 200px;
  text-align: center;
}
.upload-time-info svg { width: 20px; height: 20px; flex-shrink: 0; }

/* Info tooltip (reusable) */
.info-tooltip { display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: help; transition: color 0.2s; position: relative; margin-left: 8px; }
.info-tooltip:hover { color: var(--text); }
.info-tooltip:hover::after { 
  content: attr(data-tooltip);
  position: absolute;
  top: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  white-space: normal;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  width: 180px;
  text-align: center;
  line-height: 1.4;
}
.info-tooltip svg { width: 14px; height: 14px; flex-shrink: 0; }

.gif-dropzone { border: 2px dashed var(--key-border); border-radius: var(--radius); padding: 40px; text-align: center; cursor: pointer; transition: all 0.2s; background: color-mix(in srgb, var(--bg-tertiary)50%,black); min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gif-dropzone:hover, .gif-dropzone.dragover { border-color: var(--accent); background: rgba(98, 0, 255, 0.05); }
.gif-dropzone input { display: none; }
.gif-select-btn { background: var(--accent); color: var(--bg-primary); padding: 12px 24px; border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer; border: none; margin-bottom: 12px; }
.gif-select-btn:hover { background: var(--accent-hover); }
.gif-preview { margin-top: 16px; }
.gif-preview img { max-width: 240px; max-height: 240px; border-radius: var(--radius); border: 2px solid var(--key-border); }
.gif-info { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.gif-actions { display: flex; gap: 16px; margin-top: 24px; }
.gif-action-card { flex: 1; background: var(--bg-tertiary); border: 1px solid var(--key-border); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer; transition: all 0.2s; }
.gif-action-card:hover { border-color: var(--text-muted); background: var(--bg-modifier-hover); }
.gif-action-card.disabled { opacity: 0.5; cursor: not-allowed; }
.gif-action-icon { font-size: 32px; margin-bottom: 8px; }
.gif-action-label { font-size: 14px; font-weight: 500; }
.upload-progress { margin-top: 16px; display: none; }
.upload-progress.active { display: block; }
.upload-progress-bar { height: 8px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: var(--accent); transition: width 0.3s; }
.upload-progress-text { font-size: 12px; color: var(--text-muted); margin-top: 8px; text-align: center; }

/* Debug console */
.debug-console { background: var(--bg-tertiary); border: 1px solid var(--key-border); border-radius: var(--radius); padding: 12px; height: 520px; overflow-y: auto; white-space: pre-wrap; font-size: 12px; line-height: 1.4; }
.debug-console .debug-line { color: var(--text-muted); }
.debug-console .debug-line.error { color: var(--red); }
.debug-console .debug-line.warn { color: var(--yellow); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, -48%); } to { opacity: 1; transform: translate(-50%, -50%); } }

/* Advanced Calibration Modal */
.adv-cal-key { position: relative; overflow: hidden; }
.adv-cal-cal-overlay { position: absolute; inset: 0; background: var(--green); opacity: 0.14; pointer-events: none; display: none; z-index: 0; }
.adv-cal-key.calibrated .adv-cal-cal-overlay { display: block; }
.adv-cal-depth-track { position: absolute; left: 0; right: 0; top: 0; bottom: 0; opacity: 0.35; pointer-events: none; z-index: 0; }
.adv-cal-depth-fill { position: absolute; left: 0; right: 0; top: 0; height: 0%; background: var(--accent); transition: height 0.05s linear; }
.adv-cal-key.calibrated .adv-cal-depth-fill { background: var(--green); }
.adv-cal-key .adv-cal-check { position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; opacity: 0.95; pointer-events: none; display: none; }
.adv-cal-key.calibrated .adv-cal-check { display: block; }
.adv-cal-key .adv-cal-check { z-index: 2; }
.adv-cal-key > *:not(.adv-cal-depth-track):not(.adv-cal-cal-overlay):not(.adv-cal-check) { position: relative; z-index: 1; }

.adv-cal-icon-btn { width: 44px; height: 44px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,0.1); background: var(--bg-tertiary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.adv-cal-icon-btn:hover { background: var(--bg-modifier-hover); }
