/* Стили Mini App «Понятно» (/app).
   Job: подключён production 3D asset-pack (static/assets/production/,
   см. assets_manifest.json) — карточки/иконки/маскот используют
   финальные WebP-изображения без emoji и placeholder SVG.

   Job: action-карточки/role-кнопки/мотивационные chips переведены на
   "standalone 3D-ярлык" — самостоятельный ассет сверху (мягкий
   радиальный halo вместо жёсткой рамки-бейджа) и подпись HTML-текстом
   снизу, без ощущения белой кнопки-прямоугольника. Кликабельная зона
   остаётся почти невидимой в покое — лёгкая подсветка только на
   :active. Сами `.card`/`.role-btn` DOM-хуки и data-атрибуты для
   app.js не переименовывались.

   Job: hero mascot получил больше верхнего воздуха (не обрезается),
   3D-ярлыки action/role/motivation увеличены на ~35-40% относительно
   предыдущего размера, а padding у `.card`/`.role-btn` уменьшен, чтобы
   не воссоздавать белую кнопку-рамку вокруг выросшей иконки.

   Job: главные action-ярлыки/роли/мотивация переведены с card-based
   DOM (`.card.action`, `.role-btn`, `.card.stat`) на новые standalone
   классы `.shortcut-grid`/`.shortcut-item`/`.shortcut-visual`/
   `.shortcut-title`/`.shortcut-subtitle`, `.role-shortcuts`/
   `.role-shortcut`, `.motivation-shortcuts`/`.motivation-shortcut` —
   asset увеличен до ~104px (96-120px), фон/рамка отсутствуют,
   стрелок не было и не появилось. Общий `.card`/`.icon-badge`/`.label`
   остаётся только для `studentView` (`.card.student-action`),
   вне скоупа этого fix.

   Job: по live-скрину после подключения asset-pack v1 экран главного
   /app ощущался слишком "воздушным" — уплотнены вертикальные отступы
   и размеры hero/role-shortcuts/level-strip/shortcut-grid/motivation-
   shortcuts (~25-35% меньше пустот), без изменения WebP assets,
   standalone-модели ярлыков (no white card/no arrow) или бизнес-
   логики.

   Job: balanced compact — после уплотнения выше 3D-ярлыки/текст стали
   мелковаты, а desktop phone-frame — тесным. Точечно возвращён
   читаемый размер: hero mascot 96→112px, `.shortcut-visual` (action)
   100→116px/img 82→96px (~17%), `.role-shortcut .shortcut-visual`
   88→98px/img 72→80px, motivation-визуал 54→60px/img 36→42px,
   `.shortcut-title`/`.shortcut-subtitle`/motivation-текст чуть крупнее;
   desktop `.phone-frame` 412→448px. Межблочные отступы (role-block/
   level-strip/motivation-grid) не тронуты, только hero/mascot-wrap
   margin слегка подрезан (4→3px, 2→0px) под выросший маскот;
   standalone-модель (no white card/no arrow) и бизнес-логика — без
   изменений.

   Job: финальное уплотнение mobile /app после asset-pack v1 — hero
   переведён с вертикального стека на строку (`.hero-top`: mascot
   112→80px слева + `.hero-text` с brand/slogan справа, `.subtitle`
   отдельной строкой ниже), что снижает высоту hero-зоны на ~40% без
   потери видимости маскота; mvp-badge уменьшен и приглушён
   (opacity 0.82), не первый визуальный фокус. role-shortcuts подтянуты
   к hero (margin 6→3px), внутренний gap картинка/подпись сжат
   (3+3px→1px). level-strip ниже и легче (padding/margin/тени урезаны,
   badge 28→24px). shortcut-grid/motivation-shortcuts — вертикальные
   gap/margin уменьшены, подписи ближе к ярлыкам; размеры action/role
   3D-ярлыков не менялись (читаемость сохранена по ТЗ). Без изменений
   WebP assets, standalone-модели (no white card/no arrow) и
   бизнес-логики.

   Job: compact mobile layout добит после BLOCKED_TECHNICAL — верхний
   отступ `.container` под шапкой MAX сокращён (16→12px сверх
   safe-area-inset-top), back-button блок (`.student-topbar`) и hero
   (`.hero-top`/`.subtitle`) подтянуты ближе друг к другу; на taskView/
   explainView `.task-grade`/`.subject-select`/`.subject-btn`/
   `.task-mascot-wrap`/`.intake-shortcuts`/`.task-textarea` уплотнены,
   чтобы textarea оказалась выше без лишнего скролла; на studentView
   уплотнены `.student-hero`/`.student-mascot-wrap`/`.grade-select`/
   `.profile-status-text`. Размеры 3D-ярлыков (`.shortcut-visual`,
   `.intake-shortcut .shortcut-visual`), тёмный phone-frame, WebP assets
   и standalone-модель (no white card/no arrow) не менялись. */
