:root {
  --bg: #ffffff;
  --card: #ffffff;
  --code-bg: #f4f4f5;
  --text: #141414;
  --text-muted: #6b6b6b;
  --text-dim: #9a9a9a;
  --border: #d4d4d4;
  --border-soft: #eeeeee;
  --link: #165dff;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --nav-h: 58px;
  --toc-w: 210px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 1024px; margin: 0 auto; padding: 0 1.5rem; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 1rem;
  height: var(--nav-h);
}
.brand {
  display: flex; align-items: center; gap: 0.55rem;
  font-weight: 700; font-size: 1.08rem; color: var(--text); letter-spacing: -0.01em;
  justify-self: start;
}
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; border-radius: 6px; display: block; }
.nav-links { display: flex; gap: 1.6rem; font-size: 0.92rem; }
.nav-links a { color: var(--text-muted); }
.nav-links a:hover,
.nav-links a.active { color: var(--text); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 0.7rem; justify-self: end; }
.nav-account { color: var(--text-muted); font-size: 0.92rem; }
.nav-account:hover, .nav-account.active { color: var(--text); text-decoration: none; }
.nav-install {
  display: inline-flex; align-items: center; gap: 0.4rem;
  height: 36px; padding: 0 1rem; border-radius: 999px;
  background: var(--text); color: #fff; border: none;
  font-size: 0.88rem; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: opacity .2s;
}
.nav-install:hover { opacity: .86; }
.nav-install svg { width: 14px; height: 14px; }
.install-wrap { position: relative; }
.install-pop {
  position: absolute; top: calc(100% + 10px); right: 0; width: 420px;
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: 12px; padding: 0.4rem;
  box-shadow: 0 14px 36px rgba(0,0,0,.12);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 60;
}
.install-wrap:hover .install-pop,
.install-wrap:focus-within .install-pop,
.install-wrap.open .install-pop { opacity: 1; visibility: visible; transform: translateY(0); transition-delay: .12s; }
.install-row { display: flex; align-items: center; gap: 0.55rem; padding: 0.5rem 0.55rem; border-radius: 8px; }
.install-row:hover { background: #f5f5f5; }
.install-row .os { flex: none; font-size: 0.8rem; font-weight: 600; }
.install-row code {
  flex: 1; background: none; border: none; padding: 0;
  font-size: 0.68rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.install-copy {
  flex: none; width: 28px; height: 28px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 7px; background: none;
  color: var(--text-muted); cursor: pointer;
}
.install-copy:hover { background: #eeeeee; color: var(--text); }
.install-copy.copied { color: #16a34a; }
.install-copy svg { width: 14px; height: 14px; }
.install-row-qr { justify-content: flex-start; gap: 0.5rem; }
.install-hint { font-size: 0.72rem; color: var(--text-dim); }
.install-qr {
  flex: none; margin-left: auto; width: 26px; height: 26px; display: block; background: #fff;
  border: 1px solid var(--border-soft); border-radius: 6px;
  cursor: zoom-in; transition: transform .18s ease;
}
.install-qr:hover { transform: scale(1.35); }
.qr-dialog {
  position: relative; background: var(--card); border-radius: 18px;
  padding: 1.6rem 1.6rem 1.3rem; text-align: center;
  box-shadow: 0 24px 64px rgba(10,20,40,.24);
}
.qr-dialog img { display: block; width: 260px; height: 260px; border-radius: 10px; background: #fff; }
@media (max-width: 860px) { .nav-links { display: none; } }
.nav-account { background: none; border: none; padding: 0; font-family: inherit; cursor: pointer; }
.account-wrap { position: relative; display: inline-flex; align-items: center; }
.account-pop {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 190px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.4rem;
  box-shadow: 0 14px 36px rgba(0,0,0,.12);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .18s, transform .18s, visibility .18s;
  z-index: 60;
}
.account-wrap.signed-in:hover .account-pop,
.account-wrap.signed-in:focus-within .account-pop {
  opacity: 1; visibility: visible; transform: translateY(0); transition-delay: .1s;
}
.account-pop a, .account-pop button {
  display: block; width: 100%; text-align: left; padding: 0.5rem 0.55rem;
  border: none; border-radius: 8px; background: none;
  font-family: inherit; font-size: 0.86rem; color: var(--text);
  cursor: pointer;
}
.account-pop a:hover, .account-pop button:hover { background: #f5f5f5; text-decoration: none; }
.nav-account.has-avatar { display: inline-flex; align-items: center; padding: 0; }
.account-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: #eef2f7; color: #2b3648;
  border: 1px solid rgba(0,0,0,.04);
}
.account-avatar svg { width: 17px; height: 17px; }
.acct-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.acct-modal[hidden] { display: none; }
.acct-backdrop { position: absolute; inset: 0; background: rgba(12,16,24,.42); backdrop-filter: blur(3px); }
.acct-dialog {
  position: relative; width: 100%; max-width: 372px;
  background: var(--card); border-radius: 16px; padding: 1.7rem 1.6rem 1.5rem;
  box-shadow: 0 24px 64px rgba(10,20,40,.24);
}
.acct-close {
  position: absolute; top: .55rem; right: .55rem; width: 30px; height: 30px;
  border: none; border-radius: 8px; background: none; color: var(--text-dim);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.acct-close:hover { background: #f3f3f3; color: var(--text); }
.acct-dialog h2 { font-size: 1.15rem; letter-spacing: -0.01em; margin-bottom: 1.1rem; }
.acct-field { display: block; margin-bottom: .9rem; font-size: .8rem; color: var(--text-muted); }
.acct-field input {
  display: block; width: 100%; height: 40px; margin-top: .35rem; padding: 0 .75rem;
  font-size: .92rem; font-family: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.acct-field input:focus { border-color: #333; }
.acct-code { display: flex; gap: .5rem; margin-top: .35rem; }
.acct-code input { margin-top: 0; }
.acct-send {
  flex: none; height: 40px; padding: 0 .8rem; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; color: var(--text); font-size: .82rem;
  font-family: inherit; cursor: pointer; white-space: nowrap;
}
.acct-send:disabled { color: var(--text-dim); cursor: default; }
.acct-submit {
  width: 100%; height: 42px; margin-top: .5rem; border: none; border-radius: 9px;
  background: var(--text); color: #fff; font-size: .93rem; font-weight: 600;
  font-family: inherit; cursor: pointer;
}
.acct-submit:disabled { opacity: .55; cursor: default; }
.acct-msg { min-height: 1.2rem; margin-top: .7rem; font-size: .8rem; color: #c0392b; }
.acct-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1.1rem; }
.acct-mail { font-size: .98rem; font-weight: 600; word-break: break-all; }
.acct-badge { flex: none; font-size: .72rem; padding: .14rem .5rem; border-radius: 999px; background: var(--code-bg); color: var(--text-muted); }
.acct-badge.paid { background: #eaf2ff; color: #165dff; }
.acct-rows { border-top: 1px solid var(--border-soft); }
.acct-rows .row { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--border-soft); font-size: .88rem; }
.acct-rows .row span:first-child { color: var(--text-muted); }
.acct-logout {
  width: 100%; height: 40px; margin-top: 1.2rem; border: 1px solid var(--border);
  border-radius: 9px; background: #fff; color: var(--text-muted);
  font-size: .88rem; font-family: inherit; cursor: pointer;
}
.acct-view[hidden] { display: none; }

/* 联系作者弹层 */
.contact-dialog {
  position: relative; width: 100%; max-width: 560px;
  background: var(--card); border-radius: 18px; padding: 2rem 1.8rem 1.6rem;
  box-shadow: 0 24px 64px rgba(10,20,40,.24);
}
.contact-dialog h2 { font-size: 1.15rem; letter-spacing: -0.01em; text-align: center; margin-bottom: 1.4rem; }
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; align-items: start; }
.contact-card { text-align: center; }
.contact-card h3 { font-size: .84rem; font-weight: 600; margin-bottom: .6rem; color: var(--text); }
.contact-card img {
  display: block; width: 100%; max-width: 150px; aspect-ratio: 1;
  object-fit: contain; margin: 0 auto; background: #fff;
  border: 1px solid var(--border-soft); border-radius: 10px; padding: 6px;
}
.contact-card p { margin-top: .5rem; font-size: .74rem; color: var(--text-dim); line-height: 1.5; }
.contact-card a {
  display: inline-block; padding: .55rem .7rem; font-size: .8rem;
  border: 1px solid var(--border-soft); border-radius: 8px;
  color: var(--text); word-break: break-all;
}
.contact-card a:hover { text-decoration: none; border-color: var(--border); }
@media (max-width: 560px) {
  .contact-grid { grid-template-columns: 1fr 1fr; }
  .contact-card.email { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .nav-actions { gap: 0.55rem; }
  .nav-install { height: 32px; padding: 0 0.8rem; font-size: 0.82rem; }
  .install-pop { width: min(320px, calc(100vw - 32px)); }
}

footer {
  border-top: 1px solid var(--border-soft);
  padding: 2rem 0 2.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.footer-inner {
  display: flex; justify-content: space-between; flex-wrap: wrap;
  gap: 0.6rem; align-items: center;
}
.footer-links { display: flex; gap: 1.2rem; }
.footer-brand { display: flex; align-items: center; gap: 0.45rem; color: inherit; }
.footer-brand:hover { text-decoration: none; color: var(--text-muted); }
.footer-brand img { width: 18px; height: 18px; border-radius: 4px; }
footer a { color: var(--text-dim); }
footer a:hover { color: var(--text-muted); }

code, kbd {
  background: var(--code-bg);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 0.08rem 0.4rem;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.84em;
  color: var(--text);
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  margin: 0 0 1rem;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.55;
}
pre code { background: none; border: none; padding: 0; font-size: inherit; }
