/* Gyronics Codex — Unified Obsidian Kinetic Design System (100% Offline) */
@import url('vendor/fonts/fonts.css');
@import url('vendor/icons/material-symbols.css');

:root {
  --bg-base: #090D12;
  --bg-surface: #101720;
  --bg-surface-elevated: #141A22;
  --bg-surface-high: #1E293B;
  --bg-surface-highest: #283548;
  --bg-surface-lowest: #06080B;
  
  --border-subtle: #1E293B;
  --border-strong: #334155;
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --primary: #00E676;
  --primary-hover: #10B981;
  --primary-glow: rgba(0, 230, 118, 0.25);
  --primary-subtle: rgba(0, 230, 118, 0.12);
  --on-primary: #041B0F;
  
  --cyan: #00E5FF;
  --cyan-subtle: rgba(0, 229, 255, 0.12);
  
  --warning: #F59E0B;
  --error: #FF6B6B;
  --error-subtle: rgba(255, 107, 107, 0.15);
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  --font-headline: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

:root[data-theme="light"],
html.light,
body.light {
  --bg-base: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F1F5F9;
  --bg-surface-high: #E2E8F0;
  --bg-surface-highest: #CBD5E1;
  --bg-surface-lowest: #F8FAFC;
  
  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;
  
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  
  --primary: #059669;
  --primary-hover: #10B981;
  --primary-glow: rgba(5, 150, 105, 0.25);
  --primary-subtle: rgba(5, 150, 105, 0.12);
  --on-primary: #FFFFFF;
  
  --cyan: #0284C7;
  --cyan-subtle: rgba(2, 132, 199, 0.12);
}

html.light .nav-header {
  background: rgba(248, 250, 252, 0.94);
  border-bottom: 1px solid var(--border-subtle);
}

/* --- Light Mode Terminal Panel & Tab Adaptation --- */
html.light .terminal-toggle-btn {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
html.light .terminal-toggle-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
html.light .terminal-toggle-btn.active {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary);
}

html.light .terminal-drawer {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

html.light .terminal-header {
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

html.light .terminal-title-text {
  color: var(--text-primary);
}

html.light .badge-live {
  background: rgba(5, 150, 105, 0.12);
  color: #059669;
  border-color: rgba(5, 150, 105, 0.3);
}

html.light .term-btn {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
html.light .term-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
html.light .term-btn.active {
  color: var(--primary);
  border-color: rgba(5, 150, 105, 0.4);
  background: rgba(5, 150, 105, 0.12);
}
html.light .term-btn.paused {
  color: #D97706;
  border-color: rgba(217, 119, 6, 0.4);
  background: rgba(217, 119, 6, 0.12);
}

html.light .terminal-tabs {
  background: var(--bg-surface-high);
  border-color: var(--border-subtle);
}
html.light .term-tab-btn {
  color: var(--text-muted);
}
html.light .term-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}
html.light .term-tab-btn.active {
  color: var(--primary);
  background: var(--bg-surface);
  border-color: var(--border-strong);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

html.light .terminal-output {
  background: #F8FAFC;
  color: #1E293B;
  border-top: 1px solid var(--border-subtle);
}
html.light .terminal-output::-webkit-scrollbar-thumb {
  background: #CBD5E1;
}

html.light .term-line {
  color: #1E293B;
}
html.light .term-line-time {
  color: #64748B;
}
html.light .term-line-gesture {
  color: #0284C7;
}
html.light .term-line-success {
  color: #059669;
}
html.light .term-line-warn {
  color: #D97706;
}

html.light .term-fg-red { color: #DC2626; font-weight: 600; }
html.light .term-fg-green { color: #059669; font-weight: 600; }
html.light .term-fg-yellow { color: #D97706; font-weight: 600; }
html.light .term-fg-blue { color: #2563EB; font-weight: 600; }
html.light .term-fg-magenta { color: #9333EA; font-weight: 600; }
html.light .term-fg-cyan { color: #0284C7; font-weight: 600; }
html.light .term-fg-white { color: #0F172A; font-weight: 600; }
html.light .term-fg-gray { color: #64748B; font-weight: 500; }

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

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.icon-fill {
  font-variation-settings: 'FILL' 1;
}

.main-container {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 1720px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 24px 40px;
  gap: 20px;
  box-sizing: border-box;
}

.content-wrapper {
  flex: 1;
  min-width: 0;
  max-width: 1060px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: max-width 0.25s ease;
}

.main-container.terminal-collapsed .content-wrapper {
  max-width: 1300px;
}

/* --- Top Navigation Bar & Stepper --- */
.nav-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 13, 18, 0.92);
  backdrop-filter: blur(12px);
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.nav-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--primary);
}

.brand-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.nav-right-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--primary);
}

.ping-container {
  position: relative;
  width: 8px;
  height: 8px;
}

.ping-ring {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: var(--primary);
  opacity: 0.75;
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.ping-dot {
  position: relative;
  display: block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--primary);
}

@keyframes ping {
  75%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Screen Navigation Tabs (Single Line Responsive) */
.screen-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface-lowest);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  width: 100%;
}

.screen-tab-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-family: var(--font-headline);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.screen-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.screen-tab-btn.active {
  background: var(--bg-surface-high);
  color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.screen-tab-btn .tab-num {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
}

.screen-tab-btn.active .tab-num {
  background: var(--primary-subtle);
  color: var(--primary);
}

/* Screen Container Switcher */
.app-screen {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.25s ease-out;
}

.app-screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Common Screen Header */
.screen-intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.screen-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.screen-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===================================================
   SCREEN 1: CONNECT & DISCOVERY
   =================================================== */
.hero-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--bg-surface-elevated) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.hero-media {
  flex-shrink: 0;
}

.hero-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-glyph {
  color: var(--primary);
  font-size: 26px;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-icon {
  font-size: 16px;
  color: var(--primary);
}

.status-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.hero-description {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Transport Segmented Control */
.connection-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tab-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-surface-lowest);
  padding: 4px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-lg);
  font-family: var(--font-headline);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-surface-high);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.tab-btn.tab-locked {
  opacity: 0.35;
  cursor: not-allowed;
}

.tab-btn.tab-locked:hover {
  background: transparent;
  color: var(--text-secondary);
}

.tab-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 700;
}

.mode-caption {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.caption-icon {
  font-size: 16px;
  color: var(--primary);
  margin-top: 1px;
}

.caption-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Device Card */
.discovered-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-heading {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.device-count-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--primary);
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: var(--bg-surface-high);
  color: var(--text-primary);
}

.device-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.2s ease;
  overflow: hidden;
}

.primary-card {
  border-color: rgba(0, 230, 118, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px var(--primary-subtle);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.device-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.device-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.device-desc {
  font-size: 11px;
  color: var(--text-secondary);
}

.port-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  color: var(--primary);
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.telemetry-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.telemetry-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.battery-readout {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
  flex-wrap: wrap;
}

.battery-readout .material-symbols-outlined {
  font-size: 16px;
  transition: all 0.2s ease;
}

.battery-status-tag {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.4);
}

.battery-readout.battery-level-high {
  color: var(--primary);
}

.battery-readout.battery-level-medium {
  color: #fbbf24;
}

.battery-readout.battery-level-low {
  color: var(--error);
}

.battery-readout.battery-level-low .material-symbols-outlined {
  animation: pulse-dot 1.5s infinite;
}

.battery-readout.battery-level-charging {
  color: var(--cyan);
}

.stream-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.stream-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot-active {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.stream-text {
  font-size: 11px;
  color: var(--text-secondary);
}

.stream-rate {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--primary-subtle);
  color: var(--primary);
}

/* Live IMU Angles HUD Panel */
.live-telemetry-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
}

.telemetry-stream-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.angles-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.angle-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

/* Primary Action Connect Button */
.connect-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--primary);
  border: none;
  color: var(--on-primary);
  font-family: var(--font-headline);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 20px var(--primary-glow);
}

.connect-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.connect-btn.connected {
  background: var(--bg-surface-high);
  color: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: 0 0 15px var(--primary-subtle);
}

.connect-btn.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid #fbbf24;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
  cursor: wait;
}

