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

:root {
  --sidebar-width: 260px;
  --header-height: 54px;
  --color-bg: #fff;
  --color-sidebar-bg: #f7f7f7;
  --color-sidebar-border: #e0e0e0;
  --color-text: #2d2d2d;
  --color-muted: #666;
  --color-accent: #c0392b;
  --color-link: #2980b9;
  --color-active: #c0392b;
  --color-active-bg: #fdf0f0;
  --color-code-bg: #f5f5f5;
  --color-disclaimer-bg: #fff5f5;
  --color-disclaimer-border: #c0392b;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

html, body {
  height: 100%;
  font-family: var(--font-main);
  color: var(--color-text);
  background: var(--color-bg);
  font-size: 15px;
  line-height: 1.7;
}

/* ── Header ── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: #1a1a2e;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  gap: 14px;
}

.site-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 4px 0;
  border-radius: 2px;
  transition: .25s;
}

/* ── Layout ── */
.layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-sidebar-border);
  overflow-y: auto;
  z-index: 50;
  transition: transform .25s ease;
}

.sidebar-nav {
  padding: 20px 0 40px;
}

.sidebar-nav a {
  display: block;
  padding: 10px 24px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav a:hover {
  background: #ececec;
  color: var(--color-accent);
}

.sidebar-nav a.active {
  color: var(--color-active);
  background: var(--color-active-bg);
  border-left-color: var(--color-active);
  font-weight: 600;
}

/* ── Content ── */
.content-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

.disclaimer {
  background: var(--color-disclaimer-bg);
  border-left: 4px solid var(--color-disclaimer-border);
  padding: 10px 20px;
  font-size: 13px;
  color: var(--color-accent);
  font-weight: 600;
}

.content-body {
  max-width: 820px;
  padding: 40px 48px 80px;
}

/* ── Loading / Error ── */
.status-msg {
  color: var(--color-muted);
  font-style: italic;
  padding: 40px 0;
}

/* ── Markdown rendered styles ── */
.content-body h1 { font-size: 1.85em; margin: 0 0 .6em; border-bottom: 2px solid #eee; padding-bottom: .3em; }
.content-body h2 { font-size: 1.4em; margin: 2em 0 .5em; }
.content-body h3 { font-size: 1.15em; margin: 1.6em 0 .4em; }
.content-body h4 { font-size: 1em; margin: 1.4em 0 .3em; color: var(--color-muted); }
.content-body p { margin: .7em 0; }
.content-body ul, .content-body ol { margin: .6em 0 .6em 1.5em; }
.content-body li { margin: .3em 0; }
.content-body a { color: var(--color-link); text-decoration: none; }
.content-body a:hover { text-decoration: underline; }
.content-body code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--color-code-bg);
  padding: .15em .4em;
  border-radius: 3px;
}
.content-body pre {
  background: var(--color-code-bg);
  border-radius: 5px;
  padding: 1em 1.2em;
  overflow-x: auto;
  margin: 1em 0;
}
.content-body pre code { background: none; padding: 0; }
.content-body blockquote {
  border-left: 4px solid #ddd;
  padding: .4em 1em;
  color: var(--color-muted);
  margin: 1em 0;
}
.content-body hr { border: none; border-top: 1px solid #eee; margin: 1.5em 0; }
.content-body strong { font-weight: 700; }

/* ── Overlay (mobile) ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 40;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .hamburger { display: block; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .overlay.open {
    display: block;
  }

  .content-area {
    margin-left: 0;
  }

  .content-body {
    padding: 24px 20px 60px;
  }
}

@media (max-width: 480px) {
  .site-title { font-size: 14px; }
  .content-body h1 { font-size: 1.5em; }
}
