:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --accent: #3b6ef5;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --muted: #98989d;
    --line: #38383a;
    --accent: #6c95ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
        "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
}
main { max-width: 720px; margin: 0 auto; padding: 32px 20px 64px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 40px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--accent);
  display: grid; place-items: center; color: #fff; font-size: 16px;
}
.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-switch button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px;
  padding: 4px 12px; cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Content */
h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 22px; margin: 40px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 17px; margin: 24px 0 6px; }
p, ul, ol { margin: 0 0 14px; }
ul, ol { padding-left: 22px; }
li { margin-bottom: 6px; }
.lede { color: var(--muted); font-size: 19px; margin-bottom: 28px; }
.meta { color: var(--muted); font-size: 14px; }
code { font: 15px ui-monospace, "SF Mono", Menlo, monospace; background: var(--surface);
       border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 20px 22px; margin: 16px 0; }
.card h3:first-child { margin-top: 0; }
.links { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 24px 0; }
.links a { display: block; background: var(--surface); border: 1px solid var(--line);
           border-radius: var(--radius); padding: 14px 16px; color: var(--text); font-weight: 600; }
.links a span { display: block; color: var(--muted); font-weight: 400; font-size: 14px; }
.links a:hover { text-decoration: none; border-color: var(--accent); }

details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
          padding: 14px 18px; margin: 10px 0; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 8px; }

pre.license { white-space: pre-wrap; font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
              background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
              padding: 16px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

footer { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line);
         color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* Bilingual: both languages ship in the page; only the active one shows.
   Without JS the English copy stays visible. */
[data-lang="zh"] [lang="en"]:not(html) { display: none; }
html:not([data-lang="zh"]) [lang="zh-Hans"] { display: none; }
