/* Terry Archive — quiet editorial reading surface */
:root {
  /* Primitive palette */
  --paper-0: oklch(0.985 0.004 180);
  --paper-1: oklch(0.962 0.006 180);
  --paper-2: oklch(0.925 0.009 180);
  --ink-0: oklch(0.25 0.022 205);
  --ink-1: oklch(0.39 0.018 205);
  --ink-2: oklch(0.52 0.015 205);
  --accent-0: oklch(0.49 0.075 165);
  --accent-1: oklch(0.94 0.025 165);
  --accent-2: oklch(0.36 0.06 165);
  --danger-0: oklch(0.53 0.16 28);

  /* Semantic tokens */
  --page: var(--paper-1);
  --surface: var(--paper-0);
  --surface-subtle: oklch(0.948 0.008 180);
  --surface-hover: oklch(0.93 0.012 180);
  --text: var(--ink-0);
  --text-secondary: var(--ink-1);
  --text-muted: var(--ink-2);
  --line: oklch(0.885 0.01 180);
  --line-strong: oklch(0.81 0.014 180);
  --accent: var(--accent-0);
  --accent-soft: var(--accent-1);
  --accent-deep: var(--accent-2);
  --focus: oklch(0.58 0.11 165);
  --overlay: oklch(0.15 0.015 205 / 72%);
  --shadow: 0 1px 2px oklch(0.25 0.02 205 / 3%), 0 8px 28px oklch(0.25 0.02 205 / 3%);
  --font-sans: "Avenir Next", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Songti SC", "STSong", serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", monospace;
  color-scheme: light;
}

