/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 基础色板 */
  --color-dark: #140E25;
  --color-paper: #F7F5F3;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;

  /* RGB 变体用于透明度控制 */
  --color-text-rgb: 25, 21, 35;
  --color-dark-rgb: 20, 14, 37;

  /* 设计 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;

  /* 排版与间距 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-base: 1.55;
  --line-height-tight: 1.1;
  --letter-spacing-tight: -0.02em;
}

/* 重置与基础 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}
.grid {
  display: grid;
  gap: var(--gap);
}
.flex {
  display: flex;
  gap: var(--gap);
}
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* 响应式网格列 */
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .grid-cols-2, .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid-cols-2, .grid-cols-3 { grid-template-columns: 1fr; }
}

/* 排版 */
h1, h2, h3, h4 { line-height: var(--line-height-tight); letter-spacing: var(--letter-spacing-tight); font-weight: 800; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: 1.25rem; margin-bottom: calc(var(--gap) * 0.75); }
p { margin-bottom: var(--gap); max-width: 38em; }
.text-accent { color: var(--color-accent); }
.text-brand { color: var(--color-brand); }
.text-muted { color: rgba(var(--color-text-rgb), 0.7); }

/* 眉标 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.badge::before {
  content: "";
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid transparent;
}
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
}
/* 深色面下的按钮取色反转 */
.dark-bg .btn-primary { color: var(--color-dark); }
.dark-bg .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }

/* 卡片 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-color: rgba(var(--color-text-rgb), 0.16);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}
/* 深色背景里的浅色卡片恢复纸面取色 */
.light-card {
  background: var(--color-paper);
  color: var(--color-text);
  border-color: rgba(var(--color-text-rgb), 0.16);
}

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(var(--color-text-rgb), 0.12);
}
th { font-weight: 700; background: rgba(var(--color-text-rgb), 0.04); }
td:first-child { font-weight: 600; width: 40%; }

/* FAQ Details */
details {
  border: var(--card-border);
  border-color: rgba(var(--color-text-rgb), 0.16);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background: var(--color-paper);
}
summary {
  padding: 16px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 40px;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
  transition: transform 0.2s ease;
}
details[open] summary::after { transform: translateY(-50%) rotate(45deg); content: "+"; }
details > div { padding: 0 16px 16px; color: var(--color-text); }

/* 页头页脚 */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(var(--color-paper-rgb, 247, 245, 243), 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(var(--color-text-rgb), 0.08);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-list { display: flex; gap: 24px; align-items: center; }
.nav-link { font-weight: 500; transition: color 0.2s; }
.nav-link:hover { color: var(--color-brand); }
.nav-link[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 48px 0;
  margin-top: var(--section-y);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; }
.footer a { color: var(--color-accent); transition: opacity 0.2s; }
.footer a:hover { opacity: 0.8; }

/* 上下文颜色覆盖 */
.dark-bg { background-color: var(--color-dark); color: var(--color-paper); }
.dark-bg .text-muted { color: rgba(var(--color-paper-rgb, 247, 245, 243), 0.7); }
.dark-bg .badge { color: var(--color-accent); }
.dark-bg .badge::before { background: var(--color-accent); }
.dark-bg .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.dark-bg table th { background: rgba(var(--color-paper-rgb, 247, 245, 243), 0.08); color: var(--color-paper); }
.dark-bg table td { border-color: rgba(var(--color-paper-rgb, 247, 245, 243), 0.12); color: var(--color-paper); }
.dark-bg details { background: rgba(var(--color-paper-rgb, 247, 245, 243), 0.06); border-color: rgba(var(--color-paper-rgb, 247, 245, 243), 0.12); color: var(--color-paper); }
.dark-bg summary { color: var(--color-paper); }

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow: visible;
}
/* 描边绘制 */
.draw-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-path 6s ease-in-out infinite;
}
@keyframes draw-path {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
/* 呼吸浮动 */
.float-bubble {
  animation: float-bubble 5s ease-in-out infinite;
}
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
/* 打字呼吸点 */
.typing-dot {
  animation: breathe 2.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.4s; }
.typing-dot:nth-child(3) { animation-delay: 0.8s; }
@keyframes breathe {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
/* 节点依次点亮 */
.node-light {
  fill: rgba(var(--color-brand-rgb, 82, 20, 235), 0.2);
  animation: light-node 8s ease-in-out infinite;
}
.node-light:nth-child(odd) { animation-delay: 1s; }
.node-light:nth-child(even) { animation-delay: 2.5s; }
@keyframes light-node {
  0%, 100% { fill: rgba(var(--color-brand-rgb, 82, 20, 235), 0.2); }
  50% { fill: var(--color-accent); }
}
/* 通知滑入 */
.slide-in {
  animation: slide-in 7s ease-in-out infinite;
}
@keyframes slide-in {
  0%, 10% { transform: translateX(20px); opacity: 0; }
  20%, 80% { transform: translateX(0); opacity: 1; }
  90%, 100% { transform: translateX(20px); opacity: 0; }
}
/* 连接线流动 */
.flow-line {
  stroke-dasharray: 4 6;
  animation: dash-flow 2s linear infinite;
}
@keyframes dash-flow {
  to { stroke-dashoffset: -10; }
}

/* 旋转中心修正 */
.rotatable { transform-box: fill-box; transform-origin: center; }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
