/* ===== CSS Variables ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #06b6d4;
  --accent-soft: #ecfeff;
  --trust: #10b981;
  --trust-bg: #ecfdf5;
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-muted: #f1f5f9;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --gradient-brand: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  --gradient-hero: radial-gradient(ellipse 90% 70% at 50% -20%, rgba(37, 99, 235, 0.16) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
    linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07);
  --shadow-md: 0 10px 24px -4px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 20px 40px -8px rgba(15, 23, 42, 0.14);
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition: 0.22s ease;
  --nav-height: 64px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-label {
  display: inline-block;
  padding: 5px 14px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 14px;
}

.section-muted {
  background: linear-gradient(180deg, var(--bg-muted) 0%, var(--bg) 100%);
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

ul { list-style: none; }

/* ===== Typography ===== */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; color: var(--text); }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p { color: var(--text-secondary); line-height: 1.75; }

/* ===== Layout ===== */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

main { flex: 1; padding-top: var(--nav-height); }

.section { padding: 72px 0; }
.section-sm { padding: 48px 0; }

.section-header { margin-bottom: 40px; }
.section-header h2 {
  margin-bottom: 10px;
  letter-spacing: -0.03em;
  font-size: 1.85rem;
}
.section-header p { font-size: 1rem; max-width: 540px; color: var(--text-secondary); }
.section-header-center { text-align: center; }
.section-header-center p { margin-left: auto; margin-right: auto; }
.section-header-tight { margin-bottom: 24px; }

.section-preview {
  padding: 32px 0 24px;
}

main > .hero + .section-preview {
  padding-top: 28px;
}

.section-preview + .section-preview {
  padding-top: 24px;
}

.section-preview + .section {
  padding-top: 48px;
}

.section-actions {
  text-align: center;
  margin-top: 24px;
}

/* ===== Hero / 页面头图 ===== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 56px 0 44px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: var(--gradient-hero);
  z-index: 0;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero-desc,
.page-head-desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 560px;
  line-height: 1.7;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 28px;
}

.hero-compact {
  padding: 36px 0 32px;
}

.hero-compact .hero-inner {
  text-align: left;
  max-width: none;
  margin: 0;
}

.hero-compact h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
}

.hero-compact .hero-desc,
.hero-compact .page-head-desc {
  margin-left: 0;
  font-size: 0.95rem;
  max-width: none;
}

.hero-compact .trust-badges { justify-content: flex-start; }

.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  backdrop-filter: blur(8px);
}

.trust-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--trust);
  flex-shrink: 0;
}

main > .hero + .section,
main > .hero + .section-sm,
main > .page-head + .section,
main > .page-head + .section-sm {
  padding-top: 28px;
}

/* 兼容旧 page-head */
.page-head {
  position: relative;
  overflow: hidden;
  padding: 36px 0 32px;
  background: var(--gradient-hero);
  border-bottom: none;
}

.page-head-compact { padding: 32px 0 28px; }

.page-head h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.page-head-desc {
  margin-left: 0;
  font-size: 0.95rem;
}

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.nav-inner {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo:hover { color: var(--primary); }

.nav-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: all var(--transition);
}

.nav-links a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-links a.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-cta {
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

.nav-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(37, 99, 235, 0.18);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.tool-card h4 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.tool-card p {
  font-size: 0.88rem;
  margin-top: 6px;
  color: var(--text-secondary);
}

/* ===== Badge ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--primary-light);
  color: var(--primary);
}
.badge-gray { background: var(--bg-secondary); color: var(--text-secondary); }
.badge-green { background: #f0fdf4; color: #16a34a; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.form-group textarea { resize: vertical; min-height: 120px; }

/* ===== Grid Layouts ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ===== Blog Card ===== */
.blog-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.blog-card:hover h3 { color: var(--primary); }

.blog-card .card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.blog-card h3 { margin-bottom: 8px; font-size: 1.1rem; }
.blog-card p { font-size: 0.9rem; flex: 1; }
.blog-card .card-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== Tool Cards ===== */
.tool-icon {
  width: 48px;
  height: 48px;
  background: var(--gradient-brand);
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

/* ===== Tool Workspace ===== */
.tool-workspace { display: none; margin-top: 24px; }
.tool-workspace.active { display: block; }

.tool-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.tool-panel textarea,
.tool-panel input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-family: 'Fira Code', 'Courier New', monospace;
  background: var(--bg);
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: border-color var(--transition);
}
.tool-panel textarea:focus,
.tool-panel input:focus { border-color: var(--primary); }

.tool-panel textarea { min-height: 180px; }

/* tools 页高度自适应（宽度不变，仅按视口分配 JSON 输入/输出高度） */
body.page-tools {
  --tools-layout-offset: 390px;
}

body.page-tools main > .section-sm {
  padding-bottom: 12px;
}

body.page-tools .tool-workspace {
  margin-top: 12px;
}

#tool-json #json-input {
  min-height: 120px;
  height: max(120px, calc((100vh - var(--tools-layout-offset)) * 0.38));
  max-height: max(120px, calc((100vh - var(--tools-layout-offset)) * 0.38));
}

