/* ========================================================================
   GestureV — Shared Design System
   Unified dark-theme tokens, components, and utilities
   Extracted from index.html, signin.html, editor.html
   ======================================================================== */


/* ── 1. CSS Reset ──────────────────────────────────────────────────────── */

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


/* ── 2. CSS Custom Properties ──────────────────────────────────────────── */

:root {
  /* Backgrounds */
  --bg-deepest: #070a11;
  --bg-dark:    #090d17;
  --bg-mid:     #0f1625;
  --bg-card:    rgba(14, 22, 40, 0.5);
  --bg-hover:   rgba(25, 40, 65, 0.5);

  /* Borders */
  --border:     rgba(60, 100, 180, 0.1);
  --border-hov: rgba(60, 130, 220, 0.2);

  /* Text */
  --text-pri:   #e4ecf7;
  --text-sec:   rgba(160, 190, 230, 0.5);
  --text-inv:   #0b0f17;

  /* Accents */
  --accent:     #00f5a0;
  --accent2:    #00d4ff;
  --accent3:    #7c4dff;
  --accent4:    #ff6b9d;
  --accent5:    #f5c842;

  /* Utility */
  --red:        #ff4757;
  --radius:     14px;
  --shadow:     0 8px 40px rgba(0, 0, 0, 0.5);
  --glow-text:  0 0 30px rgba(0, 245, 160, 0.2);
}

/* Light theme overrides */
.light {
  --bg-deepest: #f0f2f5;
  --bg-dark:    #f5f7fa;
  --bg-mid:     #e8ecf1;
  --bg-card:    rgba(255, 255, 255, 0.7);
  --bg-hover:   rgba(0, 0, 0, 0.04);
  --border:     rgba(0, 0, 0, 0.06);
  --border-hov: rgba(0, 0, 0, 0.12);
  --text-pri:   #1a1d23;
  --text-sec:   rgba(80, 95, 120, 0.55);
  --text-inv:   #e4ecf7;
  --accent:     #00c97a;
  --accent2:    #0099cc;
  --accent3:    #6b3fa0;
  --accent4:    #cc5577;
  --accent5:    #c9a030;
  --red:        #e53935;
  --shadow:     0 8px 40px rgba(0, 0, 0, 0.06);
  --glow-text:  0 0 30px rgba(0, 201, 122, 0.15);
}


/* ── 3. Typography ─────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h3 { font-size: 1rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 0.9rem; font-weight: 600; }
h5 {
  font-size: 0.65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-sec);
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

.font-sans {
  font-family: 'Inter', sans-serif;
}

p {
  font-size: 0.76rem;
  color: var(--text-sec);
  line-height: 1.65;
}

small {
  font-size: 0.68rem;
  color: var(--text-sec);
  display: block;
  margin-top: 0.15rem;
}


/* ── 4. Base Elements ──────────────────────────────────────────────────── */

html {
  scroll-behavior: smooth;
}

html.help-page {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text-pri);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background 0.35s, color 0.35s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(0, 245, 160, 0.25);
  color: #fff;
}

.light ::selection {
  background: rgba(0, 201, 122, 0.2);
}

::-webkit-scrollbar {
  width: 4px;
}

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

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

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

.light ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
}

.light ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.15);
}


/* ── 5. Background Effects ─────────────────────────────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 0% 20%, rgba(0, 245, 160, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 80%, rgba(0, 212, 255, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 60% 40%, rgba(124, 77, 255, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  transition: background 0.35s;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.light body::after {
  opacity: 0;
}

.orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.35s;
}

.light .orb {
  opacity: 0.3;
}

.orb-1 {
  width: 400px; height: 400px;
  background: rgba(0, 245, 160, 0.04);
  top: -100px; left: -100px;
}

.orb-2 {
  width: 350px; height: 350px;
  background: rgba(0, 212, 255, 0.03);
  bottom: -80px; right: -80px;
  animation-delay: -3s;
}

.orb-3 {
  width: 300px; height: 300px;
  background: rgba(124, 77, 255, 0.03);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -6s;
}


/* ── 6. Component Classes ──────────────────────────────────────────────── */

