/*!
 * 小番茄解混淆 · 全站样式
 * 设计原则：单文件、无外部依赖、移动优先、深浅色自适应。
 * 主色取番茄红，辅色取叶片绿，正文用中性灰保证长时间阅读不累眼。
 */

/* ═══════════════ 1. 设计变量 ═══════════════ */
:root {
  --tomato: #d93a2b;
  --tomato-dark: #b32c20;
  --tomato-soft: #fdeceb;
  --leaf: #1f8a4c;
  --leaf-soft: #e8f6ed;

  --ink: #1d1a19;
  --ink-2: #4b4441;
  --ink-3: #756b67;
  --line: #e6dedb;
  --line-soft: #f1ebe9;
  --bg: #ffffff;
  --bg-2: #faf7f6;
  --bg-3: #f4efee;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(29, 26, 25, .06), 0 8px 24px rgba(29, 26, 25, .06);
  --shadow-lg: 0 12px 36px rgba(29, 26, 25, .12);

  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 20px;
  --wrap: 1160px;
  --head-h: 62px;

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
          system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tomato: #ff6a58;
    --tomato-dark: #ff8574;
    --tomato-soft: #2c1a19;
    --leaf: #57c98a;
    --leaf-soft: #16281d;

    --ink: #f1eae8;
    --ink-2: #cbc2bf;
    --ink-3: #a29895;
    --line: #3a3230;
    --line-soft: #2c2624;
    --bg: #161413;
    --bg-2: #1c1918;
    --bg-3: #221e1d;
    --card: #1e1b1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, .55);
  }
}

/* ═══════════════ 2. 基础 ═══════════════ */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

body.nav-open { overflow: hidden; }

h1, h2, h3, h4 {
  margin: 0 0 .6em;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.3rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.7rem); }
h3 { font-size: 1.14rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1em; }
a { color: var(--tomato); text-decoration: none; }
a:hover { color: var(--tomato-dark); text-decoration: underline; }
img { max-width: 100%; height: auto; }
ul, ol { margin: 0 0 1em; padding-left: 1.35em; }
li { margin: .3em 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
code, kbd, pre { font-family: var(--mono); font-size: .92em; }
code {
  background: var(--bg-3);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: .1em .38em;
  word-break: break-word;
}
pre {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.6;
}
pre code { background: none; border: 0; padding: 0; }

:focus-visible {
  outline: 3px solid var(--tomato);
  outline: 3px solid color-mix(in srgb, var(--tomato) 55%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 18px; }
.wrap--narrow { max-width: 860px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--tomato);
  color: #fff;
  padding: 10px 16px;
  z-index: 200;
}
.skip-link:focus { left: 8px; top: 8px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ═══════════════ 3. 页头与导航 ═══════════════ */
.site-head {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-head__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--head-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.06rem;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--tomato); }
/* 站标使用脚本生成的图标（favicon.svg）：番茄红底 + 按希尔伯特曲线顺序排布的色块，
   正是"像素被打乱"这件事的缩影，与工具本身同源。 */
.brand__mark {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  display: block;
  box-shadow: 0 3px 10px rgba(217, 58, 43, .3);
}

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav__link {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: .94rem;
  font-weight: 600;
  white-space: nowrap;
}
.nav__link:hover { background: var(--bg-3); color: var(--ink); text-decoration: none; }
.nav__link[aria-current="page"] { background: var(--tomato-soft); color: var(--tomato-dark); }

.nav-toggle {
  margin-left: auto;
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  padding: 0;
  place-items: center;
}
.nav-toggle__box { display: grid; gap: 5px; width: 20px; }
.nav-toggle__bar {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform .22s ease, opacity .18s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-drawer {
  display: none;
  position: fixed;
  inset: var(--head-h) 0 0 0;
  background: var(--bg);
  padding: 18px 18px 40px;
  overflow-y: auto;
  transform: translateY(-6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 99;
}
.nav-drawer[data-open="true"] { opacity: 1; transform: none; pointer-events: auto; }
.nav-drawer__group { margin-bottom: 18px; }
.nav-drawer__label {
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--ink-3);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.nav-drawer a {
  display: block;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--ink);
  font-weight: 600;
  border: 1px solid transparent;
}
.nav-drawer a:hover { background: var(--bg-2); text-decoration: none; }
.nav-drawer a[aria-current="page"] { background: var(--tomato-soft); color: var(--tomato-dark); border-color: color-mix(in srgb, var(--tomato) 25%, transparent); }
.nav-drawer__note { color: var(--ink-3); font-size: .86rem; padding: 0 12px; }

@media (max-width: 920px) {
  .nav { display: none; }
  .nav-toggle { display: grid; }
  .nav-drawer { display: block; }
}

/* ═══════════════ 4. 通用区块 ═══════════════ */
.section { padding: 42px 0; }
.section--tight { padding: 26px 0; }
.section--alt { background: var(--bg-2); border-block: 1px solid var(--line-soft); }

.section__head { max-width: 780px; margin-bottom: 22px; }
.section__title { margin-bottom: .35em; }
.section__desc { color: var(--ink-2); margin: 0; }

.eyebrow {
  display: inline-block;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tomato);
  margin-bottom: 10px;
}

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.card__title { margin: 0 0 .4em; font-size: 1.06rem; }
.card__title a { color: var(--ink); }
.card__title a:hover { color: var(--tomato); }
.card p:last-child { margin-bottom: 0; }
.card__meta { color: var(--ink-3); font-size: .85rem; }
.card--link { transition: transform .16s ease, box-shadow .16s ease; }
.card--link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card__icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--tomato-soft);
  color: var(--tomato-dark);
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tag {
  font-size: .84rem;
  color: var(--ink-2);
  background: var(--bg-3);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 3px 11px;
}

