/* 基础重置与排版 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.47;
  letter-spacing: 0;
  color: var(--text);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.home-page,
.console-mode .app,
.docs-page {
  isolation: isolate;
}

.home-page::before,
.console-mode .app::before,
.docs-page::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: -160px;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(165 197 247 / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(165 197 247 / 0.035) 1px, transparent 1px),
    linear-gradient(rgb(var(--accent-rgb) / 0.065) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--accent-rgb) / 0.065) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px, 192px 192px, 192px 192px;
  animation: ambient-grid-drift 32s linear infinite;
  will-change: transform;
}

.home-page > *,
.console-mode .app > .console-card,
.docs-page > * {
  position: relative;
  z-index: 1;
}

@keyframes ambient-grid-drift {
  to { transform: translate3d(192px, 192px, 0); }
}

::selection {
  color: var(--text);
  background: rgb(var(--accent-rgb) / 0.28);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: none;
  margin: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: none;
}

button:focus-visible {
  box-shadow: var(--focus) !important;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:focus-visible {
  outline: none;
  border-radius: 6px;
  box-shadow: var(--focus);
}

img {
  max-width: 100%;
  display: block;
}

input,
textarea,
select {
  accent-color: var(--accent);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--surface-2) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: var(--w-bold);
  letter-spacing: 0;
  color: var(--text);
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
  font-weight: 650;
}

h3 {
  font-size: 15px;
  line-height: 1.3;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.faint {
  color: var(--faint);
  font-size: 12px;
  line-height: 1.45;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}
.row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.stat-value-md {
  font-size: 16px !important;
}

.text-err { color: #ffb0a6; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .home-page::before,
  .console-mode .app::before,
  .docs-page::before {
    animation: none !important;
    will-change: auto;
  }
}
