:root {
  color-scheme: dark;
  --bg-base: #0b1220;
  --bg-deep: #020617;
  --bg-panel: #0f172a;
  --bg-surface: #111827;
  --bg-muted: #1e293b;
  --bg-soft: rgba(30, 41, 59, 0.68);
  --text: #e2e8f0;
  --text-strong: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(96, 165, 250, 0.3);
  --accent: #60a5fa;
  --accent-strong: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --success: #34d399;
  --shadow: 0 24px 64px rgba(2, 6, 23, 0.42);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.14), transparent 28%),
    linear-gradient(180deg, #0b1220 0%, #08101e 100%);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; }
.site-header {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--border); background: rgba(11, 18, 32, 0.88); backdrop-filter: blur(18px);
}
.header-left, .header-right { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo {
  width: 48px; height: 48px; border-radius: 16px; object-fit: cover; background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.brand-copy strong { display: block; color: var(--text-strong); font-size: 1rem; line-height: 1.2; }
.brand-copy span { display: block; color: var(--text-muted); font-size: 0.92rem; line-height: 1.2; margin-top: 3px; }
.menu-button {
  display: none; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg-soft); color: var(--text); cursor: pointer;
}
.lang-switcher {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--border);
  border-radius: 999px; background: rgba(15, 23, 42, 0.92);
}
.lang-switcher button {
  border: 0; border-radius: 999px; background: transparent; color: var(--text-muted); padding: 8px 14px;
  font-size: 0.88rem; font-weight: 700; letter-spacing: 0.04em; cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.lang-switcher button:hover { color: var(--text-strong); }
.lang-switcher button.active {
  background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 77px); }
