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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #263045;
  --border: #334155;
  --accent: #3b82f6;
  --accent2: #8b5cf6;
  --accent-hover: #2563eb;
  --accent-dim: rgba(59,130,246,.15);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --green: #22c55e;
  --lime: #84cc16;
  --yellow: #eab308;
  --orange: #f97316;
  --red: #ef4444;
  --red2: #dc2626;
  --radius: 12px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Nav ─────────────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(15,23,42,.9);
  backdrop-filter: blur(12px);
  z-index: 100;
}
.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}
.logo-icon { font-size: 1.4rem; }
.logo-badge {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 999px;
  border: 1px solid rgba(59,130,246,.3);
  letter-spacing: .05em;
}
.nav-cta {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .5rem 1.2rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
}
.nav-cta:hover { background: var(--accent-hover); }
.lang-btn.active { color: var(--accent) !important; background: var(--surface2); border-radius: .25rem; }

/* ─── Hero ────────────────── */
.hero {
  max-width: 780px;
  margin: 0 auto;
  padding: 5rem 1.5rem 3rem;
  text-align: center;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--accent-dim);
  border: 1px solid rgba(59,130,246,.3);
  color: var(--accent);
  font-size: .8rem;
  font-weight: 600;
  padding: .35rem 1rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
  letter-spacing: .03em;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.2rem;
  letter-spacing: -.02em;
}
.hero h1 .highlight {
  background: linear-gradient(135deg, #3b82f6, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

/* ─── Scan Form ───────────── */
.scan-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 620px;
  margin: 0 auto;
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-row.single { grid-template-columns: 1fr; }
.field label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .4rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.field input,
.field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .95rem;
  padding: .7rem 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.field input::placeholder { color: var(--text-dim); }
.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}
.field select option { background: var(--surface); }

.scan-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .85rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  margin-top: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  box-shadow: 0 4px 20px rgba(59,130,246,.35);
}
.scan-btn:hover { background: var(--accent-hover); box-shadow: 0 4px 28px rgba(59,130,246,.5); }
.scan-btn:active { transform: scale(.99); }
.scan-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.form-note {
  text-align: center;
  font-size: .78rem;
  color: var(--text-dim);
  margin-top: .8rem;
}

/* ─── Social proof strip ──── */
.proof {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 2.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: .85rem;
}
.proof-item { display: flex; align-items: center; gap: .4rem; }

/* ─── How it works ────────── */
.how {
  max-width: 900px;
  margin: 5rem auto;
  padding: 0 1.5rem;
}
.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.section-header h2 {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: .5rem;
}
.section-header p { color: var(--text-muted); }
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.step-num {
  width: 40px;
  height: 40px;
  background: var(--accent-dim);
  border: 1px solid rgba(59,130,246,.3);
  color: var(--accent);
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto .8rem;
  font-size: .9rem;
}
.step-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: .4rem; }
.step-card p { color: var(--text-muted); font-size: .88rem; }

/* ─── Loading ─────────────── */
#loading {
  display: none;
  max-width: 620px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}
#loading.visible { display: block; }
.loading-header {
  text-align: center;
  margin-bottom: 2rem;
}
.loading-header h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: .3rem; }
.loading-header p { color: var(--text-muted); font-size: .9rem; }

.progress-bar-wrap {
  background: var(--border);
  border-radius: 999px;
  height: 6px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border-radius: 999px;
  transition: width .4s ease;
  width: 0%;
}

.steps-log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  max-height: 280px;
  overflow-y: auto;
  font-size: .85rem;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
}
.log-line {
  padding: .3rem 0;
  border-bottom: 1px solid rgba(51,65,85,.4);
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  color: var(--text-muted);
  animation: fadeIn .2s ease;
}
.log-line:last-child { border-bottom: none; }
.log-line.done { color: var(--text); }
.log-line.error { color: var(--red); }
.log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: .45rem;
  animation: pulse 1.5s infinite;
}
.log-dot.done { background: var(--green); animation: none; }
.log-dot.error { background: var(--red); animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Results ─────────────── */
#results {
  display: none;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
#results.visible { display: block; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.results-header h2 { font-size: 1.5rem; font-weight: 700; }
.results-meta { color: var(--text-muted); font-size: .9rem; margin-top: .2rem; }
.results-actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: .5rem 1rem;
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* Score hero row */
.score-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2.5rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 560px) {
  .score-hero { grid-template-columns: 1fr; text-align: center; }
}

