/* =============================================================
   reader.css — 「卡片阅读」独立页样式（完全独立功能）

   设计原则：
   - 不依赖主站 style.css，不复用其类名（一律 rc- / reader- 前缀），
     改主站样式不会波及本页，本页上线也不影响其它页面。
   - 只借鉴站点的「浅色纸面 + 深色外框」观感；卡面背景由 reader.js 生成
     随机淡彩色（复刻 slide.guanjihuan.com 的阅读节奏）。
   - 一屏一篇：#reader-track 纵向平移，每篇占满一屏。
   - 外框深浅随站点主题二值切换（仅影响外框，卡面始终是浅底深字，
     保证任意主题下正文可读）。2026-10-26 起未存过主题时按站点默认主题
     「期刊白」画浅色外框，不再跟系统 prefers-color-scheme。
   ============================================================= */

:root {
  --rc-bg: #e9eaee;
  --rc-fg: #17181c;
  --rc-muted: #565b66;
  --rc-panel: #ffffff;
  --rc-border: #c9ccd4;
  --rc-accent: #004e4e;
  --rc-accent-fg: #ffffff;
  --rc-shadow: 0 10px 34px rgba(0, 0, 0, 0.16);
}

html[data-reader="dark"] {
  /* 组127（全面审查 L21）：外框切深色却不声明 color-scheme，UA 控件按 light
     画——深色起始面板里的原生 <select>/复选框弹白下拉、滚动条亮轨，与深底
     撕裂；主站 4 枚深色主题均带 color-scheme:dark，本页此前是漏网。 */
  color-scheme: dark;
  --rc-bg: #0e1015;
  --rc-fg: #0e1015;         /* 卡面文字色与浅底配（卡面非外框色） */
  --rc-muted: #565b66;
  --rc-panel: #171a21;       /* 起始面板：深色 */
  --rc-border: #2b303b;
  --rc-accent: #2aa198;
  --rc-accent-fg: #04120f;
  --rc-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--rc-bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { color: var(--rc-fg); }

/* 触屏点按不留灰块（组95 窄屏打磨；对鼠标无感） */
a, button { -webkit-tap-highlight-color: transparent; }

/* ---------- 起始设置面板 ---------- */
.reader-setup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: var(--rc-bg);
  z-index: 20;
}
.reader-setup[hidden] { display: none; }

.rs-card {
  width: 100%;
  max-width: 560px;
  background: var(--rc-panel);
  border: 1px solid var(--rc-border);
  border-radius: 18px;
  box-shadow: var(--rc-shadow);
  padding: 28px 30px 26px;
  color: var(--rc-fg);
}
html[data-reader="dark"] .rs-card { color: #e7e9ef; }

.rs-title {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-wrap: balance;
}
.rs-sub {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--rc-muted);
}
html[data-reader="dark"] .rs-sub { color: #9aa1b0; }

.rs-field { margin-bottom: 20px; }
.rs-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--rc-muted);
  margin-bottom: 9px;
}
html[data-reader="dark"] .rs-label { color: #9aa1b0; }

/* 分段选择按钮 */
.rs-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rs-seg > label { cursor: pointer; }
.rs-seg input { position: absolute; opacity: 0; pointer-events: none; }
.rs-seg span {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--rc-border);
  border-radius: 999px;
  font-size: 14px;
  color: var(--rc-muted);
  background: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}
