
  :root {
    --bg: #0f0f1a;
    --surface: #1a1a2e;
    --border: #2a2a4a;
    --text: #e0e0f0;
    --text-muted: #9090b0;
    --accent: #6c5ce7;
    --accent-hover: #7f6ff0;
    --success: #00d68f;
    --warning: #ffaa00;
    --error: #ff4757;
    --info: #54a0ff;
    --radius: 8px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
  }
  .container { max-width: 860px; margin: 0 auto; }

  header { text-align: center; margin-bottom: 32px; }
  header h1 { font-size: 1.8rem; color: var(--accent); margin-bottom: 4px; }
  header p { color: var(--text-muted); font-size: 0.95rem; }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
  }
  .card-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 12px;
  }

  /* Input section */
  .input-row {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .input-row input[type="text"] {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
  }
  .input-row input[type="text"]:focus { border-color: var(--accent); }
  .input-row input[type="text"]::placeholder { color: var(--text-muted); }

  .btn {
    border: none;
    border-radius: var(--radius);
    padding: 10px 18px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    white-space: nowrap;
  }
  .btn-primary { background: var(--accent); color: #fff; }
  .btn-primary:hover { background: var(--accent-hover); }
  .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
  .btn-success { background: var(--success); color: #000; }
  .btn-success:hover { opacity: 0.85; }
  .btn-danger { background: var(--error); color: #fff; }
  .btn-danger:hover { opacity: 0.85; }
  .btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
  }
  .btn-outline:hover { border-color: var(--accent); color: var(--accent); }
  .btn-sm { padding: 6px 12px; font-size: 0.8rem; }

  /* Connection status */
  #connection-status { display: none; }
  #connection-status.visible { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .status-dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex-shrink: 0;
  }
  .status-dot.disconnected { background: var(--text-muted); }
  .status-dot.connecting { background: var(--warning); animation: pulse 1s infinite; }
  .status-dot.connected { background: var(--success); }
  .status-dot.error { background: var(--error); }
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
  }
  .status-text { font-size: 0.9rem; }
  .status-latency { font-size: 0.8rem; color: var(--text-muted); }

  /* Report section */
  #report-section { display: none; }
  #report-section.visible { display: block; }
  .report-loading { text-align: center; color: var(--text-muted); padding: 20px; }
  .report-error { color: var(--error); padding: 8px 0; }
  .report-fallback { margin-top: 12px; }
  .report-fallback textarea {
    width: 100%;
    min-height: 120px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
  }
  .report-item { padding: 3px 0; }
  .report-item.label { color: var(--text-muted); font-size: 0.85rem; }
  .report-feature {
    display: inline-block;
    background: rgba(108, 92, 231, 0.15);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 4px;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    font-size: 0.85rem;
    cursor: help;
  }
  .report-feature.obscure {
    background: rgba(144, 144, 176, 0.12);
    border-color: rgba(144, 144, 176, 0.2);
  }
  .report-limitation { font-size: 0.9rem; padding: 2px 0; }
  .report-limitation .lim-label { color: var(--text-muted); }

  /* Caveat notice — NIP-11 accuracy warning */
  .report-caveat {
    margin: 12px 0;
    padding: 12px 14px;
    background: rgba(255, 170, 0, 0.12);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
  }

  /* Policy badges */
  .policy-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 6px 0; }
  .policy-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
  }
  .policy-free { background: rgba(0, 214, 143, 0.15); color: var(--success); border: 1px solid rgba(0, 214, 143, 0.3); }
  .policy-open { background: rgba(84, 160, 255, 0.12); color: var(--info); border: 1px solid rgba(84, 160, 255, 0.25); }
  .policy-restricted { background: rgba(255, 170, 0, 0.15); color: var(--warning); border: 1px solid rgba(255, 170, 0, 0.3); }

  /* Tests section */
  #tests-section { display: none; }
  #tests-section.visible { display: block; }
  .test-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
  .test-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
  }
  .test-item:hover { background: rgba(255,255,255,0.03); }
  .test-item input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
  }
  .test-item label {
    cursor: pointer;
    flex: 1;
    font-size: 0.95rem;
  }
  .test-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .test-count { font-size: 0.85rem; color: var(--text-muted); }

  /* Delay slider */
  .delay-control {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
  .delay-control label {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
  }
  .delay-control input[type="range"] {
    width: 100%;
    max-width: 300px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
  }
  .delay-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
  }
  .delay-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
  }
  #delay-value { color: var(--text); font-weight: bold; }

  /* Results section */
  #results-section { display: none; }
  #results-section.visible { display: block; }
  .result-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.95rem;
  }
  .result-item.running { background: rgba(84, 160, 255, 0.08); }
  .result-item.success { background: rgba(0, 214, 143, 0.08); }
  .result-item.failure { background: rgba(255, 71, 87, 0.08); }
  .result-item.skipped { background: rgba(144, 144, 176, 0.06); }
  .result-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
  .result-body { flex: 1; min-width: 0; }
  .result-title { font-weight: 500; }
  .result-detail { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
  .result-timing { font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; }
  .result-guidance {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(84, 160, 255, 0.1);
    border-left: 3px solid var(--info);
    border-radius: 4px;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text);
  }

  /* Tip jar */
  .tip-jar {
    text-align: center;
    padding: 24px 0 12px 0;
    font-size: 0.85rem;
  }
  .tip-jar a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
  }
  .tip-jar a:hover {
    color: var(--accent);
  }

  /* Responsive */
  @media (max-width: 600px) {
    .input-row { flex-direction: column; }
    .input-row .btn { width: 100%; }
    body { padding: 12px; }
    .card { padding: 14px 16px; }
  }


