:root {
  --bg: #fbfaf7;
  --fg: #26231f;
  --muted: #7a746b;
  --line: #e6e2d9;
  --card: #ffffff;
  --accent: #b4541a;
  --fs: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17161a;
    --fg: #e8e4dc;
    --muted: #9a948a;
    --line: #2c2a30;
    --card: #1f1e23;
    --accent: #e08a52;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "PingFang SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
  line-height: 1.6;
}

/* The line length is capped on the container, never on single elements. */
.page { max-width: 42rem; margin: 0 auto; padding: 0 16px 64px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; margin: 0; font-size: 20px; }
.spacer { flex: 1; }
/* The reader's title bar: the title takes what the buttons leave and is cut to one line. */
.bar-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn.verdict { padding: 6px 10px; line-height: 1; }
.btn.verdict:disabled { opacity: 0.4; cursor: default; }
.btn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.font-row { display: flex; align-items: center; gap: 8px; margin-top: 40px; font-size: 14px; color: var(--muted); }

.btn {
  font: inherit;
  font-size: 15px;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 12px;
  text-decoration: none;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: default; }

.status { color: var(--muted); font-size: 14px; padding: 10px 0 0; min-height: 1.2em; }

.card {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.card-title { font-size: 17px; font-weight: 600; line-height: 1.45; }
.card-meta { margin-top: 4px; font-size: 13px; color: var(--muted); }

.more { padding: 20px 0; text-align: center; }
.end { color: var(--muted); font-size: 14px; margin: 0; }

.article { padding-top: 20px; }
.article-title { font-size: 26px; line-height: 1.35; margin: 0 0 8px; }
.origin { display: inline-block; margin: 8px 0 20px; font-size: 14px; color: var(--accent); }
.article h2 { font-size: calc(var(--fs) * 1.15); margin: 1.8em 0 0.6em; line-height: 1.4; }
.article p strong { font-weight: 700; }
.article p.source { font-size: 15px; line-height: 1.6; margin-bottom: 0.7em; }
.article p.source a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.source-host { color: var(--muted); font-size: 13px; }
.article p { font-size: var(--fs); line-height: 1.9; margin: 0 0 1.1em; overflow-wrap: anywhere; }

/* Step 2: read marks on the feed, and the paragraph toolbar in the reader. */
.card.read .card-title { color: var(--muted); font-weight: 500; }

.block.selected > p { background: color-mix(in srgb, var(--accent) 9%, var(--bg)); border-radius: 10px; padding: 6px 12px; margin-left: -12px; margin-right: -12px; }
.marks { display: flex; flex-wrap: wrap; gap: 6px; margin: -0.5em 0 0.9em; }
.marks:empty { display: none; }
.chip { font-size: 14px; line-height: 1; padding: 3px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.note {
  flex-basis: 100%;
  font-size: 15px;
  line-height: 1.6;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: var(--card);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  white-space: pre-wrap; /* a line break typed in a note stays a line break */
  overflow-wrap: anywhere;
}
.tools { margin: -0.4em 0 1.2em; }
.tools:empty { display: none; }
.tools:not(:has(textarea)) { display: flex; flex-wrap: wrap; gap: 8px; }
.tool {
  font: inherit;
  font-size: 18px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.tool.wide { font-size: 15px; }
.tool.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.tool-row { display: flex; gap: 8px; margin-top: 8px; }
.note-input {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  resize: vertical;
}

/* Step 3: the offline copy and syncing. */
.notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  overflow-wrap: anywhere;
}
.status:empty { display: none; }
.foot { margin: 0; padding: 8px 0 0; font-size: 12px; color: var(--muted); text-align: center; overflow-wrap: anywhere; }

.fold { margin: 16px 0; }
.fold > summary { display: inline-block; cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold[open] > summary { margin-bottom: 8px; }

/* Step 5a: the statistics page. */
.stats { padding-top: 8px; }
.progress { font-size: 17px; font-weight: 600; margin: 12px 0 8px; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0; line-height: 1.6; }
.scatter { display: block; width: 100%; height: auto; margin: 10px 0 4px; touch-action: manipulation; }
.scatter-bg { fill: var(--card); stroke: var(--line); }
.scatter-dot { stroke: var(--bg); stroke-width: 1.5; }
.scatter-ring { fill: none; stroke: var(--accent); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin: 6px 0; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.group { border-bottom: 1px solid var(--line); padding: 4px 0; }
.group > summary { cursor: pointer; font-size: 17px; font-weight: 600; padding: 10px 0; }
.sub { margin: 0 0 4px 12px; }
.sub > summary { cursor: pointer; font-size: 15px; padding: 6px 0; color: var(--fg); }
.sub-rest { margin-left: 12px; }
.row { display: block; padding: 7px 0 7px 12px; font-size: 15px; line-height: 1.5; color: inherit; text-decoration: none; border-top: 1px solid var(--line); }


/* The category bars on the statistics page, and the reaction digest. */
.wide-link { display: block; text-align: center; margin: 6px 0 4px; }
.section-title { font-size: 16px; margin: 18px 0 8px; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 12px; font-size: 15px; padding: 4px 0; }
.bar-row .bar-track { grid-column: 1 / -1; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { position: relative; height: 14px; border-radius: 7px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; opacity: 0.55; }
.bar-mark { position: absolute; left: 0; top: 4px; bottom: 4px; background: var(--fg); opacity: 0.75; border-radius: 3px; }
.bar-num { color: var(--muted); font-size: 13px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.filter { font: inherit; font-size: 15px; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; cursor: pointer; }
.filter.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.filter.dim { opacity: 0.45; }
.digest-entry { padding: 14px 0; border-bottom: 1px solid var(--line); }
.digest-head { font-size: 13px; color: var(--muted); }
.digest-text { margin: 6px 0; font-size: 16px; line-height: 1.7; cursor: pointer; }
.digest-text.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.digest-title { display: block; margin-top: 6px; font-size: 14px; color: var(--accent); text-decoration: none; }

/* Step 6: questions under a paragraph. */
.ask-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ask { display: flex; flex-basis: 100%; gap: 10px; align-items: baseline; justify-content: space-between; font-size: 15px; line-height: 1.6; padding: 8px 12px; border-left: 3px solid var(--muted); background: var(--card); border-radius: 0 8px 8px 0; cursor: pointer; }
.ask.answered { cursor: default; border-left-color: var(--accent); }
.ask-status { flex: none; font-size: 13px; color: var(--muted); text-decoration: none; }
.ask.answered .ask-status { color: var(--accent); }

.queue { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0 0; font-size: 14px; color: var(--muted); }
.queue:empty { display: none; }
.article h2 { scroll-margin-top: 72px; }

/* The access-token prompt, shown in the feed's notice when the server answers 401. */
.token-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.token-form input { flex: 1; min-width: 10em; font: inherit; font-size: 16px; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }

/* Under the reader's title bar once an article is disliked: the reasons to pick from. */
.reasons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0 2px; }
.reasons[hidden] { display: none; }
.reasons-label { flex-basis: 100%; font-size: 14px; color: var(--muted); }

/* Source marks like [3] inside a paragraph: small and quiet, so a sentence reads on past them. */
.cite { color: var(--muted); font-size: 0.62em; margin-left: 1px; vertical-align: super; line-height: 0; }

/* The 2026-11 redesign: header buttons, the settings menu, the unread line, the 已读 and 提需求 pages, the statistics tabs. */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 10px; }
.topbar .btn { min-height: 44px; display: inline-flex; align-items: center; }
.btn.primary { display: block; width: 100%; min-height: 52px; margin-top: 16px; border-color: var(--accent); background: var(--accent); color: var(--bg); font-size: 17px; font-weight: 700; border-radius: 14px; }
.btn.primary:disabled { opacity: 0.5; }

.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: flex; flex-direction: column; gap: 4px; min-width: 14em; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14); }
.menu[hidden] { display: none; }
.menu-item { font: inherit; font-size: 16px; text-align: left; min-height: 44px; padding: 0 12px; color: var(--fg); background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
.menu-item:hover { background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.menu-item:disabled { opacity: 0.5; cursor: default; }
.menu-font { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; font-size: 16px; }
.menu-font span { flex: 1; }
.menu-foot { margin: 0; padding: 4px 12px 6px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.sync-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; font-size: 13px; color: var(--muted); }
.sync-text { flex: 1; min-width: 0; }
.read-link { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding-left: 12px; font-size: 14px; color: var(--fg); text-decoration: none; }
.read-link:empty { display: none; }

.card-title { font-size: 18px; font-weight: 700; }
.card-meta { font-size: 14px; }

.tabs { display: flex; gap: 8px; padding: 14px 0 0; }
.tab { font: inherit; font-size: 15px; min-height: 44px; padding: 0 16px; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.tab[aria-pressed="true"] { border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); font-weight: 600; }
.tabs.underline { gap: 0; padding: 0; border-bottom: 1px solid var(--line); }
.tabs.underline .tab { flex: 1; justify-content: center; min-height: 48px; font-size: 17px; background: transparent; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: var(--muted); }
.tabs.underline .tab[aria-current="page"] { color: var(--fg); font-weight: 700; border-bottom-color: var(--accent); }

.ask-form { padding-top: 20px; }
.ask-label { display: block; font-size: 15px; color: var(--muted); margin-bottom: 10px; }
.ask-input { font-size: 17px; min-height: 12em; resize: vertical; }
.ask-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ask-row-text { flex: 1; min-width: 0; font-size: 16px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.ask-row-state { flex: none; font-size: 14px; color: var(--muted); }
a.ask-row-state { color: var(--accent); }
.link-btn { flex: none; font: inherit; font-size: 14px; min-height: 44px; padding: 0 6px; color: var(--accent); background: transparent; border: 0; cursor: pointer; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.section-head .section-title { margin: 0; }
.legend-fill, .legend-mark { display: inline-block; border-radius: 5px; }
.legend-fill { width: 22px; height: 10px; background: var(--muted); opacity: 0.5; }
.legend-mark { width: 22px; height: 4px; background: var(--fg); opacity: 0.75; }

.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 0 16px 4px; }
.chips.scroll .filter { flex: none; white-space: nowrap; }
.filter { min-height: 40px; }
.digest-text { font-size: 17px; cursor: auto; }
.note-mine { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 0; padding: 10px 12px; font-size: 15px; line-height: 1.55; background: var(--card); border-radius: 10px; }
.note-mine-label { color: var(--muted); }
.digest-tail { padding: 22px 0 8px; text-align: center; }
.chips.scroll { scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }

/* The reader of the 2026-11 redesign: the cards for 点赞 / 点踩 / 已阅, the writing bar above the keyboard, the contents panel, the buttons that close an article. */
.tool.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(20, 18, 16, 0.35); }
.overlay.light { background: rgba(20, 18, 16, 0.25); }
.sheet { position: fixed; z-index: 31; left: 50%; transform: translateX(-50%); width: calc(100% - 24px); max-width: 40rem; box-sizing: border-box; padding: 18px 16px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22); max-height: 90vh; overflow-y: auto; }
.sheet-title { margin: 0; font-size: 18px; line-height: 1.4; }
.reason-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.reason-chips .filter { min-height: 44px; padding: 0 14px; }
.sheet-label { display: block; margin-top: 14px; font-size: 13px; color: var(--muted); }
.sheet-input { display: block; width: 100%; box-sizing: border-box; min-height: 44px; margin-top: 4px; padding: 10px 12px; font: inherit; font-size: 16px; line-height: 1.5; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; resize: none; overflow-y: auto; }
.sheet-actions, .composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.btn.primary.inline { display: inline-flex; align-items: center; justify-content: center; width: auto; min-height: 48px; margin-top: 0; padding: 0 28px; font-size: 16px; }
.link-btn.muted { color: var(--muted); }
.icon-btn.plain { border: 0; background: transparent; color: var(--muted); }

.composer { position: fixed; left: 0; right: 0; z-index: 31; box-sizing: border-box; padding: 10px 16px 12px; background: var(--card); border-top: 1px solid var(--line); }
.composer-head { display: flex; align-items: center; justify-content: space-between; }
.composer-label { font-size: 14px; font-weight: 600; }
.composer .icon-btn.plain { margin: -6px -12px -6px 0; }
.composer .note-input { margin-top: 2px; border-color: var(--accent); resize: none; }
.composer-actions { margin-top: 10px; }
body.composing .topbar { display: none; }
body.composing .article { padding-bottom: 75vh; }

.toc-panel { position: fixed; z-index: 31; right: 12px; top: 72px; width: min(310px, calc(100% - 24px)); max-height: 70vh; overflow-y: auto; box-sizing: border-box; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2); }
.toc-head { padding: 6px 12px 4px; font-size: 13px; color: var(--muted); }
.toc-row { display: flex; align-items: center; width: 100%; min-height: 48px; box-sizing: border-box; padding: 6px 12px; text-align: left; font: inherit; font-size: 16px; line-height: 1.4; color: var(--fg); background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
.toc-row.here { background: color-mix(in srgb, var(--accent) 12%, var(--card)); font-weight: 700; }

.end-block { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.end-actions { display: flex; gap: 8px; }
.end-btn { flex: 1; min-height: 52px; font: inherit; font-size: 16px; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.end-btn.on { border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--fg); font-weight: 600; }

/* On a wide screen the writing box is a small box under the paragraph, not a bar across the window. */
.composer.inline { position: static; margin: 8px 0 1.2em; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 12px; }
.composer-slot:empty { display: none; }
.end-notes:empty { display: none; }
.end-note { white-space: pre-wrap; display: block; width: 100%; box-sizing: border-box; margin-top: 10px; padding: 10px 12px; text-align: left; font: inherit; font-size: 15px; line-height: 1.55; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; overflow-wrap: anywhere; }
.end-note-head { font-size: 13px; color: var(--muted); }
.end-note-label { color: var(--muted); }

/* The settings button carries a dot, and the menu a line at its top, when a newer version of the page is waiting. */
.menu-btn, .icon-btn { position: relative; }
.badge { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.badge[hidden], .menu-item.update[hidden] { display: none; }
.menu-item.update { color: var(--accent); font-weight: 600; }
.link-btn.withdraw { color: var(--muted); text-decoration: underline; }

/* 笔记 › 我写的: the reader's own words first, large; the paragraph they were written on underneath, quieter. */
.written-text { margin: 8px 0 0; font-size: 18px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.written-quote { margin: 10px 0 0; padding-left: 10px; border-left: 3px solid var(--line); font-size: 15px; line-height: 1.65; color: var(--muted); cursor: pointer; }
.written-quote.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
