/* ==========================================================================
   阿梨 AI 早晚报
   遵循优化稿：每类信息一个权威位置；一种标签语气；正文最响亮。
   层级：报头 64 → 本期标题（Display）→ 今日要点 → 目录 / 640 阅读列 / 打卡
   ========================================================================== */

:root {
  color-scheme: light;
  --paper: #faf9f6;
  --surface: #f2f0e9;
  --ink: #171815;
  --body: #2c2d29;
  --summary: #51564e;
  --muted: #6f7169;
  --faint: #787970;
  --line: #e0ddd3;
  --line-strong: #1a1b17;
  --accent: #cc3d2d;
  --highlight: rgba(204, 61, 45, 0.18);
  --radius: 2px;

  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, SimSun, serif;
  --sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --num: Georgia, "Times New Roman", serif;

  --body-size: 17px;
  --ui: 14px;
  --cap: 12px;
  --display: 44px;
  --h2: 30px;
  --h3: 24px;

  --shell: 1176px;
  --gutter: 40px;
  --measure: 38em;
  --rail: 176px;
  --side: 240px;
  --gap: 56px;
}

:root[data-theme="evening"] {
  color-scheme: dark;
  --paper: #171b22;
  --surface: #1f2630;
  --ink: #f0ece1;
  --body: #d8d4ca;
  --summary: #bdc5cf;
  --muted: #9aa3af;
  --faint: #808a97;
  --line: #333d4a;
  --line-strong: #e7e2d7;
  --accent: #f09a7a;
  --highlight: rgba(240, 154, 122, 0.24);
}

:root[data-font-size="large"] { --body-size: 19px; --ui: 15px; --cap: 13px; --display: 46px; --h2: 32px; --h3: 26px; }
:root[data-font-size="extra"]  { --body-size: 21px; --ui: 16px; --cap: 14px; --display: 48px; --h2: 34px; --h3: 28px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--sans);
  font-size: var(--body-size);
  line-height: 1.8;
  letter-spacing: 0.005em;
  text-autospace: ideograph-alpha ideograph-numeric;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--paper); }

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 90;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--ui);
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   报头：一行 64px，只放品牌、搜索、Aa、分享
   -------------------------------------------------------------------------- */

.shell {
  max-width: calc(var(--shell) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  min-width: 0;
}

.brand-avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.brand-text {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.15;
  white-space: nowrap;
}

.brand-text small {
  display: block;
  margin-top: 3px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--faint);
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: var(--ui);
  white-space: nowrap;
}

.tool-button:hover { color: var(--ink); background: var(--surface); }
.tool-button svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}

.tool-size .aa {
  font-family: var(--num);
  font-size: 17px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.key-hint {
  margin-left: 2px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--faint);
}

/* --------------------------------------------------------------------------
   本期标题：整页唯一的主角（第 191 期 · 晨间版 / AI 早报）
   -------------------------------------------------------------------------- */

.edition-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px 40px;
  padding: 46px 0 20px;
  border-bottom: 3px solid var(--line-strong);
}

.kicker {
  margin: 0 0 14px;
  font-size: var(--cap);
  letter-spacing: 0.16em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.edition-id h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: var(--display);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}

.edition-side {
  display: grid;
  gap: 22px;
  justify-items: end;
  align-content: space-between;
  min-height: 100%;
}

.edition-meta {
  margin: 0;
  font-size: var(--cap);
  color: var(--muted);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.edition-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-control { position: relative; }

.date-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: var(--ui);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.date-trigger:hover { border-color: var(--muted); }
.date-trigger:disabled { color: var(--faint); cursor: default; }
.date-trigger svg {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.65;
}
.date-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.date-trigger[aria-expanded="true"] { border-color: var(--muted); }

.date-weekday { color: var(--muted); }
.date-short { display: none; }

.date-main {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
}

.period-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.period-switch button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 14px;
  border-radius: 1px;
  color: var(--muted);
  font-size: var(--ui);
  white-space: nowrap;
}

.period-switch button svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}

.period-switch button:hover { color: var(--ink); }
.period-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.page-notice {
  margin: 20px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  background: var(--surface);
  font-size: var(--ui);
  color: var(--body);
}

/* --------------------------------------------------------------------------
   今日要点：5 条文字速览，头条是真照片时才给一张图
   -------------------------------------------------------------------------- */

.digest { padding: 36px 0 0; }

