/* 优优工具网 · 工具运行页样式（/tools/{slug}，仅 tool.html 引用；变量继承 site.css） */

/* 头部 */
.tool-header { display: flex; align-items: flex-start; gap: 14px; padding: 4px 2px 16px; }
.tool-header.is-loading { align-items: center; }
.tool-icon {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--c, #1e6dfe) 12%, transparent);
  color: var(--c, #1e6dfe); font-size: 26px;
}
.tool-head-main { flex: 1; min-width: 0; }
.tool-head-main h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: .2px; color: var(--text); }
.tool-head-main p { margin: 5px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.tool-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tm-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3.5px 10px;
  border-radius: 999px; background: var(--card-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--text-2); text-decoration: none;
}
.tm-chip.cost { background: #fff7ec; border-color: #ffe3bd; color: #c47b1a; }
.tm-chip.free { background: #ecfaf0; border-color: #c9efd6; color: #199a3b; }
.tm-chip.link:hover { border-color: var(--brand-200); color: var(--brand); }
.tool-fav {
  flex: none; width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text-3); font-size: 17px;
}
.tool-fav:hover { border-color: #ffd88a; color: #f5a623; }
.tool-fav.on { background: #fff8e8; border-color: #ffd88a; color: #f5a623; }
.tool-missing { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; color: var(--text-2); }

/* 工作区卡片 */
.tool-workcard { margin-top: 2px; padding: 20px; }
.tool-loading { padding: 8px 2px; }
.tool-doccard { margin-top: 14px; padding: 14px 20px; }
.tool-doc-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; list-style: none;
  font-size: 14px; font-weight: 700; color: var(--text);
}
.tool-doc-summary::-webkit-details-marker { display: none; }
.tool-doc-summary > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.tool-doc-summary > span:first-child i { color: var(--brand); font-size: 17px; }
.td-chevron { display: inline-flex; color: var(--text-3); transition: transform .18s ease; }
.td-chevron i { font-size: 18px; }
.tool-doccard[open] .td-chevron { transform: rotate(180deg); }
.tool-doccard[open] { padding-bottom: 16px; }
.tool-doc-tip { margin: 12px 0 10px; font-size: 12.5px; color: var(--text-3); }
.tool-code {
  margin: 0; padding: 12px 14px; border-radius: 10px; overflow-x: auto;
  background: #0e1422; color: #9fd3a8; font-size: 12px; line-height: 1.7;
  font-family: Consolas, Menlo, monospace; white-space: pre;
}

/* 表单元素 */
.tool-form { display: grid; gap: 14px; }
.tool-field > label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.tool-field .hint { margin-top: 5px; font-size: 12px; color: var(--text-3); }
.tool-input, .tool-textarea, .tool-select {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--card-2); color: var(--text);
  font-size: 13.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.tool-input:focus, .tool-textarea:focus, .tool-select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}
.tool-textarea { min-height: 150px; resize: vertical; line-height: 1.65; font-family: inherit; }
.tool-textarea.mono { font-family: Consolas, Menlo, monospace; font-size: 12.8px; }
.tool-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tool-row > * { flex: 1; min-width: 130px; }
.tool-actions { display: flex; gap: 10px; align-items: center; margin-top: 2px; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 26px; border-radius: 11px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff;
  font-size: 14px; font-weight: 600; box-shadow: 0 4px 14px rgba(30, 109, 254, .28);
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.tool-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(30, 109, 254, .34); }
.tool-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.tool-btn.ghost {
  background: var(--card-2); color: var(--text-2); border: 1px solid var(--line-2); box-shadow: none;
}
.tool-btn.ghost:hover { border-color: var(--brand-200); color: var(--brand); }

/* 选项胶囊 */
.tool-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-item {
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 12.5px;
  border: 1px solid var(--line-2); background: var(--card-2); color: var(--text-2); font-weight: 500;
}
.tp-item:hover { border-color: var(--brand-200); color: var(--brand); }
.tp-item.active { background: var(--brand-50); border-color: var(--brand); color: var(--brand); font-weight: 600; }

/* 上传区 */
.tool-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 34px 18px; border-radius: 14px; cursor: pointer; text-align: center;
  border: 1.5px dashed var(--line-2); background: var(--card-2); transition: border-color .15s, background .15s;
}
.tool-dropzone:hover, .tool-dropzone.drag { border-color: var(--brand); background: var(--brand-50); }
.tool-dropzone i { font-size: 34px; color: var(--brand); }
.tool-dropzone b { font-size: 13.5px; color: var(--text); }
.tool-dropzone em { font-style: normal; font-size: 12px; color: var(--text-3); }

/* 上传进度条 */
.tool-progress { height: 8px; border-radius: 999px; background: var(--card-2); overflow: hidden; margin-top: 10px; }
.tool-progress > i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #4e8cff); transition: width .2s;
}

/* 结果区 */
.tool-result { margin-top: 18px; }
.tr-head {
  display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600;
  color: var(--success); margin-bottom: 10px;
}
.tr-head i { font-size: 16px; }
.tool-files { display: grid; gap: 8px; }
.tool-file {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card-2);
  transition: border-color .15s, transform .12s;
}
.tool-file:hover { border-color: var(--brand-200); transform: translateY(-1px); }
.tool-file .tf-icon {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-50); color: var(--brand); font-size: 18px;
}
.tool-file .tf-body { flex: 1; min-width: 0; }
.tool-file b { display: block; font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-file em { font-style: normal; font-size: 12px; color: var(--text-3); }
.tool-file .tf-arrow { color: var(--text-4); }

/* 输出对比 / 统计 */
.tool-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tool-stat { padding: 12px 14px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); }
.tool-stat b { display: block; font-size: 19px; color: var(--text); font-weight: 700; }
.tool-stat em { font-style: normal; font-size: 11.5px; color: var(--text-3); }
.tool-output {
  margin-top: 10px; padding: 12px 14px; border-radius: 12px; overflow: auto;
  background: var(--card-2); border: 1px solid var(--line);
  font-family: Consolas, Menlo, monospace; font-size: 12.8px; line-height: 1.7;
  color: var(--text); white-space: pre-wrap; word-break: break-all;
  max-height: 420px;
}
.tool-img-preview { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }

