/* ============================================================
   Meu Português — дизайн-система «тёплый современный бразильский город»
   Палитра из style bible. Светлая/тёмная тема, safe areas, a11y.
   ============================================================ */

:root {
  --verde: #176B55;
  --verde-txt: #176B55;   /* зелёный для текста; в тёмной теме — светлее */
  --coral-txt: #B0402F;   /* коралловый для текста (контраст ≥ 4,5:1) */
  --turquesa: #20A58A;
  --sol: #F6C84C;
  --coral: #EF7465;
  --ceu: #67B8D8;
  --fundo: #FFF9EF;
  --texto: #20312D;
  --cartao: #FFFFFF;

  --texto-2: #5C6B66;
  --linha: #E8E0D0;
  --verde-suave: #E3F2EC;
  --sol-suave: #FCF0D2;
  --coral-suave: #FCE4E0;
  --ceu-suave: #E4F2F8;
  --sombra: 0 2px 10px rgba(32, 49, 45, 0.08);
  --sombra-up: 0 -2px 12px rgba(32, 49, 45, 0.07);

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 10px;

  --fs-base: 16px;
  --tap: 48px;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;   /* нативные чекбоксы, поле даты и полосы прокрутки — в тон теме */
}

:root[data-theme="dark"] {
  color-scheme: dark;   /* было: белые чекбоксы и почти невидимый значок календаря на тёмном фоне */
  --verde-txt: #7FD8BE;
  --coral-txt: #FF9A8B;
  --fundo: #14201C;
  --texto: #F0EFE6;
  --texto-2: #A3B3AC;
  --cartao: #1D2C27;
  --linha: #2C3E38;
  --verde-suave: #1B3A30;
  --sol-suave: #3A331A;
  --coral-suave: #3C2622;
  --ceu-suave: #1D3340;
  --sombra: 0 2px 10px rgba(0, 0, 0, 0.35);
  --sombra-up: 0 -2px 12px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --verde-txt: #7FD8BE;
    --coral-txt: #FF9A8B;
    --fundo: #14201C;
    --texto: #F0EFE6;
    --texto-2: #A3B3AC;
    --cartao: #1D2C27;
    --linha: #2C3E38;
    --verde-suave: #1B3A30;
    --sol-suave: #3A331A;
    --coral-suave: #3C2622;
    --ceu-suave: #1D3340;
    --sombra: 0 2px 10px rgba(0, 0, 0, 0.35);
    --sombra-up: 0 -2px 12px rgba(0, 0, 0, 0.3);
  }
}

:root[data-textsize="large"] { --fs-base: 19px; }
:root[data-textsize="xlarge"] { --fs-base: 22px; }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { font-size: var(--fs-base); }
/* фокус с клавиатуры не прячется под нижней панелью вкладок: браузер докручивает с запасом на её высоту
   (было: «Карта звуков» закрыта на 67 %, узлы «Пути» — на 60–80 %). На ПК панель сбоку — запас не нужен */
html { scroll-padding-bottom: calc(76px + var(--sab)); }
@media (min-width: 960px) { html { scroll-padding-bottom: 0; } }

body {
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  line-height: 1.45;
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select, textarea { font: inherit; }
img, svg { max-width: 100%; display: block; }
a { color: var(--verde-txt); }

/* атрибут hidden прячет всегда: было, что .chip{display:inline-flex} и .btn{display:flex} его перебивали —
   пустая розовая плашка у «Предложить улучшение», пустой блок Google в окне входа */
[hidden] { display: none !important; }

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

/* ---------- каркас ---------- */

#app { display: flex; flex-direction: column; min-height: 100dvh; }

.screen {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--sat) + 14px) 16px calc(96px + var(--sab));
  animation: screen-in 0.22s ease;
}
.screen.no-tabs { padding-bottom: calc(24px + var(--sab)); }

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

/* ---------- нижняя навигация ---------- */

