/* SafeW 全站共享样式 */
:root {
  --dark: #271334;
  --paper: #E9E8EA;
  --text: #1D1523;
  --brand: #8A13DD;
  --accent: #9EED6E;
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--text);
  --card-shadow: 4px 4px 0 var(--text);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  --font-body: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.2em; }
li { margin-bottom: 0.5em; }

/* 主题容器 */
.bg-paper { --text-color: var(--text); --accent-color: var(--brand); --bg: var(--paper); }
.bg-dark { --text-color: var(--paper); --accent-color: var(--accent); --bg: var(--dark); }
.bg-paper, .bg-dark { background: var(--bg); color: var(--text-color); }

/* 布局 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-block: var(--section-y); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* 排版 */
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: 0.6em;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: var(--gap);
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
p { max-width: 38em; margin-bottom: 1em; }
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-color);
  margin-bottom: 0.5em;
}
.hl { color: var(--accent-color); font-weight: 600; }
.fact { font-size: 0.9rem; opacity: 0.85; margin-top: 0.5em; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 48px;
  padding: 0 1.5em;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform var(--transition-base), background var(--transition-base), border-color var(--transition-base);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--accent-color); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--dark); }
.btn-secondary { background: transparent; border: 2px solid var(--border-color, var(--text)); color: var(--text-color); }
.bg-dark .btn-secondary { border-color: var(--paper); color: var(--paper); }

/* 卡片与面板 */
.card {
  background: var(--card-bg, var(--paper));
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
  position: relative;
}
.bg-dark .card {
  --card-bg: var(--paper);
  --card-border: 2px solid var(--text);
  --card-shadow: 4px 4px 0 var(--text);
  color: var(--dark);
}
.panel-dark {
  background: var(--dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  color: var(--paper);
}

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 300px; }
th, td { padding: 0.75em 1em; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.3); }
th { font-weight: 600; }
td:first-child { font-weight: 600; }

/* FAQ */
details { margin-bottom: 1em; border-bottom: 1px solid rgba(128,128,128,0.3); padding-bottom: 1em; }
summary { cursor: pointer; font-weight: 600; list-style: none; padding: 0.25em 0; display: flex; align-items: center; gap: 0.5em; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; display: inline-block; width: 1.2em; text-align: center; font-weight: 700; color: var(--accent-color); }
details[open] summary::before { content: "-"; }
details p { margin-top: 0.5em; }

/* 页头页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  backdrop-filter: blur(8px);
}
.bg-dark .site-header { background: var(--dark); border-bottom-color: rgba(255,255,255,0.1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 0.75em; font-weight: 700; font-size: 1.1rem; }
.logo img { width: 28px; height: 28px; }
.nav { display: flex; gap: 1.5em; align-items: center; }
.nav a { font-weight: 500; opacity: 0.85; }
.nav a:hover, .nav a[aria-current="page"] { opacity: 1; text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent-color); }
.site-footer {
  padding: var(--gap) 0;
  border-top: 1px solid rgba(128,128,128,0.2);
  font-size: 0.9rem;
  opacity: 0.8;
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--gap); }

/* SVG 动效 */
.svg-anim { width: 100%; height: auto; }
.anim-float-1 { animation: float1 6s ease-in-out infinite; }
.anim-float-2 { animation: float2 7.5s ease-in-out infinite; }
.anim-float-3 { animation: float3 9s ease-in-out infinite; }
@keyframes float1 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes float2 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes float3 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 5s ease-in-out infinite; }
@keyframes drawLine { 0%, 100% { stroke-dashoffset: 0; } 50% { stroke-dashoffset: 1; } }

.anim-breathe { animation: breathe 3.5s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.anim-slide-in { animation: slideIn 6s ease-in-out infinite; }
@keyframes slideIn { 0%, 100% { transform: translateX(0); opacity: 1; } 85% { transform: translateX(12px); opacity: 1; } 95% { transform: translateX(12px); opacity: 0.5; } }

.transform-center { transform-box: fill-box; transform-origin: center; }

/* 响应式与无障碍 */
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .nav { gap: 1em; }
  .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
