/* Keying Meter */
.meter-container {
  position: relative;
  height: 42px;
  background: #0d0e12;
  border-radius: 8px;
  border: 1.5px solid #363a47;
  overflow: hidden;
  margin-bottom: 8px;
}

.meter-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00b4d8, #00e5ff);
  transition: width 0.03s linear;
}

.meter-bar.dah-active {
  background: linear-gradient(90deg, #d4af37, #ffb703);
}

.meter-ghost {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #ffffff;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 4;
  box-shadow: 0 0 6px #fff;
}

/* Threshold Markers */
.marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: rgba(255, 255, 255, 0.35);
  z-index: 3;
}

.marker-threshold {
  background: #ff5252;
  width: 2.5px;
}

.marker-label {
  position: absolute;
  bottom: 3px;
  font-size: 10px;
  font-weight: 600;
  color: #aaa;
  transform: translateX(-50%);
  pointer-events: none;
}

.meter-readout {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

.meter-readout strong {
  color: #fff;
}

.wpm-badge {
  background: #112233;
  color: var(--neon-blue);
  border: 1px solid #005b82;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: bold;
  font-family: monospace;
  letter-spacing: 0.5px;
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.2);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.wpm-badge.pulse {
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.6);
  border-color: var(--neon-blue);
  color: #fff;
}

/* Dual Meter Side-by-Side Grid */
.meter-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}

.meter-subtrack {
  display: flex;
  flex-direction: column;
}

.meter-subtrack .meter-container {
  height: 36px;
  margin-bottom: 4px;
}

.meter-subtrack .meter-readout {
  font-size: 0.72rem;
}

.meter-subtrack .meter-track-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 3px;
  min-height: 18px;
  line-height: 18px;
}

@media (max-width: 580px) {
  .meter-dual-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* Current State Display */
.state-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.85rem;
}

.state-item {
  background: #121318;
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--gold);
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.state-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.state-val {
  font-size: 1.15rem;
  font-weight: bold;
  color: #fff;
  font-family: monospace;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  text-overflow: clip;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.state-val::-webkit-scrollbar {
  display: none;
}

/* Interactive Big Key */
.key-button {
  width: 100%;
  height: 64px;
  background: linear-gradient(180deg, #2b2e38 0%, #1a1b22 100%);
  border: 2px solid var(--border-brass);
  border-radius: 12px;
  color: var(--gold-light);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.05s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  touch-action: none;
}

.key-button:active, .key-button.active {
  transform: translateY(2px) scale(0.98);
  background: linear-gradient(180deg, #443a1d 0%, #26200e 100%);
  border-color: var(--gold);
  box-shadow: 0 0 18px var(--gold-glow), inset 0 0 8px rgba(0, 229, 255, 0.4);
}

.key-button:active span i, .key-button.active span i {
  color: #fff;
  filter: drop-shadow(0 0 6px var(--cyan)) drop-shadow(0 0 12px var(--gold));
  animation: contact-spark 0.08s infinite alternate;
}

/* Keyer Device Switcher Tabs */
.keyer-device-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.keyer-tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #363a46;
  background: #15171e;
  color: #aaa;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  text-align: center;
  line-height: 1.25;
}

.keyer-tab.active {
  border-color: var(--gold);
  background: #2a2512;
  color: var(--gold-light);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
}

/* Dual Paddle Visual Deck */
.paddle-deck {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #0d0e12;
  border: 2px solid var(--border-brass);
  border-radius: 12px;
  padding: 10px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-user-select: none;
}

.paddle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  position: relative;
}

.paddle-lever {
  height: 80px;
  background: linear-gradient(180deg, #252830 0%, #15171d 100%);
  border: 2px solid #444b59;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  transition: all 0.05s ease;
  position: relative;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.paddle-lever:active, .paddle-lever.active {
  transform: translateY(2px);
  background: linear-gradient(180deg, #3d3419 0%, #1c1809 100%);
  border-color: var(--gold);
  box-shadow: 0 0 14px var(--gold-glow);
}

#paddle-left {
  transform-origin: center right;
}
#paddle-right {
  transform-origin: center left;
}
#paddle-left:active, #paddle-left.active {
  transform: translateY(2px) rotate(-1.5deg);
}
#paddle-right:active, #paddle-right.active {
  transform: translateY(2px) rotate(1.5deg);
}

