/*
 * Bilik — стили. Основа: документ «Дизайн Bilik».
 * Тёплый кремовый фон, мягкие яркие цвета, крупные кнопки (не меньше 48 px),
 * ошибка — коралловая (никогда не красная), анимации короткие и отключаемые.
 *
 * Помимо цветов из документа есть «чернильные» оттенки (--*-ink): тёмнее основных.
 * Нужны, чтобы текст и значки оставались читаемыми (контраст не ниже 4.5:1).
 */

:root {
  /* Цвета из документа «Дизайн Bilik» */
  --bg: #FFF8EE;
  --blue: #4C9AFF;
  --orange: #FF8A3D;
  --star: #FFC83D;
  --good: #3CC47C;
  --soft-error: #FF7A6B;
  --text: #2B2D42;
  --purple: #8B6CF0;
  --teal: #2EC4B6;

  /* Производные: фоны, тени, текст на цветном */
  --card: #FFFFFF;
  --line: #EFE3D0;
  --muted: #5D6079;
  --blue-ink: #1F5FC4;
  --blue-soft: #E4F0FF;
  --orange-deep: #D9691F;
  --good-soft: #E1F6EA;
  --good-ink: #1B7A47;
  --error-soft: #FFE8E4;
  --error-ink: #A63A2C;
  --purple-soft: #EEE9FF;
  --teal-soft: #DDF6F3;
  --star-soft: #FFF1C7;
  --shadow: 0 2px 0 rgba(43, 45, 66, .06), 0 8px 24px rgba(43, 45, 66, .08);

  --radius: 20px;
  --radius-sm: 14px;
  --tap: 52px; /* минимальная высота нажимаемого элемента (в документе: не меньше 48) */
  --font: 'Nunito', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
button { font: inherit; color: inherit; }
img, svg { max-width: 100%; }

:focus-visible { outline: 4px solid var(--blue); outline-offset: 3px; border-radius: 12px; }
/* Заголовки получают фокус программно (для чтения с экрана) — рамку на них не рисуем */
[tabindex="-1"]:focus { outline: none; }

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

.skip-link {
  position: absolute; left: 12px; top: -80px; z-index: 50;
  background: var(--text); color: #fff; padding: 12px 16px; border-radius: 12px; text-decoration: none; font-weight: 800;
}
.skip-link:focus { top: 12px; }

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

.page {
  max-width: 760px; margin: 0 auto; overflow-x: clip;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px));
}
/* В уроке снизу закреплена панель с кнопкой (до ~260 px при показе ответа), оставляем под неё место */
.page--player { padding-bottom: 280px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 0 14px;
}

.brand {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 8px 4px 0;
  cursor: pointer; min-height: var(--tap); border-radius: 14px;
}
.brand__word { font-size: 30px; font-weight: 900; letter-spacing: -0.5px; color: var(--blue-ink); }
.brand__star { display: inline-flex; }

.topbar__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.lang {
  display: inline-flex; background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 3px;
}
.lang__btn {
  min-height: 48px; min-width: 56px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent;
  font-weight: 800; font-size: 16px; cursor: pointer; color: var(--muted);
}
.lang__btn[aria-pressed="true"] { background: var(--blue); color: var(--text); }

.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
@media (min-width: 560px) { .chips { grid-template-columns: repeat(2, max-content); } }
.chip {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--line);
  border-radius: 999px; padding: 6px 16px 6px 10px; font-weight: 800; min-height: 56px;
}
.chip__icon { display: inline-flex; margin: -4px 0; }
.chip__num { font-size: 24px; font-weight: 900; }
.chip__label { font-weight: 700; color: var(--muted); font-size: 13px; line-height: 1.15; }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 12px 28px; border: 0; border-radius: 18px;
  font-weight: 900; font-size: 20px; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}