/* ── Card ────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.35s, border-color 0.35s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.light .card {
  background: rgba(255, 255, 255, 0.85);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(0, 245, 160, 0.08), transparent 35%, transparent 65%, rgba(0, 212, 255, 0.05));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}

.card::after {
  display: none;
}

.card:hover {
  border-color: var(--border-hov);
  transform: translateY(-2px);
}

.card:hover::before {
  opacity: 1;
}

.card.full {
  grid-column: 1 / -1;
}

.card .corner {
  position: absolute;
  width: 16px; height: 16px;
  border-color: rgba(0, 245, 160, 0.08);
  border-style: solid;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}

.card:hover .corner {
  opacity: 1;
}

.card .corner.tl { top: 8px; left: 8px; border-width: 1px 0 0 1px; border-radius: 4px 0 0 0; }
.card .corner.tr { top: 8px; right: 8px; border-width: 1px 1px 0 0; border-radius: 0 4px 0 0; }
.card .corner.bl { bottom: 8px; left: 8px; border-width: 0 0 1px 1px; border-radius: 0 0 0 4px; }
.card .corner.br { bottom: 8px; right: 8px; border-width: 0 1px 1px 0; border-radius: 0 0 4px 0; }

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

.card-header .ch-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.card-header .ch-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.25;
}

.card-header h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-sec);
}

.card-header .card-icon {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-sec);
  opacity: 0.15;
  transition: opacity 0.4s;
}

.card:hover .card-icon {
  opacity: 0.35;
}

.card-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}


/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-sec);
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.35s, color 0.35s, background 0.35s;
  -webkit-tap-highlight-color: transparent;
  width: fit-content;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.06), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hov);
  color: var(--text-pri);
}

.btn:hover::after {
  opacity: 1;
}

.btn:active {
  transform: scale(0.97) !important;
  transition: transform 0.1s ease !important;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(0, 245, 160, 0.08), rgba(0, 212, 255, 0.04));
  border-color: rgba(0, 245, 160, 0.15);
  color: var(--accent);
  width: 100%;
  padding: 0.8rem;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  position: relative;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(0, 245, 160, 0.2), transparent 40%, transparent 60%, rgba(0, 212, 255, 0.1));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s;
}

.btn-primary::before {
  opacity: 1;
}

.btn-primary:hover::before { opacity: 1; }
.btn-primary:hover {
  border-color: transparent;
  box-shadow: 0 0 40px rgba(0, 245, 160, 0.08);
}

.btn-primary:active {
  transform: scale(0.97) !important;
  transition: transform 0.1s ease !important;
}

.btn-primary.live {
  background: linear-gradient(135deg, rgba(0, 245, 160, 0.1), rgba(0, 212, 255, 0.05));
  border-color: rgba(0, 245, 160, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(228, 236, 247, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-pri);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: scale(0.97) !important;
  transition: transform 0.1s ease !important;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: var(--accent2);
  background: none;
  border: none;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.3s;
  padding: 0.2rem 0;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.btn-link:hover {
  color: var(--accent);
  gap: 0.6rem;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-group .btn {
  flex: 1;
  min-width: 0;
  font-size: 0.68rem;
}

.btn-capture {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-pri);
  font-size: 0.55rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.25s, border-color 0.35s;
  flex-shrink: 0;
}

.btn-capture:hover {
  background: var(--accent);
  color: #0a0c10;
  border-color: var(--accent);
}


/* ── Stat Cards ──────────────────────────────────────────────────────── */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.stat {
  padding: 0.9rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  position: relative;
}

.stat:hover {
  border-color: var(--border-hov);
  background: rgba(255, 255, 255, 0.025);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.stat .sv {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.65rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 25%, rgba(255, 255, 255, 0.35));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  transition: filter 0.3s;
  animation: count-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stat:hover .sv {
  filter: brightness(1.15);
}

.light .stat .sv {
  background: linear-gradient(135deg, #1a1d23 25%, rgba(26, 29, 35, 0.35));
  -webkit-background-clip: text;
  background-clip: text;
}

.stat .sl {
  font-size: 0.52rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-sec);
  margin-top: 0.3rem;
  font-weight: 600;
  display: block;
}

.stat-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.stat:hover .stat-glow { opacity: 1; }
.stat-glow.green { background: radial-gradient(circle at 50% 0%, rgba(0, 245, 160, 0.06), transparent 70%); }
.stat-glow.blue  { background: radial-gradient(circle at 50% 0%, rgba(0, 212, 255, 0.06), transparent 70%); }
.stat-glow.purple { background: radial-gradient(circle at 50% 0%, rgba(124, 77, 255, 0.06), transparent 70%); }


/* ── Gesture Items & Chips ───────────────────────────────────────────── */

.gesture-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
}

