:root {
  --bg: #0a0b14;
  --bg-2: #0e0f1c;
  --panel: #131526;
  --panel-2: #171a30;
  --text: #eceefb;
  --text-dim: #a8acc8;
  --muted: #797ea3;
  --border: #262a48;
  --border-soft: #1c2038;
  --accent: #7c8bff;
  --accent-grad: linear-gradient(135deg, #7c8bff 0%, #b06cf9 60%, #ff7ac6 100%);
  --accent-soft: rgba(124, 139, 255, 0.14);
  --success: #3ddc97;
  --success-soft: rgba(61, 220, 151, 0.12);
  --warning: #f5b942;
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.1);
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.35);
  --font-heading: "Space Grotesk", "Inter", -apple-system, Segoe UI, sans-serif;
  --font-body: "Inter", -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(124, 139, 255, 0.16), transparent 60%),
    radial-gradient(700px 450px at 100% 0%, rgba(176, 108, 249, 0.12), transparent 55%),
    radial-gradient(800px 500px at 50% 100%, rgba(255, 122, 198, 0.06), transparent 60%),
    var(--bg);
}

h1, h2, h3, h4, h5 { font-family: var(--font-heading); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 8px; }
p { margin: 0 0 12px; color: var(--text-dim); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 11, 20, 0.72);
  border-bottom: 1px solid var(--border-soft);
}

.site-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 1.1em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.3em; }
.brand-name strong { color: var(--accent); font-weight: 700; }

.site-nav { display: flex; align-items: center; gap: 22px; font-size: 0.92em; }
.site-nav a { color: var(--text-dim); font-weight: 500; padding: 6px 2px; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.nav-github { display: flex; align-items: center; gap: 6px; }

/* ---------- Layout ---------- */

.site-main { max-width: 1180px; margin: 0 auto; padding: 0 24px 80px; }

.site-footer { border-top: 1px solid var(--border-soft); margin-top: 60px; }
.footer-badges {
  max-width: 1180px; margin: 0 auto; padding: 24px 24px 0;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 8px;
}
.footer-badges .badge {
  font-size: 0.78em; font-weight: 600; color: var(--text-dim);
  background: var(--panel); border: 1px solid var(--border-soft);
  padding: 5px 12px; border-radius: 999px;
}
.site-footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 18px 24px 26px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  font-size: 0.85em; color: var(--muted);
}
.site-footer-inner a { color: var(--muted); }
.site-footer-inner a:hover { color: var(--accent); }

/* ---------- Hero ---------- */

.hero { padding: 64px 0 36px; text-align: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8em; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2.1em, 5vw, 3.2em);
  line-height: 1.1;
  margin-bottom: 16px;
}
.hero h1 .grad {
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { font-size: 1.15em; max-width: 640px; margin: 0 auto 8px; color: var(--text-dim); }

.hero-cta-row { display: flex; gap: 14px; justify-content: center; margin: 28px 0 8px; flex-wrap: wrap; }
.btn-secondary {
  display: inline-flex; align-items: center; padding: 13px 22px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: 0.98em;
  background: var(--panel);
}
.btn-secondary:hover { border-color: var(--accent); text-decoration: none; background: var(--accent-soft); }
a.btn-primary { display: inline-flex; align-items: center; text-decoration: none; }
a.btn-primary:hover { text-decoration: none; }

.browser-mockup {
  max-width: 880px; margin: 48px auto 0; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  background: var(--panel);
}
.browser-mockup-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--panel-2); border-bottom: 1px solid var(--border-soft);
}
.browser-mockup-bar .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-red { background: #ff5f57; } .dot-yellow { background: #febc2e; } .dot-green { background: #28c840; }
.browser-mockup-url {
  margin-left: 12px; font-family: var(--font-mono); font-size: 0.78em; color: var(--muted);
  background: var(--bg-2); padding: 3px 10px; border-radius: 6px;
}
.browser-mockup img { display: block; width: 100%; }

/* ---------- How it works / differentiation sections ---------- */

.section-heading { text-align: center; font-size: 1.7em; margin-bottom: 6px; }
.section-sub { text-align: center; max-width: 560px; margin: 0 auto 36px; }

.how-it-works, .diff-section { max-width: 1040px; margin: 76px auto 0; padding: 0 4px; }

.steps-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px;
}
.step-tile {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 22px 20px; position: relative;
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent-grad);
  color: white; font-family: var(--font-heading); font-weight: 700; margin-bottom: 12px;
}
.step-tile h4 { margin-bottom: 6px; }
.step-tile p { font-size: 0.9em; margin: 0; }

.diff-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px;
}
.diff-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 24px 22px;
}
.diff-card .icon { font-size: 1.6em; display: block; margin-bottom: 10px; }
.diff-card h4 { margin-bottom: 6px; font-size: 1.02em; }
.diff-card p { font-size: 0.9em; margin: 0; }

