@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=JetBrains+Mono:wght@400;500&family=Inter:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

:root {
  --bg:          #0a0b14;
  --surface:     #13141f;
  --surface2:    #1b1c2e;
  --border:      #252640;
  --accent:      #f0a500;
  --accent-dim:  #6b4800;
  --teal:        #00d4aa;
  --teal-dim:    #004d3e;
  --text:        #c9d1e0;
  --text-muted:  #6b7280;
  --code-bg:     #0d0e1a;
  --link:        #60a5fa;
  --success:     #34d399;
  --warning:     #f59e0b;
  --error:       #f87171;
  --purple:      #c084fc;
  --sidebar-w:   260px;
  --toc-w:       200px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.75;
  display: flex;
  min-height: 100vh;
}

body:not(.welcome-body) {
  padding-left: var(--sidebar-w);
  justify-content: center;
}

body.no-sidebar {
  padding-left: 0;
}

/* ── Search trigger (sidebar button) ─────────────────── */
.search-trigger {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 12px;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  width: calc(100% - 24px);
  text-align: left;
  transition: border-color .15s, color .15s;
}
.search-trigger:hover { border-color: rgba(240,165,0,.45); color: var(--text); }
.search-trigger-kbd {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: inherit;
  color: var(--text-muted);
}

/* ── Search modal ─────────────────────────────────────── */
.search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 800;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.search-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.search-modal {
  width: 100%;
  max-width: 580px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.65);
  transform: translateY(-10px);
  transition: transform .15s;
}
.search-backdrop.open .search-modal { transform: translateY(0); }

.search-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.search-modal-head svg { flex-shrink: 0; color: var(--text-muted); }

.search-modal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.search-modal-input::placeholder { color: var(--text-muted); }

.search-modal-esc {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.search-modal-results { max-height: 400px; overflow-y: auto; }

.sr-item {
  display: block;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background .1s;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover,
.sr-item--focused { background: var(--surface); text-decoration: none; }
.sr-item--focused { border-left: 2px solid var(--accent); padding-left: 16px; }

.sr-cat {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 2px;
}
.sr-title {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 3px;
}
.sr-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sr-empty {
  padding: 20px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 48px;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: block;
  text-decoration: none;
  transition: background .15s;
}
.sidebar-logo:hover { background: rgba(240,165,0,.05); text-decoration: none; }
.sidebar-logo:hover .doc-label { color: var(--text); }

.sidebar-logo .game-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--accent);
  line-height: 1.9;
  letter-spacing: 0;
}

.sidebar-logo .doc-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.nav-group { padding: 4px 0; }

.nav-label {
  padding: 0 20px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.nav-home {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px 15px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color .15s, background .15s;
}

.nav-home:hover { color: var(--accent); background: rgba(240,165,0,.05); text-decoration: none; }

.nav-home svg { flex-shrink: 0; color: var(--accent); opacity: .85; }

.nav-section {
  padding: 18px 20px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  user-select: none;
}
.nav-section::after {
  content: '▾';
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  transition: transform .2s;
  letter-spacing: 0;
}
.nav-section--collapsed::after { transform: rotate(-90deg); }

.nav-sub-section {
  padding: 10px 20px 3px 28px;
  font-size: 9.5px;
  font-weight: 600;
  color: #4b5570;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.nav-link.sub {
  padding-left: 36px;
  font-size: 13px;
}

.nav-divider {
  margin: 8px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-cta {
  padding: 10px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sidebar-cta-btn {
  display: block;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: opacity .15s, border-color .15s, color .15s;
}
.sidebar-cta-btn:hover { opacity: .8; text-decoration: none; }

.sidebar-cta-btn--store {
  background: var(--accent);
  color: #000;
}
.sidebar-cta-btn--store:hover { opacity: .85; }

.sidebar-cta-btn--demo {
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.sidebar-cta-btn--demo:hover { border-color: var(--teal); color: var(--teal); opacity: 1; }

.nav-link {
  display: block;
  padding: 7px 20px;
  font-size: 13.5px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255,255,255,.03);
}

.nav-link.active {
  color: var(--accent);
  background: rgba(240,165,0,.07);
  border-left-color: var(--accent);
}

/* ── Main content ─────────────────────────────────────── */
.main {
  width: 100%;
  max-width: 860px;
  padding: 52px 60px 80px;
}

/* ── Page header ──────────────────────────────────────── */
.page-header {
  margin-bottom: 44px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.page-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  margin-bottom: 10px;
}

h1 {
  font-size: 30px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 14px;
}

.page-desc {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 580px;
  line-height: 1.7;
}

/* ── Headings ─────────────────────────────────────────── */
h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin: 44px 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  scroll-margin-top: 40px;
}

h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

h3 {
  font-size: 15px;
  font-weight: 600;
  color: #dce4f5;
  margin: 30px 0 12px;
}

h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 20px 0 8px;
}

/* ── Tables ───────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 14px 0 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead tr { background: var(--surface2); }

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.55;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }

td code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--teal);
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

/* ── Code blocks ──────────────────────────────────────── */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 24px;
  overflow-x: auto;
  margin: 16px 0 28px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  color: #abb2bf;
}