.btn--primary { background: var(--orange); color: var(--text); box-shadow: 0 5px 0 var(--orange-deep); }
.btn--good { background: var(--good); color: var(--text); box-shadow: 0 5px 0 #25995D; }
.btn--ghost { background: #fff; color: var(--blue-ink); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn--block { width: 100%; }
.btn:hover:not(:disabled) { filter: brightness(1.04); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
.btn:disabled { background: #EDE6DA; color: #8A8798; box-shadow: 0 5px 0 #DDD3C2; cursor: not-allowed; }
.btn--ghost:disabled { background: #fff; }

/* ---------- Карточки и главный экран ---------- */

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
  border: 2px solid #fff;
}

.hero {
  display: grid; grid-template-columns: auto 1fr; gap: 12px 20px; align-items: center;
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF3DD 100%);
}
.hero__title { font-size: 28px; font-weight: 900; }
.hero__sub { color: var(--muted); margin-top: 6px; }
.hero__actions { grid-column: 1 / -1; margin-top: 4px; }

.section-title { font-size: 22px; font-weight: 900; margin: 28px 0 12px; }

.subjects { display: grid; gap: 14px; grid-template-columns: 1fr; }
.subjects > li { display: flex; }
@media (min-width: 560px) { .subjects { grid-template-columns: repeat(3, 1fr); } }

.subject {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start; text-align: left;
  border: 0; cursor: pointer; padding: 18px; min-height: 130px; border-radius: var(--radius);
  box-shadow: 0 5px 0 rgba(43, 45, 66, .12); background: var(--blue-soft);
  transition: transform .08s ease, box-shadow .08s ease;
  width: 100%;
}
.subject:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(43, 45, 66, .12); }
.subject--math { background: var(--blue-soft); --accent: var(--blue); }
.subject--native_lang { background: var(--purple-soft); --accent: var(--purple); }
.subject--world_logic { background: var(--teal-soft); --accent: var(--teal); }
.subject__icon { display: inline-flex; flex: none; filter: drop-shadow(0 4px 0 rgba(43, 45, 66, .12)); }
.subject__icon svg { display: block; }
.subject__name { font-size: 20px; font-weight: 900; line-height: 1.2; }
.subject__meta { font-size: 15px; color: var(--muted); font-weight: 700; }

.note { color: var(--muted); font-size: 15px; margin-top: 24px; }
.footer { margin-top: 32px; padding-top: 16px; border-top: 2px dashed var(--line); color: var(--muted); font-size: 14px; }

.badge {
  display: inline-block; background: var(--star-soft); color: #7A5200; font-weight: 800; font-size: 13px;
  padding: 3px 10px; border-radius: 999px; border: 2px solid var(--star);
}

.calm-toggle {
  display: flex; align-items: center; gap: 12px; margin-top: 14px; min-height: var(--tap);
  background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 8px 14px; cursor: pointer; width: 100%;
  text-align: left; font-weight: 800;
}
.calm-toggle small { display: block; color: var(--muted); font-weight: 600; font-size: 14px; }
.calm-toggle__switch {
  margin-left: auto; width: 54px; height: 32px; border-radius: 999px; background: #D9D2C3; position: relative; flex: none;
  transition: background .15s ease;
}
.calm-toggle__switch::after {
  content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s ease;
}
.calm-toggle[aria-checked="true"] .calm-toggle__switch { background: var(--good); }
.calm-toggle[aria-checked="true"] .calm-toggle__switch::after { transform: translateX(22px); }

/* ---------- Экран предмета ---------- */

.back {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); border: 0; background: none; cursor: pointer;
  color: var(--blue-ink); font-weight: 900; font-size: 18px; padding: 0 12px 0 0;
}
.subject-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 8px; }
.subject-head h1 { font-size: 28px; font-weight: 900; }
.module-title { font-size: 20px; font-weight: 900; margin: 22px 0 10px; }

.lesson-list { display: grid; gap: 12px; }
.lesson-row {
  display: flex; align-items: center; gap: 14px; background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; width: 100%; text-align: left; cursor: pointer; min-height: 72px;
}
.lesson-row__num {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; color: var(--text);
  font-size: 22px; /* крупный жирный текст: на фиолетовом нужен контраст не ниже 3:1 */
  background: var(--accent, var(--blue)); flex: none;
}
.lesson-row__body { flex: 1; min-width: 0; }
.lesson-row__title { font-weight: 900; font-size: 18px; }
.lesson-row__meta { color: var(--muted); font-size: 14px; font-weight: 700; }
.lesson-row__stars { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; font-size: 22px; white-space: nowrap; }
.lesson-row__play { color: var(--blue-ink); font-size: 22px; }

