/* ============================================================================
 *  ФормулаЦТ — база, лейаут, типографика
 * ==========================================================================*/
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--fg);
  background: var(--bg);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--brand); text-decoration: none; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.15em; }
::selection { background: var(--brand-100); }

/* ------------------------------ ЗАГРУЗКА --------------------------------- */
.boot {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2);
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-700) 100%);
  color: #fff;
}
.boot__logo { font-size: 62px; animation: bootFloat 1.6s ease-in-out infinite; }
.boot__title { font-size: 30px; font-weight: 900; letter-spacing: .5px; }
.boot__sub { opacity: .82; font-weight: 600; font-size: 14px; }
.boot__bar { width: 140px; height: 5px; border-radius: 99px; background: rgba(255,255,255,.28); overflow: hidden; margin-top: var(--sp-4); }
.boot__bar i { display: block; height: 100%; width: 40%; border-radius: 99px; background: #fff; animation: bootBar 1.1s ease-in-out infinite; }
@keyframes bootBar { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
@keyframes bootFloat { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
.boot--out { opacity: 0; pointer-events: none; transition: opacity .35s ease; }

/* ------------------------------- ЛЕЙАУТ ---------------------------------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  padding-top: var(--safe-top);
  height: calc(var(--topbar-h) + var(--safe-top));
  display: flex; align-items: center; gap: var(--sp-3);
  padding-inline: var(--sp-4);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t);
}
.topbar--scrolled { border-bottom-color: var(--line); }
.screen {
  flex: 1;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bot) + var(--sp-6));
  outline: none;
  animation: screenIn .26s cubic-bezier(.4,0,.2,1);
}
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.screen--flush { padding-bottom: 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  height: calc(var(--tabbar-h) + var(--safe-bot));
  padding-bottom: var(--safe-bot);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--fg-3); font-size: 11px; font-weight: 700; letter-spacing: .2px;
  transition: color var(--t-fast), transform var(--t-fast);
}
.tabbar__item svg { width: 25px; height: 25px; }
.tabbar__item.is-active { color: var(--brand); }
.tabbar__item.is-active svg { transform: translateY(-2px) scale(1.06); }
.tabbar__item:active { transform: scale(.94); }
.tabbar__badge {
  position: absolute; transform: translate(15px, -12px);
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: var(--err); color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--surface);
}

.wrap { width: 100%; max-width: 780px; margin: 0 auto; padding-inline: var(--sp-4); }
.wrap--wide { max-width: 1020px; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ----------------------------- ТИПОГРАФИКА ------------------------------- */
.t-h1 { font-size: 26px; font-weight: 900; letter-spacing: -.4px; line-height: 1.2; }
.t-h2 { font-size: 20px; font-weight: 800; letter-spacing: -.2px; }
.t-h3 { font-size: 16px; font-weight: 800; }
.t-body { font-size: 15px; color: var(--fg-2); }
.t-small { font-size: 13px; color: var(--fg-2); }
.t-tiny { font-size: 11px; color: var(--fg-3); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.t-mono { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.t-ok { color: var(--ok-600); } .t-err { color: var(--err-600); } .t-brand { color: var(--brand); }
.t-muted { color: var(--fg-3); }
strong { font-weight: 800; }

/* ------------------------------ МОБИЛЬНЫЙ -------------------------------- */
@media (min-width: 900px) {
  .screen { padding-bottom: var(--sp-8); }
  .tabbar {
    position: sticky; top: auto; bottom: var(--sp-5);
    width: max-content; margin: 0 auto var(--sp-5);
    grid-auto-columns: 96px; gap: var(--sp-1);
    border: 1px solid var(--line); border-radius: var(--r-pill);
    padding: 6px; height: auto; box-shadow: var(--sh-2);
  }
  .tabbar__item { padding: 6px 10px; border-radius: var(--r-pill); }
  .tabbar__item.is-active { background: var(--brand-100); }
}