.pill {
  display: inline-block;
  font-size: .74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--leaf-soft);
  color: var(--leaf);
  vertical-align: middle;
}

/* ═══════════════ 5. 首页英雄区 ═══════════════ */
.hero {
  padding: 34px 0 8px;
  background: var(--bg);
  background:
    radial-gradient(1200px 320px at 12% -40%, color-mix(in srgb, var(--tomato) 14%, transparent), transparent 70%),
    radial-gradient(900px 260px at 88% -30%, color-mix(in srgb, var(--leaf) 12%, transparent), transparent 72%);
}
.hero__inner { max-width: 900px; }
.hero__title { margin-bottom: .28em; }
.hero__lead { font-size: 1.06rem; color: var(--ink-2); margin-bottom: 14px; }
.hero__list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--ink-2); font-size: .93rem; }
.hero__list li { margin: 0; }
.hero__list li::before { content: "✓"; color: var(--leaf); font-weight: 800; margin-right: 6px; }

/* ═══════════════ 6. 工具面板 ═══════════════ */
.tool {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  margin-top: 18px;
}
@media (max-width: 640px) { .tool { padding: 14px; border-radius: var(--radius); } }

.tool__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.tool__head h2 { margin: 0; font-size: 1.12rem; }
.tool__hint { margin: 0; color: var(--ink-3); font-size: .88rem; }

/* 手机端把首屏让给工具本身：这句长说明隐藏，同样的信息在下方
   “三步就能完成一次混淆”“本地处理”等模块里都有，不影响内容完整性。 */
@media (max-width: 640px) {
  .tool__hint--desktop { display: none; }
}