.connect-btn.failed {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error, #ef4444);
  border: 1px solid var(--error, #ef4444);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.25);
}

/* Device Picker Bar */
.device-picker-bar {
  margin-bottom: 12px;
}
.device-picker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: border-color 0.2s ease;
}
.device-picker-wrap:focus-within {
  border-color: var(--cyan);
}
.device-picker-wrap .picker-icon {
  color: var(--cyan);
  font-size: 18px;
}
.device-picker-select {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-headline);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.device-picker-select option {
  background: var(--bg-surface-high);
  color: var(--text-primary);
}
.refresh-btn.scanning .refresh-icon {
  animation: spin 1s linear infinite;
}

/* Manager Daemon Restart / Re-scan Alert Card */
.daemon-rescan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.25);
}

.daemon-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.daemon-icon {
  font-size: 20px;
  color: var(--cyan);
}

.daemon-text-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.daemon-text-desc {
  font-size: 11px;
  color: var(--text-secondary);
}

.btn-restart-manager {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-restart-manager:hover {
  background: rgba(0, 229, 255, 0.25);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

/* ===================================================
   SCREEN 2: NEUTRAL REST CALIBRATION
   =================================================== */
.calibration-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.biomechanical-visual {
  position: relative;
  width: 100%;
  height: 140px;
  background: #0B1017;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.biomechanical-grid {
  position: absolute;
  inset: 0;
  opacity: 0.3;
}

.posture-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-md);
  background: rgba(10, 16, 23, 0.85);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--primary);
  font-weight: 600;
}

.node-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
}