#tool-json .code-viewport {
  min-height: 140px;
  height: max(140px, calc((100vh - var(--tools-layout-offset)) * 0.58));
  max-height: max(140px, calc((100vh - var(--tools-layout-offset)) * 0.58));
}

#tool-json .json-viewer-code {
  min-height: 100%;
}

.tool-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }

.output-box {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-all;
}

.output-box.success { border-left: 3px solid #22c55e; }
.output-box.error { border-left: 3px solid #ef4444; }

/* ===== JSON Output Viewer ===== */
.json-output-panel {
  margin-bottom: 16px;
}

.json-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.json-output-header label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}

.json-hint {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: 8px;
}

.json-output-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.json-wrap-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.json-wrap-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
}

#json-maximize-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

#json-maximize-btn svg {
  display: block;
  flex-shrink: 0;
}

.code-viewport {
  display: flex;
  overflow: auto;
  max-height: 360px;
  background: #1e293b;
  border-radius: var(--radius);
  border: 1px solid #334155;
}

.code-viewport.success { border-left: 3px solid #22c55e; }
.code-viewport.error { border-left: 3px solid #ef4444; }

.line-numbers {
  flex-shrink: 0;
  padding: 16px 10px 16px 12px;
  color: #64748b;
  background: #0f172a;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  text-align: right;
  user-select: none;
  border-right: 1px solid #334155;
  min-width: 3em;
}

.line-numbers span {
  display: block;
}

.json-viewer-code {
  flex: 1;
  margin: 0;
  padding: 16px;
  min-height: 200px;
  background: transparent;
  color: #e2e8f0;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  overflow: visible;
  border: none;
  border-radius: 0;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

/* 默认勾选：自动换行 */
.code-viewport.is-wrap .json-viewer-code {
  white-space: pre-wrap;
  word-break: break-all;
}

/* 取消勾选：不换行，横向滚动 */
.code-viewport:not(.is-wrap) .json-viewer-code {
  white-space: pre;
  word-break: normal;
}

.json-viewer-code mark.json-match {
  background: rgba(250, 204, 21, 0.32);
  color: #fef9c3;
  padding: 0 1px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.45);
  line-height: inherit;
  vertical-align: baseline;
}

/* ===== JSON 折叠视图 ===== */
#json-output.json-fold-view {
  display: block;
  user-select: text;
  -webkit-user-select: text;
}

#json-output .json-fold,
#json-output .json-fold-body,
#json-output .jv-row {
  user-select: text;
  -webkit-user-select: text;
}

.json-fold {
  display: block;
  position: relative;
  margin: 0;
}

.json-fold-body {
  display: block;
  margin-left: 0.6em;
  margin-top: 0;
  margin-bottom: 0;
  padding-left: 0.85em;
  border-left: 1px dashed rgba(148, 163, 184, 0.55);
}

.json-fold-inner {
  display: block;
}

.jv-row {
  display: block;
  line-height: 1.6;
  margin: 0;
}