.digest-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  font-size: var(--cap);
  letter-spacing: 0.18em;
  color: var(--muted);
}

.mark-dot {
  width: 5px; height: 5px;
  background: var(--accent);
  display: block;
  flex-shrink: 0;
}

.digest-layout { display: grid; gap: 36px; }

.digest-layout.has-hero {
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

.digest-hero {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
}

.digest-hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.digest-hero.is-photo img { aspect-ratio: 16 / 10; }

:root[data-theme="evening"] .digest-hero.is-photo img { filter: brightness(0.9) contrast(1.02); }

.digest-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: digest;
}

.digest-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
}

.digest-num {
  font-family: var(--num);
  font-style: italic;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.digest-title {
  font-family: var(--serif);
  font-size: var(--body-size);
  line-height: 1.55;
  font-weight: 500;
  color: var(--ink);
  text-wrap: pretty;
}

.digest-row:hover .digest-title { color: var(--accent); }

.digest-tag {
  font-size: var(--cap);
  color: var(--faint);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   正文：目录（滚动高亮）+ 640px 阅读列 + 打卡卡片
   -------------------------------------------------------------------------- */

.reader {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--side);
  column-gap: var(--gap);
  align-items: start;
  padding: 68px 0 0;
}

.rail { align-self: stretch; }

.rail-inner {
  position: sticky;
  top: 44px;
  padding-right: 8px;
}

.rail-label {
  margin: 0 0 14px;
  font-size: var(--cap);
  letter-spacing: 0.16em;
  color: var(--faint);
}

#directory { display: flex; flex-direction: column; }

.dir-link {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 8px 0 8px 11px;
  border-left: 2px solid transparent;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s;
}

.dir-link:hover { color: var(--ink); }

.dir-link[aria-current="true"] {
  color: var(--accent);
  border-left-color: var(--accent);
}

.dir-num {
  font-family: var(--num);
  font-style: italic;
  font-size: 11px;
  color: var(--faint);
}

.dir-link[aria-current="true"] .dir-num { color: var(--accent); }

.rail-top {
  margin-top: 20px;
  padding-left: 13px;
  font-size: var(--cap);
  color: var(--faint);
  letter-spacing: 0.04em;
}

.rail-top:hover { color: var(--accent); }

.reader-main { max-width: var(--measure); }

/* 栏目标题 = 分隔页 */
.section { margin: 0; }
.section + .section { margin-top: 76px; }

.section-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 16px;
  padding-top: 20px;
  margin-bottom: 34px;
  border-top: 2px solid var(--line-strong);
}

