
    :root {
      --bg: #f3f6fa;
      --card: #ffffff;
      --text: #16202a;
      --muted: #617083;
      --line: #d9e1ea;
      --accent: #0d6efd;
      --accent-dark: #084fbe;
      --good: #15805a;
      --warn: #9a6500;
      --danger: #b42318;
      --shadow: 0 16px 42px rgba(31,46,61,.10);
      --radius: 20px;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: var(--text);
      background:
        radial-gradient(circle at 8% 0%, #eaf3ff 0, transparent 28%),
        radial-gradient(circle at 100% 10%, #edf8f4 0, transparent 30%),
        var(--bg);
    }

    .topbar {
      min-height: 70px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      padding: 14px clamp(18px, 3vw, 56px);
      background: rgba(255,255,255,.92);
      backdrop-filter: blur(12px);
      border-bottom: 1px solid var(--line);
    }

    .brand {
      color: var(--accent-dark);
      text-decoration: none;
      font-size: clamp(1.5rem, 2vw, 2.1rem);
      font-weight: 900;
      letter-spacing: -.04em;
    }

    .tagline {
      color: var(--muted);
      font-size: .95rem;
    }

    main {
      width: min(1600px, calc(100% - 32px));
      margin: 24px auto 36px;
    }

    .hero {
      margin-bottom: 18px;
    }

    h1 {
      margin: 0 0 6px;
      font-size: clamp(2.2rem, 3.3vw, 3.7rem);
      line-height: 1;
      letter-spacing: -.05em;
    }

    .subtitle {
      margin: 0;
      max-width: 1020px;
      color: var(--muted);
      line-height: 1.5;
      font-size: clamp(1rem, 1.25vw, 1.16rem);
    }

    .error {
      display: none;
      margin: 0 0 16px;
      padding: 14px 16px;
      border: 1px solid #efc6c1;
      border-radius: 14px;
      background: #fff2f0;
      color: #8f1d15;
      line-height: 1.45;
      font-weight: 650;
    }

    .layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 360px;
      gap: 18px;
      align-items: start;
    }

    .card {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      overflow: hidden;
    }

    .stage {
      position: relative;
      width: 100%;
      aspect-ratio: 16 / 9;
      min-height: 500px;
      background: #0d1117;
      overflow: hidden;
    }

    video, #overlay, #avatarCanvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    video, #overlay {
      transform: scaleX(-1);
    }

    #overlay, #avatarCanvas {
      pointer-events: none;
    }

    #avatarCanvas {
      display: none;
      background: linear-gradient(180deg, #eef6ff 0%, #dfeef8 58%, #d7e7df 100%);
    }

    .status-pill {
      position: absolute;
      left: 16px;
      top: 16px;
      z-index: 8;
      padding: 9px 12px;
      border-radius: 999px;
      background: rgba(8,12,16,.76);
      color: #fff;
      font-size: .9rem;
      backdrop-filter: blur(8px);
    }

    .status-pill.ok { background: rgba(13,110,76,.82); }
    .status-pill.loading { background: rgba(116,77,8,.84); }

    .mode-pill {
      position: absolute;
      right: 16px;
      top: 16px;
      z-index: 8;
      min-width: 140px;
      padding: 10px 13px;
      border-radius: 15px;
      background: rgba(255,255,255,.94);
      box-shadow: 0 8px 24px rgba(0,0,0,.18);
      color: var(--text);
      text-align: center;
      font-weight: 850;
      backdrop-filter: blur(8px);
    }

    .stage-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 10px;
      padding: 14px 16px;
      border-top: 1px solid var(--line);
    }

    .tech-status {
      margin-left: auto;
      color: var(--muted);
      font-size: .86rem;
    }

    button {
      appearance: none;
      border: 0;
      border-radius: 13px;
      padding: 11px 14px;
      font: inherit;
      font-weight: 800;
      cursor: pointer;
      transition: transform .08s ease, background .15s ease, opacity .15s ease;
    }

    button:hover:not(:disabled) { transform: translateY(-1px); }
    button:active:not(:disabled) { transform: translateY(0); }
    button:disabled { opacity: .42; cursor: not-allowed; }

    .primary {
      background: var(--accent);
      color: #fff;
    }

    .primary:hover:not(:disabled) { background: var(--accent-dark); }

    .secondary {
      background: #edf2f7;
      color: var(--text);
    }

    .mode-buttons {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
    }

    .mode-button.active {
      background: var(--accent);
      color: #fff;
    }

    .panel {
      padding: 18px;
    }

    .panel h2 {
      margin: 0 0 6px;
      font-size: 1.18rem;
      letter-spacing: -.02em;
    }

    .panel p {
      margin: 0 0 14px;
      color: var(--muted);
      font-size: .92rem;
      line-height: 1.45;
    }

    .divider {
      height: 1px;
      background: var(--line);
      margin: 16px 0;
    }

    .meter-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 9px;
    }

    .metric {
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 13px;
      background: #fbfcfe;
    }

    .metric .label {
      color: var(--muted);
      font-size: .74rem;
    }

    .metric .value {
      margin-top: 3px;
      font-weight: 900;
      font-size: 1.05rem;
    }

    .bar-row {
      margin-top: 11px;
    }

    .bar-label {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 5px;
      color: var(--muted);
      font-size: .82rem;
    }

    .bar {
      height: 9px;
      border-radius: 999px;
      overflow: hidden;
      background: #e9eef4;
    }

    .bar > div {
      width: 0%;
      height: 100%;
      background: var(--accent);
      border-radius: inherit;
      transition: width .08s linear;
    }

    .info {
      margin-top: 14px;
      padding: 12px;
      border-radius: 13px;
      background: #f5f8fc;
      color: #4c5b6b;
      font-size: .84rem;
      line-height: 1.45;
    }

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

    footer {
      width: min(1600px, calc(100% - 32px));
      margin: 0 auto 26px;
      text-align: center;
      color: var(--muted);
      font-size: .92rem;
    }

    footer a {
      display: inline-block;
      margin-top: 4px;
      color: var(--accent-dark);
      text-decoration: none;
      font-size: 1.35rem;
      font-weight: 900;
    }

    .legal-links {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 0 18px;
      margin-top: 10px;
    }

    .legal-links a {
      min-height: 44px;
      display: inline-flex;
      align-items: center;
      margin-top: 0;
      font-size: .92rem;
      font-weight: 600;
    }

    .privacy {
      margin-top: 8px;
      font-size: .82rem;
      line-height: 1.45;
    }

    @media (max-width: 1050px) {
      .layout {
        grid-template-columns: 1fr;
      }

      .panel {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 18px;
      }

      .panel > .panel-section + .panel-section {
        border-left: 1px solid var(--line);
        padding-left: 18px;
      }

      .divider { display: none; }

      .stage { min-height: 420px; }
    }

    @media (max-width: 700px) {
      main {
        width: min(100% - 18px, 1600px);
        margin-top: 16px;
      }

      .topbar {
        min-height: 58px;
        padding: 10px 12px;
      }

      .tagline { display: none; }

      .stage {
        min-height: 300px;
        aspect-ratio: 4 / 3;
      }

      .panel {
        display: block;
      }

      .panel > .panel-section + .panel-section {
        border-left: 0;
        padding-left: 0;
      }

      .divider { display: block; }

      .tech-status {
        width: 100%;
        margin-left: 0;
      }
    }
  