/* 川流 · 分享阅读页（移动端优先）
 * 配色参照用户提供的分享页：品牌橙 #ff6a41、正文深灰 #1d2129、
 * 次要文字 #8a8f99、浅灰分隔 #e5e6ea、浅底 #f6f6f6。
 * 2026-11-11 17:07 用户补齐参考页截图后，按截图把主色收敛为黑白灰
 * （双行品牌顶栏 / 录音条 / 视图 Tab / 居中胶囊底栏 / 键值列表），橙紫仅作点缀。
 * 不依赖任何框架与 CDN，可直接静态托管。
 */

:root {
  --cl-brand: #ff6a41;
  --cl-brand-soft: #fff1ec;
  --cl-accent: #766af6;
  --cl-text: #1d2129;
  --cl-text-sub: #8a8f99;
  --cl-text-weak: #b0b4bd;
  --cl-bg: #ffffff;
  --cl-surface: #f6f6f6;
  --cl-surface-2: #f2f3f5;
  --cl-line: #e5e6ea;
  --cl-shadow: 0 2px 16px rgba(29, 33, 41, 0.06);
  /* 参考页以黑白灰为主，橙/紫只作点缀；主行动按钮与品牌块用 ink */
  --cl-ink: #1d2129;
  --cl-ink-text: #ffffff;
  --cl-max: 720px;
  --cl-bottom-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --cl-brand: #ff855f;
    --cl-brand-soft: #3a241d;
    --cl-text: #eceef2;
    --cl-text-sub: #9a9fab;
    --cl-text-weak: #6d737e;
    --cl-bg: #16181c;
    --cl-surface: #202329;
    --cl-surface-2: #262a31;
    --cl-line: #33383f;
    --cl-shadow: 0 2px 16px rgba(0, 0, 0, 0.28);
    --cl-ink: #eceef2;
    --cl-ink-text: #16181c;
  }
}

* { box-sizing: border-box; }

/* 组件用了 display:flex / block，UA 的 [hidden] 规则会被覆盖，必须显式兜底 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cl-bg);
  color: var(--cl-text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  /* 统一避让 fixed 底栏：备案号 footer 显示与否都不影响留白 */
  padding-bottom: calc(var(--cl-bottom-h) + 28px + env(safe-area-inset-bottom));
}

button { font: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
.cl-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: var(--cl-bg);
  border-bottom: 1px solid var(--cl-line);
}

/* 参考页顶栏：深色圆角 logo + 双行品牌（名称 / 灰色副标题） */
.cl-brand { display: inline-flex; align-items: center; gap: 9px; }
.cl-brand-text { display: inline-flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cl-brand-name { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.cl-brand-slogan { font-size: 10px; color: var(--cl-text-weak); white-space: nowrap; }

.cl-brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--cl-ink);
  position: relative;
  flex: none;
}
.cl-brand-mark::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--cl-bg);
  border-right-color: transparent;
  border-radius: 50%;
}

