/* ============================================================
   bases: 设计令牌 / 重置 / 排版 / 基础控件
   ============================================================ */

:root {
  --spectrum: linear-gradient(112deg, #8b5cff 0%, #5aa7ff 26%, #2ee6d6 52%, #ffc46b 76%, #ff5c9d 100%);
  --spectrum-soft: linear-gradient(112deg, rgba(139, 92, 255, .22), rgba(46, 230, 214, .18), rgba(255, 92, 157, .2));
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --rail-w: 248px;
  --aside-w: 312px;
  --main-w: 660px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Iowan Old Style", "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #07070a;
  --bg-2: #0b0b11;
  --surface: #111118;
  --surface-2: #16161f;
  --surface-3: #1d1d28;
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f3f3f8;
  --text-2: #b9b9cc;
  --dim: #9797ad;
  --faint: #6d6d84;
  --accent: #9b7cff;
  --accent-ink: #0a0714;
  --cyan: #4fe3d4;
  --pink: #ff6fa8;
  --amber: #ffb454;
  --shadow: 0 24px 70px -30px rgba(0, 0, 0, .9), 0 2px 10px -4px rgba(0, 0, 0, .6);
  --glass: rgba(14, 14, 20, .72);
  --scrim: rgba(4, 4, 8, .72);
}

:root[data-theme="light"] {
  --bg: #f4f4f8;
  --bg-2: #ececf3;
  --surface: #ffffff;
  --surface-2: #f7f7fb;
  --surface-3: #efeff6;
  --line: rgba(16, 16, 30, .09);
  --line-2: rgba(16, 16, 30, .16);
  --text: #14141d;
  --text-2: #3d3d4e;
  --dim: #6b6b80;
  --faint: #9a9aae;
  --accent: #6b45f5;
  --accent-ink: #ffffff;
  --cyan: #0f9e94;
  --pink: #e0357c;
  --amber: #b57213;
  --shadow: 0 20px 50px -28px rgba(30, 25, 60, .35), 0 2px 8px -4px rgba(30, 25, 60, .18);
  --glass: rgba(255, 255, 255, .78);
  --scrim: rgba(24, 22, 40, .42);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  /* 固定滚动条占位：否则「有滚动条 / 无滚动条」的页面互相切换时整页会左右跳 5px */
  scrollbar-gutter: stable;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body { min-height: 100dvh; }

h1, h2, h3, h4, p, figure { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

::selection { background: rgba(139, 92, 255, .35); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }

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

/* ---------- 环境光 ---------- */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.ambient__glow {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .26;
}
.ambient__glow--a {
  top: -22vmax;
  left: -14vmax;
  background: radial-gradient(circle at 40% 40%, rgba(124, 92, 255, .55), transparent 60%);
}
.ambient__glow--b {
  right: -20vmax;
  bottom: -26vmax;
  background: radial-gradient(circle at 55% 45%, rgba(46, 230, 214, .34), transparent 62%);
}
:root[data-theme="light"] .ambient__glow { opacity: .22; filter: blur(100px); }
.ambient__grain {
  position: absolute;
  inset: -50%;
  opacity: .085;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
:root[data-theme="light"] .ambient__grain { opacity: .05; }

/* ---------- 启动态 ---------- */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--bg);
  z-index: 90;
  transition: opacity .5s var(--ease), visibility .5s;
}
.boot[hidden] { display: none; }
.boot.is-out { opacity: 0; visibility: hidden; }
.boot__mark {
  width: 60px;
  height: 60px;
  animation: prism-breathe 2.8s var(--ease) infinite;
  filter: drop-shadow(0 12px 30px rgba(91, 124, 255, .45));
}
.boot__mark svg { display: block; width: 100%; height: 100%; }
@keyframes prism-breathe {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: .92; }
  50% { transform: scale(1.06) rotate(8deg); opacity: 1; }
}
.boot__word {
  font-size: 12px;
  letter-spacing: .58em;
  text-indent: .58em;
  color: var(--dim);
  font-family: var(--font-mono);
}
.boot__line {
  width: 132px;
  height: 2px;
  background: var(--line);
  overflow: hidden;
  border-radius: 2px;
}
.boot__line i {
  display: block;
  width: 40%;
  height: 100%;
  background: var(--spectrum);
  animation: prism-slide 1.4s var(--ease) infinite;
}

@keyframes prism-spin {
  0%, 100% { transform: rotate(0) scale(1); }
  50% { transform: rotate(180deg) scale(1.08); }
}
@keyframes prism-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

/* ---------- 排版 ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.24;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--faint);
}
.muted { color: var(--dim); }
.faint { color: var(--faint); }
.mono { font-family: var(--font-mono); }
.grad-text {
  background: var(--spectrum);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.body-text { white-space: pre-wrap; word-break: break-word; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: transform .18s var(--ease), background .2s, border-color .2s, opacity .2s;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }

.btn--primary {
  background: var(--spectrum);
  border: none;
  color: #fff;
  font-weight: 650;
  box-shadow: 0 10px 30px -14px rgba(139, 92, 255, .9);
}
.btn--primary:hover { filter: brightness(1.06); background: var(--spectrum); }
:root[data-theme="light"] .btn--primary { color: #fff; }

.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn--danger { color: #ff6b6b; border-color: rgba(255, 107, 107, .3); }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--dim);
  transition: background .2s, color .2s, transform .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.92); }

/* ---------- 表单 ---------- */
.field { display: block; }
.field__label {
  display: block;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 7px;
  letter-spacing: .02em;
}
.input, .textarea, .select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  transition: border-color .2s, background .2s, box-shadow .2s;
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(155, 124, 255, .55);
  box-shadow: 0 0 0 3px rgba(139, 92, 255, .14);
}
.textarea { resize: vertical; min-height: 92px; line-height: 1.65; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 29px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--text-2);
  transition: all .18s var(--ease);
  white-space: nowrap;
}
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip.is-on {
  background: rgba(139, 92, 255, .16);
  border-color: rgba(139, 92, 255, .5);
  color: var(--text);
}
.chip--sm { height: 25px; font-size: 11.5px; padding: 0 9px; }

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: .02em;
}

.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;
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
