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

html {
  background: var(--bg-deep);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  position: relative;
  width: min(100%, 480px);
  height: 100vh;
  height: 100dvh;
  margin-inline: auto;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--text); }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.7); outline-offset: 2px; border-radius: var(--r-xs); }

.ambient { display: none; }

.app {
  position: absolute;
  inset: var(--top) 0 0 0;
  z-index: 1;
}

.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; }
.icon use { pointer-events: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* макет «окна Telegram» для запуска в обычном браузере */
.devframe {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--devframe-h);
  z-index: calc(var(--z-overlay) + 20);
  display: flex;
  align-items: center;
  padding: 0 6px;
  background: #121213;
  border-bottom: 1px solid var(--line);
}
.devframe__title { flex: 1; font-weight: 600; font-size: 16px; padding-left: 10px; }
.devframe__btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-pill); color: var(--text-2); }
.devframe__btn:hover { background: rgba(255, 255, 255, 0.06); }
.devframe__btn .icon { width: 22px; height: 22px; }
.devframe__btn:first-child[hidden] + .devframe__title { padding-left: 14px; }

/* загрузка */
.boot { height: 100%; display: grid; place-items: center; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--text);
  animation: spin 0.8s linear infinite;
}
.spinner--lg { width: 34px; height: 34px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* уведомления */
.toasts {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--dock-h) + 14px);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  padding: 0 var(--gutter);
}
.toast {
  max-width: 100%;
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: #232325;
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 12px 30px rgba(0, 0, 0, 0.5);
  font-size: 14px; font-weight: 600;
  opacity: 0; transform: translateY(10px) scale(0.96);
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease-spring);
}
.toast.is-in { opacity: 1; transform: none; }
.toast--warn { color: var(--warn); }
.toast--error { color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