.tool__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.tool__bar--split { justify-content: space-between; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  font-size: .95rem;
  padding: 10px 18px;
  border-radius: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform .12s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
  text-align: center;
}
.btn:hover { background: var(--bg-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(140deg, var(--tomato), #ef6a4a);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(217, 58, 43, .28);
}
.btn--primary:hover { background: linear-gradient(140deg, var(--tomato-dark), #e05a3a); color: #fff; }
.btn--ghost { background: var(--bg-2); }
.btn--plain { border-color: transparent; background: none; color: var(--ink-3); }
.btn--sm { padding: 6px 12px; font-size: .86rem; border-radius: 9px; }
.btn--block { width: 100%; }

.file-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
}
.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 200px;
}

.stage {
  position: relative;
  min-height: 220px;
  border: 1px dashed var(--tomato);
  border: 1px dashed color-mix(in srgb, var(--tomato) 35%, var(--line));
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, var(--bg-3) 25%, transparent 25%, transparent 75%, var(--bg-3) 75%) 0 0 / 22px 22px,
    linear-gradient(45deg, var(--bg-3) 25%, transparent 25%, transparent 75%, var(--bg-3) 75%) 11px 11px / 22px 22px,
    var(--bg-2);
  padding: 14px;
  display: grid;
  place-items: center;
  transition: border-color .16s ease, background-color .16s ease;
  overflow: hidden;
}
.stage.is-dropping { border-color: var(--tomato); background-color: var(--tomato-soft); }
.stage img { display: none; max-height: 62vh; border-radius: var(--radius-s); box-shadow: var(--shadow); background: #fff; }
.stage.has-image .stage__placeholder { display: none; }
.stage.has-image { padding: 14px; }
.stage__placeholder { text-align: center; color: var(--ink-3); padding: 28px 12px; }
.stage__placeholder strong { display: block; color: var(--ink-2); font-size: 1.02rem; margin-bottom: 6px; }
.stage__placeholder span { font-size: .88rem; }

.stage__busy {
  position: absolute;
  inset: 0;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 3;
}
.stage__busy[hidden] { display: none; }
.stage__busy-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: .95rem;
}
.spinner {
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--tomato) 30%, transparent);
  border-top-color: var(--tomato);
  animation: spin .8s linear infinite;
  flex: 0 0 17px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  html { scroll-behavior: auto; }
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.meta-list li {
  margin: 0;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 9px 12px;
  font-size: .88rem;
  min-width: 0;
}
.meta-list dt, .meta-list__label {
  display: block;
  color: var(--ink-3);
  font-size: .76rem;
  letter-spacing: .06em;
  margin-bottom: 2px;
}
.meta-list__value {
  font-weight: 650;
  word-break: break-all;
  display: block;
}

.privacy-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-s);
  background: var(--leaf-soft);
  color: var(--leaf);
  color: color-mix(in srgb, var(--leaf) 78%, var(--ink));
  font-size: .89rem;
}
.privacy-note strong { color: var(--leaf); }

/* ═══════════════ 7. 步骤 / 表格 / 提示 ═══════════════ */
.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); counter-reset: step; }
.step {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px 62px;
  box-shadow: var(--shadow);
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 16px; top: 16px;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--tomato-soft);
  color: var(--tomato-dark);
  display: grid; place-items: center;
  font-weight: 800;
}
.step h3 { margin-bottom: .3em; font-size: 1.02rem; }
.step p { margin: 0; color: var(--ink-2); font-size: .93rem; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; }
table.tbl caption { text-align: left; padding: 12px 14px 0; color: var(--ink-3); font-size: .85rem; }
table.tbl th, table.tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.tbl thead th { background: var(--bg-3); font-weight: 700; white-space: nowrap; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--bg-2); }

.callout {
  border: 1px solid var(--line);
  border-left: 4px solid var(--tomato);
  background: var(--bg-2);
  border-radius: var(--radius-s);
  padding: 14px 16px;
  margin: 18px 0;
  font-size: .94rem;
}
.callout--warn { border-left-color: #d97706; background: var(--bg-2); background: color-mix(in srgb, #f59e0b 8%, var(--bg)); }
.callout--ok { border-left-color: var(--leaf); background: var(--leaf-soft); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout__title { font-weight: 700; display: block; margin-bottom: 4px; }

/* ═══════════════ 8. 问答折叠 ═══════════════ */
.faq { display: grid; gap: 10px; }
.faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
}
.faq summary {
  cursor: pointer;
  padding: 15px 18px;
  font-weight: 650;
  list-style: none;
  position: relative;
  padding-right: 46px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 18px; top: 50%;
  transform: translateY(-50%);
  color: var(--tomato);
  font-size: 1.25rem;
  font-weight: 700;
  transition: transform .18s ease;
}
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 18px 16px; color: var(--ink-2); font-size: .95rem; }
.faq details > div > *:last-child { margin-bottom: 0; }