.paddle-lever.active-dah {
  background: linear-gradient(180deg, #443216 0%, #201405 100%);
  border-color: #ffb703;
  box-shadow: 0 0 14px rgba(255, 183, 3, 0.5);
}

.paddle-name {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.paddle-key-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: monospace;
}

.paddle-led {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.62rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: #1d212a;
  border: 1px solid #363d4e;
  color: #555;
  font-family: monospace;
  transition: all 0.1s ease;
}

.paddle-led.latch-active {
  background: #382d0b;
  border-color: #ffd700;
  color: #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}

.squeeze-banner {
  font-size: 0.72rem;
  text-align: center;
  padding: 4px 8px;
  border-radius: 5px;
  background: #151820;
  border: 1px dashed #363a46;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.squeeze-banner.squeezing {
  background: #2b2207;
  border-color: var(--gold);
  color: var(--gold-light);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* Settings Controls */
.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 125px 48px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.settings-row label {
  color: #bbb;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-row label span {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-row input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
  margin: 0;
}

.settings-row .val-tag {
  font-family: monospace;
  color: var(--gold);
  width: 100%;
  text-align: right;
}

/* Preset Profiles Buttons */
.preset-btn {
  background: #14151c;
  border: 1.5px solid #363a46;
  border-radius: 7px;
  color: #e0e0e0;
  padding: 6px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  background: #1f222b;
  border-color: #666;
}

.preset-btn.active-preset {
  background: #2a2512 !important;
  border-color: var(--gold) !important;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

/* Key Profile Buttons */
.key-profile-btn {
  transition: all 0.15s ease;
}
.key-profile-btn:hover {
  border-color: #666 !important;
  background: #252834 !important;
}
.key-profile-btn.active-key-profile {
  border-color: var(--neon-blue) !important;
  background: #002b3d !important;
  color: #fff !important;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

.bind-btn {
  transition: all 0.15s ease;
}
.bind-btn:hover {
  filter: brightness(1.2);
}
.bind-btn.recording {
  border-color: #ff5252 !important;
  color: #ff5252 !important;
  background: #331214 !important;
  animation: kochTargetPulse 1s infinite alternate ease-in-out;
}

/* ==========================================================================
   Tactile UI Polish: Checkboxes & Toggle Switches
   ========================================================================== */

/* 1. Terminal Dark Checkbox */
.terminal-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #0b0e14;
  border: 1.5px solid #2e384d;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  outline: none;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
}

.terminal-checkbox:hover {
  border-color: #526385;
  box-shadow: 0 0 6px rgba(82, 99, 133, 0.3);
}

.terminal-checkbox:checked {
  background: #002b3d;
  border-color: var(--neon-blue);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.35);
}

.terminal-checkbox:checked::before {
  content: '';
  position: absolute;
  top: 1.5px;
  left: 4.5px;
  width: 4.5px;
  height: 8.5px;
  border: solid var(--neon-blue);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  box-shadow: 0 0 4px var(--neon-blue);
}

/* 2. Instrument Toggle Switches */
.switch-input {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 19px;
  background: #0d1017;
  border: 1.5px solid #283042;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.switch-input::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2.5px;
  width: 12px;
  height: 12px;
  background: #606b82;
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.switch-input:hover::before {
  background: #8e9bb3;
}

/* Neon Blue Switch Variant (Default / Farnsworth) */
.switch-input:checked,
.switch-input.switch-neon:checked {
  background: #002a3d;
  border-color: var(--neon-blue);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.3), inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.switch-input:checked::before,
.switch-input.switch-neon:checked::before {
  left: 16.5px;
  background: var(--neon-blue);
  box-shadow: 0 0 6px var(--neon-blue);
}

/* Gold Switch Variant (Paddle) */
.switch-input.switch-gold:checked {
  background: #2b2308;
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.3), inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.switch-input.switch-gold:checked::before {
  left: 16.5px;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}

/* Amber Switch Variant (QRN) */
.switch-input.switch-amber:checked {
  background: #2b1d04;
  border-color: #ffb703;
  box-shadow: 0 0 8px rgba(255, 183, 3, 0.3), inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.switch-input.switch-amber:checked::before {
  left: 16.5px;
  background: #ffb703;
  box-shadow: 0 0 6px #ffb703);
}

/* ==========================================================================
   Tactile UI Polish: Segmented Radio Pills
   ========================================================================== */
.radio-pill-group {
  display: inline-flex;
  align-items: center;
  background: #0b0e14;
  border: 1.5px solid #232a3a;
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.radio-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  font-size: 0.74rem;
  font-weight: 500;
  color: #838e9e;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
  white-space: nowrap;
  border: 1px solid transparent;
}

.radio-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.radio-pill:hover {
  color: #c0c9d6;
  background: rgba(255, 255, 255, 0.04);
}

/* Neon Blue Checked (Default) */
.radio-pill:has(input[type="radio"]:checked),
.radio-pill.radio-pill-neon:has(input[type="radio"]:checked) {
  background: #0f2434;
  color: var(--neon-blue);
  border-color: #006088;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.25);
  font-weight: bold;
}

/* Red / Danger Variant (Challenge Koch) */
.radio-pill-danger:has(input[type="radio"]:checked) {
  background: #2b1114;
  color: #ff5252;
  border-color: #822228;
  box-shadow: 0 0 8px rgba(255, 82, 82, 0.25);
  font-weight: bold;
}

/* Gold / Amber Variant (Paddle Mode) */
.radio-pill-gold:has(input[type="radio"]:checked) {
  background: #261f0b;
  color: var(--gold);
  border-color: #735d17;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.25);
  font-weight: bold;
}

/* ==========================================================================
   Tactile UI Polish: Terminal Select Dropdown
   ========================================================================== */
.terminal-select {
  appearance: none;
  -webkit-appearance: none;
  background: #0d1219 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2300e5ff' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 6px center;
  color: #e0f2fe;
  border: 1.5px solid #233145;
  border-radius: 5px;
  font-size: 0.72rem;
  font-family: inherit;
  padding: 3px 22px 3px 7px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.terminal-select:hover {
  border-color: #3b506f;
  background-color: #121822;
}

.terminal-select:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.3), inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.terminal-select option {
  background: #0b1017;
  color: #e0e6ed;
  padding: 4px 8px;
}

/* ==========================================================================
   Tactile UI Polish: Precision Console Sliders (Eurorack Faders)
   ========================================================================== */
.settings-row input[type="range"],
input[type="range"].console-slider {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  height: 22px;
  margin: 0;
  vertical-align: middle;
}

/* WebKit Track */
.settings-row input[type="range"]::-webkit-slider-runnable-track,
input[type="range"].console-slider::-webkit-slider-runnable-track {
  height: 6px;
  background: #090c12;
  border: 1px solid #212735;
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
  transition: all 0.2s ease;
}

/* WebKit Thumb (Gold Default) */
.settings-row input[type="range"]::-webkit-slider-thumb,
input[type="range"].console-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 18px;
  margin-top: -6px;
  background: linear-gradient(180deg, #444c5e 0%, #202531 60%, #151821 100%);
  border: 1.5px solid var(--gold);
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8), 0 0 6px rgba(212, 175, 55, 0.25);
  cursor: ew-resize;
  position: relative;
  transition: all 0.15s ease;
}

.settings-row input[type="range"]::-webkit-slider-thumb:hover,
input[type="range"].console-slider::-webkit-slider-thumb:hover {
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.6), 0 2px 5px rgba(0, 0, 0, 0.9);
  transform: scaleY(1.08);
}

.settings-row input[type="range"]:active::-webkit-slider-thumb,
input[type="range"].console-slider:active::-webkit-slider-thumb {
  background: linear-gradient(180deg, #ffd700 0%, #d4af37 100%);
  border-color: #fff;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
}

/* Neon-Blue Slider Thumb (Farnsworth WPM) */
input[type="range"].slider-neon-blue::-webkit-slider-thumb {
  border-color: var(--neon-blue);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8), 0 0 6px rgba(0, 229, 255, 0.3);
}

input[type="range"].slider-neon-blue::-webkit-slider-thumb:hover {
  border-color: #70f3ff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.7);
  transform: scaleY(1.08);
}

input[type="range"].slider-neon-blue:active::-webkit-slider-thumb {
  background: linear-gradient(180deg, #00e5ff 0%, #0077b6 100%);
  border-color: #fff;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.9);
}

/* Amber Slider Thumb (QRN Volume) */
input[type="range"].slider-amber::-webkit-slider-thumb {
  border-color: #ffb703;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8), 0 0 6px rgba(255, 183, 3, 0.3);
}

input[type="range"].slider-amber::-webkit-slider-thumb:hover {
  border-color: #ffe169;
  box-shadow: 0 0 10px rgba(255, 183, 3, 0.7);
  transform: scaleY(1.08);
}

input[type="range"].slider-amber:active::-webkit-slider-thumb {
  background: linear-gradient(180deg, #ffb703 0%, #fb8500 100%);
  border-color: #fff;
  box-shadow: 0 0 14px rgba(255, 183, 3, 0.9);
}

/* Firefox Support */
.settings-row input[type="range"]::-moz-range-track,
input[type="range"].console-slider::-moz-range-track {
  height: 6px;
  background: #090c12;
  border: 1px solid #212735;
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
}

.settings-row input[type="range"]::-moz-range-thumb,
input[type="range"].console-slider::-moz-range-thumb {
  width: 14px;
  height: 18px;
  background: linear-gradient(180deg, #444c5e 0%, #202531 60%, #151821 100%);
  border: 1.5px solid var(--gold);
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8), 0 0 6px rgba(212, 175, 55, 0.25);
  cursor: ew-resize;
}

/* ==========================================================================
   Tactile UI Polish: Terminal Text Input
   ========================================================================== */
.terminal-input {
  flex: 1;
  background: #090c12;
  border: 1.5px solid #283042;
  border-radius: 6px;
  color: #f0f6fc;
  padding: 8px 12px;
  font-size: 0.86rem;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  outline: none;
  transition: all 0.25s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.terminal-input::placeholder {
  color: #536279;
  font-style: italic;
  letter-spacing: 0.5px;
}

.terminal-input:hover {
  border-color: #3b4863;
}

.terminal-input:focus {
  border-color: var(--neon-blue);
  background: #0c1119;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.25), inset 0 1px 3px rgba(0, 0, 0, 0.6);
  color: #ffffff;
}
