:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --bg-sidebar: #0d1117;
  --bg-header: rgba(13, 17, 23, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --link: #58a6ff;
  --hint-info-bg: rgba(56, 139, 253, 0.1);
  --hint-info-border: rgba(56, 139, 253, 0.4);
  --hint-warning-bg: rgba(210, 153, 34, 0.1);
  --hint-warning-border: rgba(210, 153, 34, 0.4);
  --hint-danger-bg: rgba(248, 81, 73, 0.1);
  --hint-danger-border: rgba(248, 81, 73, 0.4);
  --hint-success-bg: rgba(63, 185, 80, 0.1);
  --hint-success-border: rgba(63, 185, 80, 0.4);
  --sidebar-width: 280px;
  --header-height: 64px;
  --content-max: 768px;
  --radius: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header-height);
  padding: 0 1.5rem;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}

.site-logo:hover { text-decoration: none; color: var(--text); }

.site-logo img { border-radius: 4px; }

.header-links {
  margin-left: auto;
  display: flex;
  gap: 1.25rem;
}

.header-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
}

.header-links a:hover { color: var(--text); text-decoration: none; }

.layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.sidebar-nav ul { list-style: none; }
.sidebar-nav > ul > li { margin-bottom: 0.25rem; }

.nav-group-title {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.nav-group ul { padding-left: 0; }

.nav-link {
  display: block;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

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

.nav-link.active {
  background: rgba(88, 166, 255, 0.12);
  color: var(--accent);
  font-weight: 500;
}

.sidebar-footer {
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

.content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.markdown-body {
  width: 100%;
  max-width: var(--content-max);
}

.markdown-body h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.markdown-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.markdown-body h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.markdown-body h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.markdown-body p { margin-bottom: 1rem; color: var(--text); }

.markdown-body ul, .markdown-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.markdown-body li { margin-bottom: 0.375rem; }
.markdown-body li > ul, .markdown-body li > ol { margin-top: 0.375rem; margin-bottom: 0; }

.markdown-body code {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.875em;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.markdown-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.markdown-body pre code { background: none; padding: 0; font-size: 0.875rem; }

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.markdown-body th, .markdown-body td {
  border: 1px solid var(--border);
  padding: 0.625rem 0.875rem;
  text-align: left;
}

.markdown-body th { background: var(--bg-secondary); font-weight: 600; }

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.markdown-body figure { margin: 1.5rem 0; }

.markdown-body figure img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.markdown-body figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.markdown-body strong { font-weight: 600; }

.hint {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border-left: 3px solid;
  font-size: 0.9375rem;
}

.hint-info { background: var(--hint-info-bg); border-color: var(--hint-info-border); }
.hint-warning { background: var(--hint-warning-bg); border-color: var(--hint-warning-border); }
.hint-danger { background: var(--hint-danger-bg); border-color: var(--hint-danger-border); }
.hint-success { background: var(--hint-success-bg); border-color: var(--hint-success-border); }

.content-ref {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.25rem;
  margin-bottom: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.content-ref:hover {
  border-color: rgba(88, 166, 255, 0.4);
  background: rgba(88, 166, 255, 0.06);
  text-decoration: none;
  color: var(--text);
}

.content-ref::after {
  content: '→';
  margin-left: auto;
  color: var(--text-muted);
}

.page-footer {
  width: 100%;
  max-width: var(--content-max);
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.nav-prev { color: var(--text-muted); font-size: 0.875rem; }

@media (max-width: 768px) {
  .sidebar-toggle { display: block; }

  .sidebar {
    position: fixed;
    left: -100%;
    top: var(--header-height);
    z-index: 90;
    transition: left 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .sidebar.open { left: 0; }
  .content { padding: 1.5rem 1.25rem; }
  .header-links { display: none; }
  .markdown-body h1 { font-size: 1.75rem; }
}

@media (min-width: 769px) {
  .sidebar-toggle { display: none !important; }
}
