/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --bg: #f9f9f9;
  --surface: #ffffff;
  --border: #e5e5e5;
  --text: #111111;
  --muted: #555555;
  --accent: #1DB954;
  --accent-hover: #17a349;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 8px;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --nav-h: 56px;
  --max-w: 900px;
  --px: 1.5rem;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; background: none; border: none; }

/* ── Base ────────────────────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
h1 { font-size: 2.25rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1rem; font-weight: 600; line-height: 1.4; }
p { color: var(--muted); }
code, pre { font-family: var(--font-mono); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--px);
}
.main-content {
  flex: 1;
  padding: 3rem 0;
  overflow: hidden;
}

/* ── Nav ─────────────────────────────────────────────────────────────────── */
.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--px);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-logo {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  gap: 0.125rem;
  flex: 1;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 120ms, background 120ms;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--bg);
}
.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.nav-auth [data-auth="logged-in"] {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.nav-user-name {
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.875rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms, color 120ms, opacity 120ms;
  cursor: pointer;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}
.btn-outline:hover:not(:disabled) {
  background: var(--bg);
  border-color: #d0d0d0;
  color: var(--text);
}
.btn-danger {
  background: #e53e3e;
  border-color: #e53e3e;
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #c53030;
  border-color: #c53030;
}
.btn-lg {
  padding: 0.6875rem 0.875rem;
  font-size: 1rem;
}
.btn-wide {
  display: flex;
  width: 100%;
}
.hero-btn {
  min-width: 11.5rem;
}
.header-btn {
  min-width: 7rem;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 0;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--px);
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.footer-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}
.footer-nav a {
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  font-size: 0.8125rem;
  color: var(--muted);
  transition: color 120ms;
}
.footer-nav a:hover { color: var(--text); }
.footer-disclaimer {
  font-size: 0.75rem;
  color: #999;
  margin: 0;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  padding: 5rem 2.5rem 4rem;
  margin-inline: -2.5rem;
  background: #a1edbd;
  /* border: 1px solid rgba(29, 185, 84, 0.15); */
  border-radius: 16px;
}
.hero-content {
  display: flex;
  align-items: center;
  gap: 3rem;
}
.hero-text {
  flex: 1;
}
.hero-text h1 {
  max-width: 680px;
  margin: 0 0 1rem;
  text-wrap: balance;
}
.hero-text p {
  max-width: 520px;
  margin: 0 0 2.25rem;
  font-size: 1.0625rem;
  text-wrap: pretty;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.hero-image {
  flex: 0 0 280px;
}
.hero-image img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.6s ease;
}


/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 2rem;
}
.page-header h1,
.page-header h2 { margin-bottom: 0.375rem; }
.page-header > p { font-size: 1rem; margin: 0; }

/* ── Welcome banner ──────────────────────────────────────────────────────── */
.welcome-banner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: #a1edbd;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.welcome-banner p {
  flex: 1;
  margin: 0;
}