:root {
  color-scheme: light;
  --bg-top: #EEF2FF;
  --bg-bottom: #FDF2F8;
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --primary-soft: #818CF8;
  --accent: #F59E0B;
  --pink: #F472B6;
  --green: #22C55E;
  --text: #1E1B2E;
  --muted: #6B7280;
  --card-bg: #FFFFFF;
  --radius: 20px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  color: var(--text);
  /* top safe-area уже учтён в `.container` padding-top — не дублируем его
     здесь, иначе в MAX WebView (где env(safe-area-inset-top) не равен 0)
     верхний отступ удваивается и контент проваливается вниз. */
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
.page {
  display: flex;
  justify-content: center;
}
.phone-frame {
  width: 100%;
}
.phone-screen {
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 18px 14px;
  position: relative;
}
.badge-row {
  display: flex;
  justify-content: center;
  margin-bottom: 2px;
}
.mvp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--primary-dark);
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.18);
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  opacity: 0.82;
}
.hero {
  text-align: center;
  margin-bottom: 2px;
  position: relative;
}
.hero-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.hero-text {
  text-align: left;
}
.mascot-wrap {
  width: 80px;
  height: 80px;
  margin: 0;
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}
.mascot-halo {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.45) 0%, rgba(129, 140, 248, 0) 70%);
}
.mascot {
  width: 80px;
  height: 80px;
  position: relative;
  object-fit: contain;
  filter: drop-shadow(0 16px 20px rgba(79, 70, 229, 0.32));
  animation: bob 3.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1deg); }
}
.brand {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--pink) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.slogan {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}
.subtitle {
  font-size: 11px;
  color: var(--muted);
  margin: 2px 0 0;
  line-height: 1.25;
}
.role-shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 3px 0 3px;
}
.role-shortcut {
  appearance: none;
  border: none;
  background: none;
  box-shadow: none;
  border-radius: 0;
  padding: 2px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.role-shortcut:active {
  transform: scale(0.95);
  opacity: 0.85;
}
.role-shortcut .shortcut-visual {
  width: 98px;
  height: 98px;
  margin-bottom: 0;
}
.role-shortcut .shortcut-visual::before {
  background: radial-gradient(circle, rgba(129, 140, 248, 0.34) 0%, rgba(129, 140, 248, 0) 72%);
}
.role-shortcut.parent .shortcut-visual::before {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.34) 0%, rgba(245, 158, 11, 0) 72%);
}
.role-shortcut .shortcut-visual img {
  width: 80px;
  height: 80px;
}
.role-shortcut .shortcut-title {
  color: var(--primary-dark);
}
.role-shortcut.parent .shortcut-title {
  color: #B45309;
}
section {
  margin-top: 6px;
}
.section-title {
  font-size: 13px;
  font-weight: 800;
  margin: 0 0 3px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}
