/* 月下世界 demo — 版式与组件。颜色、字体、圆角全部走变量，三套风格见 css/themes/ */
:root {
  /* 颜色（基线；themes/*.css 按 data-look 覆盖） */
  --bg: #f4efe6;
  --paper: #fbf8f2;
  --paper2: #f0e9dc;
  --ink: #2a2620;
  --ink2: #6b6358;
  --ink3: #8f8679;
  --line: #e2dacb;
  --accent: #4f6f52;
  --accent-ink: #ffffff;
  --accent-soft: #e3eadc;
  --warm: #a8553a;
  --warm-soft: #f3e1d6;
  --on-warm: #ffffff;
  --hl1: rgba(226, 186, 86, .28);
  --hl2: rgba(226, 186, 86, .45);
  --hl3: rgba(226, 186, 86, .65);
  --hl-me: #4f6f52;
  --sel-bg: #2a2620;
  --sel-ink: #fbf8f2;
  --av-s: 30%;
  --av-l: 82%;
  --av-d: 28%;
  --ic1: var(--warm); --ic2: var(--accent); --ic3: #4d6f8c; --ic4: #8a6d35;
  --tile-bg: var(--paper);
  --tile-line: var(--line);
  --tile-shadow: var(--shadow);
  --mark-ink: var(--ink); --mark-accent: var(--warm); --mark-on: #fff; --mark-glow: #e8a948;
  --desk-bg: radial-gradient(120% 60% at 50% 0%, var(--paper), transparent 70%);
  --shadow: 0 1px 2px rgba(60, 45, 20, .06), 0 6px 18px rgba(60, 45, 20, .07);
  --shadow-sm: 0 1px 2px rgba(60, 45, 20, .05);
  /* 形状 */
  --r-card: 14px; --r-btn: 10px; --r-tile: 16px; --r-floor: 12px;
  --card-border: 1px solid var(--line);
  /* 字体 */
  --serif: "Noto Serif SC", "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-ui: var(--sans);
  --font-head: var(--serif);
  --font-read: var(--serif);
  --font-en: Georgia, "Times New Roman", serif;
  --head-weight: 600;
  /* 阅读 */
  --read-fs: 18px; --read-lh: 2; --read-gap: 18px;
  /* 安全区 */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --bar-h: 52px;
  color-scheme: light;
}
:root[data-fs="s"] { --read-fs: 16px; --read-lh: 1.9; --read-gap: 14px; }
:root[data-fs="m"] { --read-fs: 18px; --read-lh: 1.95; --read-gap: 16px; }
:root[data-fs="l"] { --read-fs: 21px; --read-lh: 1.9; --read-gap: 20px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 var(--font-ui); overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; background: var(--bg); }
@media (min-width: 520px) { #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* ---------- 通用 ---------- */
.btn {
  border: 0; border-radius: var(--r-btn); min-height: 44px; padding: 10px 18px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; letter-spacing: .02em;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: translateY(1px); filter: brightness(.95); }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 13px; border-radius: calc(var(--r-btn) - 2px); }
.btn.block { display: flex; width: 100%; min-height: 50px; font-size: 16px; }
.btn:disabled { opacity: .45; }
/* 小按钮看着小，点着大：伪元素把可点区撑到 ≥44px */
.link, .rx, .pchip button, .btn.small, .bar .back { position: relative; }
.link::after, .rx::after, .pchip button::after, .btn.small::after, .bar .back::after {
  content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 44px; transform: translateY(-50%);
}
.link { background: none; border: 0; padding: 0; color: var(--accent); font-size: 13px; }
.muted { color: var(--ink3); }
.card { background: var(--paper); border: var(--card-border); border-radius: var(--r-card); box-shadow: var(--shadow); }
.tag { display: inline-block; font-size: 11px; line-height: 1; padding: 4px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; vertical-align: 2px; letter-spacing: .02em; }
.tag.warm { background: var(--warm-soft); color: var(--warm); }
.tag.plain { background: var(--paper2); color: var(--ink2); }
textarea, input[type=text], select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--paper);
  padding: 11px 12px; outline: none; resize: vertical; min-height: 44px;
}
textarea::placeholder, input::placeholder { color: var(--ink3); }
textarea:focus, input[type=text]:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* 头像：色相来自成员数据，饱和度/明度按风格定，深浅色都清楚 */
.av {
  --h: 30; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%; font-size: 14px; font-weight: 600;
  background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) calc(var(--av-s) + 10%) var(--av-d));
  box-shadow: 0 0 0 2px var(--paper);
}
.av.s { width: 26px; height: 26px; font-size: 12px; }
.av.l { width: 40px; height: 40px; font-size: 16px; }

