/* ────────────────────────────────────────────────
   Design tokens & reset — shared by login + app
   ──────────────────────────────────────────────── */

:root {
  --bg: #F5F5F7;
  --bg-deep: #EDEDF0;
  --surface: #FFFFFF;
  --surface-2: #FAFAFC;
  --surface-3: #F2F2F5;
  --text: #1D1D1F;
  --text-2: #6E6E73;
  --text-3: #8E8E93;
  --line: rgba(0, 0, 0, 0.07);
  --line-strong: rgba(0, 0, 0, 0.13);
  --field: rgba(0, 0, 0, 0.035);
  --primary: #0071E3;
  --primary-hover: #0062C4;
  --green: #30D158;
  --orange: #FF9F0A;
  --red: #FF453A;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 34px rgba(0, 0, 0, 0.09);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.13);
  --glow: rgba(0, 113, 227, 0.16);
  --noise-opacity: 0.028;
  --grid-opacity: 0.22;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #08080A;
  --bg-deep: #050506;
  --surface: #121215;
  --surface-2: #17171B;
  --surface-3: #1C1C21;
  --text: #EDEDEF;
  --text-2: #9C9CA3;
  --text-3: #8A8A92;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.16);
  --field: rgba(255, 255, 255, 0.045);
  --primary: #0A84FF;
  --primary-hover: #2E97FF;
  --shadow-sm: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.65);
  --glow: rgba(58, 130, 255, 0.3);
  --noise-opacity: 0.045;
  --grid-opacity: 0.55;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
}

button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

::selection { background: color-mix(in srgb, var(--primary) 22%, transparent); }

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 99px;
  background: var(--line-strong);
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }

:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 70%, transparent);
  outline-offset: 2px;
}

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

/* 极细噪点 + 网格，用于提升大面积暗色底板的质感 */
.texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.texture::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.texture::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: var(--grid-opacity);
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 10%, transparent 72%);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .glass { backdrop-filter: none !important; background: var(--surface) !important; }
}
