:root { font-family: system-ui, "Microsoft YaHei", sans-serif; color: #20322e; background: #f5f7f3; font-size: 18px; }
* { box-sizing: border-box; }
body { margin: 0; padding: 0 1.1rem 5.5rem; }
.header { max-width: 900px; margin: auto; padding: 1.3rem 0; display: flex; align-items: center; justify-content: space-between; gap: .75rem; border-bottom: 1px solid #dce4dc; }
.brand { font-weight: 750; color: #1e5140; text-decoration: none; }
.badge { font-size: .65rem; padding: .3rem .5rem; border-radius: 6px; background: #e4eee4; white-space: nowrap; }
main, .storage, .notice { max-width: 900px; margin: auto; }
main { padding: 1.8rem 0; min-height: 55vh; }
h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); margin: .5rem 0 1rem; }
p { line-height: 1.7; overflow-wrap: anywhere; }
.eyebrow { color: #38624d; font-size: .8rem; }
.lead { color: #5c6e66; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin: 1.5rem 0; }
.card { background: white; border: 1px solid #e0e6df; border-radius: 12px; padding: 1rem; }
.card p { font-size: .75rem; margin: 0 0 .5rem; }
.card strong { font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; }
button { border: 1px solid #bacdc0; border-radius: 9px; padding: .65rem .9rem; font: inherit; font-size: .85rem; color: #214c3a; background: white; min-height: 44px; cursor: pointer; }
button:hover { background: #e8f0e7; }
a { color: #23583f; }
button:focus-visible, a:focus-visible { outline: 3px solid #c18530; outline-offset: 3px; }
.muted, .storage { font-size: .75rem; color: #596c60; }
.notice { color: #754911; min-height: 2rem; padding: .6rem 0; }
nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 3rem; background: #fff; padding: .9rem; border-top: 1px solid #dce4dc; }
nav a { text-decoration: none; min-height: 32px; }
@media (max-width: 420px) { .stats { gap: .4rem; } .card { padding: .6rem; } .card strong { font-size: .75rem; } }
.library-filters { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1rem; }
.library-filters label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; flex: 1 1 140px; min-width: 0; }
.library-filters input, .library-filters select { width: 100%; min-height: 44px; font: inherit; padding: .5rem; border: 1px solid #bacdc0; border-radius: 6px; background: white; color: #20322e; }
.problem-card { padding: 1rem; border: 1px solid #dce4dc; border-radius: 8px; background: white; margin: .7rem 0; overflow-wrap: anywhere; }
.problem-card p { font-size: .8rem; margin: .3rem 0; }
.source-links { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1rem 0; overflow-wrap: anywhere; }
.source-text { white-space: pre-wrap; overflow-wrap: anywhere; font: .85rem/1.7 ui-monospace, Consolas, monospace; padding: .8rem; background: white; border: 1px solid #dce4dc; }

.reader, .reader > *, .markdown { min-width: 0; max-width: 100%; }
.reader h2 { overflow-wrap: anywhere; }
.reader-modes { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
details { margin: .8rem 0; border: 1px solid #bacdc0; border-radius: 8px; padding: .6rem .8rem; }
summary { cursor: pointer; min-height: 44px; display: list-item; padding: .5rem 0; }
details[hidden], button[hidden], pre[hidden] { display: none; }
summary:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #c18530; outline-offset: 2px; }
.reader pre, .markdown pre { overflow-x: auto; white-space: pre; max-width: 100%; padding: .8rem; border-radius: 5px; background: #e9eee9; font: .8rem/1.7 ui-monospace, Consolas, monospace; }
.markdown { overflow-x: auto; overflow-wrap: anywhere; line-height: 1.8; }
.markdown table { border-collapse: collapse; max-width: 100%; }
.markdown th, .markdown td { border: 1px solid #bacdc0; padding: .4rem; }
.personal-note label { display: block; }
.personal-note textarea { display: block; width: 100%; margin: .6rem 0; resize: vertical; min-height: 160px; font: inherit; line-height: 1.6; padding: .6rem; border-radius: 6px; border: 1px solid #bacdc0; color: inherit; background: inherit; }
.personal-note button { margin: .3rem; }
.reader .latest-note { white-space: pre-wrap; overflow-wrap: anywhere; }
#note-status[data-state="error"] { color: #a52323; }
.note-marker { display: inline-block; border-radius: 5px; padding: .2rem .5rem; background: #e3eee6; font-size: .75rem; }
.reading-settings { display: flex; flex-wrap: wrap; gap: 1rem; }
.reading-settings label { display: flex; flex-direction: column; gap: .4rem; }
.reading-settings select { font: inherit; min-height: 44px; max-width: 100%; }
:root[data-theme="dark"] { color-scheme: dark; color: #e1eae4; background: #18221e; }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .problem-card, :root[data-theme="dark"] .source-text,
:root[data-theme="dark"] nav, :root[data-theme="dark"] button, :root[data-theme="dark"] input,
:root[data-theme="dark"] select, :root[data-theme="dark"] .reader pre { background: #25342c; color: #e1eae4; }
:root[data-theme="dark"] a, :root[data-theme="dark"] .brand, :root[data-theme="dark"] .eyebrow { color: #a3d7b6; }
:root[data-theme="dark"] .muted, :root[data-theme="dark"] .storage, :root[data-theme="dark"] .lead { color: #bfcec3; }
:root[data-theme="dark"] .badge, :root[data-theme="dark"] .note-marker { background: #344f40; color: #e1eae4; }
:root[data-theme="dark"] .notice, :root[data-theme="dark"] #note-status[data-state="error"] { color: #ffb89c; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] { color-scheme: dark; color: #e1eae4; background: #18221e; }
  :root[data-theme="system"] .card, :root[data-theme="system"] .problem-card, :root[data-theme="system"] .source-text,
  :root[data-theme="system"] nav, :root[data-theme="system"] button, :root[data-theme="system"] input,
  :root[data-theme="system"] select, :root[data-theme="system"] .reader pre { background: #25342c; color: #e1eae4; }
  :root[data-theme="system"] a, :root[data-theme="system"] .brand, :root[data-theme="system"] .eyebrow { color: #a3d7b6; }
  :root[data-theme="system"] .muted, :root[data-theme="system"] .storage, :root[data-theme="system"] .lead { color: #bfcec3; }
  :root[data-theme="system"] .badge, :root[data-theme="system"] .note-marker { background: #344f40; color: #e1eae4; }
  :root[data-theme="system"] .notice, :root[data-theme="system"] #note-status[data-state="error"] { color: #ffb89c; }
}