.gesture-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.gc-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gesture-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1), background 0.35s, border-color 0.35s;
  cursor: default;
  position: relative;
}

.light .gesture-item {
  background: rgba(255, 255, 255, 0.5);
}

.gesture-item::before {
  content: '';
  position: absolute;
  left: -1px; top: 20%; bottom: 20%;
  width: 2px;
  background: var(--accent);
  border-radius: 4px;
  opacity: 0;
  transition: all 0.35s;
}

.gesture-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-hov);
  transform: translateX(4px);
}

.gesture-item:hover::before {
  opacity: 1;
  top: 10%; bottom: 10%;
}

.gesture-item .gi-info { flex: 1; min-width: 0; }
.gesture-item .gi-name {
  font-size: 0.76rem; font-weight: 600;
  color: var(--text-pri);
}
.gesture-item .gi-desc {
  font-size: 0.64rem;
  color: var(--text-sec);
  margin-top: 0.15rem;
}

.gesture-item .gi-action {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  color: var(--text-sec);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.gesture-item:hover .gi-action {
  border-color: var(--border-hov);
}

.gesture-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--text-sec);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.gesture-chip:hover {
  background: var(--bg-hover);
  border-color: var(--border-hov);
  color: var(--text-pri);
  transform: translateX(4px) scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}


/* ── Badge / Tag ─────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 100px;
  background: rgba(0, 245, 160, 0.05);
  border: 1px solid rgba(0, 245, 160, 0.08);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  background: rgba(0, 245, 160, 0.04);
  border: 1px solid rgba(0, 245, 160, 0.08);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-sec);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.01em;
  transition: all 0.3s ease;
}

.tag:hover {
  background: rgba(0, 245, 160, 0.08);
  border-color: rgba(0, 245, 160, 0.15);
  transform: translateY(-2px);
}


/* ── Toggle Switch ───────────────────────────────────────────────────── */

.toggle {
  width: 36px; height: 20px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.35s, background 0.35s;
  flex-shrink: 0;
}

.light .toggle {
  background: rgba(0, 0, 0, 0.04);
}

.toggle.on,
.toggle.active {
  background: linear-gradient(135deg, rgba(0, 245, 160, 0.15), rgba(0, 212, 255, 0.08));
  border-color: rgba(0, 245, 160, 0.2);
}

.toggle::after,
.toggle .toggle-knob {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-sec);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1), background 0.35s;
}

.toggle.on::after,
.toggle.on .toggle-knob,
.toggle.active::after,
.toggle.active .toggle-knob {
  left: 18px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(0, 245, 160, 0.3);
}


/* ── Form Inputs ─────────────────────────────────────────────────────── */

.input,
input[type="text"],
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-pri);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus,
input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 245, 160, 0.08);
}

.input::placeholder,
input[type="text"]::placeholder,
textarea::placeholder {
  color: var(--text-sec);
  opacity: 0.5;
}

textarea {
  resize: vertical;
  min-height: 60px;
}


/* ── Toast Notifications ─────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  border: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  max-width: 320px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: rgba(0, 245, 160, 0.1);
  border-color: rgba(0, 245, 160, 0.2);
  color: var(--accent);
}

.toast.error {
  background: rgba(255, 71, 87, 0.1);
  border-color: rgba(255, 71, 87, 0.2);
  color: var(--red);
}

.toast.info {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.2);
  color: var(--accent2);
}

.toast.leaving {
  animation: toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}


/* ── Alert Banners ───────────────────────────────────────────────────── */

.banner {
  display: none;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.banner.show {
  display: flex;
}

.banner.info {
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid rgba(0, 212, 255, 0.1);
  color: var(--accent2);
}

.banner.warn {
  background: rgba(255, 183, 77, 0.05);
  border: 1px solid rgba(255, 183, 77, 0.1);
  color: #ffb74d;
}

.banner.good {
  background: rgba(0, 245, 160, 0.05);
  border: 1px solid rgba(0, 245, 160, 0.1);
  color: var(--accent);
}

.banner .ba-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}