.card {
  position: relative;
  background: none;
  border: none;
  border-radius: 20px;
  padding: 6px 4px;
  box-shadow: none;
  cursor: pointer;
  user-select: none;
  overflow: visible;
  transition: transform 0.12s ease, background 0.12s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.card:active {
  transform: scale(0.95);
  background: rgba(79, 70, 229, 0.06);
}
.card .icon-badge {
  position: relative;
  width: 82px;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  flex: 0 0 auto;
}
.card .icon-badge::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.28) 0%, rgba(129, 140, 248, 0) 72%);
}
.card .icon-badge img {
  position: relative;
  z-index: 1;
  width: 54px;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(30, 27, 46, 0.22));
}
.card .label {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
}

/* Standalone 3D-ярлыки главных действий (`.shortcut-item`) и ролей
   (`.role-shortcut`, стили выше): большой asset + мягкий radial halo
   вместо белой плитки-кнопки, подпись HTML-текстом снизу, кликабельная
   зона почти невидима в покое (только едва заметный scale/opacity на
   :active — без прямоугольной подложки и без стрелки). */
.shortcut-item {
  position: relative;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 2px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, opacity 0.12s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.shortcut-item:active {
  transform: scale(0.95);
  opacity: 0.85;
}
.shortcut-visual {
  position: relative;
  width: 116px;
  height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  flex: 0 0 auto;
}
.shortcut-visual::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.28) 0%, rgba(129, 140, 248, 0) 72%);
}
.shortcut-visual img {
  position: relative;
  z-index: 1;
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(30, 27, 46, 0.24));
}
.shortcut-item.c1 .shortcut-visual::before { background: radial-gradient(circle, rgba(129, 140, 248, 0.32) 0%, rgba(129, 140, 248, 0) 72%); }
.shortcut-item.c2 .shortcut-visual::before { background: radial-gradient(circle, rgba(245, 158, 11, 0.3) 0%, rgba(245, 158, 11, 0) 72%); }
.shortcut-item.c3 .shortcut-visual::before { background: radial-gradient(circle, rgba(34, 197, 94, 0.3) 0%, rgba(34, 197, 94, 0) 72%); }
.shortcut-item.c4 .shortcut-visual::before { background: radial-gradient(circle, rgba(244, 114, 182, 0.32) 0%, rgba(244, 114, 182, 0) 72%); }
.shortcut-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
}
.shortcut-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
  margin-top: 1px;
}

/* Плашка «Профиль» и ярлыки «Разобрать ошибку»/«Выучить стих» (c5/c6, см.
   #mainProfileShortcut/`.shortcut-item.action.c5`/`.c6` в templates.py) —
   отдельный компактный ряд под сеткой учебных действий, тот же standalone
   `.shortcut-item`-паттерн (переносится на вторую строку при нехватке
   ширины); «Профиль» не участвует в XP/confetti-реакциях
   `.shortcut-item.action`. */
.profile-shortcut-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
  margin-top: 4px;
}
.shortcut-item.c5 .shortcut-visual::before { background: radial-gradient(circle, rgba(56, 189, 248, 0.3) 0%, rgba(56, 189, 248, 0) 72%); }
.shortcut-item.c6 .shortcut-visual::before { background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, rgba(168, 85, 247, 0) 72%); }

/* Мотивационные chips (Очки/Серия/Бейджи/Прогресс): компактный
   standalone-ярлык, asset сверху + число/название снизу, без крупного
   пустого белого прямоугольника. */