#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--cartao);
  border-top: 1px solid var(--linha);
  box-shadow: var(--sombra-up);
  padding-bottom: var(--sab);
}
#tabbar .row {
  display: flex; max-width: 560px; margin: 0 auto;
}
.tab-btn {
  flex: 1; min-width: 0; min-height: 58px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--texto-2);
  font-size: 0.68rem; font-weight: 600;
}
.tab-btn .lbl { white-space: nowrap; }
/* подписи не влезают (крупный текст, 320 px, системное увеличение шрифта — app.js fitTabs): только значки, подпись
   остаётся для чтения с экрана. Было: подписи налезали друг на друга, а вкладка PF уезжала за край экрана */
body.tabs-compact .tab-btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tab-btn .tab-badge { position: absolute; top: 4px; left: 50%; margin-left: 8px; }
.tab-btn .ico { font-size: 1.35rem; line-height: 1; }
.tab-btn[aria-current="page"] { color: var(--verde-txt); }
.tab-btn[aria-current="page"] .ico { transform: translateY(-1px); }

/* ---------- типографика ---------- */

h1 { font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 1.18rem; line-height: 1.25; }
h3 { font-size: 1rem; }
.muted { color: var(--texto-2); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.75rem; }
.pt-text { font-weight: 700; }

/* ---------- карточки и кнопки ---------- */