.section-num {
  font-family: var(--num);
  font-style: italic;
  font-size: 28px;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.section-name {
  margin: 0;
  font-family: var(--serif);
  font-size: var(--h2);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-wrap: balance;
}

.section-count {
  font-size: var(--cap);
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 文章 */
.story { margin: 0 0 52px; }
.story:last-child { margin-bottom: 0; }

.story-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 10px;
  font-size: var(--cap);
  color: var(--faint);
  letter-spacing: 0.02em;
}

.story-num {
  font-family: var(--num);
  font-style: italic;
  font-size: 12px;
  color: var(--accent);
}

.story-meta .sep {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}

.story-meta time { font-variant-numeric: tabular-nums; }

.story h3 {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: var(--h3);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.002em;
  color: var(--ink);
  text-wrap: balance;
}

.story h3 a { color: inherit; }
.story h3 a:hover { color: var(--accent); }

/* 正文排版 */
.prose { font-size: var(--body-size); line-height: 1.85; color: var(--body); }
.story-summary { color: var(--summary); font-weight: 400; }
.prose p { margin: 0 0 1.05em; text-wrap: pretty; }
.prose p:last-child { margin-bottom: 0; }
.prose strong, .prose b { font-weight: 600; color: var(--ink); }
.prose em { font-style: italic; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* 反引号残留：数字降级为强调，真标识符才用等宽，且不带灰底胶囊 */
.prose code {
  font-family: inherit;
  font-size: inherit;
  background: none;
  padding: 0;
  border: 0;
  font-variant-numeric: tabular-nums;
}

.prose code.code-id {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
  font-size: 0.92em;
  letter-spacing: -0.01em;
}

.prose .num {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.005em;
}

.prose mark {
  background: linear-gradient(transparent 62%, var(--highlight) 0);
  color: var(--accent);
  font-weight: 600;
  padding: 0 1px;
}
.prose mark :is(strong, b, code, .num) { color: inherit; }

.prose blockquote {
  margin: 1.2em 0;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

.prose ul, .prose ol { margin: 0 0 1.05em; padding-left: 1.4em; }
.prose li { margin-bottom: 0.35em; }

/* 配图：正文优先，缩略图集中在每条新闻末尾。 */
.prose img {
  display: block;
  width: auto;
  max-width: 156px;
  max-height: 156px;
  height: auto;
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: zoom-in;
}

:root[data-theme="evening"] .prose img { filter: brightness(0.86) contrast(1.04); }
:root[data-theme="evening"] .prose img:hover { filter: brightness(0.96) contrast(1.02); }

.story-gallery {
  --thumb-size: 156px;
  --thumb-columns: 3;
  display: grid;
  grid-template-columns: repeat(var(--thumb-columns), minmax(0, 1fr));
  gap: 6px;
  width: min(100%, calc(var(--thumb-size) * var(--thumb-columns) + 6px * (var(--thumb-columns) - 1)));
  margin: 18px 0 0;
}

.story-gallery[data-columns="1"] { --thumb-columns: 1; }
.story-gallery[data-columns="2"] { --thumb-columns: 2; }

.image-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: zoom-in;
}

.image-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  object-fit: cover;
}

.image-thumb.is-long img { object-position: top; }
.image-thumb:hover { border-color: var(--muted); }
.image-thumb:disabled { cursor: default; }
.image-thumb .missing-image { padding: 10px; font-size: 12px; line-height: 1.6; }
:root[data-theme="evening"] .image-thumb img { filter: brightness(0.86) contrast(1.04); }
:root[data-theme="evening"] .image-thumb:hover img { filter: brightness(0.96) contrast(1.02); }

.image-thumb-label {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(18, 18, 18, 0.7);
  color: #fff;
  font-size: 11px;
}

.zoom-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(18, 18, 18, 0.55);
  color: #fff;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.zoom-badge svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* 阿梨的看法 */
.story-opinion {
  margin: 26px 0 0;
  padding: 16px 20px 18px;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
}

.story-opinion .op-label {
  margin: 0 0 6px;
  font-size: var(--cap);
  letter-spacing: 0.14em;
  color: var(--accent);
}

.story-opinion .prose { font-size: calc(var(--body-size) - 1px); }

/* 来源 */
.story-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  margin: 18px 0 0;
  font-size: var(--cap);
  color: var(--faint);
}

.story-sources .source-label { letter-spacing: 0.14em; }

.story-sources a {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}

.story-sources a:hover { color: var(--accent); border-color: var(--accent); }

/* --------------------------------------------------------------------------
   读完、上一期/下一期、七日档案
   -------------------------------------------------------------------------- */

.finished {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 72px 0 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.finished-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
}

.finished-mark svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.finished-body { min-width: 0; }
.finished-title { margin: 0; font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); }
.finished-sub { margin: 3px 0 0; font-size: var(--cap); color: var(--muted); }

.finished-link {
  margin-left: auto;
  font-size: var(--ui);
  color: var(--accent);
  white-space: nowrap;
}

.finished-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.issue-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.issue-nav a {
  padding: 16px 0;
  min-width: 0;
}

.issue-nav a + a {
  padding-left: 24px;
  border-left: 1px solid var(--line);
  text-align: right;
}

.issue-nav .nav-label { display: block; font-size: var(--cap); color: var(--faint); letter-spacing: 0.1em; }
.issue-nav .nav-title { display: block; margin-top: 2px; font-family: var(--serif); font-size: 15px; color: var(--ink); }
.issue-nav a:hover .nav-title { color: var(--accent); }
.issue-nav a[aria-disabled="true"] { pointer-events: none; opacity: 0.35; }

.week { margin: 60px 0 0; }

.week-title {
  margin: 0 0 14px;
  font-size: var(--cap);
  letter-spacing: 0.16em;
  color: var(--faint);
}

.week-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(4, auto);
  grid-auto-flow: column;
  gap: 2px 36px;
}

.week-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 76px;
  gap: 2px;
  align-items: stretch;
}

