:root {
      color-scheme: dark;
      --bg: #0b0d12;
      --panel: #141821;
      --panel-strong: #1a202c;
      --line: #2a3140;
      --text: #edf2ff;
      --muted: #9aa6bb;
      --accent: #9146ff;
      --accent-strong: #a970ff;
      --ok: #42d392;
      --danger: #ff6678;
      --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      background:
        radial-gradient(circle at top left, rgba(145, 70, 255, 0.18), transparent 34rem),
        linear-gradient(180deg, #10131a 0%, var(--bg) 38%);
      color: var(--text);
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    button,
    input {
      font: inherit;
    }

    .page {
      width: min(1180px, calc(100% - 32px));
      margin: 0 auto;
      padding: 42px 0 54px;
    }

    .topbar {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 24px;
      align-items: end;
      margin-bottom: 28px;
    }

    .eyebrow {
      margin: 0 0 8px;
      color: var(--accent-strong);
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 0;
      text-transform: uppercase;
    }

    h1 {
      margin: 0;
      font-size: clamp(32px, 5vw, 56px);
      line-height: 1;
      letter-spacing: 0;
    }

    .subtitle {
      max-width: 660px;
      margin: 14px 0 0;
      color: var(--muted);
      font-size: 16px;
      line-height: 1.55;
    }

    .controls {
      display: grid;
      gap: 10px;
      justify-items: end;
      min-width: 320px;
    }

    .language-switch {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
      justify-content: flex-end;
      color: var(--muted);
      font-size: 13px;
      font-weight: 800;
      letter-spacing: 0;
    }

    .language-switch a {
      border: 0;
      background: transparent;
      color: var(--muted);
      font-weight: 800;
      padding: 0;
      cursor: pointer;
      text-decoration: none;
    }

    .language-switch a:hover,
    .language-switch a.active {
      color: var(--accent-strong);
      text-decoration: underline;
      text-underline-offset: 4px;
    }

    .filter-title {
      color: var(--muted);
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 0;
      text-transform: uppercase;
    }

    .region-list {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: flex-end;
      max-width: 460px;
    }

    .region-option {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      min-height: 36px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      color: var(--text);
      padding: 0 12px;
      cursor: pointer;
      user-select: none;
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    }

    .region-option:has(input:checked) {
      border-color: rgba(145, 70, 255, 0.7);
      background: rgba(145, 70, 255, 0.18);
    }

    .region-option input {
      width: 15px;
      height: 15px;
      accent-color: var(--accent);
      margin: 0;
    }

    .region-list[aria-disabled="true"] {
      opacity: 0.55;
      pointer-events: none;
    }

    .bandwidth-control {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      min-height: 36px;
      justify-self: end;
      border: 1px solid rgba(255, 149, 0, 0.58);
      border-radius: 8px;
      background: rgba(255, 149, 0, 0.12);
      color: var(--text);
      padding: 0 12px;
      font-size: 14px;
      font-weight: 800;
    }

    .bandwidth-label {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      user-select: none;
    }

    .bandwidth-label input {
      width: 15px;
      height: 15px;
      accent-color: #ff9500;
      margin: 0;
    }

    .tooltip {
      position: relative;
      display: inline-grid;
      place-items: center;
      width: 18px;
      height: 18px;
      border: 1px solid rgba(255, 149, 0, 0.72);
      border-radius: 999px;
      color: #ffb347;
      font-size: 12px;
      line-height: 1;
      cursor: help;
    }

    .tooltip-text {
      position: absolute;
      z-index: 5;
      right: 0;
      top: calc(100% + 10px);
      width: min(320px, calc(100vw - 32px));
      border: 1px solid rgba(255, 149, 0, 0.48);
      border-radius: 8px;
      background: #16120d;
      color: var(--text);
      padding: 12px;
      font-size: 13px;
      font-weight: 500;
      line-height: 1.45;
      text-align: left;
      white-space: pre-line;
      box-shadow: var(--shadow);
      opacity: 0;
      pointer-events: none;
      transform: translateY(-4px);
      transition: opacity 150ms ease, transform 150ms ease;
    }

    .tooltip:hover .tooltip-text,
    .tooltip:focus-within .tooltip-text {
      opacity: 1;
      transform: translateY(0);
    }

    .status {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      min-height: 48px;
      margin-bottom: 18px;
      color: var(--muted);
      font-size: 14px;
    }

    .help-callout {
      margin: 6px 0 24px;
      color: var(--text);
      font-size: clamp(24px, 3.2vw, 38px);
      font-weight: 800;
      line-height: 1.16;
      letter-spacing: 0;
      text-align: center;
    }

    .help-callout a {
      color: var(--accent-strong);
      font-weight: 900;
      text-decoration: none;
    }

    .help-callout a:hover {
      text-decoration: underline;
      text-underline-offset: 5px;
    }

    .retry {
      display: none;
      min-height: 36px;
      border: 1px solid rgba(145, 70, 255, 0.55);
      border-radius: 8px;
      background: rgba(145, 70, 255, 0.14);
      color: var(--text);
      padding: 0 14px;
      cursor: pointer;
    }

    .retry:hover {
      border-color: var(--accent-strong);
      background: rgba(145, 70, 255, 0.22);
    }

    .grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 16px;
    }

    .card {
      min-width: 0;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 42%), var(--panel);
      box-shadow: var(--shadow);
      overflow: hidden;
    }

    .card-head {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: start;
      padding: 18px 18px 14px;
      border-bottom: 1px solid rgba(42, 49, 64, 0.82);
    }

    .title {
      min-width: 0;
      margin: 0;
      font-size: 18px;
      line-height: 1.25;
      letter-spacing: 0;
      overflow-wrap: anywhere;
    }

    .meta {
      color: var(--muted);
      font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
      font-size: 13px;
      white-space: nowrap;
    }

    .fields {
      display: grid;
      gap: 14px;
      padding: 14px;
    }

    .url-block {
      display: grid;
      gap: 7px;
    }

    .scheme-title {
      color: var(--text);
      font-size: 13px;
      font-weight: 800;
      letter-spacing: 0;
    }

    .hint {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.4;
    }

    .field {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 38px;
      gap: 10px;
      align-items: stretch;
      min-height: 54px;
      border: 1px solid rgba(42, 49, 64, 0.9);
      border-radius: 8px;
      background: var(--panel-strong);
      padding: 8px;
    }

    .url {
      align-self: center;
      min-width: 0;
      color: #dbe4f8;
      font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
      font-size: 13px;
      line-height: 1.45;
      overflow-wrap: anywhere;
    }

    .copy {
      display: inline-grid;
      place-items: center;
      width: 38px;
      min-width: 38px;
      border: 1px solid rgba(154, 166, 187, 0.28);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.05);
      color: var(--text);
      cursor: pointer;
      transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
    }

    .copy:hover {
      border-color: var(--accent-strong);
      background: rgba(145, 70, 255, 0.16);
    }

    .copy.copied {
      border-color: rgba(66, 211, 146, 0.75);
      color: var(--ok);
    }

    .empty {
      display: none;
      border: 1px dashed var(--line);
      border-radius: 8px;
      color: var(--muted);
      padding: 28px;
      text-align: center;
    }

    .footer-badge {
      width: fit-content;
      max-width: 100%;
      margin: 28px auto 0;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(20, 24, 33, 0.78);
      color: var(--muted);
      padding: 12px 16px;
      text-align: center;
      font-size: 14px;
      line-height: 1.45;
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
    }

    .footer-badge a {
      color: #ffc0cb;
      font-weight: 900;
      text-decoration: none;
    }

    .footer-badge a:hover {
      text-decoration: underline;
      text-underline-offset: 4px;
    }

    .error {
      color: var(--danger);
    }

    @media (max-width: 820px) {
      .page {
        width: min(100% - 24px, 680px);
        padding-top: 28px;
      }

      .topbar {
        grid-template-columns: 1fr;
        align-items: start;
      }

      .controls {
        justify-items: stretch;
        min-width: 0;
        width: 100%;
      }

      .region-list {
        justify-content: flex-start;
        max-width: none;
      }

      .bandwidth-control {
        justify-self: start;
      }

      .tooltip-text {
        left: 0;
        right: auto;
      }

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