.cl-topbar-tag {
  font-size: 12px;
  color: var(--cl-text-sub);
  background: var(--cl-surface-2);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ---------- 主体 ---------- */
.cl-main {
  max-width: var(--cl-max);
  margin: 0 auto;
  padding: 20px 20px 8px;
  min-height: 60vh;
}

/* ---------- 录音条（参考页：浅灰圆角条 + 深色圆形播放键 + 细进度）---------- */
.cl-audio {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 0 0 22px;
  background: var(--cl-surface-2); border-radius: 10px;
}
.cl-audio-play {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: none; background: var(--cl-bg); color: var(--cl-ink);
  font-size: 10px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.cl-audio-current, .cl-audio-duration {
  flex: none; font-size: 11px; color: var(--cl-text-sub);
  font-variant-numeric: tabular-nums;
}
.cl-audio-track {
  flex: 1; min-width: 40px; height: 3px;
  border-radius: 3px; background: var(--cl-line); overflow: hidden;
}
.cl-audio-progress {
  display: block; height: 100%; width: 0%;
  background: var(--cl-ink); border-radius: 3px;
  transition: width .15s linear;
}
.cl-audio audio { display: none; }

/* ---------- 视图 Tab（参考页：智能总结 / 文字记录）---------- */
.cl-tabs {
  display: flex; gap: 22px;
  margin: 0 0 22px;
  border-bottom: 1px solid var(--cl-line);
}
.cl-tab {
  position: relative; border: none; background: none;
  padding: 0 0 10px; font-size: 14px; color: var(--cl-text-sub);
}
.cl-tab.is-active { color: var(--cl-text); font-weight: 600; }
.cl-tab.is-active::after {
  content: ""; position: absolute; left: 50%; bottom: -1px;
  transform: translateX(-50%);
  width: 22px; height: 2px; border-radius: 2px; background: var(--cl-ink);
}

/* 骨架屏 */
.cl-skeleton { padding-top: 12px; }
.sk-line {
  height: 15px;
  border-radius: 6px;
  background: var(--cl-surface-2);
  margin: 14px 0;
  animation: cl-pulse 1.4s ease-in-out infinite;
}
.sk-title { height: 28px; width: 78%; }
.sk-title-short { height: 28px; width: 46%; }
.sk-short { width: 62%; }
.sk-author { display: flex; align-items: center; gap: 10px; margin: 26px 0 30px; }
.sk-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--cl-surface-2); animation: cl-pulse 1.4s ease-in-out infinite; }
.sk-meta { width: 110px; height: 12px; margin: 0; }
@keyframes cl-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  .sk-line, .sk-avatar { animation: none; }
}