/* Circular gauge */
.gauge-wrap { position: relative; width: 160px; height: 160px; flex-shrink: 0; }
.gauge-wrap svg { transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: var(--border); stroke-width: 10; }
.gauge-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1), stroke .5s;
}
.gauge-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.gauge-score { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.gauge-label { font-size: .7rem; color: var(--text-muted); margin-top: .15rem; letter-spacing: .05em; }
.gauge-grade { font-size: 1.1rem; font-weight: 700; margin-top: .1rem; }

.score-details h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: .3rem; }
.score-summary { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.2rem; }
.metrics-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.metric { }
.metric-val { font-size: 1.3rem; font-weight: 700; }
.metric-lbl { color: var(--text-muted); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
}
.stat-card .val { font-size: 1.8rem; font-weight: 700; line-height: 1; margin-bottom: .3rem; }
.stat-card .lbl { color: var(--text-muted); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }

/* Section blocks */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.section-title {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-muted);
  letter-spacing: .02em;
  text-transform: uppercase;
  font-size: .8rem;
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: .7rem 1.2rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
td {
  padding: .75rem 1.2rem;
  font-size: .9rem;
  border-bottom: 1px solid rgba(51,65,85,.4);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-green { background: rgba(34,197,94,.15); color: var(--green); border: 1px solid rgba(34,197,94,.25); }
.badge-red { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.25); }
.badge-yellow { background: rgba(234,179,8,.15); color: var(--yellow); border: 1px solid rgba(234,179,8,.25); }
.badge-blue { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(59,130,246,.25); }
.badge-gray { background: rgba(100,116,139,.15); color: var(--text-dim); border: 1px solid rgba(100,116,139,.25); }

/* Mention bar */
.mention-bar-wrap { display: flex; align-items: center; gap: .7rem; }
.mention-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  max-width: 120px;
}
.mention-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }

/* Competitor dot */
.comp-bar { color: var(--accent); letter-spacing: -.1em; font-size: .85rem; }

/* Tech scan checks */
.tech-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .8rem;
  padding: 1.2rem 1.4rem;
}
.tech-check {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .8rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.tc-icon { font-size: 1.2rem; flex-shrink: 0; }
.tc-title { font-size: .85rem; font-weight: 600; margin-bottom: .15rem; }
.tc-sub { font-size: .78rem; color: var(--text-muted); }
.tc-score {
  margin-left: auto;
  font-size: .8rem;
  font-weight: 700;
  padding: .1rem .5rem;
  border-radius: 6px;
  flex-shrink: 0;
}

/* Priority actions */
.actions-list { padding: 1rem 1.4rem; display: flex; flex-direction: column; gap: .75rem; }
.action-item {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  padding: .9rem 1rem;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.action-emoji { font-size: 1.3rem; flex-shrink: 0; margin-top: .1rem; }
.action-title { font-size: .9rem; font-weight: 600; margin-bottom: .25rem; }
.action-body { font-size: .83rem; color: var(--text-muted); line-height: 1.5; }
.action-item.critical { border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.05); }
.action-item.high { border-color: rgba(234,179,8,.25); background: rgba(234,179,8,.04); }
.action-item.medium { border-color: rgba(59,130,246,.2); background: rgba(59,130,246,.03); }
.action-item.low { border-color: var(--border); }

/* Snippet collapse */
.snippet-text {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: .3rem;
  font-style: italic;
  padding: .4rem .7rem;
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

/* CTA banner */
.cta-banner {
  background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 60%, #1a1e3a 100%);
  border: 1px solid rgba(59,130,246,.3);
  border-radius: 16px;
  padding: 2.5rem;
  text-align: center;
  margin-top: 2rem;
}
.cta-banner h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: .5rem; }
.cta-banner p { color: var(--text-muted); margin-bottom: 1.5rem; }
.cta-email-row {
  display: flex;
  gap: .8rem;
  max-width: 440px;
  margin: 0 auto;
}
.cta-email-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .95rem;
  padding: .7rem 1rem;
  outline: none;
  min-width: 0;
}
.cta-email-row input:focus { border-color: var(--accent); }
.cta-email-row button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .7rem 1.2rem;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  flex-shrink: 0;
}
.cta-email-row button:hover { background: var(--accent-hover); }

