@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 500 900; font-display: swap; src: url(fonts/nunito-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 500 900; font-display: swap; src: url(fonts/nunito-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Единый стиль «робот»: белые поверхности, жирная чёрная обводка, нейтральные пастельные фоны. Цвета остальным не нужны */
  color-scheme: light;
  --ink: #14161a;
  --bg: #f9f6f2;
  --bg2: #f9f6f2;
  --card: #ffffff;
  --text: #14161a;
  --muted: #5f5c6b;
  --accent: #f48257; /* «солнечный коралл» */
  --accent-dark: #df6a3d;
  --accent-text: #ffffff;
  --glow: #ffb08e;
  --accent-strong: #e8703f; /* заливка главных кнопок: белый жирный текст 3,1:1 (крупный текст) */
  --accent-link: #b4471f;
  --field-border: #e3dbd7;
  --focus: #14161a;
  --tint: #fdece3; /* лёгкая заливка выбранного */
  --line: #ebe4e0; /* светлая рамка карточек */
  --danger: #c0261c;
  --tutor: #f3eefc;
  --user: #fde1da;
  --border: #ebe4e0;
  --face-ink: #2a2826;
  --font: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }
body {
  margin: 0;
  overflow-x: hidden;
  overflow-x: clip;
  min-height: 100dvh;
  color: var(--text);
  font: 500 17px/1.45 var(--font);
  background:
    radial-gradient(760px 520px at 100% 0%, #f3dcf3, transparent 65%),
    radial-gradient(680px 560px at 0% 18%, #dcecfb, transparent 65%),
    radial-gradient(760px 560px at 100% 100%, #ffe8cc, transparent 65%),
    var(--bg);
  background-attachment: fixed;
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 640px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(max(12px, env(safe-area-inset-top)) + 44px) 16px max(16px, env(safe-area-inset-bottom));
}


.status { margin-top: 4px; color: var(--muted); font-size: 1rem; font-weight: 700; text-align: center; min-height: 1.5em; }
.status.live { color: var(--accent-link); font-weight: 700; }
.status.error { color: var(--danger); font-weight: 600; }

.task {
  background: var(--card);
  border: 3px solid var(--accent);
  border-radius: 22px;
  padding: 12px 18px;
  box-shadow: 0 6px 0 var(--border);
}
.task-meta { color: var(--muted); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.task-text { margin-top: 4px; font-size: 1.15rem; white-space: pre-wrap; }

.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 200px; }
.orb {
  --level: 0;
  position: relative;
  width: min(54vw, 230px);
  aspect-ratio: 240 / 200;
  display: grid;
  place-items: center;
  transition: transform 0.1s linear;
  -webkit-tap-highlight-color: transparent;
}
.face-stack { position: relative; width: 100%; height: 100%; display: grid; place-items: center; transform-origin: 50% 70%; filter: drop-shadow(0 10px 18px rgb(60 40 80 / 0.14)); }
.face-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.face-shell { fill: #fff; stroke: var(--face-ink); stroke-width: 17; }
.eye-w { fill: var(--face-ink); transform-box: fill-box; transform-origin: 50% 50%; animation: blink 5.2s infinite; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.12); } }

/* Выражения: в покое только глаза (симметричные, стоят широко). Рот-капсула появляется, пока репетитор говорит, и раскрывается по громкости */
.mouth { fill: var(--face-ink); opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; transform: scaleY(0.3); transition: opacity 0.15s, transform 0.06s linear; }
.ey { transition: transform 0.22s ease; transform-box: fill-box; transform-origin: 50% 50%; transform: translate(var(--gx, 0px), calc(var(--gy, 0px) + var(--fy, 0px))) scale(var(--es, 1)); } /* взгляд (--gx, --gy) и размер глаз (--es) задаёт robot.css по состоянию */
.orb.speaking .mouth { opacity: 1; transform: scale(var(--mw, 1), calc(0.35 + var(--level) * 1.2)); transition: opacity 0.15s, transform 0.11s ease-out; } /* говорит ртом: открывается и закрывается плавно по громкости, остальное лицо спокойно дышит */
.orb.muted .eye-w { animation: none; transform: scaleY(0.1); }          /* микрофон выключен: глаза закрыты чёрточками */

/* Дыхание: лицо чуть приближается и отдаляется (вперёд-назад), без наклонов и сдвигов вбок */
.face-stack { transform-origin: 50% 50%; }
.orb.idle .face-stack { animation: face-breathe 3.6s ease-in-out infinite; }
.orb.listening .face-stack { animation: face-breathe 1.8s ease-in-out infinite; }
.orb.thinking .face-stack { animation: face-breathe 2.4s ease-in-out infinite; }
.orb.speaking .face-stack { animation: face-breathe 3.6s ease-in-out infinite; }
.orb.muted .face-stack { opacity: 0.75; }
@keyframes face-breathe { 0%, 100% { transform: scale(0.97); } 50% { transform: scale(1.03); } }
.orb.tap { cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
@media (prefers-reduced-motion: reduce) { .orb, .orb .face-stack, .eye-w { animation: none !important; transition: none; }
 }

.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.hint { flex-basis: 100%; margin: 4px 0 0; color: var(--muted); font-size: 0.85rem; }

.btn {
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font: 800 1rem var(--font);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--border), 0 8px 18px -8px rgb(20 29 38 / 0.35);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--border), 0 3px 8px -6px rgb(20 29 38 / 0.35); }
.btn.primary { flex: 1; background: var(--accent-strong); color: var(--accent-text); font-size: 1.2rem; box-shadow: 0 5px 0 var(--accent-dark), 0 12px 22px -10px var(--accent-strong); }
.btn.primary:active { box-shadow: 0 2px 0 var(--accent-dark), 0 5px 12px -8px var(--accent-strong); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.6; cursor: default; }

[hidden] { display: none !important; }

.voice { color: var(--muted); font-size: 0.95rem; }
.voice select { margin-left: 6px; min-height: 44px; padding: 0 12px; border: 3px solid var(--field-border); border-radius: 999px; font-weight: 700; background: var(--card); color: var(--text); font: inherit; }

.who { display: flex; align-items: center; margin-top: 2px; color: var(--muted); font-size: 0.9rem; }
.link { padding: 0 6px; min-height: 44px; border: 0; background: none; color: var(--accent-link); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.login { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; background: var(--card); border: 3px solid var(--accent); border-radius: 22px; }
.login input { min-height: 60px; padding: 0 14px; border: 3px solid var(--field-border); border-radius: 18px; background: var(--bg); color: var(--text); font: inherit; font-size: 1.6rem; letter-spacing: 0.4em; text-align: center; }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--muted); font-size: 0.95rem; }
.check input { width: 24px; height: 24px; accent-color: var(--accent-strong); }

/* Видимый фокус для клавиатуры у всех интерактивных элементов */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 12px; }
.voice { display: flex; align-items: center; min-height: 44px; }

