:root{
  --bg:#F7F4EF;
  --accent:#5B7C99;
  --card:#FFFFFF;
  --text:#2B2B2B;
  --sub:#8A8A8A;
  --line:#EAE5DD;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;}
/* 防横向溢出（右滑返回时 #app 平移不出横向滚动条）。
   原来 html 和 body 都设 overflow-x:hidden：两者都非 visible 时，body 自己变成滚动容器，
   但实际滚动的是窗口，于是 position:sticky 以 body 为参照、永远不会吸住。
   改为：html 保留 hidden（会传给窗口，效果不变），body 用 clip（裁切但不成为滚动容器）。 */
html{overflow-x:hidden;}
body{overflow-x:clip;}
body{
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  font-size:16px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
#app{
  touch-action:pan-y;
  background:inherit;
  max-width:430px;
  margin:0 auto;
  min-height:100vh;
  padding:0 16px calc(96px + env(safe-area-inset-bottom));
  padding-top:env(safe-area-inset-top);
}
a{color:inherit;text-decoration:none;}

/* header */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 2px 10px;
}
.topbar .date{
  font-size:15px;
  font-weight:500;
  letter-spacing:.3px;
  color:#9A958C;
}
.icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:38px;height:38px;
  border-radius:50%;
  background:transparent;
  border:none;
  color:var(--accent);
  cursor:pointer;
}
.icon-btn:active{background:rgba(91,124,153,.1);}
.icon-btn svg{width:22px;height:22px;display:block;}

/* section */
.section{margin-top:22px;}
.section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
}
.section-title{
  display:flex;
  align-items:center;
  font-size:16px;
  font-weight:700;
  letter-spacing:.5px;
}
.section-title::before{
  content:"";
  display:inline-block;
  width:4px;
  height:16px;
  border-radius:2px;
  background:var(--accent);
  margin-right:9px;
}
.more-link{
  font-size:13px;
  color:var(--accent);
  font-weight:500;
}

/* card */
.card{
  display:block;
  background:var(--card);
  border-radius:16px;
  padding:14px 16px;
  margin-bottom:12px;
  box-shadow:0 1px 2px rgba(0,0,0,.03);
  transition:transform .12s ease;
}
.card:active{transform:scale(.99);}
.card-top{
  display:flex;
  align-items:flex-start;
  gap:8px;
}
.unread-dot{
  flex:0 0 auto;
  width:8px;height:8px;
  border-radius:50%;
  background:var(--accent);
  margin-top:8px;
}
.unread-dot.hidden{visibility:hidden;}
.card-title{
  font-size:16px;
  font-weight:700;
  line-height:1.45;
  color:var(--text);
}
.card-summary{
  margin-top:6px;
  font-size:13.5px;
  color:var(--sub);
  line-height:1.5;
  display:-webkit-box;
  -webkit-line-clamp:1;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.card-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-top:12px;
  font-size:12px;
  color:var(--sub);
}
.card-tag{color:#B0AAA0;}

/* page header (more / detail) */
.page-head{
  display:flex;
  align-items:center;
  padding:16px 0 8px;
  min-height:44px;
}
.back-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:36px;height:36px;
  margin-left:-8px;
  color:var(--accent);
  background:none;border:none;cursor:pointer;
}
.back-btn svg{width:22px;height:22px;}
.page-head .center-title{
  flex:1;
  text-align:center;
  font-size:16px;
  font-weight:700;
  margin-right:28px;
}

/* detail */
.detail-title{
  font-size:23px;
  font-weight:800;
  line-height:1.4;
  margin:14px 0 10px;
}
.detail-meta{
  font-size:13px;
  color:var(--sub);
  margin-bottom:20px;
}
.detail-body p{
  font-size:var(--fs,16px);
  line-height:1.85;
  margin:0 0 18px;
  color:#333;
  white-space:pre-line;
  overflow-wrap:anywhere;
}
.detail-body a{color:#5B7C99;text-decoration:none;}

/* fixed copy button */
.btn-copy{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom:calc(16px + env(safe-area-inset-bottom));
  width:calc(100% - 32px);
  max-width:398px;
  background:var(--accent);
  color:#fff;
  border:none;
  border-radius:14px;
  padding:15px;
  font-size:16px;
  font-weight:600;
  letter-spacing:1px;
  cursor:pointer;
  box-shadow:0 6px 18px rgba(91,124,153,.3);
}
.btn-copy:active{opacity:.9;}

/* toast */
.toast{
  position:fixed;
  left:50%;
  bottom:calc(90px + env(safe-area-inset-bottom));
  transform:translateX(-50%) translateY(8px);
  background:rgba(43,43,43,.9);
  color:#fff;
  font-size:13px;
  padding:8px 18px;
  border-radius:20px;
  opacity:0;
  pointer-events:none;
  transition:opacity .2s, transform .2s;
  z-index:50;
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0);}

