:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --panel: #ffffff;
  --line: #e3e6ea;
  --line-strong: #cfd4db;
  --ink: #16191d;
  --ink-2: #454c55;
  --ink-3: #6b7480;
  --accent: #1f4fd8;
  --accent-soft: #eef2fd;
  --ok: #0f7a4a;
  --warn: #9a3412;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

/* 浏览器默认的 [hidden] { display: none } 来自 UA 样式表，会被作者样式表里的
   `.field { display: flex }` 这类声明整体压过（作者 > UA，与选择器权重无关），
   于是 hidden 属性静默失效、本该隐藏的字段一直显示。这里显式把它抬回来。 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 760px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff;
  padding: 8px 14px; z-index: 50;
}
.skip:focus { left: 8px; top: 8px; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; gap: 12px; min-height: 58px; flex-wrap: wrap; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink); font-weight: 700; font-size: 17px; letter-spacing: -.01em;
}
.brand svg { color: var(--accent); }
.pill {
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ok); background: #e8f6ee; border: 1px solid #c7e8d5;
  padding: 2px 8px; border-radius: 999px;
}
.site-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a {
  color: var(--ink-2); font-size: 13.5px; padding: 5px 9px; border-radius: 7px; white-space: nowrap;
}
.site-nav a:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }

/* ---------- type ---------- */
h1 { font-size: clamp(1.7rem, 4vw, 2.35rem); line-height: 1.2; letter-spacing: -.02em; margin: 26px 0 10px; }
h2 { font-size: 1.22rem; line-height: 1.3; letter-spacing: -.01em; margin: 40px 0 12px; }
h3 { font-size: 1rem; margin: 0 0 4px; }
.lead { font-size: 1.08rem; color: var(--ink-2); margin: 0 0 22px; }
.prose p { margin: 0 0 15px; color: var(--ink-2); }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 8px;
}
.cta-line { color: var(--ink-3); font-size: .92rem; margin-top: 34px; }

.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-3); margin-top: 22px; }
.crumbs a { color: var(--ink-3); }

/* ---------- hero ---------- */
.hero { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--accent-soft), #fff); padding-bottom: 34px; }
.hero h1 { margin-top: 34px; }
.hero-proof {
  font-size: .93rem; color: var(--ink-2); background: var(--panel);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 11px 14px; border-radius: 8px; margin: 0;
}

/* ---------- widget ---------- */
.widget {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin: 0 0 26px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); transition: .15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dz-target {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%; padding: 30px 16px; background: none; border: 0; cursor: pointer;
  font: inherit; color: var(--ink);
}
.dz-target strong { font-size: 1rem; }
.dz-target span { font-size: 13px; color: var(--ink-3); }