.feature-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 40px 0 8px;
}
.feature-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
  text-align: left;
}
.feature-card .icon { font-size: 1.4em; margin-bottom: 8px; display: block; }
.feature-card h4 { font-size: 0.98em; margin-bottom: 4px; }
.feature-card p { font-size: 0.85em; margin: 0; }

/* ---------- Cards / panels ---------- */

.panel {
  max-width: 720px;
  margin: 36px auto 0;
  padding: 32px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.panel.wide { max-width: 1040px; }

.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }

section.block {
  max-width: 1040px;
  margin: 0 auto 24px;
  padding: 26px 30px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
section.block h2 { font-size: 1.15em; }

.page-title { max-width: 1040px; margin: 44px auto 4px; }
.page-title h1 { font-size: 1.8em; }
.page-subtitle { max-width: 1040px; margin: 0 auto 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--border-soft); }
.tab-btn {
  padding: 10px 16px; border: none; background: none; color: var(--text-dim);
  font-family: var(--font-body); font-weight: 600; font-size: 0.95em; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel.hidden { display: none; }

/* ---------- Block headers (title + action link) ---------- */

.block-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 4px; }
.block-header h2 { margin: 0; }

/* ---------- Forms ---------- */

.upload-form { display: flex; flex-direction: column; gap: 6px; }
.upload-form label { font-weight: 600; margin-top: 18px; font-size: 0.92em; }
.upload-form input[type=text],
.upload-form input[type=file],
.upload-form textarea {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95em;
}
.upload-form textarea { resize: vertical; }
.upload-form input[type=text]:focus, .upload-form input[type=file]:focus, .upload-form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.upload-form input[type=file] {
  padding: 9px;
}
.upload-form input[type=file]::file-selector-button {
  padding: 8px 14px; margin-right: 10px; border: none; border-radius: 8px;
  background: var(--accent-grad); color: white; font-weight: 600; cursor: pointer; font-family: var(--font-body);
}
.hint { color: var(--muted); font-size: 0.83em; margin: 6px 0 0; }

button {
  font-family: var(--font-body);
}

button[type=submit], .btn-primary {
  margin-top: 24px;
  padding: 13px 22px;
  border: none;
  border-radius: 10px;
  background: var(--accent-grad);
  color: white;
  font-weight: 600;
  font-size: 0.98em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(124, 139, 255, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
button[type=submit]:hover, .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(124, 139, 255, 0.35);
}

.error {
  background: var(--danger-soft);
  border: 1px solid rgba(255, 107, 107, 0.35);
  padding: 12px 16px;
  border-radius: 10px;
  color: #ffb4b4;
  margin: 16px 0;
  max-width: 1040px;
  margin-left: auto; margin-right: auto;
}

.progress-bar-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-grad);
  transition: width 0.6s ease;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 4px 16px 4px 0;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.92em;
  font-weight: 500;
}
.back-link:hover { text-decoration: underline; }

/* ---------- Analysis level cards ---------- */

.level-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.level-option {
  display: grid; grid-template-columns: auto 1fr; align-items: start; column-gap: 12px; row-gap: 2px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; font-weight: normal;
  background: var(--bg-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.level-option input[type=radio] { grid-row: 1 / 3; margin-top: 3px; accent-color: var(--accent); }
.level-option:hover { border-color: #3a3f66; }
.level-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.level-name { font-weight: 700; font-family: var(--font-heading); }
.level-desc { color: var(--muted); font-size: 0.85em; }

/* ---------- Model picker ---------- */

.link-btn {
  background: none; border: none; color: var(--accent); cursor: pointer;
  padding: 0; margin-top: 20px; font-size: 0.9em; text-align: left; font-weight: 600;
}
.model-groups { margin-top: 14px; padding: 16px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--bg-2); }
.model-groups.hidden { display: none; }
.model-group h4 { margin-bottom: 8px; font-size: 0.9em; color: var(--text-dim); }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.checkbox-item {
  font-weight: normal; display: flex; align-items: center; gap: 6px; font-size: 0.87em;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel);
}

/* ---------- Utility ---------- */

.hidden { display: none; }

/* ---------- Clarifying questions (dataset description step) ---------- */

.question-card {
  border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px 16px;
  margin: 12px 0; background: var(--bg-2);
}
.question-text { margin: 0 0 10px; font-weight: 500; }
.question-choice { display: flex; margin-bottom: 6px; }
.question-choice:last-child { margin-bottom: 0; }

/* ---------- Join cards ---------- */

.join-card {
  border: 1px solid var(--border-soft); border-radius: 12px; padding: 18px; margin-top: 16px;
  background: var(--bg-2);
}
.join-card h3 { margin-top: 0; font-size: 1.05em; }
.join-fields { display: flex; align-items: flex-end; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.join-fields > div { display: flex; flex-direction: column; gap: 4px; font-size: 0.88em; }
.join-fields > div label { font-weight: 600; color: var(--text-dim); }
.join-fields select {
  padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-family: var(--font-body);
}

/* ---------- Tables ---------- */

.comparison-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.92em; }
.comparison-table th {
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border);
  color: var(--muted); font-weight: 600; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.03em;
}
.comparison-table td {
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border-soft);
}
.comparison-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.comparison-table .best-row { background: var(--success-soft); }
.comparison-table .best-row td:first-child::before { content: "★ "; color: var(--success); }
.comparison-table .needs-input-row { background: rgba(245, 185, 66, 0.1); }
.comparison-table .needs-input-row td:first-child::before { content: "⚠ "; color: var(--warning); }

