/* ============================================================
   SilkGateway Design System — 白底蓝色科技风
   White base · Blue tech accent · Responsive · Colored data
   ============================================================ */

:root {
  --bg: #f5f8ff;
  --surface: #ffffff;
  --surface-2: #f0f5ff;
  --border: #e2eaf8;
  --border-2: #d3e2fa;
  --text: #0a1f44;
  --text-2: #48587a;
  --muted: #7e8db0;
  --primary: #1668ff;
  --primary-2: #38bdf8;
  --primary-deep: #0b3fa0;
  --primary-soft: #e8f1ff;
  --green: #10b981;
  --green-soft: #e7f9f1;
  --red: #ef4444;
  --red-soft: #feeceb;
  --amber: #f59e0b;
  --amber-soft: #fef3e0;
  --purple: #8b5cf6;
  --purple-soft: #f1ecfe;
  --cyan: #06b6d4;
  --cyan-soft: #e3f8fc;
  --pink: #ec4899;
  --pink-soft: #fdeef6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(22, 104, 255, 0.09);
  --shadow-sm: 0 4px 16px rgba(22, 104, 255, 0.07);
  --grad: linear-gradient(135deg, #1668ff 0%, #38bdf8 100%);
  --grad-deep: linear-gradient(135deg, #0b3fa0 0%, #1668ff 100%);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
::selection { background: var(--primary-soft); }

/* 键盘可达性：Tab 聚焦环（仅键盘触发，不干扰鼠标点击） */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.btn:focus-visible { outline-offset: 3px; }

/* 细滚动条（配合蓝白主题） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; border: 2px solid var(--surface-2); }
::-webkit-scrollbar-thumb:hover { background: var(--primary-2); }
* { scrollbar-width: thin; scrollbar-color: var(--border-2) var(--surface-2); }

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* 渐变文字 */
.grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; gap: 28px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 900; font-size: 17px;
  box-shadow: 0 4px 12px rgba(22, 104, 255, 0.35);
}
.logo span { color: var(--primary); }
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a {
  color: var(--text-2); padding: 8px 14px; border-radius: 8px; font-weight: 500; font-size: 14px;
}
.nav-links a:hover { color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.nav-links a.active { color: var(--primary); background: var(--primary-soft); }
.lang-btn {
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
  font-family: var(--font); transition: all 0.15s;
}
.lang-btn:hover { border-color: var(--primary); color: var(--primary); }
.nav-burger { display: none; margin-left: auto; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-burger svg { display: block; }

/* ---------- 布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; }
.section-title { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; }
.section-sub { color: var(--text-2); font-size: 16px; margin-bottom: 40px; max-width: 640px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.text-center { text-align: center; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.card-desc { color: var(--text-2); font-size: 14px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 12px; font-weight: 700; font-size: 14px;
  font-family: var(--font); cursor: pointer; border: none; transition: all 0.18s;
  text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(22, 104, 255, 0.3); }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(22, 104, 255, 0.42); }
.btn-ghost { background: var(--surface); color: var(--primary); border: 1.5px solid var(--border-2); }
.btn-ghost:hover { border-color: var(--primary); background: var(--primary-soft); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border-2); border-radius: 12px;
  font-size: 14px; font-family: var(--font); color: var(--text); background: var(--surface);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input::placeholder { color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- 徽章 / 状态 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-cyan { background: var(--cyan-soft); color: var(--cyan); }
.badge-gray { background: var(--surface-2); color: var(--text-2); }

/* ---------- 统计卡（彩色数字）---------- */
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--stat-color, var(--grad));
}
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-value { font-size: 27px; font-weight: 800; color: var(--stat-color, var(--primary)); font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stat-c-blue { --stat-color: #1668ff; }
.stat-c-green { --stat-color: #10b981; }
.stat-c-purple { --stat-color: #8b5cf6; }
.stat-c-amber { --stat-color: #f59e0b; }
.stat-c-cyan { --stat-color: #06b6d4; }
.stat-c-pink { --stat-color: #ec4899; }
.stat-c-red { --stat-color: #ef4444; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
.tbl th {
  text-align: left; padding: 12px 16px; background: var(--surface-2); color: var(--text-2);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: var(--primary-soft); }
.tbl .mono { font-family: var(--mono); font-size: 12.5px; }
.tbl tbody tr.skel-row td { padding: 14px 16px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 14px; }
.empty-state .empty-icon { display: block; font-size: 30px; margin-bottom: 8px; opacity: 0.65; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 22px; }
.tab-btn {
  padding: 9px 18px; border-radius: 10px; border: none; background: transparent;
  color: var(--text-2); font-weight: 600; font-size: 13.5px; cursor: pointer; font-family: var(--font);
  transition: all 0.15s;
}
.tab-btn:hover { background: var(--primary-soft); color: var(--primary); }
.tab-btn.active { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(22, 104, 255, 0.3); }

/* ---------- 进度条 ---------- */
.progress { height: 9px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--grad); border-radius: 999px; transition: width 0.5s ease; }
.progress-bar.warn { background: linear-gradient(135deg, #f59e0b, #f97316); }
.progress-bar.danger { background: linear-gradient(135deg, #ef4444, #f43f5e); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 76px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 13px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow); animation: toastIn 0.25s ease; max-width: 340px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  display: flex; align-items: center; gap: 9px;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.leaving { opacity: 0; transform: translateX(24px); transition: all 0.3s; }
.toast .toast-icon { font-size: 15px; line-height: 1; flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---------- 骨架屏（加载占位）---------- */
.skel {
  position: relative; overflow: hidden; border-radius: 8px;
  background: var(--surface-2); min-height: 14px;
}
.skel::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.75), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- 数字滚动（hero 统计）---------- */
.stat-value.count-up { animation: countPop 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes countPop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 入场动画（滚动进入视口时触发）---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ---------- 回到顶部 ---------- */
.fab-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--surface); color: var(--primary); box-shadow: var(--shadow);
  border: 1px solid var(--border-2); display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.fab-top.show { opacity: 1; pointer-events: auto; }
.fab-top:hover { transform: translateY(-2px); border-color: var(--primary); }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(10, 31, 68, 0.45); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--surface); border-radius: 20px; padding: 28px; width: 100%;
  max-width: 520px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow);
  animation: modalIn 0.22s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 19px; font-weight: 800; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------- 图表容器 ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.chart-title { font-size: 14px; font-weight: 700; color: var(--text-2); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.chart-box { position: relative; width: 100%; }

/* ---------- 代码块 ---------- */
.code-block {
  background: #0a1f44; color: #dbe7ff; border-radius: 14px; padding: 20px;
  font-family: var(--mono); font-size: 13px; line-height: 1.7; overflow-x: auto;
  position: relative;
}
.code-block .cm { color: #6b83ad; }
.code-block .kw { color: #38bdf8; }
.code-block .str { color: #7ee7b8; }
.code-tag {
  position: absolute; top: 12px; right: 14px; font-size: 11px; color: #6b83ad;
  font-family: var(--font); font-weight: 600;
}
.code-copy {
  position: absolute; top: 8px; right: 60px; padding: 4px 10px; border-radius: 7px;
  border: 1px solid rgba(107, 131, 173, 0.5); background: rgba(10, 31, 68, 0.6);
  color: #9db4dc; font-size: 11.5px; font-weight: 600; font-family: var(--font);
  cursor: pointer; opacity: 0; transition: opacity 0.2s, color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.code-block:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: #dbe7ff; border-color: #38bdf8; }
.code-copy.copied { color: #7ee7b8; border-color: #7ee7b8; opacity: 1; }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 64px; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; background: var(--primary-soft);
  color: var(--primary); padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  margin-bottom: 20px;
}
.hero-title { font-size: 52px; font-weight: 900; line-height: 1.12; letter-spacing: -1.5px; margin-bottom: 18px; }
.hero-title .grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: 17px; color: var(--text-2); margin-bottom: 30px; max-width: 520px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- 功能卡图标 ---------- */
.feature-icon {
  width: 46px; height: 46px; border-radius: 13px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 22px; margin-bottom: 16px;
}

/* ---------- 开关 ---------- */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0; background: var(--border-2); border-radius: 999px;
  cursor: pointer; transition: 0.2s;
}
.switch-slider::before {
  content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-slider { background: var(--grad); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 40px 0; margin-top: 40px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }

/* ---------- 工具类 ---------- */
.flex { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-2 { color: var(--text-2); } .muted { color: var(--muted); }
.small { font-size: 13px; } .bold { font-weight: 700; }
.c-blue { color: var(--primary); } .c-green { color: var(--green); } .c-red { color: var(--red); }
.c-purple { color: var(--purple); } .c-amber { color: var(--amber); } .c-cyan { color: var(--cyan); }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.spinner {
  width: 18px; height: 18px; border: 2.5px solid var(--primary-soft);
  border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero { padding: 56px 0 40px; }
  .hero-title { font-size: 38px; }
  .section { padding: 52px 0; }
  .section-title { font-size: 26px; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 12px 20px; gap: 4px; box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-burger { display: block; }
  .nav-inner { padding: 0 16px; gap: 12px; }
  .container { padding: 0 16px; }
  .hero-title { font-size: 32px; letter-spacing: -0.5px; }
  .hero-sub { font-size: 15px; }
  .stat-value { font-size: 22px; }
  .card { padding: 18px; }
  .modal { padding: 20px; }
  .section { padding: 40px 0; }
  .section-title { font-size: 23px; }
  .toast-wrap { left: 16px; right: 16px; }
  .toast { max-width: none; }
}
