    :root {
      --bg: #0b0f16;
      --panel: #0f1720;
      --text: #e6edf3;
      --muted: #90a0b0;
      --accent: #5eead4;
      --danger: #ff6b6b;
      --success: #4ade80;
      --warning: #fbbf24;
    }

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

    html, body {
      height: 100%;
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

    body {
      background: linear-gradient(120deg, #071017, #071827 60%, #08111a);
      color: var(--text);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    header {
      padding: 14px 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    header h1 {
      margin: 0;
      font-size: clamp(16px, 2.2vw, 20px);
      letter-spacing: .2px;
      color: var(--accent);
    }

    .status {
      font-size: 13px;
      color: var(--muted);
    }

    .wrap {
      display: grid;
      grid-template-columns: 1.6fr .9fr;
      gap: 14px;
      padding: 14px;
      align-items: start;
      flex-grow: 1;
    }

    @media (max-width: 900px) {
      .wrap {
        grid-template-columns: 1fr;
      }
      .sidebar {
        order: 2;
      }
    }

    .stage {
      position: relative;
      border-radius: 12px;
      overflow: hidden;
      background: #000;
      box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
      min-height: 420px;
      aspect-ratio: 16/9;
    }

    video {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      transform: scaleX(-1);
    }

    canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
    }

    .hud {
      position: absolute;
      left: 12px;
      bottom: 12px;
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
      padding: 10px;
      border-radius: 10px;
      background: rgba(4, 8, 12, .45);
      backdrop-filter: blur(6px);
    }

    .controls {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
      padding: 12px;
      border-radius: 10px;
      background: var(--panel);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
    }

    .controls label {
      font-size: 13px;
      color: var(--muted);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    button, select, input[type="color"], input[type="range"], input[type="text"] {
      border-radius: 10px;
      border: none;
      padding: 8px 10px;
      background: #0b1622;
      color: var(--text);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02);
      cursor: pointer;
      transition: all 0.2s ease;
    }

    button:hover {
      background: #102035;
    }

    button.primary {
      background: linear-gradient(180deg, #0f2340, #0b1a30);
    }

    button.ghost {
      background: transparent;
      border: 1px solid rgba(255, 255, 255, .03);
    }

    button:disabled {
      opacity: .6;
      cursor: not-allowed;
    }

    .sidebar {
      padding: 12px;
      border-radius: 12px;
      background: linear-gradient(180deg, rgba(255, 255, 255, .01), transparent);
      box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    }

    .panel {
      margin-bottom: 12px;
      background: var(--panel);
      border-radius: 8px;
      padding: 16px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
    }

    .panel h3 {
      margin: 0 0 12px 0;
      font-size: 13px;
      color: var(--muted);
      border-bottom: 1px solid rgba(255, 255, 255, .05);
      padding-bottom: 8px;
    }

    .preview {
      width: 100%;
      height: 200px;
      border-radius: 8px;
      background: #071019;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }

    .preview img {
      max-width: 100%;
      max-height: 100%;
      display: block;
    }

    .note-list {
      max-height: 160px;
      overflow-y: auto;
      padding: 6px;
      border-radius: 8px;
      background: rgba(0, 0, 0, .2);
    }

    .note-item {
      padding: 8px;
      border-radius: 6px;
      margin-bottom: 6px;
      background: rgba(255, 255, 255, .02);
      font-size: 13px;
      cursor: pointer;
      transition: background-color 0.2s ease;
    }

    .note-item:hover {
      background: rgba(255, 255, 255, .05);
    }

    .legend {
      position: absolute;
      right: 12px;
      bottom: 12px;
      padding: 8px 10px;
      background: rgba(10, 14, 22, .6);
      border-radius: 10px;
      font-size: 12px;
      color: var(--muted);
    }

    .legend b {
      color: var(--text);
    }

    footer {
      padding: 10px 16px;
      color: var(--muted);
      font-size: 12px;
      text-align: center;
      border-top: 1px solid rgba(255, 255, 255, .05);
    }

    .fallback {
      padding: 10px;
      border-radius: 8px;
      background: rgba(255, 255, 255, .02);
      margin-top: 8px;
    }

    .small {
      font-size: 12px;
      color: var(--muted);
    }

    .loading-spinner {
      border: 3px solid rgba(94, 234, 212, 0.3);
      border-radius: 50%;
      border-top: 3px solid var(--accent);
      width: 24px;
      height: 24px;
      animation: spin 1s linear infinite;
      margin-right: 8px;
    }

    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

    .pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 8px;
      border-radius: 20px;
      background: rgba(255, 255, 255, .05);
      font-size: 12px;
    }

    .notification {
      position: fixed;
      top: 20px;
      right: 20px;
      padding: 12px 16px;
      border-radius: 8px;
      background: var(--panel);
      box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
      z-index: 1000;
      transform: translateX(100%);
      transition: transform 0.3s ease;
    }

    .notification.show {
      transform: translateX(0);
    }

    .notification.success {
      border-left: 4px solid var(--success);
    }

    .notification.error {
      border-left: 4px solid var(--danger);
    }