/* ==========================================================================
   Folliscope, Design System v2
   Fonts: Inter (UI), Space Grotesk (headings), JetBrains Mono (code)
   Aesthetic: clean, scientific, premium. Soft greens + slate, generous spacing.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===== RESET & BASE ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand-50:  #ecfdf5;
  --brand-100: #d1fae5;
  --brand-200: #a7f3d0;
  --brand-300: #6ee7b7;
  --brand-400: #34d399;
  --brand-500: #10b981;
  --brand-600: #059669;
  --brand-700: #047857;
  --brand-800: #065f46;

  --ink-900: #0f172a;
  --ink-800: #1e293b;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --ink-200: #e2e8f0;
  --ink-100: #f1f5f9;
  --ink-50:  #f8fafc;
  --bg:      #fbfcfd;
  --white:   #ffffff;

  --info:    #0ea5e9;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --danger-d:#b91c1c;

  --risk-minimal: #10b981;
  --risk-low:     #22c55e;
  --risk-mod:     #f59e0b;
  --risk-high:    #f97316;
  --risk-vhigh:   #dc2626;

  --font-ui:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head:  'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  --sh-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 1px rgba(15,23,42,.03);
  --sh-md: 0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
  --sh-lg: 0 12px 32px rgba(15,23,42,.08), 0 4px 12px rgba(15,23,42,.04);
  --sh-xl: 0 24px 56px rgba(15,23,42,.10), 0 8px 16px rgba(15,23,42,.05);

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --s-9: 56px; --s-10: 80px;

  --container: 1140px;
  --nav-h: 68px;
}

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-ui);
  color: var(--ink-800);
  background: var(--bg);
  line-height: 1.6;
  font-size: 15px;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word; /* long URLs/tokens wrap instead of forcing horizontal scroll on mobile */
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  color: var(--ink-900);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
}
h1 { font-size: clamp(2.2rem, 4vw + 1rem, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 2vw + 1rem, 2.1rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { color: var(--ink-700); }

a { color: var(--brand-600); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-700); }

code, pre, .mono { font-family: var(--font-mono); font-size: 0.88em; }

::selection { background: var(--brand-200); color: var(--brand-800); }

/* ===== LAYOUT =========================================================== */
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--s-6); }

.section { padding: var(--s-10) 0; }
.section--tight { padding: var(--s-8) 0; }
.section--alt { background: var(--white); }
.section--ink { background: var(--ink-900); color: var(--white); }
.section--ink h1, .section--ink h2, .section--ink h3 { color: var(--white); }
.section--ink p { color: var(--ink-300); }

.section-head { text-align: center; max-width: 720px; margin: 0 auto var(--s-8); }
.section-head h2 { margin-bottom: var(--s-3); }
.section-head p  { color: var(--ink-500); font-size: 1.02rem; }
.section-head .eyebrow {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--brand-600); text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: var(--s-3);
}