.motivation-shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 6px;
}
.motivation-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  padding: 1px;
}
.motivation-shortcut .shortcut-visual {
  width: 54px;
  height: 54px;
  margin-bottom: 1px;
}
.motivation-shortcut .shortcut-visual::before {
  inset: -6px;
}
.motivation-shortcut .shortcut-visual img {
  width: 38px;
  height: 38px;
}
.motivation-value {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.15;
}
.motivation-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
}
.progress-bar {
  margin-top: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.12);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(30, 27, 46, 0.08);
}
.progress-bar .fill {
  height: 100%;
  width: 16%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green) 0%, var(--primary-soft) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.level-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(165deg, #FFFFFF 0%, #F3F1FE 100%);
  border: 1px solid rgba(79, 70, 229, 0.08);
  border-radius: 13px;
  padding: 5px 9px;
  margin: 4px 0 3px;
  box-shadow: 0 4px 10px rgba(30, 27, 46, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.level-strip .level-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(150deg, #FDE68A 0%, var(--accent) 100%);
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.7), 0 4px 8px rgba(217, 119, 6, 0.3);
  flex: 0 0 auto;
  overflow: hidden;
}
.level-strip .level-badge img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}
.level-strip .level-info {
  flex: 1 1 auto;
  min-width: 0;
}
.level-strip .level-title {
  font-size: 11.5px;
  font-weight: 800;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.level-strip .progress-bar {
  margin-top: 0;
}
.pop {
  position: absolute;
  top: 8px;
  right: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #EA580C 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(-6px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(234, 88, 12, 0.35);
}
.pop.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.confetti-piece {
  position: fixed;
  border-radius: 2px;
  pointer-events: none;
  z-index: 90;
  animation: confetti-pop 750ms ease-out forwards;
}
@keyframes confetti-pop {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.6); opacity: 0; }
}
footer {
  text-align: center;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.student-view[hidden],
.task-view[hidden],
.parent-view[hidden] {
  display: none;
}
/* `.role-shortcuts` (roleGate) и `.role-shortcut` задают свой `display`
   безусловно (grid/flex, см. правила выше) — как и у `.container` для
   student-/task-/parent-view, обычный `[hidden]` без этого правила
   перекрывается и элемент остаётся видимым несмотря на JS
   `roleGate.hidden = true` (см. updateRoleGateVisibility в app.js). */
#roleGate[hidden],
.role-shortcut[hidden] {
  display: none;
}
.student-topbar {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}
.back-btn {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 999px;
  padding: 7px 14px 7px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  background: rgba(79, 70, 229, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.back-btn:active {
  transform: scale(0.96);
}
.back-arrow {
  font-size: 15px;
  line-height: 1;
}
.student-hero {
  text-align: center;
  margin-bottom: 8px;
}
.student-mascot-wrap {
  width: 88px;
  height: 88px;
  margin: 0 auto 6px;
}
.student-mascot {
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(79, 70, 229, 0.28));
}
.student-title {
  font-size: 19px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.student-subtitle {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.3;
}
.grade-select {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin: 8px 0;
}
.grade-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: 12px;
  background: #FFFFFF;
  color: var(--primary-dark);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  padding: 9px 0;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.grade-btn:active {
  transform: scale(0.94);
}
.grade-btn.selected {
  background: linear-gradient(150deg, var(--primary-soft) 0%, var(--primary) 55%, var(--primary-dark) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
}
.student-actions {
  margin-top: 4px;
}
.card.student-action {
  width: 100%;
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.task-mascot-wrap {
  width: 44px;
  height: 44px;
  margin: 0 auto 3px;
}
.task-mascot {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(79, 70, 229, 0.28));
}
.task-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 2px;
  color: var(--text);
  letter-spacing: -0.01em;
  text-align: center;
}
.task-grade {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 4px;
  text-align: center;
}
.task-grade .value {
  color: var(--primary-dark);
}
.task-mode-badge {
  width: 36px;
  height: 36px;
  margin: 0 auto 2px;
}
.task-mode-badge img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(30, 27, 46, 0.22));
}
.task-lead {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 6px;
  text-align: center;
}
.task-intake-title {
  justify-content: center;
  margin: 0 0 6px;
}
/* Способы постановки задания в taskView — главный визуальный блок
   экрана: тот же standalone 3D-ярлык-паттерн, что и `.shortcut-item`
   (без белой карточки-рамки и без стрелок), укрупнён под ряд из трёх
   пунктов, чтобы быть заметнее старого card-based UI. */
.intake-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin: 0 0 4px;
}
/* taskView — единственный экран с 4 способами постановки задания
   («Ввести текстом»/«Надиктовать»/«Сфотографировать»/«Загрузить фото»,
   см. templates.py `#intakeShortcuts`) — остальные экраны (explainView/
   checkView/missedView/mistakeView/poemView) сохраняют 3 колонки. */
