/* ==========================================================================
   基础层：设计令牌 / 重置 / 排版 / 按钮 / 表单 / 动效
   前台与后台共用，保证风格一致
   ========================================================================== */

:root {
  /* 主色（可通过后台切换 data-accent 切换整套配色） */
  --accent-1: #7c6cff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(124, 108, 255, .16);

  /* 背景与表面 */
  --bg: #06070b;
  --bg-elevated: #0b0d14;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .06);
  --surface-3: rgba(255, 255, 255, .09);

  /* 描边 */
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .18);

  /* 文字 */
  --text: #eceef5;
  --text-dim: #a4abc1;
  --text-mute: #6d748d;

  /* 语义色 */
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;

  /* 尺寸与节奏 */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --wrap: 1140px;
  --gutter: clamp(20px, 5vw, 40px);
  --section-y: clamp(64px, 8.5vw, 124px);

  /* 缓动 */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  --shadow-card: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 24px 60px -32px rgba(0, 0, 0, .9);
  --shadow-glow: 0 18px 50px -18px var(--accent-soft);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-accent="cyan"]    { --accent-1: #22d3ee; --accent-2: #4f7cff; --accent-soft: rgba(34, 211, 238, .16); }
html[data-accent="amber"]   { --accent-1: #f5a524; --accent-2: #f87171; --accent-soft: rgba(245, 165, 36, .16); }
html[data-accent="rose"]    { --accent-1: #f472b6; --accent-2: #a855f7; --accent-soft: rgba(244, 114, 182, .16); }
html[data-accent="emerald"] { --accent-1: #34d399; --accent-2: #22d3ee; --accent-soft: rgba(52, 211, 153, .16); }

/* ---------- 重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }
strong { font-weight: 600; }
code { font-family: var(--mono); font-size: .9em; }

::selection { background: var(--accent-1); color: #05060a; }

:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 3px;
  border-radius: 6px;
}

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .16) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .14);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .26); background-clip: content-box; }

/* ---------- 版心与排版 ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.muted { color: var(--text-mute); }
.text-dim { color: var(--text-dim); }

.section { padding: var(--section-y) 0; position: relative; }
.section + .section::before {
  content: "";
  position: absolute;
  inset-inline: var(--gutter);
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.section-head { max-width: 720px; margin-bottom: clamp(36px, 5vw, 64px); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent-1);
  margin-bottom: 18px;
}
.eyebrow i {
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: .6;
}

.section-title {
  font-size: clamp(28px, 4.4vw, 46px);
  line-height: 1.15;
  letter-spacing: -.02em;
  font-weight: 650;
}

.section-lede {
  margin-top: 20px;
  color: var(--text-dim);
  font-size: clamp(15px, 1.6vw, 17px);
  max-width: 60ch;
}

/* 富文本 / Markdown 输出 */
.prose { color: var(--text-dim); max-width: 68ch; }
.prose > * + * { margin-top: 1.1em; }
.prose h2, .prose h3, .prose h4 { color: var(--text); letter-spacing: -.01em; margin-top: 2em; }
.prose h2 { font-size: 24px; }
.prose h3 { font-size: 19px; }
.prose strong { color: var(--text); }
.prose a { color: var(--accent-1); text-decoration: underline; text-underline-offset: 3px; }
.prose ul { list-style: none; padding-left: 0; }
.prose li { position: relative; padding-left: 22px; margin-top: .5em; }
.prose li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-1);
  opacity: .8;
}
.prose code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

/* ---------- 按钮 ---------- */
.btn {
  --btn-bg: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .25s var(--ease-out), border-color .25s, background .25s, box-shadow .3s, opacity .2s;
}
.btn:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .3); }
.btn:active { transform: translateY(0) scale(.985); }
.btn svg { transition: transform .3s var(--ease-out); }
.btn:hover svg { transform: translateX(3px); }

.btn-primary {
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent-1), var(--accent-2));
  color: #06070b;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { box-shadow: 0 22px 60px -18px var(--accent-1); }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

.btn-sm { padding: 9px 16px; font-size: 13px; }
.btn-block { width: 100%; }

.btn-danger { border-color: rgba(248, 113, 113, .35); color: #ffb4b4; }
.btn-danger:hover { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .6); }

.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.field-hint { font-size: 12px; color: var(--text-mute); margin-top: 6px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 6px; }

.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--line-strong); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent-1);
  background: rgba(255, 255, 255, .05);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.select { appearance: none; background-image: none; cursor: pointer; }
.select option { background: var(--bg-elevated); color: var(--text); }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
}
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent-1); cursor: pointer; }

/* ---------- 动效基类 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* 屏幕阅读器专用 */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