/* ===== NAVBAR =========================================================== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--ink-200);
  height: var(--nav-h);
}
.navbar .container { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: var(--s-3); font-family: var(--font-head); font-weight: 700; font-size: 1.18rem; color: var(--ink-900); letter-spacing: -0.02em; }
.brand:hover { color: var(--ink-900); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; box-shadow: 0 4px 12px rgba(16,185,129,.32);
}
.nav-links { display: flex; gap: var(--s-1); list-style: none; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.94rem; color: var(--ink-600); padding: var(--s-2) var(--s-4); border-radius: var(--r-md); transition: all .15s; }
.nav-links a:hover { color: var(--ink-900); background: var(--ink-100); }
.nav-links a.active { color: var(--brand-700); background: var(--brand-50); }
.nav-cta { background: var(--ink-900) !important; color: #fff !important; padding: var(--s-2) var(--s-5) !important; font-weight: 600 !important; }
.nav-cta:hover { background: var(--brand-700) !important; }
.hamburger { display: none; background: none; border: none; cursor: pointer; font-size: 1.3rem; color: var(--ink-700); }
@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: var(--nav-h); right: 0; left: 0;
    background: var(--white); border-bottom: 1px solid var(--ink-200);
    padding: var(--s-4) var(--s-6); gap: var(--s-1); box-shadow: var(--sh-md);
  }
  .hamburger { display: block; }
}

/* ===== HERO ============================================================= */
.hero {
  position: relative;
  padding: var(--s-10) 0 var(--s-9);
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(16,185,129,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(14,165,233,0.06), transparent 60%),
    linear-gradient(180deg, var(--white), var(--bg));
  overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--ink-100) 1px, transparent 1px),
    linear-gradient(90deg, var(--ink-100) 1px, transparent 1px);
  background-size: 56px 56px; background-position: center;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  opacity: 0.5; pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--s-9); align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: var(--s-7); } }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--brand-700); background: var(--brand-50);
  border: 1px solid var(--brand-200);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-full);
  margin-bottom: var(--s-5); letter-spacing: 0.06em; text-transform: uppercase;
}
.hero h1 { margin-bottom: var(--s-4); }
.hero h1 .accent {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-lead { font-size: 1.1rem; color: var(--ink-600); max-width: 540px; margin-bottom: var(--s-6); }
.hero-cta { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-6); }
.hero-meta { display: flex; gap: var(--s-5); flex-wrap: wrap; font-size: 0.86rem; color: var(--ink-500); }
.hero-meta .meta-item { display: flex; align-items: center; gap: var(--s-2); }
.hero-meta i { color: var(--brand-600); }

.hero-card { background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-xl); padding: var(--s-7); box-shadow: var(--sh-lg); position: relative; }
.hero-card h4 { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-500); margin-bottom: var(--s-4); }
.compare-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; }
.compare-row .label { width: 110px; font-size: 0.85rem; color: var(--ink-600); }
.compare-bar { flex: 1; height: 10px; background: var(--ink-100); border-radius: var(--r-full); overflow: hidden; position: relative; }
.compare-bar .fill { height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--brand-400), var(--brand-700)); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.compare-bar .fill--mod { background: linear-gradient(90deg, var(--warning), var(--risk-high)); }
.compare-row .val { font-family: var(--font-mono); font-size: 0.88rem; font-weight: 500; color: var(--ink-800); min-width: 64px; text-align: right; }
.compare-divider { border-top: 1px dashed var(--ink-200); margin: var(--s-4) 0; }

/* ===== BUTTONS ========================================================== */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-6);
  font-family: var(--font-ui); font-weight: 600; font-size: 0.95rem;
  border-radius: var(--r-md); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: all .18s cubic-bezier(.2,.8,.2,1); white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--ink-900); color: #fff; box-shadow: 0 4px 12px rgba(15,23,42,.20); }
.btn--primary:hover { background: var(--brand-700); color: #fff; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(5,150,105,.30); }
.btn--brand { background: var(--brand-600); color: #fff; box-shadow: 0 4px 12px rgba(16,185,129,.25); }
.btn--brand:hover { background: var(--brand-700); color: #fff; transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--ink-800); border-color: var(--ink-300); }
.btn--ghost:hover { background: var(--ink-100); color: var(--ink-900); border-color: var(--ink-400); }
.btn--outline { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.4); }
.btn--outline:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.7); color: #fff; }
.btn--sm { padding: var(--s-2) var(--s-4); font-size: 0.85rem; }
.btn--lg { padding: var(--s-4) var(--s-7); font-size: 1rem; }
.btn--block { width: 100%; justify-content: center; }

/* ===== CARDS ============================================================ */
.card { background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg); box-shadow: var(--sh-sm); overflow: hidden; transition: transform .2s, box-shadow .2s; }
.card--hover:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }
.card-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--ink-200); background: linear-gradient(180deg, var(--white), var(--ink-50)); }
.card-head h3 { font-size: 1.05rem; }
.card-head .icon { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--brand-50); color: var(--brand-700); display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.card-body { padding: var(--s-6); }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-5); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s-4); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* ===== STAT CARDS ======================================================= */
.stat-card { padding: var(--s-6); background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg); text-align: left; transition: transform .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.stat-card .icon { width: 40px; height: 40px; border-radius: var(--r-md); background: var(--brand-50); color: var(--brand-700); display: flex; align-items: center; justify-content: center; margin-bottom: var(--s-4); font-size: 1rem; }
.stat-card .num { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--ink-900); letter-spacing: -0.02em; }
.stat-card .lbl { font-size: 0.92rem; color: var(--ink-500); margin-top: var(--s-1); }