/* ---------- 品牌 ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.brand .mark { width: 30px; height: 30px; flex: none; }
.brand-words { display: flex; flex-direction: column; line-height: 1.1; }
.brand-zh { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 15px; letter-spacing: .28em; margin-right: -.28em; }
.brand-en { font-family: var(--font-en); font-size: 11px; letter-spacing: .14em; color: var(--ink3); margin-top: 2px; }

/* ---------- 应用顶栏 ---------- */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  height: calc(var(--bar-h) + var(--sat)); padding: var(--sat) calc(12px + var(--sar)) 0 calc(12px + var(--sal));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar .back { border: 0; background: none; color: var(--accent); padding: 6px 4px; font-size: 15px; white-space: nowrap; }
.bar h1 { flex: 1; margin: 0; font-family: var(--font-head); font-size: 17px; font-weight: var(--head-weight); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .02em; }
.bar .side { min-width: 72px; display: flex; justify-content: flex-end; gap: 14px; }
.bar .side:first-child { justify-content: flex-start; }
.bar .side .link { font-size: 14px; padding: 6px 0; }
.page { padding: 16px calc(16px + var(--sar)) calc(24px + var(--sab)) calc(16px + var(--sal)); }

/* ---------- 桌面 ---------- */
.desk {
  min-height: 100vh; min-height: 100dvh;
  padding: calc(22px + var(--sat)) calc(20px + var(--sar)) calc(18px + var(--sab)) calc(20px + var(--sal));
  background: var(--desk-bg), var(--bg);
  display: flex; flex-direction: column;
}
.desk-top { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.desk-date { font-family: var(--font-head); font-size: 34px; line-height: 1.15; letter-spacing: 1px; font-weight: var(--head-weight); }
.desk-week { color: var(--ink2); font-size: 14px; margin-top: 6px; }
.desk-name .mark { width: 40px; height: 40px; display: block; }
.wall { padding: 16px; margin-bottom: 14px; }
.wall-head { display: flex; align-items: baseline; justify-content: space-between; }
.wall-num { font-size: 15px; color: var(--ink2); }
.wall-num b { font-family: var(--font-head); font-size: 28px; color: var(--accent); margin: 0 3px 0 2px; font-weight: 700; }
.wall-bar { height: 6px; border-radius: 3px; background: var(--paper2); margin: 12px 0; overflow: hidden; }
.wall-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.wall-avs { display: flex; flex-wrap: wrap; gap: 0; align-items: center; }
.wall-avs .av { margin-right: -5px; }
.wall-avs .more { font-size: 12px; color: var(--ink3); margin-left: 12px; }
.now { display: flex; gap: 14px; align-items: center; padding: 14px 16px; margin-bottom: 26px; text-align: left; width: 100%; color: inherit; }
.now .cover { width: 54px; flex: none; }
.now-t { flex: 1; min-width: 0; }
.now-t .k { font-size: 12px; color: var(--ink3); letter-spacing: .08em; }
.now-t .n { font-family: var(--font-head); font-size: 17px; font-weight: var(--head-weight); margin: 2px 0; }
.now-t .p { font-size: 13px; color: var(--ink2); }
.now .go { color: var(--accent); font-size: 14px; white-space: nowrap; font-weight: 600; }
.icons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 8px; }
.ico { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none; padding: 0; color: var(--ink); font-size: 13px; position: relative; }
.ico .tile {
  width: 62px; height: 62px; border-radius: var(--r-tile); display: flex; align-items: center; justify-content: center;
  background: var(--tile-bg); border: 1px solid var(--tile-line); box-shadow: var(--tile-shadow); color: var(--accent);
  transition: transform .1s ease;
}
.ico:active .tile { transform: scale(.95); }
.ico .tile svg { width: 28px; height: 28px; }
.ico.c1 .tile { color: var(--ic1); } .ico.c2 .tile { color: var(--ic2); } .ico.c3 .tile { color: var(--ic3); } .ico.c4 .tile { color: var(--ic4); }
.badge { position: absolute; top: -5px; right: calc(50% - 38px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--warm); color: var(--on-warm); font-size: 12px; line-height: 20px; font-weight: 700; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.desk-sign { margin-top: auto; padding-top: 40px; display: flex; justify-content: center; opacity: .9; }
.desk-sign .brand { flex-direction: column; gap: 10px; text-align: center; }
.desk-sign .brand .mark { width: 44px; height: 44px; }
.desk-sign .brand-words { align-items: center; }
.desk-foot { padding-top: 22px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink3); }
.desk-foot button { background: none; border: 0; color: var(--ink2); font-size: 13px; padding: 0 2px; min-height: 44px; }
.look-btn { color: var(--accent) !important; font-weight: 600; }

