:root { --bg:#faf8f4; --fg:#2b2b2b; --muted:#888; --line:#e3ded4; --accent:#a0522d; }
html[data-theme="night"] { --bg:#16161c; --fg:#c9c9c9; --muted:#777; --line:#2b2b35; --accent:#c98d5a; }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--fg);
  font-family:-apple-system,"PingFang SC","Noto Serif CJK SC",serif; line-height:1.9; }
main.list { max-width:36em; margin:0 auto; padding:1.2em 1em; }
h1 { font-size:1.25em; border-bottom:2px solid var(--accent); padding-bottom:.4em; }
ol.vols, ol.chs { list-style:none; padding:0; margin:0; }
ol.vols li, ol.chs li { padding:.7em .2em; border-bottom:1px solid var(--line);
  display:flex; justify-content:space-between; }
a { color:var(--accent); text-decoration:none; }
.meta { color:var(--muted); font-size:.8em; }
.crumb { font-size:.85em; color:var(--muted); margin:.2em 0 1em; }
.continue { display:block; margin:.8em 0; padding:.7em 1em; border:1px solid var(--accent);
  border-radius:.5em; }
main.read { max-width:36em; margin:0 auto; padding:1em 1.1em 3.5em; }
.secpick { position:sticky; top:0; background:var(--bg); padding:.5em 0;
  border-bottom:1px solid var(--line); font-size:.85em; z-index:1; }
.secpick a { margin-right:.7em; }
main.read section { margin:1.6em 0; }
main.read section h2 { font-size:.8em; color:var(--muted); font-weight:normal; }
main.read p { margin:0 0 1em; text-align:justify; }
html[data-font="s"] main.read { font-size:15px; }
html[data-font="m"] main.read { font-size:18px; }
html[data-font="l"] main.read { font-size:22px; }
.pager { display:flex; justify-content:space-between; margin-top:2.5em; gap:1em; }
.btn { border:1px solid var(--accent); border-radius:.5em; padding:.6em 1em; }
#settings-fab { position:fixed; right:1em; bottom:1em; }
#settings-fab > button { font-size:1.1em; width:2.6em; height:2.6em; border-radius:50%;
  border:1px solid var(--accent); background:var(--bg); color:var(--fg); }
#settings-panel { display:none; position:absolute; right:0; bottom:3.2em; background:var(--bg);
  border:1px solid var(--line); border-radius:.5em; padding:.6em; min-width:9em; }
#settings-panel.open { display:block; }
#settings-panel button { display:block; width:100%; margin:.25em 0; padding:.45em;
  background:none; border:1px solid var(--line); border-radius:.4em; color:var(--fg); }
.fonts { display:flex; gap:.3em; }

/* 入口页 */
main.gate { position:relative; overflow:hidden; min-height:100vh; min-height:100dvh;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:1.5em; text-align:center; }
.gate-bg { position:absolute; left:50%; top:46%; transform:translate(-50%,-50%);
  width:min(78vw, 430px); height:auto; opacity:.16; pointer-events:none; user-select:none;
  filter:drop-shadow(0 8px 30px rgba(160,82,45,.15)); }
