:root {
  --bg-dark: #231334;
  --bg-paper: #F5F3F7;
  --text-body: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background-color: var(--bg-paper);
  color: var(--text-body);
  line-height: 1.75;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 主题容器 */
.theme-paper { background-color: var(--bg-paper); color: var(--text-body); }
.theme-paper .hl, .theme-paper .badge { color: var(--color-brand); }
.theme-paper .btn-secondary { border-color: var(--text-body); color: var(--text-body); }

.theme-dark { background-color: var(--bg-dark); color: var(--bg-paper); }
.theme-dark .hl, .theme-dark .badge { color: var(--color-accent); }
.theme-dark .btn-secondary { border-color: var(--bg-paper); color: var(--bg-paper); }
.theme-dark .card { background-color: rgba(255,255,255,0.06); color: var(--bg-paper); }
.theme-dark .card .hl, .theme-dark .card .badge { color: var(--color-brand); }
.theme-dark .btn-primary { background-color: var(--color-accent); color: var(--bg-dark); }

/* 布局与排版 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-top: var(--section-y); padding-bottom: var(--section-y); }

h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
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: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: calc(var(--gap) / 2); }
p { margin-bottom: var(--gap); max-width: 38em; }
.badge { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 0.5rem; display: inline-block; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  height: 52px; padding: 0 24px; border-radius: var(--radius-btn); font-weight: 600; font-size: 1rem; cursor: pointer; transition: transform 0.2s ease, background 0.2s ease;
}
.btn-primary { background-color: var(--color-accent); color: var(--bg-dark); }
.btn-primary:hover { transform: translateY(-2px); background-color: #f0d88a; }
.btn-secondary { border: 2px solid var(--text-body); color: var(--text-body); background: transparent; }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* 卡片与面板 */
.card {
  background-color: rgba(0,0,0,0.03);
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}
.panel {
  background-color: var(--bg-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  width: 100%; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center;
}
.theme-light-panel { background-color: var(--bg-dark); }
.theme-dark-panel { background-color: rgba(255,255,255,0.05); }

/* 网格与弹性布局 */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.flex-row.reverse { direction: rtl; }
.flex-row.reverse > * { direction: ltr; }

/* 表格 */
table { width: 100%; border-collapse: collapse; margin-bottom: var(--gap); }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid currentColor; opacity: 0.85; }
th { font-weight: 700; }
.theme-dark th, .theme-dark td { border-color: rgba(255,255,255,0.2); }

/* FAQ */
details { margin-bottom: 16px; border-radius: var(--radius-card); overflow: hidden; }
.theme-paper details { background: rgba(0,0,0,0.03); }
.theme-dark details { background: rgba(255,255,255,0.05); }
summary { padding: 16px 24px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; font-size: 1.2em; }
details[open] summary::after { content: '−'; }
details > div { padding: 0 24px 24px; }

/* 导航与页脚 */
header { position: sticky; top: 0; z-index: 100; background: var(--bg-paper); border-bottom: 1px solid rgba(0,0,0,0.1); }
.theme-dark header { background: var(--bg-dark); border-color: rgba(255,255,255,0.1); }
.nav-container { display: flex; justify-content: space-between; align-items: center; height: 64px; }
nav a { margin-left: 24px; font-weight: 500; opacity: 0.8; transition: opacity 0.2s; }
nav a:hover, nav a[aria-current="page"] { opacity: 1; }
.theme-paper nav a[aria-current="page"], .theme-paper nav a:hover { color: var(--color-brand); }
.theme-dark nav a[aria-current="page"], .theme-dark nav a:hover { color: var(--color-accent); }

/* 移动端折叠导航 */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.menu-toggle svg { width: 24px; height: 24px; stroke: currentColor; }
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-paper);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 16px;
    display: none;
    flex-direction: column;
    gap: 16px;
    z-index: 99;
  }
  .theme-dark nav { background: var(--bg-dark); border-color: rgba(255,255,255,0.1); }
  nav.open { display: flex; }
  nav a { margin-left: 0; }
}
footer { padding: 48px 0; border-top: 1px solid rgba(0,0,0,0.1); text-align: center; font-size: 0.9rem; opacity: 0.8; }
.theme-dark footer { border-color: rgba(255,255,255,0.1); }

/* SVG 动效 */
.svg-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes draw-in { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
@keyframes breathe { 0%, 100% { opacity: 0.7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.02); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }

.anim-draw { animation: draw-in 3s ease forwards; }
.anim-breathe { animation: breathe 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float { animation: float 5s ease-in-out infinite; }
.anim-slide { animation: slide-in 1.5s ease forwards; }
.delay-1 { animation-delay: 0.4s; }
.delay-2 { animation-delay: 0.8s; }
.delay-3 { animation-delay: 1.2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .anim-draw, .anim-breathe, .anim-float, .anim-slide { animation: none !important; }
}
/* factory-contrast-width */
@media (max-width: 390px) {
  [data-fc-390="paper"] {
    color: #f5f3f7 !important;
    -webkit-text-fill-color: #f5f3f7 !important;
  }
}
