/* ============ 基础 · 设计变量 ============ */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --accent: #4c7dff;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --ease-spring: cubic-bezier(.2, .9, .25, 1.08);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --bar-h: 50px;
  --menubar-h: 28px;
}

[data-theme="light"] {
  --text: #1b1c22;
  --text-2: rgba(27, 28, 34, .64);
  --text-3: rgba(27, 28, 34, .40);
  --line: rgba(0, 0, 0, .08);
  --line-2: rgba(0, 0, 0, .14);
  --surface: rgba(250, 250, 253, .80);
  --surface-solid: #f6f6f9;
  --card: rgba(255, 255, 255, .62);
  --card-hover: rgba(255, 255, 255, .9);
  --side-bg: rgba(236, 237, 244, .62);
  --hover: rgba(0, 0, 0, .05);
  --glass-bg: rgba(255, 255, 255, .30);
  --glass-bg-strong: rgba(250, 250, 253, .66);
  --glass-hi: rgba(255, 255, 255, .85);
  --glass-lo: rgba(255, 255, 255, .22);
  --glass-shadow: 0 10px 34px rgba(16, 22, 60, .18);
  --win-shadow: 0 34px 90px -12px rgba(12, 18, 50, .42), 0 10px 26px rgba(12, 18, 50, .14);
  --win-edge: rgba(255, 255, 255, .7);
  color-scheme: light;
}

[data-theme="dark"] {
  --text: #f2f3f8;
  --text-2: rgba(242, 243, 248, .64);
  --text-3: rgba(242, 243, 248, .38);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --surface: rgba(28, 29, 37, .78);
  --surface-solid: #1c1d25;
  --card: rgba(255, 255, 255, .055);
  --card-hover: rgba(255, 255, 255, .1);
  --side-bg: rgba(255, 255, 255, .05);
  --hover: rgba(255, 255, 255, .07);
  --glass-bg: rgba(24, 26, 38, .26);
  --glass-bg-strong: rgba(30, 32, 42, .62);
  --glass-hi: rgba(255, 255, 255, .42);
  --glass-lo: rgba(255, 255, 255, .08);
  --glass-shadow: 0 12px 38px rgba(0, 0, 0, .4);
  --win-shadow: 0 34px 90px -12px rgba(0, 0, 0, .7), 0 10px 26px rgba(0, 0, 0, .35);
  --win-edge: rgba(255, 255, 255, .16);
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: #05060b;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: default; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

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

.selectable, .selectable * { user-select: text; -webkit-user-select: text; }

.glyph { width: 1em; height: 1em; flex: none; display: block; }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* 壁纸 */
#wallpaper { position: fixed; inset: 0; overflow: hidden; z-index: 0; background: #0b1026; }
#wallpaper canvas {
  position: absolute; inset: -6%;
  width: 112%; height: 112%;
  filter: blur(28px) saturate(1.15);
  transition: opacity 1.2s ease;
}
#wallpaper .wp-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
#wallpaper .wp-lines g { animation: wp-drift 36s ease-in-out infinite alternate; transform-origin: center; }
#wallpaper .wp-lines g:nth-child(2) { animation-duration: 48s; animation-direction: alternate-reverse; }
@keyframes wp-drift {
  from { transform: translate3d(-2%, -1.5%, 0) rotate(-1deg); }
  to   { transform: translate3d(2%, 2%, 0) rotate(1.2deg); }
}
#wallpaper .wp-veil { position: absolute; inset: 0; transition: background .6s; }
[data-theme="light"] #wallpaper .wp-veil { background: rgba(255, 255, 255, .08); }
[data-theme="dark"] #wallpaper .wp-veil { background: rgba(0, 0, 0, .22); }
#wallpaper .wp-grain {
  position: absolute; inset: 0; opacity: .14; mix-blend-mode: overlay;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#dim { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 5000; transition: opacity .2s; }

/* 减少动效 */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}
@media (prefers-reduced-motion: reduce) {
  #wallpaper .wp-lines g { animation: none; }
}