/* ===== STEP CARDS ======================================================= */
.step-card { padding: var(--s-7); background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg); position: relative; transition: transform .2s, box-shadow .2s; }
.step-card:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.step-card .num { position: absolute; top: var(--s-5); right: var(--s-5); font-family: var(--font-mono); font-size: 0.82rem; color: var(--brand-700); background: var(--brand-50); padding: 4px 10px; border-radius: var(--r-full); }
.step-card .icon { width: 48px; height: 48px; border-radius: var(--r-md); background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: var(--s-5); font-size: 1.2rem; box-shadow: 0 6px 16px rgba(16,185,129,.30); }
.step-card h4 { margin-bottom: var(--s-2); }
.step-card p { font-size: 0.92rem; color: var(--ink-600); }

/* ===== INFO BOXES ======================================================= */
.info { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4) var(--s-5); border-radius: var(--r-md); font-size: 0.9rem; line-height: 1.55; margin: var(--s-3) 0; }
.info > i { font-size: 1rem; margin-top: 2px; flex-shrink: 0; }
.info--info    { background: #ecfeff; color: #0e7490; border-left: 3px solid var(--info); }
.info--success { background: var(--brand-50); color: var(--brand-800); border-left: 3px solid var(--brand-600); }
.info--warn    { background: #fffbeb; color: #92400e; border-left: 3px solid var(--warning); }
.info--danger  { background: #fef2f2; color: #991b1b; border-left: 3px solid var(--danger); }
.info strong { color: inherit; }

/* ===== BADGES =========================================================== */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.74rem; font-weight: 500; padding: 4px 10px; border-radius: var(--r-full); letter-spacing: 0.04em; text-transform: uppercase; }
.badge--brand   { background: var(--brand-50); color: var(--brand-700); }
.badge--ink     { background: var(--ink-100); color: var(--ink-700); }
.badge--info    { background: #e0f2fe; color: #0369a1; }
.badge--warn    { background: #fef3c7; color: #92400e; }
.badge--danger  { background: #fee2e2; color: #991b1b; }
.badge--success { background: var(--brand-100); color: var(--brand-800); }

/* ===== TABLES =========================================================== */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl thead th { background: var(--ink-900); color: #fff; padding: var(--s-3) var(--s-4); text-align: left; font-family: var(--font-ui); font-weight: 600; font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }
.tbl tbody td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--ink-200); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--brand-50); }
.tbl-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--ink-200); }

/* ===== FORM CONTROLS ==================================================== */
.field { margin-bottom: var(--s-5); }
.field label { display: block; font-weight: 600; font-size: 0.86rem; color: var(--ink-800); margin-bottom: var(--s-2); }
.field label .hint { font-weight: 400; color: var(--ink-500); font-size: 0.82rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

.input, .select, .textarea {
  width: 100%; padding: var(--s-3) var(--s-4);
  font-family: var(--font-ui); font-size: 0.94rem; color: var(--ink-900);
  background: var(--white); border: 1px solid var(--ink-300);
  border-radius: var(--r-md); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(16,185,129,0.12); }
.input--sm { padding: var(--s-2) var(--s-3); font-size: 0.88rem; }
.textarea { font-family: var(--font-mono); font-size: 0.82rem; min-height: 140px; resize: vertical; }

.choice-group { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.choice-group--col { flex-direction: column; gap: var(--s-2); }
.choice {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--white); border: 1px solid var(--ink-300);
  border-radius: var(--r-md); font-size: 0.9rem; color: var(--ink-700);
  cursor: pointer; transition: all .15s;
}
.choice:hover { border-color: var(--brand-400); background: var(--brand-50); color: var(--ink-900); }
.choice input { accent-color: var(--brand-600); }
.choice.selected, .choice:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); color: var(--ink-900); font-weight: 600; }