/* ---------- 封面 ---------- */
.cover { aspect-ratio: 3 / 4.2; border-radius: 2px 5px 5px 2px; overflow: hidden; box-shadow: 1px 2px 6px rgba(0,0,0,.18), inset 0 0 0 1px rgba(0,0,0,.04); display: block; }
.cover svg { display: block; width: 100%; height: 100%; }

/* ---------- 打卡 ---------- */
.reading { display: flex; gap: 14px; padding: 14px; align-items: center; }
.reading .cover { width: 60px; flex: none; }
.reading .info { flex: 1; min-width: 0; }
.reading .k { font-size: 12px; color: var(--ink3); }
.reading .t { font-family: var(--font-head); font-size: 18px; font-weight: var(--head-weight); }
.reading .a { font-size: 13px; color: var(--ink2); }
.reading select { margin-top: 8px; padding: 6px 8px; font-size: 13px; }
.status { margin: 14px 2px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warm); }
.status.done .dot { background: var(--accent); }
.step { margin-bottom: 18px; }
.step-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; }
.step-h .n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.step-h .r { margin-left: auto; font-weight: 400; }
.excerpt-in { font-family: var(--font-read); background: var(--paper2); line-height: 1.8; }
.pics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pic { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic .x { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; line-height: 24px; padding: 0; }
.addpic { width: 72px; height: 72px; border-radius: 8px; border: 1px dashed var(--ink3); background: none; color: var(--ink2); font-size: 12px; }
.done-card { padding: 16px; margin: 4px 0 16px; border-color: var(--accent); background: var(--accent-soft); }
.done-card .big { font-size: 16px; font-weight: 600; }
.done-card .row { display: flex; gap: 8px; margin-top: 10px; }
.cal { padding: 14px; margin-top: 22px; }
.cal-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.cal-h b { font-family: var(--font-head); font-size: 17px; font-weight: var(--head-weight); }
.cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 13px; }
.cal-g .w { color: var(--ink3); font-size: 12px; }
.cal-g .d { aspect-ratio: 1; width: 100%; max-width: 36px; margin: 0 auto; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--ink2); }
.cal-g .d.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.cal-g .d.today { box-shadow: inset 0 0 0 2px var(--warm); color: var(--ink); }
.cal-g .d.on.today { color: var(--accent-ink); }
.cal-g .d.fut { color: var(--ink3); opacity: .45; }
.cal-legend { margin-top: 10px; font-size: 12px; color: var(--ink3); }

