/* ============================================================================
   Neura Gesture — Premium Glassmorphism Dark UI with Neon Glass Effects
   by Neura Innovation | Innovate, Integrate, & Elevate Your Future
   ============================================================================ */

/* ─── Google Fonts Import ─── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ─── Design Tokens ─── */
:root {
  /* Core palette */
  --bg-deep: #05060a;
  --bg: #0a0c14;
  --surface: rgba(14, 17, 30, 0.65);
  --surface-solid: #0e111e;
  --raised: rgba(20, 24, 42, 0.6);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.07);

  /* Neon accents */
  --neon-cyan: #00f0ff;
  --neon-blue: #3b82f6;
  --neon-purple: #a855f7;
  --neon-pink: #ec4899;
  --neon-green: #00ff88;
  --neon-orange: #f59e0b;

  /* LED colors */
  --led-on: #00ff88;
  --led-on-line: #33ffaa;
  --led-off: rgba(255, 255, 255, 0.04);
  --led-glow: rgba(0, 255, 136, 0.3);

  /* Semantic */
  --ok: #00ff88;
  --bad: #ff4466;
  --warning: #f59e0b;

  /* Text */
  --text: #eef0f6;
  --text-secondary: #a0a8c0;
  --muted: #6b7394;
  --dim: #4a5072;

  /* Borders & lines */
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, #00f0ff 0%, #3b82f6 50%, #a855f7 100%);
  --gradient-glow: linear-gradient(135deg, rgba(0, 240, 255, 0.15) 0%, rgba(59, 130, 246, 0.1) 50%, rgba(168, 85, 247, 0.15) 100%);
  --gradient-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);

  /* Focus ring */
  --focus: #00f0ff;

  /* Typography */
  --sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

/* ─── Reset ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}

/* Animated mesh background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: 
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(0, 240, 255, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(168, 85, 247, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 50% 50%, rgba(59, 130, 246, 0.03) 0%, transparent 70%);
  animation: meshShift 20s ease-in-out infinite alternate;
}

@keyframes meshShift {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

/* Subtle grid overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ─── Utility Classes ─── */
.svg-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.svg-icon-lg {
  width: 30px;
  height: 30px;
}

/* ─── Glass Card Mixin ─── */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-surface);
  pointer-events: none;
  z-index: 0;
}

/* ─── App Container ─── */
.app-container {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ─── */
.app-header {
  height: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: rgba(10, 12, 20, 0.75);
  backdrop-filter: blur(30px) saturate(1.4);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
  position: relative;
  z-index: 50;
}

/* Neon line under header */
.app-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient-brand);
  opacity: 0.4;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo-unit {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--raised);
  border: 1px solid var(--glass-border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
  position: relative;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
  transition: box-shadow 0.3s ease;
}

.brand-logo-unit:hover {
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.2);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-meta {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.brand-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.15);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

/* ─── Header Actions ─── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-flasher-custom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: var(--radius-sm);
  color: var(--neon-cyan);
  font: 600 12px var(--sans);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.btn-flasher-custom:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.3);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
  color: #fff;
}

.btn-flasher-custom .svg-icon {
  color: var(--neon-cyan);
  filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.5));
}

.btn-serial {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  background: var(--gradient-brand);
  border: 0;
  border-radius: var(--radius-sm);
  color: #fff;
  font: 600 12px var(--sans);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.btn-serial::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.btn-serial:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(0, 240, 255, 0.25), 0 0 40px rgba(59, 130, 246, 0.15);
}

.btn-serial.connected {
  background: transparent;
  color: var(--ok);
  box-shadow: inset 0 0 0 1.5px var(--ok), 0 0 20px rgba(0, 255, 136, 0.1);
}

.btn-serial.connected::before {
  display: none;
}

/* ─── Status Bar ─── */
.status-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 8px rgba(255, 68, 102, 0.4);
  animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.connected {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  font-size: 12px;
  font-weight: 500;
}

.status-baud {
  font-size: 11px;
  color: var(--muted);
  padding-left: 8px;
  border-left: 1px solid var(--glass-border);
  font-family: var(--mono);
}

