:root {
  --bg: #0a0e14;
  --surface: #11161f;
  --surface-2: #161c27;
  --border: #232b38;
  --text: #f1f4f7;
  --text-secondary: #94a1b2;
  --text-tertiary: #677183;
  --accent: #22b8e8;
  --accent-dim: #1a5e76;
  --success: #4dd4a8;
  --warning: #f2b84d;
  --danger: #f25d5d;
  --radius-md: 8px;
  --radius-lg: 14px;
}
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Intro */
.intro-head { text-align: center; margin-bottom: 1.75rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  background: rgba(124, 109, 242, 0.12);
  padding: 5px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  display: inline-block;
}

h1 { font-size: 26px; font-weight: 600; margin: 0 0 0.6rem; letter-spacing: -0.01em; }
.sub { font-size: 14px; color: var(--text-secondary); margin: 0; }

#audit-form { display: flex; gap: 8px; }

#url-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  padding: 0 14px;
  height: 44px;
}
#url-input:focus { outline: none; border-color: var(--accent); }
#url-input::placeholder { color: var(--text-tertiary); }

#start-btn {
  background: var(--accent);
  border: none;
  color: white;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 0 18px;
  height: 44px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s;
}
#start-btn:hover { opacity: 0.9; }
#start-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-text { color: var(--danger); font-size: 13px; margin: 8px 0 0; }
.fine-print { color: var(--text-tertiary); font-size: 12px; margin: 14px 0 0; }

/* Loading */
#loading-view { text-align: center; padding: 3rem 0; }
.spinner {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  margin: 0 auto 1.5rem;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
#loading-url { color: var(--text-secondary); font-size: 13px; margin: 0 0 1.5rem; }

#steps { display: inline-block; text-align: left; }
.step-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; font-size: 14px; color: var(--text-tertiary);
}
.step-row.active { color: var(--text); font-weight: 600; }
.step-row.done { color: var(--text-secondary); }
.step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.step-row.active .step-dot { background: var(--accent); }
.step-row.done .step-dot { background: var(--success); }

/* Error */
#error-view { text-align: center; padding: 2.5rem 0; }
.error-title { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
#error-detail { color: var(--text-secondary); font-size: 13px; max-width: 420px; margin: 0 auto 1.5rem; }
#retry-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-md); padding: 10px 18px; font-size: 14px; cursor: pointer;
}
#retry-btn:hover { border-color: var(--accent); }

/* Results */
.results-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.results-url { font-size: 12px; color: var(--text-tertiary); margin: 0 0 2px; }
.results-title { font-size: 19px; font-weight: 600; margin: 0; }
#new-check-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-md); padding: 7px 14px; font-size: 13px; cursor: pointer;
}

.score-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; margin-bottom: 1.25rem;
}
.score-card {
  background: var(--surface); border-radius: var(--radius-md);
  padding: 1rem 0.75rem; text-align: center;
}
.score-value { font-size: 24px; font-weight: 700; margin: 4px 0 2px; }
.score-label { font-size: 12px; color: var(--text-secondary); }
.score-label .est { font-size: 10px; opacity: 0.8; }

.section-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem;
}
.section-card h2 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.summary-text { font-size: 14px; color: var(--text-secondary); margin: 0; line-height: 1.6; }

.finding {
  display: flex; gap: 10px; padding: 11px 0;
  border-top: 1px solid var(--border); font-size: 13px;
}
.finding:first-of-type { border-top: none; }
.finding-cat { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); }
.finding-issue { margin: 2px 0 4px; font-weight: 600; }
.finding-fix { margin: 0; color: var(--text-secondary); }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.sev-high { background: var(--danger); }
.sev-medium { background: var(--warning); }
.sev-low { background: var(--text-tertiary); }

.raw-row {
  display: flex; justify-content: space-between; padding: 7px 0;
  border-top: 1px solid var(--border); font-size: 13px;
}
.raw-row:first-of-type { border-top: none; }
.raw-row span:first-child { color: var(--text-secondary); }
.raw-row span:last-child { font-weight: 600; }

.perf-note {
  font-size: 11px; color: var(--text-tertiary); text-align: center;
  margin: 1rem 0 0; line-height: 1.6;
}

@media (max-width: 480px) {
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  #audit-form { flex-direction: column; }
}
