/* 绿色工具箱 — 网页版工具（浏览器内运行，不上传文件）
   只被 /tools/web-*.html 引用，不进主样式表，避免给其它页面加体积。 */

.wt-wrap { margin: 0 0 28px; }

.wt-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--green-dark);
  background: var(--green-soft); border: 1px solid var(--green-line);
  border-radius: 999px; padding: 3px 11px; margin-bottom: 10px;
}
.wt-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

.wt-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin: 18px 0;
}

.wt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wt-grid-1 { grid-template-columns: 1fr; }

.wt-pane { display: flex; flex-direction: column; min-width: 0; }
.wt-pane-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 6px;
}
.wt-pane-head > span:first-child {
  font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em;
}
.wt-tools { display: flex; gap: 4px; }

.wt-mini {
  font: inherit; font-size: 12.5px; line-height: 1;
  padding: 5px 9px; border-radius: 6px; cursor: pointer;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line);
}
.wt-mini:hover { color: var(--green-dark); border-color: var(--green-line); background: var(--green-soft); }
.wt-mini:active { transform: translateY(1px); }

.wt-ta {
  font-family: var(--mono); font-size: 13px; line-height: 1.65;
  width: 100%; min-height: 300px; resize: vertical;
  padding: 11px 12px; color: var(--ink);
  background: #fdfdfc; border: 1px solid var(--line); border-radius: 8px;
  outline: none; tab-size: 2;
}
.wt-ta:focus { border-color: var(--green-line); box-shadow: 0 0 0 3px rgba(26,154,94,.09); }
.wt-ta[readonly] { background: var(--surface); }
.wt-ta::placeholder { color: var(--ink-3); }