/* calendar */
.cal-list{margin-top:8px;}
.cal-day{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:var(--card);
  border-radius:14px;
  padding:16px;
  margin-bottom:10px;
  cursor:pointer;
}
.cal-day:active{transform:scale(.99);}
.cal-day .d-main{font-size:15px;font-weight:600;}
.cal-day .d-sub{font-size:12px;color:var(--sub);margin-top:2px;}
.cal-day .d-count{
  font-size:12px;
  color:var(--accent);
  font-weight:600;
}
.cal-day .chev{color:#C9C3B8;}

/* day view group */
.day-group{margin-top:18px;}
.day-group-title{
  font-size:14px;
  font-weight:700;
  color:var(--accent);
  margin-bottom:10px;
  display:flex;align-items:center;
}
.day-group-title::before{
  content:"";width:3px;height:13px;border-radius:2px;
  background:var(--accent);margin-right:8px;
}
.empty{
  text-align:center;
  color:var(--sub);
  font-size:14px;
  padding:60px 0;
}

/* page without bottom copy btn */
#app.no-pad-bottom{padding-bottom:calc(24px + env(safe-area-inset-bottom));}
.detail-page{padding-bottom:8px;}
.card-body-wrap{flex:1;min-width:0;}
.card-top .card-title{flex:1;}

.page-head.with-line{
  border-bottom:1px solid var(--line);
  margin-bottom:14px;
  padding-bottom:12px;
}
.card-summary{margin-left:16px;} /* align under title after unread dot */
.card-foot{margin-left:16px;}

/* 配图 */
.pics { margin: 18px 0 22px; }
.pics-label { font-size: 13px; color: #5B7C99; font-weight: 600; margin-bottom: 8px; }
.pic { margin: 0 0 16px; }
.pic img { display: block; width: 100%; height: auto; border-radius: 10px; background: #eef1f4; cursor: zoom-in; }
.pic figcaption { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: #8a8f96; }
.viewer { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; cursor: zoom-out; overflow:hidden; touch-action: none; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }

.fs-ctl{margin-left:auto;display:flex;gap:8px;}
.fs-ctl button{min-width:40px;height:32px;border-radius:16px;border:1px solid #d5dde5;background:#fff;color:#5B7C99;font-size:14px;font-weight:700;}
.viewer img{transition:transform .08s linear;will-change:transform;}
.viewer-x{position:absolute;top:calc(env(safe-area-inset-top,0px) + 14px);right:16px;width:40px;height:40px;border-radius:20px;border:none;background:rgba(255,255,255,.2);color:#fff;font-size:26px;line-height:40px;padding:0;}
.viewer-tip{position:absolute;bottom:calc(env(safe-area-inset-bottom,0px) + 18px);left:0;right:0;text-align:center;color:rgba(255,255,255,.55);font-size:12px;pointer-events:none;}

/* 复制提问：右下角小悬浮按钮 */
.btn-copy{
  left:auto;right:14px;transform:none;
  width:auto;max-width:none;
  bottom:calc(18px + env(safe-area-inset-bottom));
  padding:9px 15px;border-radius:999px;
  font-size:13px;font-weight:600;letter-spacing:.5px;
  background:rgba(91,124,153,.88);
  -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  box-shadow:0 3px 10px rgba(91,124,153,.28);
}
.toast{left:auto;right:14px;transform:translateY(8px);bottom:calc(66px + env(safe-area-inset-bottom));}
.toast.show{transform:translateY(0);}
#app.no-pad-bottom, #app{padding-bottom:calc(24px + env(safe-area-inset-bottom));}

/* 再淡一档 */
.btn-copy{
  background:rgba(91,124,153,.16);
  color:#5B7C99;
  border:1px solid rgba(91,124,153,.28);
  font-weight:500;
  padding:7px 13px;
  box-shadow:none;
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);
}
.btn-copy:active{background:rgba(91,124,153,.28);}

/* 下一篇卡片 */
.next-card{display:block;margin:28px 0 36px;padding:14px 16px;border-radius:12px;background:rgba(91,124,153,.08);border:1px solid rgba(91,124,153,.22);text-decoration:none;color:inherit;-webkit-tap-highlight-color:transparent;}
.next-card:active{background:rgba(91,124,153,.16);}
.next-lab{font-size:12px;color:#5B7C99;margin-bottom:6px;letter-spacing:.5px;}
.next-title{font-size:16px;font-weight:600;line-height:1.45;color:#222;}
.next-end .next-title{font-size:15px;font-weight:500;}

/* ===== 2026-10-30 手机复查优化（测试版） ===== */
/* 点按区域至少 44px（外观不变，只放大可点范围） */
.icon-btn{width:44px;height:44px;margin-right:-6px;}
.back-btn{width:44px;height:44px;margin-left:-12px;}
.more-link{display:inline-flex;align-items:center;min-height:44px;padding:0 4px 0 14px;margin:-12px -4px -12px 0;}
.fs-ctl button{min-width:44px;height:36px;border-radius:18px;position:relative;}
.fs-ctl button::after{content:"";position:absolute;inset:-4px -2px;}
.btn-copy{min-height:44px;padding:0 16px;}
/* 竖长截图不超过一屏，整张可点开看大图 */
.pic img{max-height:70vh;width:auto;max-width:100%;margin:0 auto;object-fit:contain;}
/* 深色模式：跟随手机设置 */
@media (prefers-color-scheme: dark){
  :root{--bg:#161616;--card:#232323;--text:#E6E3DE;--sub:#9A968F;--line:#2E2E2E;--accent:#8FB0CC;}
  body{color:var(--text);}
  .topbar .date{color:#9A968F;}
  .detail-body p{color:#D6D3CE;}
  .detail-body a,.next-lab{color:#8FB0CC;}
  .card{box-shadow:none;}
  .card-tag{color:#7D7A74;}
  .cal-day .chev{color:#5A5753;}
  .fs-ctl button{background:#232323;border-color:#3A3A3A;color:#8FB0CC;}
  .btn-copy{background:rgba(143,176,204,.18);color:#BFD3E4;border-color:rgba(143,176,204,.35);}
  .next-card{background:rgba(143,176,204,.08);border-color:rgba(143,176,204,.22);}
  .next-title{color:#E6E3DE;}
  .pic img{background:#2A2A2A;}
  .pic figcaption{color:#8E8A84;}
  .toast{background:rgba(230,227,222,.92);color:#1a1a1a;}
}

/* 顶部标签栏（2026-10-31 测试） */
.tabs{
  display:flex;gap:22px;overflow-x:auto;white-space:nowrap;
  margin:0 -16px;padding:6px 18px 0;
  background:var(--bg);border-bottom:1px solid var(--line);
  scrollbar-width:none;-webkit-overflow-scrolling:touch;
  /* 只许横向滚：纵向锁死（原先内容比容器高 1px，可上下微动）；滚到头不回弹带动页面 */
  overflow-y:hidden;overscroll-behavior:contain;touch-action:pan-x;
}
.tabs::-webkit-scrollbar{display:none;}
.tab{flex:none;padding:8px 0 10px;font-size:15px;color:var(--sub);border-bottom:2px solid transparent;}
.tab.on{color:var(--text);font-weight:700;border-bottom-color:var(--accent);}
.tab-list{padding-top:14px;}
@media (prefers-color-scheme: dark){
  .tabs{background:#161616;border-bottom-color:#2A2A2A;}
  .tab{color:#7D7A74;} .tab.on{color:#E8E6E3;border-bottom-color:#8FB0CC;}
}

/* 列表卡片只留标题 + 时间/标签（去掉摘要后收紧间距） */
.card{padding:14px 16px 12px;}
.card-foot{margin-top:8px;}

/* 头部（日期行+日历图标）+ 标签栏 整体吸顶；不透明背景；刘海/状态栏安全区并入头部内边距 */
.sticky-head{
  position:-webkit-sticky;position:sticky;top:0;z-index:5;
  margin:calc(-1 * env(safe-area-inset-top)) -16px 0;
  padding:env(safe-area-inset-top) 16px 0;
  background:var(--bg);
}
.sticky-head .tabs{background:transparent;}
@media (prefers-color-scheme: dark){ .sticky-head{background:#161616;} }

/* 紧凑头部（仅吸顶头部内；日历/详情页不受影响） */
.sticky-head .topbar{padding:8px 2px 0;}
.sticky-head .topbar .date{line-height:1.3;}
.sticky-head .icon-btn{width:40px;height:40px;margin-right:-6px;}
.sticky-head .tabs{padding-top:0;}
.sticky-head .tab{padding:6px 0 9px;line-height:1.4;}

/* 趋势周刊徽章（2026-11-01） */
.badge-weekly{display:inline-block;vertical-align:2px;margin-right:6px;padding:1px 6px;border-radius:4px;font-size:11px;font-weight:600;line-height:1.5;letter-spacing:.5px;color:#fff;background:var(--accent);}
.detail-title .badge-weekly{vertical-align:4px;font-size:12px;}
@media (prefers-color-scheme: dark){ .badge-weekly{color:#161616;background:#8FB0CC;} }


/* Book reading only: preserve all other columns' typography and navigation. */
.book-page .detail-title{font-size:29px;line-height:1.45;letter-spacing:-.035em;font-weight:700;margin-bottom:17px;}
.book-page .detail-meta{font-size:12px;margin-bottom:28px;}
.book-page .detail-body{font-size:var(--fs,18px);line-height:1.9;overflow-wrap:anywhere;}
.book-page .detail-body p{font-size:inherit;line-height:1.9;margin-bottom:20px;}
.book-page .detail-body h2{font-size:1.12em;line-height:1.55;font-weight:700;margin:35px 0 17px;}
.book-abstract{border-top:1px solid #c8d2da;border-bottom:1px solid #c8d2da;padding:17px 0 18px;margin-bottom:33px;}
.book-label{font-size:12px;letter-spacing:.16em;color:#526d83;font-weight:600;margin-bottom:9px;}
.book-page .book-abstract p{margin:0;color:#505b63;line-height:1.85;}
.book-page .detail-body a.book-inline-link{color:var(--accent);text-decoration:underline;text-decoration-color:rgba(91,124,153,.42);text-underline-offset:3px;text-decoration-thickness:1px;overflow-wrap:anywhere;transition:opacity .15s;}
.book-page .detail-body a.book-inline-link:active{opacity:.65;}
.book-page .detail-body a.book-inline-link:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:3px;}
.book-sources{margin-top:36px;padding-top:22px;border-top:1px solid var(--line);}
.book-sources .book-label{margin-bottom:12px;}
.book-links{display:flex;flex-direction:column;background:var(--card);border:1px solid var(--line);border-radius:14px;overflow:hidden;}
.book-page .book-links a.book-link-row{display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:50px;padding:12px 16px;border-top:1px solid var(--line);color:var(--text);text-decoration:none;-webkit-tap-highlight-color:transparent;transition:background .15s;}
.book-page .book-links a.book-link-row:first-child{border-top:0;}
.book-page .book-links a.book-link-row:active{background:rgba(91,124,153,.09);}
.book-page .book-links a.book-link-row:focus-visible{outline:2px solid var(--accent);outline-offset:-2px;}
.book-link-main{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1;}
.book-link-title{font-size:15px;line-height:1.45;font-weight:500;color:var(--text);overflow-wrap:anywhere;}
.book-link-host{font-size:12px;line-height:1.35;color:var(--sub);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.book-link-arrow{flex:none;font-size:15px;line-height:1;color:var(--accent);opacity:.78;}
@media(min-width:760px){.book-page .detail-title{font-size:36px;}}
@media(prefers-color-scheme:dark){
  .book-page .book-abstract{border-color:#4a535b;}
  .book-page .book-abstract p{color:#c3cdd3;}
  .book-page .book-label{color:#9bb9cf;}
  .book-page .detail-body a.book-inline-link{text-decoration-color:rgba(143,176,204,.46);}
  .book-page .book-links a.book-link-row:active{background:rgba(143,176,204,.12);}
}

/* ===== 2026-11-21 设置页 ===== */
.top-icons{display:inline-flex;align-items:center;gap:2px;}
.set-list{padding:12px 0 40px;}
.set-card{background:var(--card);border-radius:14px;padding:2px 16px;margin:0 0 12px;}
.set-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px;padding:6px 0;border-top:1px solid var(--line);font-size:15px;color:var(--text);}
.set-card > .set-row:first-child,.set-cap + .set-row{border-top:0;}
.set-row.col{flex-direction:column;align-items:stretch;gap:8px;padding:12px 0;}
.set-label{font-size:15px;}
.set-cap{font-size:12px;color:var(--sub);padding:12px 0 2px;}
.set-val{font-size:14px;color:var(--sub);}
.set-btn{width:100%;background:none;border:0;border-top:0;font:inherit;text-align:left;cursor:pointer;-webkit-tap-highlight-color:transparent;}
.set-seg{display:flex;gap:6px;}
.set-seg button{flex:1;min-height:38px;padding:0 4px;white-space:nowrap;border:0;border-radius:10px;background:var(--bg);color:var(--text);font:inherit;font-size:14px;cursor:pointer;-webkit-tap-highlight-color:transparent;}
.set-seg button.on{background:var(--accent);color:#fff;font-weight:600;}
.set-switch{-webkit-appearance:none;appearance:none;position:relative;flex:none;width:44px;height:26px;border-radius:13px;background:#D3D1C7;cursor:pointer;transition:background .15s;margin:0;}
.set-switch::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.2);transition:transform .15s;}
.set-switch:checked{background:var(--accent);}
.set-switch:checked::after{transform:translateX(18px);}
label.set-row{cursor:pointer;}
@media (prefers-color-scheme: dark){
  .set-seg button.on{color:#161616;}
  .set-switch{background:#4a4945;}
}

/* ===== 护眼模式（暖纸黄，柔和低蓝光） ===== */
:root[data-theme="eye"]{
  --bg:#EFE7D4;
  --card:#F6F0E2;
  --text:#3A3126;
  --sub:#7D7160;
  --line:#DFD5C0;
  --accent:#7A5E42;
}
:root[data-theme="eye"] body{background:var(--bg);color:var(--text);}
:root[data-theme="eye"] .sticky-head{background:var(--bg);}
:root[data-theme="eye"] .topbar .date{color:#867967;}
:root[data-theme="eye"] .icon-btn:active{background:rgba(122,94,66,.12);}
:root[data-theme="eye"] .card{box-shadow:0 1px 2px rgba(58,49,38,.04);}
:root[data-theme="eye"] .card-tag{color:#948774;}
:root[data-theme="eye"] .cal-day .chev{color:#B8AA95;}
:root[data-theme="eye"] .detail-body p{color:#43392D;}
:root[data-theme="eye"] .detail-body a,
:root[data-theme="eye"] .pics-label,
:root[data-theme="eye"] .next-lab{color:var(--accent);}
:root[data-theme="eye"] .pic img{background:#E5DBC6;filter:brightness(.95) sepia(.06);}
:root[data-theme="eye"] .viewer img{filter:none;}
:root[data-theme="eye"] .pic figcaption{color:#847867;}
:root[data-theme="eye"] .fs-ctl button{background:#F6F0E2;border-color:#D8CCB5;color:var(--accent);}
:root[data-theme="eye"] .btn-copy{background:rgba(122,94,66,.14);color:#6B5138;border-color:rgba(122,94,66,.3);}
:root[data-theme="eye"] .btn-copy:active{background:rgba(122,94,66,.24);}
:root[data-theme="eye"] .next-card{background:rgba(122,94,66,.07);border-color:rgba(122,94,66,.22);}
:root[data-theme="eye"] .next-card:active{background:rgba(122,94,66,.14);}
:root[data-theme="eye"] .next-title{color:#3A3126;}
:root[data-theme="eye"] .toast{background:rgba(58,49,38,.92);color:#F6F0E2;}
:root[data-theme="eye"] .badge-weekly{color:#FBF7EE;background:var(--accent);}
:root[data-theme="eye"] .book-abstract{border-color:#D6C9B0;}
:root[data-theme="eye"] .book-label{color:var(--accent);}
:root[data-theme="eye"] .book-page .book-abstract p{color:#594D3E;}
:root[data-theme="eye"] .book-page .detail-body a.book-inline-link{text-decoration-color:rgba(122,94,66,.42);}
:root[data-theme="eye"] .book-page .book-links a.book-link-row:active{background:rgba(122,94,66,.09);}
:root[data-theme="eye"] .set-seg button.on{color:#FBF7EE;}
:root[data-theme="eye"] .set-switch{background:#CFC4AE;}
:root[data-theme="eye"] .set-switch::after{background:#FBF7EE;}
:root[data-theme="eye"] .feedback-dialog textarea{border-color:rgba(122,94,66,.3);}
:root[data-theme="eye"] .feedback-dialog textarea::placeholder{color:#9C8F7C;}
:root[data-theme="eye"] .feedback-submit{color:#FBF7EE;}