/* ── Sidebar Layout ──────────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 230px;
  z-index: 100;
  background: rgba(9, 13, 23, 0.95);
  border-right: 1px solid var(--border);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: background 0.35s, border-color 0.35s;
}

.light .sidebar {
  background: rgba(245, 247, 250, 0.85);
}

.sidebar-brand {
  padding: 1.5rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: border-color 0.35s;
}

.sidebar-brand .brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  background: linear-gradient(135deg, rgba(0, 245, 160, 0.15), rgba(0, 212, 255, 0.1));
  border: 1px solid rgba(0, 245, 160, 0.15);
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.sidebar-brand .brand-word {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #e4ecf7 30%, rgba(228, 236, 247, 0.4));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.light .sidebar-brand .brand-word {
  background: linear-gradient(135deg, #1a1d23 30%, rgba(26, 29, 35, 0.4));
  -webkit-background-clip: text;
  background-clip: text;
}

.sidebar-brand .brand-v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: var(--glow-text);
}

.sidebar-brand .brand-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.45rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--text-sec);
  opacity: 0.3;
  text-transform: uppercase;
}

.sidebar-body {
  padding: 0.5rem 0.65rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-nav-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.48rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-sec);
  opacity: 0.25;
  padding: 0.75rem 0.75rem 0.35rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  color: var(--text-sec);
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.sidebar-nav a:hover {
  color: var(--text-pri);
  background: var(--bg-hover);
}

.sidebar-nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(0, 245, 160, 0.08), transparent);
}

.light .sidebar-nav a.active {
  color: var(--text-pri);
}

.sidebar-nav a .nav-icon {
  width: 24px; height: 24px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  transition: all 0.3s;
  flex-shrink: 0;
  color: var(--text-sec);
}

.sidebar-nav a:hover .nav-icon {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-hov);
}

.sidebar-nav a.active .nav-icon {
  background: rgba(0, 245, 160, 0.08);
  border-color: rgba(0, 245, 160, 0.12);
  color: var(--accent);
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.35s;
}

.sidebar-footer .sf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.48rem;
  color: var(--text-sec);
  opacity: 0.3;
  letter-spacing: 0.05em;
}

.sidebar-footer .sf-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
}

.sidebar-search {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-search input {
  width: 100%;
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-pri);
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  outline: none;
  transition: border-color 0.2s;
}

.sidebar-search input::placeholder {
  color: var(--text-sec);
  opacity: 0.5;
}

.sidebar-search input:focus {
  border-color: var(--accent);
}

.sidebar-count {
  padding: 0.35rem 0.75rem;
  font-size: 0.55rem;
  color: var(--text-sec);
  border-bottom: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
}

.gesture-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.gesture-list::-webkit-scrollbar { width: 4px; }
.gesture-list::-webkit-scrollbar-track { background: transparent; }
.gesture-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }

.group-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-sec);
  opacity: 0.4;
  padding: 0.75rem 0.5rem 0.35rem;
}

.overlay {
  display: none;
}


/* ── Main Layout ─────────────────────────────────────────────────────── */

.main {
  position: relative;
  z-index: 1;
  margin-left: 230px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2.5rem;
  background: rgba(9, 13, 23, 0.95);
  border-bottom: 1px solid var(--border);
  transition: background 0.35s, border-color 0.35s;
}

.light .main-header {
  background: rgba(245, 247, 250, 0.6);
}

.main-header .mh-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.main-header .mh-left .breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sec);
  opacity: 0.5;
}

.main-header .mh-left .breadcrumb .sep { opacity: 0.3; }
.main-header .mh-left .breadcrumb .current {
  color: var(--text-pri);
  opacity: 1;
}

.main-header .mh-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.main-header .status-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-sec);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  background: rgba(255, 255, 255, 0.02);
}

.main-header .status-pill .sp-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.4s;
}

.main-header .status-pill .sp-dot.active {
  background: var(--accent);
  box-shadow: 0 0 18px rgba(0, 245, 160, 0.6);
}

.main-header .status-pill.running {
  border-color: rgba(0, 245, 160, 0.15);
  color: var(--accent);
  box-shadow: 0 0 30px rgba(0, 245, 160, 0.04);
}

.main-header .mh-right .hamburger { display: none; }

.main-content {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.main-content::-webkit-scrollbar { width: 5px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.06); border-radius: 10px; }
.main-content::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.1); }

.main-footer {
  padding: 0.85rem 2.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.47rem;
  color: var(--text-sec);
  opacity: 0.25;
  letter-spacing: 0.05em;
  margin-top: auto;
  transition: border-color 0.35s, color 0.35s;
}