.sidebar { border-right: 1px solid var(--border); background: rgba(15, 23, 42, 0.9); padding: 24px 16px; }
.sidebar-inner { position: sticky; top: 100px; }
.sidebar-label {
  margin: 0 0 14px; color: var(--text-muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid transparent; border-radius: 14px;
  color: var(--text-muted); transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.sidebar a:hover { color: var(--text-strong); background: rgba(59, 130, 246, 0.1); }
.sidebar a.active { color: var(--text-strong); background: rgba(59, 130, 246, 0.18); border-color: rgba(96, 165, 250, 0.24); }
.sidebar-overlay { display: none; }
.page-content { width: 100%; max-width: 1180px; padding: 32px clamp(20px, 4vw, 48px) 64px; }
.hero-card, .content-section, .mini-card, .card {
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.96));
  box-shadow: var(--shadow);
}
.hero-card { padding: clamp(24px, 4vw, 38px); }
.hero-grid, .two-column, .mini-card-grid, .card-grid { display: grid; gap: 18px; }
.hero-grid, .two-column, .mini-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-grid { align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 7px 12px; border: 1px solid var(--border-strong);
  border-radius: 999px; background: var(--accent-soft); color: #bfdbfe; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
h1, h2, h3 { margin: 0; color: var(--text-strong); line-height: 1.15; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.35rem, 2vw, 1.7rem); }
h3 { font-size: 1.05rem; }
p, li { color: var(--text); line-height: 1.75; }
.lead { margin: 14px 0 0; max-width: 72ch; color: var(--text-muted); font-size: 1.05rem; }
.section-stack { display: grid; gap: 22px; margin-top: 24px; }
.content-section { padding: clamp(22px, 3vw, 28px); }
.section-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px;
}
.section-label {
  margin: 0 0 8px; color: #93c5fd; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.card-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 24px; }
.card, .mini-card { padding: 22px; }
.card { position: relative; overflow: hidden; transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease; }
.card::after { content: "→"; position: absolute; right: 22px; bottom: 18px; color: #93c5fd; font-size: 1.1rem; }
.card:hover {
  transform: translateY(-4px); border-color: rgba(96, 165, 250, 0.34); background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
}
.card p, .mini-card p { margin: 10px 0 0; color: var(--text-muted); }
.info-list, .steps, .tag-list { margin: 0; }
.info-list, .steps { padding-left: 1.2rem; display: grid; gap: 10px; }
.tag-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tag {
  display: inline-flex; align-items: center; padding: 8px 12px; border: 1px solid rgba(96, 165, 250, 0.24); border-radius: 999px;
  background: rgba(59, 130, 246, 0.12); color: #bfdbfe; font-size: 0.92rem;
}
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-panel); }
.feature-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.feature-table th, .feature-table td {
  padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top;
}
.feature-table thead th { background: rgba(30, 41, 59, 0.92); color: #bfdbfe; font-size: 0.92rem; }
.feature-table tbody tr:last-child td { border-bottom: 0; }
.code-block {
  margin: 16px 0 0; padding: 18px; border: 1px solid rgba(148, 163, 184, 0.24); border-radius: var(--radius-md); background: #1e293b;
  color: var(--text); overflow-x: auto; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem; line-height: 1.7;
}
.notice, .warning-box { margin-top: 18px; padding: 16px 18px; border-radius: var(--radius-md); }
.notice { border: 1px solid rgba(52, 211, 153, 0.26); background: rgba(52, 211, 153, 0.1); color: #a7f3d0; }
.warning-box { border: 1px solid rgba(251, 191, 36, 0.24); background: var(--warning-soft); color: #fde68a; }
/* ── Figure / Screenshot ─────────────────────────────────────────── */
figure.screenshot {
  margin: 18px 0 0;
  padding: 0;
}
figure.screenshot img {
  display: block;
  max-width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(2,6,23,0.4);
}
figure.screenshot figcaption {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}
/* Placeholder shown when image not yet available */
figure.screenshot .fig-placeholder {
  display: grid;
  place-items: center;
  min-height: 210px;
  padding: 24px;
  border: 1px dashed rgba(148,163,184,0.38);
  border-radius: 14px;
  background: rgba(148,163,184,0.06);
  color: var(--text-muted);
  text-align: center;
  gap: 8px;
}
figure.screenshot .fig-placeholder .fig-name {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 6px;
}
figure.screenshot .fig-placeholder .fig-desc {
  font-size: 0.88rem;
}
figure.screenshot.compact .fig-placeholder { min-height: 180px; }
/* Hide placeholder when image loaded; hide img when placeholder shown */
figure.screenshot img.loaded + .fig-placeholder { display: none; }
figure.screenshot.has-error img { display: none; }
.screenshot-placeholder {
  display: grid; place-items: center; min-height: 210px; margin-top: 18px; padding: 24px; border: 1px dashed rgba(148, 163, 184, 0.38);
  border-radius: 22px; background: rgba(148, 163, 184, 0.08); color: var(--text-muted); text-align: center;
}
.screenshot-placeholder.compact { min-height: 180px; margin-top: 0; }
.footer-note { margin-top: 28px; color: var(--text-muted); font-size: 0.92rem; }
@media (max-width: 960px) {
  .menu-button { display: inline-flex; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 77px; left: 0; bottom: 0; width: min(84vw, 320px); transform: translateX(-105%); transition: transform 0.24s ease; z-index: 50;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-overlay {
    display: block; position: fixed; inset: 77px 0 0; background: rgba(2, 6, 23, 0.7); opacity: 0; pointer-events: none; transition: opacity 0.24s ease; z-index: 45;
  }
  body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
  .page-content { padding-top: 24px; }
  .hero-grid, .two-column, .mini-card-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .site-header { padding: 12px 14px; }
  .brand-logo { width: 42px; height: 42px; border-radius: 14px; }
  .brand-copy span { font-size: 0.84rem; }
  .lang-switcher button { padding: 8px 10px; }
  .hero-card, .content-section, .card, .mini-card { border-radius: 20px; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Setup step list */
.step-list { padding-left: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 18px; margin: 14px 0 0; }
.step-list li { counter-increment: step; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 14px 52px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 12px; position: relative; }
.step-list li::before { content: counter(step); position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; background: var(--accent); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; }
.step-list li strong { font-size: 0.97rem; color: var(--text-primary); }
.step-list li p { font-size: 0.9rem; color: var(--text-secondary); margin: 0; }
.ext-link { display: inline-block; margin-top: 6px; font-size: 0.88rem; font-weight: 600; color: var(--accent-light); text-decoration: none; }
.ext-link:hover { text-decoration: underline; }
.info-box { margin-top: 18px; padding: 14px 18px; background: var(--warning-subtle); border: 1px solid rgba(234,179,8,0.3); border-radius: 12px; }
.info-box p { margin: 0 0 6px; font-size: 0.9rem; color: var(--text-secondary); }
.info-box p:first-child { font-weight: 700; color: var(--warning-text); }
.section-note { font-size: 0.9rem; color: var(--text-secondary); margin-top: 4px; }
