/* 全站共享样式：设计变量（深色 / 浅色）、文章排版、独立文章页布局与共享阅读组件。
   首页专属布局放在 home.css；代码高亮配色放在按需加载的 highlight.css。

   设计规范
   - 颜色：一个主色（翡翠绿）+ 一套冷灰中性色；提示 / 注意只用于色条与标签。
   - 字号：12 / 13 / 14 / 16.5（正文）/ 20 / 24 / 32。
   - 间距：4 的倍数。圆角：6 / 10 / 14。阴影只用于浮层。 */

:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #11161d;
  --surface-2: #161c24;
  --surface-hover: rgba(148, 163, 184, 0.08);
  --border: #222a35;
  --border-strong: #2e3846;
  --text: #f1f4f8;
  --text-2: #d4dae3;
  --muted: #8a94a3;
  --accent: #34d399;
  --accent-text: #34d399;
  --accent-strong: #6ee7b7;
  --accent-soft: rgba(52, 211, 153, 0.1);
  --accent-border: rgba(52, 211, 153, 0.36);
  --link: var(--accent-text);
  --code-bg: #0f141a;
  --inline-code-bg: rgba(148, 163, 184, 0.14);
  --tip: #22d3ee;
  --warn: #fbbf24;
  --warn-border: rgba(251, 191, 36, 0.45);
  --mark-bg: rgba(52, 211, 153, 0.28);
  --header-bg: rgba(11, 15, 20, 0.86);
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --font-body: 16px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --anchor-offset: 24px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #f7f8fa;
    --surface-2: #eef1f4;
    --surface-hover: rgba(15, 23, 42, 0.05);
    --border: #e5e8ec;
    --border-strong: #d5dae1;
    --text: #111827;
    --text-2: #2b3440;
    --muted: #5b6573;
    --accent: #059669;
    --accent-text: #047857;
    --accent-strong: #065f46;
    --accent-soft: #ecfdf5;
    --accent-border: rgba(4, 120, 87, 0.34);
    --code-bg: #f6f8fa;
    --inline-code-bg: rgba(15, 23, 42, 0.06);
    --tip: #0e7490;
    --warn: #b45309;
    --warn-border: rgba(180, 83, 9, 0.4);
    --mark-bg: rgba(16, 185, 129, 0.22);
    --header-bg: rgba(255, 255, 255, 0.88);
    --overlay: rgba(15, 23, 42, 0.35);
    --shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f7f8fa;
  --surface-2: #eef1f4;
  --surface-hover: rgba(15, 23, 42, 0.05);
  --border: #e5e8ec;
  --border-strong: #d5dae1;
  --text: #111827;
  --text-2: #2b3440;
  --muted: #5b6573;
  --accent: #059669;
  --accent-text: #047857;
  --accent-strong: #065f46;
  --accent-soft: #ecfdf5;
  --accent-border: rgba(4, 120, 87, 0.34);
  --code-bg: #f6f8fa;
  --inline-code-bg: rgba(15, 23, 42, 0.06);
  --tip: #0e7490;
  --warn: #b45309;
  --warn-border: rgba(180, 83, 9, 0.4);
  --mark-bg: rgba(16, 185, 129, 0.22);
  --header-bg: rgba(255, 255, 255, 0.88);
  --overlay: rgba(15, 23, 42, 0.35);
  --shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

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

html.is-scroll-locked {
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--text-2);
  background: var(--bg);
  font-family: var(--font-sans);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--mark-bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

mark {
  border-radius: 3px;
  color: inherit;
  background: var(--mark-bg);
}

/* ---------- 文章排版（首页内联与独立文章页共用） ---------- */

.article {
  min-width: 0;
  color: var(--text-2);
  font-size: var(--font-body);
  line-height: 1.8;
  overflow-wrap: break-word;
}

.article > :first-child {
  margin-top: 0;
}

