/* ============================================================
   超想在线工具集 /tool/ 专用样式
   分类菜单贴视口最左侧（全宽侧栏）+ 右侧工具展示；仅作用于 .th-* 前缀，
   公共 .container / 卡片 / 页脚仍复用站点样式
   ============================================================ */
:root {
  --th-brand: #2D7AFA;
  --th-ink: #16243B;
  --th-body: #5A6780;
  --th-muted: #8792A6;
  --th-line: #E4EAF3;
  --th-radius: 14px;
}

/* ---------------- 顶部（仅品牌与收藏） ---------------- */
.th-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--th-line);
  box-shadow: 0 4px 20px rgba(23, 41, 82, .04);
}
/* 顶部品牌栏同样拉通全宽，左边缘与下方侧栏对齐 */
.th-header .th-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 28px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.th-brand { display: inline-flex; align-items: center; gap: 12px; flex: none; text-decoration: none; }
.th-logo { display: inline-flex; align-items: center; gap: 6px; }
.th-logo img { width: 38px; height: 38px; object-fit: contain; display: block; }
.th-logo em {
  font-style: normal;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--th-brand);
}
.th-brand-txt { display: flex; flex-direction: column; line-height: 1.25; padding-left: 4px; border-left: 1px solid var(--th-line); }
.th-brand-txt strong { font-size: 17px; font-weight: 700; color: var(--th-ink); letter-spacing: .2px; }
.th-brand-txt span { font-size: 9.5px; letter-spacing: 1.3px; color: var(--th-muted); text-transform: uppercase; margin-top: 4px; }

.th-actions { flex: none; display: flex; align-items: center; gap: 10px; }
.th-fav {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 14px;
  border: 1px solid #C9DBFF; border-radius: 9px;
  background: #F4F8FF; color: var(--th-brand);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: all .2s;
}
.th-fav:hover { background: var(--th-brand); border-color: var(--th-brand); color: #fff; }
.th-fav svg { width: 15px; height: 15px; }
.th-fav kbd {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11px; font-weight: 600;
  padding: 2px 5px; border-radius: 4px;
  background: rgba(45, 122, 250, .10); border: 1px solid rgba(45, 122, 250, .16);
}
.th-fav:hover kbd { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .3); }

/* ---------------- 左右布局：侧栏贴视口最左侧 ---------------- */
.th-layout {
  --th-side-w: 264px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: var(--th-side-w) minmax(0, 1fr);
  gap: 0;
  align-items: start;
  /* 左侧栏底色铺满整行高度；侧栏内容本身保持 sticky 独立滚动 */
  background: linear-gradient(to right,
      #F5F9FF 0,
      #F5F9FF var(--th-side-w),
      #FFFFFF var(--th-side-w),
      #FFFFFF 100%);
}
.th-side {
  position: sticky;
  top: 68px;
  min-width: 0;
  width: 100%;
  max-height: calc(100vh - 68px);
  overflow-y: auto;
  padding: 22px 16px 32px;
  border-right: 1px solid var(--th-line);
  scrollbar-width: thin;
}
.th-side::-webkit-scrollbar { width: 6px; }
.th-side::-webkit-scrollbar-thumb { background: #D7E1F0; border-radius: 6px; }

/* 左侧栏顶部：标题 + 主图（原 banner 合并到这里） */
.th-side-head {
  padding: 18px;
  border: 1px solid #DCE9FC;
  border-radius: var(--th-radius);
  background: linear-gradient(135deg, #EDF4FF 0%, #F8FBFF 100%);
}
.th-side-head h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--th-ink);
  letter-spacing: -.3px;
}
.th-side-head p { margin: 7px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--th-body); }
.th-side-head img {
  display: block;
  width: 100%;
  height: 116px;
  margin-top: 14px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(24, 62, 120, .12);
}

