  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --bg: #000000;
    --surface: #111111;
    --surface2: #1c1c1c;
    --border: rgba(255,255,255,0.08);
    --border2: rgba(255,255,255,0.2);
    --text: #ffffff;
    --muted: #999999;
    --green: #cc0000;
    --green-light: #ff2222;
    --green-dim: rgba(204,0,0,0.15);
    --amber: #ff5555;
    --amber-dim: rgba(255,85,85,0.15);
  }
  html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: 'Syne', sans-serif; }
  body { display: flex; flex-direction: column; height: 100vh; }

  header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 24px; border-bottom: 1px solid var(--border);
    background: var(--surface); flex-shrink: 0;
  }
  .logo { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
  .logo span { color: var(--green-light); }
  #status-pill {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border2);
    background: var(--surface2); font-size: 12px; color: var(--muted);
    font-family: 'DM Mono', monospace; transition: all 0.3s;
  }
  #status-pill.active { border-color: var(--green); color: var(--green-light); background: var(--green-dim); }
  #status-pill.detecting { border-color: var(--amber); color: var(--amber); background: var(--amber-dim); }
  #dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); transition: background 0.3s; flex-shrink: 0; }
  #status-pill.active #dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
  #status-pill.detecting #dot { background: var(--amber); box-shadow: 0 0 6px var(--amber); animation: pulse 1s infinite; }
  @keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:0.4 } }

  .layout { display: grid; grid-template-columns: 340px 1fr; flex: 1; min-height: 0; overflow: hidden; }

  .left-panel { border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }

  .cam-section { position: relative; background: #000; flex-shrink: 0; }
  #cam { width: 100%; display: block; transform: scaleX(-1); aspect-ratio: 4/3; object-fit: cover; max-height: 255px; }
  #overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: scaleX(-1); pointer-events: none; }

  #gesture-badge {
    position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.8); border: 1px solid var(--border2);
    color: #fff; padding: 4px 14px; border-radius: 999px;
    font-size: 12px; font-family: 'DM Mono', monospace;
    opacity: 0; transition: opacity 0.2s; pointer-events: none; white-space: nowrap;
  }
  #gesture-badge.show { opacity: 1; }

  #hold-bar-wrap { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; }
  #hold-bar { height: 100%; width: 0%; background: var(--green); transition: width 0.05s linear; }

  .gestures-panel { padding: 10px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .panel-title { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; margin-bottom: 7px; }

  .gesture-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
  .gc {
    padding: 6px 6px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface2); text-align: center; transition: all 0.2s;
  }
  .gc .em { font-size: 16px; display: block; margin-bottom: 2px; }
  .gc .gc-name { font-size: 10px; font-weight: 600; color: var(--text); margin-bottom: 1px; }
  .gc .gc-action { font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; }
  .gc.active { border-color: var(--green); background: var(--green-dim); }
  .gc.active .gc-name { color: var(--green-light); }
  .gc.holding { border-color: var(--amber); background: var(--amber-dim); }
  .gc.holding .gc-name { color: var(--amber); }
  .gc-wake { border-color: var(--green) !important; background: var(--green-dim) !important; }
  .gc-wake .gc-name { color: var(--green-light) !important; }
  .gc-wake .gc-action { color: var(--green-light) !important; }
  .gc-locked { opacity: 0.35; }
  .gc-locked .gc-action::before { content: "🔒 "; }
  .gc.unlocked { opacity: 1; }
  #gesture-mode-bar {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 5px 12px; font-size: 11px; font-family: 'DM Mono', monospace;
    background: var(--surface2); border-bottom: 1px solid var(--border);
    color: var(--muted); flex-shrink: 0; transition: all 0.3s;
  }
  #gesture-mode-bar.armed { background: var(--green-dim); color: var(--green-light); border-color: var(--green); }
  #mode-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
  #gesture-mode-bar.armed #mode-dot { background: var(--green-light); box-shadow: 0 0 5px var(--green); animation: pulse 1s infinite; }

  .controls-section { padding: 10px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
  #start-btn {
    width: 100%; padding: 8px; border-radius: 8px;
    background: var(--green); color: #fff; border: none; cursor: pointer;
    font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 600;
    transition: background 0.2s;
  }
  #start-btn:hover { background: #aa0000; }
  #start-btn:disabled { background: var(--surface2); color: var(--muted); cursor: not-allowed; }
  .hint { font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; font-family: 'DM Mono', monospace; }

  .videos-section { padding: 10px 12px; flex: 1; overflow-y: auto; min-height: 0; }
  .vi {
    display: flex; align-items: center; gap: 8px; padding: 7px 9px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface2);
    cursor: pointer; transition: all 0.15s; margin-bottom: 5px;
  }
  .vi:hover { border-color: var(--border2); }
  .vi.current { border-color: var(--green); background: var(--green-dim); }
  .vi-n {
    width: 20px; height: 20px; border-radius: 50%; background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 600; flex-shrink: 0; font-family: 'DM Mono', monospace; color: var(--muted);
  }
  .vi.current .vi-n { background: var(--green); color: #fff; }
  .vi-info { flex: 1; min-width: 0; }
  .vi-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .vi.current .vi-title { color: var(--green-light); }
  .vi-sub { font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; margin-top: 1px; }

  .right-panel { display: flex; flex-direction: column; background: #000; min-height: 0; }
  #video-area { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; min-height: 0; }
  #local-video { position: absolute; inset: 0; width: 100%; height: 100%; display: none; background: #000; object-fit: contain; }
  .no-video { text-align: center; color: var(--muted); }
  .no-video .big-em { font-size: 40px; display: block; margin-bottom: 10px; }
  .no-video p { font-size: 13px; font-family: 'DM Mono', monospace; }
  .no-video .h2 { font-size: 11px; color: #555; margin-top: 6px; }

  .video-info-bar {
    padding: 10px 20px; border-top: 1px solid var(--border); background: var(--surface);
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  }
  .np-label { font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; text-transform: uppercase; letter-spacing: 0.08em; }
  .np-title { font-size: 14px; font-weight: 600; margin-top: 2px; }
  .nav-btns { display: flex; gap: 7px; }
  .nav-btn {
    padding: 6px 13px; border-radius: 7px; border: 1px solid var(--border2);
    background: var(--surface2); color: var(--text); cursor: pointer;
    font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 600; transition: all 0.15s;
  }
  .nav-btn:hover { border-color: var(--green); color: var(--green-light); }

