:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #5f6368;
  --line: #e4e4e0;
  --brand: #1f3fae;
  --brand-ink: #ffffff;
  --accent-bg: #eef2ff;
  --warn-bg: #fff6e5;
  --warn-line: #f2c46d;
  --ok: #1e7a3c;
  --code-bg: #f1f1ee;
  --nav-bg: #1d1d1f;
  --nav-ink: #f2f2f2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141415;
    --surface: #1d1d1f;
    --ink: #ececec;
    --muted: #a1a1a6;
    --line: #333336;
    --brand: #8aa4ff;
    --brand-ink: #10183a;
    --accent-bg: #1f2540;
    --warn-bg: #3a2e14;
    --warn-line: #8a6a1f;
    --ok: #6fd08f;
    --code-bg: #26262a;
    --nav-bg: #0d0d0e;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.75 "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}
a { color: var(--brand); }
img { max-width: 100%; height: auto; }

/* 頂端選單 */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--nav-bg); color: var(--nav-ink);
}
.top .in {
  max-width: 1120px; margin: auto; padding: 0 16px;
  display: flex; align-items: center; gap: 4px; min-height: 56px; flex-wrap: wrap;
}
.top .brand { font-weight: 700; color: var(--nav-ink); text-decoration: none; margin-right: 16px; white-space: nowrap; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.top nav a {
  color: #c9c9cc; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 15px; white-space: nowrap;
}
.top nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.top nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .14); }

/* 版面 */
.wrap { max-width: 1120px; margin: auto; padding: 32px 16px 64px; }
.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; }
.toc { position: sticky; top: 80px; align-self: start; font-size: 14px; }
.toc strong { display: block; margin-bottom: 6px; color: var(--muted); font-weight: 500; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 4px 12px; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
@media (max-width: 860px) {
  .doc { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .top { position: static; }
  .top .in { flex-wrap: nowrap; overflow-x: auto; }
  .top nav { flex-wrap: nowrap; }
  h1 { font-size: 26px; }
  h2 { font-size: 21px; }
}

h1 { font-size: 32px; line-height: 1.3; margin: 0 0 8px; }
h2 { font-size: 24px; line-height: 1.4; margin: 48px 0 12px; padding-top: 8px; border-top: 1px solid var(--line); }
h2:first-of-type { border-top: 0; }
h3 { font-size: 18px; margin: 28px 0 8px; }
.lead { color: var(--muted); font-size: 17px; margin: 0 0 24px; }
p, ul, ol { margin: 0 0 14px; }
li { margin: 4px 0; }
code, kbd {
  font-family: "JetBrains Mono", Consolas, monospace; font-size: .88em;
  background: var(--code-bg); border-radius: 4px; padding: 1px 6px;
}
kbd { border: 1px solid var(--line); border-bottom-width: 2px; }
.ui { font-weight: 700; }
.ui::before { content: "「"; font-weight: 400; }
.ui::after { content: "」"; font-weight: 400; }

table { width: 100%; border-collapse: collapse; margin: 8px 0 18px; font-size: 15px; background: var(--surface); }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--code-bg); font-weight: 600; }
.table-scroll { overflow-x: auto; }

figure { margin: 16px 0 24px; }
figure img { border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: block; }
figcaption { color: var(--muted); font-size: 14px; margin-top: 6px; }

.note, .warn, .tip {
  border-radius: 10px; padding: 12px 16px; margin: 16px 0; border: 1px solid var(--line); background: var(--surface);
}
.note { background: var(--accent-bg); border-color: transparent; }
.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.note > :last-child, .warn > :last-child, .tip > :last-child { margin-bottom: 0; }

.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding-left: 44px; margin: 14px 0; }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}

.say {
  border-left: 3px solid var(--brand); background: var(--surface); padding: 8px 14px; margin: 8px 0; border-radius: 0 8px 8px 0;
}
.say b { color: var(--muted); font-weight: 500; font-size: 14px; display: block; }

/* 首頁 */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 24px 0 8px; }
.hero h1 { font-size: 40px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero h1 { font-size: 30px; } }
.download {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); margin-top: 20px;
}
.btn {
  display: inline-block; background: var(--brand); color: var(--brand-ink); text-decoration: none; font-weight: 700;
  padding: 12px 22px; border-radius: 10px; font-size: 17px;
}
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.meta { color: var(--muted); font-size: 14px; margin-top: 10px; }
.sha { word-break: break-all; font-size: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 16px 0 32px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow);
}
.card:hover { border-color: var(--brand); }
.card h3 { margin: 0 0 6px; font-size: 18px; color: var(--brand); }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
div.card h3 { color: var(--ink); }
div.card:hover { border-color: var(--line); }
.foot { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); margin-top: 48px; padding-top: 16px; }
