/* ── 全局重置 ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg:       #f8f9fb;
  --color-surface:  #ffffff;
  --color-border:   #e5e7eb;
  --color-primary:  #6366f1;
  --color-primary-dark: #4f46e5;
  --color-text:     #1f2937;
  --color-muted:    #6b7280;
  --radius:         12px;
  --shadow:         0 2px 12px rgba(0,0,0,.08);
  --transition:     0.2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── 布局容器 ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── 导航栏 ───────────────────────────────────────────────── */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.5px;
}
nav { display: flex; gap: 1.5rem; }
nav a {
  font-size: 0.95rem;
  color: var(--color-muted);
  transition: color var(--transition);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
nav a:hover, nav a.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ── 语言切换按钮 ── */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  transition: all var(--transition);
  cursor: pointer;
}
.lang-switch:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: #f0f0ff;
}

/* ── 首页 Hero ────────────────────────────────────────────── */
.hero {
  padding: 4rem 1.5rem 3rem;
  text-align: center;
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
}
.hero .subtitle {
  font-size: 1.1rem;
  color: var(--color-muted);
  margin-bottom: 3rem;
}

/* ── 页面 Header ──────────────────────────────────────────── */
.page-header {
  padding: 2.5rem 0 1.5rem;
}
.page-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.page-header p {
  color: var(--color-muted);
}

/* ── 卡片网格（首页/英语页） ───────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  padding-bottom: 3rem;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99,102,241,.15);
  border-color: var(--color-primary);
}
.card-icon {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}
.card h2 {
  font-size: 1.1rem;
  font-weight: 600;
}
.card p {
  font-size: 0.9rem;
  color: var(--color-muted);
  flex: 1;
}
.badge {
  display: inline-block;
  background: #eff6ff;
  color: #3b82f6;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 0.5rem;
  width: fit-content;
}

/* ── Dev 主页（分类分组 + 搜索） ──────────────────────────── */
.dev-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  width: 100%;
}
.dev-hero {
  text-align: center;
  padding: 2.5rem 0 1.5rem;
}
.dev-hero h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  background: linear-gradient(135deg, var(--color-primary), #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.dev-hero p {
  color: var(--color-muted);
  font-size: 0.95rem;
}
.dev-search-bar {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}
.dev-search-bar input {
  width: 100%;
  max-width: 520px;
  padding: 10px 18px;
  border: 2px solid var(--color-border);
  border-radius: 24px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  background: var(--color-surface);
}
.dev-search-bar input:focus {
  border-color: var(--color-primary);
}
.dev-category {
  margin-bottom: 28px;
}
.dev-cat-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.dev-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dev-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(99,102,241,.12);
  transform: translateY(-2px);
}
.dev-card-icon {
  font-size: 1.3em;
  margin-bottom: 4px;
}
.dev-card-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--color-text);
}
.dev-card-desc {
  font-size: 0.78rem;
  color: var(--color-muted);
  line-height: 1.4;
}
.dev-no-result {
  text-align: center;
  padding: 40px;
  color: var(--color-muted);
  font-size: 0.95rem;
}

@media (max-width: 600px) {
  .dev-grid {
    grid-template-columns: 1fr;
  }
}

/* ── 子工具页面自适应宽度 ─────────────────────────────────── */
.tool-page-container {
  width: 100%;
  max-width: none;
  padding: 0;
  flex: 1;
}
.tool-page-container .container,
.tool-page-container .container-tool {
  max-width: none !important;
  width: 100%;
  padding: 24px 2rem;
}
.tool-page-container > .tool-panel,
.tool-page-container > .tk-panel,
.tool-page-container > .md-panel {
  max-width: 960px;
  margin: 0 auto;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 1.25rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
}
.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: .6rem;
}
.site-footer .footer-links a {
  color: var(--color-muted);
  text-decoration: none;
  transition: color .15s ease;
}
.site-footer .footer-links a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ── 信息/信任页（隐私/关于/联系/条款） ────────────────────── */
.info-page {
  max-width: 820px;
  margin: 2.5rem auto 3rem;
  padding: 0 1rem;
  line-height: 1.75;
}
.info-page h1 {
  font-size: 1.9rem;
  margin-bottom: .5rem;
}
.info-intro {
  color: var(--color-muted);
  margin-bottom: 1.75rem;
}
.info-section {
  margin-bottom: 1.75rem;
}
.info-section h2 {
  font-size: 1.2rem;
  margin-bottom: .5rem;
  color: var(--color-text);
}
.info-section p {
  margin: 0 0 .6rem;
}
.info-section ul {
  margin: .25rem 0 .6rem 1.2rem;
  padding: 0;
}
.info-section li {
  margin-bottom: .35rem;
}

/* ── 导航栏 Mega Menu 下拉面板 ────────────────────────────── */
.nav-dev-link {
  position: relative;
}
.nav-mega {
  display: none;
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  z-index: 200;
}
.nav-mega.visible { display: block; }
.nav-mega-inner {
  width: 66.67vw;
  max-width: 1100px;
  margin: 0 auto;
  /* 右侧 padding 去掉，由 scrollbar-gutter 自动补偿，避免内容与滚动条间留白 */
  padding: 16px 1.5rem 16px 1.5rem;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;  /* 始终为滚动条预留空间，避免出现时内容抖动 */
}
.nav-mega-search {
  margin-bottom: 14px;
}
.nav-mega-search input {
  width: 100%;
  max-width: 360px;
  padding: 7px 14px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
  background: var(--color-bg);
}
.nav-mega-search input:focus {
  border-color: var(--color-primary);
}
.nav-mega-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px 24px;
}

.subnav-col-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}
.subnav-col a {
  display: block;
  padding: 5px 4px;
  border-radius: 4px;
  color: var(--color-text);
  transition: background 0.15s, color 0.15s;
}
.subnav-col a:hover {
  background: #f0f0ff;
  color: var(--color-primary);
}
.subnav-tool-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
}
.subnav-tool-desc {
  display: block;
  font-size: 0.72rem;
  color: var(--color-muted);
  margin-top: 1px;
}

/* ── 响应式 ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-mega-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .hero h1 { font-size: 1.8rem; }
  nav { gap: 1rem; }
}