html[data-theme="night"] .gate-bg { opacity:.13; filter:drop-shadow(0 8px 30px rgba(0,0,0,.5)); }
.gate-title, .gate-rule, .gate-enter { position:relative; z-index:1; }
.gate-title { font-size:clamp(2.4em, 9vw, 3.8em); font-weight:800; letter-spacing:.14em;
  border:none; padding:0; margin:0 0 .35em;
  background:linear-gradient(120deg, #a0522d 0%, #d4a017 35%, #c98d5a 55%, #a0522d 100%);
  background-size:200% 200%;
  -webkit-background-clip:text; background-clip:text; color:transparent;
  filter:drop-shadow(0 2px 10px rgba(160,82,45,.28));
  animation:gate-shimmer 7s ease-in-out infinite; }
html[data-theme="night"] .gate-title {
  background:linear-gradient(120deg, #c98d5a 0%, #e8c078 35%, #c98d5a 60%, #a0522d 100%);
  background-size:200% 200%;
  -webkit-background-clip:text; background-clip:text;
  filter:drop-shadow(0 2px 12px rgba(201,141,90,.35)); }
@keyframes gate-shimmer {
  0% { background-position:0% 50%; }
  50% { background-position:100% 50%; }
  100% { background-position:0% 50%; } }
.gate-rule { width:4.5em; height:2px; margin:0 auto 2.2em; border:none;
  background:linear-gradient(90deg, transparent, var(--accent), transparent); }
.gate-actions { position:relative; z-index:1; display:flex; flex-direction:column;
  align-items:center; gap:.85em; }
.gate-enter { display:inline-block; padding:.65em 2.4em; font-size:1.05em; letter-spacing:.28em;
  text-indent:.28em; color:var(--accent); border:1px solid var(--accent); border-radius:2em;
  background:transparent; transition:background .25s, color .25s, box-shadow .25s; }
.gate-enter:hover, .gate-enter:focus { background:var(--accent); color:var(--bg);
  box-shadow:0 4px 18px rgba(160,82,45,.3); outline:none; }
html[data-theme="night"] .gate-enter:hover,
html[data-theme="night"] .gate-enter:focus { box-shadow:0 4px 18px rgba(201,141,90,.35); }
.gate-admin { display:inline-block; padding:.45em 1.8em; font-size:.9em; letter-spacing:.22em;
  text-indent:.22em; color:var(--muted); border:1px dashed var(--line); border-radius:2em;
  background:transparent; cursor:pointer; font-family:inherit;
  transition:color .25s, border-color .25s; }
.gate-admin:hover, .gate-admin:focus { color:var(--accent); border-color:var(--accent);
  outline:none; }
.gate-slot { display:flex; flex-direction:column; align-items:center; gap:.5em; }
.gate-pass { display:flex; gap:.4em; align-items:center; animation:pass-in .18s ease; }
@keyframes pass-in { from { opacity:0; transform:translateY(-4px); } to { opacity:1; } }
.gate-pass input { width:9em; padding:.45em .8em; font-size:1em; font-family:inherit;
  color:var(--fg); background:var(--bg); border:1px solid var(--accent); border-radius:2em;
  outline:none; text-align:center; letter-spacing:.3em; }
.gate-pass input:focus { box-shadow:0 0 0 3px rgba(160,82,45,.15); }
.gate-pass-ok { padding:.45em 1.1em; font-size:.9em; font-family:inherit; color:var(--bg);
  background:var(--accent); border:none; border-radius:2em; cursor:pointer; }
.gate-pass-no { padding:.45em .7em; font-size:1em; font-family:inherit; color:var(--muted);
  background:none; border:1px solid var(--line); border-radius:2em; cursor:pointer; line-height:1; }
.gate-pass-err { margin:0; font-size:.8em; color:#c0392b; }
html[data-theme="night"] .gate-pass-err { color:#e07060; }
.gate-reader { display:inline-block; padding:.45em 1.8em; font-size:.9em; letter-spacing:.22em;
  text-indent:.22em; color:var(--muted); border:1px dashed var(--line); border-radius:2em;
  background:transparent; transition:color .25s, border-color .25s; }
.gate-reader:hover, .gate-reader:focus { color:var(--accent); border-color:var(--accent);
  outline:none; }

/* Reader 页 */
main.md { max-width:44em; margin:0 auto; padding:1.2em 1em 3em; }
main.md h1 { font-size:1.2em; }
#md-src { width:100%; min-height:55vh; padding:.9em 1em; font-size:16px; font-family:ui-monospace,
  "SF Mono", Menlo, Consolas, monospace; line-height:1.7; color:var(--fg); background:var(--bg);
  border:1px solid var(--line); border-radius:.5em; outline:none; resize:vertical; }
#md-src:focus { border-color:var(--accent); }
.md-bar { display:flex; gap:.7em; margin-top:.9em; }
.md-ghost { background:none; color:var(--muted); }
.md-top { display:flex; justify-content:space-between; margin:.3em 0 1.2em; }
.md-body { font-size:17px; line-height:1.95; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { line-height:1.4; margin:1.4em 0 .6em; }
.md-body h1 { font-size:1.5em; border-bottom:2px solid var(--accent); padding-bottom:.3em; }
.md-body h2 { font-size:1.3em; border-bottom:1px solid var(--line); padding-bottom:.25em; }
.md-body h3 { font-size:1.15em; }
.md-body h4, .md-body h5, .md-body h6 { font-size:1em; color:var(--muted); }
.md-body p { margin:0 0 1em; text-align:justify; }
.md-body ul, .md-body ol { margin:0 0 1em; padding-left:1.6em; }
.md-body li { margin:.25em 0; }
.md-body a { text-decoration:underline; text-underline-offset:3px; }
.md-body code { font-family:ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size:.88em; background:rgba(160,82,45,.1); padding:.12em .4em; border-radius:.3em; }
.md-body pre { background:rgba(0,0,0,.06); border:1px solid var(--line); border-radius:.5em;
  padding:.9em 1.1em; overflow-x:auto; margin:0 0 1.2em; }
html[data-theme="night"] .md-body pre { background:rgba(255,255,255,.05); }
.md-body pre code { background:none; padding:0; font-size:.85em; line-height:1.7; }
.md-body blockquote { margin:0 0 1em; padding:.4em 1em; border-left:3px solid var(--accent);
  color:var(--muted); background:rgba(160,82,45,.06); border-radius:0 .4em .4em 0; }
.md-body hr { border:none; border-top:1px solid var(--line); margin:1.8em auto; width:60%; }
.md-body img { max-width:100%; height:auto; border-radius:.4em; }
.md-body table { border-collapse:collapse; width:100%; margin:0 0 1.2em; font-size:.95em; }
.md-body th, .md-body td { border:1px solid var(--line); padding:.45em .7em; text-align:left; }
.md-body th { background:rgba(160,82,45,.08); }

/* KaTeX 公式排版 */
.md-body .katex { font-size:1.05em; }
.md-body p .katex-display, .md-body .katex-display { overflow-x:auto; overflow-y:hidden;
  padding:.2em 0; }
.md-body .katex-error { color:#c0392b; font-family:ui-monospace, monospace; font-size:.9em;
  background:rgba(192,57,43,.06); padding:.1em .3em; border-radius:.25em; }
html[data-theme="night"] .md-body .katex-error { color:#e07060; }
/* 手机上长公式横向滑动，不撑破版心 */
@media (max-width: 600px) {
  .md-body { font-size:16px; }
  .md-body .katex-display { margin:.8em -.4em; }
}