.card {
  background: var(--cartao);
  border-radius: var(--r-lg);
  border: 1px solid var(--linha);
  box-shadow: var(--sombra);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
/* крупный текст (настройка или системные 200 %): длинное слово («Конфиденциальность», «Импровизированный») переносится,
   а не раздвигает экран и не обрезается краем карточки. На обычном размере ничего не меняется — слова влезают */
.card, .list-row .grow, .stat-tile, .map-node .info { overflow-wrap: anywhere; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.08s ease, filter 0.15s ease;
  width: 100%;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--verde); color: #fff; }
.btn-primary:disabled { background: var(--linha); color: var(--texto-2); cursor: default; }
.btn-sun { background: var(--sol); color: #4a3a08; }
.btn-coral { background: #C4473A; color: #fff; }   /* белый на фирменном коралловом — 2,85:1, темнее — 4,6:1 */
.btn-ghost { background: transparent; color: var(--verde-txt); border: 2px solid var(--verde); }
.btn-soft { background: var(--verde-suave); color: var(--verde-txt); }
.btn-plain { background: transparent; color: var(--texto-2); font-weight: 600; min-height: 40px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--verde-suave); color: var(--verde-txt);
  border-radius: 999px; padding: 5px 12px;
  font-size: 0.82rem; font-weight: 700;
}
.chip.sun { background: var(--sol-suave); color: #7a5c0c; }   /* было #8a6a10 — 4,46:1, ниже 4,5:1 */
.chip.coral { background: var(--coral-suave); color: #b0402f; }
.chip.ceu { background: var(--ceu-suave); color: #2b6d8c; }

/* ---------- шапка экранов ---------- */

/* при крупном тексте и на 320 px счётчики переносятся под заголовок, а не уходят за край (страница ездила вбок) */
.topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.topline > h1, .topline > h2, .topline > div:not(.stats) { min-width: 0; overflow-wrap: anywhere; }
/* счётчики не сжимаются: в строку с заголовком или целиком строкой ниже (там фишки переносятся, если не влезают) */
.topline .stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; flex: 0 0 auto; max-width: 100%; }
.topline .stats .chip { white-space: nowrap; }

.back-btn {
  min-width: var(--tap); min-height: var(--tap);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--cartao); border: 1px solid var(--linha);
  font-size: 1.1rem;
}

/* ---------- онбординг ---------- */

.ob-progress { display: flex; gap: 6px; margin: 10px 0 20px; }
.ob-progress i { flex: 1; height: 6px; border-radius: 3px; background: var(--linha); }
.ob-progress i.on { background: var(--turquesa); }

.opt-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap);
  background: var(--cartao); border: 2px solid var(--linha);
  border-radius: var(--r-md); padding: 13px 16px;
  font-weight: 600; text-align: left; width: 100%;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.opt .ico { font-size: 1.3rem; }
.opt[aria-pressed="true"] { border-color: var(--turquesa); background: var(--verde-suave); }

/* ---------- карта Bairro Vivo ---------- */

.section-band {
  border-radius: var(--r-lg);
  padding: 18px 16px;
  margin-bottom: 14px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.section-band .cefr {
  position: absolute; top: 12px; right: 14px;
  background: rgba(15, 38, 31, 0.45);   /* тёмная, а не светлая: по светлому небу картинок белый мелкий текст давал 1,7–2,4 при норме 4,5 */
  border-radius: 999px; padding: 3px 10px;
  font-size: 0.75rem; font-weight: 700;
}
/* справа — место под плашку уровня (самая широкая, «Survival», — 67 px при 18,9 px заголовка): было, что на телефоне
   заголовок района заезжал под плашку («Свободная речь и культура» под «B2.2») */
.section-band h2 { margin-bottom: 2px; padding-right: 4em; }
.section-band .small { opacity: 0.9; }

.map-scroll { position: relative; padding: 8px 0 30px; }

.map-node {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 6px;
  border-radius: var(--r-md);
  text-align: left;
}
.map-node .bubble {
  width: 62px; height: 62px; flex: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  border: 3px solid var(--linha);
  background: var(--cartao);
  box-shadow: var(--sombra);
  position: relative;
}
.map-node.side .bubble { width: 52px; height: 52px; font-size: 1.2rem; margin-left: 34px; }
.map-node.done .bubble { border-color: var(--turquesa); background: var(--verde-suave); }
.map-node.current .bubble { border-color: var(--sol); background: var(--sol-suave); animation: pulse 2s infinite; }
.map-node.locked { opacity: 0.55; }
.map-node .info { flex: 1; min-width: 0; }
.map-node .t { font-weight: 700; }
.map-node .check {
  position: absolute; right: -4px; bottom: -4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--turquesa); color: #fff;
  font-size: 0.8rem; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--cartao);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(246, 200, 76, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(246, 200, 76, 0); }
}

.unit-head {
  display: flex; align-items: center; gap: 10px;
  margin: 20px 0 10px; color: var(--texto-2);
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.unit-head::before, .unit-head::after { content: ""; flex: 1; height: 1px; background: var(--linha); }

.locked-section {
  opacity: 0.7; filter: saturate(0.6);
}

/* ---------- урок ---------- */

.lesson-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.lesson-progress { flex: 1; height: 10px; border-radius: 5px; background: var(--linha); overflow: hidden; }
.lesson-progress i { display: block; height: 100%; background: var(--turquesa); border-radius: 5px; transition: width 0.3s ease; }

.ex-prompt { margin: 6px 0 16px; }
.ex-phrase {
  font-size: 1.3rem; font-weight: 700; margin: 8px 0;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

.audio-btn {
  width: 46px; height: 46px; flex: none;
  border-radius: 50%;
  background: var(--ceu-suave); color: #2b6d8c;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.audio-btn.big { width: 84px; height: 84px; font-size: 2rem; margin: 10px auto; background: var(--ceu); color: #fff; }
.audio-btn.slow { font-size: 1rem; }

.answer-list { display: flex; flex-direction: column; gap: 10px; }
.answer {
  min-height: var(--tap);
  background: var(--cartao); border: 2px solid var(--linha);
  border-radius: var(--r-md); padding: 12px 16px;
  font-weight: 600; width: 100%; text-align: left;
  display: flex; align-items: center; gap: 10px;
}
.answer.sel { border-color: var(--ceu); background: var(--ceu-suave); }
.answer.ok { border-color: var(--turquesa); background: var(--verde-suave); }
.answer.bad { border-color: var(--coral); background: var(--coral-suave); }

.word-bank, .word-slots { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; min-height: 46px; }
.word-slots { padding: 10px; border-radius: var(--r-md); background: var(--verde-suave); align-items: flex-start; }
.w-token {
  background: var(--cartao); border: 2px solid var(--linha);
  border-radius: var(--r-sm); padding: 8px 14px; font-weight: 700;
  min-height: 42px;
}
.w-token.ghost { opacity: 0.25; pointer-events: none; }

/* «Соедините пары»: слева португальский, справа перевод — по колонкам (dense), а не вперемешку по строкам: было
   «onze | doze», а при нечётном числе пар «quinze | 13» выглядело как готовая пара */
.pairs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: dense; gap: 10px; }
.pairs-grid [data-side="l"] { grid-column: 1; }
.pairs-grid [data-side="r"] { grid-column: 2; }
.pairs-grid .answer { justify-content: center; text-align: center; }
.pairs-grid .answer.matched { opacity: 0.35; pointer-events: none; border-color: var(--turquesa); }

.type-input {
  width: 100%; min-height: 54px;
  border: 2px solid var(--linha); border-radius: var(--r-md);
  background: var(--cartao); color: var(--texto);
  padding: 12px 16px; font-size: 1.1rem; font-weight: 600;
}
.type-input:focus { outline: none; border-color: var(--turquesa); }

.feedback {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--cartao);
  border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg);
  box-shadow: var(--sombra-up);
  padding: 18px 16px calc(16px + var(--sab));
  animation: sheet-in 0.2s ease;
}
.feedback .inner { max-width: 560px; margin: 0 auto; }
.feedback.ok { border-top: 4px solid var(--turquesa); }
.feedback.bad { border-top: 4px solid var(--coral); }
.feedback h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

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

/* ---------- персонаж на сцене ---------- */

.stage {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 4px;
}
.stage .char-holder { width: 168px; height: 168px; }
.stage.small .char-holder { width: 110px; height: 110px; }
.speech-bubble {
  position: relative;
  background: var(--cartao); border: 1px solid var(--linha);
  border-radius: var(--r-lg); padding: 14px 16px;
  box-shadow: var(--sombra);
  margin-top: 8px;
  max-width: 100%;
}
.speech-bubble::before {
  content: ""; position: absolute; top: -8px; left: 50%; margin-left: -8px;
  width: 16px; height: 16px; background: inherit;
  border-left: 1px solid var(--linha); border-top: 1px solid var(--linha);
  transform: rotate(45deg);
}

.karaoke { font-size: 1.25rem; font-weight: 700; line-height: 1.5; }
.karaoke .w { border-radius: 6px; padding: 1px 3px; }
.karaoke .w.now { background: var(--sol-suave); color: #8a6a10; }
.karaoke .w.good { background: var(--verde-suave); color: var(--verde-txt); }
.karaoke .w.mid { background: var(--sol-suave); color: #8a6a10; }
.karaoke .w.poor { background: var(--coral-suave); color: #b0402f; }

.rate-row { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
.rate-row .chipbtn {
  border: 2px solid var(--linha); border-radius: 999px;
  padding: 8px 16px; font-weight: 700; font-size: 0.9rem;
  background: var(--cartao); min-height: 42px;
}
.rate-row .chipbtn.on { border-color: var(--turquesa); background: var(--verde-suave); color: var(--verde-txt); }

.mic-btn {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--coral); color: #fff; font-size: 2rem;
  display: flex; align-items: center; justify-content: center;
  margin: 14px auto 6px;
  box-shadow: var(--sombra);
}
.mic-btn.rec { animation: recpulse 1s infinite; }
@keyframes recpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 116, 101, 0.55); }
  50% { box-shadow: 0 0 0 16px rgba(239, 116, 101, 0); }
}

/* ---------- диалог ---------- */

.dlg-log { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.dlg-msg { display: flex; gap: 10px; align-items: flex-end; }
.dlg-msg .avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden; background: var(--verde-suave); }
.dlg-msg .txt {
  background: var(--cartao); border: 1px solid var(--linha);
  border-radius: var(--r-md); border-bottom-left-radius: 4px;
  padding: 10px 14px; max-width: 82%;
}
.dlg-msg.me { flex-direction: row-reverse; }
.dlg-msg.me .txt {
  background: var(--verde); color: #fff; border-color: var(--verde);
  border-bottom-left-radius: var(--r-md); border-bottom-right-radius: 4px;
}
.dlg-msg .ru { font-size: 0.8rem; opacity: 0.75; margin-top: 3px; }

/* ---------- профиль и статистика ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-tile { background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--r-md); padding: 12px 14px; }
.stat-tile .v { font-size: 1.4rem; font-weight: 800; }

.skill-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--linha); }
.skill-row:last-child { border-bottom: 0; }
.skill-row .name { flex: 1; font-weight: 600; }
/* «Новые слова» во вступлении урока: слово и перевод в одну строку, не помещаются — перевод строкой ниже. Было: перевод —
   отдельный элемент строки, у слова нулевая основа (flex: 1), и при длинном переводе слово сжималось в колонку по букве */
.skill-row .new-word { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; column-gap: 10px; }
.skill-row .new-word .muted { font-weight: 400; }
.skill-bar { width: 110px; height: 8px; border-radius: 4px; background: var(--linha); overflow: hidden; }
.skill-bar i { display: block; height: 100%; border-radius: 4px; background: var(--turquesa); }

.list-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: var(--tap); padding: 12px 4px;
  border-bottom: 1px solid var(--linha); text-align: left; font-weight: 600;
}
.list-row:last-child { border-bottom: 0; }
.list-row .ico { font-size: 1.25rem; width: 30px; text-align: center; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .arr { color: var(--texto-2); }

/* «Разговор»: сетки персонажей и сценок — колонок столько, сколько влезает (крупный текст — меньше колонок, на ПК — до
   шести и трёх). Отступ между карточками даёт gap: было, что .card + .card поднимал первую карточку ряда на 12 px */
.talk-grid { display: grid; gap: 8px; margin-bottom: 4px; }
.talk-grid.chars { grid-template-columns: repeat(auto-fit, minmax(min(100%, max(5.5rem, 15%)), 1fr)); }
.talk-grid.roles { grid-template-columns: repeat(auto-fit, minmax(min(100%, max(8.5rem, 30%)), 1fr)); }
.talk-grid > .card { margin-top: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- paywall ---------- */

.plan-card { border: 2px solid var(--linha); border-radius: var(--r-lg); padding: 16px; background: var(--cartao); }
.plan-card + .plan-card { margin-top: 12px; }
.plan-card.hot { border-color: var(--sol); position: relative; }
.plan-card.hot .tag {
  position: absolute; top: -11px; left: 16px;
  background: var(--sol); color: #4a3a08;
  border-radius: 999px; padding: 2px 12px; font-size: 0.75rem; font-weight: 800;
}
.plan-card ul { margin: 10px 0 0 2px; list-style: none; }
.plan-card li { padding: 3px 0 3px 26px; position: relative; font-size: 0.92rem; }
.plan-card li::before { content: "✓"; position: absolute; left: 2px; color: var(--turquesa); font-weight: 800; }

.price-line { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.price-line .p { font-size: 1.3rem; font-weight: 800; }

/* ---------- разное ---------- */

.hero-panel {
  border-radius: var(--r-lg); overflow: hidden; position: relative;
  background: linear-gradient(135deg, var(--verde), var(--turquesa));
  color: #fff; padding: 20px 18px; margin-bottom: 14px;
}
.hero-panel h1 { color: #fff; }

.toast {
  position: fixed; top: calc(var(--sat) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--texto); color: var(--fundo);
  border-radius: 999px; padding: 10px 20px; font-weight: 700; font-size: 0.9rem;
  z-index: 90; box-shadow: var(--sombra); max-width: 92vw; text-align: center;
  animation: toast-in 0.25s ease;
}
/* BVRU1024: подсказка про зеркало для России (установленное приложение) */
.geo-hint {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab, 0px) + 84px);
  width: min(560px, calc(100vw - 24px)); z-index: 85; display: flex; gap: 10px; align-items: flex-start;
  background: var(--texto); color: var(--fundo); border-radius: 16px; padding: 12px 12px 12px 16px;
  font-size: 0.9rem; line-height: 1.35; box-shadow: var(--sombra);
}
.geo-hint a { color: inherit; font-weight: 800; text-decoration: underline; }
.geo-hint-x { flex: none; min-width: 36px; min-height: 36px; border: 0; border-radius: 999px; background: transparent; color: inherit; font-size: 1rem; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.modal-back {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20, 32, 28, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--fundo); width: 100%; max-width: 560px;
  border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg);
  padding: 20px 16px calc(20px + var(--sab));
  max-height: 88dvh; overflow-y: auto;
  animation: sheet-in 0.25s ease;
}
.modal .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--linha); margin: 0 auto 14px; }
/* шапка окна: ручка (свайп вниз закрывает) и «✕»; липкая — в длинной шторке видна и после прокрутки */
.modal-top {
  position: sticky; top: -20px; z-index: 2;
  display: flex; justify-content: flex-end; align-items: flex-start;
  margin: -20px -16px 2px; padding: 4px 6px 0; min-height: 48px;
  background: var(--fundo);
  touch-action: none;
}
.modal-top .grab { position: absolute; left: 50%; top: 10px; margin: 0 0 0 -22px; }
.modal-x {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--texto-2); font-size: 1.05rem; font-weight: 700;
}
.modal-x:hover { background: var(--linha); }
.modal-x:focus-visible { outline: 2px solid var(--turquesa); outline-offset: -2px; }
.modal:focus, .modal [tabindex="-1"]:focus, h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }   /* фокус на заголовке окна и экрана — для чтения с экрана, без рамки */