.empty { text-align: center; padding: 28px 16px; }
.empty p { color: var(--muted); margin-top: 8px; }

/* ---------- Проигрыватель урока ---------- */

.player-top { display: flex; align-items: center; gap: 12px; padding: 4px 0 8px; }
.close-btn {
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 2px solid var(--line); background: #fff; cursor: pointer;
  font-size: 22px; font-weight: 900; color: var(--muted); flex: none;
}
.progress { flex: 1; display: flex; gap: 5px; align-items: center; min-width: 0; }
.progress__seg { height: 12px; border-radius: 999px; background: #EADFCB; flex: 1; min-width: 0; transition: background .2s ease; }
.progress__seg.is-done { background: var(--good); }
.progress__seg.is-current { background: var(--blue); }
.player-count { font-weight: 800; color: var(--muted); font-size: 15px; margin: 2px 0 10px; }
.player-count .badge { margin-left: 8px; }

.exercise { padding: 22px 20px; }
.exercise__q { font-size: 26px; font-weight: 900; margin-bottom: 8px; outline: none; }
.exercise__help { color: var(--muted); font-weight: 700; font-size: 16px; margin-bottom: 14px; }
.visual {
  font-size: 44px; line-height: 1.25; letter-spacing: 4px; text-align: center; padding: 10px 6px 16px; word-break: break-word;
}
.visual--big { font-size: 64px; }
.example { background: var(--star-soft); border-radius: var(--radius-sm); padding: 14px 16px; font-weight: 700; margin-top: 12px; border: 2px solid var(--star); }
.theory-body { font-size: 20px; margin-top: 4px; }

.options { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); margin-top: 8px; }
@media (max-width: 380px) { .options { grid-template-columns: 1fr; } }
.opt {
  min-height: 68px; border-radius: 18px; border: 3px solid var(--line); background: #fff; font-size: 28px; font-weight: 900;
  cursor: pointer; padding: 10px 14px; transition: transform .08s ease, border-color .1s ease, background .1s ease;
  box-shadow: 0 4px 0 var(--line); word-break: break-word;
}
.opt:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.opt[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue); }
.opt.is-right { border-color: var(--good); background: var(--good-soft); box-shadow: 0 4px 0 var(--good); }
.opt.is-wrong { border-color: var(--soft-error); background: var(--error-soft); box-shadow: 0 4px 0 var(--soft-error); }
.opt:disabled { cursor: default; }
.opt--check { display: flex; align-items: center; justify-content: center; gap: 12px; }
.opt__box {
  width: 30px; height: 30px; border-radius: 9px; border: 3px solid #CDBFA5; background: #fff; flex: none;
  display: grid; place-items: center; font-size: 20px; line-height: 1; color: transparent;
}
.opt[aria-pressed="true"] .opt__box { background: var(--blue); border-color: var(--blue); color: var(--text); }

.fill { display: flex; justify-content: center; margin-top: 8px; }
.fill__input {
  width: 100%; max-width: 300px; min-height: 76px; text-align: center; font-size: 40px; font-weight: 900; font-family: inherit;
  border: 3px solid var(--line); border-radius: 18px; background: #fff; color: var(--text); padding: 6px 12px;
}
.fill__input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 4px rgba(76, 154, 255, .25); }
.fill__input.is-right { border-color: var(--good); background: var(--good-soft); }
.fill__input.is-wrong { border-color: var(--soft-error); background: var(--error-soft); }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-top: 8px; }
.match__col { display: grid; gap: 10px; align-content: start; }
.mbtn {
  min-height: 64px; border-radius: 16px; border: 3px solid var(--line); background: #fff; font-size: 24px; font-weight: 900;
  cursor: pointer; padding: 8px 10px; box-shadow: 0 4px 0 var(--line); position: relative; word-break: break-word; line-height: 1.2;
}
.mbtn.is-selected { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue); }
.mbtn.is-paired { border-color: var(--pair, var(--purple)); background: var(--pair-soft, var(--purple-soft)); box-shadow: 0 4px 0 var(--pair, var(--purple)); }
.mbtn__tag {
  position: absolute; top: -10px; right: -6px; min-width: 26px; height: 26px; border-radius: 13px; background: var(--text);
  border: 2px solid var(--pair, var(--purple)); color: #fff; font-size: 15px; font-weight: 900; display: grid; place-items: center;
  padding: 0 6px; line-height: 1;
}
.mbtn.is-right { border-color: var(--good); background: var(--good-soft); box-shadow: 0 4px 0 var(--good); }
.mbtn.is-wrong { border-color: var(--soft-error); background: var(--error-soft); box-shadow: 0 4px 0 var(--soft-error); }
.mbtn:disabled { cursor: default; }