.dark {
  --page: oklch(0.18 0.012 205);
  --surface: oklch(0.215 0.014 205);
  --surface-subtle: oklch(0.245 0.015 205);
  --surface-hover: oklch(0.275 0.017 205);
  --text: oklch(0.92 0.008 180);
  --text-secondary: oklch(0.78 0.012 180);
  --text-muted: oklch(0.66 0.014 180);
  --line: oklch(0.31 0.016 205);
  --line-strong: oklch(0.39 0.018 205);
  --accent: oklch(0.72 0.085 165);
  --accent-soft: oklch(0.28 0.035 165);
  --accent-deep: oklch(0.82 0.07 165);
  --focus: oklch(0.76 0.1 165);
  --overlay: oklch(0.08 0.01 205 / 84%);
  --shadow: 0 1px 2px oklch(0.05 0.01 205 / 18%), 0 10px 32px oklch(0.05 0.01 205 / 12%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  min-width: 320px;
  min-height: 100dvh;
  scrollbar-gutter: stable;
  scroll-behavior: auto;
  scroll-padding-top: 24px;
}
body {
  min-height: 100dvh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
button:not(:disabled), a { cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, p, dl, dd { margin: 0; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.hidden { display: none !important; }
.flex { display: flex !important; }
.tg-is-hidden { display: none !important; }
.icon { width: 18px; height: 18px; display: block; }

.site-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

/* Masthead */
.site-header { padding-bottom: 28px; border-bottom: 1px solid var(--line-strong); }
.header-main { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand-block { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-avatar {
  width: 64px;
  height: 64px;
  flex: none;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px oklch(0.25 0.02 205 / 8%);
}
.brand-copy { min-width: 0; }
.brand-overline {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .16em;
  line-height: 1.4;
}
.site-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.25;
}
.brand-name { font-family: var(--font-display); font-size: 36px; font-weight: 600; letter-spacing: -.035em; }
.title-divider { color: var(--line-strong); font-family: var(--font-display); font-size: 26px; font-weight: 400; }
.header-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.language-switch { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; }
.lang-btn {
  min-width: 34px;
  min-height: 32px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  transition: background-color 160ms ease, color 160ms ease;
}
.lang-btn:hover { background: var(--surface-hover); color: var(--text); }
.lang-btn.is-active { background: var(--surface); color: var(--accent-deep); box-shadow: 0 1px 3px oklch(0.25 0.02 205 / 8%); }
.action-divider { width: 1px; height: 20px; margin: 0 8px; background: var(--line); }
.icon-btn, .small-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.icon-btn:hover, .small-icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn:active, .small-icon-btn:active { transform: scale(.94); }
.small-icon-btn { width: 32px; height: 32px; }
.small-icon-btn .icon { width: 15px; height: 15px; }
/* 铃铛「有新内容」提示点：用主题强调色，明暗主题自动适配；描边取页面底色，避免压在铃铛线条上糊成一团 */
.icon-btn.has-dot::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-deep);
  box-shadow: 0 0 0 2px var(--page);
  pointer-events: none;
  animation: bell-dot-in 240ms cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes bell-dot-in {
  from { transform: scale(.2); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .icon-btn.has-dot::after { animation: none; }
}
.header-bottom { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: end; margin-top: 30px; }
.site-description { max-width: 58ch; color: var(--text-secondary); font-size: 15px; line-height: 1.75; }
.archive-meta { display: flex; flex-wrap: wrap; margin-top: 8px; color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.archive-meta span { white-space: nowrap; }
.archive-stats { display: grid; grid-template-columns: repeat(4, minmax(70px, 1fr)); gap: 28px; width: 452px; }
.stat-item dt { color: var(--text-muted); font-size: 11px; line-height: 1.4; white-space: nowrap; }
.stat-item dd { margin-top: 5px; color: var(--text); font-family: var(--font-display); font-size: 23px; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; }

/* Primary reading layout */
.site-layout { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 48px; align-items: start; margin-top: 32px; }
.archive-main { min-width: 0; }
.feed-tools { margin-bottom: 24px; }
.archive-search {
  position: relative;
  display: flex;
  align-items: center;
  height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px oklch(0.25 0.02 205 / 3%);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.archive-search:hover { border-color: var(--text-muted); }
.archive-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-icon { position: absolute; left: 17px; width: 19px; height: 19px; color: var(--text-muted); pointer-events: none; }
.search-input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 52px 0 48px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  -webkit-appearance: none;
  appearance: none;
}
.search-input::-webkit-search-cancel-button { opacity: .65; cursor: pointer; }
.search-input::placeholder { color: var(--text-muted); opacity: 1; }
.search-kbd {
  position: absolute;
  right: 15px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  pointer-events: none;
}
.feed-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; }
.feed-heading { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.feed-heading h2 { font-size: 18px; font-weight: 650; letter-spacing: -.015em; }
#toolbar-count { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sort-btn {
  min-height: 36px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.sort-btn:hover { border-color: var(--line); background: var(--surface); color: var(--text); }
.feed-region { min-height: 60vh; }
.load-status { padding: 32px 0; color: var(--text-muted); font-size: 14px; text-align: center; }
.empty-state { padding: 48px 24px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--text-muted); font-size: 14px; text-align: center; }

/* Month markers and posts */
.tg-month-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 32px 0 12px;
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--page);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .01em;
}
.tg-month-head:first-child { margin-top: 0; }
.tg-month-head span:last-child { color: var(--text-muted); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
.post-card {
  position: relative;
  margin-bottom: 12px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 1px oklch(0.25 0.02 205 / 2%);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.post-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.post-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.post-date { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; line-height: 1.5; }
.copy-btn { width: 32px; height: 32px; margin: -6px -8px -6px 0; border-radius: 7px; }
.copy-btn .icon { width: 15px; height: 15px; }
.post-text {
  margin-top: 9px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.text-link { color: var(--accent-deep); text-decoration: none; text-underline-offset: 3px; }
.text-link:hover { text-decoration: underline; }
.text-link-inline { display: inline; font-weight: 500; overflow-wrap: anywhere; word-break: break-all; }
.post-media { max-width: 100%; }
.post-image {
  width: auto;
  max-width: 100%;
  max-height: 360px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  object-fit: cover;
  cursor: zoom-in;
}
.attachment-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 16px; font-size: 14px; }
#list img, #lightbox, #lightbox img { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.tg-sentinel { padding: 22px 0 4px; color: var(--text-muted); font-size: 11px; text-align: center; }
.tg-skeleton { height: 112px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); animation: skeletonPulse 1.4s ease-in-out infinite alternate; }
@keyframes skeletonPulse { from { opacity: .48; } to { opacity: 1; } }

/* Quotes */
.tg-quote {
  position: relative;
  margin: 12px 0 0;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  overflow: hidden;
}
.tg-quote::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--accent); }
.tg-quote.is-expandable { cursor: pointer; }
.tg-quote.is-expandable:hover { background: var(--surface-hover); }
.tg-quote.is-missing::before { background: var(--line-strong); }
.tg-quote-name { display: block; color: var(--accent-deep); font-size: 12px; font-weight: 650; line-height: 1.5; }
.tg-quote-text { margin-top: 2px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-quote-text.is-placeholder { color: var(--text-muted); }
.tg-quote.is-open .tg-quote-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.tg-quote-hint { display: none; margin-top: 5px; color: var(--accent-deep); font-size: 11px; font-weight: 600; }
.tg-quote.is-open .tg-quote-hint { display: block; }

/* Sidebar */
.archive-sidebar { position: sticky; top: 24px; max-height: calc(100dvh - 48px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; overscroll-behavior: contain; }
.side-panel { padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.side-title { color: var(--text); font-size: 12px; font-weight: 650; letter-spacing: .02em; line-height: 1.5; }
.side-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.session-list { display: grid; gap: 4px; margin-top: 12px; }
.tg-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 550;
  text-align: left;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.tg-nav-item:hover { background: var(--surface-hover); color: var(--text); }
.tg-nav-item.is-active { border-color: var(--line); background: var(--surface); color: var(--accent-deep); box-shadow: 0 1px 2px oklch(0.25 0.02 205 / 3%); }
.tg-nav-count, .tg-month-count { color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.session-bar { height: 2px; margin-top: 12px; border-radius: 2px; background: var(--line); overflow: hidden; }
.session-bar > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 200ms ease; }
.subscribe-panel p { color: var(--text-secondary); font-size: 12px; line-height: 1.7; }
.subscribe-panel #subscribe-desc { margin-top: 10px; }
.subscribe-panel #subscribe-desc2 { margin-top: 5px; color: var(--text-muted); }
.subscribe-form { display: flex; gap: 8px; margin-top: 14px; }
.subscribe-input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}
.subscribe-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.subscribe-input::placeholder { color: var(--text-muted); }
.subscribe-btn {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--accent-deep);
  border-radius: 8px;
  background: var(--accent-deep);
  color: var(--paper-0);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 160ms ease, transform 160ms ease;
}
.dark .subscribe-btn { color: oklch(0.19 0.015 205); }
.subscribe-btn:hover { opacity: .88; }
.subscribe-btn:active { transform: scale(.97); }
.subscribe-feedback { margin-top: 10px; color: var(--accent-deep) !important; }
.subscribe-feedback.is-error { color: #b3261e !important; }
.dark .subscribe-feedback.is-error { color: #ffb4ab !important; }
#subscribe-card { display: none; }
.side-panel.is-flash { border-color: var(--accent); }

/* Timeline */
.timeline-heading { margin-bottom: 10px; }
.timeline-switch { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; }
.timeline-mode { display: grid; place-items: center; width: 30px; height: 28px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-muted); transition: background-color 160ms ease, color 160ms ease; }
.timeline-mode:hover { background: var(--surface-hover); color: var(--text); }
.timeline-mode.is-active { background: var(--surface); color: var(--accent-deep); }
.month-nav { display: grid; gap: 1px; max-height: min(42vh, 330px); padding-right: 4px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; overscroll-behavior: contain; }
.tg-month-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  gap: 12px;
  padding: 6px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: left;
  transition: background-color 150ms ease, color 150ms ease;
}
.tg-month-btn:hover { background: var(--surface-hover); color: var(--text); }
.tg-month-btn.is-active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.tg-muted { color: var(--text-muted); font-size: 12px; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.calendar-title { flex: 1; font-size: 12px; font-weight: 650; text-align: center; white-space: nowrap; }
.calendar-arrow { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-secondary); font-size: 20px; line-height: 1; }
.calendar-arrow:hover:not(:disabled) { background: var(--surface-hover); }
.calendar-arrow:disabled { opacity: .3; cursor: default; }
.calendar-week, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.calendar-week { margin-bottom: 3px; }
.tg-cal-weekday { padding: 2px 0; color: var(--text-muted); font-size: 9px; text-align: center; }
.tg-cal-cell { position: relative; display: flex; align-items: center; justify-content: center; height: 32px; min-height: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-secondary); font-size: 11px; font-variant-numeric: tabular-nums; }
.tg-cal-cell.is-outside, .tg-cal-cell.is-disabled { color: var(--line-strong); cursor: default; }
button.tg-cal-cell { color: var(--text); cursor: pointer; font-weight: 600; }
button.tg-cal-cell:hover { background: var(--surface-hover); }
.tg-cal-cell.has-post::after { content: ""; position: absolute; bottom: 3px; left: 50%; width: 3px; height: 3px; border-radius: 50%; background: var(--accent); transform: translateX(-50%); }
.tg-cal-cell.is-active { background: var(--accent-soft); color: var(--accent-deep); }
.calendar-hint { margin-top: 8px; color: var(--text-muted); font-size: 11px; }
.calendar-hint:empty { display: none; }
.site-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--text-muted); font-size: 11px; }
.site-footer a, .site-footer button { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0; border: 0; background: transparent; color: inherit; font-size: inherit; text-decoration: none; }
.site-footer a:hover, .site-footer button:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }
.tg-desktop-only { display: none; }