.jv-key { color: #7dd3fc; }
.jv-colon { color: #94a3b8; }
.jv-str { color: #86efac; }
.jv-str-multiline {
  white-space: pre-wrap;
  word-break: break-all;
}
.jv-num { color: #fcd34d; }
.jv-lit { color: #c4b5fd; }
.jv-empty { color: #94a3b8; }
.jv-comma { color: #94a3b8; }

.json-brace {
  cursor: pointer;
  font-weight: 700;
  color: #94a3b8;
  padding: 0 2px;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
  user-select: none;
}

.json-brace:hover {
  color: #e2e8f0;
  background: rgba(59, 130, 246, 0.22);
}

.json-brace.is-active {
  color: #fde68a;
  background: rgba(250, 204, 21, 0.28);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.55);
}

.json-fold-ellipsis {
  display: none;
  color: #64748b;
  font-style: italic;
  margin: 0 4px;
  user-select: none;
}

.json-fold.is-collapsed .json-fold-ellipsis {
  display: inline;
}

.json-fold.is-collapsed .json-fold-body {
  display: none;
}

/* 折叠时虚线改为 open/close 之间的水平连接提示 */
.json-fold.is-collapsed .json-brace-open {
  position: relative;
}

.json-fold.is-collapsed .json-brace-open::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  width: 1.5em;
  height: 0;
  border-top: 1px dashed rgba(148, 163, 184, 0.55);
  margin-left: 2px;
  pointer-events: none;
}

/* JSON 输出最大化 */
body.json-output-maximized { overflow: hidden; }

.json-output-panel.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 3000;
  margin: 0;
  padding: 16px 20px 20px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.json-output-panel.is-maximized .json-output-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}

/* 用 ID 提高优先级，覆盖 #tool-json .code-viewport 的 vh 固定高度 */
#json-output-panel.is-maximized .code-viewport {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  height: auto;
  overflow: auto;
}

#json-output-panel.is-maximized .json-viewer-code {
  min-height: 100%;
}

@media (max-width: 768px) {
  body.page-tools {
    --tools-layout-offset: 280px;
  }

  #tool-json #json-input {
    min-height: 100px;
    height: max(100px, calc((100vh - var(--tools-layout-offset)) * 0.36));
    max-height: max(100px, calc((100vh - var(--tools-layout-offset)) * 0.36));
  }

  #tool-json .code-viewport {
    min-height: 120px;
    height: max(120px, calc((100vh - var(--tools-layout-offset)) * 0.56));
    max-height: max(120px, calc((100vh - var(--tools-layout-offset)) * 0.56));
  }

  #json-output-panel.is-maximized .code-viewport {
    max-height: none;
    min-height: 0;
    height: auto;
  }

  .code-viewport { max-height: 280px; }
  .json-output-panel.is-maximized { padding: 12px; }
}

/* ===== Tags ===== */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  background: var(--bg-muted);
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.tab-btn {
  padding: 8px 18px;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.8);
}

.tab-btn.active {
  color: #fff;
  background: var(--gradient-brand);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* ===== Alert ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--primary-light); color: #1d4ed8; border: 1px solid #bfdbfe; }

/* Toast 居中提示（全站 showToast 共用） */
.toast-notice {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  max-width: min(360px, calc(100vw - 48px));
  margin: 0;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  animation: toastIn 0.25s ease;
  pointer-events: none;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

/* ===== Loading ===== */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

/* ===== Blog Post Content ===== */
.post-content { line-height: 1.8; }
.post-content h1, .post-content h2, .post-content h3 { margin: 28px 0 12px; }
.post-content p { margin-bottom: 16px; color: var(--text); }
.post-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 16px 0;
  font-size: 0.85rem;
}
.post-content code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'Fira Code', monospace;
}
.post-content pre code { background: none; padding: 0; }
.post-content blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== Footer ===== */
footer {
  margin-top: auto;
  background: #0f172a;
  color: #94a3b8;
  padding: 0;
  border-top: none;
}

.footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  padding: 40px 0 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.footer-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
  text-decoration: none;
}