.range { width: 100%; accent-color: var(--brand-600); cursor: pointer; }
.range-value { display: inline-block; font-family: var(--font-mono); font-size: 0.82rem; font-weight: 600; background: var(--ink-900); color: #fff; padding: 2px 10px; border-radius: var(--r-full); margin-left: var(--s-2); }
.range-marks { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-400); margin-top: var(--s-1); }

.scale-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.scale-tile {
  display: block; padding: var(--s-4); cursor: pointer;
  background: var(--white); border: 1px solid var(--ink-300);
  border-radius: var(--r-md); text-align: center; transition: all .15s;
}
.scale-tile:hover { border-color: var(--brand-400); background: var(--brand-50); }
.scale-tile input { display: none; }
.scale-tile.selected, .scale-tile:has(input:checked) { border-color: var(--brand-600); background: var(--brand-50); box-shadow: 0 0 0 4px rgba(16,185,129,0.10); }
.scale-tile .scale-name { font-family: var(--font-head); font-weight: 600; color: var(--ink-900); font-size: 0.92rem; }
.scale-tile .scale-desc { font-size: 0.76rem; color: var(--ink-500); margin-top: 4px; }

/* ===== WIZARD =========================================================== */
.wizard-progress { background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg); padding: var(--s-5) var(--s-6); margin-bottom: var(--s-6); box-shadow: var(--sh-sm); }
.wizard-progress .header { display: flex; justify-content: space-between; align-items: center; font-size: 0.88rem; color: var(--ink-600); margin-bottom: var(--s-3); }
.wizard-progress .header strong { color: var(--ink-900); font-weight: 600; }
.wizard-progress .track { height: 6px; background: var(--ink-100); border-radius: var(--r-full); overflow: hidden; }
.wizard-progress .fill { height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand-700)); border-radius: var(--r-full); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.wizard-dots { display: flex; gap: var(--s-2); margin-top: var(--s-3); }
.wizard-dots .dot { flex: 1; height: 3px; border-radius: var(--r-full); background: var(--ink-200); transition: background .3s; }
.wizard-dots .dot.done { background: var(--brand-600); }
.wizard-dots .dot.active { background: var(--brand-500); }

.form-section { display: none; }
.form-section.active { display: block; animation: fadeUp .35s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.form-nav { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s-6); padding: var(--s-5) var(--s-6); background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg); position: sticky; bottom: var(--s-4); z-index: 10; box-shadow: var(--sh-md); }

/* ===== TABS ============================================================= */
.tab-bar { background: var(--white); border-bottom: 1px solid var(--ink-200); position: sticky; top: var(--nav-h); z-index: 80; overflow-x: auto; }
.tab-bar .container { display: flex; gap: 0; }
.tab-btn {
  padding: var(--s-4) var(--s-5); background: transparent; border: none; cursor: pointer;
  font-family: var(--font-ui); font-size: 0.9rem; font-weight: 500; color: var(--ink-500);
  display: flex; align-items: center; gap: var(--s-2); border-bottom: 2px solid transparent;
  white-space: nowrap; transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--ink-900); }
