:root {
  --bg: #1e1e1e;
  --sidebar: #262626;
  --panel: #2a2a2a;
  --text: #d7d7d7;
  --strong: #ececec;
  --muted: #9a9a9a;
  --border: #343434;
  --accent: #a88bfa;
  --accent-soft: rgba(168, 139, 250, .14);
  --code-bg: #161616;
  --radius: 8px;
}
[data-theme="light"] {
  --bg: #ffffff;
  --sidebar: #f7f7f6;
  --panel: #f1f1f0;
  --text: #2c2c2c;
  --strong: #111111;
  --muted: #6d6d6d;
  --border: #e5e5e3;
  --accent: #6b52d6;
  --accent-soft: rgba(107, 82, 214, .10);
  --code-bg: #f6f6f5;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}
::selection { background: var(--accent-soft); }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 264px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 22px 16px 18px;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 18px; }
.brand-mark {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}
.brand a { color: var(--strong); text-decoration: none; font-weight: 600; font-size: 15px; letter-spacing: .01em; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  color: var(--text); text-decoration: none; font-size: 14px;
  padding: 6px 10px; border-radius: 6px; transition: background .12s;
}
.nav a:hover { background: var(--panel); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }

.nav-label {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 22px 10px 8px;
}
.recent { list-style: none; margin: 0; padding: 0; }
.recent li a {
  display: block; color: var(--muted); text-decoration: none; font-size: 13px;
  padding: 5px 10px 5px 18px; border-radius: 6px; position: relative;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent li a::before {
  content: ""; position: absolute; left: 8px; top: 50%;
  width: 4px; height: 4px; border-radius: 50%; background: var(--border);
  transform: translateY(-50%);
}
.recent li a:hover { background: var(--panel); color: var(--text); }

.sidebar-foot { margin-top: auto; padding: 20px 6px 2px; display: flex; gap: 8px; }
.icon-btn {
  font: inherit; font-size: 12px; color: var(--muted);
  background: transparent; border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }

/* ---------- content ---------- */
.content {
  margin-left: 264px; padding: 64px 48px 120px;
  max-width: 780px;
}
.content > * { max-width: 680px; }

h1, h2, h3, h4 { color: var(--strong); font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
h1 { font-size: 30px; margin: 0 0 12px; }
h2 { font-size: 21px; margin: 40px 0 12px; }
h3 { font-size: 17px; margin: 28px 0 8px; }
p { margin: 0 0 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong { color: var(--strong); }
ul, ol { padding-left: 22px; margin: 0 0 16px; }
li { margin: 4px 0; }
li::marker { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
img { max-width: 100%; border-radius: var(--radius); }

blockquote {
  margin: 0 0 16px; padding: 2px 0 2px 16px;
  border-left: 2px solid var(--accent); color: var(--muted);
}
blockquote p:last-child { margin-bottom: 0; }

code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: .88em; background: var(--panel); padding: 2px 5px;
  border-radius: 4px; color: var(--strong);
}
pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; overflow-x: auto;
  margin: 0 0 18px; line-height: 1.6;
}
pre code { background: none; padding: 0; font-size: 13px; color: var(--text); }

table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; }

/* ---------- page bits ---------- */
.meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border); }

.tag {
  display: inline-block; font-size: 12px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 9px; margin-right: 6px; text-decoration: none;
}
.tag:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.hero { margin-bottom: 44px; }
.hero p { color: var(--muted); font-size: 15px; margin: 0; }

.notes { list-style: none; padding: 0; margin: 0; }
.notes li { padding: 16px 0; border-bottom: 1px solid var(--border); }
.notes li:first-child { border-top: 1px solid var(--border); }
.notes a.title { color: var(--strong); font-size: 16px; font-weight: 500; }
.notes a.title:hover { color: var(--accent); text-decoration: none; }
.notes p { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }

.page-foot { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 16px; font-size: 13px; }

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--border);
    padding: 16px 18px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
  .brand { padding: 0 12px 0 0; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-label, .recent { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; }
  .content { margin-left: 0; padding: 36px 20px 80px; }
  h1 { font-size: 25px; }
}