/* Persistent utility */
.back-top {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-secondary);
  box-shadow: var(--shadow);
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.back-top.is-visible { display: grid; }
.back-top:hover { background: var(--surface-hover); color: var(--text); transform: translateY(-2px); }

/* Dialogs */
.lightbox, .modal { position: fixed; inset: 0; z-index: 50; align-items: center; justify-content: center; padding: 20px; background: var(--overlay); overscroll-behavior: contain; }
.lightbox { touch-action: none; user-select: none; }
.lightbox-close { position: absolute; top: 20px; right: 20px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid oklch(0.95 0 0 / 25%); border-radius: 50%; background: oklch(0.15 0.01 205 / 45%); color: oklch(0.95 0 0); }
.lightbox-close:hover { background: oklch(0.3 0.01 205 / 60%); }
#lightboxImg { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; box-shadow: 0 20px 70px oklch(0 0 0 / 35%); }
.modal { z-index: 60; overflow-y: auto; }
.about-panel { width: min(560px, 100%); max-height: min(760px, calc(100dvh - 40px)); padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 80px oklch(0.08 0.01 205 / 25%); overflow-y: auto; overscroll-behavior: contain; }
.about-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.about-heading h2 { margin-top: 5px; font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.about-lead { margin-top: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); color: var(--text-secondary); font-size: 14px; line-height: 1.75; }
.about-sections { display: grid; gap: 20px; margin-top: 22px; }
.about-sections h3 { margin-bottom: 5px; color: var(--accent-deep); font-size: 12px; font-weight: 650; }
.about-sections p { color: var(--text-secondary); font-size: 13px; line-height: 1.8; }