.divider { height: 1px; background: var(--linha); margin: 14px 0; }

.badge-dot {
  min-width: 20px; height: 20px; border-radius: 10px;
  background: var(--coral); color: #fff; font-size: 0.7rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 6px;
}

.empty-state { text-align: center; padding: 36px 16px; color: var(--texto-2); }
.empty-state .big { font-size: 2.6rem; margin-bottom: 10px; }

.ad-slot {
  border: 2px dashed var(--linha); border-radius: var(--r-md);
  padding: 14px; text-align: center; color: var(--texto-2); font-size: 0.85rem;
  margin-top: 14px;
}

.confetti-pop { animation: pop 0.45s ease; }
@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* дыхание персонажей (отключается настройкой анимаций и prefers-reduced-motion) */
.char-holder svg, .stat-tile .char, .avatar .char {
  animation: char-idle 3.6s ease-in-out infinite;
  transform-origin: 50% 88%;
}
@keyframes char-idle {
  0%, 100% { transform: none; }
  50% { transform: translateY(-1.5px) scaleY(1.015); }
}

.mission-done { color: var(--verde-txt); font-weight: 700; }

.focus-pips { display: inline-flex; gap: 3px; }
.focus-pips i { width: 10px; height: 10px; border-radius: 50%; background: var(--linha); }
.focus-pips i.on { background: var(--sol); }

