:root {
  --bg: #0f1117;
  --bg-sidebar: #13161b;
  --bg-card: #1a1d24;
  --bg-code: #161920;
  --text: #e1e7ef;
  --text-muted: #8b929e;
  --text-heading: #f1f5f9;
  --accent: #818cf8;
  --accent-dim: #6366f1;
  --border: #21252e;
  --hover: #1e2229;
  --green: #6ee7b7;
  --orange: #fbbf24;
  --pink: #f0abfc;
  --ring: rgba(129, 140, 248, 0.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: grid;
  grid-template-columns: 260px 1fr;
  width: 100%;
  height: 100vh;
}

/* Sidebar */
#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.01em;
}

.sidebar-logo {
  display: block;
  height: 38px;
  width: auto;
  filter: invert(1);
  opacity: 0.9;
  margin-bottom: 10px;
}

.version {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

.search-box {
  padding: 12px 20px;
  position: relative;
}

#search-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

#search-results {
  position: absolute;
  top: 100%;
  left: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

#search-results.active { display: block; }

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.1s;
}

.search-result-item:hover { background: var(--hover); }
.search-result-item:last-child { border-bottom: none; }

.search-result-item .sr-class {
  color: var(--accent);
  font-weight: 600;
}

.search-result-item .sr-method {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.search-result-item .sr-desc {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

/* Nav */
#nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-group-label {
  padding: 16px 20px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 600;
}

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

.nav-item:hover {
  background: var(--hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--hover);
  color: var(--accent);
  border-left-color: var(--accent);
}

/* Main content */
#content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 40px 56px;
}

#section-content {
  max-width: 860px;
}

/* Section styles */
.section-header {
  margin-bottom: 32px;
}

.section-header h2 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}

.section-header .subtitle {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

/* Constructor / signature block */
.signature {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  margin: 20px 0;
  overflow-x: auto;
  line-height: 1.8;
  box-shadow: var(--shadow-sm);
}

.sig-keyword { color: var(--pink); }
.sig-class { color: var(--green); }
.sig-method { color: var(--accent); }
.sig-param { color: var(--orange); }
.sig-type { color: var(--text-muted); }
.sig-punct { color: var(--text-muted); }

/* Tables */
.api-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0 28px;
  font-size: 13px;
}

.api-table th {
  text-align: left;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.api-table td {
  padding: 10px 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.6;
}

.api-table tr:last-child td {
  border-bottom: none;
}

.api-table td:first-child {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-heading);
  white-space: nowrap;
  font-weight: 500;
}

.api-table td:nth-child(2) {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* Method cards */
.method-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 16px 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.method-card:hover {
  border-color: rgba(129, 140, 248, 0.3);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.1), var(--shadow-sm);
}

.method-card h4 {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-heading);
  margin-bottom: 8px;
  font-weight: 500;
}

.method-card .method-sig {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-code);
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
}

.method-card p {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.6;
}

.method-card .returns {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.method-card .returns span {
  color: var(--green);
  font-family: var(--font-mono);
}

/* Method mini demos */
.method-demo {
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: #0f1117;
}

.method-demo canvas {
  display: block;
  width: 100%;
  height: 200px;
}

/* Section dividers */
.section-divider {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 40px 0 16px;
  padding-bottom: 0;
  border-bottom: none;
}

/* Demo canvas */
.demo-container {
  margin: 28px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0f1117;
  box-shadow: var(--shadow-md);
}

.demo-container canvas {
  display: block;
  width: 100%;
  height: 350px;
}

.demo-label {
  padding: 10px 20px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-code);
  border-top: 1px solid var(--border);
}

/* Code examples */
.code-example {
  background: var(--bg-code);
  border: none;
  border-radius: 8px;
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  margin: 16px 0;
  overflow-x: auto;
  white-space: pre;
  box-shadow: var(--shadow-sm);
}

.code-example .kw { color: var(--pink); }
.code-example .fn { color: var(--accent); }
.code-example .str { color: var(--green); }
.code-example .num { color: var(--orange); }
.code-example .cm { color: #4b5563; }

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
  vertical-align: middle;
}

.badge-static { background: rgba(110, 231, 183, 0.1); color: #6ee7b7; border: 1px solid rgba(110, 231, 183, 0.2); }
.badge-getter { background: rgba(196, 181, 253, 0.1); color: #c4b5fd; border: 1px solid rgba(196, 181, 253, 0.2); }
.badge-readonly { background: rgba(129, 140, 248, 0.1); color: #818cf8; border: 1px solid rgba(129, 140, 248, 0.2); }

/* Architecture diagram */
.arch-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 24px 0;
}

.arch-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.arch-card:hover {
  border-color: rgba(129, 140, 248, 0.3);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.1), var(--shadow-sm);
}

.arch-card-core {
  border-color: rgba(110, 231, 183, 0.25);
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(110, 231, 183, 0.04) 100%);
}

.arch-card-core:hover {
  border-color: rgba(110, 231, 183, 0.4);
  box-shadow: 0 0 0 1px rgba(110, 231, 183, 0.1), var(--shadow-sm);
}

.arch-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
}

.arch-card-lang {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 6px;
}

.arch-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

.arch-card-tags {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.arch-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

.arch-tag-green {
  background: rgba(110, 231, 183, 0.1);
  color: #6ee7b7;
  border: 1px solid rgba(110, 231, 183, 0.2);
}

.arch-tag-blue {
  background: rgba(129, 140, 248, 0.1);
  color: #818cf8;
  border: 1px solid rgba(129, 140, 248, 0.2);
}

.arch-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
}

.arch-arrow-line {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.arch-arrow-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 0;
}

.arch-arrow-head {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #sidebar { width: 100%; min-width: 100%; height: auto; max-height: 50vh; }
  #content { padding: 20px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2e37; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }
