/* =============================================================
   工具详情页样式
   ============================================================= */

.browser-workspace { min-width: 0; }
.browser-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.browser-summary > div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-2); }
.browser-summary span, .browser-summary strong { display: block; overflow-wrap: anywhere; }
.browser-summary span { color: var(--muted); font-size: 12px; }
.browser-summary strong { margin-top: 5px; font-size: 16px; }
.browser-note { color: var(--muted); font-size: 13px; line-height: 1.7; }
.browser-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 18px; }
.browser-filters .field { flex: 1 1 240px; margin: 0; }
.browser-filters > label { font-size: 13px; }
.browser-nav { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 18px 0; font-size: 13px; }
.browser-section { margin-top: 24px; scroll-margin-top: 20px; }
.browser-section h2 { font-size: 16px; margin: 0 0 12px; }
.browser-grid { margin: 0; }
.browser-grid > div { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); gap: 12px 20px; padding: 10px 0; border-top: 1px solid var(--line); }
.browser-grid dt { color: var(--ink-2); font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.browser-grid small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 4px; }
.browser-grid dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }
.browser-state { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.browser-state[data-state=ok] { color: var(--success-ink); }
.browser-workspace textarea { box-sizing: border-box; width: 100%; font-family: var(--font-mono); }
.browser-section summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
@media (max-width: 600px) {
  .browser-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .browser-grid > div { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

.tool-head { margin: 14px 0 16px; }
.tool-head { display: flex; align-items: center; gap: 18px; }
.tool-head-icon { width: 88px; height: 88px; flex: 0 0 88px; border-radius: var(--r-3); }
.tool-head > div, .two-col > *, .three-col > * { min-width: 0; }
.tool-jump { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 18px; font-size: 13px; }
.tool-jump a { color: var(--link); }
.tool-body section, #tool-workspace { scroll-margin-top: 20px; }
.tool-body h3 { font-size: 13px; color: var(--muted); }
.tool-body pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.tool-illustration { margin: 0; }
.tool-illustration img { display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--r-2); }
.tool-illustration figcaption { margin-top: 8px; font-size: 12px; color: var(--muted); }
.actions.tool-helpers { margin-bottom: 14px; }
.table-scroll { overflow-x: auto; }
.tool-quickstart { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; line-height: 1.6; max-width: 820px; }
.tool-shortcut { margin: -6px 0 12px; color: var(--muted); font-size: 12px; }
.output-actions { margin: 0; }
.reference-scroll { max-height: min(65vh, 560px); }
.reference-scroll thead th { position: sticky; top: 0; z-index: 1; }
.reference-status { table-layout: fixed; }
.reference-status th:first-child { width: 22%; }
.reference-status th:nth-child(2) { width: 34%; }
.reference-status td { overflow-wrap: anywhere; }
.reference-mime { min-width: 600px; table-layout: fixed; }
.reference-mime th:first-child { width: 18%; }
.reference-mime th:nth-child(2) { width: 48%; }
.reference-mime td { overflow-wrap: anywhere; }
.btn-mini:focus-visible, .btn-primary:focus-visible, .table-scroll:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 3px;
}
@media (max-width: 480px) {
  .tool-head { gap: 12px; align-items: flex-start; }
  .tool-head-icon { width: 64px; height: 64px; flex-basis: 64px; }
  .tool-card-panel { padding: 14px; }
  .related-list { grid-template-columns: 1fr; }
}
.tool-head h1 { margin: 0 0 4px; font-size: clamp(1.5rem, 1.5vw + 1rem, 1.85rem); }
.tool-head .lede { color: var(--muted); margin: 0; max-width: 780px; }

.tool-meta {
  display: flex; align-items: center; gap: 6px 10px;
  color: var(--muted); font-size: 12.5px;
  margin: 8px 0 0;
  flex-wrap: wrap;
}
.tool-meta .chip {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; letter-spacing: .01em;
}
.tool-meta .chip--server { border-color: rgba(160,30,43,.25); background: var(--accent-soft); color: var(--accent); }
.tool-meta .chip--local  { border-color: rgba(23,91,52,.25); background: var(--success-bg); color: var(--success-ink); }

.tool-card-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow-1);
}

.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.field .hint { color: var(--muted-2); font-size: 12px; }
.field input[type=text],
.field input[type=search],
.field input[type=number],
.field input[type=password],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: var(--r-2);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--focus); box-shadow: var(--shadow-focus);
}
.field textarea.error { border-color: var(--danger-ink); color: var(--danger-ink); background: var(--danger-bg); }
.field textarea {
  min-height: 140px; resize: vertical;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.55;
}
.field.mono input, .field.mono textarea { font-family: var(--font-mono); font-size: 13.5px; }

.actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center;
  margin: 6px 0 0;
}
.actions .grow { flex: 1; }