.order-answer {
  min-height: 84px; border: 3px dashed #D9C9AB; border-radius: 18px; padding: 10px; display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: center; margin: 8px 0 16px; background: #FFFCF6;
}
.order-answer__empty { color: var(--muted); font-weight: 700; font-size: 16px; }
.order-pool { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 64px; }
.chipbtn {
  min-height: 60px; min-width: 60px; padding: 6px 18px; border-radius: 16px; border: 3px solid var(--line); background: #fff;
  font-size: 28px; font-weight: 900; cursor: pointer; box-shadow: 0 4px 0 var(--line);
}
.chipbtn--placed { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue); }
.chipbtn.is-right { border-color: var(--good); background: var(--good-soft); box-shadow: 0 4px 0 var(--good); }
.chipbtn.is-wrong { border-color: var(--soft-error); background: var(--error-soft); box-shadow: 0 4px 0 var(--soft-error); }
.chipbtn:disabled { cursor: default; }

/* Нижняя панель: ответ-подсказка и кнопка (всегда под рукой) */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 3px solid var(--line);
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  box-shadow: 0 -8px 24px rgba(43, 45, 66, .08);
}
.dock--good { background: var(--good-soft); border-top-color: var(--good); }
.dock--soft { background: var(--error-soft); border-top-color: var(--soft-error); }
.dock__inner { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }
.feedback { display: flex; gap: 12px; align-items: flex-start; }
.feedback__icon { width: 64px; height: 64px; flex: none; display: grid; place-items: center; margin: -6px 0 -6px -4px; }
.feedback__title { font-weight: 900; font-size: 20px; }
.dock--good .feedback__title { color: var(--good-ink); }
.dock--soft .feedback__title { color: var(--error-ink); }
.feedback__text { font-size: 16px; font-weight: 700; color: var(--text); }
.feedback__answer { font-weight: 900; }

/* ---------- Результат ---------- */

.result { text-align: center; padding: 26px 18px; }
.result__title { font-size: 32px; font-weight: 900; margin-top: 4px; }
.result__text { color: var(--muted); margin: 8px auto 0; max-width: 460px; }
.rating { display: flex; justify-content: center; gap: 6px; margin: 4px 0 6px; }
.rating__star { display: inline-flex; }
.rating__star { filter: grayscale(1) opacity(.28); transform: scale(.9); }
.rating__star.is-on { filter: none; transform: scale(1); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.stat { background: var(--star-soft); border: 2px solid var(--star); border-radius: var(--radius-sm); padding: 12px; }
.stat__num { font-size: 30px; font-weight: 900; }
.stat__label { font-size: 14px; font-weight: 700; color: var(--muted); }
.mastery { font-weight: 900; margin-bottom: 8px; }
.mastery--yes { color: var(--good-ink); }
.mastery--no { color: var(--muted); }
.result__actions { display: grid; gap: 12px; max-width: 420px; margin: 18px auto 0; }

.error-box { text-align: center; padding: 28px 16px; }
.error-box p { margin-bottom: 16px; }

/* ---------- Движение (мягкое и отключаемое) ---------- */

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }
@keyframes slidein { from { transform: translateY(100%); } to { transform: translateY(0); } }