.table-scroll { overflow-x: auto; }

.threshold-chart { width: 100%; max-width: 560px; height: auto; margin-top: 10px; }
.chart-gridline { stroke: var(--border-soft); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 9px; font-family: var(--font-body); }
.chart-axis-label { fill: var(--muted); font-size: 10px; font-family: var(--font-body); text-transform: uppercase; letter-spacing: 0.04em; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-peak-line { stroke: var(--success); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart-peak-dot { fill: var(--success); stroke: var(--bg); stroke-width: 1.5; }
.chart-hit-point { fill: transparent; cursor: crosshair; }
.chart-hover-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 2; pointer-events: none; }
.chart-hover-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 1.5; pointer-events: none; }
.chart-tooltip { pointer-events: none; }
.chart-tooltip-bg { fill: var(--panel); stroke: var(--border); stroke-width: 1; }
.chart-tooltip-text { fill: var(--text); font-size: 10px; font-family: var(--font-body); }
.chart-peak-label { fill: var(--success); font-size: 11px; font-weight: 600; font-family: var(--font-body); }

/* ---------- Insights list ---------- */

.insights { padding-left: 0; margin: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.insights li {
  position: relative; padding: 12px 16px 12px 40px; background: var(--bg-2);
  border: 1px solid var(--border-soft); border-radius: 10px; font-size: 0.94em;
}
.insights li::before {
  content: "💡"; position: absolute; left: 14px; top: 11px; font-size: 0.95em;
}

/* ---------- Charts ---------- */

.charts { display: flex; flex-wrap: wrap; gap: 18px; }
.chart {
  background: white; border-radius: 12px; padding: 10px; border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
}
.chart img { max-width: 100%; display: block; border-radius: 6px; }

/* ---------- Chat ---------- */

#chat-log {
  height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 16px;
  background: var(--bg-2);
  margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg { padding: 10px 14px; border-radius: 12px; max-width: 78%; font-size: 0.93em; line-height: 1.45; }
.msg.user { background: var(--accent-grad); color: white; margin-left: auto; border-bottom-right-radius: 4px; }
.msg.bot { background: var(--panel-2); color: var(--text); border: 1px solid var(--border-soft); border-bottom-left-radius: 4px; }
.msg.ai { background: var(--accent-soft); border: 1px solid var(--accent); }
.msg.ai-error { background: var(--panel-2); border: 1px dashed var(--border); color: var(--muted); font-size: 0.85em; }

.ai-mode-panel {
  border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px 14px;
  margin-bottom: 14px; background: var(--bg-2);
}
.ai-mode-panel .checkbox-item { margin-bottom: 4px; }
#ai-model-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
#ai-model-row label { font-size: 0.85em; color: var(--muted); }
#ai-model-select {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 0.85em;
}

#chat-form { display: flex; gap: 10px; }
#chat-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-body);
}
#chat-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#chat-form button { margin-top: 0; padding: 12px 20px; }

/* ---------- Misc ---------- */

.step-timeline { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.step-timeline li {
  counter-increment: step;
  position: relative;
  padding: 4px 0 20px 34px;
  border-left: 2px solid var(--border);
}
.step-timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.step-timeline li::before {
  content: counter(step);
  position: absolute; left: -13px; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-grad); color: white;
  font-size: 0.8em; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.step-detail { margin: 4px 0 0; font-size: 0.88em; }
.btn-edit-step {
  flex-shrink: 0; font-size: 0.85em; font-weight: 600; color: var(--accent);
  border: 1px solid var(--border); padding: 6px 12px; border-radius: 8px;
  white-space: nowrap;
}
.btn-edit-step:hover { border-color: var(--accent); text-decoration: none; background: var(--accent-soft); }

.stat-row { display: flex; gap: 24px; flex-wrap: wrap; margin: 10px 0; }
.stat-pill {
  background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 10px 16px; font-size: 0.9em;
}
.stat-pill strong { color: var(--text); font-family: var(--font-heading); }

details summary { cursor: pointer; font-weight: 600; color: var(--text-dim); padding: 4px 0; }
details summary:hover { color: var(--text); }
details[open] summary { margin-bottom: 8px; }

@media (max-width: 640px) {
  .site-header-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .site-nav { gap: 14px; flex-wrap: wrap; }
  .panel { padding: 22px; }
  section.block { padding: 20px; }
}
