/* CiteCheck v1 — mobile-first. The user checks everything on his phone:
   nothing on any page may force the viewport wider than the screen. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: #1c2333;
  background: #f4f6fb;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: #4f46e5; }
a:visited { color: #6d28d9; }
h1, h2, h3 { line-height: 1.25; overflow-wrap: anywhere; }
h1 { font-size: 1.9rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 0.6rem; }
h3 { font-size: 1.1rem; margin: 1.4rem 0 0.4rem; }
p { margin: 0 0 0.9rem; }
ul, ol { margin: 0 0 0.9rem; padding-left: 1.3rem; }
code, pre, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}
pre {
  background: #141a2e;
  color: #e6e9f5;
  padding: 14px;
  border-radius: 10px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0.5rem 0 1rem;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px 48px; }

/* header */
.topbar {
  background: linear-gradient(135deg, #312e81, #4f46e5 55%, #7c3aed);
  color: #fff;
  padding: 14px 0;
}
.topbar .wrap { padding-bottom: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo { font-size: 1.35rem; font-weight: 800; color: #fff; text-decoration: none; letter-spacing: -0.02em; }
.logo span { color: #a5b4fc; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a {
  color: #e0e7ff; text-decoration: none; font-size: 0.92rem;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}
.topbar nav a:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* hero + audit form */
.hero { padding: 34px 0 8px; text-align: center; }
.hero p.lede { font-size: 1.12rem; color: #475069; max-width: 640px; margin: 0 auto 1.2rem; }
.audit-form {
  display: flex; gap: 10px; max-width: 680px; margin: 0 auto;
  background: #fff; border: 1px solid #dbe1f0; border-radius: 14px;
  padding: 10px; box-shadow: 0 6px 24px rgba(49,46,129,0.10);
}
.audit-form input[type="url"], .audit-form input[type="text"] {
  flex: 1 1 auto; min-width: 0; border: 1px solid #cbd5e1; border-radius: 9px;
  padding: 12px 14px; font-size: 1rem; font-family: inherit; color: #1c2333;
}
.audit-form input:focus { outline: 2px solid #4f46e5; outline-offset: 1px; }
.btn {
  display: inline-block; border: 0; border-radius: 9px; cursor: pointer;
  background: #4f46e5; color: #fff; font-weight: 700; font-size: 1rem;
  padding: 12px 22px; font-family: inherit; text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: #4338ca; }
.btn.ghost { background: #eef2ff; color: #3730a3; }
.btn.ghost:hover { background: #e0e7ff; }
.btn.small { padding: 7px 12px; font-size: 0.9rem; }
.btn:disabled { opacity: 0.6; cursor: default; }
.form-note { font-size: 0.9rem; color: #64748b; margin-top: 10px; }
.form-error { color: #b91c1c; font-weight: 600; margin-top: 10px; }

/* cards + grids */
.card {
  background: #fff; border: 1px solid #dbe1f0; border-radius: 14px;
  padding: 18px; margin: 18px 0;
}
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.niche-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.niche-card {
  display: block; background: #fff; border: 1px solid #dbe1f0; border-radius: 14px;
  padding: 16px; text-decoration: none; color: inherit;
}
.niche-card:hover { border-color: #4f46e5; }
.niche-card b { color: #312e81; font-size: 1.05rem; }
.niche-card p { color: #475069; margin: 0.3rem 0 0; font-size: 0.95rem; }
.steps { counter-reset: step; }
.step { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 12px; }
.step::before {
  counter-increment: step; content: counter(step);
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  background: #4f46e5; color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
.check-cat { font-weight: 700; color: #312e81; margin-bottom: 2px; }
.muted { color: #64748b; }
.small { font-size: 0.9rem; }
.honest {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
  padding: 14px 16px; margin: 18px 0; font-size: 0.95rem;
}

/* result page */
.score-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.score-ring {
  --size: 132px;
  width: var(--size); height: var(--size); border-radius: 50%; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: conic-gradient(var(--ring, #4f46e5) calc(var(--score, 0) * 1%), #e2e8f0 0);
  position: relative;
}
.score-ring::before {
  content: ""; position: absolute; inset: 12px; background: #fff; border-radius: 50%;
}
.score-num { position: relative; font-size: 2.1rem; font-weight: 800; line-height: 1; }
.score-num small { font-size: 1rem; color: #64748b; }
.score-grade { position: relative; font-weight: 700; color: #475069; font-size: 0.9rem; }
.score-meta { min-width: 0; flex: 1 1 220px; overflow-wrap: anywhere; }
.score-meta .audited-url { overflow-wrap: anywhere; word-break: break-all; }
.cat-bar { margin: 8px 0; }
.cat-bar .cat-label { display: flex; justify-content: space-between; gap: 10px; font-size: 0.95rem; flex-wrap: wrap; }
.cat-track { height: 9px; background: #e2e8f0; border-radius: 99px; margin-top: 4px; overflow: hidden; }
.cat-fill { height: 100%; background: #4f46e5; border-radius: 99px; }

.check { border-top: 1px solid #e6eaf3; padding: 12px 0; }
.check:first-child { border-top: 0; }
.check-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.badge {
  flex: 0 0 auto; font-size: 0.8rem; font-weight: 800; border-radius: 99px;
  padding: 2px 10px; margin-top: 2px; white-space: nowrap;
}
.badge.pass { background: #dcfce7; color: #166534; }
.badge.partial { background: #fef3c7; color: #92400e; }
.badge.fail { background: #fee2e2; color: #991b1b; }
.check-label { font-weight: 700; min-width: 0; flex: 1 1 200px; overflow-wrap: anywhere; }
.check-weight { color: #64748b; font-size: 0.85rem; white-space: nowrap; }
.evidence {
  margin: 6px 0 0 0; font-size: 0.92rem; color: #475069;
  background: #f8fafc; border-left: 3px solid #c7d2fe; border-radius: 0 8px 8px 0;
  padding: 8px 10px; overflow-wrap: anywhere; word-break: break-word;
}
.fix { margin: 6px 0 0; font-size: 0.95rem; }
.fix b { color: #7c2d12; }

.fix-list { counter-reset: fix; }
.fix-item { display: flex; gap: 10px; margin: 0 0 12px; }
.fix-item::before {
  counter-increment: fix; content: counter(fix);
  flex: 0 0 26px; height: 26px; border-radius: 50%;
  background: #fef3c7; color: #92400e; font-weight: 800; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.out-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.out-head h3 { margin: 0; }
.copy-btn { flex: 0 0 auto; }

.niche-checks .badge { margin-top: 0; }
.tag {
  display: inline-block; background: #eef2ff; color: #3730a3; border-radius: 99px;
  padding: 2px 10px; font-size: 0.82rem; font-weight: 700; margin: 2px 4px 2px 0;
}

footer { border-top: 1px solid #dbe1f0; margin-top: 28px; padding-top: 18px; color: #64748b; font-size: 0.9rem; }
footer a { color: #475069; }

/* loading + errors */
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 4px solid #c7d2fe; border-top-color: #4f46e5;
  animation: spin 0.9s linear infinite; margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

@media (min-width: 640px) {
  h1 { font-size: 2.3rem; }
  .grid { grid-template-columns: 1fr 1fr; }
  .niche-grid { grid-template-columns: 1fr 1fr; }
  .audit-form { flex-wrap: nowrap; }
}
@media (max-width: 639px) {
  .audit-form { flex-direction: column; }
  .audit-form .btn { width: 100%; }
  .grid.two { grid-template-columns: 1fr; }
}