@keyframes jump { 0%, 100% { transform: translateY(0) scale(1, 1); } 15% { transform: translateY(0) scale(1.08, .9); } 45% { transform: translateY(-22px) scale(.95, 1.06); } 75% { transform: translateY(0) scale(1.06, .94); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes shadowpulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.88); opacity: .75; } }
@keyframes shadowjump { 0%, 100% { transform: scale(1); opacity: 1; } 45% { transform: scale(.6); opacity: .5; } }
@keyframes sway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(7deg); } }
@keyframes crownwob { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2.5deg) translateY(-1px); } }
@keyframes tilt { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-5deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

.mascot__body { transform-origin: 50% 90%; transform-box: fill-box; }
.mascot__shadow, .mascot__eyes, .mascot__leaf, .mascot__crown, .mascot__arm { transform-box: fill-box; }
.mascot__shadow { transform-origin: center; }
.mascot__eyes { transform-origin: center; animation: blink 4.5s ease-in-out infinite; }
.mascot__leaf { transform-origin: 0% 100%; animation: sway 3s ease-in-out infinite; }
.mascot__crown { transform-origin: 50% 100%; animation: crownwob 3.6s ease-in-out infinite; }
.mascot--happy .mascot__body, .mascot--love .mascot__body { animation: bob 3.2s ease-in-out infinite; }
.mascot--happy .mascot__shadow, .mascot--love .mascot__shadow { animation: shadowpulse 3.2s ease-in-out infinite; }
.mascot--cheer .mascot__body { animation: jump .9s ease-in-out 3; }
.mascot--cheer .mascot__shadow { animation: shadowjump .9s ease-in-out 3; }
.mascot--cheer .mascot__arm--l { transform-origin: 100% 100%; animation: wiggle .45s ease-in-out infinite; }
.mascot--cheer .mascot__arm--r { transform-origin: 0% 100%; animation: wiggle .45s ease-in-out infinite reverse; }
.mascot--think .mascot__body { animation: tilt 4s ease-in-out infinite; }
.mascot--oops .mascot__body { animation: shake .4s ease-in-out 2; }
.spark { transform-box: fill-box; transform-origin: center; animation: twinkle 1.2s ease-in-out infinite; }
.rating__star.is-on { animation: pop .5s ease-out both; }
.rating__star.is-on:nth-child(2) { animation-delay: .15s; }
.rating__star.is-on:nth-child(3) { animation-delay: .3s; }
.dock { animation: slidein .18s ease-out; }


/* ---------- Блеск и «вкусность» ---------- */

/* Лёгкий блик света сверху у всего, что нажимается или награждает */
.btn, .opt, .mbtn, .chipbtn, .chip, .lesson-row, .subject, .stat, .calm-toggle, .lang__btn { position: relative; }
.btn::before, .opt::before, .mbtn::before, .chipbtn::before, .lesson-row::before, .subject::before, .stat::before, .chip::before {
  content: ''; position: absolute; left: 6px; right: 6px; top: 4px; height: 44%; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .62) 0%, rgba(255, 255, 255, 0) 100%); pointer-events: none;
}
.btn::before { border-radius: 14px 14px 60% 60% / 14px 14px 40% 40%; }
.opt::before, .mbtn::before, .chipbtn::before { opacity: .8; }
.lesson-row::before, .chip::before { opacity: .55; }
.opt > *, .mbtn > *, .btn > * { position: relative; }
.mbtn__tag { z-index: 1; }

/* Световая полоса пробегает по главным кнопкам раз в несколько секунд */
.btn { overflow: hidden; }
.btn--primary::after, .btn--good::after {
  content: ''; position: absolute; top: -20%; bottom: -20%; left: -50%; width: 28%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .55), rgba(255, 255, 255, 0));
  transform: skewX(-18deg); pointer-events: none; animation: sheen 5.5s ease-in-out 1.2s infinite;
}
.btn:disabled::after { display: none; }
@keyframes sheen { 0%, 62% { left: -50%; } 100% { left: 130%; } }

/* Карточки предметов: свой цветной отблеск и «подпрыгивание» */
.subject { overflow: hidden; }

.subject > * { position: relative; z-index: 1; }
@media (hover: hover) {
  .subject:hover { transform: translateY(-3px); box-shadow: 0 8px 0 rgba(43, 45, 66, .12); }
  .subject:hover .subject__icon svg { animation: wiggle .5s ease-in-out; }
  .lesson-row:hover, .opt:hover:not(:disabled), .mbtn:hover:not(:disabled), .chipbtn:hover:not(:disabled) { transform: translateY(-2px); }
}
.subject { transition: transform .15s ease, box-shadow .15s ease; }
.lesson-row, .opt, .mbtn, .chipbtn { transition: transform .15s ease, border-color .1s ease, background .1s ease, box-shadow .1s ease; }
.lesson-row { box-shadow: 0 4px 0 var(--line); }

