:root {
  --bg: #080c10;
  --surface: #0d1219;
  --border: #1a2535;
  --border-bright: #243040;
  --text: #c8d8e8;
  --text-dim: #4a6070;
  --text-bright: #e8f4ff;
  --accent: #00e5ff;
  --accent-dim: #007a8a;
  --green: #00ff88;
  --green-dim: #004422;
  --yellow: #ffcc00;
  --yellow-dim: #332800;
  --red: #ff3355;
  --red-dim: #330011;
  --mono: 'Space Mono', monospace;
  --sans: 'Syne', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,229,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  top: -100%;
  left: 0;
  right: 0;
  height: 200%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

header { margin-bottom: 56px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 12px;
  opacity: 0;
  animation: fadeUp 0.6s 0.1s ease forwards;
}

h1 {
  font-family: var(--sans);
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  color: var(--text-bright);
  line-height: 1.05;
  letter-spacing: -0.02em;
  opacity: 0;
  animation: fadeUp 0.6s 0.2s ease forwards;
}

h1 span { color: var(--accent); }

.subtitle {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
  max-width: 520px;
  opacity: 0;
  animation: fadeUp 0.6s 0.3s ease forwards;
}

.score-block {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-bottom: 48px;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.score-block.visible { opacity: 1; }

.ring-wrap {
  position: relative;
  flex-shrink: 0;
  width: 140px;
  height: 140px;
}

.ring-wrap svg { transform: rotate(-90deg); }

.ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.5s ease;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-num {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 42px;
  line-height: 1;
  transition: color 0.5s ease;
}

.score-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-top: 2px;
}

.score-meta h2 {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 6px;
}

.risk-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.risk-low  { background: var(--green-dim);  color: var(--green);  border: 1px solid var(--green); }
.risk-medium { background: var(--yellow-dim); color: var(--yellow); border: 1px solid var(--yellow); }
.risk-high { background: var(--red-dim);   color: var(--red);    border: 1px solid var(--red); }

.score-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 380px;
}

#run-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s;
  box-shadow: 0 0 24px rgba(0,229,255,0.3);
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.6s 0.4s ease forwards;
}

#run-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 32px rgba(0,229,255,0.5);
}

#run-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

#run-btn .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

#run-btn.loading .spinner { display: block; }
#run-btn.loading .btn-icon { display: none; }

.checks-grid { display: grid; gap: 12px; }

.check-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: start;
  gap: 16px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.3s ease;
}

.check-card.visible { opacity: 1; transform: translateY(0); }
.check-card.pass    { border-left: 3px solid var(--green); }
.check-card.warn    { border-left: 3px solid var(--yellow); }
.check-card.fail    { border-left: 3px solid var(--red); }
.check-card.info    { border-left: 3px solid var(--accent); }
.check-card.pending { border-left: 3px solid var(--border-bright); }

.check-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.check-card.pass    .check-icon { background: var(--green-dim); }
.check-card.warn    .check-icon { background: var(--yellow-dim); }
.check-card.fail    .check-icon { background: var(--red-dim); }
.check-card.info    .check-icon { background: rgba(0,229,255,0.08); }
.check-card.pending .check-icon { background: var(--border); animation: pulse 1.2s ease-in-out infinite; }