#intakeShortcuts {
  grid-template-columns: repeat(4, 1fr);
}
.intake-shortcut {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 2px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, opacity 0.12s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.intake-shortcut:active {
  transform: scale(0.95);
  opacity: 0.85;
}
.intake-shortcut .shortcut-visual {
  width: 44px;
  height: 44px;
  margin-bottom: 1px;
}
.intake-shortcut .shortcut-visual::before {
  inset: -4px;
}
.intake-shortcut .shortcut-visual img {
  width: 30px;
  height: 30px;
}
.intake-shortcut .shortcut-title {
  font-size: 11.5px;
  line-height: 1.2;
}
#intakeShortcuts .shortcut-visual {
  width: 38px;
  height: 38px;
}
#intakeShortcuts .shortcut-visual img {
  width: 26px;
  height: 26px;
}
#intakeShortcuts .shortcut-title {
  font-size: 10px;
  line-height: 1.15;
}
/* Активный способ ввода — мягкая подсветка halo/подписи, без белой
   карточки-кнопки вокруг ярлыка (см. app.js setActiveIntakeShortcut). */
.intake-shortcut.is-active .shortcut-visual::before {
  background: radial-gradient(circle, rgba(79, 70, 229, 0.42) 0%, rgba(79, 70, 229, 0) 72%);
}
.intake-shortcut.is-active .shortcut-title {
  color: var(--primary-dark);
}
/* Голосовой ввод слушает (см. app.js `startVoiceInput` — toggles
   aria-pressed на #intakeVoiceBtn/#explainVoiceBtn во время
   распознавания речи). */
.intake-shortcut[aria-pressed="true"] .shortcut-visual::before {
  background: radial-gradient(circle, rgba(220, 38, 38, 0.5) 0%, rgba(220, 38, 38, 0) 72%);
  animation: reply-mic-pulse 1.1s ease-in-out infinite;
}
.subject-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 8px;
}
/* `.subject-select` задаёт `display: grid` безусловно — тот же паттерн,
   что и у `.student-view[hidden]`/`#roleGate[hidden]` выше: без отдельного
   `[hidden]`-правила скрытый taskView #subjectSelect (см. app.js
   submitTaskText/renderSubjectButtons) остаётся видимым несмотря на
   `hidden` атрибут. */
.subject-select[hidden] {
  display: none !important;
}
.subject-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: 12px;
  background: #FFFFFF;
  color: var(--primary-dark);
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  padding: 7px 4px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.subject-btn:active {
  transform: scale(0.94);
}
.subject-btn.selected {
  background: linear-gradient(150deg, var(--primary-soft) 0%, var(--primary) 55%, var(--primary-dark) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
}
.task-textarea {
  display: block;
  width: 100%;
  min-height: 140px;
  border-radius: 16px;
  border: 1px solid rgba(79, 70, 229, 0.18);
  background: #FFFFFF;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
  margin: 0 0 8px;
}
.task-textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.task-submit-btn {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 11px 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(150deg, var(--primary-soft) 0%, var(--primary) 55%, var(--primary-dark) 100%);
  box-shadow: 0 8px 14px rgba(79, 70, 229, 0.3);
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.task-submit-btn:active {
  transform: scale(0.97);
}
.task-submit-btn:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}
/* `.task-submit-btn` объявляет свой `display: block` в author-стилях,
   что перебивает UA-правило `[hidden] { display: none }` (см. app.js
   showTaskStage — прячет taskSubmitBtn на стадиях chooser/selected,
   чтобы не показывать его одновременно с analyzeSelectedBtn) — без
   этого правила кнопка осталась бы видимой несмотря на атрибут hidden. */
.task-submit-btn[hidden] {
  display: none;
}
/* Компактное подтверждение автоматически определённого предмета —
   заменяет ручной выбор предмета заранее (см. app.js submitTaskText,
   templates.py taskView #taskSubjectChip). */
.subject-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.08);
}
/* `.subject-chip` задаёт `display: flex` безусловно — тот же паттерн, что
   и у `.subject-select` выше: без отдельного `[hidden]`-правила скрытый
   #taskSubjectChip (до определения предмета, см. app.js submitTaskText)
   остаётся видимым несмотря на `hidden` атрибут. */
