:root {
  --page-bg: #f5f8fa;
  --surface: #ffffff;
  --slot-bg: #f0f2f5;
  --slot-hover: #e2e6ea;
  --friend-bg: #f8fafc;
  --text: #1a1a2e;
  --muted: #6b7280;
  --accent: #3b82f6;
  --line: #d9e0e7;
  --shadow: 0 10px 24px rgba(26, 26, 46, 0.06);
  --radius: 6px;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page-bg);
  color: var(--text);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page-bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.top-banner {
  display: block;
  width: min(100%, 1520px);
  margin: 0 auto;
  padding: 12px 16px 0;
}

.top-banner img {
  display: block;
  width: 100%;
  height: clamp(88px, 12vw, 170px);
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 248, 250, 0.94);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  width: min(100%, 1520px);
  margin: 0 auto;
  padding: 12px 16px;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.header-center {
  display: none;
}

.main-nav {
  display: flex;
  gap: 20px;
  margin-left: 0;
}

.nav-item {
  position: relative;
}

.nav-button {
  font-size: 18px;
  color: #000;
  background: transparent;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.nav-button:hover,
.nav-item:hover .nav-button {
  font-size: 18px;
  font-weight: bold;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #cbcdda;
  border-radius: 6px;
  padding: 8px 0;
  min-width: 103px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  display: none;
  margin-top: 4px;
}

.nav-item:hover .dropdown-menu {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 10px 16px;
  color: #000;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.dropdown-menu a:hover {
  background: #959693;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.header-welcome {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
}

.welcome-line-1,
.welcome-line-2 {
  display: flex;
  align-items: center;
  gap: 4px;
}

.welcome-text {
  font-size: 13px;
}

.visitor-count {
  font-size: 13px;
  font-weight: bold;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.favorite-button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.favorite-button:hover {
  border-color: #bdd3f5;
  background: #edf5ff;
}

.page-shell {
  display: grid;
  grid-template-columns: 104px 122px minmax(0, 1fr) 104px;
  gap: 12px;
  width: min(100%, 1520px);
  margin: 14px auto 0;
  padding: 0 16px 28px;
}

.side-media {
  position: sticky;
  top: 92px;
  align-self: start;
}

.side-media a,
.side-media img {
  display: block;
  width: 100%;
}

.side-media img {
  height: 520px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.category-nav {
  position: sticky;
  top: 92px;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.category-title {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.category-list {
  display: grid;
  gap: 1px;
  padding: 6px;
}

.category-item {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 18px;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.category-item:hover,
.category-item.is-active {
  border-left-color: var(--accent);
  background: #edf5ff;
  color: #0f3f92;
}

.main-content {
  min-width: 0;
}

.zone-section,
.tool-card,
.friend-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.zone-section {
  padding: 10px;
}

.zone-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.zone-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.zone-card.is-active {
  border-color: #a7c7f7;
  background: #f4f8ff;
}

.zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
}

.zone-head h2 {
  margin: 0;
  font-size: 14px;
}

.zone-head span {
  color: var(--muted);
  font-size: 12px;
}

.z-links {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
}

.tool-sections {
  display: grid;
  gap: 18px;
  margin-top: 32px;
}

.tool-card {
  padding: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.section-meta {
  color: var(--muted);
  font-size: 12px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.link-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: 38px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--cell-bg, var(--slot-bg));
  color: var(--cell-color, #000000);
  font-size: var(--cell-font-size, 15px);
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.link-cell:hover,
.link-cell:focus-visible {
  border-color: #c7d3df;
  background: var(--cell-hover, var(--slot-hover));
  outline: none;
}

.link-cell.is-empty {
  cursor: default;
  opacity: 0.6;
}

.link-cell.is-empty:hover {
  border-color: transparent;
  background: var(--cell-bg, var(--slot-bg));
}

.z-links .link-cell {
  min-height: 30px;
  padding: 0 4px;
  font-size: 13px;
}

.friend-section {
  margin-top: 18px;
  padding: 12px;
  background: var(--friend-bg);
}

.friend-grid .link-cell {
  min-height: 34px;
  font-size: 13px;
}

.site-footer {
  width: min(100%, 1520px);
  margin: 0 auto;
  padding: 4px 16px 30px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-footer p {
  margin: 6px 0 0;
}

@media (max-width: 1180px) {
  .page-shell {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .side-media {
    display: none;
  }

  .zone-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .top-banner {
    padding: 8px 10px 0;
  }

  .top-banner img {
    height: 86px;
  }

  .site-header {
    position: static;
  }

  .header-inner {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }

  .header-copy {
    display: grid;
    gap: 4px;
    font-size: 14px;
  }

  .header-actions {
    justify-content: space-between;
  }

  .page-shell {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0 10px 22px;
  }

  .category-nav {
    position: static;
  }

  .category-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .category-item {
    min-height: 38px;
    text-align: center;
    border-left: 0;
    border-top: 3px solid transparent;
  }

  .category-item:hover,
  .category-item.is-active {
    border-left-color: transparent;
    border-top-color: var(--accent);
  }

  .link-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .z-links {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tool-sections {
    margin-top: 18px;
  }
}

@media (max-width: 460px) {
  .brand-name {
    font-size: 16px;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .category-list,
  .link-grid,
  .z-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .link-cell {
    min-height: 40px;
    padding-inline: 6px;
    font-size: min(var(--cell-font-size, 15px), 14px);
  }
}

/* tools_web02 optimization overrides */
.brand {
  grid-column: 1;
}

.header-copy {
  grid-column: 2;
}

.header-copy[hidden] {
  display: none;
}

.header-actions {
  grid-column: 3;
}

.header-actions time {
  color: #f97316;
  font-weight: 600;
}

.page-shell {
  grid-template-columns: 132px minmax(0, 1fr);
}

.side-media {
  display: none;
}

body.has-side-banners .page-shell {
  grid-template-columns: 208px 132px minmax(0, 1fr) 208px;
}

body.has-side-banners .side-media {
  display: block;
}

.side-media img {
  height: 754px;
}

.zone-head {
  justify-content: center;
}

.zone-head h2 {
  font-size: 15px;
}

.zone-head span {
  display: none;
}

.tool-card {
  scroll-margin-top: 96px;
  transition: background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.tool-card.is-highlighted {
  border-color: #3b82f6;
  background: #eaf2ff;
  box-shadow: 0 10px 26px rgba(59, 130, 246, 0.15);
}

@media (max-width: 1180px) {
  .page-shell,
  body.has-side-banners .page-shell {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  body.has-side-banners .side-media {
    display: none;
  }
}

@media (max-width: 780px) {
  .brand,
  .header-copy,
  .header-actions {
    grid-column: 1;
  }

  .page-shell,
  body.has-side-banners .page-shell {
    grid-template-columns: 1fr;
  }
}
.top-banner {
  display: none;
}

body.has-top-banner .top-banner {
  display: block;
}
/* tools_web03 optimization overrides */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.header-actions {
  position: relative;
  gap: 15px;
}

.site-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 0;
}

.site-search input {
  width: 220px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #c6c5c9;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  outline: none;
}

.site-search input:focus {
  box-shadow: 0 0 0 3px rgba(74, 57, 242, 0.14);
}

.search-button {
  height: 34px;
  padding: 0 14px;
  border: 1px solid #4a39f2;
  border-radius: var(--radius);
  background: #edf5ff;
  color: #1a1a2e;
  cursor: pointer;
}

.search-button:hover {
  background: #dfe8ff;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: min(420px, calc(100vw - 24px));
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #4a39f2;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(26, 26, 46, 0.16);
}

.search-result-item {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text);
}

.search-result-item:hover,
.search-result-item:focus-visible {
  background: #eef2ff;
  outline: none;
}

.search-result-name {
  font-size: 14px;
  font-weight: 600;
}

.search-result-url {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.link-cell {
  border-color: #4a39f2;
}

.link-cell:hover,
.link-cell:focus-visible {
  border-color: #4a39f2;
  background: #7d99ff;
}

.category-item.is-return {
  margin-top: 6px;
  border-left-color: #f97316;
  background: #fff7ed;
  color: #9a3412;
}

.category-item.is-return:hover,
.category-item.is-return:focus-visible {
  background: #ffedd5;
  color: #7c2d12;
}

@media (max-width: 980px) {
  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .site-search {
    width: 100%;
  }

  .site-search input {
    width: min(100%, 280px);
  }
}

@media (max-width: 520px) {
  .site-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .site-search input {
    width: 100%;
  }

  .search-results {
    left: 0;
    right: auto;
    width: calc(100vw - 20px);
  }
}
/* tools_web04 optimization overrides */
.zone-section {
  position: static;
  background: var(--surface);
}

.zone-card.is-pinned {
  border-color: #f0f2f5;
  background: #ffffff;
}

.link-cell {
  border-color: #f0f2f5;
}

.link-cell:hover,
.link-cell:focus-visible {
  border-color: #4a39f2;
  background: #7d99ff;
}

.link-cell.is-empty:hover,
.link-cell.is-empty:focus-visible {
  border-color: #f0f2f5;
  background: var(--cell-bg, var(--slot-bg));
}

/* Tool icon in link cells */
.tool-icon {
  width: 20px;
  height: 20px;
  margin-right: 6px;
  object-fit: contain;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Search resource area specific styling */
.search-resource-box .link-cell span {
  justify-content: flex-start !important;
  padding-left: 0;
}

.search-resource-box .tool-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

@media (max-width: 780px) {
  .zone-section {
    position: static;
  }
}
/* scroll alignment fixes */
html {
  scroll-padding-top: 80px;
}

.zone-section {
  margin-bottom: 22px;
}

.tool-sections {
  margin-top: 22px;
}

.tool-card {
  scroll-margin-top: 80px;
}

.tool-card.is-highlighted {
  /* 保持默认颜色 */
}

@media (max-width: 1180px) {
  html {
    scroll-padding-top: 80px;
  }

  .tool-card {
    scroll-margin-top: 80px;
  }
}

@media (max-width: 780px) {
  html {
    scroll-padding-top: 16px;
  }

  .tool-card {
    scroll-margin-top: 16px;
  }
}

/* ===== tools_web08 optimization ===== */

/* Req 1 & 2: Header restructure - welcome aligns with brand, nav 9px gap, top-aligned */
.header-inner {
  grid-template-columns: 1fr auto;
  align-items: flex-start;
}

.header-top-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.header-welcome {
  margin-left: 84px; /* logo 52px + gap 10px + 22px offset */
}

.header-welcome p:last-child {
  text-align: center;
}

/* Req 3 & 4: Remove return-top from category, add fixed back-to-top button */
.category-item.is-return {
  display: none;
}

.back-to-top-btn {
  position: fixed;
  left: 18px;
  bottom: 28px;
  z-index: 100;
  width: 100px;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
  gap: 4px;
}

.back-to-top-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: #edf5ff;
}

.back-to-top-btn img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.back-to-top-btn .back-to-top-text {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

/* Req 5: Friend section - 5 rows x 3 cols, centered, dashed borders, no cell borders */
.friend-section {
  margin-top: 18px;
  padding: 12px;
  background: transparent;
  border: none;
  box-shadow: none;
  text-align: center;
}

.friend-section .section-head {
  justify-content: center;
}

.friend-section .section-head h2 {
  text-align: center;
}

.friend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  max-width: 600px;
  margin: 0 auto;
}

.friend-grid .link-cell {
  min-height: 34px;
  font-size: 13px;
  border: 1px dashed var(--line) !important;
  background: transparent;
  box-shadow: none;
}

.friend-grid .link-cell:hover,
.friend-grid .link-cell:focus-visible {
  background: var(--slot-hover);
  border-color: var(--accent) !important;
}

/* Req 6: Footer - two lines separated by a line, contact icon with hover tooltip */
.site-footer {
  width: min(100%, 1520px);
  margin: 0 auto;
  padding: 12px 16px 30px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.footer-text-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-line {
  margin: 4px 0;
}

.footer-divider {
  width: 100%;
  border: none;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

.footer-contact {
  position: relative;
  display: flex;
  align-items: center;
}

.contact-icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.contact-icon {
  width: 22px;
  height: 22px;
  color: var(--muted);
  transition: color 150ms ease;
}

.contact-icon-wrapper:hover .contact-icon {
  color: var(--accent);
}

.contact-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 50;
}

.contact-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
}

.contact-icon-wrapper:hover .contact-tooltip {
  display: block;
}

@media (max-width: 780px) {
  .header-inner {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .header-top-row {
    flex-wrap: wrap;
  }

  .header-welcome {
    margin-left: 0;
  }

  .friend-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-content {
    flex-direction: column;
    gap: 10px;
  }
}

/* ===== tools_web17 optimization ===== */

/* Req 1: header-actions 取消顶部对齐和置顶，下移20px后垂直居中 */
.header-inner {
  align-items: center !important;
}

.header-actions {
  margin-top: 20px;
  align-self: center;
}

/* Req 2: 欢迎文字右移35px，第二行垂直居中 */
.header-welcome {
  margin-left: 119px; /* 原84px + 35px */
}

.header-welcome .welcome-line-2 {
  display: flex;
  align-items: center;
  line-height: 1;
}

/* Req 3: 返回顶部按钮右移对齐分类栏，使用 top.png 图片 */
.back-to-top-btn {
  position: fixed;
  bottom: 28px;
  z-index: 100;
  width: auto;
  height: auto;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  cursor: pointer;
}

.back-to-top-btn:hover {
  background: transparent;
  border: none;
  opacity: 0.8;
}

.back-to-top-btn img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* Req 4: logo2 高度112px，平铺填充顶部左侧，距右侧文字10px */
.header-logo2 {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-logo2 img {
  width: auto;
  height: 112px;
  object-fit: cover;
  margin-right: 10px;
}

/* Req 5: 底部联系站长文字 + 友链下移20px + 5行x3列 */
.footer-contact-label {
  font-size: 13px;
  color: var(--muted);
  margin-right: 6px;
  white-space: nowrap;
}

.friend-section {
  margin-top: 53px; /* 原18px + 35px */
}

.friend-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
}

/* Req 6: 修复工具链接单元格站点名称无法完整显示 */
.link-cell {
  white-space: normal !important;
  text-overflow: clip !important;
  overflow: visible !important;
  word-break: break-all;
  line-height: 1.35;
  padding: 4px 8px !important;
}

.link-cell span {
  flex-wrap: wrap;
}

@media (max-width: 780px) {
  .back-to-top-btn {
    left: 16px;
  }

  .header-welcome {
    margin-left: 0;
  }

  .header-actions {
    margin-top: 0;
  }

  .header-logo2 img {
    height: 60px;
  }
}

/* ===== tools_web19 optimization ===== */

/* Req 1: 品牌文字与三个菜单垂直居中对齐 */
.header-top-row {
  align-items: center !important;
}

/* Req 2: 撤回 - 不再调整 logo2 */

/* ===== tools_web25: 工具单元格图标样式 ===== */
.tool-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  object-fit: contain;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
  border-radius: 3px;
}

/* Req 3: 欢迎文字与品牌文字垂直居中对齐 */
.header-welcome {
  margin-left: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-self: center;
}

.header-welcome .welcome-line-1,
.header-welcome .welcome-line-2 {
  margin: 0;
  line-height: 1.4;
}

/* 调整 header-left 布局：logo2 在左，右侧内容垂直居中 */
.header-left {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.header-logo2 {
  flex-shrink: 0;
}

@media (max-width: 780px) {
  .header-left {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-logo2 img {
    height: 40px;
  }
}
/* ===== tools_web26 optimization ===== */
.header-inner {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center !important;
  gap: 22px;
}

.header-left {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  gap: 18px;
}

.header-brand-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  width: 150px;
}

.header-logo2 {
  display: flex;
  justify-content: center;
  width: 100%;
}

.header-logo2 img {
  display: block;
  width: auto;
  height: 82px;
  margin-right: 0;
  object-fit: contain;
}

.header-welcome {
  width: 100%;
  margin: 6px 0 0;
  align-items: center;
  justify-content: center;
  gap: 0;
  color: #263445;
  text-align: center;
}

.header-welcome .welcome-line-1,
.header-welcome .welcome-line-2 {
  display: block;
  width: 100%;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  white-space: nowrap;
}

#visitorCount {
  color: #2563eb;
  font-weight: 700;
}

.header-top-row {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center !important;
  min-width: 0;
  gap: 12px 20px;
}

.brand-name {
  white-space: normal;
  line-height: 1.3;
}

.main-nav {
  flex-wrap: wrap;
  gap: 8px;
}

.nav-button {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 520px;
  margin-top: 0;
  white-space: normal;
}

.search-form {
  display: flex;
  align-items: center;
  min-width: 260px;
  max-width: 340px;
}

.search-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #c6cdd7;
  border-radius: var(--radius) 0 0 var(--radius);
  background: #fff;
  color: var(--text);
  outline: none;
}

.search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.search-form .search-button {
  flex: 0 0 auto;
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.main-content {
  display: grid;
  grid-template-columns: 126.5px minmax(0, 1fr);
  gap: 16px;
  width: min(100%, 1520px);
  margin: 14px auto 0;
  padding: 0 16px 28px;
}

.sidebar,
.content-area {
  min-width: 0;
}

.category-nav {
  top: 138px;
  overflow: hidden;
}

.category-title {
  font-weight: 700;
  text-align: center;
}

.category-item {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 8px;
  font-size: 16px;
  line-height: 1.25;
  word-break: keep-all;
}

.category-item svg {
  flex: 0 0 auto;
}

.zone-section,
.tool-card,
.friend-section {
  overflow: visible;
}

.zone-section {
  padding: 12px;
}

.zone-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

.zone-card {
  display: flex;
  flex-direction: column;
}

.zone-head {
  min-height: 36px;
}

.z-links {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.z-links .link-cell {
  min-height: 46px;
  padding: 5px 6px !important;
  font-size: 13px;
}

#toolSections {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.link-grid {
  grid-template-columns: repeat(6, minmax(128px, 1fr));
  gap: 8px;
}

.link-cell {
  align-items: center;
  min-height: 44px;
  height: auto;
  overflow: visible !important;
  padding: 6px 8px !important;
  border-color: #d8e0ea;
  line-height: 1.32;
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.link-cell > span {
  display: flex !important;
  align-items: center;
  min-width: 0;
  width: 100%;
  gap: 6px;
  flex-wrap: nowrap;
}

.link-cell > span > span {
  min-width: 0;
}

.tool-icon {
  margin-right: 0;
}

.search-container {
  min-width: 0;
}

.search-engine-box,
.search-resource-box {
  padding: 12px !important;
}

.search-engine-buttons {
  row-gap: 8px !important;
}

.search-resource-grid {
  grid-template-columns: repeat(6, minmax(128px, 1fr)) !important;
}

@media (max-width: 1280px) {
  .header-inner {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: flex-start;
    max-width: none;
    width: 100%;
  }

  .zone-grid {
    grid-template-columns: 1fr;
  }

  .z-links {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .header-left {
    flex-wrap: wrap;
  }

  .header-brand-group {
    width: 132px;
  }

  .header-logo2 img {
    height: 70px;
  }

  .main-content {
    grid-template-columns: 1fr;
  }

  .category-nav {
    position: static;
  }

  .category-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .category-item {
    justify-content: center;
    text-align: center;
    border-left: 0;
    border-top: 3px solid transparent;
  }

  .category-item:hover,
  .category-item.is-active {
    border-left-color: transparent;
    border-top-color: var(--accent);
  }

  .link-grid,
  .search-resource-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 680px) {
  .header-left {
    flex-direction: column;
    align-items: center;
  }

  .header-brand-group {
    width: 150px;
  }

  .header-top-row,
  .header-actions {
    justify-content: center;
  }

  .brand-name {
    text-align: center;
  }

  .search-form {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .category-list,
  .link-grid,
  .search-resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .z-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* tools_web26: keep shortcut cards in three columns despite the shared link-grid class. */
.link-grid.zone-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1280px) {
  .link-grid.zone-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .link-grid.zone-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== tools_web27 optimization ===== */
.header-inner {
  display: flex;
  align-items: flex-start !important;
  gap: 0;
}

.header-left {
  width: 100%;
  align-items: flex-start;
  gap: 18px;
}

.header-brand-group {
  margin-top: 0;
}

.header-top-row {
  align-items: flex-start !important;
  gap: 15px;
  padding-top: 0;
}

.brand-stack {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
  min-width: 248px;
  gap: 4px;
}

.brand-stack .brand {
  min-height: 36px;
  align-items: center;
}

.system-date {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  margin-left: 45px;
  margin-top: 15px;
  background: linear-gradient(90deg, #f97316, #eab308, #22c55e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.main-nav {
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 8px;
}

.header-actions {
  position: relative;
  align-self: flex-start;
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: flex-start;
  max-width: none;
  margin-top: 0;
  gap: 8px;
}

.search-form {
  flex: 1 1 260px;
  min-width: 230px;
  max-width: 340px;
}

.favorite-button,
.search-button,
.search-input {
  height: 36px;
}

.favorite-button {
  flex: 0 0 auto;
}

.zone-card .tool-icon {
  display: none !important;
}

.zone-card .link-cell {
  justify-content: center;
  text-align: center;
}

.zone-card .link-cell > span {
  justify-content: center !important;
  text-align: center;
}

.zone-card .link-cell > span > span {
  width: 100%;
  text-align: center;
}

@media (max-width: 1280px) {
  .header-top-row {
    flex: 1 1 0;
  }

  .brand-stack {
    min-width: 220px;
  }

  .header-actions {
    flex: 1 1 100%;
  }
}

@media (max-width: 980px) {
  .header-left {
    flex-wrap: wrap;
  }

  .header-top-row {
    width: 100%;
  }

  .brand-stack {
    min-width: min(100%, 280px);
  }
}

@media (max-width: 680px) {
  .header-left,
  .header-top-row,
  .brand-stack,
  .header-actions {
    align-items: center;
    justify-content: center;
  }

  .brand-stack .brand,
  .system-date {
    text-align: center;
  }

  .header-actions {
    flex-wrap: wrap;
    width: 100%;
  }
}

/* ===== tools_web29 optimization ===== */

/* Req 1: 品牌文字、系统时间、三个菜单向下移动35px；搜索框、搜索按钮、收藏本站按钮向下移动17px（原35px向上18px） */
.header-top-row {
  margin-top: 35px;
}

.header-actions {
  margin-top: 17px;
}

/* ===== tools_web31 optimization ===== */

/* 右侧工具链接区域站点名称字号调整至14号 */
.link-grid .link-cell {
  font-size: 14px;
}

/* 适当缩小右侧区域整体宽度 */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
}

/* 搜索框宽度调整为165.5px */
.search-input {
  width: 165.5px;
}

/* 收藏本站按钮背景色改为浅蓝色 */
.favorite-button {
  background-color: #dbeafe;
  border-color: #93c5fd;
}

/* 收藏本站按钮左移，与搜索按钮间距精确10px */
.header-actions {
  gap: 10px !important;
  flex: 0 0 auto !important;
  justify-content: flex-start !important;
}

/* 搜索表单按内容自适应，不再拉伸至 max-width，避免搜索按钮与容器右边缘之间产生空白 */
.header-actions > .search-form {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  width: auto !important;
  margin-right: 0 !important;
}

.header-actions > .favorite-button {
  flex: 0 0 auto !important;
  margin-left: 0 !important;
}

/* 工具链接单元格文字排版优化 */
.link-grid .link-cell {
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
  text-align: center;
  padding: 4px 6px;
}

/* ===== zone-card 单元格文字排版优化：避免"即时设计/科普中国"被拆成两行，"ProtoPie/PyCharm"被字母切断 ===== */
.zone-card .z-links .link-cell {
  min-height: 46px;
  padding: 6px 4px !important;
  line-height: 1.35;
  letter-spacing: 0.2px;
  /* 中文短语不在字符间拆行；英文单词不在字母间拆行；仅允许在空格/连字符处换行 */
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  white-space: normal !important;
  hyphens: none;
}

.zone-card .z-links .link-cell > span {
  gap: 4px;
  padding: 0;
  flex-wrap: wrap !important;
  justify-content: center !important;
}

.zone-card .z-links .link-cell > span > span {
  display: inline-block;
  max-width: 100%;
  text-align: center;
}