/* Блеск у иконок и звёзд */
.icon__shine { animation: glint 3.6s ease-in-out infinite; }
.icon--flame { animation: flicker 1.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes glint { 0%, 70%, 100% { opacity: .85; } 80% { opacity: .2; } 90% { opacity: 1; } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.06, .96) rotate(-2deg); } 60% { transform: scale(.97, 1.05) rotate(2deg); } }
.chip .icon--star { animation: tinypulse 2.8s ease-in-out infinite; }
@keyframes tinypulse { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.08) rotate(-6deg); } }

.hero { position: relative; overflow: hidden; }
.hero::after {
  content: ''; position: absolute; left: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, 0) 70%); pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }

/* Звёзды результата: вылетают по очереди, светятся */
.rating__star .icon { filter: drop-shadow(0 4px 0 rgba(232, 137, 12, .35)); }
.rating__star.is-on .icon { filter: drop-shadow(0 0 14px rgba(255, 200, 61, .9)); }
.rating__star:not(.is-on) .icon { filter: grayscale(1) opacity(.3); }
.rating__star.is-on { animation: starin .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.rating__star.is-on:nth-child(2) { animation-delay: .25s; }
.rating__star.is-on:nth-child(3) { animation-delay: .5s; }
@keyframes starin { 0% { transform: scale(0) rotate(-90deg); opacity: 0; } 70% { transform: scale(1.25) rotate(12deg); opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.rating__star:not(.is-on) { transform: scale(.9); }
.stat { overflow: hidden; }

/* Появление экранов */
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.page:not(.page--player) main > * { animation: rise .45s cubic-bezier(.2, .9, .3, 1) both; }
.page:not(.page--player) main > *:nth-child(2) { animation-delay: .06s; }
.page:not(.page--player) main > *:nth-child(3) { animation-delay: .12s; }
.page:not(.page--player) main > *:nth-child(4) { animation-delay: .18s; }
.page:not(.page--player) main > *:nth-child(5) { animation-delay: .24s; }
.page:not(.page--player) main > *:nth-child(n+6) { animation-delay: .3s; }
@keyframes popsoft { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.subjects > li { animation: popsoft .5s ease-out both; }
.subjects > li:nth-child(2) { animation-delay: .12s; }
.subjects > li:nth-child(3) { animation-delay: .24s; }
.lesson-list > li { animation: rise .4s ease both; }
.lesson-list > li:nth-child(2) { animation-delay: .06s; }
.lesson-list > li:nth-child(3) { animation-delay: .12s; }
.lesson-list > li:nth-child(n+4) { animation-delay: .18s; }

/* Задания: карточка влетает, выбор «пружинит», верно — подпрыгивает, мягкая ошибка — лёгкое покачивание */
@keyframes cardin { from { opacity: 0; transform: translateX(28px) scale(.98); } to { opacity: 1; transform: none; } }
.anim-in { animation: cardin .35s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes pick { 0% { transform: scale(1); } 45% { transform: scale(1.06); } 100% { transform: scale(1); } }
.opt[aria-pressed="true"], .mbtn.is-selected, .chipbtn--placed { animation: pick .25s ease-out; }
@keyframes cheerhop { 0% { transform: scale(1); } 30% { transform: scale(1.1) translateY(-6px); } 60% { transform: scale(.97); } 100% { transform: scale(1); } }
.opt.is-right, .mbtn.is-right, .chipbtn.is-right { animation: cheerhop .55s ease-out; }
@keyframes softshake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.opt.is-wrong, .mbtn.is-wrong, .chipbtn.is-wrong, .fill__input.is-wrong { animation: softshake .4s ease-in-out; }
.fill__input.is-right { animation: cheerhop .55s ease-out; }
.progress__seg { transition: background .3s ease, transform .3s ease; }
.progress__seg.is-current { animation: segpulse 1.6s ease-in-out infinite; }
@keyframes segpulse { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.35); } }
.progress__seg.is-done { background: linear-gradient(180deg, #6FE0A4, var(--good)); }
@keyframes feedin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.feedback { animation: feedin .3s ease-out both; }

/* Конфетти */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i {
  position: absolute; width: 10px; height: 10px; border-radius: 2px; opacity: 0;
  animation-name: confetti; animation-timing-function: cubic-bezier(.15, .6, .35, 1); animation-fill-mode: forwards;
}
@keyframes confetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  55% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 420px)) rotate(var(--rot)); }
}

html[data-calm="true"] *, html[data-calm="true"] *::before, html[data-calm="true"] *::after {
  animation: none !important; transition: none !important;
}
html[data-calm="true"] .confetti { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 420px) {
  body { font-size: 17px; }
  .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .hero__title { font-size: 24px; }
  .exercise__q { font-size: 23px; }
  .visual { font-size: 38px; }
  .opt { font-size: 26px; }
  .brand__word { font-size: 26px; }
}

/* Герой прыгает выше рамки рисунка — не обрезаем */
.mascot { overflow: visible; }

/* Мягкий блик как у кнопок: у карточек предметов, уроков, плашек */
.subject::before, .lesson-row::before, .stat::before, .chip::before {
  left: 5px; right: 5px; top: 4px; height: 40%;
  border-radius: 16px 16px 60% 60% / 16px 16px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .6) 0%, rgba(255, 255, 255, 0) 100%);
}