table.cmp { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.cmp th, table.cmp td { padding: 7px 6px; text-align: center; border-bottom: 1px solid var(--linha); }
table.cmp td:first-child, table.cmp th:first-child { text-align: left; }

@media (min-width: 700px) {
  .screen { max-width: 640px; }
}

/* ============================================================
   Десктоп (≥960px): боковая навигация + широкая раскладка сайта
   ============================================================ */
@media (min-width: 960px) {
  body.with-tabs { padding-left: 240px; }

  body.with-tabs #tabbar {
    top: 0; bottom: 0; right: auto; width: 240px;
    border-top: 0; border-right: 1px solid var(--linha);
    box-shadow: none;
    padding: 22px 12px;
  }
  body.with-tabs #tabbar .row {
    flex-direction: column; gap: 6px; max-width: none; height: 100%;
  }
  body.with-tabs .tab-btn {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 14px;
    padding: 12px 16px; min-height: 50px;
    border-radius: var(--r-md);
    font-size: 1rem;
  }
  body.with-tabs .tab-btn .ico { font-size: 1.4rem; }
  /* бейдж повторения в боковой панели — справа от подписи (было: висел над словом «Практика») */
  body.with-tabs .tab-btn .tab-badge { position: static; margin-left: auto; }
  body.with-tabs .tab-btn[aria-current="page"] { background: var(--verde-suave); }

  body.with-tabs #tabbar .brand { display: flex; }

  .screen { max-width: 820px; padding-top: 28px; padding-bottom: 48px; }
  .screen.no-tabs { max-width: 680px; padding-top: 24px; }

  h1 { font-size: 1.8rem; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pairs-grid { gap: 12px; }
  .section-band { padding: 26px 22px; min-height: 150px; display: flex; flex-direction: column; justify-content: flex-end; }
  .map-node .bubble { width: 68px; height: 68px; }
  .plan-card.hot { margin-top: 8px; }
  .feedback .inner, .modal { max-width: 680px; }
  .modal { border-radius: var(--r-lg); margin-bottom: 4vh; }
  .modal-back { align-items: center; }
}