.tab-btn.active { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.tab-btn .tnum { width: 22px; height: 22px; background: var(--ink-100); border-radius: var(--r-full); font-family: var(--font-mono); font-size: 0.74rem; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-500); }
.tab-btn.active .tnum { background: var(--brand-600); color: #fff; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== PAGE-HEAD ======================================================= */
.page-head { padding: var(--s-9) 0 var(--s-7); background: linear-gradient(180deg, var(--white), var(--bg)); border-bottom: 1px solid var(--ink-200); text-align: center; }
.page-head .eyebrow { font-family: var(--font-mono); font-size: 0.78rem; color: var(--brand-600); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: var(--s-3); display: inline-block; }
.page-head h1 { font-size: clamp(2rem, 2.5vw + 1rem, 2.6rem); margin-bottom: var(--s-3); }
.page-head p { color: var(--ink-500); max-width: 680px; margin: 0 auto; font-size: 1.02rem; }

/* ===== DROPZONE / SEGMENTED ============================================ */
.dropzone { border: 1.5px dashed var(--ink-300); border-radius: var(--r-lg); padding: var(--s-8) var(--s-5); text-align: center; background: var(--ink-50); cursor: pointer; transition: all .2s; }
.dropzone:hover { border-color: var(--brand-500); background: var(--brand-50); }
.dropzone .icon { font-size: 1.8rem; color: var(--ink-400); margin-bottom: var(--s-3); display: block; }
.dropzone p { color: var(--ink-600); font-size: 0.92rem; }
.dropzone p strong { color: var(--ink-900); }

.segmented { display: inline-flex; background: var(--ink-100); padding: 4px; border-radius: var(--r-md); gap: 2px; margin-bottom: var(--s-4); }
.segmented button { background: transparent; border: none; cursor: pointer; padding: var(--s-2) var(--s-4); font-family: var(--font-ui); font-size: 0.85rem; font-weight: 500; color: var(--ink-600); border-radius: calc(var(--r-md) - 2px); display: inline-flex; align-items: center; gap: 6px; transition: all .15s; }
.segmented button:hover { color: var(--ink-900); }
.segmented button.active { background: var(--white); color: var(--ink-900); box-shadow: var(--sh-sm); font-weight: 600; }

/* ===== RESULTS / GAUGE ================================================== */
.gauge-card { padding: var(--s-8) var(--s-7); text-align: center; }
.gauge-score { font-family: var(--font-head); font-size: 4.5rem; font-weight: 700; letter-spacing: -0.04em; line-height: 1; margin: var(--s-3) 0 var(--s-3); }
.gauge-track { position: relative; height: 14px; border-radius: var(--r-full); background: linear-gradient(90deg, var(--risk-minimal) 0%, var(--risk-low) 20%, var(--risk-mod) 45%, var(--risk-high) 75%, var(--risk-vhigh) 100%); max-width: 640px; margin: var(--s-4) auto var(--s-3); box-shadow: inset 0 1px 2px rgba(0,0,0,.10); }
.gauge-marker { position: absolute; top: -8px; width: 4px; height: 30px; background: var(--ink-900); border-radius: var(--r-full); transform: translateX(-50%); transition: left 1s cubic-bezier(.2,.8,.2,1); }
.gauge-marker::after { content: ''; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 5px solid transparent; border-top: 7px solid var(--ink-900); }
.gauge-labels { display: flex; justify-content: space-between; max-width: 640px; margin: 0 auto; font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-400); }
.risk-pill { display: inline-flex; align-items: center; gap: var(--s-2); font-family: var(--font-head); font-weight: 600; font-size: 1rem; padding: var(--s-2) var(--s-5); border-radius: var(--r-full); margin-top: var(--s-2); }

.score-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: var(--s-4); margin: var(--s-6) 0; }
.score-card { padding: var(--s-5); background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg); box-shadow: var(--sh-sm); }
.score-card .lbl { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-500); margin-bottom: var(--s-2); display: flex; align-items: center; gap: 6px; }
.score-card .val { font-family: var(--font-head); font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink-900); }
.score-card .bar { height: 4px; background: var(--ink-100); border-radius: var(--r-full); margin-top: var(--s-2); overflow: hidden; }
.score-card .bar-fill { height: 100%; border-radius: var(--r-full); transition: width 1s cubic-bezier(.2,.8,.2,1); }