/* 键盘计算器 */
.calc-wrap { max-width: 420px; margin: 0 auto; }
.calc-screen {
  padding: 16px 16px 12px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line);
  text-align: right; margin-bottom: 12px;
}
.calc-expr { min-height: 20px; font-size: 13px; color: var(--text-3); word-break: break-all; font-family: Consolas, monospace; }
.calc-value { font-size: 26px; font-weight: 700; color: var(--text); word-break: break-all; }
.calc-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.calc-key {
  padding: 13px 0; border-radius: 11px; border: 1px solid var(--line); cursor: pointer;
  background: var(--card); color: var(--text); font-size: 15px; font-weight: 500;
  transition: background .12s, transform .1s;
}
.calc-key:hover { background: var(--card-2); }
.calc-key:active { transform: scale(.96); }
.calc-key.op { color: var(--brand); font-weight: 600; }
.calc-key.fn { font-size: 12.5px; color: var(--text-2); }
.calc-key.eq { background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; border: none; }
.calc-key.clear { color: var(--danger); }

/* 时区卡片 */
.tz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tz-card { padding: 13px 15px; border-radius: 13px; background: var(--card-2); border: 1px solid var(--line); }
.tz-card .tz-city { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.tz-card .tz-time { font-size: 22px; font-weight: 700; color: var(--text); margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.tz-card .tz-date { font-size: 11.5px; color: var(--text-3); }

/* 词频标签 */
.freq-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.freq-tag { padding: 5px 12px; border-radius: 999px; background: var(--brand-50); color: var(--brand); font-size: 12.5px; }
.freq-tag b { font-weight: 700; }

/* 侧栏同类工具 */
.side-tool-list { display: grid; gap: 6px; margin-top: 10px; }
.side-tool { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; text-decoration: none; }
.side-tool:hover { background: var(--card-2); }
.side-tool .st-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--c, #1e6dfe) 12%, transparent); color: var(--c, #1e6dfe); font-size: 16px;
}
.side-tool b { display: block; font-size: 13px; color: var(--text); }
.side-tool em { font-style: normal; font-size: 11.5px; color: var(--text-3); }

/* 图片预览双列 */
.img-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.img-compare figure { margin: 0; text-align: center; }
.img-compare img { max-width: 100%; max-height: 260px; border-radius: 10px; border: 1px solid var(--line); }
.img-compare figcaption { margin-top: 6px; font-size: 12px; color: var(--text-3); }

/* 二维码结果 */
.qr-result { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 0 6px; }
.qr-result img { width: 240px; height: 240px; border-radius: 14px; border: 1px solid var(--line); background: #fff; }

@media (max-width: 768px) {
  .tool-workcard { padding: 14px; }
  .img-compare { grid-template-columns: 1fr; }
  .calc-grid { gap: 6px; }
  .tool-header { flex-wrap: wrap; }
}

/* 已选文件预览（图片类） */
.tool-preview { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); }
.tool-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }
.tool-preview .tp-body { flex: 1; min-width: 0; }
.tool-preview .tp-body b { display: block; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-preview .tp-body em { font-style: normal; font-size: 12px; color: var(--text-3); }
.tool-preview .tp-remove { border: 1px solid var(--line-2); background: var(--card); color: var(--text-3); width: 28px; height: 28px; border-radius: 8px; cursor: pointer; flex: none; }
.tool-preview .tp-remove:hover { color: var(--danger); border-color: var(--danger); }

/* 已选文件清单（多文件类） */
.tool-filelist { display: grid; gap: 6px; }
.tool-filelist .tfl-item { display: flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); font-size: 12.5px; color: var(--text); }
.tool-filelist .tfl-item > i { color: var(--brand); flex: none; }
.tool-filelist .tfl-item em { margin-left: auto; font-style: normal; color: var(--text-3); font-size: 11.5px; flex: none; }
.tool-filelist .tfl-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 执行中按钮转圈 */
.tool-btn.is-busy { pointer-events: none; }
.tool-btn.is-busy::before { content: ''; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: tool-spin .7s linear infinite; }
@keyframes tool-spin { to { transform: rotate(360deg); } }

/* 滑块（网页截图渲染等待 / JPG 质量） */
.tool-range { width: 100%; appearance: none; -webkit-appearance: none; height: 6px; border-radius: 999px; background: var(--line-2); outline: none; cursor: pointer; }
.tool-range::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--brand); border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: grab;
}
.tool-range:disabled { opacity: .4; cursor: not-allowed; }

/* 网页截图预览（长图等比缩放，避免撑爆页面） */
.ws-shot { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card-2); max-height: 480px; display: flex; justify-content: center; }
.ws-shot a { display: block; line-height: 0; }
.ws-shot img { max-width: 100%; max-height: 480px; object-fit: contain; }

/* OCR 识别结果行号提示 */
.ocr-note { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* 侧栏分区标题（同类 / 热门） */
.side-sec { font-size: 14px; margin-bottom: 2px; }
.side-sec:not(:first-child) { margin-top: 18px; }
