:root {
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --dark: #0d1117;
  --dark-card: #0f172a;
  --dark-border: #1e293b;
  --green: #10b981;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.blue { color: var(--blue); }
.green { color: var(--green); }
.hidden { display: none !important; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  overflow-x: auto;
}
.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 20px 2px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--blue); border-bottom-color: var(--blue); }

.header-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.lang-switch { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-muted); }
.lang-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 13px; }
.lang-btn.active { color: var(--text); font-weight: 700; }
.auth-actions { display: flex; align-items: center; gap: 10px; }

/* Buttons */
.btn-primary, .btn-outline, .btn-white, .btn-dark-outline, .btn-text {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  border: 1px solid var(--blue);
  padding: 10px 18px;
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-outline {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 18px;
}
.btn-outline:hover { background: var(--bg-alt); }
.btn-white {
  background: #fff;
  color: var(--dark);
  border: 1px solid #fff;
  padding: 10px 18px;
}
.btn-dark-outline {
  background: transparent;
  color: #e2e8f0;
  border: 1px solid #334155;
  padding: 10px 18px;
}
.btn-text { background: none; border: none; color: var(--text-muted); padding: 6px 8px; }
.btn-text:hover { color: var(--text); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-xs { padding: 5px 12px; font-size: 12px; }

/* Views */
.view-section { display: none; }
.view-section.active { display: block; }

/* Hero */
.hero-wrap { padding: 72px 0 64px; border-bottom: 1px solid var(--border); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.dot-green { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.hero-title { font-size: 48px; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 18px; }
.hero-title .accent { color: var(--blue); }
.hero-subtitle { font-size: 16px; color: var(--text-muted); max-width: 520px; margin-bottom: 28px; }
.hero-cta { display: flex; gap: 12px; margin-bottom: 24px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-muted); }

/* Dark Routing Card */
.dark-card {
  background: var(--dark);
  color: #f8fafc;
  border-radius: var(--radius-lg);
  border: 1px solid var(--dark-border);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.14);
}
.routing-card { padding: 22px; }
.card-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.badge-green {
  font-size: 12px;
  color: var(--green);
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 10px;
  border-radius: 999px;
}
.endpoint-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #161b22;
  border: 1px solid #263042;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
.method-tag {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
}
.status-200 { margin-left: auto; color: var(--green); font-weight: 700; }

.flow-diagram {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}
.flow-node {
  flex: 1;
  background: #161b22;
  border: 1px solid #263042;
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.flow-node.active-node { border-color: var(--blue); background: rgba(37, 99, 235, 0.12); }
.node-idx { font-size: 11px; color: #64748b; }
.flow-node strong { font-size: 13px; }
.flow-node small { font-size: 11px; color: #94a3b8; }
.flow-arrow { font-size: 11px; color: #64748b; white-space: nowrap; }

.kv-box {
  background: #161b22;
  border: 1px solid #263042;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12.5px;
  margin-bottom: 16px;
}
.kv-row { display: flex; justify-content: space-between; padding: 3px 0; gap: 12px; }
.kv-key { color: #94a3b8; }
.kv-val { color: #e2e8f0; word-break: break-all; }
.card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #263042;
  padding-top: 14px;
}
.card-metrics small { display: block; font-size: 11px; color: #94a3b8; }
.card-metrics strong { font-size: 13px; }

/* Ecosystem Strip */
.ecosystem-strip { background: var(--bg-alt); border-bottom: 1px solid var(--border); padding: 20px 0; }
.ecosystem-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.eco-label { font-size: 13px; color: var(--text-muted); }
.eco-logos { display: flex; gap: 28px; flex-wrap: wrap; font-weight: 600; font-size: 14px; color: #334155; }

/* Sections & Bento Wireframe Grid */
.section-block { padding: 72px 0; border-bottom: 1px solid var(--border); }
.section-block.alt-bg { background: var(--bg-alt); }
.section-eyebrow { font-size: 12px; color: var(--blue); letter-spacing: 0.06em; margin-bottom: 10px; font-weight: 600; }
.section-title { font-size: 32px; letter-spacing: -0.02em; margin-bottom: 10px; }
.section-desc { font-size: 15px; color: var(--text-muted); margin-bottom: 32px; }
.cap-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.cap-header .section-desc { margin-bottom: 10px; max-width: 420px; }

.bento-grid {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fff;
}
.bento-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.bento-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.bento-cell {
  padding: 28px 24px;
  border-right: 1px solid var(--border);
  position: relative;
  transition: background 0.15s;
}
.bento-cell[data-jump] { cursor: pointer; }
.bento-cell[data-jump]:hover { background: var(--bg-alt); }
.bento-cell:last-child { border-right: none; }
.bento-num { font-size: 13px; font-weight: 700; margin-bottom: 14px; }
.bento-cell h3 { font-size: 17px; margin-bottom: 8px; }
.bento-cell p { font-size: 14px; color: var(--text-muted); }
.bento-arrow { position: absolute; right: 20px; bottom: 18px; color: var(--blue); font-weight: 700; }

/* Split Model Directory */
.split-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 40px; align-items: start; }
.link-blue { color: var(--blue); font-weight: 600; text-decoration: none; font-size: 14px; }
.table-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.model-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.model-table th, .model-table td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.model-table th { font-size: 11.5px; color: var(--text-muted); background: var(--bg-alt); font-weight: 600; }
.model-table tr:last-child td { border-bottom: none; }
.status-available { display: inline-flex; align-items: center; gap: 6px; color: #059669; font-weight: 500; }

/* Dark CTA Banner */
.cta-banner {
  padding: 40px 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.cta-eyebrow { font-size: 12px; color: #60a5fa; letter-spacing: 0.08em; margin-bottom: 10px; }
.cta-banner h2 { font-size: 28px; margin-bottom: 6px; }
.cta-banner p { color: #94a3b8; font-size: 15px; }
.cta-buttons { display: flex; gap: 12px; }

/* Subpages */
.page-container { padding: 52px 24px 80px; max-width: 720px; }
.page-container.wide { max-width: 1120px; }
.panel-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
}
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-stack label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 500; }
.form-inline { display: flex; gap: 10px; }
.form-inline input { flex: 1; }
input, select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
input:focus, select:focus { border-color: var(--blue); }

.result-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 14px;
  word-break: break-all;
}
.result-box.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.setup-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.setup-controls label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.code-preview-wrap { background: var(--dark); color: #e2e8f0; border-radius: var(--radius-md); overflow: hidden; }
.code-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #161b22;
  border-bottom: 1px solid #263042;
  font-size: 12px;
}
.code-block { padding: 18px; overflow-x: auto; font-size: 13px; line-height: 1.65; }

/* Stats & Admin */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-tile { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; }
.stat-tile small { color: var(--text-muted); font-size: 12px; display: block; margin-bottom: 6px; }
.stat-tile strong { font-size: 24px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.workspace-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.workspace-btns { display: flex; gap: 8px; }

/* Footer & Cookie */
.site-footer { padding: 28px 0; text-align: center; font-size: 13px; color: var(--text-muted); }
.cookie-banner {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: #e2e8f0;
  padding: 10px 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 60;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-card {
  background: #fff;
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }

@media (max-width: 900px) {
  .hero-grid, .split-grid, .bento-grid.cols-3, .bento-grid.cols-4, .setup-controls, .stats-grid, .admin-grid {
    grid-template-columns: 1fr;
  }
  .bento-cell { border-right: none; border-bottom: 1px solid var(--border); }
  .bento-cell:last-child { border-bottom: none; }
  .hero-title { font-size: 36px; }
}