.kw   { color: #c678dd; }
.type { color: #e5c07b; }
.str  { color: #98c379; }
.cmt  { color: #5c6370; font-style: italic; }
.fn   { color: #61afef; }
.num  { color: #d19a66; }
.attr { color: #e06c75; }

/* Inline code */
p code, li code, td p code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--teal);
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ── Callouts ─────────────────────────────────────────── */
.callout {
  display: flex;
  gap: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 16px 18px;
  margin: 20px 0 28px;
  font-size: 14px;
}

.callout.tip   { border-left-color: var(--teal);    }
.callout.warn  { border-left-color: var(--warning);  }
.callout.info  { border-left-color: var(--link);     }

.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.callout-body strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
  color: var(--accent);
}

.callout.tip  .callout-body strong { color: var(--teal); }
.callout.warn .callout-body strong { color: var(--warning); }
.callout.info .callout-body strong { color: var(--link); }

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}

.badge-abstract { background: #2d1b52; color: var(--purple); }
.badge-virtual  { background: #0e2d4a; color: var(--link);   }
.badge-static   { background: #0e3320; color: var(--success);}
.badge-event    { background: #3a1f00; color: var(--warning); }
.badge-override { background: #1a2a3a; color: #94a3b8;       }

/* ── Steps list ───────────────────────────────────────── */
.steps { list-style: none; counter-reset: step; margin: 18px 0 28px; }

.steps > li {
  counter-increment: step;
  position: relative;
  padding: 14px 18px 14px 56px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Hierarchy tree ───────────────────────────────────── */
.tree {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 24px;
  line-height: 2.1;
  margin: 14px 0 28px;
  white-space: pre;
  overflow-x: auto;
}

.tree .cls   { color: #e5c07b; }
.tree .iface { color: var(--teal); }
.tree .dim   { color: var(--text-muted); }
.tree .arrow { color: #4b5563; }

/* ── Card grid ────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 18px 0 36px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .2s, transform .15s;
  display: block;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.card-icon  { font-size: 24px; margin-bottom: 12px; }
.card-title { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 6px; }
.card-desc  { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

/* ── Dividers & misc ──────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

p { margin-bottom: 14px; }
p:last-child { margin-bottom: 0; }

ul, ol { padding-left: 22px; margin-bottom: 16px; }
li { margin-bottom: 6px; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

strong { color: #e2e8f0; font-weight: 600; }

/* ── Welcome page ─────────────────────────────────────── */
.welcome-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px 24px 40px;
  position: relative;
  background-image:
    linear-gradient(rgba(240,165,0,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240,165,0,.035) 1px, transparent 1px);
  background-size: 40px 40px;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 65% 55% at 50% 35%, rgba(240,165,0,.07) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner { max-width: 660px; text-align: center; position: relative; z-index: 1; }

.hero-categories { width: 100%; max-width: 880px; position: relative; z-index: 1; }

.hero-badge {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 40px;
}

.hero-logo {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(20px, 3.8vw, 38px);
  color: var(--accent);
  line-height: 1.7;
  text-shadow: 0 0 48px rgba(240,165,0,.28), 0 0 80px rgba(240,165,0,.12);
  margin-bottom: 24px;
}

.hero-rule {
  width: 44px;
  height: 2px;
  background: var(--accent);
  margin: 0 auto 18px;
  opacity: .35;
}

.hero-subtitle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.hero-tagline {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-muted);
  margin: 0.25rem 0 1rem;
  text-align: center;
}

.hero-flow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 1.5rem;
}
.hero-flow .hf-arrow {
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Quick Start section ──────────────────────────── */
.welcome-sections--qs {
  background: var(--surface);
}

.qs-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  background: var(--teal-dim);
  color: var(--teal);
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

.qs-steps {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  max-width: 880px;
  width: 100%;
}

.qs-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 20px;
  gap: 10px;
}

.qs-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teal-dim);
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qs-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.qs-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  font-family: 'JetBrains Mono', monospace;
}

.qs-arrow {
  font-size: 0;
  flex-shrink: 0;
  align-self: center;
  padding: 0 8px;
}

.qs-arrow::after {
  content: '→';
  color: var(--teal);
  font-size: 20px;
  opacity: .65;
}

@media (max-width: 640px) {
  .qs-steps { flex-direction: column; align-items: stretch; }
  .qs-step { align-items: center; text-align: center; padding: 16px 0; }
  .qs-arrow { padding: 6px 0; }

  .overview-flow { flex-direction: column; }
  .ovf-divider { width: 100%; height: 36px; }
  .ovf-divider::after { content: '↓'; font-size: 18px; }
  .overview-traits { grid-template-columns: 1fr; }

  .hero { padding: 20px 16px 32px; gap: 16px; }
  .hero-badge { margin-bottom: 20px; }
  .hero-flow { flex-wrap: wrap; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn-primary, .btn-outline { justify-content: center; }
  .welcome-sections { padding: 32px 16px 40px; }
  .feature-grid { grid-template-columns: 1fr; }
  .features-intro { font-size: 13px; }
  .welcome-section-label { color: var(--text); }
}

.hero-desc {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 40px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 30px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 14px;
  border-radius: 6px;
  text-decoration: none;
  transition: opacity .15s, transform .15s;
}

.btn-primary:hover { opacity: .85; transform: translateY(-2px); text-decoration: none; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 30px;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  border-radius: 6px;
  text-decoration: none;
  transition: border-color .15s, color .15s, transform .15s;
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); text-decoration: none; }

.welcome-sections {
  border-top: 1px solid var(--border);
  padding: 48px 24px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.welcome-section-label {
  padding: 28px 0 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  width: 100%;
  max-width: 880px;
}

.welcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  max-width: 880px;
  width: 100%;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.welcome-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px 22px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
}

.welcome-card:hover { background: var(--surface2); text-decoration: none; }
.welcome-card:hover .wc-title { color: var(--accent); }

.wc-icon  { font-size: 22px; margin-bottom: 2px; }
.wc-title { font-size: 13.5px; font-weight: 600; color: #fff; transition: color .15s; }
.wc-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.55; }

.welcome-footer {
  padding: 22px 24px;
  text-align: center;
  font-size: 11.5px;
  color: #2e3050;
  border-top: 1px solid var(--border);
  letter-spacing: .5px;
}

/* ── Back to top ─────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .2s, transform .2s, background .15s, color .15s, border-color .15s;
  pointer-events: none;
  z-index: 200;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--surface2);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Copy button ──────────────────────────────────────── */
.code-wrapper {
  position: relative;
  margin: 16px 0 28px;
}

.code-wrapper pre {
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  padding: 0;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

/* ── Scrollbars ───────────────────────────────────────── */
::-webkit-scrollbar              { width: 6px; height: 6px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: #2d2f4a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: #3d3f62; }
::-webkit-scrollbar-corner       { background: transparent; }

* { scrollbar-width: thin; scrollbar-color: #2d2f4a transparent; }

/* ── Welcome category blocks ──────────────────────────── */
.welcome-categories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  max-width: 880px;
  width: 100%;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.cat-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 32px 28px 28px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
}

.cat-block:hover { background: var(--surface2); text-decoration: none; }

.cb-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2.5px;
}

.cat-block--manual   .cb-eyebrow { color: var(--accent); }
.cat-block--scripting .cb-eyebrow { color: var(--teal); }

.cb-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.cb-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
  margin: 0;
}

.cb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cb-chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg);
}

.cb-cta {
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}

.cat-block--manual   .cb-cta { color: var(--accent); }
.cat-block--scripting .cb-cta { color: var(--teal); }

/* ── Index landing page cards ─────────────────────────── */
.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 18px 0 36px;
}

.index-card {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .2s, background .15s;
}

.index-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
  text-decoration: none;
}

.index-card--teal:hover { border-color: var(--teal); }

.ic-icon {
  font-size: 26px;
  flex-shrink: 0;
  margin-top: 2px;
}

.ic-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ic-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.ic-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.ic-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.ic-topics span {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Overview section ────────────────────────────────── */
.overview-intro {
  max-width: 880px;
  width: 100%;
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 32px;
}

.overview-intro strong { color: var(--text); font-weight: 600; }

.overview-flow {
  display: flex;
  align-items: stretch;
  max-width: 880px;
  width: 100%;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.ovf-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 28px 24px;
  background: var(--surface);
}

.ovf-divider {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  background: var(--surface);
}

.ovf-divider::after {
  content: '→';
  color: var(--accent);
  font-size: 20px;
  opacity: .65;
}

.ovf-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(240,165,0,.08);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ovf-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.ovf-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
}

.overview-traits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  max-width: 880px;
  width: 100%;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.ovt-item {
  display: flex;
  gap: 14px;
  padding: 22px 20px;
  background: var(--surface);
}

.ovt-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }

.ovt-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.ovt-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.ovt-desc code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--teal);
  background: rgba(0,212,170,.06);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ── Welcome feature cards ────────────────────────────── */
.welcome-sections--features {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.features-intro {
  max-width: 880px;
  width: 100%;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 4px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
  max-width: 880px;
  width: 100%;
}

.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fc-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fc-icon { font-size: 22px; flex-shrink: 0; }

.fc-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
}

.fc-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.fc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fc-list li {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 14px;
  position: relative;
  line-height: 1.5;
  margin: 0;
}

.fc-list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ── Package contents grid ────────────────────────────── */
.contents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  max-width: 880px;
  width: 100%;
}

.contents-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}