/* Re-scan button */
.rescan-btn {
  display: block;
  width: fit-content;
  margin: 1.5rem auto 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .6rem 1.4rem;
  border-radius: 8px;
  font-size: .9rem;
  cursor: pointer;
  transition: all .15s;
}
.rescan-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: .82rem;
  margin-top: 4rem;
}

/* Error toast */
#error-toast {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.4);
  color: var(--red);
  padding: .8rem 1.4rem;
  border-radius: 8px;
  font-size: .9rem;
  z-index: 999;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
#error-toast.visible { display: block; }

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.9rem; }
  .cta-email-row { flex-direction: column; }
  
  /* Mobile-specific fixes */
  body { padding: 0; }
  nav { padding: .6rem 1rem; }
  .hero { padding: 3rem 1rem 2rem; }
  .hero-sub { font-size: .9rem; }
  .section { margin: .6rem .5rem; padding: 0; border-radius: .6rem; }
  .section-title { padding: .8rem 1rem; font-size: .85rem; }
  
  /* Score hero mobile */
  .score-hero { padding: 1rem; gap: 1rem; }
  .gauge-wrap { width: 130px; height: 130px; margin: 0 auto; }
  .gauge-score { font-size: 1.8rem; }
  .score-details { padding: 0 .5rem; }
  .score-details h3 { font-size: 1rem; }
  .score-summary { font-size: .82rem; }
  .metrics-row { gap: .8rem; flex-wrap: wrap; justify-content: center; }
  .metric-val { font-size: 1.1rem; }
  
  /* Platform table mobile */
  table { font-size: .78rem; }
  th, td { padding: .5rem .4rem; }
  .snippet-text { max-width: 140px; font-size: .72rem; }
  
  /* Tech checks mobile */
  .tech-checks { padding: .6rem .8rem; }
  
  /* Actions mobile */
  .actions-list { padding: .8rem; }
  .action-body { font-size: .78rem; }
  
  /* Competitors mobile */
  .competitors-list { padding: .6rem .8rem; }
  
  /* CTA mobile */
  .cta-banner { margin: 1rem .5rem; padding: 1.5rem 1rem; }
  .cta-banner h3 { font-size: 1.1rem; }
  
  /* Results actions bar */
  .results-actions { padding: .5rem; gap: .5rem; }
  .results-actions button { font-size: .75rem; padding: .4rem .8rem; }

  /* Radar chart mobile — smaller labels */
  .tech-check svg { max-width: 260px; }
  .tech-check svg text { font-size: 7.5px !important; }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 1.5rem; }
  .metrics-row { gap: .5rem; }
  .metric { min-width: 70px; }
}

/* Print styles for PDF export */
@media print {
  body { background: #fff !important; color: #111 !important; }
  nav, .hero, .cta-banner, .results-actions, footer, .copy-hint,
  #loading-view, #strategy-btn, #section-strategy { display: none !important; }
  .section { border: 1px solid #ddd !important; margin: .5rem 0 !important; break-inside: avoid; }
  .section-title { background: #f5f5f5 !important; color: #111 !important; }
  .score-hero { background: #f9f9f9 !important; }
  .gauge-score, .gauge-grade, .metric-val { color: #111 !important; }
  .gauge-bg { stroke: #ddd !important; }
  .action-item { border: 1px solid #ddd !important; background: #fafafa !important; }
  .action-title, .action-body, .tc-title, .tc-sub { color: #222 !important; }
  .tech-check { background: #fafafa !important; border-color: #ddd !important; }
  .tc-score { background: #f0f0f0 !important; }
  pre { background: #f5f5f5 !important; border-color: #ddd !important; }
  a { color: #111 !important; }
  /* Add report header for print */
  #results-view::before {
    content: 'GEO Tracker Report — geo.agntwork.com';
    display: block;
    text-align: center;
    font-size: 10px;
    color: #999;
    margin-bottom: 1rem;
  }
}

/* Back to top button */
.back-to-top {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 99;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 1.2rem; cursor: pointer; opacity: 0;
  transition: opacity .3s, transform .3s;
  transform: translateY(10px);
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { opacity: .9; }