.filelist { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.filelist li {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 13.5px;
}
.fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmeta { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.ficons { display: flex; gap: 2px; }
.ficons button {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 6px;
  width: 24px; height: 24px; line-height: 1; cursor: pointer; color: var(--ink-2); font-size: 12px;
}
.ficons button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.options {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 14px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line);
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .opt { font-weight: 400; color: var(--ink-3); }
.field input[type="text"], .field input[type="number"], .field select {
  font: inherit; font-size: 14px; padding: 7px 9px;
  border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--ink);
  width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.field output { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.sig-block { grid-column: 1 / -1; }
#sig-canvas {
  width: 100%; height: 180px; display: block; touch-action: none; cursor: crosshair;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
}
.sig-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.hint { font-size: 12px; color: var(--ink-3); }
/* 选项区是网格，说明行要横跨整行，否则会被塞进一个 190px 的格子里 */
.options > .hint { grid-column: 1 / -1; }
button.ghost {
  font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 7px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink-2); cursor: pointer;
}
button.ghost:hover { border-color: var(--accent); color: var(--accent); }

.run-row { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
button.primary {
  font: inherit; font-size: 15px; font-weight: 600; padding: 11px 22px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer;
}
button.primary:hover:not(:disabled) { background: #1a44bd; }
button.primary:disabled { background: #c3cad6; border-color: #c3cad6; cursor: not-allowed; }
.privacy-badge {
  font-size: 12px; font-weight: 600; color: var(--ok);
  background: #e8f6ee; border: 1px solid #c7e8d5; padding: 3px 9px; border-radius: 999px;
}

.status { font-size: 13.5px; color: var(--ink-2); margin: 12px 0 0; min-height: 20px; }
.status.err { color: #b42318; }
.status.busy::before {
  content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 7px;
  border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.results { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.results li {
  display: flex; align-items: center; gap: 12px; font-size: 13.5px;
  border: 1px solid #c7e8d5; background: #f2fbf6; border-radius: 8px; padding: 9px 12px;
}
.results .dl {
  margin-left: auto; font-weight: 600; background: var(--ok); color: #fff;
  padding: 5px 13px; border-radius: 7px; white-space: nowrap;
}
.results .dl:hover { background: #0b5f39; text-decoration: none; }

/* ---------- steps / faq / cards ---------- */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li {
  counter-increment: s; position: relative; padding: 12px 14px 12px 48px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px;
}
.steps li::before {
  content: counter(s); position: absolute; left: 14px; top: 12px;
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.steps strong { display: block; font-size: 14.5px; }
.steps span { font-size: 13.5px; color: var(--ink-2); }

.faq { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  cursor: pointer; padding: 13px 16px; font-weight: 600; font-size: 14.5px; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--ink-3); font-weight: 400; }
.faq details[open] summary::after { content: "\2212"; }
.faq .ans { padding: 0 16px 14px; font-size: 14px; color: var(--ink-2); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  display: block; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; background: var(--panel); color: var(--ink); transition: .15s;
}
.card:hover { border-color: var(--accent); box-shadow: 0 3px 12px rgba(31, 79, 216, .09); text-decoration: none; }
.card p { margin: 0; font-size: 13.5px; color: var(--ink-3); }

.related { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a {
  display: inline-block; font-size: 13.5px; padding: 7px 13px;
  border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-2);
}
.related a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.ad { margin: 22px 0; min-height: 0; }

/* ---------- organize: thumbnail grid ---------- */
.thumbs {
  list-style: none; margin: 16px 0 4px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px;
}
.thumb {
  position: relative; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--panel); padding: 8px 8px 6px; cursor: grab; transition: .12s;
}
.thumb:hover { border-color: var(--accent); }
.thumb.dragging { opacity: .45; }
.thumb img {
  display: block; width: 100%; height: 128px; object-fit: contain;
  background: #fff; border-radius: 4px; transition: transform .15s;
}
.thumb .tn {
  position: absolute; top: 12px; left: 12px; min-width: 20px; height: 20px; line-height: 20px;
  padding: 0 5px; border-radius: 999px; background: rgba(16, 19, 24, .78); color: #fff;
  font-size: 11.5px; text-align: center; letter-spacing: .02em;
}
.thumb .ttools { display: flex; gap: 3px; margin-top: 6px; }
.thumb .ttools button {
  flex: 1; font: inherit; font-size: 12.5px; line-height: 1; padding: 5px 0;
  border: 1px solid var(--line); border-radius: 5px; background: var(--bg-soft);
  color: var(--ink-2); cursor: pointer;
}
.thumb .ttools button:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- fill form: dynamic fields ---------- */
.formfields { display: grid; gap: 10px; margin: 4px 0 10px; }
.formfields .field { margin: 0; }
.formfields label { font-size: 12.5px; color: var(--ink-3); margin-bottom: 3px; }
.formfields input[type="checkbox"] {
  width: 18px; height: 18px; margin: 0; accent-color: var(--accent);
  justify-self: start; align-self: start;
}
.formfields select { max-width: 320px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 56px; padding: 26px 0 40px; background: var(--bg-soft); }
.foot-tag { font-size: 13.5px; color: var(--ink-3); margin: 0 0 12px; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; margin-bottom: 14px; }
.foot-nav a { color: var(--ink-2); }
.copy { font-size: 12.5px; color: var(--ink-3); margin: 0; }

/* ---------- 长文页（/guides/） ---------- */
/* 正文列表：.prose 原本只定义了 p/code，不加这条会退化成浏览器默认缩进 */
.prose ul, .prose ol { margin: 0 0 15px; padding-left: 22px; color: var(--ink-2); }
.prose li { margin: 0 0 7px; }
.prose li:last-child { margin-bottom: 0; }
.prose strong, .gsec strong { color: var(--ink); font-weight: 600; }

.kicker {
  margin: 22px 0 0; font-size: 11.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--accent);
}
.kicker + h1 { margin-top: 6px; }
.byline { font-size: 13px; color: var(--ink-3); margin: 0 0 24px; }

.toc {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-soft); padding: 14px 18px; margin: 26px 0 4px;
}
.toc-h {
  margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3);
}
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 0 0 4px; font-size: 14px; }
.toc a { color: var(--ink-2); }

.gsec { scroll-margin-top: 74px; }
.gsec h2 { margin-top: 38px; }
.gsec ul { margin: 0 0 15px; padding-left: 22px; color: var(--ink-2); }
.gsec li { margin: 0 0 9px; }

/* 对比表：窄屏靠横向滚动而不是挤成不可读的窄列 */
.tablewrap { overflow-x: auto; margin: 4px 0 20px; -webkit-overflow-scrolling: touch; }
table.cmp {
  border-collapse: collapse; width: 100%; min-width: 520px;
  font-size: 14px; border: 1px solid var(--line); border-radius: var(--radius);
}
table.cmp th, table.cmp td {
  text-align: left; vertical-align: top; padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
table.cmp thead th {
  background: var(--bg-soft); color: var(--ink);
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  border-bottom: 1px solid var(--line-strong);
}
table.cmp tbody tr:last-child td { border-bottom: 0; }
table.cmp td:first-child { color: var(--ink); font-weight: 600; }
table.cmp td { color: var(--ink-2); }

.note {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px; margin: 4px 0 20px; font-size: 14px; color: var(--ink-2);
}

.cardmeta { display: block; margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.guide-grid .card h3 { font-size: .97rem; line-height: 1.35; }

@media (max-width: 640px) {
  .site-nav { width: 100%; margin-left: 0; overflow-x: auto; }
  h1 { margin-top: 20px; }
}