.week-date {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 0;
  font-size: var(--ui);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.week-date small { font-size: var(--cap); color: var(--faint); }

.week-cell {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--cap);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.week-cell:hover:not(:disabled) { border-color: var(--muted); color: var(--ink); }

.week-cell[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.week-cell:disabled {
  color: var(--faint);
  opacity: 0.45;
  cursor: default;
  border-style: dashed;
}

.week-legend { margin: 12px 0 0; font-size: var(--cap); color: var(--faint); }

/* --------------------------------------------------------------------------
   PC 右栏：打卡静态卡片
   -------------------------------------------------------------------------- */

.side { align-self: stretch; }

.checkin {
  position: sticky;
  top: 44px;
  padding: 18px 20px 20px;
  background: color-mix(in srgb, var(--accent) 6%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
}

.checkin-label {
  margin: 0 0 12px;
  font-size: var(--ui);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ink);
}

.checkin-streak {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0;
  color: var(--ink);
}

.checkin-streak strong {
  font-family: var(--num);
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}

.checkin-streak span { font-size: var(--cap); color: var(--muted); }

.checkin-state {
  margin: 8px 0 14px;
  font-size: var(--cap);
  color: var(--muted);
}

.checkin-state::before {
  content: "";
  display: inline-block;
  width: 4px; height: 4px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.checkin-hint { margin: 0 0 16px; color: var(--muted); font-size: var(--cap); line-height: 1.8; }
.checkin-link {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
}

.checkin-link:hover { filter: brightness(1.08); }

/* --------------------------------------------------------------------------
   手机：44px 迷你条 + 连读胶囊
   -------------------------------------------------------------------------- */

.mini-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 6px 0 8px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  transform: translateY(-101%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

@supports (backdrop-filter: blur(1px)) {
  .mini-bar { background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(14px) saturate(1.1); }
}

.mini-bar.is-visible { transform: none; }

@media (min-width: 980px) {
  .mini-bar { display: none; }
}

.mini-edition,
.mini-section {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  min-width: 0;
}

.mini-edition:hover,
.mini-section:hover { background: var(--surface); }

.mini-edition svg,
.mini-section svg {
  width: 12px; height: 12px;
  fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.6;
  flex-shrink: 0;
}

.mini-section { flex: 1; justify-content: flex-start; overflow: hidden; }
.mini-section span { overflow: hidden; text-overflow: ellipsis; }

.mini-sep {
  width: 1px;
  height: 16px;
  background: var(--line);
  flex-shrink: 0;
}

.mini-progress {
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: transparent;
}

.mini-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.15s linear;
}

.streak-pill {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 41;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  max-width: calc(100vw - 32px);
  padding: 0 17px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.13);
  opacity: 0;
  transform: translate(-50%, 140%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s;
}

.streak-pill.is-visible { opacity: 1; transform: translate(-50%, 0); }

.streak-pill svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   期次面板：7 天 × 早/晚
   -------------------------------------------------------------------------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.sheet-panel {
  position: absolute;
  width: 348px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.2);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.sheet-title {
  margin: 0;
  font-size: var(--ui);
  color: var(--ink);
  letter-spacing: 0.04em;
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: var(--radius);
  color: var(--muted);
}

.sheet-close:hover { background: var(--surface); color: var(--ink); }
.sheet-close svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }

.edition-grid { display: flex; flex-direction: column; gap: 2px; }

.edition-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px 62px;
  gap: 6px;
  align-items: center;
  padding: 3px 0;
}

.edition-date {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  padding-left: 2px;
}

.edition-date small { font-size: var(--cap); color: var(--faint); }

.edition-cell {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--cap);
  color: var(--muted);
}

.edition-cell:hover:not(:disabled) { border-color: var(--muted); color: var(--ink); }
.edition-cell[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.edition-cell:disabled {
  color: var(--faint);
  opacity: 0.4;
  cursor: default;
  border-style: dashed;
  text-decoration: line-through;
}

.sheet-foot {
  margin: 10px 2px 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: var(--cap);
  color: var(--faint);
}

.section-sheet-list { display: flex; flex-direction: column; }

.section-sheet-list a {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  font-size: var(--ui);
  color: var(--ink);
}

.section-sheet-list a:last-child { border-bottom: 0; }
.section-sheet-list span:first-child { font-family: var(--num); font-style: italic; font-size: 12px; color: var(--accent); }
.section-sheet-list small { font-size: var(--cap); color: var(--faint); }

/* --------------------------------------------------------------------------
   对话框：搜索 / 大图 / 阅读打卡
   -------------------------------------------------------------------------- */

.dialog {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--body);
  width: min(600px, calc(100vw - 32px));
  max-height: min(84vh, 780px);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.26);
  overflow: auto;
}