/* Radial Progress & Hold Gauge */
.gauge-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.gauge-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-bg-ring {
  fill: none;
  stroke: var(--bg-surface-high);
  stroke-width: 8;
}

.gauge-progress-ring {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 314.159;
  stroke-dashoffset: 314.159;
  transition: stroke-dashoffset 0.1s linear;
  filter: drop-shadow(0 0 6px var(--primary));
}

.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-val {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.gauge-hint {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--primary);
  text-transform: uppercase;
  margin-top: 4px;
}

/* Screen 2: Unified Side-by-Side Calibration Hub */
.cal-main-split {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 860px) {
  .cal-main-split {
    grid-template-columns: 1fr;
  }
}

.cal-left-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-left-panel .gauge-section {
  padding: 12px;
  flex: 0 0 auto;
}

.cal-left-panel .gauge-wrap {
  width: 120px;
  height: 120px;
}

.cal-left-panel .gauge-val {
  font-size: 28px;
}

.cal-angles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 6px;
}

/* 3D Real-Time Orientation Tracker */
.calibrate-3d-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
  height: 100%;
}

.calibrate-3d-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.viewport-controls-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stl-picker {
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.stl-picker:focus {
  border-color: var(--cyan);
}

.load-stl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--cyan);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.load-stl-btn:hover {
  background: rgba(0, 229, 255, 0.2);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.viewport-3d-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 290px;
  height: 320px;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at center, #10141d 0%, #08090d 100%);
  border: 1px solid rgba(0, 229, 255, 0.15);
  overflow: hidden;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.6);
}

.three-canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  cursor: grab;
}

.three-canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.three-canvas-container:active {
  cursor: grabbing;
}

.viewport-hud-angles {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  pointer-events: none;
  z-index: 10;
}

.angle-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(8, 10, 14, 0.85);
  backdrop-filter: blur(8px);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 229, 255, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hud-reset-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(16, 20, 28, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
}

.hud-reset-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Tolerance & Deadzone Slider */
.deadzone-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.deadzone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tolerance-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-md);
  background: var(--primary-subtle);
  border: 1px solid rgba(0, 230, 118, 0.4);
  color: var(--primary);
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.range-slider {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-high);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-surface-lowest);
  box-shadow: 0 0 10px var(--primary);
  cursor: pointer;
}

.slider-presets {
  display: flex;
  justify-content: space-between;
}

.preset-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.preset-btn:hover {
  color: var(--primary);
}

.btn-action-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--primary);
  border: none;
  color: var(--on-primary);
  font-family: var(--font-headline);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 20px var(--primary-glow);
}

.btn-action-primary:hover {
  background: var(--primary-hover);
}

.btn-action-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface-high);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-secondary:hover {
  background: var(--bg-surface-highest);
  color: var(--text-primary);
}

/* ===================================================
   SCREEN 3: GESTURE CUSTOMIZER & HUD
   =================================================== */
.gesture-profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.profile-select-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-dropdown {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-headline);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
}

.gestures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 10px;
}

.gesture-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.gesture-card.active-trigger {
  border-color: var(--primary);
  background: rgba(0, 230, 118, 0.12);
  box-shadow: 0 0 16px var(--primary-glow);
  transform: translateX(4px);
}

.gesture-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gesture-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.gesture-info-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gesture-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.gesture-description {
  font-size: 11px;
  color: var(--text-muted);
}

.gesture-keys {
  display: flex;
  align-items: center;
  gap: 6px;
}

.key-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-highest);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.key-map-input {
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
  width: 90px;
  outline: none;
  transition: all 0.2s ease;
  letter-spacing: 0.04em;
}

.key-map-input:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-elevated);
}

.key-map-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-subtle);
  background: var(--bg-surface-elevated);
  color: #FFFFFF;
}

/* Interactive Gaming/Desktop Keybinder Button */
.key-bind-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  max-width: 140px;
  padding: 6px 10px;
  background: linear-gradient(180deg, rgba(28, 32, 42, 0.8) 0%, rgba(18, 21, 28, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.key-bind-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.key-bind-btn:active {
  transform: translateY(1px);
  border-bottom-width: 1px;
}

.key-bind-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.key-bind-btn.recording {
  background: rgba(0, 229, 255, 0.15) !important;
  border-color: var(--cyan) !important;
  border-bottom-width: 2px !important;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.5) !important;
  animation: keybindPulse 1.2s infinite ease-in-out;
}

.key-bind-btn.recording .key-bind-label {
  color: #fff !important;
  font-style: italic;
}

@keyframes keybindPulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
    border-color: var(--cyan);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.7);
    border-color: #ffffff;
  }
}

/* ===================================================
   SCREEN 4: RAG-DOLL PHYSICS SANDBOX
   =================================================== */
