*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body { overflow: hidden; }

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

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

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

h1, h2, h3, p { margin: 0; }

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

[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--sm { width: 18px; height: 18px; }
.icon--lg { width: 32px; height: 32px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Оболочка: на широком экране — колонка по центру */
#app {
  position: relative;
  height: 100dvh;
  max-width: var(--app-width);
  margin: 0 auto;
  overflow: hidden;
  /* clip, а не только hidden: иначе фокус в поле прокручивает #app и из-под низа выезжает спрятанный таб-бар */
  overflow: clip;
  background: var(--bg);
}

.screens { position: absolute; inset: 0; overflow: clip; }

.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 24px);
}
.screen--with-tabbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px); }
.screen--with-fab { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--fab) + 32px); }

.screen__body { padding: 0 var(--gutter); }

/* Переходы между экранами */
.screen.is-entering-forward { animation: screen-in-right var(--dur) var(--ease-out) both; z-index: 2; }
.screen.is-leaving-back { animation: screen-out-right var(--dur) var(--ease-out) both; z-index: 2; }
.screen.is-covered { animation: screen-push-left var(--dur) var(--ease-out) both; }
.screen.is-uncovered { animation: screen-pop-left var(--dur) var(--ease-out) both; }
.screen.is-fading-in { animation: screen-fade var(--dur) ease both; }

@keyframes screen-in-right { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes screen-out-right { from { transform: translateX(0); } to { transform: translateX(100%); } }
@keyframes screen-push-left { from { transform: translateX(0); } to { transform: translateX(-20%); } }
@keyframes screen-pop-left { from { transform: translateX(-20%); } to { transform: translateX(0); } }
@keyframes screen-fade { from { opacity: 0; } to { opacity: 1; } }