/* Схемы-подсказки */
.board { background: var(--card); border: 3px solid var(--border); border-radius: 22px; padding: 14px 16px; box-shadow: 0 6px 0 var(--border); text-align: center; }
.vis-title { font-weight: 800; margin-bottom: 8px; }
.vis-caption { margin-top: 8px; color: var(--muted); font-weight: 700; }
.vis-eq { margin-top: 8px; font-size: 1.4rem; font-weight: 900; letter-spacing: 0.02em; }
.vis-groups { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.vis-cell-group { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.vis-label { font-size: 0.95rem; font-weight: 800; opacity: 0.85; }
.vis-group { display: inline-grid; grid-template-columns: repeat(var(--cols, 5), auto); justify-content: center; gap: 2px; max-width: 190px; padding: 8px 10px; border: 3px dashed var(--accent); border-radius: 16px; font-size: 1.5rem; line-height: 1.15; }
.vis-op { font-size: 1.6rem; font-weight: 900; color: var(--accent-link); }
.vis-column { display: inline-block; font: 900 2rem/1.2 var(--font); font-variant-numeric: tabular-nums; text-align: right; }
.vis-row { display: flex; justify-content: flex-end; gap: 4px; position: relative; padding-left: 1.4em; }
.vis-cell { display: inline-block; min-width: 1.1em; text-align: center; }
.vis-sign { position: absolute; left: 0; color: var(--accent-link); }
.vis-line { border-top: 4px solid var(--text); margin: 4px 0; }
.vis-row.r .vis-cell { color: var(--accent-link); }
.vis-numberline { width: 100%; max-width: 560px; height: auto; }
.nl-axis { stroke: var(--text); stroke-width: 4; stroke-linecap: round; }
.nl-tick { stroke: var(--text); stroke-width: 3; }
.nl-tick.hot { stroke: var(--accent-link); stroke-width: 5; }
.nl-label { fill: var(--muted); font: 700 16px var(--font); }
.nl-label.hot { fill: var(--text); font-weight: 900; }
.nl-arc { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.nl-jump { fill: var(--accent-link); font: 900 20px var(--font); }
.vis-word { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 4px; }
.vis-syl { display: inline-flex; gap: 3px; }
.vis-letter { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.7em; padding: 0 4px; border: 3px solid var(--field-border); border-radius: 12px; font: 900 2rem/1 var(--font); }
.vis-letter.mark { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-text); }
.vis-dash { color: var(--muted); font-weight: 900; font-size: 1.6rem; }
@media (prefers-reduced-motion: no-preference) { .board:not([hidden]) { animation: board-in 0.35s cubic-bezier(.3,1.3,.5,1); } }
@keyframes board-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

.task-audio { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn.small { min-height: 48px; padding: 0 18px; font-size: 0.95rem; }

.task-photo { display: block; max-width: 100%; max-height: 220px; margin-top: 10px; border-radius: 14px; border: 2px solid var(--border); object-fit: contain; }

.btn.pulse { animation: pulse 1.2s ease-in-out 8; box-shadow: 0 0 0 4px var(--glow), 0 8px 18px -8px rgb(20 29 38 / 0.35); }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .btn.pulse { animation: none; } }

/* Вкладки «Урок | Родителю» */
.tabs { display: flex; gap: 8px; margin: 2px 0 6px; }
.tab { flex: 1; min-height: 48px; border: 0; border-radius: 999px; background: var(--card); color: var(--muted); font: 800 1rem var(--font); cursor: pointer; box-shadow: 0 3px 0 var(--border); }
.tab[aria-selected="true"] { background: var(--accent-strong); color: var(--accent-text); box-shadow: 0 3px 0 var(--accent-dark); }
.tab:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.panel { display: flex; flex-direction: column; gap: 14px; }
.panel[hidden] { display: none; }
.pform { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--card); border: 3px solid var(--accent); border-radius: 22px; }
.pform label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.pform input { min-height: 52px; padding: 0 14px; border: 3px solid var(--field-border); border-radius: 16px; background: var(--bg); color: var(--text); font: inherit; font-size: 1.1rem; }
.child { padding: 14px 16px; margin-bottom: 12px; background: var(--card); border: 2px solid var(--border); border-radius: 20px; display: flex; flex-direction: column; gap: 8px; }
.child h2 { margin: 0; font-size: 1.2rem; }
.child.paused { opacity: 0.7; }
.meter { display: grid; grid-template-columns: 90px 1fr 44px; gap: 8px; align-items: center; font-size: 0.9rem; color: var(--muted); }
.meter progress { width: 100%; height: 12px; accent-color: var(--accent-strong); }
.notes { margin: 0; padding-left: 18px; color: var(--text); font-size: 0.95rem; }
.child .row { display: flex; flex-wrap: wrap; gap: 8px; }
.pin-box { padding: 14px 16px; border: 3px dashed var(--glow); border-radius: 20px; background: var(--card); font-weight: 800; }
.pin-box .pin { display: block; margin: 6px 0; font-size: 2rem; letter-spacing: 0.3em; color: var(--accent-link); }

.pform select { min-height: 52px; padding: 0 12px; border: 3px solid var(--field-border); border-radius: 16px; background: var(--bg); color: var(--text); font: inherit; font-size: 1.1rem; }
.profile-line { font-size: 0.9rem; color: var(--muted); }
.profile-line strong { color: var(--text); }
.coverage { font-size: 0.85rem; color: var(--muted); }

.report { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.report .stat { font-weight: 800; }
.report [aria-pressed="true"] { background: var(--accent-strong); color: var(--accent-text); }

.listen-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 2px solid var(--glow); border-radius: 18px; background: var(--card); font-weight: 700; }
.listen-bar[hidden] { display: none; }

.code-line { font-weight: 800; }
.login input.plain { letter-spacing: normal; font-size: 1.2rem; text-align: left; }

.access-bar { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; border: 2px solid var(--glow); border-radius: 18px; background: var(--card); font-weight: 700; }
.access-bar[hidden] { display: none; }

.install { display: inline-flex; align-items: center; margin-top: 4px; }
.install[hidden] { display: none; }
.install-help { margin: 4px 0 0; padding: 10px 14px; border: 2px solid var(--glow); border-radius: 14px; background: var(--card); font-size: 0.9rem; }
.install-help[hidden] { display: none; }

.mic-box { display: flex; flex-direction: column; gap: 6px; }
.mic-box [hidden] { display: none; }

.access-bar input:not([type]), .access-bar input[type="text"] { min-height: 48px; padding: 0 12px; border: 3px solid var(--field-border); border-radius: 14px; background: var(--bg); color: var(--text); font: inherit; }
.access-bar .row { display: flex; flex-wrap: wrap; gap: 8px; }

.install-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 2px solid var(--glow); font-weight: 700; }
.install-bar[hidden] { display: none; }
.install-bar span { flex: 1; font-size: 0.95rem; }