/* ─── Workspace Grid ─── */
.workspace-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

/* ─── Camera Panel ─── */
.card-panel {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.card-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-surface);
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

.camera-panel {
  display: flex;
}

.viewport-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  background: rgba(5, 6, 10, 0.8);
  overflow: hidden;
  border-radius: inherit;
}

#webcamVideo {
  display: none;
}

#outputCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  border-radius: inherit;
}

.panel-tag,
.meta-fps {
  position: absolute;
  z-index: 5;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: rgba(10, 12, 20, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  padding: 5px 14px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.panel-tag {
  top: 16px;
  left: 16px;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.08);
}

.meta-fps {
  bottom: 16px;
  left: 16px;
  color: var(--neon-cyan);
  font-family: var(--mono);
  font-size: 10px;
}

/* ─── Camera Fallback ─── */
.viewport-fallback {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 20, 0.9);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
  z-index: 10;
}

.viewport-fallback.hidden {
  display: none;
}

.fallback-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.12);
  display: grid;
  place-items: center;
  color: var(--neon-cyan);
}

.fallback-heading {
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.fallback-text {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 380px;
  line-height: 1.6;
}

.btn-solid-primary {
  height: 42px;
  padding: 0 24px;
  background: var(--gradient-brand);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  font: 600 13px var(--sans);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-solid-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  pointer-events: none;
}

.btn-solid-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(0, 240, 255, 0.3);
}

/* ─── Side Column ─── */
.side-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

/* ─── Mode Tabs ─── */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 5px;
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  position: relative;
}

.mode-tabs::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-surface);
  pointer-events: none;
  border-radius: inherit;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  font: 500 11px var(--sans);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
  letter-spacing: 0.02em;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--glass-hover);
}

.tab-btn.active {
  background: rgba(0, 240, 255, 0.06);
  color: var(--text);
  border-color: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.06);
}

.tab-btn.active .svg-icon {
  color: var(--neon-cyan);
  filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.4));
}

.tab-index {
  display: none;
}

/* ─── Panel Body ─── */
.panel-body {
  flex: 1;
  min-height: 0;
  padding: 0;
  background: none;
  border: 0;
  display: flex;
  flex-direction: column;
}

/* ─── Mode Panes ─── */
.mode-pane {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.mode-pane::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-surface);
  pointer-events: none;
  border-radius: inherit;
  z-index: 0;
}

.mode-pane > * {
  position: relative;
  z-index: 1;
}

.mode-pane.active {
  display: flex;
}

/* ─── Instruction Box ─── */
.instruction-box {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.65;
  padding: 12px 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  border-left: 3px solid rgba(0, 240, 255, 0.3);
}

/* ─── Telemetry ─── */
.telemetry-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.telemetry-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Mode 1: Palm State ─── */
.state-pill,
.metric-pill {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--muted);
  text-transform: lowercase;
}

.state-pill::first-letter,
.metric-pill::first-letter {
  text-transform: uppercase;
}

.state-pill.open,
.metric-pill.open {
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.state-pill.closed,
.metric-pill.closed {
  color: var(--text);
}

/* ─── Mode 2: Dimmer ─── */
.dimmer-metric-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.dimmer-metric-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--mono);
}

.flat-bar-rail {
  height: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  overflow: hidden;
}

.flat-bar-fill {
  height: 100%;
  width: 0;
  background: var(--gradient-brand);
  border-radius: 6px;
  transition: width 40ms linear;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

.telemetry-sub {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.sub-mono {
  color: var(--neon-cyan);
  font-weight: 600;
  font-family: var(--mono);
}

/* ─── Mode 3: Counter & Stage Meter ─── */
.counter-stage-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.counter-val-group {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-shrink: 0;
}

.counter-box {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-variant-numeric: tabular-nums;
}

.counter-max {
  font-size: 16px;
  font-weight: 600;
  color: var(--dim);
}

.counter-meter-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.meter-status {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 60ms ease;
}

.counter-stages {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.stage-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 2px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  transition: all 0.15s ease;
}

.stage-seg.active {
  background: rgba(0, 255, 136, 0.08);
  border-color: rgba(0, 255, 136, 0.3);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.1);
}

.stage-seg.active .seg-num {
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.seg-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--dim);
  line-height: 1;
}