.main-footer .mf-links { display: flex; gap: 1rem; }
.main-footer .mf-links a { color: inherit; text-decoration: none; transition: opacity 0.2s; }
.main-footer .mf-links a:hover { opacity: 0.6; }

.page { display: none; }
.page.active { display: block; }

/* ── Bindings Page (full-bleed iframe) ──────────────────────────────── */

.page-bindings {
  display: none;
  padding: 0;
  width: 100%;
  max-width: none;
}
.page-bindings.active {
  display: flex;
  flex-direction: column;
}

.page-bindings iframe {
  width: 100%;
  flex: 1;
  min-height: calc(100vh - 60px);
  border: none;
  background: var(--bg-dark);
}

html.bindings-page .main-content {
  max-width: none;
  padding: 0;
  margin: 0;
}

html.bindings-page .main-footer {
  display: none;
}

html.bindings-page .banner {
  display: none;
}


/* ── Category Filter Tabs ────────────────────────────────────────────── */

.cat-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 0.3rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  transition: background 0.3s, border-color 0.3s;
  position: relative;
  z-index: 5;
}

.cat-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-sec);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 5;
}

.cat-tab:hover {
  background: var(--bg-hover);
  color: var(--text-pri);
}

.cat-tab.active {
  background: rgba(0, 245, 160, 0.08);
  color: var(--accent);
  border: 1px solid rgba(0, 245, 160, 0.12);
}


/* ── Gesture Search ──────────────────────────────────────────────────── */

.gesture-search-wrap {
  position: relative;
  margin-bottom: 1.25rem;
}

.gesture-search {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-pri);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.35s, background 0.35s;
  outline: none;
}

.gesture-search::placeholder { color: var(--text-sec); }

.gesture-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 245, 160, 0.08);
}

.gesture-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-sec);
  font-size: 0.75rem;
  pointer-events: none;
  opacity: 0.5;
  transition: color 0.3s, opacity 0.3s;
}

.gesture-search:focus ~ .gesture-search-icon {
  color: var(--accent);
  opacity: 0.8;
}


/* ── Config Section Headers ──────────────────────────────────────────── */

.cfg-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.6rem 0 0.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  user-select: none;
}

.cfg-section-icon {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cfg-collapse-toggle {
  margin-left: auto;
  cursor: pointer;
  color: var(--text-sec);
  transition: transform 0.25s ease;
  display: flex;
  align-items: center;
}

.cfg-collapse-toggle svg { transition: transform 0.25s ease; }
.cfg-collapse-toggle.collapsed svg { transform: rotate(-90deg); }

.cfg-collapsible {
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, margin 0.25s ease;
  overflow: hidden;
}

.cfg-collapsible.collapsed {
  max-height: 0 !important;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
  border: none;
  padding: 0;
  pointer-events: none;
}

.cfg-section-header .cfg-section-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.cfg-section-reset {
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  font-size: 0.55rem;
  font-weight: 500;
  color: var(--text-sec);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  transition: opacity 0.2s, color 0.2s, background 0.2s;
  background: transparent;
  border: 1px solid transparent;
  font-family: 'Inter', sans-serif;
}

.cfg-section-header:hover .cfg-section-reset { opacity: 0.6; pointer-events: auto; }
.cfg-section-reset:hover { opacity: 1 !important; color: var(--red); background: rgba(255, 71, 87, 0.08); border-color: rgba(255, 71, 87, 0.15); }


/* ── Binding Items ───────────────────────────────────────────────────── */

.binding-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.binding-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.35s, border-color 0.35s;
}

.binding-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-hov);
  transform: translateX(3px);
}

.binding-item .bi-info { flex: 1; min-width: 0; }
.binding-item .bi-name { font-size: 0.72rem; font-weight: 600; color: var(--text-pri); }
.binding-item .bi-desc { font-size: 0.6rem; color: var(--text-sec); margin-top: 0.1rem; }

.bi-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.bi-controls select {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  font-weight: 600;
  padding: 0.25rem 1.2rem 0.25rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-pri);
  cursor: pointer;
  transition: all 0.25s;
  min-width: 80px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' fill='none'%3E%3Cpath d='M1 1l2.5 2.5L6 1' stroke='%23808a9e' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
}