/* Окно «Выбрать учебник» */
.book-now { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; text-align: center; }
.books-dialog { box-shadow: 0 18px 50px -18px rgb(60 40 80 / 0.35); width: min(34rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 2px solid var(--border); border-radius: 1.25rem; background: var(--bg); color: var(--text); }
.books-dialog::backdrop { background: rgb(255 246 240 / 0.72); backdrop-filter: blur(6px); }
.books-box { display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem; max-height: calc(100dvh - 2rem); overflow-y: auto; }
.books-head { display: flex; align-items: center; justify-content: space-between; }
.books-head h2 { margin: 0; font-size: 1.25rem; }
.books-head .link { font-size: 1.4rem; min-width: 44px; min-height: 44px; }
.grade-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { min-height: 44px; padding: 0.4rem 0.9rem; border-radius: 999px; border: 1px solid var(--field-border); background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.chip.on { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-text); font-weight: 700; }
.book-list { display: flex; flex-direction: column; gap: 0.5rem; }
.book-list h3 { margin: 0.5rem 0 0; font-size: 1rem; color: var(--muted); }
.book-row { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; min-height: 48px; padding: 0.6rem 0.9rem; border-radius: 0.9rem; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.book-row small { color: var(--muted); }
.book-row { flex-direction: row; align-items: center; gap: 0.75rem; }
.book-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.book-cover { flex: none; width: 48px; height: 64px; object-fit: cover; border-radius: 6px; box-shadow: 0 1px 4px rgb(0 0 0 / 0.25); background: var(--card); }
.book-cover.none { display: inline-flex; align-items: center; justify-content: center; background: var(--accent-link, #c9714f); color: #fff; font-weight: 800; font-size: 1.4rem; box-shadow: none; }
.book-row.on { border-color: var(--accent-link); outline: 2px solid var(--accent-link); }
.book-row:disabled { cursor: default; opacity: 1; }
.chip:focus-visible, .book-row:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Громкость */
.volume-row { display: flex; align-items: center; gap: 0.5rem; }
.volume-row input[type="range"] { flex: 1; min-width: 0; min-height: 44px; accent-color: var(--accent-link); }
.volume-row output { min-width: 3.2rem; text-align: right; color: var(--muted); }
.volume-row .btn.small { min-width: 44px; min-height: 44px; padding: 0; font-size: 1.3rem; }

/* Несколько страниц задания */
.photo-tray { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--card); }
.photo-tray .row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.photo-thumbs { display: flex; gap: 0.5rem; }
.thumb { position: relative; width: 84px; height: 84px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 0.6rem; border: 1px solid var(--field-border); }
.thumb-del { position: absolute; top: -10px; right: -10px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--field-border); background: var(--bg); color: var(--text); font: inherit; cursor: pointer; }

/* Режим «зажми и говори» */
.controls .ptt { min-height: 72px; font-size: 1.3rem; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; flex: 1 1 100%; order: -1; }
.controls .ptt[hidden] { display: none; }
.controls .ptt.held { background: var(--danger); border-color: var(--danger); color: #1a0d0d; transform: scale(0.98); }
.reply { padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--card); color: var(--text); font-size: 1.15rem; line-height: 1.45; }

/* Скачивание локального голоса */
.voice-card { display: grid; gap: 0.5rem; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--card); }
.voice-card progress { width: 100%; height: 12px; accent-color: var(--accent-strong); }
.voice-card .row { display: flex; gap: 0.5rem; flex-wrap: wrap; }


/* Главный экран: ничего лишнего. Шестерёнка в углу открывает настройки (и вкладку «Родителю») */
.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; }
.gear { position: fixed; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); z-index: 20; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--card) 70%, transparent); color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.gear:active { transform: scale(0.94); }
.controls { align-items: center; justify-content: center; }
.controls .btn.primary { flex: 1 1 auto; }
.btn.round { width: 56px; min-width: 56px; padding: 0; font-size: 1.4rem; }
.settings .tabs { margin-top: 0; }
.settings .panel { gap: 12px; }