.post-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.article h1 {
  margin: 0.2em 0 0.45em;
  color: var(--text);
  font-size: clamp(1.6rem, 1.25rem + 1.5vw, 2rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* 文章信息行：阅读时长 · 章节数 · 更新日期。 */
.article .article-meta {
  margin: -0.1em 0 1.6em;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* 导语：标题后的第一段略大、略浅，承担摘要作用。 */
.article h1 + p:not(.article-meta),
.article .article-meta + p {
  color: var(--muted);
  font-size: 1.06em;
}

.article h2 {
  margin: 2.4em 0 0.8em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  font-weight: 700;
  line-height: 1.4;
}

.article h3 {
  margin: 1.8em 0 0.6em;
  color: var(--text);
  font-size: clamp(1.08rem, 1rem + 0.35vw, 1.25rem);
  font-weight: 650;
  line-height: 1.45;
}

.article h2,
.article h3,
.article section {
  scroll-margin-top: var(--anchor-offset);
}

/* 标题序号单独着色，标题文字保持标题色，层级更清楚。 */
.heading-num {
  margin-right: 0.4em;
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-weight: 600;
}

/* 悬停标题时出现 #，点击复制本节链接。 */
.heading-anchor {
  display: inline-block;
  margin-left: 0.35em;
  padding: 0 0.2em;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 500;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.heading-anchor::before {
  content: "#";
}

.article h2:hover .heading-anchor,
.article h3:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--accent-text);
}

.article p {
  margin: 0 0 1.15em;
}

.article ul,
.article ol {
  margin: 0 0 1.15em;
  padding-left: 1.5em;
}

.article li + li {
  margin-top: 0.4em;
}

.article li::marker {
  color: var(--muted);
}

.article a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article a:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

.article .heading-anchor {
  color: var(--muted);
  text-decoration: none;
}

.article strong {
  color: var(--text);
  font-weight: 650;
}

.article hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* 提示 / 注意：只用左侧色条与标签着色，正文保持正文色。 */
.article-note,
.article-warning {
  margin: 1.5em 0;
  padding: 12px 16px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--tip);
  border-radius: var(--radius);
  color: var(--text-2);
  background: var(--surface);
}

.article-note::before,
.article-warning::before {
  content: "提示";
  display: block;
  margin-bottom: 4px;
  color: var(--tip);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.article-warning {
  border-left-color: var(--warn);
}

.article-warning::before {
  content: "注意";
  color: var(--warn);
}

.article-note > :last-child,
.article-warning > :last-child {
  margin-bottom: 0;
}

/* 引用 / 摘录：左侧细线 + 略大的衬线字体，出处右对齐。 */
.article blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  font-size: 1.06em;
  line-height: 1.9;
}

.article blockquote p {
  margin: 0 0 0.6em;
}

.article blockquote p:last-child {
  margin-bottom: 0;
}

.article blockquote footer {
  margin-top: 0.5em;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.86em;
  text-align: right;
}

.article blockquote footer::before {
  content: "—— ";
}

.article figure {
  margin: 1.8em 0;
}

.article figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.article img {
  max-width: 100%;
  height: auto;
}

.article figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.article table {
  width: 100%;
  margin: 1.4em 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  line-height: 1.6;
}

.article th,
.article td {
  padding: 8px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.article tr > :first-child {
  border-left: 1px solid var(--border);
}

.article thead th,
.article table > tr:first-child > *,
.article tbody:first-child > tr:first-child > * {
  border-top: 1px solid var(--border);
}

.article th {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 600;
}

.article td {
  background: var(--bg);
}

.article tbody tr:nth-child(even) td {
  background: var(--surface);
}

.article td.is-num,
.article th.is-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* 宽表格在块内横向滚动，第一列固定。 */
.table-scroll {
  margin: 1.4em 0;
  overflow-x: auto;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

.table-scroll > table {
  min-width: 560px;
  margin: 0;
}

.table-scroll th:first-child,
.table-scroll td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
}

.article code {
  padding: 0.12em 0.38em;
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--inline-code-bg);
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.article pre {
  overflow-x: auto;
  margin: 1.4em 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  line-height: 1.6;
  tab-size: 4;
  -webkit-overflow-scrolling: touch;
}

.article pre code {
  display: block;
  padding: 0;
  border-radius: 0;
  color: var(--text-2);
  background: none;
  font-size: 13.5px;
}

/* ---------- 代码块：顶栏（语言 + 复制），超长代码折叠 ---------- */

.code-block-wrap {
  position: relative;
  margin: 1.4em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 0 6px 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.code-lang {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.article .code-block-wrap pre {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.copy-code-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 28px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.copy-code-button:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-hover);
}

.code-block-wrap.is-collapsed pre {
  max-height: 26em;
  overflow-y: hidden;
}

.code-block-wrap.is-collapsed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 44px;
  left: 0;
  height: 72px;
  background: linear-gradient(to bottom, transparent, var(--code-bg));
  pointer-events: none;
}

.code-expand-button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-top: 1px solid var(--border);
  color: var(--accent-text);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.code-expand-button:hover {
  background: var(--surface-hover);
}

/* ---------- 独立文章页：左侧目录 + 正文；窄屏目录改为底部弹层 ---------- */

/* 旧版顶部返回链接不显示，返回入口统一放在目录卡片与底部工具条。 */
.article-topbar {
  display: none !important;
}

.article-page-shell {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 20px 16px calc(104px + env(safe-area-inset-bottom));
}

.article-footer {
  margin-top: 2.4em;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.article-sidebar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  max-height: 75dvh;
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0.25s;
}

.toc-open .article-sidebar {
  transform: none;
  visibility: visible;
}

.article-nav-card {
  display: flex;
  flex-direction: column;
  max-height: 75dvh;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.article-nav-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.article-nav-actions a,
.article-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: none;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}

.article-theme-toggle .ui-icon {
  width: 16px;
  height: 16px;
}

.article-nav-actions a:hover,
.article-theme-toggle:hover {
  color: var(--accent-text);
}

.article-nav-title {
  padding: 12px 16px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.article-nav {
  display: grid;
  align-content: start;
  gap: 2px;
  min-height: 0;
  padding: 0 8px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.article-nav a {
  padding: 6px 10px 6px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.article-nav a.article-nav-sub {
  display: none;
  padding-left: 26px;
  font-size: 13px;
}

.article-nav a.article-nav-sub.is-visible {
  display: block;
}

.article-nav a:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.article-nav a.active {
  border-left-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-soft);
}

.toc-top-button {
  flex: 0 0 auto;
  margin: 0 8px calc(10px + env(safe-area-inset-bottom));
  padding: 8px 12px;
  border: 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.toc-top-button:hover {
  color: var(--accent-text);
}

/* 底部弹层顶部的拖拽条：下滑关闭。 */
.sheet-handle {
  display: flex;
  flex: 0 0 auto;
  justify-content: center;
  padding: 8px 0 2px;
  touch-action: none;
  cursor: grab;
}

.sheet-handle::before {
  content: "";
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
}

@media (min-width: 720px) {
  .article-page-shell {
    padding: 32px 24px calc(104px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 1080px) {
  .article-page-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 44rem);
    gap: 56px;
    align-items: start;
    justify-content: center;
    max-width: none;
    padding: 40px 32px 72px;
  }

  .article-sidebar {
    position: sticky;
    top: 24px;
    z-index: auto;
    grid-column: 1;
    grid-row: 1;
    max-height: calc(100dvh - 48px);
    transform: none;
    visibility: visible;
    transition: none;
  }

  .article-nav-card {
    max-height: calc(100dvh - 48px);
    border-radius: var(--radius-lg);
    box-shadow: none;
  }

  .article-page-shell > .article {
    grid-column: 2;
    grid-row: 1;
    font-size: 16.5px;
  }

  .article-page .reader-dock,
  .article-sidebar .sheet-handle {
    display: none;
  }
}

/* ---------- 共享阅读组件 ---------- */

.reading-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 80;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

.page-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--overlay);
  backdrop-filter: blur(2px);
}

.reader-dock {
  position: fixed;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 40;
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--header-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* 向下阅读时工具条与顶栏一起收起，向上滚动时出现。 */
.is-scrolling-down .reader-dock {
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(100% + 16px));
}

.reader-dock-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.reader-dock-button:hover,
.reader-dock-button[aria-expanded="true"] {
  color: var(--text);
  background: var(--surface-hover);
}

.reader-dock-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.site-toast {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 90;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

@media (min-width: 720px) {
  .reader-dock {
    right: 20px;
    bottom: 20px;
    left: auto;
    grid-auto-columns: auto;
  }

  .reader-dock-button {
    min-width: 58px;
  }
}

/* ---------- 图片：电脑端滚轮 / 加减键缩放；触屏点击全屏查看 ---------- */

.article-image-zoom-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: zoom-in;
}

.article-image-zoom-container > img {
  display: block;
  transform-origin: center center;
  transition: transform 0.12s ease;
  user-select: none;
  cursor: zoom-in;
}

.article-image-zoom-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.article-image-zoom-container:hover .article-image-zoom-controls,
.article-image-zoom-container:focus-within .article-image-zoom-controls,
.article-image-zoom-container.is-zoomed .article-image-zoom-controls {
  opacity: 1;
  pointer-events: auto;
}

.article-image-zoom-control {
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  font: 700 14px/1 var(--font-sans);
  cursor: pointer;
}

.article-image-zoom-reset {
  min-width: 46px;
  font-size: 12px;
}

.article-image-zoom-control:hover:not(:disabled) {
  border-color: var(--accent-border);
  color: var(--accent-text);
}

.article-image-zoom-control:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.article-image-zoom-container.is-zoomed,
.article-image-zoom-container.is-zoomed > img {
  cursor: grab;
}

.article-image-zoom-container.is-zoomed > img {
  touch-action: none;
}

.article-image-zoom-container.is-dragging,
.article-image-zoom-container.is-dragging > img {
  cursor: grabbing;
}

.article-image-zoom-container:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.image-viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  color: #f1f4f8;
  background: rgba(0, 0, 0, 0.94);
}

.image-viewer::backdrop {
  background: rgba(0, 0, 0, 0.94);
}

.image-viewer-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: auto;
  touch-action: pan-x pan-y pinch-zoom;
}

.image-viewer-stage img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  margin: auto;
}

.image-viewer.is-enlarged .image-viewer-stage img {
  width: 220%;
}

.image-viewer-close {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  z-index: 1;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  color: #f1f4f8;
  background: rgba(255, 255, 255, 0.14);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.image-viewer-caption {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 16px;
  margin: 0;
  color: rgba(241, 244, 248, 0.78);
  font-size: 13px;
  text-align: center;
}

/* 触屏设备：缩放按钮不显示，改为点击图片全屏查看。 */
@media (hover: none) {
  .article-image-zoom-controls {
    display: none;
  }

  .article-image-zoom-container,
  .article-image-zoom-container > img {
    cursor: pointer;
  }

  .heading-anchor {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-image-zoom-container > img,
  .article-image-zoom-controls,
  .article-sidebar,
  .reader-dock,
  .site-toast {
    transition: none;
  }
}

@media print {
  .reading-progress,
  .reader-dock,
  .page-overlay,
  .article-sidebar,
  .copy-code-button,
  .code-expand-button,
  .heading-anchor,
  .article-image-zoom-controls {
    display: none !important;
  }

  .article-page-shell {
    display: block;
    max-width: none;
    padding: 0;
  }

  .code-block-wrap.is-collapsed pre {
    max-height: none;
  }
}
