*, *::before, *::after { box-sizing: border-box; }
:root { color-scheme: light; --paper:#f6faf9; --ink:#1b3431; --muted:#465f5b; --green:#075644; --line:#d4e4df; --error:#a12f3f; background:var(--paper); color:var(--ink); font-family:"Microsoft YaHei UI","PingFang SC","Noto Sans CJK SC",system-ui,sans-serif; }
body, h1, h2, h3, p, ul { margin:0; }
[hidden] { display:none !important; }
.shell { width:min(950px,calc(100% - 40px)); margin-inline:auto; }
.masthead { border-bottom:1px solid var(--line); background:white; }
.bar { display:flex; justify-content:space-between; align-items:center; min-height:55px; gap:12px; }
a { color:var(--green); text-underline-offset:.22em; }
.book { font-size:.95rem; font-weight:750; color:var(--ink); text-decoration:none; }
.back { font-size:.85rem; }
.page-head { padding-block:26px 20px; }
.eyebrow { margin-bottom:6px; color:var(--green); font-size:.83rem; font-weight:720; }
h1 { font-size:2rem; line-height:1.25; }
h2 { font-size:1.1rem; line-height:1.4; }
.section-head { display:flex; justify-content:space-between; align-items:center; gap:12px; padding-block:12px; border-top:1px solid var(--line); }
#count { margin-inline-start:5px; color:var(--muted); font-size:.8rem; font-weight:400; }
button { min-height:38px; display:inline-flex; justify-content:center; align-items:center; gap:6px; padding:5px 11px; border:1px solid #b9d2c9; border-radius:6px; background:white; color:var(--green); font:inherit; font-size:.88rem; cursor:pointer; }
button img { width:17px; height:17px; }
button.primary { font-weight:720; border-color:var(--green); background:var(--green); color:white; }
button.primary img { filter:invert(1); }
button:hover:not(:disabled) { outline:1px solid currentColor; outline-offset:-2px; }
button:disabled { opacity:.5; cursor:default; }
:focus-visible { outline:3px solid #77502e; outline-offset:3px; }
#list-state { color:var(--muted); font-size:.9rem; line-height:1.7; }
#list-state:not(:empty) { margin-block:10px; }
ul { display:grid; list-style:none; padding:0; gap:9px; margin-bottom:32px; }
li { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:14px; border:1px solid var(--line); border-radius:8px; background:white; }
.item-body { min-width:0; overflow-wrap:anywhere; }
.item-title { font-size:1rem; line-height:1.5; }
.item-meta { margin-top:3px; color:var(--muted); font-size:.77rem; line-height:1.6; }
.item-intro { margin-top:7px; font-size:.88rem; line-height:1.6; white-space:pre-wrap; }
.item-tools { display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; flex:none; }
.item-tools button { min-height:34px; }
.item-tools .delete { color:var(--error); }
dialog { padding:0; border:1px solid var(--line); border-radius:8px; color:var(--ink); width:min(530px,calc(100% - 24px)); max-height:calc(100dvh - 24px); }
dialog::backdrop { background:#142c27aa; }
#form { padding:16px; }
.dialog-head { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:10px; }
.dialog-head h2 { overflow-wrap:anywhere; }
.icon-button { flex:none; width:38px; padding:4px; }
label { display:block; font-weight:700; font-size:.9rem; margin-top:11px; }
label input, textarea { display:block; width:100%; min-height:38px; margin-top:4px; padding:7px; font:inherit; font-weight:400; color:var(--ink); border:1px solid #b9d2c9; border-radius:5px; background:#fff; }
textarea { resize:vertical; }
.muted, .form-note { color:var(--muted); font-size:.78rem; font-weight:400; }
.form-note, #delete-copy { margin-block:7px; line-height:1.55; }
#delete-copy { overflow-wrap:anywhere; }
.feedback { color:var(--error); font-size:.86rem; margin-top:8px; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:13px; }
#submit.danger { color:white; background:var(--error); border-color:var(--error); }
#viewer { width:min(960px,calc(100% - 20px)); height:min(900px,calc(100dvh - 22px)); }
#viewer[open] { display:grid; grid-template-rows:auto auto minmax(0,1fr); }
#viewer .dialog-head { margin:0; padding:10px 13px 6px; }
.page-controls { display:grid; grid-template-columns:auto 96px auto; align-items:center; justify-content:center; gap:7px; padding:7px 5px 10px; }
#page-number { text-align:center; font-size:.88rem; font-variant-numeric:tabular-nums; }
.paper-window { overflow:auto; background:#eef0f4; padding:8px; border-top:1px solid var(--line); }
#viewer-state { text-align:center; font-size:.9rem; line-height:1.6; }
#canvas-area canvas { display:block; max-width:100%; height:auto; margin-inline:auto; background:white; }
@media(max-width:580px) {
  .shell { width:calc(100% - 24px); }
  li { align-items:stretch; flex-direction:column; gap:8px; }
  .item-tools { justify-content:flex-start; }
  .page-controls { grid-template-columns:auto 62px auto; }
}