/* 左侧分类菜单 */
.th-side-nav {
  margin-top: 16px;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(23, 41, 82, .035);
}
.th-side-cate-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: #F8FAFE;
  border-bottom: 1px solid var(--th-line);
  font-size: 14px;
  font-weight: 600;
  color: var(--th-ink);
  cursor: pointer;
  transition: background .18s, color .18s;
}
.th-side-cate-title:hover, .th-side-cate-title.is-active {
  color: var(--cate, var(--th-brand));
  background: var(--cate-soft, #EAF2FF);
}
.th-side-cate-glyph {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: #fff;
  color: var(--cate, var(--th-brand));
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11px; font-weight: 700; letter-spacing: -.3px;
  border: 1px solid rgba(23, 41, 82, .06);
}
.th-side-cate-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-side-cate-title b {
  flex: none;
  padding: 2px 8px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--th-line);
  color: var(--th-muted);
  font-size: 11px; font-weight: 600;
}
.th-side-cate-title.is-active b { border-color: transparent; color: var(--cate, var(--th-brand)); }
.th-side-group { border-bottom: 1px solid var(--th-line); }
.th-side-group:last-child { border-bottom: 0; }
/* 分类默认只显示大类名；鼠标放上去 / 键盘聚焦时才展开该类子工具 */
.th-side-group .th-side-cate-title::after {
  content: "";
  flex: none;
  width: 6px; height: 6px;
  margin-left: 1px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s;
  opacity: .5;
}
.th-side-group:hover .th-side-cate-title::after,
.th-side-group:focus-within .th-side-cate-title::after { transform: rotate(45deg); }
.th-side-tools {
  display: none;
  padding: 8px 9px 11px;
  flex-direction: column;
  gap: 3px;
  animation: th-side-in .18s ease-out;
}
.th-side-group:hover .th-side-tools,
.th-side-group:focus-within .th-side-tools { display: flex; }
@keyframes th-side-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.th-side-tool {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 7px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--th-body);
  transition: background .18s, color .18s;
}
a.th-side-tool:hover { background: var(--cate-soft, #F2F6FD); color: var(--th-ink); }
.th-side-tool.is-disabled { opacity: .62; }
.th-side-glyph {
  position: relative;
  flex: none;
  width: 34px; height: 34px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11px; font-weight: 700; letter-spacing: -.4px;
  background: #EAF2FF; color: var(--th-brand);
}
.th-side-glyph small { position: absolute; right: 2px; bottom: 1px; font-size: 7px; font-weight: 600; opacity: .6; letter-spacing: 0; }
.th-side-glyph.th-theme-warm   { background: #FFF2E5; color: #D9690B; }
.th-side-glyph.th-theme-violet { background: #F0EEFF; color: #7563E8; }
.th-side-glyph.th-theme-cyan   { background: #E1F7FA; color: #0E8FA6; }
.th-side-glyph.th-theme-green  { background: #E7F7EC; color: #16833F; }
.th-side-glyph.th-theme-rose   { background: #FDECF1; color: #C93A5D; }
.th-side-glyph.th-theme-indigo { background: #E0DFFF; color: #4338CA; }
.th-side-glyph.th-theme-slate  { background: #EDF1F6; color: #475569; }
.th-side-tool-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-side-soon { flex: none; font-style: normal; font-size: 10px; color: var(--th-muted); }

/* 右侧内容：独立内边距，卡片网格铺满剩余宽度 */
.th-content { min-width: 0; padding: 26px 34px 64px; }
.th-search-wrap { max-width: 100%; margin: 0; }
.th-search {
  position: relative;
  display: flex; align-items: center;
  height: 56px;
  padding: 0 8px 0 18px;
  border: 1.5px solid #CFE0FF;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(45, 122, 250, .09);
  transition: border-color .2s, box-shadow .2s;
}
.th-search:focus-within { border-color: var(--th-brand); box-shadow: 0 12px 30px rgba(45, 122, 250, .16); }
.th-search-icon { width: 20px; height: 20px; flex: none; color: var(--th-brand); }
.th-search-input {
  flex: 1; min-width: 0;
  height: 100%; padding: 0 12px;
  border: 0; outline: 0; background: transparent;
  font-size: 15px; color: var(--th-ink);
}
.th-search-input::placeholder { color: #9AA6BA; }
.th-search-input::-webkit-search-cancel-button { display: none; }
.th-search-clear {
  flex: none; width: 28px; height: 28px;
  border: 0; border-radius: 50%; background: #F0F3F9; color: var(--th-muted);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.th-search-clear:hover { background: #E3EAF6; color: var(--th-ink); }
.th-search-clear[hidden] { display: none; }
.th-search-btn {
  flex: none; height: 42px; margin-left: 10px; padding: 0 22px;
  border: 0; border-radius: 9px;
  background: var(--th-brand); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.th-search-btn:hover { background: #0F5FFF; }
.th-suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  z-index: 40;
  padding: 8px;
  border: 1px solid var(--th-line); border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(23, 41, 82, .14);
  max-height: 340px; overflow-y: auto;
}
.th-suggest[hidden] { display: none; }
.th-suggest-head { padding: 6px 10px 8px; font-size: 11.5px; color: var(--th-muted); font-weight: 600; letter-spacing: .4px; }
.th-suggest-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  border: 0; border-radius: 8px; background: transparent;
  text-align: left; cursor: pointer;
  font-size: 13.5px; color: var(--th-ink);
}
.th-suggest-item:hover, .th-suggest-item.is-active { background: #F2F6FD; }
.th-suggest-item i {
  flex: none; width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--mono, ui-monospace, monospace);
  font-style: normal; font-size: 11px; font-weight: 700;
  background: #EAF2FF; color: var(--th-brand);
}
.th-suggest-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-suggest-item small { flex: none; font-size: 11.5px; color: var(--th-muted); }
.th-suggest-item em { color: var(--th-brand); font-style: normal; font-weight: 600; }
.th-suggest-empty { padding: 16px 10px; font-size: 13px; color: var(--th-muted); }
.th-search-guide { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.th-guide-label { font-size: 12.5px; color: var(--th-muted); }
.th-hot {
  padding: 4px 11px; border: 1px solid var(--th-line); border-radius: 20px;
  background: #fff; color: #53627E; font-size: 12.5px; cursor: pointer;
  transition: all .18s;
}
.th-hot:hover { border-color: var(--th-brand); color: var(--th-brand); background: #F4F8FF; }
.th-guide-tip { margin-left: auto; font-size: 12px; color: var(--th-muted); }

/* ---------------- 结果 / 卡片 ---------------- */
.th-result-bar {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0 18px; padding-bottom: 14px;
  border-bottom: 1px solid var(--th-line);
  font-size: 13px; color: var(--th-muted);
}
.th-result-bar b { color: var(--th-brand); font-family: var(--mono, ui-monospace, monospace); font-size: 15px; }
.th-cate-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 18px;
  border: 1px solid var(--cate, var(--th-brand));
  background: var(--cate-soft, #EAF2FF); color: var(--cate, var(--th-brand));
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.th-cate-chip[hidden] { display: none; }
.th-cate-chip::after { content: "×"; font-size: 14px; font-weight: 400; opacity: .7; }

/* 卡片区：每页 12 个，宽屏一行 4 个正好 3 行；窄屏降到 3 / 2 / 1 列 */
.th-results .tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.th-card { position: relative; border-top: 1px solid var(--cate, var(--th-brand)); }
.th-cate-tag {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  padding: 4px 10px; border-radius: 20px;
  background: var(--cate, var(--th-brand)); color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: .2px;
  box-shadow: 0 4px 12px rgba(23, 41, 82, .12);
}
.th-card .tool-cat { color: var(--cate, var(--th-brand)); }
.th-card .tool-go { color: var(--cate, var(--th-brand)); }
.th-card.is-disabled .tool-go { color: var(--th-muted); }
.tool-item[hidden] { display: none; }
.empty-state[hidden] { display: none; }
.th-content .notice { margin-top: 40px; }

/* ---------------- 工具列表分页（每页 24 个） ---------------- */
.th-results { position: relative; }
.th-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding: 16px 20px;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  background: #fff;
  box-shadow: 0 4px 18px rgba(23, 41, 82, .035);
}
.th-pager-info { font-size: 13px; color: var(--th-muted); }
.th-pager-info b {
  color: var(--th-brand);
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 14px;
}
.th-pager-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.th-page {
  min-width: 34px;
  height: 34px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--th-line);
  border-radius: 9px;
  background: #fff;
  color: var(--th-body);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .18s, color .18s, background .18s;
}
a.th-page:hover { border-color: var(--th-brand); color: var(--th-brand); }
.th-page.is-current {
  background: var(--th-brand);
  border-color: var(--th-brand);
  color: #fff;
  font-weight: 600;
}
.th-page.is-disabled { opacity: .42; cursor: default; }
.th-pager-dots { padding: 0 3px; color: var(--th-muted); font-size: 13px; }
.th-loading {
  display: inline-block;
  margin-top: 14px;
  padding: 7px 14px;
  border-radius: 20px;
  background: #EAF2FF;
  color: var(--th-brand);
  font-size: 13px;
}

/* ---------------- 页脚右下角：累计访问量（与工具详情页同规格） ---------------- */
.site-footer .th-views-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #CFD8E6; white-space: nowrap; font-size: 12.5px;
}
.site-footer .th-views-badge b { font-family: var(--mono, ui-monospace, monospace); font-weight: 600; color: #fff; }

/* ---------------- 子工具页共用外壳 ---------------- */
/* 顶栏中间：当前打开的工具名 + 英文 */
.th-current {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 16px;
  text-align: center;
}
.th-current strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
  color: var(--th-ink);
  letter-spacing: .2px;
}
.th-current span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 1.2px;
  color: var(--th-muted);
  text-transform: uppercase;
}
/* 子工具页左侧栏标题不用 H1，避免与 banner 主标题重复 */
.th-side-title {
  margin: 0;
  font-size: 21px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--th-ink);
  letter-spacing: -.3px;
}
/* 当前打开的工具在菜单中高亮 */
.th-side-tool.is-current {
  background: var(--cate-soft, #EAF2FF);
  color: var(--cate, var(--th-brand));
  font-weight: 600;
}
/* 内容区由各工具页自己的 .container 控制，banner 贴顶铺满右侧 */
.th-detail .th-content { padding: 0; }

/* ---------------- 响应式 ---------------- */
/* 宽屏默认 4 列；一页不足 12 个工具时自动降 3 列，避免最后一行只剩 1 张卡、右侧空 3 格。
   Vue 换页替换卡片后 :has() 自动重算，不需要额外 JS。满 12 个时即 4 列 × 3 行。 */
@media screen and (min-width: 1401px) {
  .th-results .tools-grid:not(:has(> .tool-item:nth-child(12))) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media screen and (max-width: 1400px) {
  .th-results .tools-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media screen and (max-width: 1100px) {
  .th-layout { --th-side-w: 232px; }
  .th-content { padding: 24px 26px 56px; }
  .th-current strong { font-size: 13.5px; }
  .th-current span { font-size: 9px; letter-spacing: .8px; }
  .th-results .tools-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
  .th-side-cate-title { font-size: 13.5px; padding: 10px 11px; }
}
@media screen and (max-width: 900px) {
  /* 窄屏退回单列：分类条横向排列，不再占整条左侧栏 */
  .th-layout { grid-template-columns: 1fr; min-height: 0; background: #fff; }
  .th-header .th-inner { padding: 0 20px; }
  .th-current { display: none; }
  .th-detail .th-content { padding: 0 0 32px; }
  .th-side {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 20px 20px 0;
    border-right: 0;
  }
  .th-side-head img { display: none; }
  .th-side-head { padding: 14px 16px; }
  .th-side-nav { display: flex; flex-wrap: wrap; gap: 0; }
  .th-side-cate-title { flex: 1 1 auto; min-width: 130px; border-bottom: 0; border-right: 1px solid var(--th-line); }
  .th-side-group { border-bottom: 0; }
  /* 窄屏是横向分类条，不做 hover 展开，避免布局错位 */
  .th-side-tools,
  .th-side-group:hover .th-side-tools,
  .th-side-group:focus-within .th-side-tools { display: none; }
  .th-side-group .th-side-cate-title::after { display: none; }
  .th-content { padding: 8px 20px 48px; }
  .th-results .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .th-search-guide { margin-bottom: 4px; }
}
@media screen and (max-width: 640px) {
  .th-brand-txt span { display: none; }
  .th-brand-txt strong { font-size: 15px; }
  .th-fav kbd { display: none; }
  .th-fav { padding: 0 11px; font-size: 12.5px; }
  .th-header .th-inner { padding: 0 18px; }
  .th-side { padding: 16px 18px 0; }
  .th-content { padding: 4px 18px 40px; }
  .th-search { height: 50px; padding-left: 13px; }
  .th-search-btn { padding: 0 14px; font-size: 13px; }
  .th-results .tools-grid { grid-template-columns: 1fr; }
  .th-pager { flex-direction: column; align-items: flex-start; padding: 14px 16px; }
  .th-page { min-width: 32px; height: 32px; padding: 0 9px; }
}