/* ===== NCBI COMPARISON ================================================== */
.compare-card { background: linear-gradient(180deg, var(--white), var(--ink-50)); border: 1px solid var(--ink-200); border-radius: var(--r-lg); padding: var(--s-7) var(--s-7) var(--s-6); box-shadow: var(--sh-md); margin-bottom: var(--s-6); }
.compare-card .head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-5); }
.compare-card .head h3 { display: flex; align-items: center; gap: var(--s-3); }
.compare-card .head h3 .marker { width: 28px; height: 28px; border-radius: var(--r-md); background: linear-gradient(135deg, #0369a1, #075985); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; }
.compare-card .head .src { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-500); }
.compare-card .head .src a { color: var(--brand-700); }

.cag-axis { position: relative; background: linear-gradient(90deg, #fee2e2 0%, #fef3c7 35%, #d1fae5 70%, #a7f3d0 100%); border-radius: var(--r-md); height: 56px; margin: var(--s-5) 0 var(--s-3); }
.cag-axis::before, .cag-axis::after { content: ''; position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,0.08); }
.cag-axis::before { left: 25%; }
.cag-axis::after  { left: 50%; }
.cag-marker { position: absolute; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cag-marker .dot { width: 18px; height: 18px; border-radius: var(--r-full); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.cag-marker.ncbi .dot { background: #0ea5e9; }
.cag-marker.user .dot { background: var(--ink-900); }
.cag-marker .label { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; color: var(--ink-800); background: var(--white); padding: 2px 8px; border-radius: var(--r-full); border: 1px solid var(--ink-200); white-space: nowrap; position: absolute; top: 26px; box-shadow: var(--sh-sm); }
.cag-marker.ncbi .label { color: #0c4a6e; }
.cag-range { position: absolute; top: 50%; transform: translateY(-50%); height: 12px; border-radius: var(--r-full); background: rgba(15,23,42,0.22); border: 2px solid var(--ink-900); }
.cag-axis-marks { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-500); padding: 0 4px; }
.cag-legend { display: flex; gap: var(--s-4); flex-wrap: wrap; margin-top: var(--s-5); font-size: 0.84rem; }
.cag-legend .item { display: flex; align-items: center; gap: 6px; color: var(--ink-700); }
.cag-legend .sw { width: 10px; height: 10px; border-radius: var(--r-full); }
.cag-legend .sw--ncbi { background: #0ea5e9; }
.cag-legend .sw--user { background: var(--ink-900); }

.reasoning { background: var(--ink-50); border-left: 3px solid var(--brand-500); border-radius: var(--r-md); padding: var(--s-4) var(--s-5); margin-top: var(--s-5); }
.reasoning .ttl { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-500); margin-bottom: var(--s-2); }
.reasoning ul { list-style: none; padding: 0; }
.reasoning li { padding-left: 22px; position: relative; margin: 6px 0; font-size: 0.9rem; color: var(--ink-700); line-height: 1.55; }
.reasoning li::before { content: '\f138'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; left: 0; color: var(--brand-600); font-size: 0.86rem; }

/* ===== CONFIDENCE ====================================================== */
.confidence { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5); background: var(--ink-50); border: 1px solid var(--ink-200); border-radius: var(--r-md); margin-bottom: var(--s-6); }
.confidence .head { display: flex; justify-content: space-between; align-items: center; }
.confidence .head .lbl { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-500); }
.confidence .head .pct { font-family: var(--font-head); font-weight: 600; color: var(--ink-900); font-size: 1rem; }
.confidence .bar { height: 6px; background: var(--ink-200); border-radius: var(--r-full); overflow: hidden; }
.confidence .fill { height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand-700)); border-radius: var(--r-full); transition: width 1s; }
.confidence .desc { font-size: 0.9rem; color: var(--ink-600); }
.confidence .inputs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* ===== RECOMMENDATIONS ================================================= */
.rec-list { list-style: none; padding: 0; }
.rec-item { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4) var(--s-5); background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-md); margin-bottom: var(--s-2); transition: border-color .15s, background .15s; }
.rec-item:hover { border-color: var(--brand-400); background: var(--brand-50); }
.rec-item .ric { flex-shrink: 0; width: 30px; height: 30px; border-radius: var(--r-md); background: var(--brand-50); color: var(--brand-700); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.rec-item p { font-size: 0.94rem; color: var(--ink-700); margin: 0; }

/* ===== COLLAPSIBLES ===================================================== */
.collapse { background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-md); margin-bottom: var(--s-2); overflow: hidden; }
.collapse-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-4) var(--s-5); font-weight: 600; font-size: 0.94rem; color: var(--ink-800); cursor: pointer; background: var(--white); transition: background .15s; }
.collapse-head:hover { background: var(--ink-50); }
.collapse-body { display: none; padding: var(--s-4) var(--s-5) var(--s-5); border-top: 1px solid var(--ink-200); }
.collapse.open .collapse-body { display: block; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: var(--s-3); }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: var(--s-2) var(--s-3); background: var(--ink-50); border-radius: var(--r-sm); font-size: 0.88rem; }
.detail-row span { color: var(--ink-600); }
.detail-row strong { color: var(--ink-900); font-family: var(--font-mono); font-size: 0.9rem; }

