/* База: сброс, типографика, каркас приложения. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* В Telegram скроллим #app, а не документ: pull-down не закрывает Mini App. */
html.is-telegram,
html.is-telegram body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html.is-telegram #app {
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* Мягкие синие свечения на весь экран; position: fixed — фон не едет при скролле. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 0% 0%, rgba(10, 82, 196, 0.5) 0%, transparent 32%),
    radial-gradient(ellipse 80% 45% at 90% 75%, rgba(0, 87, 217, 0.4) 0%, rgba(0, 60, 160, 0.18) 40%, transparent 70%),
    #02040c;
}

body.preview {
  background: var(--bg-base);
}

img {
  display: block;
  max-width: 100%;
}

/* Иконочные кнопки и чипы не должны тащить системный вид. */
button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

h1,
h2,
h3,
p,
dl,
dd,
dt,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

svg {
  display: block;
}

/* Мобильный каркас: на широком экране приложение остаётся колонкой 430px. */
#app {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin-inline: auto;
  /* Контейнер прозрачный, чтобы был виден фиксированный фон body::before. */
  background: transparent;
  overflow-x: clip;
}

@media (min-width: 480px) {
  #app {
    box-shadow: 0 0 0 1px var(--border), var(--shadow);
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

[hidden] {
  display: none !important;
}

.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;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