/* ===== Мягкий стиль меню: белые карточки со светлой рамкой и крупными скруглениями, выбранное обводится тёплым пастельным цветом. Жирная чёрная обводка только у лица ===== */
.btn { min-height: 54px; padding: 0 20px; border: 2px solid var(--line); border-radius: 18px; background: #fff; color: var(--ink); box-shadow: none; font-weight: 800; transition: transform 0.08s, background 0.15s, border-color 0.15s; }
.btn:active { transform: scale(0.97); box-shadow: none; background: var(--tint); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-text); box-shadow: none; }
.btn.primary:active { background: var(--accent-dark); border-color: var(--accent-dark); box-shadow: none; }
.btn.small { min-height: 46px; padding: 0 16px; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.45; }
.btn.round { width: 58px; min-width: 58px; min-height: 58px; padding: 0; display: grid; place-items: center; flex: none; }
.btn.pulse { animation: pulse 1.2s ease-in-out 8; box-shadow: 0 0 0 4px var(--glow); }
.link { color: var(--accent-link); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 700; }
.gear { width: 40px; height: 40px; border: 0; border-radius: 13px; background: rgb(255 255 255 / 0.55); color: rgb(20 22 26 / 0.62); display: grid; place-items: center; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.gear svg { width: 22px; height: 22px; }
.gear:active { transform: scale(0.94); background: rgb(255 255 255 / 0.85); }
.controls { gap: 12px; }
.controls .btn.primary { min-height: 60px; font-size: 1.15rem; flex: 1 1 100%; }
#stop[hidden] ~ #photo { display: none; } /* фото задания нужно только во время урока */

/* Вкладки: «таблетка» со светлым фоном, выбранная вкладка белая и приподнята */
.tabs { gap: 4px; margin: 0; padding: 5px; background: #f3eeeb; border-radius: 20px; }
.tab { min-height: 46px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); box-shadow: none; font-weight: 800; }
.tab[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 2px 8px -2px rgb(60 40 30 / 0.18); }

/* Поверхности и поля */
.login, .pform, .task, .child { background: #fff; border: 2px solid var(--line); border-radius: 24px; box-shadow: none; }
.reply, .board, .voice-card, .photo-tray, .access-bar, .listen-bar, .install-help, .pin-box { background: #fff; border: 2px solid var(--line); border-radius: 20px; box-shadow: none; }
.pin-box { border-style: dashed; border-color: var(--accent); }
.login input, .pform input, .pform select, .access-bar input:not([type]), .access-bar input[type="text"], .voice select { border: 2px solid var(--field-border); border-radius: 16px; background: #fff; color: var(--ink); }
.login input:focus, .pform input:focus, .pform select:focus, .voice select:focus, .access-bar input:focus { border-color: var(--accent); outline: 3px solid var(--tint); outline-offset: 0; }
.login { gap: 12px; padding: 18px; }
.login input { border-radius: 18px; }
.check { gap: 12px; align-items: flex-start; color: var(--text); font-size: 0.98rem; }
.check input { flex: none; width: 26px; height: 26px; margin-top: 1px; accent-color: #f48257; }
.hint { color: var(--muted); }

/* Окна */
.books-dialog { border: 0; border-radius: 28px; background: var(--bg); box-shadow: 0 24px 60px -24px rgb(80 50 30 / 0.4); }
.books-box { gap: 14px; padding: 18px; }
.books-head h2 { font-size: 1.4rem; font-weight: 900; }
.books-head .link { display: grid; place-items: center; width: 46px; height: 46px; min-width: 46px; min-height: 46px; padding: 0; border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); text-decoration: none; font-size: 1.1rem; }
.chip { border: 2px solid var(--line); background: #fff; }
.chip.on { background: var(--tint); border-color: var(--accent); color: var(--ink); }
.book-row { border: 2px solid var(--line); border-radius: 18px; background: #fff; }
.book-row.on { outline: 0; background: var(--tint); border-color: var(--accent); }
.install-bar { background: #fff; border-top: 2px solid var(--line); }

/* Настройки: короткие карточки с заголовками */
.settings .panel { gap: 14px; }
.set-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; background: #fff; border: 2px solid var(--line); border-radius: 22px; }
.set-card:has(> #voice-row[hidden]) { display: none; }
.set-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0; font-size: 1.1rem; font-weight: 900; letter-spacing: -0.01em; }
.set-title output { color: var(--muted); font-weight: 800; }
.volume-row { display: grid; grid-template-columns: 52px 1fr 52px; gap: 12px; align-items: center; }
.volume-row .btn.small { width: 52px; min-width: 52px; min-height: 52px; padding: 0; font-size: 1.6rem; line-height: 1; }
.volume-row input[type="range"] { width: 100%; min-width: 0; min-height: 44px; accent-color: #f48257; }
.voice { display: block; min-height: 0; }
.voice select { width: 100%; min-height: 54px; padding: 0 14px; font: inherit; font-weight: 800; }
.book-now { margin: 0; text-align: left; color: var(--muted); }
.who { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: #fff; border: 2px solid var(--line); border-radius: 20px; color: var(--text); }
.who[hidden] { display: none; }
.who-name { font-weight: 900; font-size: 1.05rem; }
.who-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.install { align-self: flex-start; }

.books-box:focus { outline: none; }

.controls #mute { flex: 1 1 100%; }
.controls #stop { flex: 1 1 0; }


/* ===== По макету владельца: тёплый светлый фон без разводов, карточки без рамок с мягкой тенью, крупный заголовок с коралловым подчёркиванием, маленькое лицо с искрами ===== */
:root { --card-shadow: 0 10px 28px -18px rgb(70 45 30 / 0.34), 0 1px 3px rgb(70 45 30 / 0.06); }
body { background: var(--bg); }
.gear { width: 44px; height: 44px; border: 0; border-radius: 16px; background: #fff; color: #8a7165; box-shadow: var(--card-shadow); -webkit-backdrop-filter: none; backdrop-filter: none; }
.gear:active { background: #fff; transform: scale(0.94); }
.app { padding-top: calc(max(12px, env(safe-area-inset-top)) + 56px); }

/* Лицо поменьше, искры у верхнего угла */
.orb { width: min(36vw, 136px); }
.spark { fill: none; stroke: #f08a5d; stroke-width: 6; stroke-linecap: round; }
.orb.listening .spark { animation: spark 0.9s ease-in-out infinite alternate; }
.orb.listening .s2 { animation-delay: 0.15s; }
.orb.listening .s3 { animation-delay: 0.3s; }
.orb.muted .spark { opacity: 0.25; }
@keyframes spark { from { opacity: 0.35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .spark { animation: none !important; } }
.face-shell { stroke-width: 16; }

/* Заголовок вместо мелкой строки состояния */
.stage { gap: 18px; justify-content: flex-start; padding-top: 4px; min-height: 0; flex: 0 0 auto; }
.status.head { margin: 0; color: var(--text); font-size: 1.9rem; line-height: 1.15; font-weight: 800; letter-spacing: -0.01em; }
.status.head::after { content: ""; display: block; width: 132px; height: 12px; margin: 10px auto 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 132 12'%3E%3Cpath d='M3 8 Q 66 1 129 6' fill='none' stroke='%23f08a5d' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.status:not(.head) { font-size: 1rem; }

/* Карточки и кнопки: без рамок, мягкая тень, большие скругления */
.login, .pform, .task, .child, .set-card, .who { border: 0; border-radius: 28px; background: #fff; box-shadow: var(--card-shadow); }
.reply, .board, .voice-card, .photo-tray, .access-bar, .listen-bar, .install-help { border: 0; border-radius: 24px; background: #fff; box-shadow: var(--card-shadow); }
.btn { border: 0; border-radius: 24px; background: #fff; box-shadow: var(--card-shadow); color: var(--text); }
.btn:active { background: #fff7f2; box-shadow: var(--card-shadow); }
.btn.primary { background: var(--accent-strong); color: #fff; box-shadow: none; border-radius: 26px; }
.btn.primary:active { background: #d2602f; box-shadow: none; }
.controls .btn.primary { min-height: 60px; font-size: 1.2rem; }
.login input, .pform input, .pform select, .voice select, .access-bar input:not([type]), .access-bar input[type="text"] { border: 2px solid #ece4df; border-radius: 22px; background: #fffdfb; }
.login { padding: 20px; }
.login label { font-size: 1.15rem; font-weight: 900; }
.login .hint { color: var(--muted); font-size: 0.95rem; }
.login input::placeholder { color: #9a918b; }
.tabs { background: #efe9e4; }
.books-dialog { background: var(--bg); }
.books-head .link { border: 0; background: #fff; box-shadow: var(--card-shadow); }
.link { color: #b4471f; }
#no-password { font-size: 0.95rem; font-weight: 600; padding: 0; min-height: 40px; }
.login .btn.primary { min-height: 56px; }

/* Ползунок громкости: светлая дорожка и круглый коралловый бегунок */
.volume-row input[type="range"] { -webkit-appearance: none; appearance: none; height: 44px; background: transparent; accent-color: #e8703f; }
.volume-row input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 6px; background: #ece3dd; }
.volume-row input[type="range"]::-moz-range-track { height: 8px; border-radius: 6px; background: #ece3dd; }
.volume-row input[type="range"]::-moz-range-progress { height: 8px; border-radius: 6px; background: #f08a5d; }
.volume-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -10px; border: 0; border-radius: 50%; background: #e8703f; box-shadow: 0 2px 8px -2px rgb(70 45 30 / 0.5); }
.volume-row input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #e8703f; box-shadow: 0 2px 8px -2px rgb(70 45 30 / 0.5); }


/* ===== Настройки по макету: строки со значками, переключатель, ползунок со звуковыми значками, коралловая вкладка ===== */
.tab[aria-selected="true"] { background: #ee9a74; color: #2a1d17; box-shadow: none; }
.books-head h2 { font-weight: 800; }
.set-title { font-weight: 800; }
.set-card { gap: 10px; padding: 20px; }

.volume-row { grid-template-columns: 34px 1fr 34px; gap: 10px; }
.vol-icon { width: 34px; height: 44px; padding: 0; border: 0; background: transparent; color: #8a7165; display: grid; place-items: center; cursor: pointer; }
.vol-icon:active { color: #e8703f; }
.volume-row input[type="range"] { height: 36px; }
.volume-row input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 4px; background: linear-gradient(to right, #ea8f69 var(--fill, 50%), #ece3dd var(--fill, 50%)); }
.volume-row input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -8px; background: #ea8f69; box-shadow: none; }
.volume-row input[type="range"]::-moz-range-track { height: 6px; background: #ece3dd; }
.volume-row input[type="range"]::-moz-range-progress { height: 6px; background: #ea8f69; }
.volume-row input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; background: #ea8f69; box-shadow: none; }

.set-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; text-align: left; color: var(--text); font: inherit; cursor: pointer; }
.set-row:active { background: transparent; opacity: 0.7; transform: none; }
.row-icon { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: #b8603f; }
.row-icon.tinted { background: #fdece3; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-text b { font-weight: 800; font-size: 1.05rem; }
.row-text small { color: var(--muted); font-size: 0.9rem; font-weight: 500; }
.row-chev { flex: none; color: #8a7165; }
.link-row .row-text { color: #b4471f; font-weight: 800; font-size: 1.05rem; }
.set-sep { height: 1px; margin: 2px 0; background: #efe8e3; }
.switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 52px; height: 32px; margin: 0; border-radius: 16px; background: #e6e0dc; cursor: pointer; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.25); transition: transform 0.2s; }
.switch:checked { background: #ee9a74; }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Круглая кнопка «ещё ниже» внизу окна настроек */
.settings { position: fixed; }
.more-btn { position: absolute; left: 50%; bottom: 14px; z-index: 5; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; background: #14161a; color: #fff; display: grid; place-items: center; transform: translateX(-50%); box-shadow: 0 6px 16px -6px rgb(0 0 0 / 0.5); cursor: pointer; }


/* ===== Экран урока по макету: шапка «Предмет · Задание N», карточка задания со сворачиванием, статус с точкой, подсказка, кнопка «Говорить» ===== */
.lesson-bar { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-top: -48px; padding-right: 56px; }
.lesson-bar[hidden] { display: none; }
.lesson-ico { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 15px; background: #fff; color: #b8603f; box-shadow: var(--card-shadow); }
.lesson-title { font-size: 1.05rem; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.task { padding: 18px 20px; }
.task-meta { color: #a8664a; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.task-text { margin-top: 8px; font-size: 1.15rem; font-weight: 600; line-height: 1.45; }
.task-toggle { display: flex; align-items: center; gap: 6px; margin: 10px 0 0 auto; padding: 6px 0 0; border: 0; background: transparent; color: #a8664a; font: inherit; font-size: 0.95rem; font-weight: 700; cursor: pointer; }
.task.collapsed .task-text, .task.collapsed .task-photo, .task.collapsed .task-audio { display: none; }
.task.collapsed .task-toggle svg { transform: rotate(180deg); }

/* В уроке статус маленький и с точкой, а не крупный заголовок */
.in-lesson .stage { gap: 12px; }
.in-lesson .status.head { font-size: 1.05rem; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.in-lesson .status.head::after { display: none; }
.in-lesson .status::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%; background: #d7cfc9; vertical-align: 0; }
.in-lesson .status.live::before, .in-lesson .status.head::before { background: #7fc29b; }
.lesson-hint { margin: 0; padding: 16px 18px; border-radius: 24px; background: #fff; box-shadow: var(--card-shadow); color: var(--muted); font-size: 0.98rem; text-align: center; }
.lesson-hint[hidden] { display: none; }

/* Кнопки внизу в уроке: камера слева, большая «Говорить» справа, «Закончить урок» ссылкой под ними */
.controls { align-items: center; }
.controls #photo { order: 1; }
.controls #ptt, .controls #mute { order: 2; flex: 1 1 0; min-width: 0; }
.controls #stop { order: 3; flex: 1 1 100%; }
.controls .ptt { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; font-size: 1.2rem; background: #ee9a74; color: #2a1d17; border-radius: 26px; flex: 1 1 0; }
.controls .ptt svg { flex: none; }
.controls .ptt.held { background: #e8703f; color: #fff; transform: scale(0.985); }
.stop-link { padding: 10px; border: 0; background: transparent; color: #a8664a; font: inherit; font-weight: 700; font-size: 1rem; text-align: center; cursor: pointer; }
.stop-link:active { opacity: 0.6; }
.controls .btn.round { border-radius: 20px; }


/* ===== Экран урока (по макету владельца): кнопки прижаты к низу, посередине место под текст задания, «Слушаю тебя» и «Думаю…» таблетками ===== */
.app { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.controls { margin-top: auto; padding-top: 10px; }
.in-lesson .stage { flex: 1 1 auto; justify-content: center; min-height: 190px; }
.lesson-hint { padding: 14px 18px; }

/* Статус-таблетка в уроке */
.in-lesson .status { display: inline-flex; align-items: center; gap: 10px; align-self: center; padding: 8px 18px; border-radius: 999px; background: #f1ece8; color: var(--text); font-size: 1.02rem; font-weight: 800; min-height: 0; }
.in-lesson .status::before { margin-right: 0; flex: none; }
.in-lesson .status[data-mode="listen"] { background: #e3f3e9; }
.in-lesson .status[data-mode="think"] { background: #fbe6da; }
.in-lesson .status[data-mode="listen"]::before { width: 22px; height: 18px; border-radius: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 18'%3E%3Cg fill='%2334b36b'%3E%3Crect x='1' y='5' width='4' height='8' rx='2'/%3E%3Crect x='9' y='1' width='4' height='16' rx='2'/%3E%3Crect x='17' y='4' width='4' height='10' rx='2'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; animation: bars 0.9s ease-in-out infinite alternate; }
.in-lesson .status[data-mode="think"]::before { width: 34px; height: 10px; border-radius: 0; background: radial-gradient(circle at 5px 5px, #ee8f5f 4px, transparent 4.5px) 0 0 / 12px 10px repeat-x; animation: dots 1.1s ease-in-out infinite alternate; }
@keyframes bars { from { transform: scaleY(0.55); } to { transform: scaleY(1); } }
@keyframes dots { from { opacity: 0.35; } to { opacity: 1; } }

/* Кнопка «Говорить»: в покое светлая с контуром, при зажатии залита оранжевым со свечением */
.controls .ptt { background: #fff; color: #e0693a; border: 2px solid #f5c9b4; box-shadow: none; }
.controls .ptt.held { background: #e8703f; border-color: #e8703f; color: #fff; box-shadow: 0 0 0 6px rgb(240 138 93 / 0.22), 0 0 34px 8px rgb(240 138 93 / 0.45); transform: scale(0.99); }
.stop-link { color: #d96a3a; text-decoration: underline; text-underline-offset: 3px; }

/* Мягкое оранжевое сияние вокруг лица, пока ребёнок говорит (без жёстких краёв) */
.orb::before { content: ""; position: absolute; inset: -80%; z-index: 0; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, rgb(246 140 90 / 0.72) 0%, rgb(246 140 90 / 0.66) 40%, rgb(246 140 90 / 0.4) 62%, rgb(246 140 90 / 0.16) 82%, rgb(246 140 90 / 0) 100%); transition: opacity 0.5s ease; }
.orb.tap.listening::before { opacity: 1; transition: opacity 2s ease-out; }
.face-stack { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .orb::before, .in-lesson .status::before { animation: none; transition: none; } }



/* ===== Правки по телефону: кнопка «Начать урок» всегда в видимой нижней части, карточки кабинета не слипаются ===== */
/* Экран урока: задание и схема в своём окне с прокруткой, а робот и кнопки всегда в кадре (длинное задание больше не выталкивает робота вниз).
   Высота окна считается от высоты экрана: на высоком телефоне окно большое, на низком меньше, но не меньше 150px. */
.work { display: contents; }
.in-lesson .work { display: flex; flex-direction: column; gap: 12px; flex: 0 1 auto; min-height: 0; max-height: max(150px, calc(100svh - 470px)); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; padding: 2px; margin: -2px; }
.in-lesson .work > * { flex: none; }
.in-lesson .work:not(:has(> :not([hidden]))) { display: none; }
.in-lesson .work.fade { -webkit-mask-image: linear-gradient(#000 calc(100% - 26px), transparent); mask-image: linear-gradient(#000 calc(100% - 26px), transparent); }
html, body { min-height: 100vh; min-height: 100svh; } /* svh: высота при открытой панели браузера, страница не вылезает за экран */
.app { min-height: 100vh; min-height: 100svh; }
.controls { position: sticky; bottom: 0; z-index: 5; margin-inline: -16px; padding: 12px 16px max(10px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 72%, rgb(249 246 242 / 0)); }
#p-cabinet:not([hidden]) { display: flex; flex-direction: column; gap: 14px; }
#p-cabinet .child { margin-bottom: 0; }
#p-children { display: flex; flex-direction: column; gap: 14px; }


/* ===== Тыкнуть в глаз: он прищуривается; после нескольких тыков лицо сердится и шутит ===== */
.hit { fill: transparent; pointer-events: all; cursor: pointer; }
.face-svg { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.orb .ey.squint { transform: scaleY(0.22); transition: transform 0.1s ease; }
.brow { fill: none; stroke: var(--face-ink); stroke-width: 9; stroke-linecap: round; opacity: 0; transform: translateY(-8px); transition: opacity 0.15s, transform 0.15s; pointer-events: none; }
.orb.angry .brow { opacity: 1; transform: none; }
.orb.angry .ey { transform: scaleY(0.7); }
.orb.joke .mouth { opacity: 1; animation: mouth-flap 0.26s ease-in-out infinite alternate; }
@keyframes mouth-flap { from { transform: scaleY(0.45); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .orb.joke .mouth { animation: none; } }


/* ===== Как в настоящем приложении: без синей подсветки при касании и без выделения подписей на кнопках ===== */
/* Кнопка тестировщика «что не нравится»: неприметная, урок при этом не прерывается */
.book-soon { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip.soon { opacity: 0.55; cursor: default; pointer-events: none; font-size: 0.9rem; }
.tg-box { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 6px; }
.tg-lead { text-align: center; margin: 0 0 6px; }
.pin-opt { margin-top: 4px; }
.pin-opt summary { cursor: pointer; font-size: 0.92rem; color: var(--muted); padding: 6px 0; }
#p-legacy { margin-top: 8px; }
.tg-slot { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 40px; }
.tg-open { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 22px; border-radius: 26px; background: #2aabee; color: #fff; font-weight: 800; text-decoration: none; border: 0; }
.tg-open:not([href]) { opacity: 0.7; }
.tg-wait { text-align: center; margin: 0; }
.tg-phone { font-size: 0.9rem; }
.tg-widget { display: flex; justify-content: center; min-height: 40px; }
#p-tg { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.fb-open { position: fixed; left: max(8px, env(safe-area-inset-left, 0px)); bottom: max(8px, env(safe-area-inset-bottom, 0px)); z-index: 5; width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--text); font-size: 15px; line-height: 1; opacity: 0.3; }
.fb-open:hover, .fb-open:focus-visible { opacity: 0.8; }
.fb-open[hidden] { display: none; }
.fb-dialog { position: fixed; inset: auto 0 max(8px, env(safe-area-inset-bottom, 0px)) 0; margin: 0 auto; width: min(28rem, calc(100vw - 1rem)); padding: 12px; border: 2px solid var(--border); border-radius: 16px; background: var(--bg); color: var(--text); box-shadow: 0 10px 30px -12px rgb(60 40 80 / 0.4); z-index: 20; }
.fb-dialog form { display: flex; flex-direction: column; gap: 8px; }
.fb-dialog label { font-weight: 700; }
.fb-dialog textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); resize: vertical; }
.fb-row { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.fb-note { margin-right: auto; font-size: 0.9rem; opacity: 0.8; }
html, * { -webkit-tap-highlight-color: transparent; }
button, a, summary, label, select, input[type="range"], input[type="checkbox"], .tab, .chip, .book-row, .set-row, .stage, .lesson-bar, .status, .gear {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
button:focus:not(:focus-visible), a:focus:not(:focus-visible), select:focus:not(:focus-visible), summary:focus:not(:focus-visible) { outline: none; }


/* ===== Кабинет родителя: «Аккаунт» одной строкой, карточки детей свёрнуты, внутри вкладки (цвета и стиль прежние) ===== */
.acct { background: #fff; border: 0; border-radius: 28px; box-shadow: var(--card-shadow); }
.acct > summary.who { list-style: none; cursor: pointer; box-shadow: none; border-radius: 28px; min-height: 56px; }
.acct > summary.who::-webkit-details-marker { display: none; }
.acct-open { color: var(--accent-link); font-weight: 800; font-size: 0.95rem; white-space: nowrap; }
.acct-open i { display: inline-block; font-style: normal; transition: transform 0.15s; }
.acct[open] .acct-open i { transform: rotate(180deg); }
.acct-body { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; }
.acct-body .access-bar { box-shadow: none; border: 2px solid var(--line); }
.kid-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 52px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.kid-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kid-name b { font-size: 1.2rem; font-weight: 800; }
.kid-name small { color: var(--muted); font-size: 0.9rem; font-weight: 500; }
.kid-chev { flex: none; color: var(--accent-link); font-weight: 800; transition: transform 0.15s; }
.kid.open .kid-chev { transform: rotate(180deg); }
.kid-body { display: flex; flex-direction: column; gap: 10px; }
.kid-body[hidden], .kid-pane[hidden] { display: none; }
.kid-actions { display: flex; gap: 8px; }
.kid-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; }
.kid-tabs { display: flex; border-bottom: 2px solid var(--line); }
.kid-tab { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 0 2px; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; background: none; color: var(--muted); font: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer; }
.kid-tab.on { color: var(--accent-link); border-bottom-color: var(--accent); font-weight: 800; }
.kid-pane { display: flex; flex-direction: column; gap: 8px; }
.kid-pane .row { display: flex; flex-wrap: wrap; gap: 8px; }
#p-add-open { align-self: stretch; }
.acct-body .who-actions { justify-content: flex-start; gap: 2px 10px; }

/* Экран родителя: тот же Тихон, кнопка и подписанные команды */
body.parent-mode #start, body.parent-mode #mute, body.parent-mode #ptt, body.parent-mode #stop, body.parent-mode #photo, body.parent-mode #lesson-bar, body.parent-mode #work, body.parent-mode #voice-card, body.parent-mode #lesson-hint, body.parent-mode #login, body.parent-mode .mic-box, body.parent-mode #photo-tray, body.parent-mode #settings-open, body.parent-mode #status, body.parent-mode #fb-open { display: none !important; }
.p-back { position: fixed; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); z-index: 20; min-height: 44px; padding: 0 14px; border: 0; border-radius: 16px; background: #fff; color: var(--muted); font: inherit; font-weight: 700; font-size: 0.95rem; cursor: pointer; }
.p-back[hidden], .parent-home[hidden], .p-result[hidden] { display: none; }
.parent-home { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-bottom: 8px; }
.p-heard { margin: 0; text-align: center; font-weight: 700; overflow-wrap: anywhere; }
.voice-cmds { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.voice-cmds li { padding: 4px 10px; background: var(--tint); border-radius: 999px; font-size: 0.85rem; }
.voice-cmds li::before { content: '«'; }
.voice-cmds li::after { content: '»'; }
.voice-type { width: 100%; min-height: 44px; padding: 8px 12px; font: inherit; font-size: 0.95rem; color: var(--text); background: var(--bg); border: 2px solid var(--field-border); border-radius: 14px; }
.p-result { padding-top: 12px; }
.kid-view { gap: 10px; }
.kid-view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Окно «О Тихоне и документы»: открывается из настроек, на главном экране ничего не занимает */
.about-body { display: flex; flex-direction: column; gap: 10px; font-size: 0.95rem; line-height: 1.5; }
.about-body p { margin: 0; }
.about-links { display: flex; flex-direction: column; gap: 6px; }
.about-links a { padding: 10px 14px; background: var(--card); border: 2px solid var(--line); border-radius: 14px; color: var(--ink); font-weight: 700; text-decoration: none; }
.about-links a:hover, .about-links a:focus { border-color: var(--ink); }
.about-meta { color: var(--muted); }
.about-meta a { color: var(--accent-link); }
.age-mark { display: inline-block; margin-left: 8px; padding: 0 6px; border: 1px solid var(--muted); border-radius: 6px; font-weight: 700; }
.age-mark[hidden] { display: none; }

/* Согласия: отдельные отметки, не отмечены заранее */
.consents { display: flex; flex-direction: column; gap: 10px; }
.check, .pform label.check { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; font-size: 0.92rem; line-height: 1.4; }
.check input[type="checkbox"], .pform .check input[type="checkbox"] { flex: none; width: 24px; height: 24px; min-height: 24px; margin: 1px 0 0; padding: 0; accent-color: var(--accent-strong); }
.check a { color: var(--accent-link); }
#p-cabinet.gated > :not(#p-consent-gate) { display: none !important; }
[inert].tg-gated { opacity: 0.45; }

.danger-link { color: var(--danger); }

/* Шутливая плашка внизу: мелко, всегда на виду */
.controls .joke { flex: 1 1 100%; order: 99; margin: 0; padding: 0; color: var(--muted); font-size: 0.68rem; line-height: 1.35; text-align: center; opacity: 0.85; text-wrap: balance; }

/* ===== Тихон (tihon.js): тело и руки — картинки, лицо и движение рисуются в коде ===== */
.tz-view { position: relative; width: 100%; height: 100%; overflow: hidden; container-type: inline-size; touch-action: manipulation; }
.tz-stage { position: absolute; left: 0; width: 640px; height: 640px; top: calc(50% - 349 / 640 * 100cqw); transform-origin: 0 0; }
.tz-stage .tz-layer, .tz-halo { position: absolute; left: 0; top: 0; width: 640px; height: 640px; pointer-events: none; will-change: transform; }
.tz-layer img, .tz-layer svg { position: absolute; left: 0; top: 0; width: 640px; height: 640px; display: block; user-select: none; -webkit-user-drag: none; }
.tz-halo { background: radial-gradient(circle at 320px 360px, rgba(var(--halo, 255, 176, 142), .55), rgba(var(--halo, 255, 176, 142), 0) 190px); }
.tz-layer[data-r="bodyg"] > img { filter: drop-shadow(0 0 0.7px rgba(20, 22, 26, .55)) drop-shadow(0 8px 10px rgba(160, 110, 80, .28)); }
.tz-hand { filter: drop-shadow(0 0 0.7px rgba(20, 22, 26, .5)) drop-shadow(0 4px 6px rgba(160, 110, 80, .3)); }
.tz-hit { position: absolute; left: 206px; top: 264px; width: 228px; height: 170px; border-radius: 58px; pointer-events: auto; cursor: pointer; }
.tz-eyehit { position: absolute; top: 311px; width: 54px; height: 64px; border-radius: 27px; pointer-events: auto; cursor: pointer; }
.tz-bit { position: absolute; pointer-events: none; z-index: 2; }
.color-row { display: flex; gap: 10px; padding-top: 12px; }
/* Выбор цвета: маленькие Тихоны со своими глазками (как мини-талисманы), выбранный обведён */
.tz-sw { flex: 1 1 0; max-width: 64px; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: 28%; cursor: pointer;
  background:
    radial-gradient(ellipse 4.5px 6.5px at 36% 47%, #14141f 96%, transparent 100%),
    radial-gradient(ellipse 4.5px 6.5px at 64% 47%, #14141f 96%, transparent 100%),
    linear-gradient(to bottom, rgb(255 255 255 / .16), rgb(0 0 0 / .05)),
    var(--c);
  box-shadow: 0 2px 6px -2px rgb(60 40 30 / .35); }
.tz-sw[data-tcolor="white"] { box-shadow: inset 0 0 0 2px var(--line), 0 2px 6px -2px rgb(60 40 30 / .25); }
.tz-sw[aria-pressed="true"] { outline: 3px solid var(--accent-strong); outline-offset: 3px; }

/* Страховка вёрстки: оболочка не короче видимой области (dvh), кнопки урока прижаты к низу, шестерёнка всегда поверх */
.app { min-height: 100dvh; }
.controls { margin-top: auto; }
.gear { z-index: 30; }

/* С Тихоном старые ореолы значка не нужны: они шире экрана и раздували страницу вбок (пропадала шестерёнка, появлялось пустое поле) */
.tz-on .orb::before, .tz-on .orb::after { display: none; }
body { overflow-x: clip; }

/* ===== Фото для Тихона: фото на месте значка камеры, его перетаскивают Тихону, он «глотает» и выводит на экран (photo-drop.js) ===== */
.pd-holder { position: relative; flex: none; order: 1; width: 58px; height: 58px; }
#stop[hidden] ~ .pd-holder { display: none; }
.pd-stack { position: absolute; inset: 0; touch-action: none; cursor: grab; border-radius: 20px; -webkit-tap-highlight-color: transparent; outline-offset: 3px; animation: pd-wiggle 2.4s ease-in-out infinite; }
.pd-stack.away { opacity: .25; animation: none; }
.pd-stack img { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); object-fit: cover; border-radius: 14px; border: 2px solid #fff; box-shadow: 0 3px 10px -3px rgb(60 40 30 / .45); pointer-events: none; user-select: none; }
@keyframes pd-wiggle { 0%, 82%, 100% { transform: rotate(0); } 88% { transform: rotate(-4deg); } 94% { transform: rotate(4deg); } }
.pd-x, .pd-plus { position: absolute; width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%; border: 0; background: #fff; color: var(--muted); font: 700 14px/26px inherit; text-align: center; box-shadow: 0 1px 6px rgb(60 40 30 / .3); cursor: pointer; z-index: 5; }
.pd-x { top: -9px; right: -9px; }
.pd-plus { bottom: -9px; right: -9px; color: var(--accent-link); font-size: 18px; }
.pd-hint { position: absolute; bottom: 68px; left: 0; padding: 6px 10px; border-radius: 12px; background: #14161a; color: #fff; font: 700 .8rem/1.1 inherit; white-space: nowrap; pointer-events: none; animation: pd-bob 1.4s ease-in-out infinite; }
.pd-hint::after { content: ""; position: absolute; left: 20px; bottom: -5px; border: 6px solid transparent; border-top-color: #14161a; border-bottom: 0; }
@keyframes pd-bob { 50% { transform: translateY(-4px); } }
.pd-fly, .pd-out { position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; border-radius: 18px; will-change: transform; }
.pd-fly { box-shadow: 0 10px 22px -6px rgb(60 40 30 / .5); }
.pd-fly img { width: 100%; height: 100%; object-fit: cover; border-radius: 18px; border: 3px solid #fff; display: block; }
.pd-out { box-shadow: 0 10px 24px -8px rgb(60 40 30 / .45); transform-origin: 0 0; }
.pd-out img { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; border: 2px solid var(--border); background: #fff; display: block; }
.pd-progress { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 6px 14px; border-radius: 14px; background: #fff; box-shadow: var(--card-shadow); font: 700 .8rem/1 inherit; color: var(--muted); transition: opacity .3s; z-index: 6; }
.pd-progress i { display: block; width: 120px; height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--accent-strong) 0 0) left / 0% 100% no-repeat, #efe8e4; animation: pd-fill .65s ease-out forwards; }
.pd-progress.fade { opacity: 0; }
@keyframes pd-fill { to { background-size: 100% 100%; } }
@media (prefers-reduced-motion: reduce) { .pd-stack, .pd-hint { animation: none; } }

/* Нет согласий: отметки встряхиваются и обводятся, чтобы было видно, что нужно сделать */
.consents.nudge { animation: nudge .6s ease; outline: 3px solid var(--accent-strong); outline-offset: 6px; border-radius: 14px; }
@keyframes nudge { 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .consents.nudge { animation: none; } }

/* Переключаемый фон (настройки → «Фон»): только на телефоне (вертикальный экран). На компьютере (широкий экран) всегда обычный фон, блок «Фон» в настройках скрыт. */
@media (max-aspect-ratio: 1 / 1) {
  html.bg-img { background: var(--bg-edge, #f3ece6); }
  html.bg-img body { background: transparent; }
  html.bg-img::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background-repeat: no-repeat; background-position: center top; background-size: cover; background-image: var(--bg-url); }
  html.bg-img .controls { background: none; } /* без светлой полосы снизу: картинка идёт до самого низа */
  /* Тема под каждый фон: цвет текста прямо на картинке, акцент кнопок и оттенок карточек подобраны под палитру картинки */
  html.bg-img { --onbg: #4a2a18; --onbg-glow: 0 0 6px rgb(255 246 235 / .9), 0 0 2px rgb(255 246 235 / .9); }
  html.bg-img .status, html.bg-img .lesson-title, html.bg-img .stop-link, html.bg-img .joke { color: var(--onbg); text-shadow: var(--onbg-glow); opacity: 1; }
  html.bg-img .in-lesson .status { color: var(--text); text-shadow: none; }
  html[data-bg-theme="room"] { --onbg: #5a2e14; --card: #fffaf5; --tint: #fdeadc; }
  html[data-bg-theme="library"] { --onbg: #fff3e0; --onbg-glow: 0 1px 6px rgb(50 25 5 / .85), 0 0 2px rgb(50 25 5 / .9); --accent: #e08a3c; --accent-strong: #c9742a; --accent-dark: #a85a1c; --accent-link: #8a4512; --glow: #f0b27a; --tint: #fbecd8; --card: #fffaf2; --line: #f0e0cc; --border: #f0e0cc; }
  html[data-bg-theme="pink"] { --onbg: #6a2a55; --accent: #ee6ea3; --accent-strong: #e0568f; --accent-dark: #c23f77; --accent-link: #a02f63; --glow: #f7a8c9; --tint: #fde6f1; --card: #fffafd; --line: #f3d9e6; --border: #f3d9e6; }
  html[data-bg-theme="blue"] { --onbg: #ffffff; --onbg-glow: 0 1px 6px rgb(8 18 60 / .85), 0 0 2px rgb(8 18 60 / .9); --accent: #f59a40; --accent-strong: #e2751f; --accent-dark: #bf5d10; --accent-link: #a8500c; --glow: #ffc58a; --tint: #e6f0ff; --card: #f8fbff; --line: #d5e3f5; --border: #d5e3f5; }
  html[data-bg-theme="space"] { --onbg: #ffffff; --onbg-glow: 0 1px 6px rgb(18 8 60 / .9), 0 0 2px rgb(18 8 60 / .9); --accent: #8a74ff; --accent-strong: #6f55e8; --accent-dark: #5a41c9; --accent-link: #5237b8; --glow: #b7a6ff; --tint: #ece8ff; --card: #f9f7ff; --line: #ddd6f5; --border: #ddd6f5; }
  html[data-bg-theme="night"] { --onbg: #fff3dc; --onbg-glow: 0 1px 6px rgb(14 8 40 / .9), 0 0 2px rgb(14 8 40 / .9); --accent: #f0983c; --accent-strong: #de7a22; --accent-dark: #b9600f; --accent-link: #9a4d0a; --glow: #ffc98a; --tint: #fdeed9; --card: #fbf8ff; --line: #e4dcf0; --border: #e4dcf0; }
}
/* «Синяя 3D»: три слоя (дальний, средний, ближний) смещаются с разной скоростью от наклона телефона или касания: лёгкий эффект глубины */
#bg3d { display: none; }
@media (max-aspect-ratio: 1 / 1) {
  html.bg-3d #bg3d { display: block; position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
  #bg3d i { position: absolute; inset: -6%; background-size: cover; background-position: center top; background-repeat: no-repeat; transform: translate3d(calc(var(--tx, 0) * var(--k) * 1px), calc(var(--ty, 0) * var(--k) * 0.6px), 0); will-change: transform; }
  #bg3d .l0 { background-image: url(bg/blue3d-far.webp); --k: 5; }
  #bg3d .l1 { background-image: url(bg/blue3d-mid.webp); --k: 13; }
  #bg3d .l2 { background-image: url(bg/blue3d-near.webp); --k: 24; }
}
@media (min-aspect-ratio: 1 / 1) { .set-card[aria-labelledby="set-bg"] { display: none; } }
.bg-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; }
.bg-sw { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--text); font: 700 0.85rem var(--font); cursor: pointer; }
.bg-thumb { width: 100%; aspect-ratio: 3 / 4; border-radius: 16px; box-shadow: inset 0 0 0 2px var(--line); background-size: cover; background-position: center; }
.bg-thumb-default { background: radial-gradient(70% 60% at 100% 0%, #f3dcf3, transparent 65%), radial-gradient(70% 60% at 0% 20%, #dcecfb, transparent 65%), radial-gradient(70% 60% at 100% 100%, #ffe8cc, transparent 65%), #f9f6f2; }
.bg-sw[aria-pressed="true"] .bg-thumb { outline: 3px solid var(--accent-strong); outline-offset: 3px; }

/* Вкладка «Разработчик» */
.dev-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 700; }
.dev-field textarea { width: 100%; min-height: 96px; padding: 12px 14px; border: 3px solid var(--field-border); border-radius: 16px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.dev-field input[type="range"] { width: 100%; accent-color: var(--accent-strong); }
#dev-go { width: 100%; }
.dev-field input[type="text"] { width: 100%; min-height: 52px; padding: 0 14px; border: 3px solid var(--field-border); border-radius: 16px; background: var(--bg); color: var(--text); font: inherit; }
#dev-fix-add { width: 100%; }
.dev-fixes { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.dev-fixes li { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; border-radius: 12px; background: var(--tint); font-weight: 700; }

/* Картинка задания из учебника, под условием */
.task-pic { display: block; width: 100%; max-height: 42vh; object-fit: contain; margin-top: 10px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); }

/* Плашка подписки: Тихон, название, цена, согласие, кнопка */
.sub-card { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 20px 18px; text-align: center; background: var(--card); border: 3px solid var(--border); border-radius: 22px; }
.sub-face { position: relative; align-self: center; width: 74px; height: 52px; background: #fff; border: 1px solid var(--field-border); border-radius: 20px; box-shadow: 0 4px 0 rgb(0 0 0 / .05); }
.sub-face i { position: absolute; display: block; }
.sub-face .e { top: 16px; width: 6px; height: 13px; border-radius: 50%; background: var(--face-ink); }
.sub-face .e.l { left: 21px; } .sub-face .e.r { right: 21px; }
.sub-face .c { top: 33px; width: 12px; height: 6px; border-radius: 50%; background: #f7b4c0; }
.sub-face .c.l { left: 8px; } .sub-face .c.r { right: 8px; }
.sub-title { font-size: 1.15rem; font-weight: 800; }
.sub-price { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.sub-new { font-size: 2.1rem; font-weight: 800; line-height: 1; }
.sub-per { color: var(--muted); font-size: 0.95rem; font-weight: 700; }
.sub-pay { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 2px solid var(--line); }
.sub-pay .check { text-align: left; font-size: 0.85rem; }
.sub-btn { width: 100%; }
.sub-note { margin: 0; color: var(--muted); font-size: 0.8rem; }
.access-bar.has-sub { padding: 0; border: 0; background: none; }
.dev-emo { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.dev-emo-head { margin-top: 8px; color: var(--muted); font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.dev-emo-row { display: flex; flex-wrap: wrap; gap: 6px; }
.dev-chip { min-height: 38px; padding: 0 12px; border: 2px solid var(--field-border); border-radius: 999px; background: var(--card); color: var(--text); font: 700 0.9rem var(--font); cursor: pointer; }
.dev-chip[aria-pressed="true"] { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-text); }
.dev-together { margin: 4px 0 12px; }
.dev-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.dev-actions .btn { flex: 1; }

/* Чистый экран разработчика: во время озвучки скрыто всё, кроме Тихона (место не меняется, интерфейс плавно гаснет) */
.app > *, .stage .status, .install-bar { transition: opacity .25s; }
html.dev-clean .app > *:not(.stage), html.dev-clean .stage .status, html.dev-clean .install-bar { opacity: 0 !important; pointer-events: none !important; }
.controls .site-links { flex: 1 1 100%; order: 100; margin: 0; padding: 0; color: var(--muted); font-size: 0.68rem; text-align: center; }
.controls .site-links a { color: inherit; }
html.bg-img .site-links { color: var(--onbg); text-shadow: var(--onbg-glow); }