/* ---------- 书斋 ---------- */
.books { display: flex; flex-direction: column; gap: 10px; }
.bk { display: flex; gap: 12px; padding: 12px; text-align: left; width: 100%; color: inherit; align-items: center; }
.bk .cover { width: 46px; flex: none; }
.bk .m { flex: 1; min-width: 0; }
.bk .t { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 16px; }
.bk .s { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.bk .last { font-size: 13px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.bk.pin { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }
.sec-t { font-size: 12px; color: var(--ink3); margin: 20px 4px 8px; letter-spacing: .14em; }
.sec-t:first-child { margin-top: 2px; }
.bhead { display: flex; gap: 16px; padding: 18px 16px 8px; }
.bhead .cover { width: 92px; flex: none; }
.bhead .t { font-family: var(--font-head); font-size: 22px; font-weight: 700; line-height: 1.3; margin-top: 4px; }
.bhead .a { color: var(--ink2); font-size: 14px; margin-top: 4px; }
.bhead .by { color: var(--ink3); font-size: 12px; margin-top: 8px; }
.intro { padding: 6px 16px 6px; font-size: 14px; line-height: 1.75; color: var(--ink2); white-space: pre-wrap; }
.atts { padding: 6px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.att { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 56px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--paper); text-align: left; color: inherit; width: 100%; }
.att .ext { width: 38px; height: 38px; border-radius: 6px; background: var(--paper2); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--ink2); flex: none; letter-spacing: .04em; }
.att .nm { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .sz { font-size: 12px; color: var(--ink3); }
.att .act { font-size: 13px; color: var(--accent); white-space: nowrap; font-weight: 600; }
.tabs { position: sticky; top: calc(var(--bar-h) + var(--sat)); z-index: 10; display: flex; gap: 6px; padding: 8px 16px; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; min-height: 36px; padding: 5px 14px; font-size: 13px; white-space: nowrap; color: var(--ink2); }
.tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.floors { padding: 12px 12px calc(120px + var(--sab)); display: flex; flex-direction: column; gap: 10px; }
/* 楼层：头（人/类型/楼号）→ 节选（引文块）→ 正文 → 图 → 互动（弱） → 回复（再弱一层） */
.floor { padding: 14px 14px 12px; background: var(--paper); border: var(--card-border); border-radius: var(--r-floor); box-shadow: var(--shadow-sm); position: relative; }
.floor.ck { box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm); }
.floor.flash { animation: flash 1.8s ease; }
@keyframes flash { 0%, 50% { box-shadow: 0 0 0 3px var(--warm); } 100% { box-shadow: none; } }
.fh { display: flex; align-items: center; gap: 10px; }
.fh .who { font-weight: 600; font-size: 14px; }
.fh .when { font-size: 12px; color: var(--ink3); }
.fh .no { margin-left: auto; align-self: flex-start; font-size: 11px; color: var(--ink3); white-space: nowrap; letter-spacing: .04em; padding-top: 2px; }
.fx { margin: 12px 0 8px; padding: 10px 14px 12px; border-radius: 6px; background: var(--paper2); font-family: var(--font-read); font-size: 15px; line-height: 1.8; color: var(--ink); position: relative; }
.fx::before { content: "节选"; display: block; font-family: var(--font-ui); font-size: 11px; color: var(--ink3); margin-bottom: 4px; letter-spacing: .12em; }
.ft { margin: 8px 0 4px; white-space: pre-wrap; word-break: break-word; line-height: 1.75; }
.ft .at, .replies .at, .note .at { color: var(--accent); font-weight: 600; }
.fimgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.fimgs .im { aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 0; padding: 0; background: var(--paper2); }
.fimgs .im img, .fimgs .im svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.rx { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; min-height: 30px; padding: 2px 10px; font-size: 13px; color: var(--ink2); }
.rx.me { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.rx.add { color: var(--ink3); border-style: dashed; }
.facts .reply-btn { margin-left: auto; font-size: 13px; padding: 4px 2px; }
.picker { display: flex; gap: 2px; padding: 4px; border: 1px solid var(--line); background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); margin-top: 6px; width: max-content; max-width: 100%; flex-wrap: wrap; }
.picker button { border: 0; background: none; font-size: 22px; min-width: 44px; min-height: 44px; border-radius: 10px; }
.replies { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.6; }
.replies .r { word-break: break-word; }
.replies .r b { font-weight: 600; }
.replies .r .when { font-size: 11px; color: var(--ink3); margin-left: 6px; }
.rin { display: flex; gap: 6px; margin-top: 8px; }
.rin input { flex: 1; min-width: 0; padding: 8px 10px; }
.composer { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 25; display: flex; gap: 8px; align-items: flex-end; padding: 10px calc(12px + var(--sar)) calc(10px + var(--sab)) calc(12px + var(--sal)); background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 10px 12px; }
.album { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 10px 12px 40px; }
.album button { aspect-ratio: 1; border: 0; padding: 0; overflow: hidden; border-radius: 4px; background: var(--paper2); position: relative; }
.album img, .album svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.album .cap { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.55)); padding: 12px 6px 4px; text-align: left; }
.empty { text-align: center; color: var(--ink3); padding: 40px 20px; font-size: 14px; line-height: 1.9; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 44px; height: 44px; border-radius: 8px; border: 2px solid transparent; padding: 0; }
.swatches button.on { border-color: var(--ink); }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: var(--ink2); margin-bottom: 4px; }

