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

    .subtitle {
      margin: 0;
      max-width: 1100px;
      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, 1.12fr) minmax(380px, .88fr);
      gap: 18px;
      align-items: start;
    }

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

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

    textarea {
      width: 100%;
      min-height: 230px;
      resize: vertical;
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 13px 14px;
      font: inherit;
      line-height: 1.5;
      color: var(--text);
      background: #fbfcfe;
      outline: none;
    }

    textarea:focus {
      border-color: #8db9ff;
      box-shadow: 0 0 0 3px rgba(13,110,253,.10);
    }

    .actions {
      display: flex;
      flex-wrap: wrap;
      gap: 9px;
      margin-top: 11px;
    }

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

    .status {
      margin-top: 12px;
      padding: 12px 13px;
      border-radius: 13px;
      background: #f5f8fc;
      color: #526171;
      font-size: .86rem;
      line-height: 1.45;
    }

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

    .progress {
      margin-top: 8px;
      height: 9px;
      border-radius: 999px;
      overflow: hidden;
      background: #e7edf4;
    }

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

    .fact-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 9px;
      margin-top: 14px;
    }

    .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.06rem;
      font-weight: 900;
    }

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

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

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

    .highlight {
      background: #fff8e8;
      color: #664b0d;
      border: 1px solid #f0dfad;
    }

    .results-card {
      margin-top: 18px;
    }

    .results-head {
      padding: 18px 18px 0;
    }

    .results-head h2 {
      margin: 0 0 5px;
      font-size: 1.28rem;
    }

    .results-head p {
      margin: 0;
      color: var(--muted);
      line-height: 1.45;
      font-size: .9rem;
    }

    .viz-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
      gap: 16px;
      padding: 16px 18px 18px;
    }

    .subcard {
      border: 1px solid var(--line);
      border-radius: 16px;
      overflow: hidden;
      background: #fbfcfe;
    }

    .subcard h3 {
      margin: 0;
      padding: 13px 14px 6px;
      font-size: 1rem;
    }

    .subcard .hint {
      padding: 0 14px 10px;
      color: var(--muted);
      font-size: .8rem;
      line-height: 1.4;
    }

    #mapCanvas {
      display: block;
      width: 100%;
      height: 480px;
      background: #fbfcfe;
    }

    .pairs {
      padding: 0 12px 12px;
      display: grid;
      gap: 8px;
    }

    .pair {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 10px;
      align-items: center;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: #fff;
    }

    .pair .texts {
      min-width: 0;
      font-size: .86rem;
      line-height: 1.35;
    }

    .pair .texts div {
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .pair .score {
      min-width: 58px;
      text-align: right;
      font-weight: 900;
      font-variant-numeric: tabular-nums;
    }

    .matrix-wrap {
      overflow-x: auto;
      padding: 0 12px 12px;
    }

    table {
      border-collapse: separate;
      border-spacing: 3px;
      width: max-content;
      min-width: 100%;
      font-size: .78rem;
    }

    th, td {
      padding: 7px 8px;
      border-radius: 7px;
      text-align: center;
      white-space: nowrap;
    }

    th {
      color: var(--muted);
      font-weight: 750;
      background: #f0f3f7;
    }

    td {
      font-weight: 750;
      border: 1px solid rgba(0,0,0,.025);
    }

    .vector-wrap {
      padding: 0 14px 14px;
    }

    select {
      width: 100%;
      margin-bottom: 10px;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 9px 10px;
      background: #fff;
      color: var(--text);
      font: inherit;
    }

    #vectorCanvas {
      display: block;
      width: 100%;
      height: 180px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #fff;
    }

    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, .viz-grid { grid-template-columns: 1fr; }
    }

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

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

      .tagline { display: none; }
      .fact-grid { grid-template-columns: 1fr; }
      #mapCanvas { height: 390px; }
    }
  