/* 轻办工具箱 - 布局稳定收口版 v2.6
   目标：
   1. 收口前几版临时 CSS，避免互相误伤。
   2. 顶部导航、首页工具卡片、工具详情页分区隔离。
   3. 2K/宽屏更舒展，普通屏不夸张，移动端不横向滚动。
*/

:root {
  --qb-bg: #f5f8fc;
  --qb-card: #ffffff;
  --qb-text: #0f172a;
  --qb-muted: #64748b;
  --qb-line: #dce5f0;
  --qb-line-strong: #cfdbea;
  --qb-brand: #2563eb;
  --qb-soft: #f8fbff;
  --qb-green-bg: #e9fbf3;
  --qb-green-text: #07966d;
  --qb-radius: 14px;
  --qb-shadow: 0 8px 22px rgba(15, 23, 42, .035);
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--qb-bg);
  color: var(--qb-text);
}

/* ---------------- 顶部导航：只管 header，不影响 main 卡片 ---------------- */

body > header,
.site-header,
.topbar,
.navbar {
  min-height: 58px !important;
  background: rgba(255,255,255,.96) !important;
  border-bottom: 1px solid var(--qb-line) !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

body > header > .container,
body > header > .wrap,
body > header > .wrapper,
body > header > .inner,
body > header > div,
.site-header > .container,
.site-header > .wrap,
.site-header > .wrapper,
.site-header > .inner,
.topbar > .container,
.topbar > .wrap,
.topbar > .wrapper,
.topbar > .inner,
.navbar > .container,
.navbar > .wrap,
.navbar > .wrapper,
.navbar > .inner {
  width: min(calc(100vw - 48px), 1480px) !important;
  max-width: 1480px !important;
  min-height: 58px !important;
  height: 58px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 24px !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

body > header .brand,
body > header .logo,
body > header .site-logo,
.site-header .brand,
.site-header .logo,
.site-header .site-logo,
.topbar .brand,
.topbar .logo,
.navbar .brand,
.navbar .logo {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  gap: 10px !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 auto 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--qb-text) !important;
  font-weight: 800 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
}

body > header .brand-icon,
.site-header .brand-icon {
  display: inline-grid !important;
  place-items: center !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 8px !important;
  background: var(--qb-brand) !important;
  color: #fff !important;
  line-height: 1 !important;
}

body > header nav,
body > header .nav,
body > header .menu,
body > header .tabs,
.site-header nav,
.site-header .nav,
.site-header .menu,
.site-header .tabs,
.topbar nav,
.topbar .nav,
.topbar .menu,
.navbar nav,
.navbar .nav,
.navbar .menu {
  display: flex !important;
  flex: 0 1 auto !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 10px !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  margin-left: auto !important;
  overflow: visible !important;
}

body > header nav a,
body > header .nav a,
body > header .menu a,
body > header .tabs a,
.site-header nav a,
.site-header .nav a,
.site-header .menu a,
.site-header .tabs a,
.topbar nav a,
.topbar .nav a,
.topbar .menu a,
.navbar nav a,
.navbar .nav a,
.navbar .menu a {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: auto !important;
  max-width: none !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 14px !important;
  margin: 0 !important;
  border: 1px solid var(--qb-line) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #475569 !important;
  font-size: 14px !important;
  line-height: 1 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  overflow: visible !important;
  box-shadow: none !important;
}

body > header nav a:hover,
body > header .nav a:hover,
.site-header nav a:hover,
.site-header .nav a:hover {
  color: #1d4ed8 !important;
  border-color: #b9cef0 !important;
  background: var(--qb-soft) !important;
}

/* ---------------- 首页：只作用 body.gecao-home main ---------------- */

body.gecao-home main {
  width: min(calc(100vw - 48px), 1480px) !important;
  max-width: 1480px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

body.gecao-home main .container,
body.gecao-home main .wrap,
body.gecao-home main .wrapper {
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

/* 首页首屏别太散 */
body.gecao-home main > section:first-of-type,
body.gecao-home main .hero,
body.gecao-home main .home-hero,
body.gecao-home main .intro {
  margin-top: 38px !important;
  margin-bottom: 28px !important;
}

body.gecao-home main h1 {
  font-size: clamp(30px, 2.1vw, 40px) !important;
  line-height: 1.2 !important;
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}

body.gecao-home main h2 {
  font-size: clamp(21px, 1.25vw, 26px) !important;
  line-height: 1.3 !important;
  margin-top: 30px !important;
  margin-bottom: 16px !important;
}

/* 首页网格统一：热门工具、全部工具都不会拉变形 */
body.gecao-home main .tool-grid,
body.gecao-home main .tools-grid,
body.gecao-home main .tool-list,
body.gecao-home main .tools-list,
body.gecao-home main .all-tools-grid,
body.gecao-home main .all-tools-list,
body.gecao-home main .category-tools,
body.gecao-home main .cards-grid,
body.gecao-home main .section-tools,
body.gecao-home main .section-grid,
body.gecao-home main .grid-tools,
body.gecao-home main .grid-list {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  grid-auto-rows: auto !important;
  gap: 16px !important;
  align-items: stretch !important;
}

/* 首页工具卡片：只限 main 内 a，不再误伤顶部 nav */
body.gecao-home main a.tool-card,
body.gecao-home main .tool-grid > a,
body.gecao-home main .tools-grid > a,
body.gecao-home main .tool-list > a,
body.gecao-home main .tools-list > a,
body.gecao-home main .all-tools-grid > a,
body.gecao-home main .all-tools-list > a,
body.gecao-home main .category-tools > a,
body.gecao-home main a[data-category],
body.gecao-home main a[href^="/pdf-"],
body.gecao-home main a[href^="/image-"],
body.gecao-home main a[href^="/qr-code"],
body.gecao-home main a[href^="/json-format"],
body.gecao-home main a[href^="/timestamp"],
body.gecao-home main a[href^="/url-base64"],
body.gecao-home main a[href^="/text-count"] {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 112px !important;
  height: auto !important;
  padding: 18px !important;
  box-sizing: border-box !important;
  background: var(--qb-card) !important;
  border: 1px solid var(--qb-line) !important;
  border-radius: var(--qb-radius) !important;
  color: inherit !important;
  text-decoration: none !important;
  overflow: hidden !important;
  box-shadow: none !important;
  grid-column: auto !important;
  grid-row: auto !important;
}

body.gecao-home main a.tool-card:hover,
body.gecao-home main .tool-grid > a:hover,
body.gecao-home main .tools-grid > a:hover,
body.gecao-home main a[data-category]:hover {
  border-color: #b9cef0 !important;
  box-shadow: var(--qb-shadow) !important;
}

body.gecao-home main a.tool-card h3,
body.gecao-home main a[data-category] h3,
body.gecao-home main .tool-grid > a h3,
body.gecao-home main .tools-grid > a h3 {
  margin: 12px 0 8px !important;
  padding: 0 !important;
  font-size: 16px !important;
  line-height: 1.35 !important;
  color: var(--qb-text) !important;
}

body.gecao-home main a.tool-card p,
body.gecao-home main a[data-category] p,
body.gecao-home main .tool-grid > a p,
body.gecao-home main .tools-grid > a p {
  margin: 0 !important;
  padding: 0 !important;
  color: var(--qb-muted) !important;
  line-height: 1.6 !important;
}

body.gecao-home main .tag,
body.gecao-home main .badge {
  align-self: flex-start;
}

/* 分类按钮只按按钮处理，不参与工具卡片规则 */
body.gecao-home main .filters,
body.gecao-home main .category-filter,
body.gecao-home main .tabs,
body.gecao-home main .tool-tabs {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  align-items: center !important;
  margin-bottom: 16px !important;
}

body.gecao-home main .filters button,
body.gecao-home main .category-filter button,
body.gecao-home main .tabs button,
body.gecao-home main .tool-tabs button {
  min-height: 34px !important;
  padding: 0 14px !important;
  border-radius: 999px !important;
}

/* ---------------- 工具详情页：只作用 body.gecao-tool-page main ---------------- */

body.gecao-tool-page main {
  width: min(calc(100vw - 48px), 1440px) !important;
  max-width: 1440px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

body.gecao-tool-page main .tool-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 300px !important;
  gap: 22px !important;
  align-items: start !important;
}

body.gecao-tool-page main .tool-main,
body.gecao-tool-page main .tool-side {
  min-width: 0 !important;
}

body.gecao-tool-page main .tool-card,
body.gecao-tool-page main .panel,
body.gecao-tool-page main .card {
  background: var(--qb-card);
  border: 1px solid var(--qb-line);
  border-radius: var(--qb-radius);
  box-sizing: border-box;
}

body.gecao-tool-page main input,
body.gecao-tool-page main textarea,
body.gecao-tool-page main select {
  max-width: 100%;
  box-sizing: border-box;
}

body.gecao-tool-page main textarea,
body.gecao-tool-page main pre,
body.gecao-tool-page main code,
body.gecao-tool-page main table {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ---------------- 宽屏 ---------------- */

@media (min-width: 1700px) {
  body > header > .container,
  body > header > .wrap,
  body > header > .wrapper,
  body > header > .inner,
  body > header > div,
  .site-header > .container,
  .site-header > .wrap,
  .site-header > .wrapper,
  .site-header > .inner,
  .topbar > .container,
  .topbar > .wrap,
  .topbar > .wrapper,
  .topbar > .inner,
  .navbar > .container,
  .navbar > .wrap,
  .navbar > .wrapper,
  .navbar > .inner,
  body.gecao-home main {
    width: min(calc(100vw - 96px), 1600px) !important;
    max-width: 1600px !important;
  }

  body.gecao-tool-page main {
    width: min(calc(100vw - 96px), 1520px) !important;
    max-width: 1520px !important;
  }

  body.gecao-home main .tool-grid,
  body.gecao-home main .tools-grid,
  body.gecao-home main .tool-list,
  body.gecao-home main .tools-list,
  body.gecao-home main .all-tools-grid,
  body.gecao-home main .all-tools-list,
  body.gecao-home main .category-tools,
  body.gecao-home main .cards-grid,
  body.gecao-home main .section-tools,
  body.gecao-home main .section-grid,
  body.gecao-home main .grid-tools,
  body.gecao-home main .grid-list {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 18px !important;
  }

  body.gecao-home main a.tool-card,
  body.gecao-home main .tool-grid > a,
  body.gecao-home main .tools-grid > a,
  body.gecao-home main a[data-category] {
    min-height: 118px !important;
  }
}

/* ---------------- 移动端 ---------------- */

@media (max-width: 1000px) {
  body.gecao-tool-page main .tool-layout {
    grid-template-columns: 1fr !important;
  }

  body.gecao-tool-page main .tool-side {
    display: block !important;
  }
}

@media (max-width: 760px) {
  body > header > .container,
  body > header > .wrap,
  body > header > .wrapper,
  body > header > .inner,
  body > header > div,
  .site-header > .container,
  .site-header > .wrap,
  .site-header > .wrapper,
  .site-header > .inner,
  .topbar > .container,
  .topbar > .wrap,
  .topbar > .wrapper,
  .topbar > .inner,
  .navbar > .container,
  .navbar > .wrap,
  .navbar > .wrapper,
  .navbar > .inner {
    width: min(calc(100vw - 24px), 100%) !important;
    height: auto !important;
    min-height: 56px !important;
    gap: 12px !important;
  }

  body > header nav,
  body > header .nav,
  body > header .menu,
  .site-header nav,
  .site-header .nav,
  .site-header .menu,
  .topbar nav,
  .topbar .nav,
  .navbar nav,
  .navbar .nav {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-width: 65vw !important;
    padding-bottom: 4px !important;
  }

  body > header nav a,
  body > header .nav a,
  body > header .menu a,
  .site-header nav a,
  .site-header .nav a,
  .site-header .menu a,
  .topbar nav a,
  .topbar .nav a,
  .navbar nav a,
  .navbar .nav a {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    padding: 0 10px !important;
    font-size: 13px !important;
  }

  body.gecao-home main,
  body.gecao-tool-page main {
    width: min(calc(100vw - 24px), 100%) !important;
    max-width: none !important;
  }

  body.gecao-home main .tool-grid,
  body.gecao-home main .tools-grid,
  body.gecao-home main .tool-list,
  body.gecao-home main .tools-list,
  body.gecao-home main .all-tools-grid,
  body.gecao-home main .all-tools-list,
  body.gecao-home main .category-tools,
  body.gecao-home main .cards-grid,
  body.gecao-home main .section-tools,
  body.gecao-home main .section-grid,
  body.gecao-home main .grid-tools,
  body.gecao-home main .grid-list {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  body.gecao-home main h1 {
    font-size: 30px !important;
  }
}
