:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --elevated: #eef2f7;
  --bezel: #0d1118;
  --bezel-border: #1e2633;
  --border: #dde3ec;
  --border-strong: #c2ccd9;
  --ink: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --primary: #1e3a5f;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-ink: #ffffff;
  --ok: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --display: "Outfit", system-ui, -apple-system, sans-serif;
  --sans: "Work Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-stage: 0 12px 36px rgba(15, 23, 42, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #080a0f;
  --surface: #10141c;
  --elevated: #171c27;
  --bezel: #07090d;
  --bezel-border: #222938;
  --border: #202634;
  --border-strong: #323c52;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --subtle: #64748b;
  --primary: #38bdf8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-ink: #ffffff;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.28);
  --shadow-stage: 0 18px 44px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { max-width: 100%; overflow-x: hidden; }
html { background: var(--bg); color: var(--ink); scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: rgba(37, 99, 235, 0.2); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  padding: 8px 14px; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.skip-link:focus { top: 12px; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em;
}
.brand svg { flex-shrink: 0; }
.nav-links { display: none; align-items: center; gap: 4px; }
@media (min-width: 920px) { .nav-links { display: flex; } }
.nav-links a {
  padding: 7px 11px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; color: var(--muted);
  transition: color 140ms var(--ease), background-color 140ms var(--ease);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); background: var(--elevated); }
.nav-links a[aria-current="page"] { font-weight: 600; }

.theme-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--elevated);
  font-size: 13px; font-weight: 600; color: var(--ink);
  transition: border-color 140ms, transform 120ms var(--ease);
}
.theme-btn:hover { border-color: var(--border-strong); }
.theme-btn:active { transform: scale(0.97); }

.main-wrap {
  max-width: 1200px; width: 100%; margin: 0 auto;
  padding: 32px 24px 72px; flex: 1;
}

/* Home Hero */
.hero-split {
  display: grid; grid-template-columns: 1fr; gap: 36px; align-items: center;
  padding: 16px 0 44px;
}
@media (min-width: 960px) {
  .hero-split { grid-template-columns: 1.05fr 0.95fr; gap: 44px; padding: 24px 0 56px; }
}
.hero-copy h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(36px, 4.8vw, 56px); line-height: 1.04; letter-spacing: -0.03em;
  margin-bottom: 16px; text-wrap: balance;
}
.hero-copy .lead {
  font-size: 17px; line-height: 1.58; color: var(--muted);
  max-width: 52ch; margin-bottom: 24px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }

.live-spec-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding-top: 20px; border-top: 1px solid var(--border);
}
.spec-pill { min-width: 0; }
.spec-pill span { display: block; font-size: 12px; color: var(--subtle); }
.spec-pill strong { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--ink); }

.hero-console {
  background: var(--bezel);
  border: 1px solid var(--bezel-border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-stage);
  color: #f1f5f9;
}
.console-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.console-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.c-tab {
  padding: 5px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
  color: #94a3b8; transition: color 140ms, background-color 140ms;
}
.c-tab:hover { color: #f8fafc; background: rgba(255, 255, 255, 0.08); }
.c-tab.active { color: #0f172a; background: #f8fafc; }
.console-canvas-wrap {
  border-radius: 10px; overflow: hidden; background: #06080c;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.console-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 12px; font-size: 12.5px; color: #94a3b8;
}
.console-foot a { color: #60a5fa; font-weight: 600; }
.console-foot a:hover { text-decoration: underline; }

.sec-head { margin: 20px 0 20px; }
.sec-head h2 {
  font-family: var(--display); font-size: clamp(24px, 3vw, 30px);
  font-weight: 700; letter-spacing: -0.025em; margin-bottom: 4px;
}
.sec-head p { color: var(--muted); font-size: 15px; }

.flagship-row { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 20px; }
@media (min-width: 820px) { .flagship-row { grid-template-columns: 1.15fr 0.85fr; } }

.suite-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-bottom: 44px; }

.lab-card {
  min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 20px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
  transition: transform 180ms var(--ease), border-color 180ms var(--ease);
}
.lab-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.lab-card.featured { padding: 24px; border-radius: var(--r-lg); }
.card-visual {
  border-radius: var(--r-sm); background: var(--elevated); border: 1px solid var(--border);
  padding: 12px; display: flex; align-items: center; justify-content: center; min-height: 92px;
}
.lab-card.featured .card-visual { min-height: 112px; }
.card-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--accent); margin-bottom: 6px; }
.lab-card h3 { font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 6px; }
.lab-card.featured h3 { font-size: 22px; }
.lab-card p { font-size: 14px; color: var(--muted); line-height: 1.55; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 600;
}

.breadcrumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.breadcrumbs a:hover { color: var(--ink); text-decoration: underline; }
.page-head { margin-bottom: 22px; max-width: 72ch; }
.page-head h1 {
  font-family: var(--display); font-size: clamp(28px, 3.8vw, 40px);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 8px;
}
.page-head p { color: var(--muted); font-size: 15.5px; }

.stage-card {
  min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-stage); margin-bottom: 28px;
}
.stage-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--border);
}
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); background: var(--elevated); color: var(--ink);
  transition: border-color 140ms, background-color 140ms, transform 100ms var(--ease);
}
.btn:hover:not(:disabled) { border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }

.select-ctrl {
  padding: 9px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--elevated); color: var(--ink);
  font-family: inherit; font-size: 14px; font-weight: 500;
}

.kbd {
  display: inline-flex; align-items: center; justify-content: center; padding: 2px 7px;
  border-radius: 5px; font-family: var(--mono); font-size: 12px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: 0 2px 0 var(--border-strong); color: var(--ink);
}

.metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-box { min-width: 0; background: var(--elevated); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 15px; }
.metric-label { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.metric-val { font-family: var(--mono); font-size: 21px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-bad { color: var(--bad); }

.canvas-frame {
  width: 100%; border-radius: var(--r-md); border: 1px solid var(--bezel-border);
  background: var(--bezel); overflow: hidden; position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
canvas.diag-canvas { display: block; width: 100%; height: auto; }

.swatch-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.swatch-btn { width: 30px; height: 30px; border-radius: 6px; border: 2px solid var(--border-strong); transition: transform 120ms var(--ease); }
.swatch-btn:hover { transform: scale(1.1); }
.swatch-btn.active { outline: 2px solid var(--accent); outline-offset: 2px; }

.notice-bar {
  margin-top: 14px; padding: 12px 15px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--elevated); font-size: 13.5px; color: var(--muted);
}
.notice-bar strong { color: var(--ink); }

.next-strip {
  margin: 28px 0 40px; padding: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-card);
}
.next-strip h2 { font-family: var(--display); font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.next-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.next-card {
  min-width: 0; padding: 14px 16px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--elevated); display: flex; flex-direction: column; gap: 4px;
  transition: border-color 140ms, transform 140ms var(--ease);
}
.next-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.next-card strong { font-size: 14.5px; }
.next-card span { font-size: 13px; color: var(--muted); }

.guide-article { display: grid; grid-template-columns: 1fr; gap: 32px; padding-top: 28px; border-top: 1px solid var(--border); }
@media (min-width: 900px) { .guide-article { grid-template-columns: 1.45fr 1fr; align-items: start; } }
.guide-body h2 { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 24px 0 10px; }
.guide-body h2:first-child { margin-top: 0; }
.guide-body p { color: var(--muted); margin-bottom: 13px; max-width: 68ch; font-size: 15.5px; }
.guide-body ul { margin: 0 0 18px 20px; color: var(--muted); font-size: 15px; }
.guide-body li { margin-bottom: 7px; }
.guide-body strong { color: var(--ink); }

.faq-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px; box-shadow: var(--shadow-card); }
.faq-panel h2 { font-family: var(--display); font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.faq-entry { padding: 13px 0; border-top: 1px solid var(--border); }
.faq-entry:first-of-type { border-top: 0; padding-top: 0; }
.faq-entry h3 { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.faq-entry p { font-size: 13.5px; color: var(--muted); line-height: 1.55; }

.prose-page { max-width: 72ch; }
.prose-page h2 { font-family: var(--display); font-size: 21px; font-weight: 700; margin: 24px 0 8px; }
.prose-page p, .prose-page li { color: var(--muted); margin-bottom: 11px; font-size: 15.5px; }
.prose-page ul { margin-left: 20px; margin-bottom: 16px; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 24px; margin-top: auto; }
.footer-inner {
  max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 16px; font-size: 13.5px; color: var(--muted);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

.fs-screen { position: fixed; inset: 0; z-index: 9999; display: none; cursor: crosshair; user-select: none; }
.fs-screen.active { display: block; }
.fs-hud {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  padding: 9px 16px; border-radius: var(--r-md);
  background: rgba(9, 11, 14, 0.88); border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f2f4f8; font-size: 13px; display: flex; align-items: center; gap: 10px; transition: opacity 220ms;
}
.fs-hud.dim { opacity: 0.14; }
.fs-hud:hover { opacity: 1; }

@media (max-width: 580px) {
  .main-wrap { padding: 20px 14px 52px; }
  .header-inner { padding: 10px 14px; }
  .stage-card { padding: 14px; }
  .metrics-row { grid-template-columns: 1fr 1fr; }
  .live-spec-strip { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