/* Единый мягкий свет сверху — еле заметный, без краёв и полосок */
.opt::before, .mbtn::before, .chipbtn::before, .lesson-row::before, .subject::before, .stat::before, .chip::before {
  left: 0; right: 0; top: 0; height: 55%; border-radius: inherit; opacity: 1;
  background: linear-gradient(180deg, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, 0) 100%);
}

/* ---------- Вход, дети, раздел для родителей ---------- */

.btn--sm { min-height: var(--tap); padding: 6px 16px; font-size: 16px; border-radius: 16px; }
.who-name { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--c, var(--blue));
  color: var(--text); font-weight: 900; box-shadow: 0 3px 0 rgba(43, 45, 66, .18); position: relative; overflow: hidden;
}
.avatar::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 50%; background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0)); }

.form-card { max-width: 520px; margin: 0 auto; }
.form-card__mascot { display: flex; justify-content: center; margin-bottom: 4px; }
.form-card__title, .cab-title { font-size: 26px; font-weight: 900; text-align: center; margin-bottom: 6px; }
.form-card__sub { color: var(--muted); text-align: center; margin-bottom: 14px; }
.card > .form-card__title { margin-bottom: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field__label { font-weight: 800; font-size: 16px; }
.field__input {
  min-height: 56px; width: 100%; border: 3px solid var(--line); border-radius: 16px; padding: 8px 14px; font: inherit;
  font-size: 20px; background: #fff; color: var(--text);
}
.field__input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 4px rgba(76, 154, 255, .25); }
input[name="pin"], input[name="pin2"] { font-size: 30px; letter-spacing: 12px; text-align: center; font-weight: 900; }
.check { display: flex; align-items: center; gap: 12px; min-height: var(--tap); margin-bottom: 12px; font-weight: 700; cursor: pointer; }
.check input { width: 28px; height: 28px; flex: none; accent-color: var(--blue); }
.form-links { display: grid; gap: 4px; justify-items: center; margin-top: 12px; }
.linkbtn { min-height: 48px; border: 0; background: none; color: var(--blue-ink); font: inherit; font-weight: 800; font-size: 17px; cursor: pointer; text-decoration: underline; padding: 0 12px; }
.form-actions { display: grid; gap: 12px; margin-top: 16px; }
.form-card .btn + .btn { margin-top: 10px; }
.msg { border-radius: 14px; padding: 12px 14px; font-weight: 700; margin-bottom: 14px; }
.msg[hidden] { display: none; }
.msg--err { background: var(--error-soft); color: var(--error-ink); border: 2px solid var(--soft-error); }
.msg--ok { background: var(--good-soft); color: var(--good-ink); border: 2px solid var(--good); }

.who-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.who {
  display: grid; justify-items: center; gap: 8px; width: 100%; padding: 16px 10px; border: 3px solid var(--line); border-radius: var(--radius);
  background: #fff; cursor: pointer; box-shadow: 0 4px 0 var(--line); font: inherit; position: relative;
}
.who:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.who__name { font-weight: 900; font-size: 20px; word-break: break-word; }