/* ── Sections ────────────────────────────────────────────────────────────── */
.section {
  padding-top: 3.5rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card-header {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.card-header h2 { margin-bottom: 0.25rem; }
.card-header p { font-size: 0.875rem; margin: 0; }

/* ── Sync / Stats ────────────────────────────────────────────────────────── */
.sync-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}
.stat-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.result-meta {
  display: none;
  margin-top: 0.875rem;
}
.result-meta.visible { display: block; }
.result-message {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.625rem 0.875rem;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* ── Settings ────────────────────────────────────────────────────────────── */
.setting-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.125rem 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:first-child,
.card-header + .setting-row { padding-top: 0; }
.setting-row:last-child { border-bottom: none; padding-bottom: 0; }
.setting-copy { flex: 1; }
.setting-label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.setting-hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
}
.setting-control { flex-shrink: 0; }

/* Segmented control */
.segmented-control {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.segmented-option {
  position: relative;
  cursor: pointer;
}
.segmented-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.segmented-option span {
  display: block;
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
  color: var(--muted);
  white-space: nowrap;
  transition: background 120ms, color 120ms;
}
.segmented-option input:checked + span {
  background: var(--accent);
  color: #fff;
}
.segmented-option:not(:first-child) { border-left: 1px solid var(--border); }

/* Select */
.setting-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.375rem 0.5rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  min-width: 180px;
}
.setting-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── How it works / Steps ─────────────────────────────────────────────────── */
.steps {
  display: flex;
  align-items: stretch;
  gap: 1.5rem;
}
.step {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.step-emoji {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.75rem;
}
.step-icon {
  display: block;
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.75rem;
}
.step h3 {
  margin-bottom: 0.375rem;
}
.step p {
  font-size: 0.875rem;
  margin: 0;
}
.step-arrow {
  font-size: 1.5rem;
  color: var(--muted);
  flex-shrink: 0;
  align-self: center;
}

/* ── FAQ ─────────────────────────────────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.faq-item h3 {
  margin-bottom: 0.5rem;
  color: var(--text);
}
.faq-item p { margin: 0; font-size: 0.9375rem; }
.faq-item a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Comparisons ─────────────────────────────────────────────────────────── */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.comparison-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.comparison-card.featured { border-color: var(--accent); }
.comparison-card-header {
  margin-bottom: 1rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.comparison-card-header h3 { color: var(--text); }
.badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  padding: 0.125rem 0.4375rem;
  border-radius: 999px;
  vertical-align: middle;
}
.comparison-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.comparison-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.comparison-list li::before {
  content: "✓";
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}
.comparison-list li.con::before {
  content: "✗";
  color: #e53e3e;
}

/* ── Dashboard auth loading ──────────────────────────────────────────────── */
.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 30vh;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ── Inline form ─────────────────────────────────────────────────────────── */
.inline-form { display: inline; margin: 0; padding: 0; }

/* ── Delete account section ──────────────────────────────────────────────── */
.delete-section {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

/* ── Confirm delete overlay ──────────────────────────────────────────────── */
.confirm-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding: var(--px);
}
.confirm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
}
.confirm-card h2 {
  margin-bottom: 1rem;
}
.confirm-card > p {
  margin-bottom: 0.625rem;
}
.confirm-list {
  list-style: disc;
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}
.confirm-list li {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 0.125rem;
}
.confirm-note {
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}
.confirm-note strong { color: var(--text); }
.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
.confirm-error {
  margin-top: 0.875rem;
  font-size: 0.875rem;
  color: #c53030;
  margin-bottom: 0;
}

/* ── Responsive – 801px+ ────────────────────────────────────────────────── */
@media (min-width: 801px) {
  .footer-nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.125rem 0.25rem;
  }
}

/* ── Responsive – 800px and below ─────────────────────────────────────────── */
@media (max-width: 800px) {
  :root { --px: 1rem; }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.25rem; }
  .hero { padding: 3rem 1.5rem 2.5rem; position: relative; margin-inline: -0.6rem; }
  .hero-content {
    flex-direction: column;
    text-align: center;
  }
  .hero-image {
    position: absolute;
    right: calc(var(--px) * -1);
    bottom: -7rem;
    width: 200px;
    opacity: 0.18;
    pointer-events: none;
  }
  .hero-cta {
    justify-content: center;
  }
  .hero-text {
    position: relative;
    z-index: 1;
  }
  .hero-text h1 {
    line-height: 1.1;
    margin-bottom: 1.25rem;
  }
  .hero-text p {
    max-width: 30.5ch;
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 2rem;
    margin-inline: auto;
  }
  .steps {
    flex-direction: column;
    gap: 0rem;
  }
  .step {
    display: flex;
    align-items: center;
    text-align: left;
  }
  .step-emoji {
    margin-bottom: 0;
    flex-shrink: 0;
    margin-right: 1rem;
  }
  .step-icon {
    margin: 0 1rem 0 0;
    flex-shrink: 0;
  }
  .step-text {
    display: flex;
    flex-direction: column;
  }
  .step-arrow {
    transform: rotate(90deg);
  }
  .steps {
    flex-direction: column;
    gap: 0rem;
  }
  .comparison-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .nav-links { display: none; }
  .nav-auth { margin-left: auto; }
  .stats-grid { grid-template-columns: 1fr; }
  .setting-row {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
}