#tabbar .brand {
  display: none;
  align-items: center; gap: 10px;
  padding: 6px 12px 20px;
  font-weight: 800; font-size: 1.15rem;
}
#tabbar .brand img { width: 40px; height: 40px; border-radius: 10px; }
#tabbar .brand .tag { font-size: 0.68rem; font-weight: 600; color: var(--texto-2); }

/* ---------- лендинг ---------- */
.landing { max-width: 1020px; margin: 0 auto; padding: 0 16px calc(40px + var(--sab)); }
.landing .hero {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  margin-top: 12px;
  box-shadow: var(--sombra);
}
/* картинка — фоном; блок 3:2, но растёт по тексту: на телефонах заголовок с двумя кнопками
   не влезал в высоту картинки и обрезался сверху (аудит 23.10) */
.landing .hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.landing .hero .inner {
  position: relative; aspect-ratio: 3 / 2;
  background: linear-gradient(180deg, rgba(15,38,31,.05) 30%, rgba(15,38,31,.82));
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 22px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
@media (max-width: 759px) {   /* текст начинается сверху, по светлому небу — затемнить и верх */
  .landing .hero .inner { background: linear-gradient(180deg, rgba(15,38,31,.66), rgba(15,38,31,.5) 45%, rgba(15,38,31,.86)); }
}
.landing .hero h1 { color: #fff; font-size: clamp(1.6rem, 4.5vw, 2.6rem); }
.landing .hero p { font-size: clamp(0.95rem, 2vw, 1.15rem); margin-top: 6px; max-width: 560px; }
.landing .cta-row { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.landing .cta-row .btn { width: auto; padding: 14px 28px; }
/* «Попробовать без регистрации» (мини-приём pfdemo) — третья кнопка hero: тише двух главных, светлая рамка по тёмной
   картинке (в обеих темах картинка та же); длинная подпись на 320 px переносится, а не раздвигает экран */
.landing .hero .land-demo {
  width: auto; align-self: flex-start; margin-top: 12px; padding: 10px 18px;
  background: rgba(255, 255, 255, 0.14); color: #fff; border: 2px solid rgba(255, 255, 255, 0.78);
  font-size: 0.95rem; text-shadow: none; white-space: normal;
}
.landing .hero .land-demo:hover { background: rgba(255, 255, 255, 0.24); }
.landing .hero .land-demo:focus-visible { outline: 3px solid var(--sol); outline-offset: 2px; }
.land-grid { display: grid; gap: 14px; margin-top: 18px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .land-grid { grid-template-columns: repeat(3, 1fr); } }
.land-card { background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sombra); }
.land-card img { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; }
.land-card .pad { padding: 14px 16px 16px; }
@media (min-width: 760px) { .land-card.pf-land { display: grid; grid-template-columns: 1fr 1fr; align-items: center; } }   /* ПК: карточка PF под фишками — картинка слева, текст справа, а не картинка 990×660 */
.land-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 22px 0 6px; }
.land-steps { display: grid; gap: 12px; margin-top: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .land-steps { grid-template-columns: repeat(3, 1fr); } }
.land-step { background: var(--verde-suave); border-radius: var(--r-lg); padding: 16px; }
.land-step .num { width: 34px; height: 34px; border-radius: 50%; background: var(--verde); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.land-foot { text-align: center; margin-top: 30px; color: var(--texto-2); font-size: 0.85rem; }
/* шапка: логотип, «Войти» (спокойная) и «Регистрация» (яркая). Влезает в 320 px; при крупном тексте
   кнопки переносятся на вторую строку, а не вылезают за экран; на узких — подпись у логотипа только для чтения с экрана */
.land-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: calc(var(--sat) + 12px) 2px 0; }
.land-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; min-width: 0; }
.land-brand img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.land-auth { display: flex; gap: 8px; margin-left: auto; }
.land-auth .btn { width: auto; min-height: 42px; padding: 9px 12px; font-size: 0.92rem; white-space: nowrap; }
@media (min-width: 600px) { .land-auth .btn { padding: 9px 18px; font-size: 1rem; } }
@media (max-width: 389px) {
  .land-brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- вход, регистрация, восстановление пароля ---------- */
.modal [hidden] { display: none !important; }   /* .btn{display:flex} иначе перебивает атрибут hidden */
.pw-wrap { position: relative; }
.pw-wrap .type-input { display: block; padding-right: 92px; }
.fld .pw-wrap { margin-top: 4px; }
.fld .pw-wrap .type-input { margin-top: 0; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  min-height: 40px; padding: 0 10px; border-radius: var(--r-sm);
  font-size: 0.82rem; font-weight: 700; color: var(--verde-txt);
}
.pw-eye:focus-visible { outline: 2px solid var(--turquesa); outline-offset: 1px; }
.form-err { color: var(--coral-txt); font-size: 0.88rem; font-weight: 600; margin-top: 8px; }
.type-input[aria-invalid="true"] { border-color: var(--coral); }
input[type="checkbox"][aria-invalid="true"] { outline: 2px solid var(--coral); outline-offset: 2px; }
.btn-soft:disabled { opacity: 0.6; cursor: default; }
.link-btn {
  display: inline; padding: 0; min-height: 0; background: none; border: 0;
  color: var(--verde-txt); font: inherit; font-weight: 700;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.toggle-row.consent-row { align-items: flex-start; border-bottom: 0; padding: 12px 0 10px; margin-top: 4px; }
.opt .opt-sub { display: block; font-weight: 500; margin-top: 2px; }
.np-ios { background: var(--sol-suave); border-radius: var(--r-md); padding: 10px 12px; margin-top: 12px; }

/* Тема карты «Босса-нова» (товар из лавки): вечерний Рио */
body.theme-bossa { --fundo: #F1EDF7; }

/* тёмная тема: цветные фишки читаемы (было 2,3–2,5:1) */
:root[data-theme="dark"] .chip.sun { color: #F6C84C; } :root[data-theme="dark"] .chip.coral { color: #FF9A8B; } :root[data-theme="dark"] .chip.ceu { color: #8FD3F0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .chip.sun { color: #F6C84C; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .chip.coral { color: #FF9A8B; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .chip.ceu { color: #8FD3F0; }
}
.faq summary { padding: 10px 0; cursor: pointer; }
/* в уроке уведомление не перекрывает заголовок и прогресс (на 320 px налезало) */
body:has(.screen.session) .toast { top: calc(var(--sat) + 70px); }