/* ── 单页版：小节之间的节奏与芯片目录 ── */
.section + .section { border-top: 1px solid var(--line-soft); }
.section--alt + .section, .section + .section--alt { border-top-color: transparent; }

.chip-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
  padding: 0;
}
.chip-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;              /* 触屏点按目标 */
  font-size: .86rem;
  line-height: 1.5;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--line-soft);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip-nav a:hover {
  background: var(--tomato-soft);
  border-color: color-mix(in srgb, var(--tomato) 35%, transparent);
  color: var(--tomato-dark);
  text-decoration: none;
}

/* 小节内部的次级区块：不再重复整段内边距 */
.subsection { margin-top: 34px; }
.subsection > .section__head { margin-bottom: 18px; }

/* 小节标题在页内导航跳转时需要留出吸顶高度 */
.section[id] { scroll-margin-top: 84px; }

/* ═══════════════ 9. 正文排版（内页） ═══════════════ */
.page-head { padding: 30px 0 6px; }
.crumb { font-size: .85rem; color: var(--ink-3); margin-bottom: 10px; }
.crumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.crumb li { margin: 0; }
.crumb li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.crumb a { color: var(--ink-3); }
.page-head__lead { color: var(--ink-2); font-size: 1.02rem; max-width: 800px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 34px;
  align-items: start;
  padding-bottom: 40px;
}
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; gap: 20px; } }

.prose { min-width: 0; max-width: 920px; }
.prose--wide { max-width: none; }
.prose h2 { margin-top: 1.9em; padding-top: .2em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.5em; }
.prose table.tbl { min-width: 460px; }
.prose figure { margin: 20px 0; }
.prose figcaption { color: var(--ink-3); font-size: .85rem; text-align: center; margin-top: 8px; }
.prose blockquote {
  margin: 18px 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--line);
  color: var(--ink-2);
}
.prose .kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 14px; font-size: .94rem; }
.prose .kv dt { color: var(--ink-3); }
.prose .kv dd { margin: 0; }

.toc {
  position: sticky;
  top: calc(var(--head-h) + 18px);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: .9rem;
}
.toc h2 { font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: toc; }
.toc li { margin: 2px 0; }
.toc a { display: block; padding: 5px 8px; border-radius: 8px; color: var(--ink-2); }
.toc a:hover { background: var(--bg-3); text-decoration: none; }
.toc a[aria-current="true"] { background: var(--tomato-soft); color: var(--tomato-dark); font-weight: 650; }
@media (max-width: 980px) {
  .toc { position: static; }
  .toc ol { columns: 2; column-gap: 12px; }
}
@media (max-width: 560px) { .toc ol { columns: 1; } }

.side-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  box-shadow: var(--shadow);
}
.side-card h2 { font-size: .98rem; margin-bottom: .5em; }
.side-card ul { padding-left: 1.1em; margin-bottom: 0; font-size: .92rem; }

.related { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.related a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font-weight: 650;
}
.related a:hover { text-decoration: none; border-color: color-mix(in srgb, var(--tomato) 45%, var(--line)); box-shadow: var(--shadow); }
.related small { display: block; color: var(--ink-3); font-weight: 500; margin-top: 4px; font-size: .84rem; }