.footer-brand-link:hover { color: #fff; }

.footer-brand-link img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.footer-slogan {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #64748b;
  max-width: 300px;
  line-height: 1.6;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0 20px;
}

.footer-copy { font-size: 0.78rem; color: #64748b; }

.footer-icp {
  font-size: 0.78rem;
  color: #64748b;
  text-decoration: none;
}

.footer-icp:hover { color: #94a3b8; }

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 0.88rem;
  color: #cbd5e1;
  font-weight: 500;
}

.footer-links a:hover { color: #fff; }

/* page-header 已合并至 .hero，保留别名兼容旧 markup */
.page-header h1 {
  font-size: 1.15rem;
  letter-spacing: -0.5px;
  margin-bottom: 0;
  line-height: 1.15;
}

.page-header p {
  font-size: 0.75rem;
  max-width: 640px;
  margin: 2px 0 0;
  line-height: 1.25;
  color: var(--text-secondary);
}

/* ===== Admin ===== */
.admin-layout { display: flex; min-height: calc(100vh - var(--nav-height)); }

.sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 24px 12px;
  flex-shrink: 0;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: var(--primary);
  background: var(--primary-light);
}

.admin-content { flex: 1; padding: 32px; overflow-y: auto; }

.admin-panel { display: none; }
.admin-panel.active { display: block; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}
.stat-card .stat-num { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
table tr:hover td { background: var(--bg-secondary); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(10px);
  transition: transform var(--transition);
}
.modal-overlay.show .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--bg-secondary); }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 40px; }
.page-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition);
}
.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; }

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  padding: 24px;
}

.login-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-card .logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-card .logo h2 { font-size: 1.5rem; }
.login-card .logo p { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* ===== About Page ===== */
.about-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 20px;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.25);
  border: 3px solid #fff;
}

.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.skill-tag {
  padding: 5px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.contact-links { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color var(--transition);
}
.contact-link:hover { color: var(--primary); }
.contact-link .link-icon { font-size: 1.1rem; width: 20px; text-align: center; }

/* ===== 企业工具表格 ===== */
.lb-tool-section { padding-top: 32px; }

.lb-tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding: 8px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.lb-tool-nav a {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.lb-tool-nav a:hover {
  color: var(--primary);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.lb-tool-table-wrap {
  margin-bottom: 28px;
  scroll-margin-top: calc(var(--nav-height) + 16px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.lb-tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.55;
}

.lb-tool-table caption {
  caption-side: top;
  text-align: left;
  padding: 18px 22px 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
}

.lb-tool-table th,
.lb-tool-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

.lb-tool-table thead th {
  background: var(--bg-muted);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.lb-tool-table tbody tr:last-child td { border-bottom: none; }

.lb-tool-table tbody tr:hover td {
  background: rgba(37, 99, 235, 0.03);
}

.lb-tool-table td.subcategory {
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  vertical-align: middle;
}

.lb-tool-table td:nth-child(2) {
  font-weight: 600;
  color: var(--text);
}

.lb-tool-table td:nth-child(3) {
  color: var(--text-secondary);
}

.lb-tool-table.lb-tool-table-3col td:nth-child(1) {
  font-weight: 600;
  color: var(--text);
}

.lb-tool-table.lb-tool-table-3col td:nth-child(2) {
  font-weight: normal;
  color: var(--text-secondary);
}

.lb-tool-table.lb-tool-table-3col td:nth-child(3) {
  color: inherit;
}

.lb-tool-table a {
  word-break: break-all;
  font-size: 0.84rem;
}

.lb-tool-table small {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.lb-tool-table .lb-tool-row-anchor {
  scroll-margin-top: calc(var(--nav-height) + 20px);
}

.lb-tool-table tbody tr.lb-tool-row-anchor:target td {
  background: rgba(37, 99, 235, 0.1);
}

.lb-tool-table tbody tr.lb-tool-row-anchor:target td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    margin-left: 0;
  }

  .nav-actions { display: none; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    box-shadow: var(--shadow-md);
  }

  .nav-menu-btn {
    display: flex;
    margin-left: auto;
  }

  .hero { padding: 40px 0 48px; }
  .hero-compact { padding: 28px 0 24px; }
  .hero h1 { white-space: normal; }
  .hero-compact .hero-inner { text-align: left; }

  .hero-actions { width: 100%; justify-content: flex-start; }
  .hero-compact .hero-actions { justify-content: flex-start; }

  .footer-top { flex-direction: column; gap: 20px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }

  .admin-layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-nav { flex-direction: row; overflow-x: auto; }

  .section { padding: 48px 0; }
  .lb-tool-table { min-width: 640px; }
  .admin-content { padding: 20px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .card { padding: 16px; }
  .login-card { padding: 28px 20px; }
}