/* ===== CHARTS =========================================================== */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); margin: var(--s-6) 0; }
@media (max-width: 760px) { .charts-grid { grid-template-columns: 1fr; } }
.chart-card { background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg); padding: var(--s-5) var(--s-6); box-shadow: var(--sh-sm); }
.chart-card h4 { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-500); margin-bottom: var(--s-4); }
.chart-card canvas { max-height: 280px; }

/* ===== MODAL ============================================================ */
.modal-overlay { position: fixed; inset: 0; z-index: 999; background: rgba(15,23,42,0.65); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: var(--s-5); animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay.hidden { display: none; }
.modal { background: var(--white); border-radius: var(--r-lg); max-width: 520px; width: 100%; padding: var(--s-7); box-shadow: var(--sh-xl); animation: scaleIn .25s cubic-bezier(.2,.8,.2,1); }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.modal h3 { margin-bottom: var(--s-3); }
.modal p { font-size: 0.94rem; color: var(--ink-600); margin-bottom: var(--s-3); }
.modal-foot { display: flex; gap: var(--s-3); justify-content: flex-end; margin-top: var(--s-6); }

/* ===== SPINNER ========================================================== */
.spinner-wrap { text-align: center; padding: var(--s-9) var(--s-5); }
.spinner { width: 44px; height: 44px; border: 3px solid var(--ink-200); border-top-color: var(--brand-600); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto var(--s-4); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SEQUENCE PREVIEW ================================================ */
.seq-preview { background: var(--ink-900); color: var(--brand-300); font-family: var(--font-mono); font-size: 0.78rem; padding: var(--s-4); border-radius: var(--r-md); max-height: 110px; overflow-y: auto; line-height: 1.5; word-break: break-all; }

/* ===== FOOTER =========================================================== */
.footer { background: var(--ink-900); color: var(--ink-300); padding: var(--s-8) 0 var(--s-7); margin-top: var(--s-9); }
.footer .container { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--s-7); }
@media (max-width: 760px) { .footer .container { grid-template-columns: 1fr; } }
.footer .brand { color: #fff; margin-bottom: var(--s-3); }
.footer .brand:hover { color: #fff; }
.footer p { color: var(--ink-400); font-size: 0.92rem; }
.footer h5 { color: #fff; font-family: var(--font-head); margin-bottom: var(--s-3); font-size: 0.92rem; text-transform: uppercase; letter-spacing: 0.08em; }
.footer ul { list-style: none; padding: 0; }
.footer li a { color: var(--ink-400); font-size: 0.9rem; padding: 4px 0; display: inline-block; }
.footer li a:hover { color: #fff; }
.footer-bottom { margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--ink-800); font-size: 0.82rem; color: var(--ink-500); text-align: center; }
.footer-bottom .disclaimer { color: #fca5a5; margin-top: 4px; }

/* ===== DATA-SOURCE PROVENANCE =========================================== */
/* Always-visible strip showing where the scientific data comes from. */
.data-sources {
  background: var(--ink-50); border-top: 1px solid var(--ink-200);
  border-bottom: 1px solid var(--ink-200);
  padding: var(--s-3) 0; font-size: 0.84rem;
}
.data-sources .container { display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap; }
.data-sources .label {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.data-sources .src-list { display: flex; gap: var(--s-3); flex-wrap: wrap; flex: 1; }
.data-sources .src {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 4px var(--s-3); background: var(--white); border: 1px solid var(--ink-200);
  border-radius: var(--r-full); color: var(--ink-700); text-decoration: none;
  font-size: 0.82rem; transition: border-color .15s, color .15s;
}
.data-sources .src:hover { border-color: var(--brand-500); color: var(--brand-700); }
.data-sources .src .ic {
  width: 18px; height: 18px; border-radius: var(--r-sm);
  background: linear-gradient(135deg, #0ea5e9, #075985);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; font-family: var(--font-mono);
}
.data-sources .src .ic--snp { background: linear-gradient(135deg, #8b5cf6, #5b21b6); }
.data-sources .src .ic--lit { background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); }

/* Live-fetch pill, shown on results page when NCBI data is freshly retrieved */
.live-fetch {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 4px var(--s-3);
  background: var(--brand-50); color: var(--brand-800);
  border: 1px solid var(--brand-200); border-radius: var(--r-full);
  font-family: var(--font-mono); font-size: 0.74rem;
  font-weight: 500; letter-spacing: 0.04em;
}
.live-fetch .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.18);
  animation: pulse-dot 2s ease-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0   rgba(16,185,129,0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(16,185,129,0.00); }
}
.live-fetch--stale {
  background: var(--ink-100); color: var(--ink-600); border-color: var(--ink-200);
}
.live-fetch--stale .dot { background: var(--ink-400); animation: none; box-shadow: none; }

/* ===== UTILITIES ======================================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--ink-500); }
.text-mono { font-family: var(--font-mono); }
.mt-2 { margin-top: var(--s-3); } .mt-3 { margin-top: var(--s-4); }
.mt-4 { margin-top: var(--s-5); } .mt-5 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-3); } .mb-3 { margin-bottom: var(--s-4); }

.male-only, .female-only { display: none; }

/* ===== MOBILE REFINEMENTS ============================================== */
/* Phones: tighten generous desktop spacing, scale down oversized type,
   make primary CTAs comfortably tappable. Structural collapses (nav,
   grids, tables) are handled by the per-component media queries above. */
@media (max-width: 640px) {
  .container { padding: 0 var(--s-4); }

  .section        { padding: var(--s-8) 0; }
  .section--tight { padding: var(--s-7) 0; }
  .section-head   { margin-bottom: var(--s-6); }
  .section-head p { font-size: 0.96rem; }

  /* Hero */
  .hero { padding: var(--s-8) 0 var(--s-7); }
  .hero-lead { font-size: 1.02rem; }
  .hero-card { padding: var(--s-5); }
  .hero-cta { gap: var(--s-2); }
  .hero-cta .btn { flex: 1 1 auto; justify-content: center; }
  .hero-meta { gap: var(--s-3) var(--s-4); }
  .compare-row .label { width: 90px; font-size: 0.8rem; }

  /* Page head */
  .page-head   { padding: var(--s-7) 0 var(--s-6); }
  .page-head p { font-size: 0.96rem; }

  /* Cards & content blocks */
  .card-body      { padding: var(--s-5); }
  .step-card      { padding: var(--s-5); }
  .compare-card   { padding: var(--s-5); }
  .wizard-progress{ padding: var(--s-4) var(--s-5); }
  .modal          { padding: var(--s-5); }

  /* Wizard footer: keep on one row but trim padding so buttons fit */
  .form-nav { padding: var(--s-4); gap: var(--s-2); }
  .form-nav .btn { padding: var(--s-3) var(--s-4); }
  #stepLabel { display: none; }

  /* Results gauge */
  .gauge-card  { padding: var(--s-6) var(--s-4); }
  .gauge-score { font-size: 3.4rem; }

  /* Data-source strip stacks its label above the chips */
  .data-sources .container { gap: var(--s-2); }

  /* Footer */
  .footer { padding: var(--s-7) 0 var(--s-6); }
}

@media (max-width: 400px) {
  .gauge-score    { font-size: 2.9rem; }
  .stat-card .num { font-size: 1.7rem; }
  .hero-eyebrow   { font-size: 0.72rem; }
  /* Stack the wizard footer when buttons would otherwise crowd */
  .form-nav { flex-wrap: wrap; }
  .form-nav .btn { flex: 1 1 auto; justify-content: center; }
}
