/* ========== 主题变量与基础样式 ========== */
:root {
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --bg-soft: #eef0f4;
  --ink: #1c2333;
  --ink-2: #4a5468;
  --ink-3: #8a93a6;
  --line: #dfe3ea;
  --accent: #0e7c66;
  --accent-soft: rgba(14, 124, 102, 0.12);
  --accent-2: #b3541e;
  --accent-2-soft: rgba(179, 84, 30, 0.12);
  --gold: #a4761b;
  --gold-soft: rgba(164, 118, 27, 0.14);
  --ok: #1a7f4b;
  --ok-soft: rgba(26, 127, 75, 0.12);
  --bad: #b3372f;
  --bad-soft: rgba(179, 55, 47, 0.12);
  --code-bg: #23272f;
  --code-ink: #e8ebf1;
  --shadow: 0 1px 2px rgba(20, 26, 38, 0.06), 0 4px 16px rgba(20, 26, 38, 0.06);
  --radius: 8px;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #14161c;
  --bg-elev: #1b1e26;
  --bg-soft: #22262f;
  --ink: #e6eaf2;
  --ink-2: #aab2c2;
  --ink-3: #6d7686;
  --line: #2c313c;
  --accent: #3fbf9f;
  --accent-soft: rgba(63, 191, 159, 0.14);
  --accent-2: #e0885a;
  --accent-2-soft: rgba(224, 136, 90, 0.14);
  --gold: #d9a94a;
  --gold-soft: rgba(217, 169, 74, 0.16);
  --ok: #4cc083;
  --ok-soft: rgba(76, 192, 131, 0.14);
  --bad: #e0695f;
  --bad-soft: rgba(224, 105, 95, 0.14);
  --code-bg: #10131a;
  --code-ink: #e8ebf1;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); }

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

h1, h2, h3, h4 {
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink);
}
h1 { font-size: 1.9rem; margin: 0 0 0.6rem; }
h2 { font-size: 1.4rem; margin: 2.2rem 0 0.8rem; }
h3 { font-size: 1.12rem; margin: 1.6rem 0 0.6rem; }
h4 { font-size: 1rem; margin: 1.2rem 0 0.4rem; }

p { margin: 0.7rem 0; }

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.38em;
  white-space: nowrap;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
  font-size: inherit;
}

kbd {
  font-family: var(--mono);
  font-size: 0.8em;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.05em 0.4em;
}

ul, ol { padding-left: 1.4rem; }
li { margin: 0.3rem 0; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.92rem;
}
th, td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
th { background: var(--bg-soft); font-weight: 600; }

blockquote {
  margin: 1rem 0;
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-2);
}

button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  th, td { padding: 0.4rem 0.5rem; font-size: 0.86rem; }
}
