/* ==========================================================
   base.css — основа: сброс стилей, шрифт, "телефон" на странице
   Цвета здесь НЕ задаём — они берутся из themes.css (переменные)
   ========================================================== */

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

html,
body {
  height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
}

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

svg.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------- "Телефон" ----------
   На телефоне приложение занимает весь экран.
   На компьютере — рисуем рамку 430x860 по центру. */
#app {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  transition: background 0.3s ease;
}

@media (min-width: 600px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
  }

  #app {
    height: min(860px, calc(100vh - 32px));
    border-radius: 36px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-phone);
  }
}

/* Прокручиваемая область с экраном */
.screen-host {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Плавное появление экрана при переходе */
.screen {
  animation: screen-in 0.25s ease;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Обновление экрана на месте (после клика) — без повторной анимации */
.screen.no-anim {
  animation: none;
}

/* Экран без внутренних отступов и собственной прокруткой (чат) */
.screen-host.flush {
  padding: 0;
  overflow: hidden;
}

.screen-host.flush .screen {
  height: 100%;
}

/* Уважаем настройку "уменьшить анимации" в системе */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