.seg-pin {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--dim);
  margin-top: 1px;
}

.stage-seg.active .seg-pin {
  color: var(--text-secondary);
}

/* ─── Finger Chips ─── */
.finger-chips-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.finger-chip-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.finger-chip-unit.extended {
  border-color: rgba(0, 255, 136, 0.3);
  background: rgba(0, 255, 136, 0.06);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.08);
}

.chip-name {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}

.chip-val,
.finger-state {
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  font-family: var(--mono);
}

.finger-chip-unit.extended .finger-state {
  color: var(--neon-green);
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.4);
}

/* ─── Live Hardware Channel Matrix ─── */
.matrix-card {
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  overflow: hidden;
  flex: 1;
  min-height: 200px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.matrix-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.matrix-card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
}

.matrix-card-badge {
  font-size: 9px;
  font-weight: 600;
  color: var(--neon-cyan);
  font-family: var(--mono);
  background: rgba(0, 240, 255, 0.06);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid rgba(0, 240, 255, 0.1);
  letter-spacing: 0.03em;
}

.matrix-channels {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.channel-row {
  display: grid;
  grid-template-columns: 58px 46px 1fr 64px;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  flex: 1;
  transition: all 0.15s ease;
}

.channel-row:last-child {
  border-bottom: none;
}

.channel-pin {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--glass);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
  text-align: center;
}

.channel-meta {
  font-size: 10px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.channel-rail {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
}

.channel-fill {
  width: 0%;
  height: 100%;
  background: var(--gradient-brand);
  border-radius: 3px;
  transition: width 60ms ease;
}

.channel-state {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-align: right;
  color: var(--dim);
}

.channel-row.active .channel-state {
  color: var(--neon-green);
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.3);
}

.channel-row.active {
  background: rgba(0, 255, 136, 0.02);
}

.channel-row.active .channel-fill {
  background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan));
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

/* ─── Command Outbox ─── */
.command-outbox {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--glass-border);
}

.outbox-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.outbox-label .svg-icon {
  display: none;
}

.outbox-code {
  font: 600 11px var(--mono);
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.12);
  padding: 5px 12px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

/* ─── Footer ─── */
.app-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--dim);
  padding: 0 4px 2px;
}

.footer-link {
  color: var(--neon-cyan);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.footer-link:hover {
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

/* ─── LED Grid (legacy, kept for JS compat) ─── */
.hardware-strip-box {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-shrink: 0;
}

.strip-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.strip-title {
  font-size: 13px;
  font-weight: 600;
}

.strip-pins {
  font-size: 12px;
  color: var(--dim);
}

.led-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.led-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.led-node {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--led-off);
  border: 1px solid var(--glass-border);
  transition: all 0.15s ease;
}

.led-node.active {
  background: var(--led-on);
  border-color: var(--led-on-line);
  box-shadow: 0 0 20px var(--led-glow), 0 0 40px rgba(0, 255, 136, 0.15);
}

.led-id {
  font-size: 11px;
  color: var(--dim);
}

/* ─── ESP Flasher Modal Wi-Fi Removal ─── */
.__efb-succ-btn-wifi,
#__efb-succ-open-wifi,
.__efb-wifi-card,
.__efb-wifi-header,
.__efb-wifi-form,
.__efb-wifi-btns,
.__efb-wifi-status {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.__efb-succ-actions {
  display: flex !important;
}

.__efb-succ-btn-serial {
  flex: 1 1 100% !important;
  width: 100% !important;
}

/* ─── Responsive ─── */
@media (max-width: 960px), (max-height: 640px) {
  html, body {
    overflow: auto;
  }

  .app-container {
    height: auto;
    min-height: 100dvh;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .camera-panel {
    aspect-ratio: 4/3;
  }

  .brand-sub {
    display: none;
  }

  .app-header {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .mode-tabs {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ─── Scrollbar Styling ─── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}