:root {
  --bg: #fafaf7; --card: #fff; --ink: #1d1d1b; --muted: #6b6b66; --line: #e4e3dc;
  --accent: #2f5fd0; --accent-soft: #e8eefc;
  --erratum: #c0392b; --suggestion: #2e8b57; --question: #b7791f; --discussion: #6b6b66;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.6 -apple-system, "PingFang SC", "Noto Sans SC", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 18px; color: var(--ink); }
#nav { display: flex; gap: 12px; align-items: center; }
#nav img { width: 28px; height: 28px; border-radius: 50%; }
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
button, .btn { font: inherit; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; color: var(--ink); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], textarea, select { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
textarea { min-height: 80px; resize: vertical; }
label { display: block; margin: 12px 0 4px; font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin-bottom: 12px; }
.paper-list h3 { margin: 0 0 4px; }
.form { max-width: 640px; }
.error { color: var(--erratum); }

/* 论文页：左 PDF，右评论 */
.paper-head h1 { margin: 0 0 4px; font-size: 24px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); gap: 20px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }
.viewer { background: #e9e8e2; border-radius: 12px; padding: 16px; }
.page-wrap { position: relative; margin: 0 auto 16px; box-shadow: 0 1px 4px rgba(0,0,0,.15); background: #fff; }
.page-wrap canvas { display: block; }
.page-tag { position: absolute; top: 6px; right: -4px; transform: translateX(100%); font-size: 12px; }
.page-wrap .comment-page { position: absolute; bottom: 8px; right: 8px; font-size: 12px; padding: 2px 8px; opacity: .85; }
.page-wrap .count { position: absolute; top: 8px; right: 8px; background: var(--accent); color: #fff; border-radius: 10px; font-size: 12px; padding: 0 8px; }
.sidebar { width: 100%; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filters button { font-size: 13px; padding: 2px 10px; }
.filters button.on { background: var(--accent-soft); border-color: var(--accent); }
.comment { border-left: 3px solid var(--line); padding: 8px 10px; margin-bottom: 10px; background: var(--card); border-radius: 0 8px 8px 0; }
.comment.erratum { border-left-color: var(--erratum); }
.comment.suggestion { border-left-color: var(--suggestion); }
.comment.question { border-left-color: var(--question); }
.comment.hidden-c { opacity: .5; }
.comment .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.comment .quote { font-size: 13px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 8px; margin: 4px 0; font-style: italic; }
.comment .body { white-space: pre-wrap; margin: 4px 0; }
.comment .actions { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.comment .actions button, .comment .actions select { font-size: 12px; padding: 1px 8px; width: auto; }
.replies { margin-left: 14px; margin-top: 6px; }
.tag { font-size: 11px; padding: 0 6px; border-radius: 6px; color: #fff; }
.tag.erratum { background: var(--erratum); } .tag.suggestion { background: var(--suggestion); }
.tag.question { background: var(--question); } .tag.discussion { background: var(--discussion); }
.status { font-size: 11px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); }
.status.accepted, .status.fixed { border-color: var(--suggestion); color: var(--suggestion); }
.status.rejected { border-color: var(--erratum); color: var(--erratum); }
.composer { background: var(--card); border: 1px solid var(--accent); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.composer .anchor { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.selection-btn { position: absolute; z-index: 20; }