/* ---------- 共读 ---------- */
.reader { padding: 8px calc(24px + var(--sar)) calc(150px + var(--sab)) calc(24px + var(--sal)); font-family: var(--font-read); max-width: 40em; margin: 0 auto; }
.reader .ch-k { font-family: var(--font-ui); font-size: 12px; color: var(--ink3); text-align: center; margin-top: 30px; letter-spacing: .3em; }
.reader h2 { font-family: var(--font-head); text-align: center; font-size: calc(var(--read-fs) + 6px); font-weight: 700; margin: 8px 0 30px; letter-spacing: .12em; }
.reader h2::after { content: ""; display: block; width: 28px; height: 2px; margin: 14px auto 0; background: var(--accent); opacity: .6; border-radius: 1px; }
.para { font-size: var(--read-fs); line-height: var(--read-lh); margin: 0; text-indent: 2em; text-align: justify; letter-spacing: .02em; color: var(--ink); }
.para-wrap { margin-bottom: var(--read-gap); }
.hl { background: var(--hl1); border-radius: 2px; cursor: pointer; box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 1px 0; }
.hl.n2 { background: var(--hl2); } .hl.n3 { background: var(--hl3); }
.hl.me { text-decoration: underline; text-decoration-color: var(--hl-me); text-decoration-thickness: 2px; text-underline-offset: .32em; }
.pchip { display: flex; justify-content: flex-end; }
.pchip button { font-family: var(--font-ui); border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--warm); font-size: 12px; padding: 2px 10px; margin-top: 4px; }
.rnav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px calc(16px + var(--sar)) calc(8px + var(--sab)) calc(16px + var(--sal)); background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); font-size: 13px; color: var(--ink2); }
.rnav button { border: 1px solid var(--line); background: var(--paper); border-radius: var(--r-btn); min-height: 44px; padding: 8px 16px; font-size: 14px; }
.rnav button:disabled { opacity: .35; }
.selbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + var(--sab)); z-index: 30; display: flex; gap: 2px; padding: 4px; border-radius: 14px; background: var(--sel-bg); box-shadow: 0 8px 28px rgba(0,0,0,.28); white-space: nowrap; }
.selbar button { border: 0; background: none; color: var(--sel-ink); min-height: 44px; padding: 8px 16px; font-size: 15px; border-radius: 10px; }
.selbar button:active { background: rgba(255,255,255,.12); }
.selbar button + button { box-shadow: -1px 0 0 rgba(127,127,127,.3); border-radius: 0 10px 10px 0; }
.ann { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ann:last-child { border-bottom: 0; }
.ann .q { font-family: var(--font-read); font-size: 14px; line-height: 1.75; color: var(--ink2); border-left: 3px solid var(--hl3); padding-left: 10px; margin: 8px 0; }
.ann .note { font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.ann .acts { display: flex; gap: 18px; margin-top: 8px; flex-wrap: wrap; }
.ann.focus .q { border-left-color: var(--accent); }
.vis { display: flex; gap: 8px; margin: 10px 0 14px; }
.vis label { flex: 1; border: 1px solid var(--line); border-radius: var(--r-btn); min-height: 44px; padding: 10px; text-align: center; font-size: 14px; cursor: pointer; }
.vis input { position: absolute; opacity: 0; pointer-events: none; }
.vis label.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 14px 4px; min-height: 48px; font-family: var(--font-head); font-size: 16px; }
.toc button.on { color: var(--accent); font-weight: 700; }
.local-wrap { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; }
.local-wrap foliate-view { flex: 1; min-height: 0; display: block; }
.local-msg { padding: 30px 20px; text-align: center; color: var(--ink2); }
/* 字号 */
.fs-pick { display: flex; gap: 8px; margin: 6px 0 14px; }
.fs-pick button { flex: 1; min-height: 64px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--paper); font-family: var(--font-read); color: var(--ink2); }
.fs-pick button[data-fs="s"] { font-size: 16px; } .fs-pick button[data-fs="m"] { font-size: 19px; } .fs-pick button[data-fs="l"] { font-size: 23px; }
.fs-pick button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.fs-pick small { display: block; font-family: var(--font-ui); font-size: 11px; font-weight: 400; color: var(--ink3); }
.fs-demo { font-family: var(--font-read); font-size: var(--read-fs); line-height: var(--read-lh); text-indent: 2em; color: var(--ink); margin: 0 0 6px; padding: 12px 14px; background: var(--bg); border-radius: var(--r-btn); }

