/* css/base.css — База: сброс, типографика body, каркас .screen/.screen-header, общее приложение. Владелец — В1.
   Вынесено из styles.css (Дизайн v2, пакет В1); порядок подключения — index.html. */

/* ---------- база ---------- */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

button {
  font: inherit;
  color: inherit;
}

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

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

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

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

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

.noscript-note,
.app-loading,
.app-fatal {
  padding: 3rem 1.25rem;
  text-align: center;
  color: var(--muted);
}

/* ---------- каркас экрана ---------- */

.screen {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px calc(32px + env(safe-area-inset-bottom, 0px));
  animation: screen-in 0.22s ease-out both;
}

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

.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  margin-bottom: 12px;
}

.screen-header .back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  flex: none;
  border-radius: var(--radius-sm);
  color: var(--ink);
}

.screen-header .back-btn:hover {
  background: var(--surface-2);
}

.screen-header-titles {
  flex: 1;
  min-width: 0;
}

.screen-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
}

.screen-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 2px;
}

.screen-header-right {
  flex: none;
}

.icon {
  display: inline-flex;
  width: 1.35em;
  height: 1.35em;
}

.icon svg {
  width: 100%;
  height: 100%;
}

/* ---------- брейкпоинты (только раскладка, не кегль) ---------- */

@media (min-width: 768px) {
  .screen {
    padding-top: 32px;
  }
}

.update-pill {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--bp-accent);
  color: var(--bp-on-accent);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  box-shadow: var(--bp-shadow-2);
  cursor: pointer;
}
.update-pill:hover { filter: brightness(1.05); }

/* Кнопка-домик в шапке промежуточных экранов */
.screen-header .home-btn { margin-right: 2px; }

/* ============================================================
   V1 — визуальная доработка 23.09.2026 (заказчик: «шрифты маленькие,
   а свободного места гигантское количество»). Слой поверх правил выше:
   текучая типографика (--fs-*), сетка 960–1200px вместо телефонной
   колонки 640px, одна система кнопок. Страница учебника (.book-shelf)
   сюда не входит — у неё своя раскладка (пакет V2).
   ============================================================ */

/* ---------- каркас ---------- */
.screen {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  padding: clamp(16px, 2.2vw, 36px) var(--gutter) calc(40px + env(safe-area-inset-bottom, 0px));
}

.settings-screen,
.login-screen,
.errors-screen,
.errors-drill-screen,
.en-words-screen,
.en-read-screen,
.debug-screen {
  max-width: calc(var(--wrap-read) + 2 * var(--gutter));
}


.screen-header {
  gap: 4px;
  min-height: 56px;
  margin-bottom: clamp(14px, 1.8vw, 28px);
}

.screen-header .icon-btn {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  color: var(--ink);
}

.screen-header .icon-btn .icon {
  width: 28px;
  height: 28px;
}

.screen-header .home-btn {
  margin-right: 0;
}

.screen-header-titles {
  padding-left: 8px;
}

.screen-title {
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: 1.15;
}

.screen-subtitle {
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-top: 4px;
}
