:root {
  --red: #C8203B; --red-soft: #FCE8EB;
  --bg: #FAF8F6; --card: #FFFFFF; --ink: #1F1A1C; --muted: #6B6266; --line: #ECE5E2;
  --note-bg: #FFF7E0; --note-line: #F6C343;
  --side-w: 248px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17131A; --card: #211C24; --ink: #F1ECEE; --muted: #A79DA2; --line: #342C35;
    --red-soft: #3A1E25; --note-bg: #2E2717; --note-line: #A8822A;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); line-height: 1.75; font-size: 17px; -webkit-text-size-adjust: 100%; }
a { color: var(--red); }

/* ── 激活码门禁：没激活只显示门，激活后只显示内容（<head> 里的脚本先打好 .ok 标记，不闪） ── */
.gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(160deg, #E8384F, #9E1028); }
html.ok .gate { display: none; }
html:not(.ok) .app { display: none; }
.gate-card { width: 100%; max-width: 360px; background: var(--card); border-radius: 20px; padding: 32px 24px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.gate-card img { border-radius: 16px; }
.gate-card h1 { margin: 12px 0 0; font-size: 24px; }
.gate-card p { margin: 4px 0 18px; color: var(--muted); }
.gate-card input { width: 100%; font-size: 26px; letter-spacing: 8px; text-align: center; padding: 12px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); text-transform: uppercase; }
.gate-card input:focus { outline: none; border-color: var(--red); }
.gate-card button { margin-top: 14px; width: 100%; padding: 13px; font-size: 18px; border: 0; border-radius: 12px;
  background: var(--red); color: #fff; cursor: pointer; }
.gate-err { color: var(--red) !important; min-height: 1.5em; margin: 12px 0 0 !important; font-size: 15px; }

/* ── 布局：手机单栏 + 顶栏抽屉；电脑左侧固定目录 ── */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.menu-btn { font-size: 22px; background: none; border: 0; color: var(--ink); padding: 4px 10px; cursor: pointer; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 7px; }
.sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); z-index: 40; overflow-y: auto;
  background: var(--card); border-right: 1px solid var(--line); padding: 16px 12px 40px;
  transform: translateX(-100%); transition: transform .2s; }
.sidebar.open { transform: none; }
.side-brand { font-size: 18px; padding: 4px 8px 12px; }
.nav-group { font-size: 13px; color: var(--muted); margin: 16px 8px 4px; }
.sidebar nav a { display: block; padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 16px; }
.sidebar nav a:hover { background: var(--bg); }
.sidebar nav a[aria-current] { background: var(--red-soft); color: var(--red); font-weight: 600; }
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.35); display: none; }
.scrim.on { display: block; }
.content { max-width: 820px; margin: 0 auto; padding: 8px 16px 48px; }
@media (min-width: 960px) {
  .topbar, .scrim { display: none !important; }
  .sidebar { transform: none; }
  .content { margin-left: var(--side-w); margin-right: auto; padding: 24px 48px 64px; max-width: calc(820px + 96px); }
}

/* ── 正文 ── */
article h1 { font-size: 28px; line-height: 1.3; margin: 20px 0 8px; }
article h1 + blockquote { font-size: 18px; }
article h2 { font-size: 22px; margin: 36px 0 10px; padding-left: 10px; border-left: 4px solid var(--red); line-height: 1.4; }
article h3 { font-size: 18px; margin: 24px 0 6px; }
article blockquote { margin: 16px 0; padding: 10px 14px; background: var(--note-bg); border-left: 4px solid var(--note-line);
  border-radius: 0 10px 10px 0; }
article blockquote p { margin: 0; }
article ol, article ul { padding-left: 1.4em; }
article li { margin: 10px 0; }
article ol > li::marker { color: var(--red); font-weight: 700; }
.table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--bg); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* ── 截图：手机上横向滑，电脑上平铺；点开放大 ── */
.shots { display: flex; gap: 10px; overflow-x: auto; padding: 8px 2px 10px; margin: 4px 0; scroll-snap-type: x mandatory; }
.shot { flex: 0 0 auto; scroll-snap-align: start; display: block; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: var(--card); }
.shot img { display: block; height: 340px; width: auto; max-width: 78vw; object-fit: contain; }
@media (min-width: 960px) { .shot img { height: 300px; max-width: 640px; } }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.88); display: none; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox.on { display: grid; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager a { padding: 10px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); text-decoration: none; font-weight: 600; }
