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

    * { box-sizing: border-box; }

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

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

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

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

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

    .hero {
      margin-bottom: 18px;
    }

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

    .subtitle {
      max-width: 980px;
      margin: 0;
      color: var(--muted);
      line-height: 1.48;
      font-size: clamp(1rem, 1.35vw, 1.17rem);
    }

    .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;
    }

    .camera-card {
      min-width: 0;
    }

    .camera-wrap {
      position: relative;
      width: 100%;
      aspect-ratio: 16 / 9;
      min-height: 480px;
      background:
        radial-gradient(circle at center, #1b1b1b 0, #0c0c0c 75%);
      overflow: hidden;
    }

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

    canvas { pointer-events: none; }

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

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

    .result-badge {
      position: absolute;
      right: 16px;
      top: 16px;
      z-index: 5;
      min-width: 210px;
      padding: 13px 16px;
      border-radius: 17px;
      background: rgba(255,255,255,.94);
      box-shadow: 0 9px 28px rgba(0,0,0,.18);
      text-align: center;
      backdrop-filter: blur(8px);
    }

    .result-badge .small {
      display: block;
      color: var(--muted);
      font-size: .78rem;
    }

    .result-badge .big {
      display: block;
      margin-top: 1px;
      font-size: 1.9rem;
      line-height: 1.05;
      font-weight: 900;
      letter-spacing: -.03em;
    }

    .result-badge .conf {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: .88rem;
    }

    .camera-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: .88rem;
    }

    button {
      appearance: none;
      border: 0;
      border-radius: 13px;
      padding: 12px 15px;
      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 {
      color: #fff;
      background: var(--accent);
    }

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

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

    .danger {
      color: var(--danger);
      background: #fff0ef;
    }

    .panel {
      padding: 18px;
    }

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

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

    .class-stack {
      display: grid;
      gap: 10px;
    }

    .class-row {
      display: grid;
      grid-template-columns: 1fr;
      gap: 9px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: #fbfcfe;
    }

    .class-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
    }

    .class-name {
      font-weight: 900;
      font-size: 1rem;
    }

    .count {
      color: var(--muted);
      font-size: .84rem;
    }

    .train-btn {
      width: 100%;
      padding: 10px 12px;
      background: #edf4ff;
      color: #18529d;
    }

    .train-btn.recording {
      background: #dff5ea;
      color: #146a46;
    }

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

    .recognition-box {
      display: grid;
      gap: 9px;
    }

    .recognition-box button {
      width: 100%;
    }

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

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

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

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

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

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

    footer {
      width: min(1600px, calc(100% - 34px));
      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;
    }

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

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

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

      .panel .divider { display: none; }

      .camera-wrap {
        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; }

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

      .panel {
        display: block;
      }

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

      .panel .divider { display: block; }

      .result-badge {
        min-width: 155px;
      }

      .result-badge .big {
        font-size: 1.45rem;
      }

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