.light .bi-controls select { background-color: rgba(255, 255, 255, 0.5); color: #1a1d23; }
.bi-controls select:hover { border-color: var(--border-hov); }
.bi-controls select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0, 245, 160, 0.1); }
.bi-controls select option { background: var(--bg-mid); color: var(--text-pri); }
.light .bi-controls select option { background: #e8ecf1; color: #1a1d23; }

.bi-value-wrap {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.bi-value-wrap input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-pri);
  transition: all 0.25s;
  min-width: 110px;
  max-width: 170px;
}

.light .bi-value-wrap input { background-color: rgba(255, 255, 255, 0.5); color: #1a1d23; }
.bi-value-wrap input:hover { border-color: var(--border-hov); }
.bi-value-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0, 245, 160, 0.1); }


/* ── Help Cards & Grid ───────────────────────────────────────────────── */

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.help-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1), background 0.35s, border-color 0.35s, transform 0.3s;
  box-shadow: var(--shadow);
  scroll-margin-top: 5rem;
}

.light .help-card {
  background: rgba(255, 255, 255, 0.7);
}

.help-card:hover {
  border-color: var(--border-hov);
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 40px rgba(0, 245, 160, 0.03);
}

.help-card.full {
  grid-column: 1 / -1;
}

.help-card .hc-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-sec);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.help-card .hc-title::before {
  content: '';
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
}

.help-steps {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.help-step {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  transition: all 0.25s, border-color 0.35s, background 0.35s;
}

.help-step:hover {
  background: var(--bg-hover);
  border-color: var(--border-hov);
}

.help-step .step-num {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(0, 245, 160, 0.1), rgba(0, 212, 255, 0.05));
  border: 1px solid rgba(0, 245, 160, 0.12);
  color: var(--accent);
  flex-shrink: 0;
}

.help-step .step-text {
  font-size: 0.76rem;
  color: var(--text-pri);
  line-height: 1.5;
}


/* ── Install Steps ───────────────────────────────────────────────────── */

.install-step {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.install-step:hover {
  border-color: var(--border-hov);
  background: rgba(255, 255, 255, 0.035);
  transform: translateX(3px);
}

.install-num {
  width: 20px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 245, 160, 0.1);
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  margin-top: 1px;
}

.install-body { flex: 1; min-width: 0; }

.install-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-pri);
  margin-bottom: 0.3rem;
}

.install-cmd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  line-height: 1.65;
  color: var(--accent);
  background: rgba(0, 245, 160, 0.04);
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 245, 160, 0.06);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  word-break: break-all;
  position: relative;
}

.install-cmd:hover {
  background: rgba(0, 245, 160, 0.08);
  border-color: rgba(0, 245, 160, 0.12);
}

.install-cmd span { color: var(--text-sec); }


/* ── Keyboard Shortcut Keys ──────────────────────────────────────────── */

kbd {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--accent2);
  margin: 0 0.08rem;
}


/* ── Performance Bars ────────────────────────────────────────────────── */

.perf-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.perf-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.perf-bar {
  width: 100%; height: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.light .perf-bar {
  background: rgba(0, 0, 0, 0.04);
}

.perf-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.perf-fill.fill-mem { background: linear-gradient(90deg, var(--accent3), var(--accent4)); }
.perf-fill.fill-fps { background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.perf-fill.fill-uptime { background: linear-gradient(90deg, var(--accent5), var(--accent3)); }

.perf-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  color: var(--text-sec);
  letter-spacing: 0.03em;
}

.perf-label span:last-child {
  font-weight: 700;
  color: var(--text-pri);
}


/* ── Setting Rows ────────────────────────────────────────────────────── */

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-user-select: none;
  user-select: none;
  margin: 0 -0.25rem;
}

.setting-row:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border);
  transform: translateX(3px);
}

.setting-row.has-unsaved {
  border-color: var(--accent5) !important;
  background: rgba(245, 200, 66, 0.04);
}

.setting-row .unsaved-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent5);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.setting-row.has-unsaved .unsaved-dot { opacity: 1; }

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.setting-name { font-size: 0.72rem; font-weight: 600; color: var(--text-pri); }
.setting-desc { font-size: 0.58rem; color: var(--text-sec); }


/* ── Empty State ─────────────────────────────────────────────────────── */

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
  color: var(--text-sec);
}

.empty-state .icon { font-size: 3rem; opacity: 0.3; }
.empty-state p { font-size: 0.85rem; }


/* ── 7. Animations ────────────────────────────────────────────────────── */

@keyframes bg-shift {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.05); }
}

@keyframes orb-float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.1); }
}

