/* ============================================================
   Сброс, типографика, фон страницы, общие примитивы текста.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Фон: едва заметная сетка графика + мягкое свечение сверху.
   Оба слоя статичны — никаких анимаций фона. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 35%, transparent 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 60% 100% at 50% 0%, rgba(120, 140, 200, 0.06), transparent 70%);
}

:root[data-theme="light"] body::before {
  background-image:
    linear-gradient(to right, rgba(27, 30, 38, 0.028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(27, 30, 38, 0.028) 1px, transparent 1px);
}
/* На светлой теме синее свечение делало «белый» голубоватым — оставляем
   почти нейтральное, только чтобы шапка не выглядела приклеенной. */
:root[data-theme="light"] body::after {
  background: radial-gradient(ellipse 60% 100% at 50% 0%, rgba(140, 150, 175, 0.055), transparent 70%);
}

#app, .page { position: relative; z-index: 1; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 30px; letter-spacing: -0.03em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }

img { max-width: 100%; display: block; }

ul, ol { margin: 0 0 10px; padding-left: 20px; }

hr { border: none; border-top: 1px solid var(--border); margin: var(--gap-lg) 0; }

::selection { background: var(--text); color: var(--bg); }

/* --- Утилиты текста --- */
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.win { color: var(--win); }
.loss { color: var(--loss); }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-md);
  margin-bottom: var(--gap-md);
}

/* Только для скринридера: подписи и живые области, которые не должны
   занимать место на экране, но обязаны быть озвучены */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Полосы прокрутки --- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 3px solid var(--bg); }

/* --- Фокус: видимый, но не уродливый --- */
:focus-visible { outline: 2px solid var(--text-dim); outline-offset: 2px; border-radius: var(--r-sm); }
:focus:not(:focus-visible) { outline: none; }

/* --- Уважаем системную настройку «меньше движения» --- */
@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;
  }
}
