/* 爆炸工厂 · 全站视觉基础
   背景柔光只存在于 .ambient，不参与前景布局，不接收指针事件。 */
:root {
  color-scheme: dark;
  --bg: #071121;
  --surface: #0c1829;
  --surface-raised: #101e30;
  --text: #eef2ef;
  --muted: #a9b5bf;
  --subtle: #81909d;
  --line: rgba(190, 208, 214, 0.13);
  --line-strong: rgba(190, 208, 214, 0.24);
  --accent: #c2d6c8;
  --accent-ink: #10211c;
  --danger: #d6a19a;
  --warning: #d4c294;
  --radius-sm: 8px;
  --radius: 14px;
  --shell: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 110px; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body, button, input, select { font-family: inherit; }
button, input, select { font-size: inherit; }
a { color: inherit; text-decoration: none; }
button { color: inherit; cursor: pointer; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
::selection { background: rgba(194, 214, 200, 0.25); color: #fff; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-weight: 500; line-height: 1.25; }
.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; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; padding: 10px 16px; background: var(--accent); color: var(--accent-ink); border-radius: 6px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

/* 柔光层：z-index: 0，位于所有内容下方。 */
.ambient { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; contain: strict; }
.ambient span { position: absolute; display: block; border-radius: 50%; mix-blend-mode: screen; filter: blur(80px); will-change: transform; }
.ambient span:nth-child(1) { width: 62vw; height: 62vw; min-width: 520px; min-height: 520px; top: -22vw; left: -12vw; background: #8a4fb5; opacity: 0.38; animation: orbit-one 12s linear infinite; }
.ambient span:nth-child(2) { width: 56vw; height: 56vw; min-width: 480px; min-height: 480px; top: 14vh; right: -16vw; background: #238f94; opacity: 0.34; animation: orbit-two 15s linear -5s infinite; }
.ambient span:nth-child(3) { width: 50vw; height: 50vw; min-width: 440px; min-height: 440px; bottom: -22vw; left: 22vw; background: #5d8d4d; opacity: 0.32; animation: orbit-three 18s linear -9s infinite; }
/* 闭环椭圆轨道：首尾完全一致， linear 无限循环，没有往返停顿。 */
@keyframes orbit-one {
  0% { transform: rotate(0deg) translate(13vw, 7vh) rotate(0deg) scale(0.94); }
  25% { transform: rotate(90deg) translate(16vw, -5vh) rotate(-90deg) scale(1.04); }
  50% { transform: rotate(180deg) translate(13vw, 7vh) rotate(-180deg) scale(1.1); }
  75% { transform: rotate(270deg) translate(9vw, 12vh) rotate(-270deg) scale(1.02); }
  100% { transform: rotate(360deg) translate(13vw, 7vh) rotate(-360deg) scale(0.94); }
}
@keyframes orbit-two {
  0% { transform: rotate(0deg) translate(-11vw, 9vh) rotate(0deg) scale(1.06); }
  25% { transform: rotate(90deg) translate(-15vw, -7vh) rotate(-90deg) scale(0.98); }
  50% { transform: rotate(180deg) translate(-11vw, 9vh) rotate(-180deg) scale(0.92); }
  75% { transform: rotate(270deg) translate(-7vw, 14vh) rotate(-270deg) scale(1.02); }
  100% { transform: rotate(360deg) translate(-11vw, 9vh) rotate(-360deg) scale(1.06); }
}
@keyframes orbit-three {
  0% { transform: rotate(0deg) translate(9vw, -11vh) rotate(0deg) scale(0.96); }
  25% { transform: rotate(90deg) translate(13vw, 7vh) rotate(-90deg) scale(1.08); }
  50% { transform: rotate(180deg) translate(9vw, -11vh) rotate(-180deg) scale(1.02); }
  75% { transform: rotate(270deg) translate(5vw, -14vh) rotate(-270deg) scale(0.92); }
  100% { transform: rotate(360deg) translate(9vw, -11vh) rotate(-360deg) scale(0.96); }
}

main, #site-footer, .toast { position: relative; z-index: 1; }
/* 导航容器必须拥有独立的高层级；否则内部固定导航会被后续 main 覆盖，导致无法点击。 */
#site-header { position: relative; z-index: 20; }
.section-shell { width: min(var(--shell), calc(100% - 80px)); margin-inline: auto; }

/* 统一导航 */
.site-header { position: fixed; inset: 0 0 auto; z-index: 20; border-bottom: 1px solid var(--line); background: #071121; }
.nav-shell { width: min(var(--shell), calc(100% - 80px)); height: 78px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 600; letter-spacing: 0.08em; flex-shrink: 0; }
.brand-symbol { width: 32px; height: 32px; color: var(--accent); }
.primary-nav { display: flex; align-items: center; gap: 34px; }
.primary-nav a { position: relative; padding: 27px 0; color: var(--muted); font-size: 14px; transition: color 180ms ease; }
.primary-nav a:hover, .primary-nav a[aria-current="page"] { color: var(--text); }
.primary-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 17px; height: 1px; background: var(--accent); }
.menu-toggle { display: none; width: 44px; height: 44px; padding: 13px 10px; border: 0; background: transparent; }
.menu-toggle span { display: block; width: 22px; height: 1px; margin: 6px auto; background: var(--text); transition: transform 180ms ease; }

/* 通用按钮 */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 46px; padding: 10px 20px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 14px; line-height: 1.4; transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.button-primary:hover { background: #d3e2d8; }
.button-outline { border-color: var(--line-strong); background: rgba(12, 24, 41, 0.35); }
.button-outline:hover { border-color: rgba(210, 225, 217, 0.5); background: rgba(194, 214, 200, 0.06); }
.button-quiet { padding-inline: 8px; color: var(--muted); background: transparent; }
.button-quiet:hover { color: var(--text); }
.text-link { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; color: var(--muted); font-size: 14px; }
.text-link:hover { color: var(--text); }
.section-kicker { margin-bottom: 16px; color: var(--subtle); font-size: 13px; letter-spacing: 0.12em; }

/* 首页 */
.home-main { padding-top: 78px; }
.hero { min-height: 650px; display: grid; grid-template-columns: 1.55fr 0.45fr; align-items: center; gap: 60px; padding-block: 100px 84px; }
.hero-kicker { margin-bottom: 24px; color: var(--muted); font-size: 14px; letter-spacing: 0.1em; }
.hero h1 { margin: 0 0 30px; font-size: clamp(72px, 10.5vw, 144px); font-weight: 300; letter-spacing: -0.065em; line-height: 0.98; }
.title-dot { color: var(--accent); }
.hero-lead { margin-bottom: 38px; color: #c2ccd0; font-size: clamp(20px, 2.4vw, 29px); font-weight: 300; line-height: 1.65; letter-spacing: 0.015em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.hero-aside { align-self: end; padding-bottom: 34px; text-align: right; color: var(--subtle); font-size: 13px; line-height: 1.9; }
.signal-mark { width: 150px; margin: 0 0 24px auto; color: var(--accent); opacity: 0.65; }
.signal-mark svg { display: block; width: 100%; }
.principles { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.principle { padding: 34px 38px 36px 0; }
.principle + .principle { padding-left: 38px; border-left: 1px solid var(--line); }
.principle-index { display: block; margin-bottom: 20px; color: var(--subtle); font-size: 12px; font-variant-numeric: tabular-nums; }
.principle h2 { margin-bottom: 10px; font-size: 17px; }
.principle p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.featured { padding-block: 100px 110px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.section-heading h2 { margin: 0; font-size: clamp(27px, 3vw, 38px); font-weight: 400; letter-spacing: -0.025em; }
.section-heading .section-kicker { margin-bottom: 10px; }
.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tool-card { position: relative; display: flex; flex-direction: column; min-height: 246px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(12, 24, 41, 0.74); transition: border-color 200ms ease, background 200ms ease, transform 200ms var(--ease); }
.tool-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--category-color) 48%, transparent); background: rgba(16, 30, 48, 0.9); }
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.tool-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid color-mix(in srgb, var(--category-color) 25%, transparent); border-radius: 9px; color: var(--category-color); background: color-mix(in srgb, var(--category-color) 6%, transparent); }
.tool-icon svg { width: 21px; height: 21px; }
.card-category, .category-label { color: var(--category-color, var(--muted)); font-size: 12px; }
.tool-card h3 { margin-bottom: 10px; font-size: 20px; }
.tool-card p { margin-bottom: 26px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.card-action { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); color: var(--subtle); font-size: 12px; }
.tool-card:hover .card-action { color: var(--text); }
.closing { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 60px; padding-block: 80px 110px; border-top: 1px solid var(--line); }
.closing h2 { margin: 0; font-size: clamp(34px, 4.4vw, 58px); font-weight: 300; line-height: 1.35; letter-spacing: -0.04em; }
.closing-copy { align-self: end; }
.closing-copy p { margin-bottom: 28px; color: var(--muted); font-size: 15px; line-height: 1.9; }

/* 工具目录 */
.catalog-main { padding-top: 158px; padding-bottom: 120px; min-height: calc(100vh - 210px); }
.page-heading { max-width: 650px; margin-bottom: 60px; }
.page-heading h1 { margin-bottom: 18px; font-size: clamp(46px, 6vw, 72px); font-weight: 300; letter-spacing: -0.045em; }
.page-heading > p:last-child { margin: 0; color: var(--muted); font-size: 16px; }
.catalog-toolbar { display: flex; align-items: center; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.search-box { display: flex; align-items: center; gap: 12px; width: min(440px, 100%); height: 46px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: rgba(12, 24, 41, 0.65); color: var(--subtle); }
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { flex-shrink: 0; width: 18px; height: 18px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.search-box input::placeholder { color: var(--subtle); }
.result-count { margin-left: auto; color: var(--subtle); font-size: 13px; white-space: nowrap; }
.filter-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 34px; }
.filter-list button { display: inline-flex; align-items: center; gap: 9px; min-height: 40px; padding: 7px 14px; border: 1px solid transparent; border-radius: 99px; background: transparent; color: var(--muted); font-size: 13px; transition: color 160ms ease, border-color 160ms ease, background 160ms ease; }
.filter-list button span { color: var(--subtle); font-size: 11px; }
.filter-list button:hover { color: var(--text); background: rgba(194, 214, 200, 0.04); }
.filter-list button.is-active { border-color: var(--line-strong); background: rgba(194, 214, 200, 0.08); color: var(--text); }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tool-grid .tool-card { min-height: 258px; }
.empty-state { padding: 70px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-state h2 { margin-bottom: 10px; font-size: 24px; }
.empty-state p { margin-bottom: 24px; color: var(--muted); }

/* 工具独立页 */
.tool-main { padding-top: 122px; padding-bottom: 110px; }
.breadcrumb { display: flex; gap: 12px; margin-bottom: 40px; color: var(--subtle); font-size: 12px; }
.breadcrumb a:hover { color: var(--text); }
.tool-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 38px; }
.tool-heading h1 { margin: 10px 0 14px; font-size: clamp(38px, 5vw, 58px); font-weight: 350; letter-spacing: -0.04em; }
.tool-heading p { max-width: 650px; margin: 0; color: var(--muted); font-size: 15px; }
.local-badge { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding-bottom: 5px; color: var(--muted); font-size: 12px; }
.local-badge > span { width: 6px; height: 6px; border-radius: 50%; background: #a9bea0; box-shadow: 0 0 0 4px rgba(169, 190, 160, 0.08); }
.safety-note { display: flex; gap: 14px; align-items: baseline; margin-bottom: 20px; padding: 14px 18px; border: 1px solid rgba(212, 194, 148, 0.22); border-radius: var(--radius-sm); background: rgba(212, 194, 148, 0.045); color: var(--muted); font-size: 12px; }
.safety-note strong { flex-shrink: 0; color: var(--warning); font-weight: 500; }
.workspace { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(12, 24, 41, 0.82); overflow: hidden; }
.workspace-grid { display: grid; grid-template-columns: minmax(300px, 0.86fr) minmax(0, 1.14fr); }
.parameter-panel, .result-panel { padding: 30px; }
.parameter-panel { border-right: 1px solid var(--line); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 26px; }
.panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading > span { color: var(--subtle); font-size: 11px; }
.tool-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; }
.field { min-width: 0; }
.field label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.field-unit { color: var(--subtle); font-size: 11px; white-space: nowrap; }
.field input, .field select { width: 100%; height: 42px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 6px; outline: 0; background: rgba(7, 17, 33, 0.66); color: var(--text); font-size: 14px; transition: border-color 160ms ease; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 18px, calc(100% - 12px) 18px; background-size: 4px 4px; background-repeat: no-repeat; }
.workspace-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.workspace-actions .button { min-height: 40px; padding: 8px 14px; font-size: 12px; }
.result-panel { background: rgba(7, 17, 33, 0.24); }
.result-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.result-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.result-table th, .result-table td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.result-table th { color: var(--subtle); font-size: 11px; font-weight: 400; background: rgba(194, 214, 200, 0.025); }
.result-table td:nth-child(2) { color: var(--text); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.result-table td:nth-child(3) { color: var(--subtle); }
.result-table tr:last-child td { border-bottom: 0; }
.result-table .row-total td { background: rgba(194, 214, 200, 0.07); color: var(--accent); }
.result-table .row-danger td { color: var(--danger); background: rgba(214, 161, 154, 0.06); }
.result-table .row-warn td { color: var(--warning); background: rgba(212, 194, 148, 0.06); }
.result-notes { margin: 16px 0 0; padding-left: 17px; color: var(--subtle); font-size: 11px; line-height: 1.8; }
.result-placeholder { display: grid; place-items: center; min-height: 260px; color: var(--subtle); font-size: 13px; text-align: center; }
.result-orbit { display: block; width: 36px; height: 36px; margin: 0 auto 16px; border: 1px solid var(--line-strong); border-radius: 50%; }
.switch-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 16px; }
.switch-grid > span { display: flex; align-items: center; gap: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--subtle); font-size: 10px; }
.switch-grid i { width: 5px; height: 5px; border-radius: 50%; background: #586570; }
.switch-grid b { margin-left: auto; font-size: 9px; font-weight: 500; }
.switch-grid .is-on { color: var(--accent); border-color: rgba(194, 214, 200, 0.24); }
.switch-grid .is-on i { background: var(--accent); }
.history { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.history summary { color: var(--muted); font-size: 12px; cursor: pointer; }
.history summary span { margin-left: 6px; color: var(--subtle); }
.history p { margin: 12px 0 0; color: var(--subtle); font-size: 11px; }
.history-list { margin-top: 12px; }
.history-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.history-list time { flex-shrink: 0; color: var(--subtle); }
.related { padding-top: 70px; }
.related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.related-grid .tool-card { min-height: 200px; }

/* 图片标注工具 */
.measure-intro { display: flex; align-items: start; justify-content: space-between; gap: 24px; padding: 28px 30px 0; }
.measure-intro h2 { margin-bottom: 8px; font-size: 18px; }
.measure-intro p { max-width: 640px; margin: 0; color: var(--muted); font-size: 13px; }
.measure-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 24px 30px; }
.measure-controls .field { width: 220px; }
.file-field input { padding: 8px; font-size: 12px; }
.file-field input::file-selector-button { margin-right: 10px; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.measure-controls .button { min-height: 42px; font-size: 12px; }
.canvas-shell { position: relative; margin: 0 30px; min-height: 320px; max-height: 650px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background-color: #091425; background-image: linear-gradient(rgba(190,208,214,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(190,208,214,.035) 1px, transparent 1px); background-size: 24px 24px; text-align: center; }
#measure-canvas { display: block; max-width: 100%; height: auto; margin: auto; cursor: crosshair; touch-action: manipulation; }
.canvas-empty { position: absolute; inset: 0; display: grid; place-content: center; pointer-events: none; color: var(--subtle); }
.canvas-empty > span { font-size: 32px; font-weight: 200; }
.canvas-empty p { margin: 8px 0 0; font-size: 13px; }
.measure-hint { margin: 14px 30px 0; color: var(--muted); font-size: 12px; }
.workspace > #tool-history { margin: 22px 30px 28px; }

/* 页脚与提示 */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 32px; min-height: 120px; color: var(--subtle); font-size: 11px; }
.footer-brand { color: var(--muted); font-size: 13px; letter-spacing: 0.08em; }
.footer-brand span { display: block; margin-top: 3px; color: var(--subtle); font-size: 10px; letter-spacing: 0; }
.footer-inner p { margin: 0; }
.footer-year { font-variant-numeric: tabular-nums; }
.filing-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
.filing-links a { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; color: var(--subtle); font-size: 11px; }
.filing-links a:hover { color: var(--muted); }
.filing-links img { width: 16px; height: 16px; object-fit: contain; }
.button:disabled { cursor: wait; opacity: 0.6; transform: none; }

/* 全站联系我们组件 */
.contact-root { position: relative; z-index: 30; }
.contact-launcher { position: fixed; right: 26px; bottom: 24px; z-index: 30; display: inline-flex; align-items: center; gap: 9px; min-height: 48px; padding: 10px 17px; border: 1px solid var(--line-strong); border-radius: 99px; background: #101e30; color: var(--text); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); font-size: 13px; transition: border-color 180ms ease, background 180ms ease; }
.contact-launcher:hover { border-color: var(--accent); background: #16283b; }
.contact-launcher svg { width: 20px; height: 20px; color: var(--accent); }
.contact-dialog { width: min(640px, calc(100% - 32px)); max-height: calc(100vh - 40px); padding: 30px; border: 1px solid var(--line-strong); border-radius: 18px; background: #0c1829; color: var(--text); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45); }
.contact-dialog::backdrop { background: rgba(3, 9, 18, 0.78); backdrop-filter: blur(5px); }
.contact-dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.contact-dialog-head .section-kicker { margin-bottom: 7px; }
.contact-dialog-head h2 { margin: 0; font-size: 30px; }
.contact-close { width: 42px; height: 42px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; }
.contact-close:hover { color: var(--text); border-color: var(--line-strong); }
.contact-description { margin: 16px 0 24px; color: var(--muted); font-size: 13px; }
.contact-qr-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.contact-qr-grid figure { margin: 0; padding: 14px 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: center; }
.contact-qr-grid img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.contact-qr-grid figcaption { padding-top: 10px; color: #24313d; font-size: 13px; }
.contact-tip { margin: 18px 0 0; color: var(--subtle); font-size: 12px; text-align: center; }
/* 白底高清图片预览与手动下载 */
.image-preview-dialog { color-scheme: light; width: min(1180px, calc(100% - 40px)); height: min(900px, calc(100dvh - 40px)); max-width: none; max-height: none; padding: 0; border: 1px solid #d7dfe1; border-radius: 16px; background: #fff; color: #17212b; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.4); overflow: hidden; }
.image-preview-dialog[open] { display: flex; flex-direction: column; }
.image-preview-head, .image-preview-toolbar { flex: 0 0 auto; }
.image-preview-dialog::backdrop { background: rgba(3, 9, 18, 0.82); backdrop-filter: blur(5px); }
.image-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 24px; border-bottom: 1px solid #e3e8e9; }
.image-preview-head .section-kicker { margin: 0 0 4px; color: #6b7780; font-size: 11px; }
.image-preview-head h2 { margin: 0; color: #17212b; font-size: 19px; }
.image-preview-head .contact-close { border-color: #d7dfe1; color: #52616d; }
.image-preview-head .contact-close:hover { color: #17212b; border-color: #9caab1; }
.image-preview-stage { flex: 1 1 auto; min-height: 0; padding: 24px; overflow: auto; background: #f1f3f4; text-align: center; overscroll-behavior: contain; }
.image-preview-stage img { display: block; max-width: none; max-height: none; margin: 0 auto; background: #fff; box-shadow: 0 3px 20px rgba(23, 33, 43, 0.12); }
.image-preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 80px; padding: 14px 20px; border-top: 1px solid #e3e8e9; background: #fff; }
.zoom-controls, .preview-actions { display: flex; align-items: center; gap: 10px; }
.zoom-controls button { min-width: 38px; height: 38px; padding: 0 10px; border: 1px solid #d7dfe1; border-radius: 7px; background: #fff; color: #33434e; font-size: 18px; }
.zoom-controls button:hover { border-color: #8d9da5; background: #f5f7f7; }
.zoom-controls input { width: 120px; accent-color: #426b5c; }
.zoom-controls output { min-width: 46px; color: #52616d; font-size: 12px; font-variant-numeric: tabular-nums; }
.zoom-controls .zoom-reset { font-size: 12px; }
.preview-actions > span { color: #6b7780; font-size: 12px; }
.image-preview-toolbar .button { min-height: 40px; padding: 8px 15px; font-size: 13px; }
.image-preview-toolbar .button-outline { border-color: #d7dfe1; background: #fff; color: #33434e; }
.image-preview-toolbar .button-outline:hover { background: #f5f7f7; border-color: #8d9da5; }
.image-preview-toolbar .button-primary { background: #315f50; color: #fff; }
.image-preview-toolbar .button-primary:hover { background: #254e41; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 40; max-width: calc(100% - 32px); padding: 11px 20px; border: 1px solid var(--line-strong); border-radius: 8px; background: #17283a; color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); font-size: 13px; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* 中等宽度下备案单独成行，避免与说明文字互相挤压。 */
@media (max-width: 1100px) {
  .footer-inner { grid-template-columns: 1fr auto; gap: 12px; padding-block: 28px; }
  .footer-inner p { grid-row: 3; grid-column: 1 / -1; }
  .filing-links { grid-row: 2; grid-column: 1 / -1; }
}

/* 平板 */
@media (max-width: 980px) {
  .section-shell, .nav-shell { width: calc(100% - 48px); }
  .hero { grid-template-columns: 1fr 0.35fr; min-height: 590px; gap: 24px; }
  .hero h1 { font-size: clamp(64px, 11vw, 104px); }
  .featured-grid, .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .workspace-grid { grid-template-columns: 1fr; }
  .parameter-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .tool-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .principle { padding-right: 22px; }
  .principle + .principle { padding-left: 22px; }
}

/* 手机 */
@media (max-width: 720px) {
  html { scroll-padding-top: 90px; }
  .section-shell, .nav-shell { width: calc(100% - 36px); }
  .nav-shell { height: 66px; }
  .brand { font-size: 15px; }
  .brand-symbol { width: 28px; height: 28px; }
  .menu-toggle { display: block; }
  .primary-nav { position: absolute; top: 66px; left: 0; right: 0; display: none; padding: 8px 18px 18px; border-bottom: 1px solid var(--line-strong); background: #071121; }
  .primary-nav.is-open { display: grid; gap: 0; }
  .primary-nav a { padding: 14px 4px; }
  .primary-nav a[aria-current="page"]::after { bottom: 8px; }
  .home-main { padding-top: 66px; }
  .hero { display: block; min-height: auto; padding-block: 76px 58px; }
  .hero h1 { margin-bottom: 26px; font-size: clamp(58px, 18vw, 92px); }
  .hero-kicker { margin-bottom: 18px; font-size: 12px; }
  .hero-lead { font-size: 20px; }
  .hero-actions { gap: 8px 16px; }
  .hero-aside { display: none; }
  .principles { grid-template-columns: 1fr; }
  .principle, .principle + .principle { padding: 24px 0; border-left: 0; }
  .principle + .principle { border-top: 1px solid var(--line); }
  .principle-index { margin-bottom: 10px; }
  .featured { padding-block: 64px 72px; }
  .section-heading { align-items: start; margin-bottom: 26px; }
  .section-heading h2 { font-size: 28px; }
  .featured-grid, .tool-grid, .related-grid { grid-template-columns: 1fr; }
  .tool-card, .tool-grid .tool-card { min-height: 220px; padding: 22px; }
  .closing { grid-template-columns: 1fr; gap: 30px; padding-block: 56px 72px; }
  .closing h2 { font-size: 38px; }
  .catalog-main { padding-top: 118px; padding-bottom: 80px; }
  .page-heading { margin-bottom: 36px; }
  .page-heading h1 { font-size: 48px; }
  .catalog-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .search-box { width: 100%; }
  .result-count { margin-left: 0; }
  .filter-list { gap: 4px; margin-block: 16px 26px; }
  .filter-list button { padding-inline: 11px; }
  .tool-main { padding-top: 100px; padding-bottom: 76px; }
  .breadcrumb { margin-bottom: 28px; }
  .tool-heading { display: block; margin-bottom: 26px; }
  .tool-heading h1 { font-size: 38px; }
  .tool-heading .local-badge { margin-top: 16px; }
  .safety-note { display: block; }
  .safety-note strong { display: block; margin-bottom: 3px; }
  .parameter-panel, .result-panel { padding: 22px 18px; }
  .panel-heading { align-items: baseline; }
  .tool-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .workspace-actions .button { flex: 1 1 auto; }
  .result-table th, .result-table td { padding: 10px; }
  .switch-grid { grid-template-columns: repeat(2, 1fr); }
  .measure-intro { display: block; padding: 22px 18px 0; }
  .measure-intro .local-badge { margin-top: 14px; }
  .measure-controls { padding: 20px 18px; }
  .measure-controls .field { width: 100%; }
  .canvas-shell { margin-inline: 18px; min-height: 240px; }
  .measure-hint { margin-inline: 18px; }
  .workspace > #tool-history { margin-inline: 18px; }
  .related { padding-top: 52px; }
  .footer-inner { grid-template-columns: 1fr auto; gap: 12px; padding-block: 28px; }
  .footer-inner p { grid-row: 3; grid-column: 1 / -1; }
  .filing-links { grid-row: 2; grid-column: 1 / -1; }
  .contact-launcher { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); min-height: 46px; padding: 9px 14px; }
  .contact-dialog { padding: 22px 18px; }
  .contact-qr-grid { gap: 10px; }
  .contact-qr-grid figure { padding: 9px 9px 12px; }
  .image-preview-dialog { width: calc(100% - 20px); height: calc(100dvh - 20px); border-radius: 12px; }
  .image-preview-head { padding: 12px 14px; }
  .image-preview-head h2 { font-size: 16px; }
  .image-preview-stage { padding: 14px; }
  .image-preview-toolbar { height: 132px; padding: 10px 12px; flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; }
  .zoom-controls { justify-content: center; gap: 7px; }
  .zoom-controls input { flex: 1; width: auto; min-width: 60px; }
  .preview-actions { justify-content: flex-end; }
  .preview-actions > span { margin-right: auto; font-size: 11px; }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 56px; }
  .tool-form { grid-template-columns: 1fr; }
  .button { padding-inline: 16px; }
}

/* 尊重系统减少动态效果设置；打印时只保留工具结果。 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .ambient span { transform: none; }
}
@media print {
  :root { color-scheme: light; --bg: #fff; --text: #111; --muted: #444; --subtle: #666; --line: #ddd; --line-strong: #ccc; }
  body { background: #fff; color: #111; }
  .ambient, .site-header, .site-footer, .breadcrumb, .tool-heading, .safety-note, .parameter-panel, .related, .measure-controls, .measure-intro, .measure-hint, .history, .toast, .contact-root, .image-preview-dialog { display: none !important; }
  .tool-main, .section-shell { width: 100%; padding: 0; margin: 0; }
  .workspace { border: 0; background: #fff; }
  .workspace-grid { display: block; }
  .result-panel { padding: 0; background: #fff; }
  .result-panel .panel-heading { display: none; }
  .result-table td, .result-table th, .result-notes { color: #222 !important; }
  .result-table .row-total td { background: #f2f2f2 !important; }
  .canvas-shell { border: 0; margin: 0; }
}