.sandbox-viewport-card {
  position: relative;
  width: 100%;
  height: 420px;
  background: radial-gradient(circle at center, #101924 0%, #06090D 100%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(0, 230, 118, 0.3);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.7), inset 0 0 20px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sandbox-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Sandbox HUD Floating Controls */
.sandbox-hud-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.sandbox-hud-pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(6, 8, 11, 0.85);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--primary);
  font-weight: 600;
}

.sandbox-hud-bottom {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.hud-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: rgba(16, 23, 32, 0.9);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.hud-btn:hover {
  background: var(--bg-surface-high);
  border-color: var(--primary);
  color: var(--primary);
}

/* Kinetic Velocity & Dual Barrier HUD */
.kinetic-status-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.barrier-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
}

.barrier-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.barrier-title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.barrier-val-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.barrier-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.barrier-status {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.barrier-slider-row {
  margin: 4px 0 2px;
}

.barrier-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.barrier-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  min-width: 54px;
  text-align: center;
}

.barrier-subnote {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Styled Range Sliders */
.styled-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-high);
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-glow);
  transition: transform 0.15s ease;
}

.styled-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ===================================================
   SCREEN 5: SYSTEM & HARDWARE SETTINGS
   =================================================== */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  gap: 12px;
}

.setting-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.setting-slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.setting-value-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  min-width: 65px;
  text-align: center;
}

.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.config-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-input {
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
}

.field-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-subtle);
}

/* Pitch Deck Presentation Mode Floating Banner */
.pitch-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid var(--primary);
  box-shadow: 0 0 15px var(--primary-subtle);
}

.pitch-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pitch-icon {
  font-size: 20px;
  color: var(--primary);
}

.pitch-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.pitch-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.hidden {
  opacity: 0;
  transform: translate(-50%, 20px);
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* Utility Scrollbar Hide */
::-webkit-scrollbar {
  display: none;
}

/* Embedded Terminal Drawer */
.terminal-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: rgba(18, 20, 24, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-headline);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex: 0 0 auto;
}
.terminal-toggle-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
}
.terminal-toggle-btn.active {
  background: var(--bg-surface-high);
  color: var(--primary);
  border-color: rgba(0, 230, 118, 0.3);
  box-shadow: 0 0 10px var(--primary-glow);
}
.term-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Desktop Dedicated Side-by-Side Terminal Panel */
.terminal-drawer {
  width: 480px;
  min-width: 460px;
  max-width: 520px;
  height: calc(100vh - 32px);
  position: sticky;
  top: 16px;
  background: #090a0d;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  z-index: 90;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              min-width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease,
              margin 0.25s ease;
}

.terminal-drawer:not(.open) {
  width: 0 !important;
  min-width: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin-left: -20px !important;
  border: none !important;
  box-shadow: none !important;
}

.terminal-header {
  display: flex;
  flex-direction: column;
  background: #101216;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.terminal-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
}

.terminal-title-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}

.terminal-tabs-row {
  padding: 4px 12px 10px;
}

.badge-live {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.terminal-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.term-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.term-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.term-btn.active {
  color: var(--primary);
  border-color: rgba(0, 230, 118, 0.4);
  background: rgba(0, 230, 118, 0.12);
}

.term-btn.paused {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.12);
}
.terminal-output {
  flex: 1;
  padding: 10px 16px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: #a1a1aa;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.terminal-output::-webkit-scrollbar {
  display: block;
  width: 6px;
}
.terminal-output::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 3px;
}
.term-line {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  line-height: 1.45;
  padding: 1px 0;
}
.term-line-time {
  color: #52525b;
  margin-right: 8px;
}
.term-line-gesture {
  color: #38bdf8;
  font-weight: 700;
}
.term-line-success {
  color: #34d399;
}
.term-line-warn {
  color: #fbbf24;
}