.ci-folder {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--teal);
  margin-bottom: 7px;
}

.ci-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* ── Support box ──────────────────────────────────────── */
.welcome-support-box {
  max-width: 880px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.wsb-text h3 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 5px;
}

.wsb-text p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.wsb-email {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  padding: 10px 20px;
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  background: rgba(240, 165, 0, 0.06);
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}

.wsb-email:hover {
  background: rgba(240, 165, 0, 0.12);
  border-color: var(--accent);
  text-decoration: none;
}

/* ── TOC (On this page) ───────────────────────────────── */
.toc-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--toc-w);
  padding: 48px 16px 40px 16px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  flex-direction: column;
  z-index: 50;
}

.toc-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.toc-link {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 8px;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  line-height: 1.45;
  transition: color .15s, border-color .15s, background .15s;
}

.toc-link:hover {
  color: var(--text);
  background: rgba(255,255,255,.03);
  text-decoration: none;
}

.toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(240,165,0,.06);
}

@media (min-width: 1180px) {
  body.has-toc { padding-right: var(--toc-w); }
  body.has-toc .toc-panel { display: flex; }
}

/* ── Mobile nav toggle ────────────────────────────────── */
.nav-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 350;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.nav-toggle:hover { background: var(--surface2); border-color: var(--accent); color: var(--accent); }

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 860px) {
  body:not(.welcome-body) { padding-left: 0; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 300;
  }
  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,.55);
  }
  body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }
  .nav-toggle { display: flex; }
  .main { padding: 64px 22px 60px; }
}

@media (max-width: 600px) {
  .welcome-categories { grid-template-columns: 1fr; }
}

/* ── Welcome-page mobile overrides ───────────────────────
   Must come AFTER the base declarations they override.
   The @media block near line 820 precedes those bases
   in source order and loses the cascade; this block wins. */
@media (max-width: 640px) {
  .overview-flow { flex-direction: column; }
  .ovf-divider { width: 100%; height: 40px; }
  .qs-arrow::after { content: '↓'; color: var(--teal); font-size: 20px; opacity: .75; }
  .ovf-divider::after { content: '↓'; color: var(--accent); font-size: 20px; opacity: .75; }
  .overview-traits { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .welcome-sections { padding: 32px 16px 40px; }
  .welcome-section-label { color: var(--text); }
  .features-intro { font-size: 13px; }
}
