/* =========================================================
   互动工具 · 组件样式（只服务 tools/ 下的页面）
   依赖 styles.css 的变量与 guide.css 的排版类
   ========================================================= */

.tool-main { max-width: 860px; margin: 0 auto; padding: 0 22px 64px; }

/* 卡片 */
.tool-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 26px 26px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.045);
  margin-bottom: 16px;
}
.tool-card > h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.tool-hint {
  margin: 0 0 18px;
  font-size: 12.8px;
  line-height: 1.72;
  color: var(--muted);
}
.tool-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: #f0f0f3;
  border-radius: 5px;
  padding: 1px 5px;
}

/* 表单栅格 */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.tool-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tool-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tool-field > label {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.tool-input,
.tool-select {
  height: 42px;
  min-width: 0;
  padding: 0 12px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tool-input:focus,
.tool-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}
.tool-input::-webkit-outer-spin-button,
.tool-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tool-input[type="number"] { -moz-appearance: textfield; }
.tool-suffix { font-size: 12px; color: var(--gray); }

/* 分段按钮 */
.tool-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: #f0f0f3;
  border-radius: 10px;
}
.tool-seg button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  color: #4a4a4f;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.tool-seg button:hover { color: var(--ink); }
.tool-seg button.on {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.tool-seg button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* 胶囊多选 */
.tool-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-pill {
  border: 1px solid #d2d2d7;
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.tool-pill:hover { border-color: #b0b0b8; }
.tool-pill.on {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 500;
}

/* 按钮 */
.tool-btn {
  height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.tool-btn:hover { background: var(--blue-hover); }
.tool-btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid #d2d2d7;
}
.tool-btn.ghost:hover { background: #f5f5f7; }
.tool-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

/* 结果区 */
.tool-out {
  margin-top: 18px;
  padding: 18px 20px;
  background: #f7f9fc;
  border-radius: 14px;
}
.tool-big {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.tool-big small {
  margin-left: 5px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.tool-sub { margin-top: 4px; font-size: 13px; color: var(--muted); line-height: 1.65; }
.tool-kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid #e8e8ed;
  font-size: 14px;
}
.tool-kv:last-child { border-bottom: 0; }
.tool-kv > span { color: var(--muted); }
.tool-kv > b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tool-verdict {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.tool-verdict.ok { background: #e7f6ec; color: #146c34; }
.tool-verdict.warn { background: #fff4e0; color: #8a5300; }
.tool-verdict.bad { background: #fdeaea; color: #a81c17; }
.tool-verdict.info { background: var(--blue-tint); color: #0a3d70; }

/* 进度条 */
.tool-meter {
  height: 8px;
  margin: 10px 0 4px;
  border-radius: 999px;
  background: #e8e8ed;
  overflow: hidden;
}
.tool-meter > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--blue);
  transition: width 0.35s ease;
}
.tool-meter.warn > i { background: #ff9500; }
.tool-meter.bad > i { background: #d92b25; }

/* 表格（可横向滚动） */
.tool-tw {
  margin-top: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tool-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tool-table th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid #e2e2e7;
  white-space: nowrap;
}
.tool-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f3;
  color: #3a3a3f;
  vertical-align: top;
  line-height: 1.6;
}
.tool-table tbody tr:last-child td { border-bottom: 0; }
.tool-table td:first-child { color: var(--ink); font-weight: 500; }
.tool-table tr.hit td { background: #fbfdff; }

/* 提示条 */
.tool-warn {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #fff6e6;
  color: #6f4708;
  font-size: 13px;
  line-height: 1.72;
}
.tool-warn b { color: #54350a; }
.tool-note {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--blue-tint);
  color: #0a3d70;
  font-size: 13px;
  line-height: 1.72;
}
.tool-note b { color: #062f58; }

/* 两栏 */
.tool-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.tool-hidden { display: none !important; }

/* 清单 */
.tool-checklist { list-style: none; margin: 0; padding: 0; }
.tool-checklist li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f3;
  font-size: 14px;
  line-height: 1.65;
}
.tool-checklist li:last-child { border-bottom: 0; }
.tool-checklist input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.tool-checklist label { cursor: pointer; }
.tool-checklist li.done label { color: var(--gray); text-decoration: line-through; }

/* 工具页尾相关链接 */
.tool-rel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.tool-rel a {
  display: block;
  padding: 14px 16px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.045);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.tool-rel a:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08); }
.tool-rel span {
  display: block;
  margin-bottom: 4px;
  font-size: 11.5px;
  color: var(--gray);
}
.tool-rel b { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.45; }

/* 工具总览页 */
.tool-hub-sec {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin: 34px 0 14px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.tool-hub-sec:first-of-type { margin-top: 0; }
.tool-hub-sec span { font-size: 13px; font-weight: 500; color: var(--muted); }
.tool-hub {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.tool-hub-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.045);
  text-decoration: none;
  transition: transform 0.16s, box-shadow 0.16s;
}
.tool-hub-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.09); }
.tool-hub-card em {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--gray);
}
.tool-hub-card b { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.tool-hub-card p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
/* 奇数张时最后一张横跨整行，避免右下留大缺口 */
.tool-hub > .tool-hub-card:last-child:nth-child(odd) { grid-column: 1 / -1; }

@media (max-width: 760px) {
  .tool-card { padding: 20px 18px 22px; }
  .tool-grid, .tool-grid.three, .tool-split, .tool-rel, .tool-hub { grid-template-columns: 1fr; }
  .tool-big { font-size: 28px; }
}