/* GyronicsLogger & ANSI Terminal Color Classes */
.term-fg-red { color: var(--error, #FF6B6B); font-weight: 500; }
.term-fg-green { color: var(--primary, #00E676); font-weight: 500; }
.term-fg-yellow { color: #FBBF24; font-weight: 500; }
.term-fg-blue { color: #60A5FA; font-weight: 500; }
.term-fg-magenta { color: #E879F9; font-weight: 500; }
.term-fg-cyan { color: var(--cyan, #00E5FF); font-weight: 500; }
.term-fg-white { color: #F8FAFC; font-weight: 500; }
.term-fg-gray { color: #94A3B8; font-weight: 500; }
.term-bold { font-weight: 700; }

/* Terminal Tabs & Pane Switcher */
.terminal-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.term-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.term-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}
.term-tab-btn.active {
  color: var(--primary);
  background: rgba(0, 230, 118, 0.14);
  border-color: rgba(0, 230, 118, 0.35);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.15);
}
.tab-indicator-mgr {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}
.terminal-pane {
  display: none;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.terminal-pane.active {
  display: flex;
}

/* Responsive adjustments for narrow/mobile screens */
@media (max-width: 1024px) {
  .main-container {
    flex-direction: column;
    align-items: center;
    padding: 12px 12px 32px;
    gap: 16px;
  }
  .content-wrapper {
    max-width: 100%;
  }
  .gestures-grid {
    grid-template-columns: 1fr;
  }
  .terminal-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 320px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
    margin-left: 0 !important;
    z-index: 999;
  }
  .terminal-drawer.open {
    transform: translateY(0);
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .terminal-drawer:not(.open) {
    transform: translateY(100%) !important;
    width: 100% !important;
    min-width: 100% !important;
  }
}

/* --- Theme Toggle Header Button --- */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.theme-toggle-btn:hover {
  background: var(--bg-surface-high);
  border-color: var(--primary);
  color: var(--primary);
}

/* --- Prominent AI Threshold Barrier Titles --- */
.barrier-title-prominent {
  font-family: var(--font-headline);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* --- Gesture Clear & Disabled Styles --- */
.gesture-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 2px;
}
.gesture-clear-btn:hover {
  background: rgba(255, 107, 107, 0.15);
  border-color: var(--error);
  color: var(--error);
}

.gesture-card.gesture-disabled {
  opacity: 0.55;
  border-style: dashed;
  background: rgba(16, 23, 32, 0.4);
}
html.light .gesture-card.gesture-disabled {
  background: rgba(241, 245, 249, 0.7);
}

.key-bind-btn.disabled-key {
  color: var(--text-muted);
  border-style: dashed;
  background: transparent;
  border-color: var(--border-subtle);
}

/* --- Gesture Activation Toggle Matrix in Settings --- */
.gesture-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.gesture-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}
.gesture-toggle-item:hover {
  border-color: var(--border-strong);
}
.gesture-toggle-item.gesture-item-disabled {
  opacity: 0.65;
  background: var(--bg-surface-elevated);
}

.gesture-toggle-item .toggle-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gesture-toggle-item .toggle-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Switch UI */
.switch-control {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}
.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-surface-highest);
  transition: 0.25s;
  border-radius: 22px;
  border: 1px solid var(--border-strong);
}
.slider-toggle:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: 0.25s;
  border-radius: 50%;
}
.switch-control input:checked + .slider-toggle {
  background-color: var(--primary-subtle);
  border-color: var(--primary);
}
.switch-control input:checked + .slider-toggle:before {
  transform: translateX(16px);
  background-color: var(--primary);
}

/* --- Help Accordion Styles --- */
.help-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.help-item {
  border-radius: var(--radius-md);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: all 0.2s ease;
}
.help-item[open] {
  border-color: var(--border-strong);
}

.help-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  background: var(--bg-surface-elevated);
}
.help-summary:hover {
  background: var(--bg-surface-high);
}
.help-summary-icon {
  font-size: 18px;
  color: var(--primary);
}

.help-body {
  padding: 12px 16px 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.help-body p {
  margin-bottom: 8px;
}
.help-body ul {
  padding-left: 18px;
  margin-bottom: 6px;
}
.help-body li {
  margin-bottom: 4px;
}
.help-body code {
  font-family: var(--font-mono);
  background: var(--bg-surface-highest);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--primary);
  font-size: 11px;
}

/* --- Modal Overlay & Card --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.2s ease;
}
.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none;
}

.modal-card {
  width: 90%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}
html.light .modal-card {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.modal-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

/* ========================================================= */
/* KINEMATIC GESTURE REPLAY STUDIO & DATASET SIMULATION HUD  */
/* ========================================================= */
.gesture-replay-card {
  display: flex !important;
  flex-direction: column !important;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(16, 23, 32, 0.95) 0%, rgba(9, 13, 18, 0.98) 100%);
  border: 1px solid rgba(0, 230, 118, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.gesture-replay-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--cyan) 50%, transparent 100%);
}

.gesture-replay-card.drag-active {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.05);
}

.replay-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.replay-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.replay-icon {
  font-size: 28px;
  color: var(--primary);
  background: rgba(0, 230, 118, 0.12);
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 230, 118, 0.2);
}

.replay-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.replay-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.replay-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(0, 230, 118, 0.12);
  color: var(--primary);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.replay-badge-status {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.replay-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.replay-controls-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
}

.replay-select-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.replay-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.replay-field label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
}

.replay-dropdown {
  min-width: 170px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-high);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.replay-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.replay-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.25);
}

.replay-primary-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.4);
}

.replay-primary-btn.playing {
  background: var(--warning);
  color: #1a1300;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

.replay-continuous-btn.active {
  background: rgba(0, 230, 118, 0.18) !important;
  color: var(--primary) !important;
  border-color: var(--primary) !important;
  animation: continuous-pulse 2s infinite ease-in-out;
}

@keyframes continuous-pulse {
  0% { box-shadow: 0 0 4px rgba(0, 230, 118, 0.2); }
  50% { box-shadow: 0 0 14px rgba(0, 230, 118, 0.5); }
  100% { box-shadow: 0 0 4px rgba(0, 230, 118, 0.2); }
}

.replay-timeline-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
}