.cab-account { text-align: center; color: var(--muted); margin-bottom: 14px; word-break: break-all; }
.kids { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.kid__head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.kid__name { font-weight: 900; font-size: 22px; }
.kid__meta { color: var(--muted); font-weight: 700; font-size: 15px; }
.kid__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.kid__stats > div { background: var(--star-soft); border: 2px solid var(--star); border-radius: var(--radius-sm); padding: 8px 6px; text-align: center; }
.kid__stats b { display: block; font-size: 26px; font-weight: 900; }
.kid__stats span { font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.15; display: block; }
.kid__sub { font-size: 16px; font-weight: 900; margin: 8px 0; }
.kid__none { color: var(--muted); font-weight: 700; margin-bottom: 12px; }
.rec { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.rec li { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #FFFCF6; border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.rec__title { font-weight: 800; min-width: 0; }
.rec__stars { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.kid .row { display: flex; flex-wrap: wrap; gap: 10px; }
.kid .row .btn { flex: 1 1 160px; }

/* ---------- «Вкусные» предметы и объёмные числа в заданиях ---------- */
.visual { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px; letter-spacing: 0; font-weight: 900; color: var(--blue-ink); }
.tk { --tk: 52px; display: inline-block; width: var(--tk); height: var(--tk); flex: none; animation: tkin .55s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
.tk svg { width: 100%; height: 100%; overflow: visible; display: block; animation: tkbob 3.2s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -.45s); transform-origin: 50% 90%; }
.visual--big .tk { --tk: 68px; }
.visual--many .tk { --tk: 38px; }
.visual--still .tk { animation: none; }
.visual--ok .tk svg { animation: tkhop .6s ease-in-out both; animation-delay: calc(var(--i, 0) * 60ms); }
.example .tk { --tk: 30px; vertical-align: middle; }
.mbtn .tk { --tk: 28px; animation: none; vertical-align: middle; }
.mbtn .tk svg { animation: none; }
@keyframes tkin { 0% { transform: scale(.2) translateY(14px); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes tkbob { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-3px) rotate(1.5deg); } }
@keyframes tkhop { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-12px) scale(1.12, .94); } 70% { transform: translateY(0) scale(.96, 1.06); } }
@media (max-width: 420px) { .tk { --tk: 44px; } .visual--big .tk { --tk: 58px; } .visual--many .tk { --tk: 32px; } .visual { font-size: 38px; } }

/* Объёмные «конфетные» числа: цвет и плотная нижняя тень, как у выпуклых букв */
.opt, .chipbtn, .mbtn, .fill__input { --num: #3A82EE; --num-d: #1F55B0; }
.opt:nth-child(4n+2), .chipbtn:nth-child(4n+2) { --num: #FF8A3D; --num-d: #B8501A; }
.opt:nth-child(4n+3), .chipbtn:nth-child(4n+3) { --num: #8B6CF0; --num-d: #5B3DC9; }
.opt:nth-child(4n+4), .chipbtn:nth-child(4n+4) { --num: #1FA99C; --num-d: #0F6E66; }
.opt, .chipbtn, .mbtn, .fill__input, .visual {
  color: var(--num, var(--blue-ink));
  text-shadow: 0 1px 0 var(--num-d, #1F55B0), 0 2px 0 var(--num-d, #1F55B0), 0 3px 0 var(--num-d, #1F55B0), 0 5px 6px rgba(43, 45, 66, .22);
}
.visual { --num: #3A82EE; --num-d: #1F55B0; }
.opt:disabled, .opt.is-wrong { text-shadow: 0 1px 0 rgba(43, 45, 66, .25); color: var(--muted); }
.opt.is-right, .chipbtn.is-right, .mbtn.is-right { --num: #23A765; --num-d: #166B43; }
.opt::before, .chipbtn::before, .mbtn::before { z-index: 0; pointer-events: none; }
@media (prefers-contrast: more) { .opt, .chipbtn, .mbtn, .fill__input, .visual { text-shadow: none; } }
.opt { font-size: 38px; }
.chipbtn { font-size: 34px; }
.mbtn { font-size: 30px; }
@media (max-width: 420px) { .opt { font-size: 36px; } }