@keyframes card-enter {
  0% { opacity: 0; transform: translateY(40px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fade-slide-up {
  0% { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.6); }
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 245, 160, 0.03); }
  50% { box-shadow: 0 0 50px rgba(0, 245, 160, 0.08); }
}

@keyframes shimmer-text {
  to { background-position: 200% center; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(15px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes count-up {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(20px) scale(0.95); }
}

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

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

@keyframes ripple-effect {
  0% { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes pulseRing {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.3); opacity: 0; }
}


/* ── 7b. Dashboard Redesign ───────────────────────────────────────────── */

.dash-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 2.2rem;
  margin-bottom: 1.5rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(0, 245, 160, 0.04), rgba(0, 212, 255, 0.02));
  border: 1px solid var(--border);
  animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dash-welcome-text h2 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.dash-welcome-actions {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.dash-stat-card {
  padding: 1.3rem 1.2rem;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dash-stat-card:nth-child(1) { animation-delay: 0.05s; }
.dash-stat-card:nth-child(2) { animation-delay: 0.1s; }
.dash-stat-card:nth-child(3) { animation-delay: 0.15s; }

.dash-stat-card:hover {
  border-color: var(--border-hov);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.dash-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.9rem;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dash-stat-card:hover .dash-stat-icon {
  transform: scale(1.08);
}

.dash-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.3rem;
  background: linear-gradient(135deg, var(--text-pri), rgba(255, 255, 255, 0.5));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.light .dash-stat-value {
  background: linear-gradient(135deg, var(--text-pri), rgba(26, 29, 35, 0.5));
  -webkit-background-clip: text;
  background-clip: text;
}

.dash-stat-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-sec);
}

.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.dash-live-card {
  min-height: 140px;
}

.dash-live-content {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.5rem 0;
}

.dash-gesture-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(0, 245, 160, 0.1), rgba(0, 212, 255, 0.05));
  border: 1px solid rgba(0, 245, 160, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.dash-gesture-icon.pulse {
  animation: gesturePulse 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gesturePulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 245, 160, 0.2); }
  50% { transform: scale(1.08); box-shadow: 0 0 30px rgba(0, 245, 160, 0.15); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 245, 160, 0); }
}

.dash-gesture-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-sec);
  transition: color 0.3s;
}

.dash-gesture-action {
  font-size: 0.68rem;
  color: var(--text-sec);
  opacity: 0.5;
  margin-top: 0.2rem;
}

.dash-perf {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.dash-perf-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.dash-perf-header {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  color: var(--text-sec);
}

.dash-perf-header span:last-child {
  font-weight: 700;
  color: var(--text-pri);
}

.dash-perf-bar {
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.light .dash-perf-bar {
  background: rgba(0, 0, 0, 0.04);
}

.dash-perf-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 8px rgba(0, 245, 160, 0.2);
}

.dash-activity-feed {
  max-height: 10rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.dash-activity-empty {
  font-size: 0.65rem;
  color: var(--text-sec);
  padding: 1rem 0;
  text-align: center;
  opacity: 0.5;
}

.dash-gesture-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

/* ── 8. Responsive Breakpoints ────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
  .help-grid { grid-template-columns: 1fr; }
}

/* Small tablet / large phone */
@media (max-width: 768px) {
  .sidebar {
    left: -230px;
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.35s, border-color 0.35s;
  }

  .sidebar.open {
    left: 0;
  }

  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.5);
  }

  .overlay.show { display: block; }

  .orb { display: none; }

  .main { margin-left: 0; }
  .main-header { padding: 0.65rem 1.25rem; }

  .main-header .mh-right .hamburger {
    display: flex;
    width: 32px; height: 32px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-sec);
    transition: all 0.2s;
  }

  .main-header .mh-right .hamburger:hover {
    background: var(--bg-hover);
    color: var(--text-pri);
  }

  .main-header .breadcrumb .sep { display: none; }

  .main-content { padding: 1.25rem; }
  .page-bindings iframe { min-height: calc(100vh - 80px); }
  html.bindings-page .main-content { padding: 0; margin: 0; }

  .main-footer {
    padding: 0.75rem 1.25rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .gesture-grid { grid-template-columns: 1fr 1fr; }
  .gesture-detail-grid { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: 1fr 1fr 1fr; gap: 0.4rem; }
  .hero-stat { padding: 0.6rem 0.5rem; }
  .hero-stat .hs-value { font-size: 1rem; }

  .toast-container { bottom: 0.75rem; right: 0.75rem; left: 0.75rem; }
  .toast { max-width: 100%; }

  .gesture-item { padding: 0.5rem 0.6rem; }
  .binding-item { flex-wrap: wrap; }
  .bi-controls { width: 100%; margin-top: 0.3rem; }

  .dash-welcome { flex-direction: column; gap: 1rem; text-align: center; padding: 1.5rem; }
  .dash-welcome-actions { justify-content: center; }
  .dash-stats { grid-template-columns: 1fr; }
  .dash-grid-2 { grid-template-columns: 1fr; }
  .dash-gesture-chips { grid-template-columns: 1fr 1fr; }
}