/* ---------- 文章 ---------- */
.cl-author-row { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.cl-avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--cl-brand-soft);
  color: var(--cl-brand);
  font-size: 15px; font-weight: 600;
}
.cl-author-info { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.cl-author { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-date { font-size: 12px; color: var(--cl-text-sub); }
.cl-source-badge {
  margin-left: auto; flex: none;
  font-size: 11px; color: var(--cl-accent);
  border: 1px solid currentColor;
  border-radius: 4px; padding: 1px 6px;
  opacity: .85;
}

.cl-title {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: .2px;
  word-break: break-word;
}

.cl-summary {
  margin: 0 0 20px;
  padding: 12px 14px;
  background: var(--cl-surface);
  border-left: 3px solid var(--cl-brand);
  border-radius: 0 8px 8px 0;
  color: var(--cl-text-sub);
  font-size: 14px;
  line-height: 1.7;
}

/* 正文：只覆盖白名单标签，与后端 content_html 对齐 */
.cl-content { font-size: 15px; line-height: 1.8; word-wrap: break-word; }
.cl-content > *:first-child { margin-top: 0; }
.cl-content p { margin: 0 0 1.1em; }
/* 参考页的小节标题是克制的深灰加粗，不用橙色左边框 */
.cl-content h1, .cl-content h2, .cl-content h3, .cl-content h4 {
  margin: 1.7em 0 .65em; line-height: 1.45; font-weight: 600;
}
.cl-content h1 { font-size: 19px; }
.cl-content h2 { font-size: 16px; }
.cl-content h3 { font-size: 15px; }
.cl-content h4 { font-size: 14px; }
.cl-content ul, .cl-content ol { margin: 0 0 1.1em; padding-left: 1.5em; }
.cl-content li { margin: .3em 0; }
.cl-content li::marker { color: var(--cl-text-weak); }
/* 「时长：…」这类键值列表，label 用 strong 加粗，对齐参考页的录音信息块 */
.cl-content li strong { font-weight: 600; }
.cl-transcript, .cl-markdown {
  white-space: pre-wrap; word-break: break-word;
  font-size: 14px; line-height: 1.8;
}
.cl-content blockquote {
  margin: 1.2em 0; padding: 10px 14px;
  background: var(--cl-surface); border-left: 3px solid var(--cl-line);
  color: var(--cl-text-sub); border-radius: 0 6px 6px 0;
}
.cl-content blockquote p:last-child { margin-bottom: 0; }
.cl-content pre {
  margin: 1.2em 0; padding: 14px; overflow-x: auto;
  background: var(--cl-surface-2); border-radius: 8px;
  font-size: 13px; line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cl-content code {
  padding: 2px 5px; border-radius: 4px;
  background: var(--cl-surface-2); font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cl-content pre code { padding: 0; background: none; }
.cl-content a { color: var(--cl-brand); text-decoration: none; border-bottom: 1px solid currentColor; }
.cl-content img { display: block; max-width: 100%; height: auto; margin: 1.2em auto; border-radius: 8px; }
.cl-content hr { border: none; border-top: 1px solid var(--cl-line); margin: 2em 0; }
.cl-content table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 14px; display: block; overflow-x: auto; }
.cl-content th, .cl-content td { border: 1px solid var(--cl-line); padding: 8px 10px; text-align: left; }
.cl-content th { background: var(--cl-surface); font-weight: 600; }
.cl-content mark { background: #fff2b8; color: inherit; padding: 0 2px; }
.cl-content figure { margin: 1.2em 0; }
.cl-content figcaption { font-size: 12px; color: var(--cl-text-sub); text-align: center; }
.cl-content details, .cl-content summary { margin: .6em 0; }

.cl-article-footer {
  margin-top: 44px; padding-top: 22px;
  border-top: 1px solid var(--cl-line);
  text-align: center; color: var(--cl-text-sub); font-size: 13px;
}
.cl-footer-mark {
  display: block; width: 28px; height: 3px; border-radius: 3px;
  background: var(--cl-brand); margin: 0 auto 16px;
}
.cl-article-footer p { margin: 0 0 4px; }
.cl-footer-sub { font-size: 12px; color: var(--cl-text-weak); }

/* ---------- 状态页 ---------- */
.cl-state { text-align: center; padding: 72px 12px; }
.cl-state-icon {
  width: 54px; height: 54px; margin: 0 auto 20px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--cl-surface-2); color: var(--cl-text-sub);
  font-size: 24px; font-weight: 600;
}
.cl-state-title { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.cl-state-desc { margin: 0 auto 22px; max-width: 320px; color: var(--cl-text-sub); font-size: 14px; line-height: 1.7; }

/* ---------- 底部操作栏 ---------- */
.cl-bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--cl-bg);
  border-top: 1px solid var(--cl-line);
  box-shadow: var(--cl-shadow);
}
/* 参考页是单个居中深色胶囊；这里保留两个只读分享动作，但改成居中胶囊形态 */
.cl-bottombar .cl-btn { flex: 0 1 168px; height: 40px; border-radius: 999px; }
.cl-bottombar .cl-btn-ghost { flex: 0 1 120px; }

.cl-btn {
  border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-weight: 500;
  transition: opacity .15s ease;
}
.cl-btn:active { opacity: .72; }
.cl-btn-primary { background: var(--cl-ink); color: var(--cl-ink-text); }
.cl-btn-ghost { background: var(--cl-surface-2); color: var(--cl-text); border-color: var(--cl-line); }
.cl-state .cl-btn { padding: 0 24px; height: 40px; }

/* ---------- 网站侧 ICP 备案号（按域名匹配，未备案域名隐藏）---------- */
.cl-icp { text-align: center; padding: 4px 16px 20px; }
.cl-icp a {
  font-size: 12px; color: var(--cl-text-weak);
  text-decoration: none;
}
.cl-icp a:hover { color: var(--cl-text-sub); text-decoration: underline; }

/* ---------- Toast ---------- */
.cl-toast {
  position: fixed; left: 50%; bottom: calc(var(--cl-bottom-h) + 28px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  z-index: 30; max-width: 80vw;
  padding: 9px 16px; border-radius: 20px;
  background: rgba(29, 33, 41, .9); color: #fff;
  font-size: 13px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.cl-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 768px) {
  .cl-main { padding-top: 32px; }
  .cl-title { font-size: 30px; }
  .cl-bottombar { justify-content: center; }
  .cl-bottombar .cl-btn { flex: 0 1 180px; }
  .cl-bottombar .cl-btn-ghost { flex: 0 1 140px; }
}
