/* Базовые стили: сброс, фон со сферами и грейном, типографика, раскладка. */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-text);
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
img,
svg {
  display: block;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ─── фон: размытые сферы (bloom) ─── */
.bloom {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  mix-blend-mode: var(--blend);
  opacity: var(--o);
  animation: br 12s ease-in-out infinite;
  will-change: transform;
}
.o1 {
  width: 70vmax;
  height: 70vmax;
  left: -28vmax;
  top: -26vmax;
  background: var(--b1);
}
.o2 {
  width: 56vmax;
  height: 56vmax;
  right: -24vmax;
  top: 26vh;
  background: var(--b2);
  animation-duration: 15s;
  animation-delay: -5s;
}
.o3 {
  width: 52vmax;
  height: 52vmax;
  left: 4vw;
  bottom: -30vmax;
  background: var(--b3);
  animation-duration: 18s;
  animation-delay: -9s;
}
@keyframes br {
  0%,
  100% {
    transform: scale(1) translate3d(0, 0, 0);
  }
  50% {
    transform: scale(1.14) translate3d(2vmax, 1.5vmax, 0);
  }
}

/* лёгкий шум-грейн поверх всего */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
}

/* ─── раскладка ─── */
#app {
  position: relative;
  z-index: 1;
}
.wrap {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--s3) + var(--safe-t)) var(--page-pad) calc(var(--dock-h) + 40px + var(--safe-b));
}
.bar-space {
  height: 88px;
}
.wrap.has-bar {
  padding-bottom: calc(var(--dock-h) + 120px + var(--safe-b));
}
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  animation: in 0.45s var(--ease) both;
}
@keyframes in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* ─── типографика ─── */
h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 450;
  letter-spacing: -0.025em;
}
h1 {
  font-size: clamp(26px, 7vw, 32px);
  line-height: 1.1;
}
h2 {
  font-size: var(--fs-lg);
  line-height: 1.25;
}
h3 {
  font-size: 16px;
  line-height: 1.3;
}
p {
  margin: 0;
}
.num {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  font-weight: 500;
}
.tnum {
  font-variant-numeric: tabular-nums;
}
.mut {
  color: var(--mut);
}
.small {
  font-size: 14px;
  line-height: 1.45;
}
.tiny {
  font-size: 12.5px;
  line-height: 1.4;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mut);
  font-size: 13.5px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--b1);
  box-shadow: 0 0 14px var(--b1);
  flex: none;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row.wrap-ok {
  flex-wrap: wrap;
}
.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stack {
  display: grid;
  gap: 10px;
}
.stack-sm {
  display: grid;
  gap: 6px;
}
.stack-xs {
  display: grid;
  gap: var(--s1);
}
.grow {
  flex: 1 1 auto;
  min-width: 0;
}
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clamp2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.center {
  text-align: center;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ─── режим тренировки: меньше blur и анимаций ради батареи и контраста ─── */
body.training .orb {
  animation: none;
  filter: blur(60px);
}
body.training::after {
  opacity: 0.035;
}
body.training .page {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ─── экран загрузки ─── */
.boot-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--s4);
  padding: var(--s6);
}
.boot-logo {
  width: 76px;
  height: 76px;
  border-radius: var(--r-lg);
  box-shadow: 0 12px 36px var(--shade-2), 0 0 48px var(--glow);
  animation: boot-pulse 1.8s var(--ease) infinite;
}
.boot-name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.boot-bar {
  position: relative;
  width: 120px;
  height: 4px;
  border-radius: var(--pill);
  background: var(--hair-2);
  overflow: hidden;
}
.boot-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: inherit;
  background: var(--accent);
  animation: boot-slide 1.2s var(--ease) infinite;
}
.boot-legal {
  display: flex;
  gap: var(--s4);
  margin-top: var(--s4);
  font-size: 13px;
}
.boot-legal a {
  color: var(--mut);
  text-decoration: underline;
  padding: var(--s2);
}
@keyframes boot-pulse {
  50% {
    transform: scale(0.96);
    opacity: 0.86;
  }
}
@keyframes boot-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

/* ─── 404 ─── */
.nf {
  min-height: 70vh;
  display: grid;
  place-content: center;
}
.nf-card {
  display: grid;
  gap: var(--s3);
  justify-items: start;
  max-width: 420px;
}
.nf-code {
  font-family: var(--font-display);
  font-size: clamp(72px, 26vw, 112px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--accent), var(--ink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@media (prefers-reduced-motion: reduce) {
  .boot-logo,
  .boot-bar i {
    animation: none;
  }
}