.btn-mini, .btn-primary {
  padding: 8px 14px; border-radius: var(--r-2);
  font-family: inherit; font-size: 13.5px;
  transition: background .12s, border-color .12s, color .12s;
  cursor: pointer;
}
.btn-mini {
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
}
.btn-mini:hover { border-color: var(--ink); background: var(--bg-alt); }
.btn-mini:disabled { color: var(--muted-2); cursor: not-allowed; }
.btn-primary {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 500;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.result {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 13.2px; line-height: 1.55;
  color: var(--code-ink);
  word-break: break-word;
  white-space: pre-wrap;
  max-height: 460px;
  overflow: auto;
}
.result.is-empty { color: var(--muted-2); }
.result.error   { border-color: rgba(143,28,28,.25); background: var(--danger-bg); color: var(--danger-ink); }
.result.success { border-color: rgba(23,91,52,.25); background: var(--success-bg); color: var(--success-ink); }

/* Timestamp controls stay visible; advanced batches are disclosed on demand. */
.timestamp-workspace { display: grid; gap: 22px; }
.timestamp-workspace h2 { margin: 0 0 10px; font-size: 1rem; }
.timestamp-note { margin: 6px 0 0; font: 12.5px/1.6 var(--font-body); color: var(--muted); }
.timestamp-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.timestamp-section-head .actions { margin: 0 0 10px; }
.timestamp-clock { border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.timestamp-clock-values { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.timestamp-clock-values > div { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 12px; background: var(--bg-alt); border-radius: var(--r-2); min-width: 0; }
.timestamp-clock-values strong { font-size: clamp(16px, 2vw, 21px); font-weight: 600; overflow-wrap: anywhere; }
.timestamp-clock-values span { color: var(--muted); font-size: 12px; }
.timestamp-clock-values .btn-mini { margin-left: auto; padding: 4px 9px; }
.timestamp-clock-wall { margin: 10px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.timestamp-settings .field { margin-bottom: 14px; }
.timestamp-zone-shortcuts, .timestamp-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.timestamp-zone-shortcuts { margin: 2px 0 5px; }
.timestamp-zone-shortcuts [aria-pressed=true], .timestamp-choice input:checked + span { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.timestamp-unit-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.timestamp-unit-field legend { margin-bottom: 7px; padding: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.timestamp-choice { position: relative; cursor: pointer; }
.timestamp-choice input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.timestamp-choice span { display: block; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: var(--r-2); font-size: 13px; }
.timestamp-choice input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 3px; }
.timestamp-converters { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; border-top: 1px solid var(--line); padding-top: 20px; }
.timestamp-converters > section { min-width: 0; display: flex; flex-direction: column; }
.timestamp-converters .actions { margin-top: auto; padding-top: 8px; }
.timestamp-converters .field { margin-bottom: 8px; }
.timestamp-status { margin: 0; }
.timestamp-status:empty { display: none; }
.timestamp-results > h2 { margin-bottom: 2px; }
.timestamp-values { margin: 10px 0 0; }
.timestamp-values > div { display: grid; grid-template-columns: 155px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; }
.timestamp-values dt { color: var(--muted); font-size: 13px; }
.timestamp-values dd { margin: 0; display: flex; align-items: center; gap: 12px; min-width: 0; }
.timestamp-values output { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13.5px; }
.timestamp-values .btn-mini { padding: 4px 9px; flex: 0 0 auto; }
.timestamp-batch { border-top: 1px solid var(--line); padding-top: 16px; }
.timestamp-batch summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.timestamp-batch > .timestamp-unit-field, .timestamp-batch > .field { margin-top: 14px; }
.timestamp-batch pre { margin-top: 10px; min-height: 46px; }
.timestamp-batch pre:empty { display: none; }
.timestamp-code { margin: 20px 0; }
.timestamp-code summary { cursor: pointer; font-weight: 600; }
.timestamp-code pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
.timestamp-code th:first-child { width: 95px; }
@media (max-width: 720px) {
  .timestamp-converters, .timestamp-clock-values { grid-template-columns: 1fr; }
  .timestamp-converters > section + section { border-top: 1px solid var(--line); padding-top: 18px; }
  .timestamp-values > div { grid-template-columns: 1fr; gap: 4px; }
  .timestamp-choice span { padding: 7px 12px; }
  .timestamp-clock-values strong { font-size: 20px; }
}

.two-col { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.three-col { display: grid; gap: 12px; grid-template-columns: 1fr 1fr 1fr; }
/* Grid gaps space fields; keep labels and controls at the top even when a
   neighbouring field has a hint or a taller result. */
.two-col:has(> .field), .three-col:has(> .field) { margin-bottom: 12px; }
.two-col:last-child, .three-col:last-child { margin-bottom: 0; }
.two-col > .field, .three-col > .field { margin-bottom: 0; align-content: start; }
/* Monospace inputs and native selects share the same control height. */
.two-col > .field > :is(input[type=text], input[type=search], input[type=number], input[type=password], select),
.three-col > .field > :is(input[type=text], input[type=search], input[type=number], input[type=password], select) { min-height: 46px; }
@media (max-width: 720px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
}

table.datatable {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
  background: var(--surface);
}
table.datatable th, table.datatable td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  vertical-align: top;
  text-align: left;
}
table.datatable th {
  background: var(--bg-alt);
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
table.datatable td.mono, table.datatable .mono { font-family: var(--font-mono); font-size: 12.8px; }
table.datatable tr:hover td { background: rgba(0,0,0,.015); }

.ip-section-heading { background: var(--bg-alt); }
.ip-history { margin-top: 20px; }
.ip-history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ip-history-head h2 { margin: 0; font-size: 1rem; }
.ip-history-empty { margin: 0; color: var(--muted); font-size: 13px; }
.ip-history-table th:last-child, .ip-history-table td:last-child { width: 1%; white-space: nowrap; }
.ip-history-table td { overflow-wrap: anywhere; }

/* Mortgage calculator: dense financial data, kept distinct from generic code output. */
.mortgage-input-note { margin: -2px 0 12px; }
.mortgage-status { min-height: 1.4em; margin: 12px 0 0; color: var(--success-ink); font-size: 13px; }
.mortgage-status.error { color: var(--danger-ink); }
.mortgage-result { margin-top: 16px; display: grid; gap: 22px; }
.mortgage-result[hidden] { display: none; }
.mortgage-result,
.mortgage-result > section,
.mortgage-result .table-scroll { min-width: 0; max-width: 100%; }
.mortgage-summary > h2,
.mortgage-schedule-head h2 { margin: 0; font-size: 1rem; }
.mortgage-plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.mortgage-plan { border: 1px solid var(--line); border-radius: var(--r-2); padding: 14px; background: var(--bg-alt); }
.mortgage-plan h3 { margin: 0 0 10px; font-size: 14px; }
.mortgage-plan dl { margin: 0; display: grid; gap: 8px; }
.mortgage-plan dl div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mortgage-plan dt { color: var(--muted); font-size: 12.5px; }
.mortgage-plan dd { margin: 0; font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; text-align: right; }
.mortgage-difference { display: flex; gap: 18px 28px; flex-wrap: wrap; padding: 11px 13px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r-2) var(--r-2); color: var(--muted); font-size: 12.5px; }
.mortgage-difference strong { display: block; margin-bottom: 2px; color: var(--accent); font-family: var(--font-mono); font-size: 14px; }
.mortgage-schedule-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.mortgage-tabs { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-2); overflow: hidden; background: var(--surface); }
.mortgage-tabs button { padding: 8px 12px; border-right: 1px solid var(--line-2); color: var(--muted); font-size: 13px; }
.mortgage-tabs button:last-child { border-right: 0; }
.mortgage-tabs button[aria-selected="true"] { color: #fff; background: var(--ink); }
.mortgage-tabs button:focus-visible { box-shadow: inset var(--shadow-focus); }
.mortgage-table td:not(:first-child), .mortgage-table th:not(:first-child) { text-align: right; }
.mortgage-table-gap td { color: var(--muted-2); text-align: center !important; font-size: 12px; }
.mortgage-schedule-actions { justify-content: center; margin-top: 10px; }
.suite-model-note { margin: -2px 0 12px; }
.suite-status { min-height: 1.4em; margin: 12px 0 0; color: var(--success-ink); font-size: 13px; }
.suite-status.error { color: var(--danger-ink); }
.suite-result { margin-top: 16px; min-width: 0; }
.suite-result h2 { margin: 0 0 10px; font-size: 1rem; }
.suite-output { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); border: 1px solid var(--line); border-radius: var(--r-2); overflow: hidden; background: var(--bg-alt); }
.suite-output > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; padding: 11px 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.suite-output dt { color: var(--muted); font-size: 12.5px; }
.suite-output dd { margin: 0; font-family: var(--font-mono); font-weight: 600; text-align: right; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .mortgage-plan-grid { grid-template-columns: 1fr; }
  .mortgage-schedule-head { align-items: stretch; flex-direction: column; }
  .mortgage-tabs { align-self: flex-start; }
}

.tool-body {
  margin-top: 32px;
  display: grid;
  gap: 26px;
  max-width: 820px;
}
.tool-body section h2 {
  font-size: 1.05rem;
  margin: 0 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.tool-body p  { margin: 6px 0 10px; color: var(--ink-2); }
.tool-body ul { padding-left: 22px; }
.tool-body ul li { margin: 3px 0; color: var(--ink-2); }
.tool-body ol.steps { counter-reset: st; padding-left: 0; list-style: none; }
.tool-body ol.steps li {
  position: relative; padding-left: 30px; margin: 8px 0; color: var(--ink-2);
}
.tool-body ol.steps li::before {
  counter-increment: st;
  content: counter(st);
  position: absolute; left: 0; top: 1px;
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.tool-body dt { font-weight: 600; margin: 12px 0 2px; color: var(--ink); }
.tool-body dd { margin: 0 0 10px; color: var(--ink-2); }
.tool-body pre { background: var(--code-bg); }

.related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.related-list a {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 8px 10px; border-radius: var(--r-2);
  border: 1px solid var(--line); background: var(--surface);
  text-decoration: none; color: var(--ink);
}
.related-list a:hover { border-color: var(--ink); color: var(--accent); }
.related-list .name    { font-weight: 500; font-size: 14px; }
.related-list .summary { color: var(--muted); font-size: 12.5px; max-width: 100%; padding-left: 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Symbol / emoji pickers. Both pages render the same card markup, so the grid,
   the card and the two caption lines are defined once here. */
.symbol-workspace .two-col { gap: 14px; }
.symbol-workspace .hint { margin: 0; color: var(--muted); }
.symbol-category-group { margin: 18px 0 0; }
.symbol-category-group[hidden] { display: none; }
.symbol-category-group > h2 {
  margin: 0 0 8px; font-size: 13px; font-weight: 600;
  color: var(--muted); letter-spacing: .02em;
}
.symbol-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}
.symbol-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 72px; padding: 8px 4px;
  border: 1px solid var(--line); border-radius: var(--r-2);
  background: var(--surface); color: var(--ink);
  cursor: pointer; text-align: center; overflow: hidden;
}
.symbol-card[hidden] { display: none; }
.symbol-card:hover { border-color: var(--line-strong); background: var(--accent-soft); }
.symbol-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.symbol-card__glyph { font-size: 22px; line-height: 1.25; }
.symbol-card__code,
.symbol-card__html {
  max-width: 100%; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.symbol-recent { margin: 18px 0 0; }
.symbol-recent[hidden] { display: none; }
.symbol-recent > h2 {
  margin: 0 0 8px; font-size: 13px; font-weight: 600;
  color: var(--muted); letter-spacing: .02em;
}

/* Kinship calculator: quick-input row reuses the unit converter's preset row, and the
   answer is a row of chips because one input can legitimately have several terms. */
.kin-quick { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 14px 0 0; }
.kin-quick__label { color: var(--muted); font-size: 12.5px; }
.kin-quick__list { display: flex; flex-wrap: wrap; gap: 8px; }
.kin-quick__back { font-family: var(--font-mono); font-size: 15px; min-width: 44px; }
.kin-answer { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.kin-answer:empty { display: none; }
.kin-answer__item {
  padding: 6px 14px; border-radius: var(--r-2);
  border: 1px solid var(--line-2); background: var(--accent-soft);
  font-size: 1.15rem; font-weight: 600; color: var(--ink);
}
#kin-status:empty { display: none; }
/* 三列顶部对齐：性别那一列底下带一行说明，否则另外两个下拉会被压到下面去。 */
#kin-options { align-items: start; margin-top: 14px; }
#kin-options .field { margin: 0; }

/* Unit conversion. The control row deliberately mirrors the currency converter
   in fx.css (amount -> from -> swap -> to) so both converters read as one system. */
.unit-form {
  display: grid; gap: 12px;
  grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.4fr) auto minmax(150px, 1.4fr);
  align-items: end;
}
.unit-form .field { margin: 0; }
.unit-form__swap { padding-bottom: 6px; }
.unit-form__swap .btn-mini {
  width: 34px; height: 34px; padding: 0;
  font-size: 15px; line-height: 1;
  border: 1px solid var(--line-2); border-radius: var(--r-2);
  background: var(--surface); color: var(--ink-2);
}
.unit-form__swap .btn-mini:hover { border-color: var(--line-strong); color: var(--accent); }
.unit-form__foot {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  align-items: center; justify-content: space-between;
  margin: 14px 0 0;
}
.unit-result {
  margin: 0; min-width: 0;
  font-size: 1.15rem; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.unit-result:empty { display: none; }
.unit-result strong { font-weight: 700; }
/* 结论为空时（清空或输入有误）复制按钮仍留在右侧，避免控件左右跳动。 */
.unit-form__foot #unit-copy { margin-left: auto; }
/* 状态行只在出错时有内容；空着时不要画出一个空盒子。 */
#unit-status:empty { display: none; }
.unit-inverse { margin: 8px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.unit-inverse:empty { display: none; }
.unit-presets { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 14px 0 0; }
.unit-presets__label { color: var(--muted); font-size: 12.5px; }
.unit-presets__list { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-digits { margin-top: 14px; }
.unit-digits select { max-width: 220px; }

.unit-table__caption {
  caption-side: top; text-align: left;
  padding: 0 0 8px; color: var(--muted); font-size: 12.5px;
}
/* Mark both ends of the conversion so the headline and the table agree at a glance. */
#unit-table tr.unit-row--source th, #unit-table tr.unit-row--source td { background: var(--accent-soft); }
#unit-table tr.unit-row--target th, #unit-table tr.unit-row--target td { background: var(--accent-soft); font-weight: 600; }
#unit-table td[data-out] { text-align: right; overflow-wrap: anywhere; }
#unit-table th[scope=row] { font-weight: 400; text-align: left; }

/* Keep controls comfortably tappable, and avoid small editable text on phones. */
@media (max-width: 480px) {
  .tool-card-panel { padding: 14px; }
  .btn-mini, .btn-primary { min-height: 44px; }
  .field input[type=text], .field input[type=search], .field input[type=number],
  .field textarea, .field.mono input, .field.mono textarea, .field select { font-size: 16px; }
  .actions select { max-width: 100%; min-height: 36px; }
  .related-list { grid-template-columns: minmax(0, 1fr); }
  .symbol-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .symbol-card { min-height: 66px; }
  .kin-answer__item { font-size: 1.05rem; }
  .unit-form { grid-template-columns: 1fr; }
  .unit-form__swap { padding-bottom: 0; }
  .unit-form__swap .btn-mini { width: 100%; }
  .unit-digits select { max-width: 100%; }
}

/* color-convert：颜色选择器 */
.cc-layout { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 20px; align-items: start; }
.cc-picker { display: grid; gap: 12px; user-select: none; touch-action: none; }
.cc-sv {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-2); cursor: crosshair;
  background-image: linear-gradient(to top, #000, rgba(0,0,0,0)), linear-gradient(to right, #fff, rgba(255,255,255,0));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
}
.cc-sv-thumb {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.3); pointer-events: none;
}
.cc-bar { position: relative; height: 14px; border-radius: 7px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.cc-hue { background: linear-gradient(to right, #f00 0%, #ff0 16.67%, #0f0 33.33%, #0ff 50%, #00f 66.67%, #f0f 83.33%, #f00 100%); }
.cc-alpha-fill { position: absolute; inset: 0; border-radius: inherit; }
.cc-bar-thumb {
  position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.3); pointer-events: none;
}
.cc-sv:focus-visible, .cc-bar:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.cc-checker {
  background-color: #fff;
  background-image: linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),
                    linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);
  background-size: 10px 10px; background-position: 0 0, 5px 5px;
}
.cc-input-row { display: flex; gap: 8px; align-items: center; }
.cc-input-row input { flex: 1; min-width: 0; font-family: var(--font-mono); }
.cc-swatch { flex: none; width: 42px; height: 42px; border-radius: var(--r-2); overflow: hidden; border: 1px solid var(--line-strong); }
.cc-swatch span { display: block; width: 100%; height: 100%; }
.cc-out { margin-top: 4px; }
.cc-contrast { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--muted); }
.cc-contrast-item { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.cc-contrast-chip { display: inline-block; padding: 2px 8px; border-radius: var(--r-1); font-weight: 700; border: 1px solid var(--line); }
#cc-on-white { background: #fff; }
#cc-on-black { background: #000; }
@media (max-width: 720px) {
  .cc-layout { grid-template-columns: 1fr; }
  .cc-picker { max-width: 360px; }
}

/* 图片工具（共用）：文件接收区、选项、结果表、对比预览 */
.img-drop {
  display: grid; justify-items: center; gap: 6px; padding: 26px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-3); background: var(--bg);
  transition: border-color .12s, background .12s;
}
.img-drop:hover, .img-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.img-drop:focus-visible { outline: none; border-color: var(--focus); box-shadow: var(--shadow-focus); }
.img-drop-icon { width: 28px; height: 28px; color: var(--muted); }
.img-drop-title { font-weight: 600; color: var(--ink); cursor: pointer; }
.img-drop-hint { font-size: 12.5px; color: var(--muted); max-width: 560px; line-height: 1.6; }
.img-status { min-height: 1.4em; margin: 8px 0 0; }
.img-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 14px; align-items: end; margin-top: 14px; }
.img-options input[type=range] { height: 42px; margin: 0; }
.img-options .field { margin-bottom: 8px; }
.img-options input[type=range] { width: 100%; accent-color: var(--accent); }
.img-options output { font-family: var(--font-mono); color: var(--ink); font-weight: 600; }
.img-field-inline input[type=color] { width: 100%; height: 42px; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--surface); cursor: pointer; }
.img-field-inline input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.img-field-inline input[type=color]::-webkit-color-swatch { border: 1px solid var(--line-strong); border-radius: var(--r-1); }
.img-field-inline input[type=color]::-moz-color-swatch { border: 1px solid var(--line-strong); border-radius: var(--r-1); }
.img-check { display: flex; gap: 6px; align-items: center; min-height: 42px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.img-results { margin-top: 12px; }
.img-table td { vertical-align: middle; }
.img-name { display: flex; gap: 8px; align-items: center; min-width: 150px; overflow-wrap: anywhere; }
.img-thumb { width: 40px; height: 40px; flex: none; object-fit: cover; border-radius: var(--r-1); border: 1px solid var(--line); background: var(--bg-alt); }
.img-note { display: block; margin-top: 3px; color: var(--muted); font-family: var(--font-body); font-size: 11.5px; line-height: 1.5; }
.img-good { color: var(--success-ink); }
.img-bad { color: var(--danger-ink); }
.img-error { color: var(--danger-ink); }
.img-pending { color: var(--muted); }
.img-actions { white-space: nowrap; }
.img-actions .btn-mini + .btn-mini { margin-left: 6px; }
.img-compare { margin-top: 16px; }
.img-compare h3 { font-size: 14px; margin: 0 0 8px; }
.img-compare-name { color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
.img-compare-stage {
  --pos: 50%; position: relative; display: grid; max-height: 70vh; overflow: hidden; border-radius: var(--r-2); border: 1px solid var(--line);
  background-color: #fff;
  background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
.img-compare-stage img { grid-area: 1 / 1; width: 100%; max-height: 70vh; object-fit: contain; }
.img-compare-stage img + img { clip-path: inset(0 0 0 var(--pos)); }
.img-compare-stage::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); pointer-events: none; }
.img-compare-tag { position: absolute; top: 8px; padding: 2px 8px; border-radius: var(--r-1); background: rgba(23,23,42,.72); color: #fff; font-size: 12px; }
.img-compare-tag--a { left: 8px; }
.img-compare-tag--b { right: 8px; }
.img-compare-range { width: 100%; margin-top: 8px; accent-color: var(--accent); }
.img-notice { margin: 8px 0 0; }
.img-notice:empty { display: none; }
.img-notice.error { color: var(--danger-ink); }
.img-results .table-scroll { position: relative; }
@media (max-width: 640px) {
  table.img-table thead { display: none; }
  table.img-table, table.img-table tbody { display: block; }
  table.img-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.img-table td { display: block; border: 0; padding: 0; }
  table.img-table td:first-child, table.img-table td.img-actions, table.img-table td[colspan] { grid-column: 1 / -1; }
  table.img-table td[data-label]:not(:first-child):not(.img-actions)::before { content: attr(data-label); display: block; color: var(--muted); font: 600 11.5px/1.6 var(--font-body); }
  table.img-table tr:hover td { background: none; }
}
.img-format-note { margin: 0 0 4px; color: var(--muted-2); font-size: 12px; }
.img-thumb--empty { display: block; background: repeating-linear-gradient(45deg, var(--bg-alt), var(--bg-alt) 4px, var(--surface) 4px, var(--surface) 8px); }
.img-options :disabled { opacity: .4; cursor: not-allowed; }

/* image-crop：选区编辑器 */
.crop-frame { display: block; max-width: 100%; margin-top: 4px; padding: 12px; overflow: hidden; border-radius: var(--r-2); background: var(--bg-alt); }
.crop-stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; touch-action: none; user-select: none; vertical-align: top; }
.crop-img { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; }
.crop-box { position: absolute; box-sizing: border-box; border: 1.5px solid #fff; box-shadow: 0 0 0 9999px rgba(23,23,42,.55), 0 0 0 1px rgba(0,0,0,.35); cursor: move; }
.crop-box:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.crop-grid { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.55) calc(33.33% - .5px), rgba(255,255,255,.55) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.55) calc(66.66% - .5px), rgba(255,255,255,.55) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
                    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.55) calc(33.33% - .5px), rgba(255,255,255,.55) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.55) calc(66.66% - .5px), rgba(255,255,255,.55) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.crop-handle { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; background: #fff; border: 1px solid rgba(0,0,0,.45); border-radius: 2px; }
.crop-handle--nw { left: 0; top: 0; cursor: nwse-resize; } .crop-handle--n { left: 50%; top: 0; cursor: ns-resize; }
.crop-handle--ne { left: 100%; top: 0; cursor: nesw-resize; } .crop-handle--e { left: 100%; top: 50%; cursor: ew-resize; }
.crop-handle--se { left: 100%; top: 100%; cursor: nwse-resize; } .crop-handle--s { left: 50%; top: 100%; cursor: ns-resize; }
.crop-handle--sw { left: 0; top: 100%; cursor: nesw-resize; } .crop-handle--w { left: 0; top: 50%; cursor: ew-resize; }
.crop-box.is-locked .crop-handle--n, .crop-box.is-locked .crop-handle--e, .crop-box.is-locked .crop-handle--s, .crop-box.is-locked .crop-handle--w { display: none; }
@media (pointer: coarse) { .crop-handle { width: 22px; height: 22px; margin: -11px 0 0 -11px; } }
.crop-editor .img-options { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.crop-result { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.crop-preview { display: inline-block; max-width: 100%; line-height: 0; border: 1px solid var(--line); border-radius: var(--r-2);
  background-color: #fff; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.crop-preview img { max-width: 100%; max-height: 50vh; }
#crop-help { margin-top: 6px; }
.img-segment { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; padding: 0; border: 0; min-width: 0; grid-column: span 2; }
.img-segment legend { width: 100%; margin-bottom: 5px; padding: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.img-segment label { position: relative; display: inline-flex; }
.img-segment input { position: absolute; opacity: 0; pointer-events: none; }
.img-segment span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--surface); font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.img-segment input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.img-segment input:focus-visible + span { box-shadow: var(--shadow-focus); }
@media (max-width: 640px) { .img-segment { grid-column: auto; } }
/* image-exif：元数据详情 */
.img-options--checks { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.img-options--checks .img-check { min-height: 0; margin-bottom: 6px; }
.meta-details { margin-top: 16px; }
.meta-details h3 { font-size: 14px; margin: 0 0 8px; }
.meta-table th { width: 34%; font-weight: 600; text-align: left; }
.meta-table td { overflow-wrap: anywhere; }
.meta-table tr.meta-sensitive th, .meta-table tr.meta-sensitive td { color: var(--danger-ink); background: var(--danger-bg); }
/* image-base64：编码 / 解码两个区块 */
.b64-section + .b64-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.b64-title { margin: 0 0 10px; font-size: 15px; }
.b64-encode-out { display: grid; grid-template-columns: minmax(0, 160px) minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 8px; }
.b64-preview { display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-2);
  background-color: #fff; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%); background-size: 12px 12px; background-position: 0 0, 6px 6px; }
.b64-preview img { max-width: 100%; max-height: 240px; image-rendering: auto; }
.b64-decode-out .b64-preview { justify-content: flex-start; max-width: 360px; }
.b64-out-field textarea { min-height: 160px; word-break: break-all; }
#b64-dec-info.error { color: var(--danger-ink); }
@media (max-width: 640px) { .b64-encode-out { grid-template-columns: 1fr; } }
/* image-watermark：九宫格位置 */
.wm-grid { display: grid; grid-template-columns: repeat(3, 34px); gap: 4px; margin: 2px 0 12px; padding: 0; border: 0; }
.wm-grid legend { grid-column: 1 / -1; margin-bottom: 5px; padding: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.wm-grid label { position: relative; display: block; }
.wm-grid input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.wm-grid span { display: block; height: 26px; border: 1px solid var(--line-2); border-radius: var(--r-1); background: var(--surface); }
.wm-grid input:checked + span { border-color: var(--accent); background: var(--accent); }
.wm-grid input:focus-visible + span { box-shadow: var(--shadow-focus); }
.wm-text-field { grid-column: span 2; }
@media (max-width: 640px) { .wm-text-field { grid-column: auto; } }
#wm-logo { font-size: 13px; }
#wm-logo-info.error { color: var(--danger-ink); }
.field .field-label { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.wm-logo-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 42px; }
.wm-logo-row label.btn-mini { cursor: pointer; }
.wm-logo-row input:focus-visible + .hint, .wm-logo-row:focus-within label.btn-mini { box-shadow: var(--shadow-focus); }
/* image-color-picker：取色画布、放大镜、记录与主色 */
.cp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; margin-top: 14px; }
.cp-stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; cursor: crosshair; touch-action: manipulation; border-radius: var(--r-2); outline: none;
  background-color: #fff; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.cp-stage:focus-visible { box-shadow: var(--shadow-focus); }
#cp-canvas { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; border-radius: var(--r-2); }
.cp-loupe { position: fixed; z-index: 30; width: 132px; height: 132px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 4px 14px rgba(0,0,0,.25); pointer-events: none; image-rendering: pixelated; background: #fff; }
.cp-side { display: grid; gap: 8px; align-content: start; }
.cp-current { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg); }
.cp-hover-hex { font-size: 16px; font-weight: 600; color: var(--ink); }
.cp-pos, .cp-at { color: var(--muted); font-size: 12px; }
.cp-swatch { display: inline-block; flex: none; width: 28px; height: 28px; border-radius: var(--r-1); border: 1px solid rgba(0,0,0,.15); }
.cp-swatch--lg { width: 44px; height: 44px; }
.cp-swatch--wide { width: 100%; height: 44px; }
.cp-h { margin: 6px 0 0; font-size: 14px; }
.cp-picked { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.cp-picked li { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-2); }
.cp-values { display: grid; gap: 3px; min-width: 0; flex: 1; }
.cp-values > div { display: flex; justify-content: space-between; gap: 6px; align-items: center; font-size: 12.5px; }
.cp-values .mono { overflow-wrap: anywhere; }
.cp-copy { padding: 2px 8px; font-size: 12px; }
.cp-empty { margin: 0; color: var(--muted-2); font-size: 12.5px; }
.cp-palette-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.cp-palette-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.cp-count-field { margin: 0; min-width: 120px; }
.cp-palette { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.cp-palette li { display: grid; gap: 4px; justify-items: start; font-size: 12.5px; }
.cp-palette small { color: var(--muted); }
@media (max-width: 860px) { .cp-layout { grid-template-columns: 1fr; } }
.cp-stage-wrap { min-width: 0; }
/* favicon-generator：尺寸预览 */
.fav-result { margin-top: 14px; }
.fav-previews { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.fav-previews li { display: grid; justify-items: center; gap: 4px; padding: 10px; min-width: 88px; border: 1px solid var(--line); border-radius: var(--r-2);
  background-color: #fff; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%); background-size: 10px 10px; background-position: 0 0, 5px 5px; }
.fav-previews img { image-rendering: auto; }
.fav-previews span { font-size: 12.5px; color: var(--ink); }
.fav-previews small { font-size: 11px; color: var(--muted); }
#fav-html { min-height: 150px; }
/* image-split：网格预览与小图 */
.split-stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; margin-top: 4px; }
.split-img { display: block; max-width: 100%; max-height: 65vh; border-radius: var(--r-2); }
.split-grid { position: absolute; inset: 0; pointer-events: none; }
.split-line { position: absolute; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
.split-line--v { top: 0; bottom: 0; width: 1px; }
.split-line--h { left: 0; right: 0; height: 1px; }
.split-result { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.split-tiles { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; max-width: 720px; }
.split-tile { display: grid; gap: 3px; width: 100%; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface); cursor: pointer; font: inherit; }
.split-tile:hover { border-color: var(--accent); }
.split-tile:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.split-tile img { width: 100%; height: auto; display: block; }
.split-tile span { font: 11px/1.3 var(--font-mono); color: var(--muted); }
/* image-stitch：顺序列表与预览 */
.stitch-list { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 6px; counter-reset: st; }
.stitch-list li { display: grid; grid-template-columns: auto 40px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-2); counter-increment: st; }
.stitch-list li::before { content: counter(st); font: 600 12px var(--font-mono); color: var(--muted); min-width: 1.4em; text-align: right; }
.stitch-name { overflow-wrap: anywhere; font-size: 13.5px; }
.stitch-list small { font: 12px var(--font-mono); color: var(--muted); }
.stitch-btns { display: inline-flex; gap: 4px; }
.stitch-btns .btn-mini { min-width: 32px; padding: 4px 8px; }
#stitch-info.error { color: var(--danger-ink); }
.stitch-preview { margin: 8px 0; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-2); overflow: hidden;
  background-color: #fff; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
#stitch-canvas { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto; }
@media (max-width: 640px) {
  .stitch-list li { grid-template-columns: auto 40px minmax(0, 1fr) auto; row-gap: 2px; }
  .stitch-list li::before, .stitch-list .img-thumb { grid-row: span 2; }
  .stitch-name { grid-column: 3; } .stitch-list small { grid-column: 3; grid-row: 2; }
  .stitch-btns { grid-column: 4; grid-row: 1 / span 2; }
  .stitch-btns .btn-mini { min-width: 30px; padding: 4px 6px; }
}
/* image-adjust：滑块网格 */
.adj-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.adj-field output { font-family: var(--font-mono); color: var(--ink); font-weight: 600; }
.adj-reset-row { align-self: end; margin-bottom: 8px; }

/* dns：DNS 服务器大全 */
.dns-h { margin: 0 0 8px; font-size: 15px; }
.dns-probe { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg); }
.dns-probe-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 16px; margin: 0 0 8px; }
.dns-probe-facts dt { font-size: 12px; color: var(--muted); }
.dns-probe-facts dd { margin: 0; font-size: 13.5px; color: var(--ink); }
.dns-caveat { margin: 0; font-size: 12.5px; line-height: 1.65; color: var(--ink-2); }
.dns-filter { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 4px 14px; align-items: end; margin-top: 14px; }
.dns-filter .field { margin-bottom: 4px; }
.dns-only-ok { margin-bottom: 8px; min-height: 42px; }
.dns-group { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); }
.dns-group > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; list-style-position: inside; }
.dns-group > summary:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--r-2); }
.dns-group-count { font-weight: 400; font-size: 12.5px; color: var(--muted); margin-left: 6px; }
.dns-group-desc { margin: 0 14px 8px; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.dns-group .table-scroll { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-2) var(--r-2); }
table.dns-table th[scope=row] { font-weight: 400; text-align: left; min-width: 200px; max-width: 340px; vertical-align: top; white-space: normal; background: var(--surface); }
table.dns-table td:nth-child(4) { min-width: 170px; }
table.dns-table td { vertical-align: top; }
.dns-name { display: block; font-weight: 600; color: var(--ink); }
.dns-op, .dns-note, .dns-enc, .dns-src-url { display: block; margin-top: 3px; font-size: 11.5px; line-height: 1.55; color: var(--muted); }
.dns-note { color: var(--ink-2); max-width: 360px; }
.dns-enc span { display: block; overflow-wrap: anywhere; }
.dns-enc code, .dns-src-url { font-family: var(--font-mono); overflow-wrap: anywhere; }
.dns-purpose { display: inline-block; margin-top: 4px; padding: 0 6px; border-radius: var(--r-1); font-size: 11px; line-height: 18px; border: 1px solid var(--line-2); color: var(--ink-2); }
.dns-purpose--security, .dns-purpose--family, .dns-purpose--adult, .dns-purpose--adblock { border-color: rgba(160,30,43,.3); color: var(--accent); background: var(--accent-soft); }
.dns-ips { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.dns-ips li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.dns-ip { font-family: var(--font-mono); font-size: 12.8px; color: var(--ink); overflow-wrap: anywhere; }
.dns-copy { padding: 1px 7px; font-size: 11.5px; }
.dns-badge { display: inline-block; padding: 0 6px; border-radius: var(--r-1); font-size: 11px; line-height: 18px; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); background: var(--bg); }
.dns-badge--ok { color: var(--success-ink); background: var(--success-bg); border-color: rgba(23,91,52,.25); }
.dns-badge--refused, .dns-badge--servfail, .dns-badge--malformed, .dns-badge--other { color: var(--danger-ink); background: var(--danger-bg); border-color: rgba(143,28,28,.2); }
.dns-source { display: inline-block; font-size: 12px; line-height: 1.5; }
.dns-source--official { color: var(--success-ink); }
.dns-source--directory { color: var(--ink-2); }
.dns-source--community { color: var(--muted); }
.dns-source--retired { color: var(--danger-ink); font-weight: 600; }
.dns-none { color: var(--muted-2); }
.dns-empty { margin: 14px 0 0; color: var(--muted); }
.dns-howto { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.dns-howto p, .dns-howto-list { font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.dns-cmd { margin: 8px 0; padding: 10px 12px; border-radius: var(--r-2); background: var(--code-bg); color: var(--code-ink); font-size: 12.5px; overflow-x: auto; }
@media (max-width: 720px) {
  .dns-filter { grid-template-columns: 1fr; }
  table.dns-table thead { display: none; }
  table.dns-table, table.dns-table tbody, table.dns-table tr { display: block; }
  table.dns-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.dns-table th[scope=row], table.dns-table td { display: block; border: 0; padding: 4px 0; min-width: 0; }
  table.dns-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font: 600 11.5px/1.6 var(--font-body); }
  table.dns-table tr:hover td, table.dns-table tr:hover th { background: none; }
}
.dns-badge--partial { color: #7a5b00; background: #fff6d9; border-color: rgba(122,91,0,.25); }

/* ---------- 在线计算器 /calculator/ ---------- */
/* 普通模式只显示 4 列基本键；科学模式在左侧加 5 列函数键，上方两行留给角度单位。 */
.calc { --key-h: 46px; --key-gap: 6px; }
.calc-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.calc-bar-hint { margin: 0; color: var(--muted); font-size: 12.5px; }
.calc-mode { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-2); overflow: hidden; background: var(--surface); }
.calc-mode button { padding: 8px 16px; border-right: 1px solid var(--line-2); color: var(--muted); font-size: 14px; }
.calc-mode button:last-child { border-right: 0; }
.calc-mode button:hover { color: var(--ink); }
.calc-mode button[aria-selected="true"] { color: #fff; background: var(--ink); }
.calc-mode button:focus-visible { box-shadow: inset var(--shadow-focus); border-radius: 0; }

.calc-shell { display: grid; grid-template-columns: minmax(0, auto) minmax(220px, 1fr); gap: 18px; align-items: start; }
.calc-main { width: 380px; max-width: 100%; }
.calc[data-mode="scientific"] .calc-main { width: 720px; }

.calc-display { position: relative; margin-bottom: 10px; padding: 10px 14px 8px; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--code-bg); }
.calc-flags { position: absolute; top: 8px; left: 14px; display: flex; gap: 6px; font: 600 11px/1 var(--font-mono); color: var(--muted); letter-spacing: .04em; }
.calc-flags span { padding: 2px 5px; border: 1px solid var(--line-2); border-radius: var(--r-1); background: var(--surface); }
.calc-expr { display: block; width: 100%; margin: 14px 0 2px; padding: 4px 0; border: 0; border-bottom: 1px dashed transparent; background: transparent; color: var(--ink-2); font: 16px/1.4 var(--font-mono); text-align: right; }
.calc-expr::placeholder { color: var(--muted-2); font-family: var(--font-body); font-size: 13px; }
.calc-expr:focus { outline: none; border-bottom-color: var(--line-strong); }
.calc-result { display: block; min-height: 1.3em; color: var(--ink); font: 600 32px/1.3 var(--font-mono); text-align: right; overflow-wrap: anywhere; }
.calc-result.is-preview { color: var(--muted); font-weight: 400; }
.calc-grouped { min-height: 1.4em; margin: 0; color: var(--muted); font: 12px/1.4 var(--font-mono); text-align: right; }
.calc-msg { margin: 6px 0 0; color: var(--danger-ink); font-size: 13px; text-align: right; }

.calc-pads { display: flex; gap: 12px; align-items: flex-start; }
.calc-keys { display: grid; gap: var(--key-gap); grid-auto-rows: var(--key-h); }
.calc-keys--std { flex: 1 1 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.calc-keys--sci { flex: 1.25 1 0; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.calc-key { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 0 2px; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--surface); color: var(--ink); font: 15px/1 var(--font-body); white-space: nowrap; user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: background .1s, border-color .1s, color .1s; }
.calc-key sup, .calc-key sub { font-size: .68em; line-height: 0; }
.calc-key:hover { border-color: var(--ink); background: var(--bg-alt); }
.calc-key:active, .calc-key.is-pressed { background: var(--line); }
.calc-key:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.calc-key:disabled { color: var(--muted-2); border-color: var(--line); background: var(--surface); cursor: default; }
.calc-key--num { font: 500 19px/1 var(--font-mono); }
.calc-key--op { background: var(--bg-alt); font-size: 20px; }
.calc-key--fn { font-size: 14px; color: var(--ink-2); }
.calc-key--mem { font-size: 13px; color: var(--muted); }
.calc-key--clear { color: var(--accent); font-weight: 600; }
.calc-key--eq { border-color: var(--ink); background: var(--ink); color: #fff; font-size: 22px; }
.calc-key--eq:hover, .calc-key--eq.is-pressed { border-color: var(--accent); background: var(--accent); }

.calc-angle { grid-column: 1 / -1; grid-row: span 2; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-width: 0; margin: 0; padding: 0 2px; border: 0; }
.calc-angle legend { float: left; margin-right: 4px; padding: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.calc-angle label { position: relative; display: inline-flex; }
.calc-angle input { position: absolute; opacity: 0; pointer-events: none; }
.calc-angle span { padding: 7px 12px; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--surface); color: var(--ink-2); font-size: 13.5px; cursor: pointer; }
.calc-angle input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.calc-angle input:focus-visible + span { box-shadow: var(--shadow-focus); }

.calc-history { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg); }
.calc-history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.calc-history-head h2 { margin: 0; font-size: 1rem; }
.calc-history-head .btn-mini { padding: 4px 10px; font-size: 12.5px; }
.calc-history-empty, .calc-history-note { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.calc-history-note { margin-top: 8px; color: var(--muted-2); font-size: 12px; }
.calc-history-list { max-height: 420px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.calc-history-list li { display: grid; padding: 6px 0; border-bottom: 1px solid var(--line); }
.calc-history-list li:last-child { border-bottom: 0; }
.calc-history-list button { padding: 2px 4px; border-radius: var(--r-1); font-family: var(--font-mono); text-align: right; overflow-wrap: anywhere; }
.calc-history-list button:hover { background: var(--bg-alt); color: var(--accent); }
.calc-history-expr { color: var(--muted); font-size: 12.5px; }
.calc-history-result { color: var(--ink); font-size: 15px; font-weight: 600; }
.calc-shortcut { margin: 14px 0 0; }

@media (max-width: 1100px) {
  .calc[data-mode="scientific"] .calc-shell { grid-template-columns: minmax(0, 1fr); }
  .calc[data-mode="scientific"] .calc-main { width: auto; }
}
@media (max-width: 720px) {
  .calc-shell { grid-template-columns: minmax(0, 1fr); }
  .calc-main, .calc[data-mode="scientific"] .calc-main { width: auto; }
  .calc-pads { flex-direction: column; align-items: stretch; }
  .calc-keys--sci, .calc-keys--std { flex: none; }
  .calc-keys--sci { --key-h: 40px; }
  .calc-angle { grid-row: auto; padding-bottom: 2px; }
}
@media (max-width: 480px) {
  .calc { --key-h: 52px; }
  .calc-result { font-size: 28px; }
}