@media (min-width: 1024px) {
  .tg-desktop-only { display: block; }
  #subscribe-card:not(.tg-dismissed) { display: block; }
  #subscribe-card.is-open { display: block; }
}

@media (max-width: 1023px) {
  .site-shell { width: min(820px, calc(100% - 40px)); padding-top: 28px; }
  .header-bottom { gap: 28px; }
  .archive-stats { gap: 20px; }
  .site-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 28px; }
  .archive-sidebar { display: contents; }
  .channels-panel { order: 0; margin: 0; padding: 0; border: 0; }
  .session-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 9px; }
  .tg-nav-item { min-height: 44px; border-color: var(--line); background: var(--surface); }
  .session-bar { display: none; }
  .archive-main { order: 1; }
  #subscribe-card.is-open { display: block; order: 2; margin: 0; }
  .site-footer { order: 3; justify-content: center; padding-top: 16px; border-top: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .site-shell { width: calc(100% - 32px); padding: 20px 0 48px; }
  .site-header { padding-bottom: 22px; }
  .header-main { align-items: flex-start; flex-direction: column; gap: 18px; }
  .brand-block { gap: 13px; }
  .brand-avatar { width: 54px; height: 54px; border-radius: 13px; }
  .brand-overline { font-size: 12px; letter-spacing: .12em; }
  .site-title { gap: 8px; font-size: 20px; }
  .brand-name { font-size: 31px; }
  .title-divider { font-size: 22px; }
  .header-actions { width: 100%; justify-content: space-between; gap: 2px; }
  .language-switch { flex: 1; justify-content: space-between; max-width: 170px; }
  .lang-btn { min-width: 44px; min-height: 44px; }
  .action-divider { margin: 0 4px; }
  .icon-btn { width: 44px; height: 44px; }
  .header-bottom { grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 24px; }
  .site-description { font-size: 14px; }
  .archive-meta { font-size: 12px; }
  .archive-stats { width: 100%; gap: 12px; }
  .stat-item { padding-top: 10px; border-top: 1px solid var(--line); }
  .stat-item dt { font-size: 12px; }
  .stat-item dd { font-size: 21px; }
  .site-layout { margin-top: 20px; }
  /* 移动端把订阅卡片放到频道列表上方，避免无限加载把它顶到页面底部 */
  #subscribe-card.is-open { order: -1; margin: 0 0 20px; }
  .archive-search { height: 50px; }
  .search-input { font-size: 16px; }
  .feed-meta { margin-top: 16px; }
  .sort-btn { min-height: 44px; }
  .post-card { padding: 17px 16px; border-radius: 10px; }
  .post-date { font-size: 12px; }
  .copy-btn { width: 44px; height: 44px; margin: -12px -12px -10px 0; }
  .post-text { font-size: 16px; line-height: 1.8; }
  .post-image { max-height: 300px; }
  .tg-month-head { margin-top: 26px; }
  .tg-month-head span:last-child, .tg-sentinel, .site-footer { font-size: 12px; }
  .subscribe-input, .subscribe-btn, .site-footer a, .site-footer button { min-height: 44px; }
  .search-kbd { display: none; }
  .search-input { padding-right: 20px; }
  .back-top { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .about-panel { padding: 22px 20px; border-radius: 13px; }
  .modal { padding: 12px; }
  .lightbox { padding: 12px; }
}

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