.replay-time-indicators {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.replay-time-val {
  color: var(--text-primary);
  font-weight: 600;
}

.replay-time-divider {
  color: var(--text-muted);
}

.replay-slider-container {
  width: 100%;
}

.replay-scrubber {
  width: 100%;
  cursor: pointer;
}

.replay-metrics-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.replay-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
}

.replay-chip .chip-label {
  color: var(--text-muted);
  font-weight: 500;
}

.replay-chip .chip-value {
  color: var(--cyan);
  font-weight: 600;
}

/* ========================================================= */
/* LIGHT THEME: KEY BUTTONS (SPACE, ARROWS) & REPLAY STUDIO  */
/* ========================================================= */
html.light .key-bind-btn,
body.light .key-bind-btn,
html[data-theme="light"] .key-bind-btn,
body[data-theme="light"] .key-bind-btn {
  background: linear-gradient(180deg, #FFFFFF 0%, #F1F5F9 100%) !important;
  border: 1px solid #CBD5E1 !important;
  border-bottom: 2px solid #94A3B8 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

html.light .key-bind-btn:hover,
body.light .key-bind-btn:hover,
html[data-theme="light"] .key-bind-btn:hover,
body[data-theme="light"] .key-bind-btn:hover {
  border-color: #059669 !important;
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

html.light .key-bind-label,
body.light .key-bind-label,
html[data-theme="light"] .key-bind-label,
body[data-theme="light"] .key-bind-label {
  color: #059669 !important;
}

html.light .key-bind-btn.recording,
body.light .key-bind-btn.recording,
html[data-theme="light"] .key-bind-btn.recording,
body[data-theme="light"] .key-bind-btn.recording {
  background: rgba(2, 132, 199, 0.12) !important;
  border-color: #0284C7 !important;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.35) !important;
}

html.light .key-bind-btn.recording .key-bind-label,
body.light .key-bind-btn.recording .key-bind-label,
html[data-theme="light"] .key-bind-btn.recording .key-bind-label,
body[data-theme="light"] .key-bind-btn.recording .key-bind-label {
  color: #0284C7 !important;
}

html.light .gesture-clear-btn,
body.light .gesture-clear-btn,
html[data-theme="light"] .gesture-clear-btn,
body[data-theme="light"] .gesture-clear-btn {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #64748B;
}

html.light .gesture-icon-box,
body.light .gesture-icon-box,
html[data-theme="light"] .gesture-icon-box,
body[data-theme="light"] .gesture-icon-box {
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #059669;
}

/* Light theme: Replay Studio Card, Borders & Controls */
html.light .gesture-replay-card,
body.light .gesture-replay-card,
html[data-theme="light"] .gesture-replay-card,
body[data-theme="light"] .gesture-replay-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%) !important;
  border: 1px solid #CBD5E1 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06) !important;
}

html.light .gesture-replay-card::before,
body.light .gesture-replay-card::before,
html[data-theme="light"] .gesture-replay-card::before,
body[data-theme="light"] .gesture-replay-card::before {
  background: linear-gradient(90deg, #059669 0%, #0284C7 50%, transparent 100%) !important;
}

html.light .replay-icon,
body.light .replay-icon,
html[data-theme="light"] .replay-icon,
body[data-theme="light"] .replay-icon {
  background: rgba(5, 150, 105, 0.1) !important;
  color: #059669 !important;
  border-color: rgba(5, 150, 105, 0.2) !important;
}

html.light .replay-controls-bar,
body.light .replay-controls-bar,
html[data-theme="light"] .replay-controls-bar,
body[data-theme="light"] .replay-controls-bar {
  background: #F8FAFC !important;
  border: 1px solid #CBD5E1 !important;
}

html.light .replay-dropdown,
body.light .replay-dropdown,
html[data-theme="light"] .replay-dropdown,
body[data-theme="light"] .replay-dropdown {
  background: #FFFFFF !important;
  color: #0F172A !important;
  border: 1px solid #CBD5E1 !important;
}

html.light .replay-timeline-wrap,
body.light .replay-timeline-wrap,
html[data-theme="light"] .replay-timeline-wrap,
body[data-theme="light"] .replay-timeline-wrap {
  background: #F8FAFC !important;
  border: 1px solid #CBD5E1 !important;
}

html.light .replay-chip,
body.light .replay-chip,
html[data-theme="light"] .replay-chip,
body[data-theme="light"] .replay-chip {
  background: #FFFFFF !important;
  border: 1px solid #CBD5E1 !important;
}

html.light .replay-chip .chip-label,
body.light .replay-chip .chip-label,
html[data-theme="light"] .replay-chip .chip-label,
body[data-theme="light"] .replay-chip .chip-label {
  color: #64748B !important;
}

html.light .replay-chip .chip-value,
body.light .replay-chip .chip-value,
html[data-theme="light"] .replay-chip .chip-value,
body[data-theme="light"] .replay-chip .chip-value {
  color: #0284C7 !important;
}

html.light .replay-badge,
body.light .replay-badge,
html[data-theme="light"] .replay-badge,
body[data-theme="light"] .replay-badge {
  background: rgba(5, 150, 105, 0.1) !important;
  color: #059669 !important;
  border: 1px solid rgba(5, 150, 105, 0.25) !important;
}

html.light .replay-badge-status,
body.light .replay-badge-status,
html[data-theme="light"] .replay-badge-status,
body[data-theme="light"] .replay-badge-status {
  background: #FFFFFF !important;
  color: #475569 !important;
  border: 1px solid #CBD5E1 !important;
}

html.light .replay-primary-btn,
body.light .replay-primary-btn,
html[data-theme="light"] .replay-primary-btn,
body[data-theme="light"] .replay-primary-btn {
  background: #059669 !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 10px rgba(5, 150, 105, 0.25) !important;
}

html.light .replay-primary-btn:hover,
body.light .replay-primary-btn:hover,
html[data-theme="light"] .replay-primary-btn:hover,
body[data-theme="light"] .replay-primary-btn:hover {
  background: #047857 !important;
}

html.light .replay-primary-btn.playing,
body.light .replay-primary-btn.playing,
html[data-theme="light"] .replay-primary-btn.playing,
body[data-theme="light"] .replay-primary-btn.playing {
  background: #D97706 !important;
  color: #FFFFFF !important;
}

html.light .replay-continuous-btn.active,
body.light .replay-continuous-btn.active,
html[data-theme="light"] .replay-continuous-btn.active,
body[data-theme="light"] .replay-continuous-btn.active {
  background: rgba(5, 150, 105, 0.15) !important;
  color: #059669 !important;
  border-color: #059669 !important;
}

/* ==========================================================================
   TOP BAR ENHANCED CONTROLS & MASTER PILLS (ITEM A & ICONS)
   ========================================================================== */
.top-mode-segmented {
  display: flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 2px;
}

.top-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.top-mode-btn .material-symbols-outlined {
  font-size: 14px;
}

.top-mode-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.top-mode-btn.active {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Top Navigation Cluster Action Buttons */
.top-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-headline);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.top-action-btn:hover {
  background: var(--bg-surface-highest);
  border-color: var(--border-prominent);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}

.top-action-btn:active {
  transform: translateY(1px);
}

.top-action-btn.active {
  background: rgba(0, 230, 118, 0.12);
  border-color: rgba(0, 230, 118, 0.45);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.2);
}

.top-action-btn.active .pill-icon,
.top-action-btn.active #icon-actuation-top {
  color: var(--primary);
}