/* ═══════════════ 10. 曲线实验室 ═══════════════ */
.lab { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 820px) { .lab { grid-template-columns: 1fr; } }
.lab__panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.lab__panel h3 { margin-bottom: .3em; }
.lab__panel p { color: var(--ink-3); font-size: .88rem; }
.lab__canvas { display: grid; place-items: center; }
.lab__canvas canvas { border-radius: var(--radius-s); border: 1px solid var(--line); background: #fff; max-width: 100%; }
.lab__controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin: 16px 0 4px; }
.lab__controls label { font-size: .9rem; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; }
.lab__controls select, .lab__controls input[type="range"] { font: inherit; }
.lab__controls select {
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}
.lab__readout {
  margin-top: 12px;
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  font-size: .9rem;
  color: var(--ink-2);
}
.lab__readout strong { color: var(--tomato-dark); }

/* ═══════════════ 11. 批量页 ═══════════════ */
.batch-drop {
  border: 2px dashed var(--tomato);
  border: 2px dashed color-mix(in srgb, var(--tomato) 35%, var(--line));
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 26px 18px;
  text-align: center;
  transition: border-color .16s ease, background .16s ease;
}
.batch-drop.is-dropping { border-color: var(--tomato); background: var(--tomato-soft); }
.batch-drop p { margin: 0 0 12px; color: var(--ink-2); }

.batch-opts { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; margin: 16px 0; font-size: .93rem; }
.batch-opts label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }

.progress { margin: 14px 0; }
.progress__track { height: 8px; border-radius: 999px; background: var(--bg-3); overflow: hidden; }
.progress__bar { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--tomato), #f0894f); transition: width .25s ease; }
.progress__text { font-size: .87rem; color: var(--ink-3); margin: 7px 0 0; }

.batch-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.batch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.batch-item__thumb {
  width: 54px; height: 54px;
  flex: 0 0 54px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-3);
  display: grid; place-items: center;
}
.batch-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.batch-item__ph { color: var(--ink-3); font-weight: 700; }
.batch-item__meta { min-width: 0; flex: 1 1 auto; }
.batch-item__name { margin: 0; font-weight: 650; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-item__sub { margin: 2px 0 0; color: var(--ink-3); font-size: .82rem; }
.batch-item__ops { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
@media (max-width: 560px) {
  .batch-item { flex-wrap: wrap; }
  .batch-item__ops { width: 100%; justify-content: flex-end; }
}
.batch-empty { color: var(--ink-3); font-size: .92rem; padding: 14px 2px; }

/* ═══════════════ 12. 广告位与页脚 ═══════════════ */
.ad-slot {
  margin: 28px auto;
  max-width: var(--wrap);
  padding: 12px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  text-align: center;
  color: var(--ink-3);
  font-size: .84rem;
  min-height: 60px;
  display: grid;
  place-items: center;
}
.ad-slot[hidden] { display: none; }

.site-foot {
  margin-top: 30px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  padding: 38px 0 22px;
  font-size: .92rem;
}
.foot__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 26px;
}
@media (max-width: 900px) { .foot__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .foot__grid { grid-template-columns: 1fr; } }
.foot__grid h2 { font-size: .95rem; margin-bottom: .6em; }
.foot__grid ul { list-style: none; padding: 0; margin: 0; }
.foot__grid li { margin: 4px 0; }
.foot__grid a { color: var(--ink-2); }
.foot__brand { font-weight: 800; font-size: 1.05rem; margin-bottom: 8px; }
.foot__bottom {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
  color: var(--ink-3);
  font-size: .86rem;
}
.foot__bottom p { margin: 0; }

.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 60;
}
.to-top[data-visible="true"] { opacity: 1; pointer-events: auto; }
.to-top:hover { transform: translateY(-2px); color: var(--tomato); }

/* ═══════════════ 13. 404 ═══════════════ */
.notfound { padding: 60px 0 80px; text-align: center; }
.notfound__code {
  font-size: clamp(3.6rem, 12vw, 6rem);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(140deg, var(--tomato), #f0a04f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}

/* ═══════════════ 14. 打印 ═══════════════ */
@media print {
  .site-head, .nav-drawer, .to-top, .ad-slot, .tool, .site-foot { display: none !important; }
  body { font-size: 12pt; }
  a { color: #000; text-decoration: underline; }
}