/* Phone */
@media (max-width: 480px) {
  .hero-stats { grid-template-columns: 1fr; }
  .tip-chip { flex-direction: column; text-align: center; }
}


/* ── 9. Accessibility ─────────────────────────────────────────────────── */

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

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

@media (prefers-color-scheme: light) {
  :root {
    --bg-deepest: #f0f2f5;
    --bg-dark:    #f5f7fa;
    --bg-mid:     #e8ecf1;
    --bg-card:    rgba(255, 255, 255, 0.7);
    --bg-hover:   rgba(0, 0, 0, 0.04);
    --border:     rgba(0, 0, 0, 0.06);
    --border-hov: rgba(0, 0, 0, 0.12);
    --text-pri:   #1a1d23;
    --text-sec:   rgba(80, 95, 120, 0.55);
    --text-inv:   #e4ecf7;
    --accent:     #00c97a;
    --accent2:    #0099cc;
    --accent3:    #6b3fa0;
    --accent4:    #cc5577;
    --accent5:    #c9a030;
    --red:        #e53935;
    --shadow:     0 8px 40px rgba(0, 0, 0, 0.06);
    --glow-text:  0 0 30px rgba(0, 201, 122, 0.15);
  }
}


/* ── 10. Utility Classes ──────────────────────────────────────────────── */

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

/* Grid */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.col-span-full { grid-column: 1 / -1; }

/* Gap */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

/* Margin */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: 0.55rem; }
.text-sm { font-size: 0.68rem; }
.text-base { font-size: 0.76rem; }
.text-lg { font-size: 0.9rem; }
.text-xl { font-size: 1.05rem; }
.text-sec { color: var(--text-sec); }
.text-accent { color: var(--accent); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.uppercase { text-transform: uppercase; }

/* Width / Height */
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Rounded */
.rounded { border-radius: var(--radius); }
.rounded-sm { border-radius: 8px; }
.rounded-full { border-radius: 9999px; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.02) 25%, rgba(255, 255, 255, 0.06) 50%, rgba(255, 255, 255, 0.02) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

.light .skeleton {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.04) 25%, rgba(0, 0, 0, 0.08) 50%, rgba(0, 0, 0, 0.04) 75%);
  background-size: 200% 100%;
}

/* Tooltip */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-mid);
  border: 1px solid var(--border-hov);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-pri);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ── 9. UI Polish ─────────────────────────────────────────────────────── */

/* Smooth focus states */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(0, 245, 160, 0.08);
}

/* Button hover lift */
.btn:hover, button:not(.toggle):hover {
  transform: translateY(-1px);
}

.btn:active, button:active {
  transform: translateY(0) scale(0.98);
}

/* Card hover glow */
.card:hover {
  border-color: var(--border-hov);
}

/* Toggle switch polish */
.toggle {
  transition: background 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toggle:hover {
  filter: brightness(1.1);
}

/* Smooth page transitions */
.page {
  animation: fadeSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Badge pulse for active states */
.badge-pulse {
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 245, 160, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(0, 245, 160, 0); }
}

/* Setting row hover */
.setting-row:hover {
  background: var(--bg-hover);
}

.setting-row {
  transition: background 0.15s;
}

/* Gesture item hover animation */
.gesture-item:hover {
  transform: translateX(2px);
}

.gesture-item {
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Smooth scrollbar appearance */
::-webkit-scrollbar {
  transition: width 0.2s;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s;
}

/* Loading spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0,0,0,0.15);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 0.3rem;
}

/* Voice mic animation */
@keyframes micBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.vh-icon.listening {
  animation: micBounce 1s ease-in-out infinite;
}

/* Smooth color transitions for theme */
* {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 0s;
}

.transition-theme * {
  transition-duration: 0.35s;
}
