
    :root {
      --bg: #f3f6fa;
      --card: #ffffff;
      --text: #16202a;
      --muted: #627080;
      --line: #d9e1ea;
      --accent: #0d6efd;
      --accent-dark: #084fbe;
      --good: #15805a;
      --warn: #a36a00;
      --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.4vw, 3.8rem);
      line-height: 1;
      letter-spacing: -.05em;
    }

    .subtitle {
      margin: 0;
      max-width: 1050px;
      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) 430px;
      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:
        radial-gradient(circle at center, #1a1d22 0, #0d1117 75%);
      overflow: hidden;
      display: grid;
      place-items: center;
    }

    #previewImage, #video {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: contain;
      background: #0d1117;
    }

    #video {
      transform: scaleX(-1);
      display: none;
    }

    .placeholder {
      padding: 40px;
      max-width: 760px;
      text-align: center;
      color: #c8d2dc;
      line-height: 1.55;
    }

    .placeholder .big {
      display: block;
      margin-bottom: 8px;
      color: #fff;
      font-size: clamp(1.5rem, 2.4vw, 2.5rem);
      font-weight: 900;
      letter-spacing: -.03em;
    }

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

    .source-pill {
      position: absolute;
      right: 16px;
      top: 16px;
      z-index: 8;
      min-width: 130px;
      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);
    }

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

    button, .upload-label {
      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;
      text-decoration: none;
    }

    button:hover:not(:disabled), .upload-label:hover {
      transform: translateY(-1px);
    }

    button:active:not(:disabled), .upload-label:active {
      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, .upload-label {
      background: #edf2f7;
      color: var(--text);
    }

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

    input[type="file"] { display: none; }

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

    .results {
      display: grid;
      gap: 10px;
      min-height: 290px;
    }

    .empty-result {
      padding: 24px;
      border: 1px dashed var(--line);
      border-radius: 15px;
      color: var(--muted);
      text-align: center;
      line-height: 1.5;
      background: #fbfcfe;
    }

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

    .result-topline {
      display: grid;
      grid-template-columns: 42px 1fr auto;
      gap: 10px;
      align-items: center;
      margin-bottom: 8px;
    }

    .rank {
      display: grid;
      place-items: center;
      width: 34px;
      height: 34px;
      border-radius: 10px;
      background: #eaf2ff;
      color: var(--accent-dark);
      font-weight: 900;
    }

    .class-name {
      min-width: 0;
      font-weight: 850;
      line-height: 1.25;
      overflow-wrap: anywhere;
    }

    .probability {
      font-variant-numeric: tabular-nums;
      font-weight: 900;
    }

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

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

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

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

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

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

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

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

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

    .info.highlight {
      background: #fff8e8;
      color: #6a4c06;
      border: 1px solid #f1dfae;
    }

    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: 1100px) {
      .layout { grid-template-columns: 1fr; }
      .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;
      }

      .fact-grid { grid-template-columns: 1fr; }

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