.wt-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.wt-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 13.5px; color: var(--ink-2); }
.wt-opts label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.wt-opts input[type="checkbox"], .wt-opts input[type="radio"] { accent-color: var(--green); margin: 0; }
.wt-opts input[type="number"] {
  width: 74px; font: inherit; font-size: 13.5px; padding: 4px 6px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
.wt-opts select {
  font: inherit; font-size: 13.5px; padding: 4px 6px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.wt-opts input[type="text"] {
  font: inherit; font-size: 13.5px; padding: 4px 8px; width: 150px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}

.wt-run {
  font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1;
  margin-left: auto; padding: 11px 22px; cursor: pointer;
  color: #fff; background: var(--green);
  border: 0; border-radius: 8px;
}
.wt-run:hover { background: var(--green-dark); }
.wt-run:disabled { background: var(--ink-3); cursor: default; }

.wt-note {
  margin-top: 12px; padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; line-height: 1.6;
  background: var(--green-soft); color: var(--green-dark); border: 1px solid var(--green-line);
}
.wt-note-err { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.wt-note[hidden] { display: none; }
.wt-note code { font-family: var(--mono); font-size: 12.5px; }

.wt-stat { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* 图片类工具 */
.wt-drop {
  display: block; width: 100%; text-align: center; cursor: pointer;
  padding: 26px 16px; margin: 4px 0 0;
  border: 2px dashed var(--green-line); border-radius: 10px;
  background: var(--green-soft); color: var(--green-dark);
  font-size: 14px; line-height: 1.7;
}
.wt-drop strong { font-size: 15px; }
.wt-drop small { display: block; color: var(--ink-2); font-size: 12.5px; margin-top: 4px; }
.wt-drop.wt-over { background: #d9f0e4; border-color: var(--green); }
.wt-drop input[type="file"] { display: none; }

.wt-preview {
  margin-top: 14px; padding: 10px; border-radius: 10px;
  background:
    linear-gradient(45deg, #ececea 25%, transparent 25%, transparent 75%, #ececea 75%) 0 0/16px 16px,
    linear-gradient(45deg, #ececea 25%, transparent 25%, transparent 75%, #ececea 75%) 8px 8px/16px 16px,
    #f7f7f5;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; min-height: 120px;
}
.wt-preview canvas { max-width: 100%; height: auto; display: block; box-shadow: 0 1px 6px rgba(0,0,0,.12); background: #fff; }
/* 去底工具：透明区域要露出预览框自带的棋盘格，不能盖白底 */
.wt-preview canvas.wt-checker { background: transparent; box-shadow: none; }
.wt-preview canvas.wt-keycanvas { cursor: crosshair; }
.wt-preview .wt-empty { color: var(--ink-3); font-size: 13px; }

.wt-files { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.wt-files li {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--line); color: var(--ink-2);
}
.wt-files li:last-child { border-bottom: 0; }
.wt-files .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.wt-files .s { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12.5px; }
.wt-files .s b { color: var(--green-dark); }
.wt-files .wf-del {
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 5px;
}
.wt-files .wf-del:hover { background: #f3e3e0; color: #b4442f; }

/* 表格类工具 */
.wt-sheetbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: 13px; }
.wt-sheetbar span.lbl { color: var(--ink-3); }
.wt-sheetbar button {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 3px 10px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
}
.wt-sheetbar button.on { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); font-weight: 600; }

/* 工作表改名清单（Excel 工作表整理） */
.wt-sheetbar.wt-sheetedit { display: block; margin-top: 12px; }
.wt-sheetedit .se-head { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.wt-sheetedit .se-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 2px; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.wt-sheetedit .se-row:last-child { border-bottom: 0; }
.wt-sheetedit .se-idx { width: 22px; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.wt-sheetedit input[type="checkbox"] { accent-color: var(--green); margin: 0; }
.wt-sheetedit input[type="text"] {
  flex: 1; min-width: 120px; font: inherit; font-size: 13px;
  padding: 5px 9px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 6px;
}
.wt-sheetedit input[type="text"]:focus { border-color: var(--green-line); outline: none; }
.wt-sheetedit .se-meta { width: 108px; text-align: right; color: var(--ink-3); font-size: 12px; }

.wt-tablewrap {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 10px;
  overflow: auto; max-height: 340px; background: #fff;
}
.wt-tablewrap:empty { display: none; }
.wt-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.wt-table th, .wt-table td {
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  padding: 6px 9px; text-align: left; white-space: nowrap;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.wt-table th { position: sticky; top: 0; background: var(--green-soft); color: var(--green-dark); font-weight: 600; z-index: 1; }
.wt-table th:last-child, .wt-table td:last-child { border-right: 0; }
.wt-table tbody tr:nth-child(even) td { background: #fafaf8; }
.wt-table .wt-th-n, .wt-table .wt-td-n {
  width: 40px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums;
  background: #fbfbf9 !important;
}
.wt-table .wt-td-empty, .wt-table .wt-td-more {
  color: var(--ink-3); text-align: center; padding: 14px; font-size: 12.5px;
}
.wt-table tfoot td { border-bottom: 0; }

.wt-tablewrap-out { max-height: 420px; }
.wt-textout { margin-top: 14px; }
.wt-textout[hidden] { display: none; }
.wt-textout .wt-ta { min-height: 280px; }
.wt-resultbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding: 9px 12px; border-radius: 9px;
  background: var(--green-soft); border: 1px solid var(--green-line);
  font-size: 13px; color: var(--ink-2);
}
.wt-resultbar .wt-rlabel { font-weight: 700; color: var(--green-dark); }
.wt-resultbar .wt-rsum { flex: 1; min-width: 120px; }
.wt-resultbar[hidden] { display: none; }

.wt-dynopts { display: inline-flex; flex-wrap: wrap; gap: 10px; }
.wt-dynopts:empty { display: none; }
.wt-dynopts label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-2); }
.wt-dynopts select {
  font-size: 12.5px; padding: 3px 6px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--ink); max-width: 190px;
}

.wt-progress { height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; margin-top: 10px; }
.wt-progress i { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }

/* 裁剪工具 */
.crop-stage {
  position: relative; display: inline-block; max-width: 100%;
  line-height: 0; touch-action: none; user-select: none;
}
.crop-stage img {
  max-width: 100%; display: block; user-select: none;
  -webkit-user-drag: none; -webkit-user-select: none;
}
.crop-box {
  position: absolute; box-sizing: border-box;
  border: 1px solid #fff; cursor: move;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45);
}
.crop-box::before {
  content: ''; position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  border: 1px dashed rgba(255, 255, 255, .75); pointer-events: none;
}
.crop-box .ch {
  position: absolute; width: 13px; height: 13px; background: #fff;
  border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
}
.crop-box .ch.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.crop-box .ch.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.crop-box .ch.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.crop-box .ch.se { right: -7px; bottom: -7px; cursor: nwse-resize; }

.wt-hint-inline { color: var(--ink-3); font-size: 12.5px; }

/* 匹配补全的列选择 */
.wt-fillcols {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  width: 100%; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line);
}
.wt-fclabel { color: var(--ink-3); font-size: 12.5px; }
.wt-fc { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.wt-fc input { margin: 0; }

@media (max-width: 760px) {
  .wt-grid { grid-template-columns: 1fr; }
  .wt-ta { min-height: 190px; font-size: 12.5px; }
  .wt-card { padding: 13px; }
  .wt-run { width: 100%; margin-left: 0; padding: 13px 18px; }
  .wt-opts { gap: 10px; }
}

/* 页面下半部分的常见问题 */
details.faq { border-bottom: 1px solid var(--line); padding: 10px 0; }
details.faq:first-of-type { border-top: 1px solid var(--line); }
details.faq summary {
  cursor: pointer; font-weight: 600; font-size: 15px; color: var(--ink);
  list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "＋ "; color: var(--green); font-weight: 700; }
details.faq[open] summary::before { content: "－ "; }
details.faq p { margin: 7px 0 2px; color: var(--ink-2); font-size: 14.5px; }

/* Markdown 预览面板 */
.wt-md {
  flex: 1; min-height: 300px; max-height: 640px; overflow: auto;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink);
  font-size: 15px; line-height: 1.78;
}
.wt-md > *:first-child { margin-top: 0; }
.wt-md > *:last-child { margin-bottom: 0; }
.wt-md h1, .wt-md h2, .wt-md h3, .wt-md h4, .wt-md h5, .wt-md h6 {
  margin: 18px 0 8px; line-height: 1.35; color: var(--ink);
}
.wt-md h1 { font-size: 23px; }
.wt-md h2 { font-size: 20px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.wt-md h3 { font-size: 17px; }
.wt-md h4, .wt-md h5, .wt-md h6 { font-size: 15px; color: var(--ink-2); }
.wt-md p { margin: 10px 0; }
.wt-md ul, .wt-md ol { margin: 8px 0; padding-left: 24px; }
.wt-md li { margin: 3px 0; }
.wt-md blockquote {
  margin: 12px 0; padding: 6px 14px;
  border-left: 3px solid var(--green); background: var(--green-soft);
  color: var(--ink-2); border-radius: 0 6px 6px 0;
}
.wt-md blockquote p { margin: 4px 0; }
.wt-md code {
  font-family: var(--mono); font-size: 13px;
  background: #f2f3f5; padding: 1px 5px; border-radius: 4px;
}
.wt-md pre {
  margin: 12px 0; padding: 11px 13px; overflow: auto;
  background: #f6f8fa; border: 1px solid var(--line); border-radius: 8px;
}
.wt-md pre code { background: none; padding: 0; font-size: 12.8px; line-height: 1.6; }
.wt-md table { width: 100%; margin: 12px 0; border-collapse: collapse; font-size: 14px; }
.wt-md th, .wt-md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.wt-md th { background: var(--surface); font-weight: 600; }
.wt-md img { max-width: 100%; height: auto; border-radius: 6px; }
.wt-md hr { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }
.wt-md a { color: var(--green-dark); }
.wt-md-empty { margin: 0; color: var(--ink-3); font-size: 13.5px; }
.wt-md-wrap pre { white-space: pre-wrap; word-break: break-word; }
.wt-img-off {
  display: inline-block; padding: 1px 7px; border: 1px dashed var(--line);
  border-radius: 4px; color: var(--ink-3); font-size: 12.5px;
}

/* 画布类结果（二维码）：白底、居中、不拉伸 */
.wt-canvas-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 300px; padding: 16px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
}
.wt-canvas-wrap canvas { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
.wt-canvas-wrap .wt-empty { color: var(--ink-3); font-size: 13.5px; }
.wt-pager {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 9px; font-size: 13px; color: var(--ink-3);
}
.wt-opts input.wt-re {
  width: 260px; max-width: 46vw; padding: 6px 9px; font-size: 13.5px;
  font-family: ui-monospace, Consolas, monospace;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.wt-opts input.wt-num { width: 62px; padding: 6px 8px; text-align: center; }
.wt-opts input.wt-num-wide { width: 84px; padding: 6px 8px; text-align: center; }
.wt-row2 { margin-top: 14px; }
.wt-opts input[type="file"] {
  font-size: 13px; max-width: 240px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  padding: 4px 6px; color: var(--ink-2); cursor: pointer;
}
.wt-opts input[type="file"]::file-selector-button {
  margin-right: 8px; padding: 3px 10px; border: 1px solid var(--green-line);
  border-radius: 5px; background: var(--green-soft); color: var(--green-dark);
  font-size: 12.5px; cursor: pointer;
}

@media (max-width: 760px) {
  .wt-md { min-height: 220px; max-height: none; font-size: 14.5px; }
}

/* 徽标里的实时网络请求计数器 */
.wt-net {
  margin-left: 4px; padding-left: 8px; font-weight: 500;
  border-left: 1px solid var(--green-line); font-variant-numeric: tabular-nums;
}
.wt-net.bad { color: #b42318; border-left-color: #f3b7b2; }

/* CSS 阴影生成器的实时预览（web-shadow.js 注入） */
.sh-preview { padding: 6px 0 16px; }
.sh-stage {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; padding: 24px; border-radius: 12px;
  background: #f4f8f5; border: 1px solid var(--green-line);
}
.sh-box {
  background: #fff; padding: 26px 34px; border-radius: 12px;
  font-size: 15px; font-weight: 600; color: #24503a; line-height: 1.5;
}
.sh-text { background: transparent; font-size: 24px; padding: 8px 4px; }
.sh-filter { background: #fff; font-size: 15px; }

/* 图片转 ICO 的多尺寸预览 */
.ico-prev { display: flex; align-items: flex-end; gap: 18px; }
.ico-prev canvas { background: #fff; border: 1px solid var(--green-line); border-radius: 4px; }
.ico-cap { display: block; margin-top: 10px; color: #6b7d72; }

/* 图片取色：色板与配色条（web-palette.js 注入） */
.pal-grid { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 0 6px; }
.pal-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 12px; border: 1px solid var(--green-line); border-radius: 10px;
  background: var(--surface); cursor: pointer; transition: transform .12s ease;
}
.pal-card:hover { transform: translateY(-2px); }
.pal-chip { display: block; width: 76px; height: 56px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.pal-card b { font: 600 13px/1 var(--mono); color: var(--green-dark); letter-spacing: .3px; }
.pal-card small { font-size: 12px; color: #6b7d72; }
.pal-head { margin: 18px 0 8px; font-size: 13px; color: #6b7d72; }
.pal-strip { display: flex; max-width: 380px; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.pal-mini { flex: 1; height: 46px; border: 0; padding: 0; cursor: pointer; }
.wt-preview canvas.wt-mosaic-canvas { cursor: crosshair; }

/* 对比度检查：把文字色铺在背景色上的实时色块（web-contrast.js 注入） */
.ct-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 4px; }
.ct-chip {
  display: inline-block; padding: 7px 14px; border-radius: 7px;
  font-size: 14px; font-weight: 600; line-height: 1.35;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}

/* 色阶生成：一条档位色带（web-shades.js 注入，类名用 tone- 前缀避开阴影工具的 sh-） */
.tone-wrap { display: flex; flex-direction: column; gap: 8px; padding: 2px 0 6px; }
.tone-row { display: flex; align-items: center; gap: 10px; }
.tone-name { flex: 0 0 68px; font: 600 12px/1 var(--mono); color: var(--green-dark); }
.tone-bars { display: flex; flex: 1 1 auto; min-width: 0; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.07); }
.tone-bar {
  flex: 1 1 0; min-width: 0; padding: 14px 0 12px; text-align: center;
  font: 600 11px/1 var(--mono); letter-spacing: .2px; overflow: hidden;
}

/* 色盲模拟：原始与模拟色并排的结果表（web-cvd.js 注入） */
.cvd-wrap { overflow-x: auto; padding: 2px 0 6px; }
.cvd-tb { border-collapse: collapse; font-size: 12.5px; }
.cvd-tb th, .cvd-tb td { padding: 5px 10px; border-bottom: 1px solid var(--green-line); white-space: nowrap; }
.cvd-tb th { font-weight: 600; color: var(--green-dark); text-align: left; }
.cvd-tb td { font-family: var(--mono); }
.cvd-tb td:first-child { font-family: inherit; color: var(--ink-2); }
.cvd-sw {
  display: inline-block; width: 15px; height: 15px; margin-right: 6px;
  border-radius: 4px; vertical-align: -2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14);
}

/* 表格类工具的文本型 opts：列名输入与多行规则框 */
.wt-opts input.wt-txt { width: 132px; padding: 6px 8px; text-align: left; }
.wt-opts label.wt-full { flex: 1 1 100%; align-items: flex-start; cursor: default; }
.wt-opts textarea.wt-rules {
  flex: 1 1 auto; min-width: 200px; min-height: 86px; font: inherit; font-size: 13px;
  line-height: 1.55; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink); resize: vertical;
}
