  :root {
    --bg: #0a0a0f;
    --surface: #111118;
    --border: #1e1e2e;
    --accent: #00ff88;
    --accent2: #7c3aed;
    --text: #e2e8f0;
    --muted: #64748b;
    --danger: #ff4466;
    --warn: #f59e0b;
  }

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

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Syne', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
  }

  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
      linear-gradient(rgba(0,255,136,0.03) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0,255,136,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
  }

  header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(10,10,15,0.9);
    backdrop-filter: blur(12px);
  }

  .logo {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.2em;
    color: var(--accent);
    text-transform: uppercase;
  }

  .logo span { color: var(--muted); }

  .role-badge {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
    padding: 4px 12px;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 2px;
  }

  main {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    gap: 32px;
  }

  /* ── IDLE STATE ── */
  .idle-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 480px;
    width: 100%;
    text-align: center;
  }

  .idle-icon {
    width: 80px; height: 80px;
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    font-size: 32px;
  }

  .idle-state h1 {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  .idle-state h1 em {
    font-style: normal;
    color: var(--accent);
  }

  .idle-state p {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
  }

  /* ── BUTTONS ── */
  .btn {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 14px 28px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .btn-primary {
    background: var(--accent);
    color: #0a0a0f;
    font-weight: 700;
  }
  .btn-primary:hover { background: #00e87a; transform: translateY(-1px); box-shadow: 0 0 24px rgba(0,255,136,0.3); }
  .btn-primary:active { transform: translateY(0); }

  .btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
  }
  .btn-danger:hover { background: rgba(255,68,102,0.1); }

  .btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

  /* ── SESSION PANEL ── */
  .session-panel {
    display: none;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 760px;
  }

  .session-panel.visible { display: flex; }

  .info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }

  .info-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
  }

  .info-value {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    color: var(--text);
    word-break: break-all;
  }

  .copy-btn {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
  }
  .copy-btn:hover { border-color: var(--accent); color: var(--accent); }

  /* ── STATUS BAR ── */
  .status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
  }

  .status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
    transition: background 0.3s;
  }
  .status-dot.waiting { background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: pulse 1.5s infinite; }
  .status-dot.active { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 2s infinite; }
  .status-dot.ended { background: var(--danger); }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
  }

  .status-text { color: var(--muted); }
  .status-text strong { color: var(--text); }

  /* ── PREVIEW ── */
  .preview-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 16/9;
    width: 100%;
  }

  .preview-container video,
  .preview-container canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  .preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  .preview-overlay .overlay-icon { font-size: 36px; opacity: 0.4; }

  /* live indicator */
  .live-badge {
    position: absolute;
    top: 12px; right: 12px;
    background: var(--danger);
    color: white;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.15em;
    padding: 3px 8px;
    border-radius: 2px;
    display: none;
  }
  .live-badge.visible { display: block; animation: pulse 1.5s infinite; }

  /* ── CONTROLS ── */
  .controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
  }

  /* ── STATS ── */
  .stats-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
  }
  .stat-chip {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--muted);
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 3px;
  }
  .stat-chip span { color: var(--accent); }

  /* ── LOG ── */
  .log {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    line-height: 1.8;
    color: var(--muted);
    max-height: 120px;
    overflow-y: auto;
  }
  .log-entry { display: flex; gap: 10px; }
  .log-time { color: var(--border); flex-shrink: 0; }
  .log-entry.ok .log-msg { color: var(--accent); }
  .log-entry.err .log-msg { color: var(--danger); }
  .log-entry.info .log-msg { color: var(--text); }