/* ===========================================================
   思度安全 · 工具站样式（配合 assets/style.css）
   =========================================================== */

.tools-intro { padding: 34px 0 4px; }
.tools-intro h1 { font-size: 28px; letter-spacing: -.02em; margin-bottom: 7px; color: #0f172a; }
.tools-intro p { font-size: 14px; color: var(--muted); max-width: 780px; }

.tools-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 26px;
  padding-top: 20px;
  padding-bottom: 70px;
  align-items: start;
}

/* ---------- 左侧菜单 ---------- */
.t-side {
  position: sticky; top: 76px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px 12px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.t-side::-webkit-scrollbar { width: 6px; }
.t-side::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }

.t-side .side-title {
  font-size: 11.5px; letter-spacing: .1em; color: #94a3b8;
  text-transform: uppercase; padding: 2px 8px 10px;
}
.t-search { position: relative; margin-bottom: 12px; }
.t-search input {
  width: 100%; padding: 8px 10px 8px 30px; font: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe; color: var(--text);
}
.t-search input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.t-search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: #9aa4b2; }

.t-group { margin-bottom: 6px; }
.t-group h4 {
  font-size: 11.5px; font-weight: 600; color: #64748b; letter-spacing: .04em;
  padding: 8px 8px 5px;
}
.t-group a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 8px;
  font-size: 13.4px; color: #374151; text-decoration: none;
  border: 1px solid transparent;
}
.t-group a:hover { background: #f4f7fb; color: var(--accent); }
.t-group a.on { background: var(--accent-soft); color: #1d4ed8; border-color: #dbeafe; font-weight: 600; }
.t-group a .dot {
  width: 5px; height: 5px; border-radius: 50%; background: #cbd5e1; flex: 0 0 auto;
}
.t-group a.on .dot { background: var(--accent); }
.t-group a .badge-soon {
  margin-left: auto; font-size: 10px; color: #b45309; background: #fffbeb;
  border: 1px solid #fde68a; border-radius: 4px; padding: 0 4px; line-height: 15px;
}
.t-side .side-foot {
  margin-top: 12px; padding: 10px 8px 2px; border-top: 1px dashed var(--border);
  font-size: 11.5px; color: var(--muted); line-height: 1.7;
}
.t-side .side-foot b { color: #047857; font-weight: 600; }

/* ---------- 右侧内容 ---------- */
.t-main { min-width: 0; }
.tool { display: none; }
.tool.on { display: block; animation: tfade .22s ease; }
@keyframes tfade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.tool-head { margin-bottom: 16px; }
.tool-head h2 { font-size: 22px; letter-spacing: -.01em; color: #0f172a; margin-bottom: 5px; }
.tool-head p { font-size: 13.5px; color: var(--muted); max-width: 720px; }
.tool-head .chips-row { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.tool-head .pill {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: #f1f5f9; color: #475569; border: 1px solid var(--border);
}
.tool-head .pill.local { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card > h3 {
  font-size: 13.5px; color: #0f172a; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.card > h3::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--accent); }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

label.fl {
  display: block; font-size: 12px; color: #64748b; margin-bottom: 5px; letter-spacing: .02em;
}
textarea.ta, input.in, select.sel {
  width: 100%; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.8px; line-height: 1.65; color: var(--text);
  background: #fbfcfe; border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; resize: vertical;
}
textarea.ta { min-height: 168px; }
textarea.ta:focus, input.in:focus, select.sel:focus {
  outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.ta[readonly] { background: #f8fafc; }
input.in, select.sel { font-size: 13px; padding: 8px 10px; }
select.sel { cursor: pointer; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 11px; align-items: center; }
button.btn {
  font: inherit; font-size: 13px; cursor: pointer;
  padding: 8px 15px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: #374151; transition: .15s;
}
button.btn:hover { border-color: #bfdbfe; color: var(--accent); background: #f8fbff; }
button.btn:active { transform: translateY(1px); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.btn.primary:hover { background: #1d4ed8; color: #fff; }
button.btn.ghost { background: transparent; }
button.btn.tiny { padding: 4px 9px; font-size: 12px; }
button.btn.danger:hover { border-color: #fecaca; color: #b91c1c; background: #fef2f2; }
.btn-row .spacer { flex: 1; }

.opt-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.opt { display: flex; align-items: center; gap: 6px; font-size: 12.8px; color: #475569; }
.opt input[type=checkbox], .opt input[type=radio] { accent-color: var(--accent); }
.opt input[type=range] { accent-color: var(--accent); width: 110px; }

.hint { font-size: 12px; color: #94a3b8; margin-top: 8px; line-height: 1.65; }
.hint code, .msg code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 11.8px; }

.msg { margin-top: 10px; font-size: 12.8px; border-radius: 8px; padding: 9px 12px; display: none; line-height: 1.7; }
.msg.show { display: block; }
.msg.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.msg.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.msg.warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.msg.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #dbeafe; }

/* 结果行 */
.kv-list { display: flex; flex-direction: column; gap: 7px; }
.kv {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 12.8px; padding: 8px 10px; background: #f8fafc;
  border: 1px solid var(--border); border-radius: 8px;
}
.kv .k { flex: 0 0 108px; color: #64748b; }
.kv .v { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; word-break: break-all; color: #0f172a; }
.kv .v.plain { font-family: inherit; }

/* 表格 */
table.tt { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.tt th, table.tt td { text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tt th { color: #64748b; font-weight: 600; background: #f8fafc; font-size: 12px; }
table.tt td { font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
table.tt td.plain { font-family: inherit; }

/* 图片工具 */
.drop {
  border: 1.5px dashed #cbd5e1; border-radius: 12px; padding: 26px 18px;
  text-align: center; color: var(--muted); font-size: 13px; cursor: pointer;
  background: #fbfcfe; transition: .15s;
}
.drop:hover, .drop.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop b { color: #374151; }
.canvas-wrap {
  background:
    linear-gradient(45deg, #eef2f7 25%, transparent 25%, transparent 75%, #eef2f7 75%),
    linear-gradient(45deg, #eef2f7 25%, transparent 25%, transparent 75%, #eef2f7 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center;
}
.canvas-wrap canvas, .canvas-wrap img { max-width: 100%; height: auto; border-radius: 6px; display: block; margin: 0 auto; }

.pos-grid { display: grid; grid-template-columns: repeat(3, 30px); gap: 4px; }
.pos-grid button {
  width: 30px; height: 26px; border-radius: 5px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 10px; color: #94a3b8; padding: 0;
}
.pos-grid button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 正则高亮 */
.re-hit { background: #fef08a; border-radius: 3px; padding: 0 1px; }
.re-view {
  font-family: ui-monospace, Menlo, monospace; font-size: 12.8px; line-height: 1.85;
  background: #fbfcfe; border: 1px solid var(--border); border-radius: 9px;
  padding: 11px 13px; white-space: pre-wrap; word-break: break-word; min-height: 90px;
  max-height: 320px; overflow: auto;
}

/* 规划中 */
.soon {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
  padding: 20px 22px; font-size: 13.5px; color: #92400e; line-height: 1.8;
}
.soon h3 { font-size: 15px; margin-bottom: 8px; color: #78350f; }
.soon ul { margin: 8px 0 0 18px; }
.soon li { margin: 4px 0; }

/* 移动端 */
.t-side-toggle { display: none; }
@media (max-width: 900px) {
  .tools-shell { grid-template-columns: 1fr; padding-top: 16px; gap: 14px; }
  .t-side {
    position: static; max-height: none; padding: 10px;
  }
  .t-side .side-title { display: none; }
  .t-side nav { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .t-side nav::-webkit-scrollbar { display: none; }
  .t-group { margin: 0; flex: 0 0 auto; }
  .t-group h4 { padding: 6px 0 2px; }
  .t-group a { display: inline-flex; padding: 5px 10px; border: 1px solid var(--border); margin: 2px 4px 2px 0; white-space: nowrap; font-size: 12.5px; }
  .t-group a .dot { display: none; }
  .t-side .side-foot { display: none; }
  .cols, .cols-3 { grid-template-columns: 1fr; }
  .tool-head h2 { font-size: 19px; }
}

/* ---------- 新增标记 / 分段切换 ---------- */
.t-group a .badge-new {
  margin-left: 5px; padding: 0 5px; border-radius: 4px;
  background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0;
  font-size: 10px; line-height: 15px; letter-spacing: .02em;
}

.seg {
  display: inline-flex; gap: 4px; padding: 3px;
  background: #f1f5f9; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 14px;
}
.seg-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 13px; color: #64748b;
  padding: 7px 14px; border-radius: 8px; transition: .16s;
  white-space: nowrap;
}
.seg-btn:hover { color: #0f172a; }
.seg-btn.on {
  background: #fff; color: #1d4ed8; font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}
.pane > .card + .card { margin-top: 14px; }

/* 示例词 */
.pp-ex {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 9px; font-size: 12px; color: #94a3b8;
}
.pp-ex .chip {
  appearance: none; cursor: pointer; font: inherit; font-size: 12.5px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid #e2e8f0; background: #f8fafc; color: #475569;
  transition: .15s;
}
.pp-ex .chip:hover { border-color: #bfdbfe; background: var(--accent-soft); color: #1d4ed8; }

.in.mono, input.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; }

/* 结果行：可点击复制 */
.kv.click { cursor: pointer; transition: .15s; }
.kv.click:hover { border-color: #bfdbfe; background: #f8fbff; }
.kv .v strong { font-weight: 600; }
.kv .v em { font-style: normal; color: #0f766e; }
.kv.bad .v { color: #b45309; }

@media (max-width: 900px) {
  .seg { width: 100%; }
  .seg-btn { flex: 1; padding: 7px 8px; font-size: 12.5px; }
}

/* ---------- wasm 徽章 / 示例 chips ---------- */
.t-group a .badge-wasm {
  margin-left: auto; padding: 0 4px; border-radius: 4px;
  background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
  font-size: 10px; line-height: 15px; letter-spacing: .02em;
}
.t-group a .badge-new + .badge-wasm { margin-left: 4px; }

.ex-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ex-chips .chip {
  appearance: none; cursor: pointer; font: inherit; font-size: 12.5px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid #e2e8f0; background: #f8fafc; color: #475569;
  transition: .15s; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.ex-chips .chip:hover { border-color: #bfdbfe; background: var(--accent-soft); color: #1d4ed8; }

/* 卡片正文（长说明） */
.card p.prose { font-size: 13px; line-height: 1.85; color: #475569; margin: 6px 0; }
.card p.prose b { color: #0f172a; font-weight: 600; }
.card p.prose code, .card p.prose code * {
  background: #f1f5f9; padding: 1px 5px; border-radius: 4px;
  font-size: 11.8px; color: #0f172a;
}

.kv.click.copied { border-color: #a7f3d0; background: #ecfdf5; }

kbd {
  font-family: inherit; font-size: 11.5px; padding: 1px 5px; border-radius: 4px;
  border: 1px solid #d8dee9; border-bottom-width: 2px; background: #fff; color: #475569;
}

textarea.ta.code { font-size: 12.6px; line-height: 1.72; background: #fcfdff; }

/* ---------- Python 沙箱 ---------- */
.sandbox-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sandbox-bar .spacer { flex: 1; }
.py-state {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; white-space: nowrap;
}
.py-state.loading { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.py-state.run { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.py-state.ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.py-state.bad { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

pre.console {
  margin: 0; min-height: 360px; max-height: 560px; overflow: auto;
  background: #0f172a; color: #e2e8f0; border-radius: 9px;
  padding: 12px 14px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.4px; line-height: 1.72; white-space: pre-wrap; word-break: break-word;
}
pre.console .c-dim { color: #94a3b8; }
pre.console .c-out { color: #e2e8f0; }
pre.console .c-err { color: #fca5a5; }
pre.console .c-res { color: #7dd3fc; }

@media (max-width: 900px) {
  pre.console { min-height: 220px; max-height: 340px; }
  .sandbox-bar select.sel { flex: 1; max-width: none; }
  .ex-chips .chip { font-size: 12px; }
}