.dialog::backdrop {
  background: rgba(16, 16, 14, 0.46);
  backdrop-filter: blur(2px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
}

.dialog-kicker {
  margin: 0 0 6px;
  font-size: var(--cap);
  letter-spacing: 0.16em;
  color: var(--faint);
}

.dialog-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.dialog-close {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius);
  color: var(--muted);
}

.dialog-close:hover { background: var(--surface); color: var(--ink); }
.dialog-close svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }

.ghost-button {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink);
}

.ghost-button:hover { border-color: var(--muted); }
.ghost-small { height: 30px; padding: 0 12px; font-size: var(--cap); }

.share-content { padding: 0 24px 24px; }
.share-content label { display: block; margin-bottom: 8px; color: var(--muted); font-size: var(--ui); }
.share-content input { display: block; width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: var(--ui); }
.share-content p { margin: 12px 0 16px; color: var(--muted); font-size: var(--ui); }
.share-content .ghost-button { min-height: 44px; }

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 24px;
  padding: 0 14px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search-field:focus-within { border-color: var(--muted); }
.search-field svg { width: 17px; height: 17px; fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-linecap: round; flex-shrink: 0; }
.search-field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: var(--ui); color: var(--ink); }
.search-field input::placeholder { color: var(--faint); }

.search-hint { margin: 12px 24px 4px; font-size: var(--cap); color: var(--faint); }

.search-results { padding: 8px 12px 18px; }

.search-result {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  text-align: left;
}

.search-result:hover { background: var(--surface); }
.search-result .result-meta { font-size: var(--cap); color: var(--faint); letter-spacing: 0.04em; }
.search-result h3 { margin: 4px 0 3px; font-family: var(--serif); font-size: 16px; font-weight: 600; line-height: 1.45; color: var(--ink); }
.search-result p { margin: 0; font-size: var(--cap); line-height: 1.65; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.image-dialog {
  width: min(1100px, 94vw);
  max-width: 94vw;
  max-height: 94vh;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: auto;
}

.image-dialog::backdrop { background: rgba(10, 10, 9, 0.82); }
html.image-open { overflow: hidden; }

.image-stage { max-height: 76vh; overflow: auto; }

.image-stage img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius);
  background: var(--paper);
}

.image-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: var(--cap);
  flex-wrap: wrap;
}

.image-actions p { margin: 0; }
.image-actions .image-position { margin-right: auto; font-variant-numeric: tabular-nums; }
.image-actions .ghost-button { min-height: 40px; }
.image-actions .ghost-button { border-color: rgba(255, 255, 255, 0.28); color: #fff; background: transparent; }
.image-actions .ghost-button:hover { border-color: #fff; }
.image-actions .ghost-button:disabled { opacity: 0.35; cursor: default; }
.image-load-error { color: #fff; font-size: var(--ui); text-align: center; }

.reading-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 4px 24px 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.reading-stats > div { background: var(--paper); padding: 14px 16px; }
.reading-stats strong { display: block; font-family: var(--num); font-size: 32px; font-weight: 400; line-height: 1.1; color: var(--ink); }
.reading-stats span { font-size: var(--cap); color: var(--faint); }

.reading-message { margin: 14px 24px 0; font-size: var(--cap); line-height: 1.7; color: var(--muted); }

.reading-rank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 24px 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.reading-rank-head .dialog-kicker { margin: 0; }

.reading-rank-list { margin: 0; padding: 0 24px; list-style: none; }

.reading-rank-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--ui);
}

.reading-rank-list li:last-child { border-bottom: 0; }
.reading-rank-list .rank { font-family: var(--num); font-style: italic; font-size: 12px; color: var(--faint); }
.reading-rank-list .rank.top { color: var(--accent); }
.reading-rank-list strong { font-weight: 500; color: var(--ink); }
.reading-rank-list .score { font-size: var(--cap); color: var(--muted); font-variant-numeric: tabular-nums; }
.reading-rank-list li.is-me { background: var(--surface); margin: 0 -10px; padding: 8px 10px; border-radius: var(--radius); }

.reading-foot {
  margin: 16px 24px 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: var(--cap);
  line-height: 1.7;
  color: var(--faint);
}

/* --------------------------------------------------------------------------
   页脚与提示
   -------------------------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 32px;
  margin-top: 96px;
  padding: 26px 0 54px;
  border-top: 1px solid var(--line);
  font-size: var(--cap);
  color: var(--faint);
}

.footer-brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 0.05em;
}

.footer-brand span {
  display: block;
  margin-top: 3px;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
}

.footer-note { margin: 0; }
.footer-preview { color: var(--faint); opacity: 0.8; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* 空状态：这一期还没发布 */
.reader.is-empty { grid-template-columns: minmax(0, 1fr); }
.reader.is-empty .rail,
.reader.is-empty .side { display: none; }

.empty {
  padding: 48px 0 8px;
  max-width: 34em;
}

.empty h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
}