/* ---------- 消息 ---------- */
.msgs { display: flex; flex-direction: column; }
.msg { display: flex; gap: 12px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; width: 100%; color: inherit; }
.msg.unread { background: var(--paper); }
.msg .m { flex: 1; min-width: 0; }
.msg .h { font-size: 14px; }
.msg .h b { font-weight: 600; }
.msg .x { font-size: 14px; color: var(--ink2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg .w { font-size: 12px; color: var(--ink3); margin-top: 4px; }
.msg .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warm); margin-top: 6px; flex: none; }

/* ---------- 弹层 / 提示 ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(15, 12, 8, .42); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet { width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto; background: var(--paper); border-radius: calc(var(--r-card) + 6px) calc(var(--r-card) + 6px) 0 0; padding: 8px calc(18px + var(--sar)) calc(20px + var(--sab)) calc(18px + var(--sal)); animation: up .22s ease; }
.sheet .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet h3 { margin: 4px 0 12px; font-size: 17px; font-family: var(--font-head); font-weight: var(--head-weight); }
.sheet .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.viewer { text-align: center; }
.viewer .big { border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.viewer .big img, .viewer .big svg { width: 100%; display: block; max-height: 60vh; object-fit: contain; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + var(--sab)); z-index: 80; max-width: calc(100% - 32px); width: max-content; display: flex; gap: 14px; align-items: center; padding: 11px 16px; border-radius: 12px; background: var(--sel-bg); color: var(--sel-ink); font-size: 14px; box-shadow: var(--shadow); }
.toast button { border: 0; background: none; color: var(--sel-ink); font-weight: 700; text-decoration: underline; padding: 0; min-height: 36px; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* 桌面：最近的划线 */
.quote { display: block; width: 100%; text-align: left; color: inherit; margin-top: 26px; padding: 16px 18px; }
.quote-k { display: block; font-size: 12px; color: var(--ink3); letter-spacing: .08em; }
.quote-t { display: block; font-family: var(--font-read); font-size: 17px; line-height: 1.8; margin: 8px 0 6px; padding-left: 12px; border-left: 3px solid var(--hl3); }
.quote-by { display: block; font-size: 12px; color: var(--ink3); text-align: right; }

/* 选中文字的底色跟主题走 */
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; }