.check-title {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.check-summary {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 8px;
}

.check-detail {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.7;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.check-detail.open { max-height: 400px; }

.check-detail .kv {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.check-detail .k {
  color: var(--accent-dim);
  min-width: 120px;
  flex-shrink: 0;
}

.check-detail .v { color: var(--text); word-break: break-all; }

.check-detail .remediation {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(0,229,255,0.04);
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  line-height: 1.7;
}

.check-detail .remediation strong {
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.sev-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  text-transform: uppercase;
}

.sev-pass    { background: var(--green-dim);            color: var(--green); }
.sev-warn    { background: var(--yellow-dim);           color: var(--yellow); }
.sev-fail    { background: var(--red-dim);              color: var(--red); }
.sev-info    { background: rgba(0,229,255,0.08);        color: var(--accent); }
.sev-pending { background: var(--border);               color: var(--text-dim); }

.log-wrap {
  margin-top: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.log-wrap.visible { opacity: 1; }

.log-header {
  background: var(--surface);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.dot   { width: 10px; height: 10px; border-radius: 50%; }
.dot-r { background: #ff5f57; }
.dot-y { background: #ffbd2e; }
.dot-g { background: #28ca41; }

.log-title {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 6px;
  letter-spacing: 0.08em;
}

.log-body {
  padding: 16px;
  font-size: 11px;
  line-height: 1.8;
  max-height: 220px;
  overflow-y: auto;
  background: #060a0e;
}

.log-body::-webkit-scrollbar       { width: 4px; }
.log-body::-webkit-scrollbar-track { background: transparent; }
.log-body::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

.log-line { display: block; }
.log-ts   { color: var(--text-dim); margin-right: 8px; }
.log-ok   { color: var(--green); }
.log-warn { color: var(--yellow); }
.log-err  { color: var(--red); }
.log-info { color: var(--accent); }
.log-dim  { color: var(--text-dim); }

footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.cursor { animation: blink 1s step-end infinite; }

@media (max-width: 600px) {
  .score-block { flex-direction: column; gap: 20px; }
  .check-card  { grid-template-columns: 28px 1fr; }
  .sev-badge   { display: none; }
}

/* ─── Score utility classes (replaces inline styles) ─── */
.score-hidden { display: none; }

.score-color-green { color: var(--green); }
.score-color-yellow { color: var(--yellow); }
.score-color-red { color: var(--red); }

/* ── SCORE BREAKDOWN ─────────────────────────────────── */
.score-breakdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
}
.breakdown-title {
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 0.65rem;
  margin-bottom: .6rem;
}
.breakdown-rows { display: flex; flex-direction: column; gap: .3rem; }
.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .2rem .5rem;
  border-radius: 4px;
}
.bd-fail { background: rgba(255,80,80,.08); color: var(--red); }
.bd-warn { background: rgba(255,193,7,.08); color: var(--yellow); }
.bd-label { flex: 1; }
.bd-penalty { font-weight: 700; letter-spacing: .05em; }
.breakdown-total {
  margin-top: .7rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
  text-align: right;
  color: var(--muted);
  font-size: 0.68rem;
}
.breakdown-clean { color: var(--green); font-size: 0.75rem; }

/* ── VPN BANNER ──────────────────────────────────────── */
.vpn-banner {
  background: linear-gradient(135deg, rgba(0,200,100,.07), rgba(0,150,255,.05));
  border: 1px solid rgba(0,200,100,.25);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
}
.vpn-banner-title {
  font-weight: 700;
  color: var(--green);
  font-size: 0.85rem;
  margin-bottom: .5rem;
  letter-spacing: .03em;
}
.vpn-protected {
  color: var(--text);
  margin-bottom: .4rem;
  line-height: 1.6;
}
.vpn-protected strong { color: var(--green); }
.vpn-unprotected {
  color: var(--muted);
  line-height: 1.6;
}
.vpn-unprotected strong { color: var(--yellow); }
.vpn-note {
  display: block;
  margin-top: .35rem;
  font-size: 0.68rem;
  color: var(--muted);
  font-style: italic;
}

/* ── REMEDIATION PRIORITY LIST ───────────────────────── */
.remediation-list { margin-top: .25rem; }
.remediation-item {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .55rem .5rem;
  border-bottom: 1px solid var(--border);
}
.remediation-item:last-child { border-bottom: none; }
.rem-num {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: .1rem;
}
.rem-body { flex: 1; }
.rem-action {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: var(--text);
  font-weight: 700;
  margin-bottom: .2rem;
}
.rem-detail {
  font-family: 'Space Mono', monospace;
  font-size: 0.67rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── SHARE ROW ───────────────────────────────────────── */
.share-row {
  display: flex;
  gap: .6rem;
  margin-top: 1rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.share-btn {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .4rem .85rem;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: .05em;
  transition: border-color .15s, color .15s;
}
.share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