.empty p { margin: 0 0 10px; font-size: var(--ui); color: var(--muted); }
.empty button { margin-top: 6px; }

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 1179px) {
  :root { --rail: 168px; --gap: 44px; }
  .reader { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .side { display: none; }
}

@media (max-width: 979px) {
  :root { --gutter: 32px; }
  .reader { grid-template-columns: minmax(0, 1fr); padding-top: 52px; }
  .rail { display: none; }
  .reader-main { max-width: var(--measure); }
  .streak-pill { display: none; }
}

@media (max-width: 767px) {
  :root {
    --gutter: 24px;
    --display: 32px;
    --h2: 24px;
    --h3: 24px;
    --measure: 100%;
    --gap: 0px;
  }

  body { line-height: 1.8; }

  .topbar { height: 56px; gap: 12px; }
  .brand-avatar { width: 32px; height: 32px; border-radius: 4px; }
  .brand-text { font-size: 14px; letter-spacing: 0.06em; }
  .brand-text small { display: none; }
  .tool-button { padding: 0 8px; height: 34px; }
  .tool-text { display: none; }
  .key-hint { display: none; }
  .tool-share { display: none; }
  .tool-size .aa { font-size: 18px; }

  .edition-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 26px 0 16px;
    border-bottom-width: 3px;
  }

  .kicker { margin-bottom: 10px; letter-spacing: 0.12em; }
  .edition-id h1 { font-size: var(--display); line-height: 1.1; }

  .edition-side { display: contents; }

  .edition-meta {
    order: 2;
    margin-top: 12px;
    font-size: var(--cap);
    color: var(--muted);
    white-space: normal;
  }

  .edition-controls {
    order: 3;
    margin-top: 16px;
    gap: 8px;
    width: 100%;
  }

  .date-control { flex: 1; min-width: 0; }
  .date-trigger { width: 100%; justify-content: space-between; height: 40px; }
  .date-full { display: none; }
  .date-short { display: inline; }

  .period-switch { flex-shrink: 0; }
  .period-switch button { height: 32px; padding: 0 12px; }

  .digest { padding-top: 26px; }
  .digest-layout.has-hero { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  /* 手机上不重复显示头条图：第一篇文章的配图就在下方，首屏留给要点与正文 */
  .digest-hero { display: none; }
  .digest-row { grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 8px 0; }
  .digest-title { font-size: 16px; line-height: 1.5; }
  .digest-tag { display: none; }

  .reader { padding-top: 40px; }

  .section + .section { margin-top: 52px; }
  .section-head { gap: 12px; padding-top: 16px; margin-bottom: 26px; }
  .section-num { font-size: 22px; }
  .section-name { font-size: var(--h2); }
  .section-count { font-size: 11px; }

  .story { margin-bottom: 40px; }
  .story h3 { margin-bottom: 16px; }
  .story-meta { gap: 8px; }

  .prose em { font-style: normal; }

  .story-gallery { --thumb-size: 108px; }
  .image-actions { gap: 6px; }
  .image-actions .ghost-button { padding: 6px 10px; }

  .finished { flex-wrap: wrap; gap: 12px; padding: 16px 18px; }
  .finished-link { margin-left: 0; width: 100%; }

  .issue-nav a { padding: 14px 0; }
  .issue-nav a + a { padding-left: 16px; }
  .issue-nav .nav-title { font-size: 14px; }

  .week-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; gap: 2px; }
  .week-row { grid-template-columns: minmax(0, 1fr) 62px 62px; }
  .week-date { font-size: 13px; }

  .site-footer { margin-top: 64px; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .footer-preview { display: none; }

  .dialog { width: calc(100vw - 24px); max-height: 86vh; }
  .dialog-head { padding: 18px 18px 14px; }
  .search-field { margin: 0 18px; }
  .search-hint { margin: 10px 18px 2px; }
  .reading-stats { margin: 4px 18px 0; }
  .reading-message { margin: 12px 18px 0; }
  .reading-rank-head { margin: 18px 18px 6px; }
  .reading-rank-list { padding: 0 18px; }
  .reading-foot { margin: 14px 18px 18px; }

  .sheet { background: rgba(20, 18, 14, 0.34); }

  .sheet-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: auto;
    padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
    border-radius: 12px 12px 0 0;
    border-bottom: 0;
    max-height: 82vh;
    overflow: auto;
    animation: sheet-in 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes sheet-in {
    from { transform: translateY(14px); opacity: 0.6; }
    to { transform: none; opacity: 1; }
  }

  .edition-row { grid-template-columns: minmax(0, 1fr) 66px 66px; }
  .edition-cell { height: 36px; }

  .streak-pill { display: inline-flex; }
}

@media (max-width: 380px) {
  :root { --gutter: 20px; --display: 29px; --h2: 22px; --h3: 23px; }
  .period-switch button { padding: 0 9px; }
  .edition-row { grid-template-columns: minmax(0, 1fr) 58px 58px; }
  .week-row { grid-template-columns: minmax(0, 1fr) 56px 56px; }
}

/* 主题切换：只让颜色过渡 */
:root.theme-ready body,
:root.theme-ready .topbar,
:root.theme-ready .edition-head,
:root.theme-ready .digest-hero,
:root.theme-ready .checkin,
:root.theme-ready .finished,
:root.theme-ready .week-cell,
:root.theme-ready .issue-nav,
:root.theme-ready .mini-bar,
:root.theme-ready .streak-pill,
:root.theme-ready .sheet-panel,
:root.theme-ready .dialog {
  transition: background-color 0.35s ease, color 0.3s ease, border-color 0.35s ease;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Toy account actions use the same reading state in the sidebar and dialogs. */
.edition-video { display:inline-block; margin-top:8px; color:var(--accent); font-size:var(--cap); }
.edition-video:hover { text-decoration:underline; text-underline-offset:4px; }
.edition-checkin { margin-top: 20px; }
.edition-checkin button {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 7%, var(--paper));
  text-align: left;
  line-height: 1.7;
}
.edition-checkin button:hover { border-color: var(--accent); }
.edition-checkin-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--paper); }
.edition-checkin svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.edition-checkin-copy { display: grid; gap: 4px; min-width: 0; }
.edition-checkin-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink); font-size: var(--ui); font-weight: 600; }
.edition-checkin-badge { padding: 1px 7px; border-radius: 4px; background: var(--highlight); color: var(--accent); font-size: 11px; font-weight: 500; }
.edition-checkin.is-checked .edition-checkin-badge { background: var(--accent); color: var(--paper); }
#editionReadingStatus { color: var(--muted); font-size: var(--cap); }
.edition-checkin-link { color: var(--accent); font-size: var(--cap); font-weight: 600; white-space: nowrap; }
.edition-checkin button:hover .edition-checkin-link { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 767px) {
  .edition-checkin button { grid-template-columns: 36px minmax(0, 1fr); gap: 6px 12px; padding: 14px; }
  .edition-checkin-icon { grid-row: span 2; align-self: start; }
  .edition-checkin-link { grid-column: 2; }
}
.reading-today { margin:12px 24px 0; color:var(--accent); font-size:var(--cap); }
.reading-check-button { width:calc(100% - 48px); margin:16px 24px 0; border:1px solid var(--line); background:var(--ink); color:var(--paper); padding:11px 16px; font-size:var(--ui); border-radius:var(--radius); }
.reading-check-button:disabled { opacity:.5; cursor:default; }
.reading-rank-number { width:24px; color:var(--accent); font-family:var(--num); }
.reading-rank-sync { margin:16px 24px; padding:14px 0; border-block:1px solid var(--line); }
.reading-rank-sync .ghost-button { font-size:var(--cap); }
.reading-rank-sync p { margin:9px 0 0; color:var(--muted); font-size:var(--cap); line-height:1.7; }