.top-action-btn.muted {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--error);
}

/* Connect / Disconnect Top Button */
.top-connect-btn {
  border-color: var(--border);
}

.top-connect-btn.connected {
  background: rgba(0, 230, 118, 0.15);
  border-color: rgba(0, 230, 118, 0.55);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.25);
}

.top-connect-btn.pending {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.top-connect-btn.failed {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
  color: var(--error);
}

.top-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.top-icon-btn:hover {
  background: var(--bg-surface-highest);
  border-color: var(--border-prominent);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* ==========================================================================
   SIMPLE MODE VS PRO LAB MODE
   ========================================================================== */
body.mode-simple .pro-only {
  display: none !important;
}

body.mode-simple .screen-subtitle {
  display: none !important;
}

body.mode-simple .screen-desc,
body.mode-simple .overexplain-text {
  display: none !important;
}

body.mode-simple .cal-angles-grid {
  grid-template-columns: repeat(3, 1fr) !important;
}

body.mode-simple #btn-toggle-terminal,
body.mode-simple #terminal-drawer,
body.mode-simple .terminal-drawer {
  display: none !important;
}

body.mode-simple .main-container {
  grid-template-columns: 1fr !important;
}

body.mode-simple .simple-only {
  display: block;
}

body.mode-pro .simple-only {
  display: none !important;
}

/* Reserved Mode Switch Gesture Card Styling */
.gesture-card.card-reserved {
  opacity: 0.72;
  border-color: rgba(0, 230, 118, 0.45) !important;
  background: rgba(0, 230, 118, 0.04) !important;
  position: relative;
}

.gesture-card.card-reserved .gesture-keys {
  pointer-events: none;
}

.badge-reserved-mode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.simple-sensitivity-selector {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.simple-sens-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.simple-sens-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.simple-sens-btn.active {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

/* ==========================================================================
   YAW COMPENSATION BADGE & VIEWPORT HUD
   ========================================================================== */
.hud-mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.hud-mode-pill.comp-active {
  background: rgba(0, 230, 118, 0.18);
  border: 1px solid var(--primary);
  color: var(--primary);
}

.hud-mode-pill.raw-active {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid var(--warning);
  color: var(--warning);
}

/* ==========================================================================
   SWIPE-TO-TEXT FLOATING OVERLAY KEYBOARD (ITEM C)
   ========================================================================== */
.swipe-keyboard-overlay {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: 90%;
  max-width: 680px;
  background: rgba(16, 23, 32, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 230, 118, 0.3);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 24px rgba(0, 230, 118, 0.15);
  animation: swipeKeyboardSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes swipeKeyboardSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 40px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.swipe-kb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.swipe-kb-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swipe-kb-title {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.swipe-kb-mode-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(0, 230, 118, 0.15);
  color: var(--primary);
  font-weight: 700;
}

.swipe-kb-candidates {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  padding: 2px 4px;
}

.swipe-candidate {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.swipe-candidate:hover {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

.swipe-candidate.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  font-weight: 700;
}

.swipe-kb-actions {
  display: flex;
  gap: 6px;
}

.swipe-kb-btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.swipe-kb-btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.swipe-kb-input-preview {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  background: var(--bg-surface-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

.swipe-kb-caret {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--primary);
  margin-left: 2px;
  animation: kbBlink 1s infinite;
}

@keyframes kbBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.swipe-kb-board {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: none;
}

.swipe-trail-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.swipe-cursor {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
  transition: transform 0.03s linear;
}

.swipe-cursor-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
}

.swipe-cursor-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
  opacity: 0.6;
  animation: cursorRingPulse 1.2s infinite ease-out;
}

@keyframes cursorRingPulse {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

.swipe-row {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.swipe-row.row-indent-1 {
  padding: 0 16px;
}

.swipe-row.row-indent-2 {
  padding: 0 32px;
}

.swipe-key {
  flex: 1;
  max-width: 52px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s ease;
  position: relative;
  z-index: 2;
}

.swipe-key:hover,
.swipe-key.hover-active {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.08);
  box-shadow: 0 0 14px var(--primary-glow);
}

.swipe-key.key-func {
  max-width: 70px;
  font-size: 12px;
  background: var(--bg-surface-high);
  color: var(--text-secondary);
}

.swipe-key.key-space {
  max-width: 280px;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.swipe-key.key-enter {
  max-width: 100px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}

/* ========================================================= */
/* GLOBAL HERO DEMO BANNER & YOUTUBE PLAYER EMBED            */
/* ========================================================= */

.hero-demo-banner {
  margin: 16px 24px 0 24px;
  background: linear-gradient(135deg, rgba(16, 23, 32, 0.94) 0%, rgba(10, 15, 22, 0.98) 100%);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-demo-banner::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-demo-inner {
  position: relative;
  z-index: 1;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-demo-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.hero-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #FF5252;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.hero-live-dot {
  width: 8px;
  height: 8px;
  background: #FF5252;
  border-radius: 50%;
  box-shadow: 0 0 8px #FF5252;
  animation: hero-live-pulse 1.8s infinite ease-in-out;
}

@keyframes hero-live-pulse {
  0% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 4px #FF5252; }
  50% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 12px #FF5252; }
  100% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 4px #FF5252; }
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.hero-tag.cyan {
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.28);
  color: var(--cyan);
}

.hero-tag.primary {
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.28);
  color: var(--primary);
}

.hero-tag.orange {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--warning);
}

.hero-demo-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.hero-demo-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
  max-width: 900px;
}

.hero-demo-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s ease;
}

.hero-btn.primary {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.hero-btn.primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}

.hero-btn.secondary {
  background: rgba(0, 229, 255, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
  font-weight: 600;
}

.hero-btn.secondary:hover {
  background: rgba(0, 229, 255, 0.2);
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.hero-btn.tertiary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  font-weight: 500;
}

.hero-btn.tertiary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-secondary);
}

.hero-btn.icon-only {
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.hero-btn.icon-only:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.1);
}

/* Video Embed Player Container (Responsive 16:9) */
.hero-video-container {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: heroFadeSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes heroFadeSlideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.video-responsive-frame {
  position: relative;
  width: 100%;
  max-width: 880px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(0, 229, 255, 0.35);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 229, 255, 0.15);
}

.video-responsive-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-caption-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 4px;
}

.btn-text-action {
  background: transparent;
  border: none;
  color: var(--cyan);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
}

.btn-text-action:hover {
  color: #67e8f9;
}

/* Banner Minimized Mode */
.hero-demo-banner.minimized .hero-demo-desc,
.hero-demo-banner.minimized .hero-video-container,
.hero-demo-banner.minimized .hero-btn.secondary,
.hero-demo-banner.minimized .hero-btn.tertiary {
  display: none !important;
}

.hero-demo-banner.minimized .hero-demo-inner {
  padding: 10px 20px;
}

.hero-demo-banner.minimized .hero-demo-title {
  font-size: 15px;
  margin: 0;
}