.subject-chip[hidden] {
  display: none !important;
}
.subject-chip-text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary-dark);
}
.subject-chip-edit {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: underline;
  padding: 0;
  cursor: pointer;
}
.task-error {
  margin: 12px 0 0;
  font-size: 12.5px;
  font-weight: 700;
  color: #B91C1C;
}
.task-answer {
  margin-top: 14px;
  background: linear-gradient(165deg, #FFFFFF 0%, #F3F1FE 100%);
  border: 1px solid rgba(79, 70, 229, 0.08);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 8px 18px rgba(30, 27, 46, 0.1);
  box-sizing: border-box;
}
.task-answer-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
}

/* Диалог с наставником: прошлые реплики ребёнка/бота над текущим ответом. */
.task-dialog-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.task-dialog-log:empty {
  display: none;
  margin-bottom: 0;
}
.dialog-entry {
  margin: 0;
  max-width: 88%;
  padding: 8px 11px;
  border-radius: 13px;
  font-size: 12.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  box-sizing: border-box;
}
.dialog-entry-bot {
  align-self: flex-start;
  background: rgba(79, 70, 229, 0.07);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.dialog-entry-student {
  align-self: flex-end;
  background: linear-gradient(150deg, var(--primary-soft) 0%, var(--primary) 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Composer ответа ученика: текстовое поле + голос + отправка (см. app.js). */
.reply-composer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(79, 70, 229, 0.12);
}
.reply-composer-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.reply-textarea {
  display: block;
  width: 100%;
  min-height: 64px;
  border-radius: 14px;
  border: 1px solid rgba(79, 70, 229, 0.18);
  background: #FFFFFF;
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
  margin: 0 0 8px;
}
.reply-textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.reply-status-text {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
}
.reply-error {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #B91C1C;
}
.reply-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.reply-mic-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--primary-soft) 0%, var(--primary) 55%, var(--primary-dark) 100%);
  box-shadow: 0 8px 14px rgba(79, 70, 229, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform 0.12s ease, background 0.12s ease;
}
.reply-mic-btn:active {
  transform: scale(0.94);
}
.reply-mic-icon,
.reply-mic-stop-icon {
  display: none;
  line-height: 0;
  color: #fff;
}
.reply-mic-spinner {
  display: none;
}
.reply-mic-btn[data-state="idle"] .reply-mic-icon {
  display: flex;
}
.reply-mic-btn[data-state="recording"] .reply-mic-stop-icon {
  display: flex;
}
.reply-mic-btn[data-state="recording"] {
  background: linear-gradient(150deg, #F87171 0%, #DC2626 100%);
  box-shadow: 0 8px 14px rgba(220, 38, 38, 0.35);
  animation: reply-mic-pulse 1.1s ease-in-out infinite;
}
.reply-mic-btn[data-state="transcribing"] {
  opacity: 0.65;
  cursor: default;
  animation: none;
}
.reply-mic-btn[data-state="transcribing"] .reply-mic-spinner {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: reply-mic-spin 0.7s linear infinite;
}
@keyframes reply-mic-pulse {
  0%, 100% { box-shadow: 0 8px 14px rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 8px 22px rgba(220, 38, 38, 0.55); }
}
@keyframes reply-mic-spin {
  to { transform: rotate(360deg); }
}
.reply-send-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 auto;
  border: none;
  border-radius: 16px;
  padding: 12px 10px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(150deg, var(--primary-soft) 0%, var(--primary) 55%, var(--primary-dark) 100%);
  box-shadow: 0 8px 14px rgba(79, 70, 229, 0.3);
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.reply-send-btn:active {
  transform: scale(0.97);
}
.reply-send-btn:disabled,
.reply-mic-btn:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

/* Фото-помощник: съёмка/галерея, разбор на карточки, выбранный фрагмент.
   Кнопки-триггеры (photoCameraBtn/photoGalleryBtn/manualToggleBtn) —
   больше не основной UI: выбор способа теперь делается через
   `.intake-shortcuts` выше, эти элементы остаются в DOM только как
   внутренние обработчики клика (см. app.js), поэтому скрыты по id, а не
   через общие `.photo-primary-btn`/`.photo-secondary-btn` — последний
   класс переиспользуется другими видимыми кнопками (`resumeErrorBackBtn`,
   `pickAnotherBtn`, `subjectSwitchBtn` и др.), которые трогать нельзя. */
.photo-intake {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.photo-intake[hidden] {
  display: none;
}
#photoCameraBtn,
#photoGalleryBtn,
#manualToggleBtn {
  display: none;
}
.photo-primary-btn {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 16px;
  padding: 13px 10px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(150deg, var(--primary-soft) 0%, var(--primary) 55%, var(--primary-dark) 100%);
  box-shadow: 0 10px 18px rgba(79, 70, 229, 0.32);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.photo-primary-btn:active {
  transform: scale(0.97);
}
.photo-secondary-btn {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: 16px;
  padding: 11px 10px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--primary-dark);
  background: #FFFFFF;
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.12s ease;
}
.photo-secondary-btn:active {
  transform: scale(0.97);
}
.photo-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 220px;
  border-radius: 16px;
  margin-top: 2px;
  box-shadow: 0 8px 18px rgba(30, 27, 46, 0.12);
  box-sizing: border-box;
  object-fit: cover;
}
.photo-preview[hidden] {
  display: none;
}
.manual-toggle-btn {
  appearance: none;
  -webkit-appearance: none;
  align-self: center;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: underline;
  padding: 4px 0;
  cursor: pointer;
}
.manual-entry {
  margin-top: 4px;
}
.photo-analyzing {
  text-align: center;
  padding: 26px 10px;
}
.photo-status-text {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.chooser-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  color: var(--text);
}
.task-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.task-card {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  border: 1px solid rgba(79, 70, 229, 0.1);
  border-radius: 16px;
  background: linear-gradient(165deg, #FFFFFF 0%, #F3F1FE 100%);
  padding: 8px;
  box-shadow: 0 8px 16px rgba(30, 27, 46, 0.08);
  text-align: left;
  box-sizing: border-box;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.task-card:active {
  transform: scale(0.97);
}
.task-card-thumb {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  background: #EEF2FF;
}
.task-card-number {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-dark);
}
.task-card-subject {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--primary-dark);
}
.task-card-subject-uncertain {
  text-transform: none;
  font-weight: 700;
  color: var(--muted);
}
.task-card-preview {
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
  display: block;
  overflow: visible;
}
.task-selected {
  margin-top: 4px;
  text-align: center;
}
.selected-fragment {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 auto 10px;
  border-radius: 16px;
  background: #EEF2FF;
  box-shadow: 0 10px 20px rgba(30, 27, 46, 0.12);
  box-sizing: border-box;
}
.selected-preview {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--muted);
  white-space: pre-line;
  text-align: left;
}
.selected-subject {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--primary-dark);
}
.selected-subject.selected-subject-uncertain {
  font-weight: 700;
  color: var(--muted);
}
.subject-switch-hint {
  margin: 0 0 12px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(79, 70, 229, 0.06);
  text-align: center;
}
.subject-switch-text {
  margin: 0 0 8px;
  font-size: 12.5px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--text);
}
.subject-pick-required {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.task-selected .task-submit-btn {
  margin-bottom: 8px;
}
.task-selected .task-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
@media (min-width: 640px) {
  body {
    background: radial-gradient(circle at 18% 12%, rgba(129, 140, 248, 0.25) 0%, transparent 55%),
      radial-gradient(circle at 85% 8%, rgba(244, 114, 182, 0.22) 0%, transparent 50%),
      linear-gradient(180deg, #F5F3FF 0%, #EEF2FF 100%);
    min-height: 100vh;
    padding: 48px 16px;
  }
  .phone-frame {
    width: 448px;
    border-radius: 48px;
    padding: 14px;
    background: linear-gradient(160deg, #2A2750 0%, #14122B 100%);
    box-shadow: 0 30px 60px rgba(30, 27, 46, 0.35), 0 0 0 2px rgba(255, 255, 255, 0.06) inset;
  }
  .phone-screen {
    border-radius: 36px;
    overflow: hidden;
    min-height: 828px;
  }
  .container {
    padding: 34px 22px 44px;
  }
}

/* Профиль ученика (Mini App «Я ученик»): загрузка/ошибка/выбор ребёнка/
   создание профиля/найденный профиль/смена класса — см. app.js. */
.profile-status-text {
  margin: 10px 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
/* Мягкая ненавязчивая плашка «Режим предпросмотра в браузере» (вне MAX,
   см. app.js `browserPreviewNote`) — обычный блок в потоке документа, без
   position: fixed/absolute и без перекрытия остального интерфейса или
   кнопок studentView (см. п.5 задачи browser preview fix). */
.browser-preview-note {
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary-dark);
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}
.profile-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
}
.child-btn {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: 14px;
  background: #FFFFFF;
  color: var(--primary-dark);
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.child-btn:active {
  transform: scale(0.97);
}
.profile-name-input {
  display: block;
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(79, 70, 229, 0.18);
  background: #FFFFFF;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  box-sizing: border-box;
  margin: 0 0 12px;
}
.profile-name-input:focus {
  outline: none;
  border-color: var(--primary);
}
.student-profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(79, 70, 229, 0.14);
  border-radius: 16px;
  background: linear-gradient(165deg, #FFFFFF 0%, #F3F1FE 100%);
  box-shadow: 0 8px 16px rgba(30, 27, 46, 0.08);
  padding: 12px 14px;
  margin: 0 0 14px;
}
.student-profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.student-profile-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.student-profile-grade {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.profile-edit-btn {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  border: 1px solid rgba(79, 70, 229, 0.25);
  border-radius: 12px;
  background: #FFFFFF;
  color: var(--primary-dark);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
  cursor: pointer;
}
.profile-edit-btn:active {
  transform: scale(0.96);
}
.profile-compact-status {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-dark);
  text-align: center;
}
.profile-settings {
  margin: 0 0 14px;
}
.profile-settings-btn {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0;
}
.profile-settings-btn:active {
  opacity: 0.7;
}
.profile-settings-panel {
  margin-top: 6px;
}
.profile-reset-btn {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  margin: 0;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0;
}
.profile-reset-btn:active {
  opacity: 0.7;
}
.profile-current-grade {
  margin: 0 0 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.profile-edit-grade .task-submit-btn {
  margin-bottom: 8px;
}

/* MAX WebView (`body.is-max-webview` — маркер выставляется в app.js по
   той же MAX bridge-детекции, что и `isMaxBridge` для voice fallback,
   см. app.js) — компактный fix выше (`calc(env(safe-area-inset-top, 0px)
   + 12px)` в базовом `.container`) всё ещё оставлял большую пустую зону
   до кнопки «Назад»: в MAX WebView `env(safe-area-inset-top)` не равен 0
   (платформенная шапка MAX уже занимает верхнюю safe-area сама), поэтому
   здесь top padding задаётся без `env()` вовсе — маленькое фиксированное
   значение. Обычный браузер (класс не выставляется вне MAX) продолжает
   использовать базовый `.container`/`.student-topbar` без изменений. */
body.is-max-webview .container {
  padding-top: 6px;
}
body.is-max-webview .student-topbar {
  margin-bottom: 2px;
}