html[data-reader="dark"] .rs-seg span { color: #b9bfcb; }
.rs-seg input:checked + span {
  background: var(--rc-accent);
  border-color: var(--rc-accent);
  color: var(--rc-accent-fg);
  font-weight: 600;
}
.rs-seg input:focus-visible + span {
  outline: 2px solid var(--rc-accent);
  outline-offset: 2px;
}

/* 组122：arXiv 分类下拉（字段显隐由 reader.js 切 hidden 属性，此处只管控件本体）。
   font-size 16px：iOS 对 <16px 的表单控件聚焦即整页缩放（主站组111 同口径） */
.rs-cat {
  width: 100%;
  padding: 9px 12px;
  font-size: 16px;
  color: var(--rc-fg);
  background: var(--rc-panel);
  border: 1px solid var(--rc-border);
  border-radius: 10px;
}
html[data-reader="dark"] .rs-cat { color: #e7e9ef; }
.rs-cat:focus-visible {
  outline: 2px solid var(--rc-accent);
  outline-offset: 2px;
}

/* 篇数滑块 */
.rs-count-row { display: flex; align-items: center; gap: 14px; }
.rs-count-row input[type="range"] { flex: 1; accent-color: var(--rc-accent); }
.rs-count-val {
  min-width: 2.4em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 700;
}
.rs-quick { display: flex; gap: 6px; margin-top: 8px; }
.rs-quick button {
  padding: 4px 12px;
  font-size: 13px;
  border: 1px solid var(--rc-border);
  border-radius: 8px;
  background: transparent;
  color: var(--rc-muted);
  cursor: pointer;
}
html[data-reader="dark"] .rs-quick button { color: #b9bfcb; }
.rs-quick button:hover { border-color: var(--rc-accent); color: var(--rc-accent); }

.rs-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.rs-start {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 13px 30px;
  font-size: 16px;
  font-weight: 700;
  background: var(--rc-accent);
  color: var(--rc-accent-fg);
  cursor: pointer;
}
.rs-start:disabled { opacity: 0.55; cursor: progress; }
.rs-start:not(:disabled):hover { filter: brightness(1.08); }

.rs-hint {
  flex: 1;
  font-size: 13px;
  color: var(--rc-muted);
  min-height: 1.2em;
}
html[data-reader="dark"] .rs-hint { color: #9aa1b0; }
.rs-hint.is-error { color: #b3261e; }
html[data-reader="dark"] .rs-hint.is-error { color: #ff8a80; }

.rs-foot { margin-top: 18px; font-size: 13px; }
.rs-foot a { color: var(--rc-accent); text-decoration: none; }
.rs-foot a:hover { text-decoration: underline; }

/* ---------- 阅读舞台 ---------- */
.reader-stage { position: fixed; inset: 0; overflow: hidden; }
.reader-stage[hidden] { display: none; }
/* 组127（全面审查 M1）：reader.js 开始/回舞台时 stage.focus() 送键盘焦点——
   tabindex=-1 元素被程序化聚焦时，若焦点前最后一次交互是键盘（点「开始阅读」
   用的 Enter），部分浏览器判 :focus-visible，整屏焦点框糊在卡片上。舞台不是
   可操作控件，无需可见环。 */
.reader-stage:focus { outline: none; }

#reader-track {
  position: absolute;
  top: 0; left: 0; right: 0;
  transition: transform 0.42s cubic-bezier(0.33, 0.9, 0.35, 1);
  will-change: transform;
}

.rcard {
  position: relative;
  height: 100vh;
  /* 100dvh=可见视口（手机地址栏收放不躲开正文/按钮）；旧浏览器停在上行 100vh。
     步长与位移由 reader.js 实测卡高（cardStep）驱动，单位换轨不脱节 */
  height: 100dvh;
  width: 100%;
  display: flex;
  /* 展开长摘要时整卡可滚；居中用 body 的 margin:auto——flex 居中 +
     overflow 是经典「顶部被裁且滚不回去」组合，margin:auto 可两头滚到 */
  overflow-y: auto;
  overscroll-behavior: contain;
  /* safe-area：桌面/无刘海 env()=0 原样；刘海屏避开状态栏与 home 条 */
  padding:
    calc(56px + env(safe-area-inset-top))
    calc(20px + env(safe-area-inset-right))
    calc(84px + env(safe-area-inset-bottom))
    calc(20px + env(safe-area-inset-left));
}

.rcard-body {
  width: 100%;
  max-width: 760px;
  margin: auto;
  color: #191a1e;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 100%;
}
/* 组114：展开态必须真正放开——base 的 max-height:100% 把 body 钉在卡高内，
   矮屏（横屏手机/小窗）flex 压缩把摘要盒压回 2 行托底，「展开全文」点了
   毫无效果，长文卡在矮屏上永远读不全（667×375 实测展开前后逐像素相同）。
   撤掉钉高后 body 撑开 → .rcard 的 overflow-y:auto 接管整卡滚动
   （margin:auto 居中两头都滚得到）；navEnabled 展开期屏蔽翻页手势已给
   原生滚动让位（组98 先例），整卡滚不破坏翻页坐标系——步长仍取卡高
   offsetHeight，卡自身高度不含滚动内容（100dvh 定高）不变。 */
.rcard.is-expanded .rcard-body { max-height: none; }

.rc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: rgba(0, 0, 0, 0.06);
  color: #33363d;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.rc-badge .rc-dot { width: 9px; height: 9px; border-radius: 50%; }
.rc-date {
  font-size: 12.5px;
  color: #565b66;
  font-variant-numeric: tabular-nums;
}

.rc-title {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 34px);
  line-height: 1.24;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-wrap: pretty;
}

.rc-authors {
  margin: 0;
  font-size: 14.5px;
  color: #454a55;
  line-height: 1.5;
}

.rc-abstract {
  margin: 2px 0 0;
  font-size: 17px; /* 组98：16→17，卡片阅读主体文字提一档看清 */
  line-height: 1.72;
  color: #23252b;
  overflow-wrap: break-word;
  /* 折叠态：限高并渐隐；展开态：整卡可滚动。
     --rc-clip 由 reader.js detectClips 按行高取整后写入（组98 不切半行），
     未测出前走初值 --rc-clip-init（组114：变量化，矮竖屏/小窗档覆写 38vh） */
  max-height: var(--rc-clip, var(--rc-clip-init, 46vh));
  overflow: hidden;
  position: relative;
  /* 组98：窄矮屏里正文+标题把 body 撑满 100% 时，flex 可伸缩项（overflow
     hidden → min-content=0）会把摘要压到 1 行甚至 0 行。托底 2 行，保证
     「至少能看到正文」；真托不住时整卡可滚（.rcard overflow-y:auto） */
  min-height: calc(1.72em * 2);
}
.rcard.is-expanded .rc-abstract {
  max-height: none;
  overflow: visible;
}
/* 组98：展开态撤渐隐罩——旧版末行永远罩着 40px 渐变，展开读到底反而糊 */
.rcard.is-expanded .rc-abstract.is-clipped::after { display: none; }
.rc-abstract.is-clipped::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 28px; /* 组98：40→28 ≈ 一行高，只溶尾行不糊上一行 */
  /* 组98：旧版 currentColor（深灰）半透明带把末行字压成灰块，「文字不清楚」
     主因。改为向卡面底色渐隐——--rc-fade 与卡底同色单源（reader.js 写入），
     文字保持清晰直到自然溶入纸面 */
  background: linear-gradient(transparent, var(--rc-fade, #eef0f3));
  pointer-events: none;
}
.rc-more {
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 12px;
  font-size: 13px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  color: #33363d;
  cursor: pointer;
}
.rc-more:hover { border-color: #004e4e; color: #004e4e; }
.rc-more[hidden] { display: none; }

.rc-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.rc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  background: #004e4e;
  color: #fff;
}
.rc-link:hover { filter: brightness(1.1); }
.rc-link--ghost {
  background: rgba(0, 0, 0, 0.05);
  color: #33363d;
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.rc-link--ghost:hover { background: rgba(0, 0, 0, 0.09); }

/* ---------- 收藏 / 已读 标记钮（组99） ---------- */
.rc-mark {
  /* 两态钉宽（主站组78 同思路）：文案在「☆ 收藏/★ 已收藏」「○ 标记已读/✓ 已读」
     间切换不推挤相邻钮；按长态字数钉（含 6px 图标间隙与 18px 左右 padding） */
  justify-content: center;
  min-width: 100px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.rc-mark--read { min-width: 116px; }
.rc-mark.is-on {
  background: rgba(0, 78, 78, 0.12);
  border-color: rgba(0, 78, 78, 0.45);
  color: #003636;
  font-weight: 700;
}
.rc-mark.is-on:hover { background: rgba(0, 78, 78, 0.18); }

/* ---------- 结束卡 ---------- */
.rcard.rcard-end { text-align: center; }
.rcard-end .rc-title { font-size: clamp(24px, 4vw, 40px); }
.rc-end-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 12px; }

/* ---------- HUD：顶部进度 ---------- */
.reader-hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding:
    calc(14px + env(safe-area-inset-top))
    calc(18px + env(safe-area-inset-right))
    14px
    calc(18px + env(safe-area-inset-left));
  font-size: 14px;
  z-index: 15;
  pointer-events: none;
}
.reader-hud > * { pointer-events: auto; }
.rc-counter {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  backdrop-filter: blur(2px);
}
.rc-journal-tag {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.30);
  color: #fff;
}
/* 组103：设置入口（触屏无 Esc 的可见替代；组115 起钮文案「修改设置」）；右侧成对时 margin-left:auto
   只留给最左者，两个都带会均分空隙把钮甩到中间 */
.rc-setup {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-family: inherit; /* 按钮不继承 body 字体，与旁边的 <a> 胶囊配对须钉同源 */
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.28);
  cursor: pointer;
}
.rc-setup:hover { background: rgba(0, 0, 0, 0.6); }
.rc-exit {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.rc-exit:hover { background: rgba(0, 0, 0, 0.6); }

/* 顶部进度条 */
.rc-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: var(--rc-accent);
  z-index: 16;
  transition: width 0.3s ease;
}

/* ---------- 右侧圆点导航 ---------- */
.rc-dots {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 15;
  /* 篇数拉满 30 且矮屏时点列自身可滚（滚动条藏形，视觉仍是裸点列）；
     高度口径与卡高一致（dvh，回退 vh），上下各留 HUD/翻页钮的空间 */
  max-height: calc(100vh - 128px);
  max-height: calc(100dvh - 128px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.rc-dots::-webkit-scrollbar { display: none; }
.rc-dots button {
  position: relative;
  flex: none; /* 点列 overflow 滚动后若被 flex 压扁，圆会瘦成椭圆 */
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
html[data-reader="dark"] .rc-dots button {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.28);
}
.rc-dots button:hover { transform: scale(1.35); }
/* 透明扩大命中区：视觉点径不变（8–10px），四周补 ~9px 可点范围（组95 触屏） */
.rc-dots button::after {
  content: "";
  position: absolute;
  inset: -9px;
}
.rc-dots button[aria-current="true"] {
  background: var(--rc-accent);
  border-color: var(--rc-accent);
  transform: scale(1.4);
}

/* ---------- 底部翻页按钮 ---------- */
.rc-nav {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 15;
}
.rc-nav button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.15s;
  backdrop-filter: blur(2px);
}
.rc-nav button:hover:not(:disabled) { background: rgba(0, 0, 0, 0.6); }
.rc-nav button:disabled { opacity: 0.32; cursor: default; }
.rc-nav .rc-nav-hint {
  font-size: 12.5px;
  color: #fff;
  background: rgba(0, 0, 0, 0.34);
  padding: 4px 12px;
  border-radius: 999px;
}

/* ---------- 窄屏（组95 收口：留道、命中区、触屏去键盘提示） ---------- */
@media (max-width: 640px) {
  /* 组98：让位给正文——间距收 2px、超长作者名单限 2 行
     （完整名单在「读原文」，卡面首要信息是摘要） */
  .rcard-body { gap: 12px; }
  .rc-authors {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0; /* 防挤压：overflow:hidden 的 flex 项 min-content=0，不加会被 body 压扁切半行 */
  }
  .rs-card { padding: 22px 20px; }
  .rs-title { font-size: 24px; }
  /* 超窄时「开始阅读」与提示语换行，不再挤压同行 */
  .rs-actions { flex-wrap: wrap; }
  /* 命中区提档到 ≥36px（与主站组93 口径一致；13px 小胶囊裸高约 27px 偏小） */
  .rs-quick button { min-height: 36px; padding: 8px 14px; }
  .rc-more { min-height: 36px; }
  /* 组103：HUD 两胶囊（修改设置/退出，组115 文案）触屏命中区扩到 ~45px——用组95 点列的
     ::after 透明外扩而非 min-height：后者会把 HUD 裸高从 ~43px 撑到 64px，
     正撞组101 按 46px 卡顶留白钉的「不叠正文」账。左右 -6 后两钮命中带间
     仍剩 14−6−6=2px 不互叠。 */
  .rc-setup, .rc-exit { position: relative; }
  .rc-setup::after, .rc-exit::after {
    content: "";
    position: absolute;
    inset: -9px -6px;
  }
  /* 右侧 26px 留道给圆点列（点列占 8–16px），正文右缘不与点重叠 */
  .rcard {
    padding:
      calc(48px + env(safe-area-inset-top))
      26px
      calc(78px + env(safe-area-inset-bottom))
      14px;
  }
  .rc-abstract { font-size: 16px; } /* 组98：15→16，与桌面档差一档而非两档 */
  .rc-dots { right: 8px; gap: 7px; }
  .rc-dots button { width: 8px; height: 8px; }
  /* 触屏没有键盘，「↑↓ 翻页 · Esc 改选题」提示反而添乱 */
  .rc-nav-hint { display: none; }
}

/* ---------- 超窄手机（≤380：iPhone SE 375 / 320 一线，组101）：纵向寸土让给正文 ----------
   320×568 实测（组101 修复前）：标题 4 行 + 作者 2 行 + 三钮 links 行高 + 上下留白
   把 body 撑满，摘要只剩组98 的 2 行托底——「一屏一篇」变成「一屏一钮」。
   本档逐件压缩固定开销（合计省 ~55px ≈ 正文多出 2 行），字号不降反保 16px
   （组98 可读性口径），行长换宽度：左右留道再收 2px/4px，点列命中带不侵正文。 */
@media (max-width: 380px) {
  /* 上 46px：HUD 裸高 ~43px 仍不叠正文；下 70px 容 46px 圆钮 + 16px 边距；
     左 12 / 右 24：点列 right:6 + 点径 8 + ::after 扩击 9 = 占带 23 ≤ 24 */
  .rcard {
    padding:
      calc(46px + env(safe-area-inset-top))
      24px
      calc(70px + env(safe-area-inset-bottom))
      12px;
  }
  .rcard-body { gap: 10px; }
  /* 完整名单在「读原文」，超窄屏作者让位给摘要（组98 限 2 行口径再收一档） */
  .rc-authors { -webkit-line-clamp: 1; }
  .rc-dots { right: 6px; }
  /* links 行：两枚标记钮钉宽同步收（88+8+102 ≤ 286 单行放得下），行高省 ~14px；
     13.5px 字 + 7px 上下 padding 裸高仍 ≥36px 命中档（组93/95 口径不破坏） */
  .rc-links { gap: 8px; }
  .rc-link { padding: 7px 12px; font-size: 13.5px; }
  .rc-mark { min-width: 88px; }
  .rc-mark--read { min-width: 102px; }
  /* 设置面板：「30 篇」不 nowrap 会在 240px 内宽里折成两行竖排 */
  .rs-quick button { white-space: nowrap; padding: 8px 10px; }
}

/* ---------- 中窄档（641~830：iPad 竖屏 / 横屏手机一线，组110）：点列留道补账 ----------
   组95「正文右缘不与点重叠」的账只由 ≤640 档 26px 右留道结清；base 档
   padding-right 20px 挡不住点列 ::after 命中带（right 14 + 点径 10 + 外扩 9
   = 左缘 vw−33）。实测 641~825 命中带咬进 body 盒 9~15px（768×1024 iPad 竖屏
   +15、667×375 +15、812×375 +9）——透明不可见的翻页陷阱带：按到行尾末几字或
   links 行钮右缘即被圆点吞击跳页。≥826 起 body 被 760px 封顶居中，右缘自然
   脱开命中带（实测 834 档 −2），上界 830 收口（826 取整留余）。
   只垫右留道 34px（=14+10+9+1），左缘/字号/组101 排版档零触碰——本档是
   组95 留道账在 base 区的延续，不是新的排版决定。 */
@media (min-width: 641px) and (max-width: 830px) {
  .rcard { padding-right: calc(34px + env(safe-area-inset-right)); }
}

/* ---------- 矮屏（手机横屏 / 小窗）：压缩纵向留白，内容优先 ----------
   组127（全面审查 L22）：删本档 .rcard padding 44/64——组114 新增的 ≤560 档
   源码在后、同特异度且同样命中 ≤480，padding 恒被其 44+env/70+env 覆盖，
   本档这两行从未生效（其注释「≤480 档同值」亦不确，已随改）；本档实际生效
   项只有 nav 尺寸/点距/nav 底位。nav 底位原裸 10px 丢了 base 的 safe-area
   账——横屏刘海机 home 指示条正压翻页钮，补回 env()。 */
@media (max-height: 480px) {
  .rc-nav { bottom: calc(10px + env(safe-area-inset-bottom)); }
  .rc-nav button { width: 40px; height: 40px; font-size: 17px; }
  .rc-dots { gap: 5px; }
}

/* ---------- 矮竖屏/小窗（组114）：46vh 折叠初值在卡高 <~470px 时算出的
   可读纵深被 chrome 吃光，摘要只剩 2 行托底（500×420 实测：46vh≈193px 的
   空间看似够，实际上下 padding 44+64 + HUD 留白后摘要盒只分到 55px）。
   档位 ≤560px 卡高（320 矮横屏到 375×568 之间的过渡带，含 500×420/600×400
   这类桌面小窗；lint-tokens 登记 560px）。向下收三处纵向开销：
   折叠初值 46vh→38vh（矮卡上 38vh ≈ 160px ≈ 6 行，比 2 行托底多给 4 行）、
   body 上下留白 56/84→44/70（组127 注：本档即矮屏唯一 padding 账——原 ≤480
   档的 44/64 恒被此处覆盖属死码，已删）、gap 14→10。 */
@media (max-height: 560px) {
  .rcard {
    padding-top: calc(44px + env(safe-area-inset-top));
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }
  .rcard-body { gap: 10px; }
  .rc-abstract { --rc-clip-init: 38vh; }
}

/* ---------- 超宽屏（组101）：整版同比放大，行长恒定不扩面 ----------
   1920 与 3440 此前逐像素相同（body 封顶 760 + 17px 字，大屏=小屏加边），
   与组100 首页同病。组100 用 zoom 缩放 .home-grid 子树，本页**不用**：
   zoom 会把 vh/flex 百分比 max-height（--rc-clip 初值 46vh、body max-height
   100%）一并乘档，而 reader.js 的翻页步长取 offsetHeight 映射 translateY，
   坐标系一旦掺 zoom 就错位半屏——岛页逐档显式抬几个关键长度更稳，
   也全部可静态锚死。
   行长承诺：max-width ÷ 摘要字号 = 恒定 em 数（760/17 ≈ 860/19 ≈ 940/21
   ≈ 44.8em），物理尺寸随屏长大、每行字数不变。档位 1700/2560 复用
   lint-tokens 已登记的 2xl/3xl（与组100 首页缩放档同步，两页不同步会花眼）。 */
@media (min-width: 1700px) {
  .rcard-body { max-width: 860px; }
  .rc-abstract { font-size: 19px; }
  .rc-title { font-size: clamp(26px, 2.3vw, 40px); }
  .rc-authors { font-size: 15.5px; }
  .rc-badge { font-size: 13.5px; }
  .rc-date { font-size: 13.5px; }
  .rc-more { font-size: 14px; }
  .rc-link { font-size: 15.5px; padding: 10px 20px; }
  .rc-mark { min-width: 110px; }
  .rc-mark--read { min-width: 128px; }
  .reader-hud { font-size: 15px; }
  .rc-journal-tag { font-size: 13px; }
  /* 组107：HUD 右对两枚成对胶囊（组103）须同幅抬档——此前只抬 .rc-exit，
     宽档下「返回首页」比「改选题」胖一号（13px vs 14px，实测高 31↔32） */
  .rc-setup, .rc-exit { font-size: 14px; }
  /* 边缘 chrome 同比抬一档：1080p 起 46px 圆钮/10px 点在大桌面上像放大镜里的蚂蚁 */
  .rc-nav button { width: 52px; height: 52px; font-size: 22px; }
  .rc-nav-hint { font-size: 13.5px; }
  .rc-dots { right: 18px; gap: 11px; }
  .rc-dots button { width: 11px; height: 11px; }
}
@media (min-width: 2560px) {
  .rcard-body { max-width: 940px; }
  .rc-abstract { font-size: 21px; }
  .rc-title { font-size: clamp(28px, 2.5vw, 46px); }
  .rc-authors { font-size: 17px; }
  .rc-link { font-size: 16.5px; padding: 11px 22px; }
  .rc-mark { min-width: 118px; }
  .rc-mark--read { min-width: 138px; }
  .rc-nav button { width: 58px; height: 58px; font-size: 24px; }
  .rc-dots button { width: 12px; height: 12px; }
  /* 设置面板 4K 距离同档放大（表单字 14px 在 27 英寸外缩成脚注） */
  .rs-card { max-width: 620px; padding: 32px 36px 30px; }
  .rs-title { font-size: 34px; }
  .rs-sub, .rs-label, .rs-hint, .rs-foot { font-size: 15px; }
  .rs-seg span { font-size: 15px; padding: 9px 18px; }
  .rs-start { font-size: 17px; }
}

/* ---------- 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  #reader-track { transition: none; }
  .rc-progress { transition: none; }
  .rc-dots button, .rc-nav button { transition: none; }
}

/* ---------- 打印/存 PDF（组127 全面审查 L23） ----------
   此前三者叠加：html/body/.reader-stage 全 overflow:hidden + .rcard 100dvh
   定高 + track 靠 translateY 定位——Ctrl+P 只出一页「当前屏」，展开态长文
   照样截半页，导航钮/HUD/进度条等固定层还会每页重印。收拢为纸面序列：
   取消平移定位让全部卡自然堆叠，撤摘要折叠限高（is-clipped 的渐隐罩同撤），
   固定 chrome 与纸上死控件（翻页钮、展开钮、收藏/已读钮、读原文链）整组藏。
   卡底虚线作篇间分隔；卡背景是浅色随机彩，浏览器默认不印背景色，纸面即
   白底深字，10 档排版字号不动即可读。 */
@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  .reader-stage { position: static; overflow: visible; }
  #reader-track {
    position: static;
    /* 位移由 reader.js 内联 transform 驱动，静态规则压不住，必须 !important */
    transform: none !important;
    transition: none !important;
    will-change: auto;
  }
  .rcard {
    height: auto;
    overflow: visible;
    padding: 0 0 2.5em;
    border-bottom: 1px dashed #b6bac2;
    break-inside: avoid;
  }
  .rcard-body { max-height: none; margin: 0 auto; }
  .rc-abstract {
    max-height: none;
    overflow: visible;
    min-height: 0;
  }
  .rc-abstract.is-clipped::after { display: none; }
  .reader-hud, .rc-progress, .rc-dots, .rc-nav,
  .rc-more, .rc-mark, .rc-link { display: none !important; }
}
