/* ============================================================
   Ballerina Dreams — «карамельный балет»
   Пастель: сирень / пудрово-розовый / персик / мята
   ============================================================ */

:root {
  /* палитра по стайлгайду заказчика (#FFC799 / #7E7FD9 / #E1EEF4 / #FFF / #141B34),
     адаптирована под балет: + пуантово-розовый акцент */
  --bg-1: #eef4fa;   /* ледяной голубой E1EEF4, чуть светлее */
  --bg-2: #fdf3ec;   /* тёплый кремовый от персика */
  --bg-3: #ffffff;
  --card: #ffffff;
  --ink: #141b34;
  --ink-soft: #5b6284;
  --lav: #9a9be2;
  --lav-deep: #7e7fd9;  /* перванш — основной акцент */
  --pink: #f79fc0;      /* пуантовый розовый — балетный акцент */
  --pink-soft: #fdd9e6;
  --peach: #ffc799;     /* тёплый CTA из стайлгайда */
  --ice: #e1eef4;
  --mint: #9fe3c6;
  --gold: #ffd166;
  --navy: #141b34;
  --danger: #ff7a7a;
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
  --shadow: 0 10px 30px rgba(120, 90, 190, 0.16);
  --shadow-soft: 0 4px 14px rgba(120, 90, 190, 0.10);
  --nav-h: 78px;
}

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

html, body { height: 100%; }

body {
  font-family: 'Manrope', 'Nunito', 'Segoe UI', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 85% -5%, #ffe9d6 0%, transparent 55%),
    radial-gradient(700px 500px at -10% 20%, #dfe0f7 0%, transparent 55%),
    linear-gradient(170deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  user-select: none;
}

/* Gilroy-стиль из стайлгайда: геометрический гротеск (Manrope — свободный аналог с кириллицей) */
h1, h2, h3, .display { font-family: 'Manrope', 'Nunito', sans-serif; font-weight: 800; letter-spacing: -0.01em; }

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh; /* fallback для старых WebView */
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ---------- декоративные «звёздочки-блёстки» фона ---------- */
.sparkles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.sparkle {
  position: absolute; font-size: 14px; opacity: .5;
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(12deg); }
}

/* ============================================================
   ЭКРАНЫ / ОБЩЕЕ
   ============================================================ */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px 18px calc(var(--nav-h) + 26px);
  position: relative;
  z-index: 1;
  animation: screenIn .35s ease both;
}
.screen.no-nav { padding-bottom: 30px; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.screen-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.screen-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 16px; }

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 16px;
  border: none;
  border-radius: 999px;
  padding: 15px 26px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--lav-deep), var(--pink));
  box-shadow: 0 8px 20px rgba(143, 111, 224, 0.35);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:active { transform: scale(.96); }
.btn:disabled { filter: grayscale(.6); opacity: .6; cursor: default; }
.btn.secondary {
  background: #fff;
  color: var(--lav-deep);
  box-shadow: inset 0 0 0 2px #dcdff5, var(--shadow-soft);
}
.btn.peach { background: linear-gradient(135deg, var(--peach), var(--pink)); box-shadow: 0 8px 20px rgba(255, 143, 185, .35); }
.btn.small { padding: 12px 20px; font-size: 14px; }
.btn.block { width: 100%; }

.input {
  width: 100%;
  border: 2px solid #dfe2f2;
  background: #fff;
  border-radius: var(--r-md);
  padding: 15px 18px;
  font-size: 17px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  color: var(--ink);
  outline: none;
  transition: border-color .2s;
}
.input:focus { border-color: var(--lav); }
.input::placeholder { color: #a9aecb; font-weight: 600; }

/* ============================================================
   ОНБОРДИНГ
   ============================================================ */
.onb-hero { text-align: center; margin: 12px 0 20px; }
.onb-hero svg { width: 150px; height: auto; }
.onb-hero img.onb-hero-img { width: 208px; height: auto; }
.onb-hero .pointe-bounce { animation: pointeBounce 2.6s ease-in-out infinite; transform-origin: 50% 90%; display: inline-block; }
@keyframes pointeBounce {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(-8px); }
}

/* PNG-рендеры Nano Banana теперь с настоящей прозрачностью */
.cutout { filter: drop-shadow(0 10px 14px rgba(80, 50, 140, .28)); }

/* PNG-сцены на всю площадь контейнера */
img.room-bg, .path-card img.path-bg, .hw-video img.hw-scene {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}

.onb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.onb-back { color: var(--ink); flex: none; }
.onb-back-spacer { width: 46px; flex: none; }
.onb-progress { display: flex; gap: 7px; justify-content: center; align-items: center; flex: 1; }
.onb-dot { width: 9px; height: 9px; border-radius: 50%; background: #d5d8f0; transition: all .3s; }
.onb-dot.active { width: 26px; border-radius: 6px; background: linear-gradient(90deg, var(--lav-deep), var(--pink)); }

.branch-item {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: var(--r-md);
  padding: 15px 16px; margin-bottom: 11px;
  border: 2px solid transparent;
  box-shadow: var(--shadow-soft);
  cursor: pointer; transition: border-color .2s, transform .15s;
}
.branch-item:active { transform: scale(.98); }
.branch-item.selected { border-color: var(--lav-deep); background: #eef0fb; }
.branch-emoji {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, #e9ebf8, #ffe9d9);
}
.branch-name { font-weight: 800; font-size: 15px; }
.branch-addr { font-size: 12.5px; color: var(--ink-soft); }

.age-row { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 10px 0 4px; }
.age-val { font-size: 44px; font-weight: 900; min-width: 74px; text-align: center; font-family: 'Manrope'; color: var(--lav-deep); }
.age-btn {
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 26px; font-weight: 900; color: var(--lav-deep);
  background: #fff; box-shadow: var(--shadow-soft);
}
.age-btn:active { transform: scale(.92); }
.age-hint { text-align: center; font-size: 12.5px; color: var(--ink-soft); }

/* выбор пути */
.path-choice { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.path-card {
  flex: 1; min-height: 200px; border-radius: var(--r-lg); position: relative;
  overflow: hidden; cursor: pointer; border: 3px solid transparent;
  box-shadow: var(--shadow); transition: transform .18s, border-color .2s;
  display: flex; align-items: flex-end;
}
.path-card:active { transform: scale(.97); }
.path-card.selected { border-color: var(--gold); }
.path-card svg.path-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.path-label {
  position: relative; z-index: 2; width: 100%;
  padding: 14px 16px;
  background: linear-gradient(transparent, rgba(30, 20, 60, 0.65));
  color: #fff; font-weight: 800; font-size: 17px; font-family: 'Manrope';
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.path-label small { display: block; font-family: 'Nunito'; font-weight: 600; font-size: 12px; opacity: .9; }

/* ============================================================
   КАСТОМИЗАЦИЯ
   ============================================================ */
.custom-stage {
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 20%, #fff 0%, #eceffa 100%);
  border-radius: var(--r-lg); box-shadow: var(--shadow-soft);
  padding: 14px; margin-bottom: 14px; min-height: 250px;
}
.custom-stage svg { max-height: 240px; }

.opt-group { margin-bottom: 14px; }
.opt-label { font-weight: 800; font-size: 13.5px; color: var(--ink-soft); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.opt-row { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  border: 3px solid #fff; box-shadow: var(--shadow-soft);
  transition: transform .15s, border-color .2s;
}
.swatch.selected { border-color: var(--lav-deep); transform: scale(1.12); }
.chip {
  padding: 13px 18px; border-radius: 999px; background: #fff; cursor: pointer;
  font-weight: 800; font-size: 13.5px; color: var(--ink);
  box-shadow: var(--shadow-soft); border: 2px solid transparent;
  transition: all .15s;
}
.chip.selected { border-color: var(--lav-deep); background: #eceffa; color: var(--lav-deep); }

/* ============================================================
   ГЛАВНЫЙ ЭКРАН — КОМНАТА
   ============================================================ */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; position: relative; z-index: 2; }
.tb-avatar {
  width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex: none;
  background: linear-gradient(135deg, #e9ebf8, #ffe9d9);
  box-shadow: var(--shadow-soft); display: grid; place-items: center;
}
.tb-avatar svg { width: 40px; height: 40px; }
.tb-info { flex: 1; min-width: 0; }
.tb-name { font-weight: 900; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-level { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.tb-level-num { font-size: 11px; font-weight: 900; color: var(--lav-deep); flex: none; }
.xp-track { flex: 1; height: 8px; background: #e9e0fb; border-radius: 5px; overflow: hidden; }
.xp-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--lav-deep), var(--pink)); transition: width .5s ease; }

.wallet { display: flex; gap: 7px; }
.wallet-pill {
  display: flex; align-items: center; gap: 5px;
  background: #fff; border-radius: 999px; padding: 7px 11px;
  font-weight: 900; font-size: 13px; box-shadow: var(--shadow-soft);
}
.wallet-pill svg { width: 16px; height: 16px; }

.badge-btn {
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: #fff; box-shadow: var(--shadow-soft); display: grid; place-items: center;
}
.badge-btn svg { width: 22px; height: 22px; }

/* комната */
.room {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow); flex: 1;
  min-height: 320px; /* fallback */
  min-height: clamp(300px, 46dvh, 380px); /* баннер бонуса всегда виден */
  display: flex; align-items: flex-end; justify-content: center;
}
.room svg.room-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.room .hero-holder {
  position: relative; z-index: 2; margin-bottom: 8px;
  animation: heroIdle 3.5s ease-in-out infinite;
  transform-origin: 50% 100%;
}
@keyframes heroIdle {
  0%, 100% { transform: translateY(0) }
  50% { transform: translateY(-6px) }
}

.room-actions {
  position: absolute; top: 14px; right: 12px; z-index: 3;
  display: flex; flex-direction: column; gap: 10px;
}
.room-action {
  width: 58px; height: 60px; border-radius: 18px; border: none; cursor: pointer;
  background: rgba(255,255,255,.92); backdrop-filter: blur(4px);
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform .15s; font-family: 'Nunito';
}
.room-action:active { transform: scale(.9); }
.room-action svg { width: 26px; height: 26px; }
.room-action .ra-label { font-size: 10px; font-weight: 800; color: var(--ink-soft); }

.pet-corner {
  position: absolute; left: 12px; bottom: 12px; z-index: 3;
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.92); box-shadow: var(--shadow-soft);
  display: grid; place-items: center;
}
.pet-corner svg { width: 40px; height: 40px; }

.daily-banner {
  margin-top: 14px;
  background: linear-gradient(120deg, #8f6fe0, #ff8fb9);
  border-radius: var(--r-md); padding: 14px 16px;
  color: #fff; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 10px 24px rgba(143, 111, 224, .35);
  cursor: pointer; border: none; width: 100%; text-align: left;
  font-family: 'Nunito';
}
.daily-banner .db-emoji { font-size: 26px; }
.daily-banner .db-title { font-weight: 900; font-size: 14.5px; }
.daily-banner .db-sub { font-size: 12px; opacity: .9; }

/* ============================================================
   НИЖНЕЕ МЕНЮ
   ============================================================ */
/* «стеклянная» плавающая капсула: активная вкладка — цветная пилюля
   с подписью, остальные — круглые иконки */
.bottom-nav {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  width: min(402px, calc(100% - 24px));
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, .9);
  border-radius: 999px; padding: 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 4px;
  box-shadow: 0 14px 40px rgba(120, 90, 190, .28);
  z-index: 50;
}
.nav-btn {
  border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  height: 52px; min-width: 52px; flex: 0 0 auto;
  padding: 0; border-radius: 999px; color: #a89ecf;
  transition: all .28s cubic-bezier(.5, 1.4, .4, 1); font-family: 'Nunito';
  overflow: hidden;
}
.nav-btn svg { width: 24px; height: 24px; }
.nav-btn span:not(.nav-ico) {
  font-size: 13.5px; font-weight: 900; white-space: nowrap;
  max-width: 0; opacity: 0; transition: all .28s ease;
}
.nav-btn.active {
  flex: 1 1 auto; color: #fff; padding: 0 18px;
  background: linear-gradient(135deg, var(--lav-deep), var(--pink));
  box-shadow: 0 6px 18px rgba(143, 111, 224, .45);
}
.nav-btn.active span:not(.nav-ico) { max-width: 110px; opacity: 1; }
.nav-ico { display: grid; place-items: center; }

/* ============================================================
   МАГАЗИН
   ============================================================ */
.shop-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 6px;
  scrollbar-width: none;
}
.shop-tabs::-webkit-scrollbar { display: none; }
.shop-tab {
  flex: none; padding: 10px 16px; border-radius: 999px; border: none; cursor: pointer;
  font-family: 'Nunito'; font-weight: 800; font-size: 13px;
  background: #fff; color: var(--ink-soft); box-shadow: var(--shadow-soft);
}
.shop-tab.active { background: var(--navy); color: #fff; }

.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shop-item {
  background: #fff; border-radius: var(--r-md); padding: 13px;
  box-shadow: var(--shadow-soft); position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 2px solid transparent;
}
.shop-item.owned { border-color: var(--mint); }
.shop-item.equipped { border-color: var(--lav-deep); background: #eef0fb; }
.shop-thumb {
  width: 84px; height: 84px; border-radius: 16px;
  background: linear-gradient(135deg, #eef0fb, #fff0f6);
  display: grid; place-items: center; font-size: 38px;
}
.shop-thumb svg { width: 64px; height: 64px; }
.shop-name { font-weight: 800; font-size: 13px; text-align: center; line-height: 1.25; }
.shop-price {
  display: flex; align-items: center; gap: 5px;
  font-weight: 900; font-size: 13.5px; color: var(--lav-deep);
  background: #e8f6fd; border-radius: 999px; padding: 4px 12px;
}
.shop-price--pearl { background: #f6eefc; color: #8a5fb8; }
.shop-price svg { width: 15px; height: 15px; }
.shop-item .btn { padding: 8px 20px; font-size: 12.5px; }
.lock-overlay {
  position: absolute; inset: 0; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .72); backdrop-filter: blur(1.5px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  font-weight: 800; font-size: 12px; color: var(--ink-soft); text-align: center; padding: 8px;
  z-index: 2;
}
.lock-overlay .lock-ico { font-size: 26px; }

.gift-note {
  background: #fff8e8; border: 2px dashed var(--gold);
  border-radius: var(--r-md); padding: 12px 14px; font-size: 12.5px;
  color: #8a6d1d; font-weight: 700; margin-bottom: 12px;
}

/* ============================================================
   РАСПИСАНИЕ
   ============================================================ */
.sched-branch-pick { margin-bottom: 12px; }
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-pill {
  flex: none; width: 52px; padding: 9px 0; border-radius: 16px; border: none; cursor: pointer;
  background: #fff; box-shadow: var(--shadow-soft); font-family: 'Nunito';
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.day-pill .dow { font-size: 10.5px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; }
.day-pill .dnum { font-size: 17px; font-weight: 900; color: var(--ink); }
.day-pill.active { background: var(--navy); }
.day-pill.active .dow, .day-pill.active .dnum { color: #fff; }

.lesson-card {
  background: #fff; border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 11px;
  box-shadow: var(--shadow-soft); display: flex; gap: 13px; align-items: center;
}
.lesson-time {
  flex: none; width: 62px; text-align: center;
  background: linear-gradient(135deg, #e9ebf8, #ffe9d9);
  border-radius: 13px; padding: 9px 0;
}
.lesson-time b { display: block; font-size: 15px; color: var(--lav-deep); }
.lesson-time small { font-size: 10.5px; color: var(--ink-soft); font-weight: 700; }
.lesson-title { font-weight: 800; font-size: 14.5px; }
.lesson-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.lesson-empty { text-align: center; color: var(--ink-soft); font-weight: 700; padding: 30px 0; }

/* ============================================================
   ДОМАШНИЕ ЗАДАНИЯ
   ============================================================ */
.hw-card {
  background: #fff; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-soft); margin-bottom: 15px; position: relative;
}
.hw-video {
  position: relative; aspect-ratio: 16/9;
  background: linear-gradient(135deg, #d9c8ff, #ffd3e4);
  display: grid; place-items: center;
}
.hw-video .play-btn {
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.95); box-shadow: var(--shadow);
  display: grid; place-items: center; z-index: 2;
}
.hw-video .play-btn svg { width: 26px; height: 26px; margin-left: 3px; }
.hw-video .hw-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.hw-body { padding: 14px 16px 16px; }
.hw-title { font-weight: 800; font-size: 15px; }
.hw-desc { font-size: 12.5px; color: var(--ink-soft); margin: 4px 0 10px; }
.hw-progress-track { height: 9px; border-radius: 6px; background: #efe8ff; overflow: hidden; }
.hw-progress-fill { height: 100%; background: linear-gradient(90deg, var(--mint), #59c99c); border-radius: 6px; transition: width .3s; }
.hw-progress-label { font-size: 11.5px; font-weight: 800; color: var(--ink-soft); margin-top: 6px; }
.hw-locked .hw-video { filter: grayscale(.5); }
.hw-done-tag {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  background: var(--mint); color: #14684a; font-weight: 900; font-size: 11px;
  border-radius: 999px; padding: 5px 11px;
}

/* ============================================================
   ПИТОМЕЦ
   ============================================================ */
.pet-stage {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow); min-height: 380px; flex: 1;
  display: flex; align-items: flex-end; justify-content: center; gap: 4px;
}
.pet-stage svg.room-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pet-holder { position: relative; z-index: 2; margin-bottom: 16px; animation: petBob 2.8s ease-in-out infinite; }
@keyframes petBob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-5px) } }
.pet-prop { position: absolute; z-index: 2; bottom: 22px; animation: propPop .5s cubic-bezier(.2,1.6,.4,1) both; }
.pet-prop.bowl-pos { left: 18%; }
.pet-prop.toy-pos { right: 16%; }
@keyframes propPop { from { transform: scale(0); } to { transform: scale(1); } }
.pet-actions { display: flex; gap: 12px; margin-top: 14px; }
.pet-actions .btn { flex: 1; }
.pet-name-row { text-align: center; margin-top: 14px; }
.pet-name-row b { font-family: 'Manrope'; font-size: 18px; }

/* ============================================================
   ДОСТИЖЕНИЯ / СКИЛЛЫ
   ============================================================ */
.skills-card { margin-bottom: 16px; }
.skill-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.skill-row:last-child { margin-bottom: 0; }
.skill-emoji { width: 34px; height: 34px; border-radius: 11px; background: #eceffa; display: grid; place-items: center; font-size: 16px; flex: none; }
.skill-name { font-weight: 800; font-size: 13px; width: 96px; flex: none; }
.skill-track { flex: 1; height: 9px; background: #efe8ff; border-radius: 6px; overflow: hidden; }
.skill-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--lav-deep), var(--pink)); }

.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.ach-cell {
  background: #fff; border-radius: var(--r-md); padding: 13px 8px;
  box-shadow: var(--shadow-soft); text-align: center;
}
.ach-cell.locked { opacity: .6; }
.ach-cell.locked .ach-ico { filter: grayscale(1); opacity: .7; }
.ach-ico { font-size: 30px; }
.ach-name { font-size: 11px; font-weight: 800; margin-top: 5px; line-height: 1.2; }

/* ============================================================
   МОДАЛКА / ТОСТЫ
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(40, 30, 70, .45);
  z-index: 90; display: grid; place-items: center; padding: 24px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0 } }
.modal {
  background: #fff; border-radius: var(--r-lg); padding: 24px 20px;
  max-width: 340px; width: 100%; text-align: center;
  box-shadow: 0 24px 60px rgba(40, 30, 70, .35);
  animation: popIn .3s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes popIn { from { transform: scale(.8); opacity: 0 } }
.modal .m-emoji { font-size: 48px; }
.modal h3 { margin: 10px 0 6px; font-size: 19px; }
.modal p { color: var(--ink-soft); font-size: 14px; margin-bottom: 16px; }

.toasts {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: min(380px, calc(100% - 30px)); pointer-events: none;
}
.toast {
  background: var(--navy); color: #fff; font-weight: 800; font-size: 13.5px;
  padding: 12px 20px; border-radius: 999px; box-shadow: 0 10px 26px rgba(44,38,80,.4);
  animation: toastIn .3s ease both; text-align: center;
  font-family: 'Nunito';
}
.toast.reward { background: linear-gradient(120deg, var(--lav-deep), var(--pink)); }
@keyframes toastIn { from { transform: translateY(-16px); opacity: 0 } }
.toast.out { animation: toastOut .3s ease both; }
@keyframes toastOut { to { transform: translateY(-16px); opacity: 0 } }

/* фиксация верхней панели ссылки педагога */
.teacher-link {
  margin-top: auto; text-align: center; padding-top: 18px;
  font-size: 13px; color: var(--ink-soft); font-weight: 700;
  text-decoration: underline; cursor: pointer; background: none; border: none;
  font-family: 'Nunito';
}

@media (min-width: 431px) {
  body::before {
    content: ''; position: fixed; inset: 0; z-index: 0;
  }
}

/* ============================================================
   ЭТАП 3: idle-урок, экзамен, фоторежим, возрастные слои
   ============================================================ */

/* --- топбар: титул и три валюты --- */
.tb-title { font-size: 10.5px; font-weight: 800; color: var(--lav-deep); text-transform: uppercase; letter-spacing: .04em; }
.wallet { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.wallet-pill { font-size: 12px; padding: 2px 9px; }
.wallet-pill svg { width: 13px; height: 13px; }

/* --- урок у станка --- */
.lesson-stage {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow); min-height: 320px;
  display: flex; align-items: flex-end; justify-content: center;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
}
.lesson-hero { margin-bottom: 10px; pointer-events: none; }
.tap-hint {
  position: absolute; top: 16px; right: 16px; z-index: 3;
  background: rgba(255,255,255,.92); border-radius: 999px; padding: 8px 14px;
  font-weight: 900; font-size: 14px; color: var(--lav-deep);
  animation: pointeBounce 1.6s ease-in-out infinite;
}
.tap-float {
  position: absolute; z-index: 4; pointer-events: none;
  font-weight: 900; font-size: 20px; color: #fff;
  text-shadow: 0 2px 8px rgba(120, 80, 200, .8);
  animation: tapFloat .9s ease-out forwards;
}
@keyframes tapFloat {
  from { transform: translate(-50%, 0) scale(.7); opacity: 1; }
  to   { transform: translate(-50%, -70px) scale(1.25); opacity: 0; }
}
.combo-bar { text-align: center; font-size: 12.5px; font-weight: 800; color: var(--ink-soft); margin-top: 10px; }

/* анимации движений героини */
.do-plie   { animation: doPlie .45s ease-out; }
.do-releve { animation: doReleve .45s ease-out; }
.do-spin   { animation: doSpin .55s ease-in-out; }
@keyframes doPlie   { 30% { transform: translateY(12px) scaleY(.94); } }
@keyframes doReleve { 30% { transform: translateY(-14px); } }
@keyframes doSpin   { 50% { transform: rotate(8deg) translateY(-6px); } }

/* карточки апгрейдов */
.upgrade-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow-soft);
  padding: 12px 14px; margin-bottom: 10px;
}
.ug-emoji { font-size: 26px; }
.ug-info { flex: 1; min-width: 0; }
.ug-name { font-weight: 800; font-size: 14px; }
.ug-lvl { color: var(--lav-deep); font-size: 12px; margin-left: 4px; }
.ug-desc { font-size: 11.5px; color: var(--ink-soft); }
.upgrade-card .btn svg { width: 14px; height: 14px; }

/* --- карьера --- */
.career-card { margin-bottom: 14px; }
.career-path { margin: 4px 0 12px; }
.career-step { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13.5px; font-weight: 700; }
.cs-dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 900;
  background: #efe8ff; color: var(--ink-soft);
}
.career-step.done .cs-dot { background: var(--mint); color: #1f6b4c; }
.career-step.next .cs-dot { background: var(--peach); color: #7a3d12; }
.career-step.locked { opacity: .5; }
.cs-req { margin-left: auto; font-size: 11px; color: var(--lav-deep); font-weight: 800; }

/* --- экзамен --- */
.exam-status { text-align: center; font-weight: 800; padding: 14px; margin-bottom: 12px; }
.exam-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.ex-dot { width: 12px; height: 12px; border-radius: 50%; background: #dfe1f2; transition: all .2s; }
.ex-dot.good { background: var(--mint); transform: scale(1.25); }
.exam-moves { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.exam-move {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--card); border: 3px solid transparent; border-radius: var(--r);
  box-shadow: var(--shadow-soft); padding: 16px 10px; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.exam-move:disabled { opacity: .75; }
.exam-move.lit { border-color: var(--lav); background: #eceffa; transform: scale(1.06); box-shadow: 0 6px 22px rgba(143,111,224,.35); }
.exam-move:active { transform: scale(.96); }
.em-emoji { font-size: 30px; }
.em-name { font-weight: 900; font-size: 14px; color: var(--ink); }

/* --- фоторежим --- */
.photo-stage {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow); min-height: 380px; margin-top: 4px;
  display: flex; align-items: flex-end; justify-content: center;
}
.photo-hero { margin-bottom: 42px; }
.photo-pet { position: absolute; right: 14%; bottom: 46px; z-index: 2; }
.photo-caption {
  position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 3;
  background: rgba(30,20,60,.68); color: #fff; border-radius: 14px;
  text-align: center; padding: 9px 12px; font-size: 14px;
}

/* --- родительский гейт --- */
.gate-q { font-size: 26px; font-weight: 900; text-align: center; color: var(--lav-deep); margin: 8px 0; }
.gate-input { text-align: center; font-size: 20px; font-weight: 800; }
/* «Для мамы»: абонементы, акции, связь со школой */
.school-card { margin-top: 10px; }
.price-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.price-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 14px; background: #f6f7fd; border: 2px solid transparent;
}
.price-row.featured { border-color: var(--lav-deep); background: #eef0fc; }
.price-row small { display: block; font-size: 11.5px; font-weight: 600; opacity: .7; margin-top: 2px; }
.price-val { font-weight: 900; white-space: nowrap; text-align: right; }
.offer-list { margin: 10px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.45; }
.offer-list li + li { margin-top: 4px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }

/* ============================================================
   Кабинеты: анкета, родитель, администратор (js/shell/)
   ============================================================ */
.shell { padding-bottom: 40px; }
.shell .card { margin-top: 12px; }
.shell-loading { min-height: 70vh; display: grid; place-items: center; font-size: 44px; animation: pointeBounce 1.4s ease-in-out infinite; }
.shell-center { text-align: center; padding-top: 18vh; }
.shell-emoji { font-size: 48px; margin-bottom: 8px; }
.shell-top { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.shell-top .grow, .grow { flex: 1; min-width: 0; }
.shell-title { font-size: 22px; font-weight: 900; color: var(--ink); }
.shell-sub { font-size: 13px; color: var(--ink-soft); font-weight: 700; margin-top: 2px; }
.shell-p { font-size: 13.5px; line-height: 1.45; color: var(--ink-soft); margin: 4px 0 10px; }
.shell-back { color: var(--ink); margin: 6px 0 4px; }
.role-chip { background: var(--lav-deep); color: #fff; border-radius: 999px; padding: 5px 11px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.link { color: var(--lav-deep); text-decoration: underline; cursor: pointer; }

/* «Кто вы?» */
.who-card { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; border: 2px solid transparent;
  font-family: inherit; cursor: pointer; margin-top: 12px; }
.who-card:active { transform: scale(.98); border-color: var(--lav-deep); }
.who-card b { display: block; font-size: 17px; color: var(--ink); }
.who-card small { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; line-height: 1.35; }
.who-emoji { font-size: 38px; }
.studio-pick .branch-item { cursor: pointer; }

/* кабинет родителя */
.kid-chips { margin-bottom: 4px; }
.hero-card { display: flex; align-items: center; gap: 12px; }
.hero-name { font-size: 20px; font-weight: 900; color: var(--ink); }
.pearl-total { font-size: 15px; margin: 4px 0 8px; }
.visit-list { display: flex; flex-direction: column; gap: 6px; }
.visit-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 7px 10px; background: #f6f7fd; border-radius: 10px; }
.v-yes { color: #2f9e6e; } .v-no { color: var(--ink-soft); font-weight: 700; }
.sh-head { margin-bottom: 8px; }
.sh-head small { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.sh-row { display: flex; gap: 10px; font-size: 13.5px; padding: 6px 0; border-top: 1px solid #eef0f8; }
.sh-row b { min-width: 76px; }
.invite-link { display: block; word-break: break-all; background: #f6f7fd; padding: 8px; border-radius: 8px; font-size: 12px; user-select: all; }
.preview-bar { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.preview-bar small { display: block; font-size: 11px; opacity: .7; }

/* кабинет администратора */
.admin-tabs { margin-bottom: 6px; }
.badge-dot { background: var(--danger); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.day-nav { display: flex; align-items: center; gap: 10px; text-align: center; margin: 10px 0; }
.day-nav small { display: block; font-size: 11.5px; color: var(--ink-soft); }
.mark-list { padding: 6px 10px; }
.mark-row { display: flex; align-items: center; gap: 6px; padding: 9px 0; border-top: 1px solid #eef0f8; }
.mark-row:first-child { border-top: none; }
.mark-row small { display: block; font-size: 11.5px; color: var(--ink-soft); }
.mark-btn { border: 2px solid #dcdff5; background: #fff; border-radius: 10px; padding: 7px 10px; font-family: inherit; font-weight: 800; font-size: 12.5px; cursor: pointer; color: var(--ink-soft); }
.mark-btn.yes.on { background: #2f9e6e; border-color: #2f9e6e; color: #fff; }
.mark-btn.no.on { background: var(--ink-soft); border-color: var(--ink-soft); color: #fff; }
.student-card.is-new { border: 2px solid var(--peach); }
.st-head { display: flex; align-items: center; gap: 8px; }
.st-head small { display: block; font-size: 12px; color: var(--ink-soft); }
.st-meta { font-size: 12.5px; color: var(--ink-soft); margin: 8px 0; line-height: 1.5; }
.st-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-new { background: var(--peach); color: var(--ink); border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 800; }
.team-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 14px; }
.team-row small { color: var(--ink-soft); margin-left: auto; }

/* игра, открытая из кабинета */
.game-bar { position: sticky; top: 0; z-index: 49; display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; padding: 6px 10px; }
.game-bar .grow { text-align: right; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-exit { border: none; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff;
  font-family: inherit; font-weight: 800; font-size: 12.5px; padding: 6px 12px; cursor: pointer; }

/* окно отзыва (бета) */
.feedback-text { width: 100%; min-height: 120px; resize: vertical; font-family: inherit; line-height: 1.4; text-align: left; box-sizing: border-box; }

/* --- возрастной слой «Малышка» (3–5): крупнее и проще --- */
body[data-layer="toddler"] .room-action { width: 64px; height: 64px; }
body[data-layer="toddler"] .ra-label { font-size: 12px; font-weight: 900; }
body[data-layer="toddler"] .nav-btn { font-size: 13px; }
body[data-layer="toddler"] .nav-ico svg { width: 30px; height: 30px; }
body[data-layer="toddler"] .btn { min-height: 52px; font-size: 16px; }
body[data-layer="toddler"] .shop-grid { grid-template-columns: 1fr 1fr; }
body[data-layer="toddler"] .shop-thumb { width: 104px; height: 104px; }
body[data-layer="toddler"] .exam-move { padding: 22px 10px; }
body[data-layer="toddler"] .em-emoji { font-size: 40px; }
body[data-layer="toddler"] .screen-sub { font-size: 15px; }

/* слой «Балерина» (9–12): компактнее, взрослее */
body[data-layer="teen"] .sparkles { display: none; }

/* ============================================================
   ИТЕРАЦИЯ 4: игры, профиль, аватарка
   ============================================================ */

/* аватарка в топбаре — кликабельная, с карандашиком */
.tb-avatar { position: relative; border: none; background: transparent; padding: 0; cursor: pointer; }
.tb-avatar-img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2.5px solid #fff; box-shadow: var(--shadow-soft); }
.tb-edit {
  position: absolute; right: -3px; bottom: -3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--lav-deep); color: #fff; font-size: 10px;
  display: grid; place-items: center; box-shadow: var(--shadow-soft);
}

/* карточки списка игр */
.game-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-soft);
  padding: 16px; margin-bottom: 12px; cursor: pointer;
  transition: transform .15s;
}
.game-card:active { transform: scale(.97); }
.gc-emoji {
  width: 56px; height: 56px; border-radius: 18px; flex: none;
  display: grid; place-items: center; font-size: 30px;
  background: linear-gradient(135deg, #e9ebf8, #ffe9d9);
}
.gc-info { flex: 1; }
.gc-name { font-weight: 900; font-size: 16px; }
.gc-desc { font-size: 12.5px; color: var(--ink-soft); }
.gc-go {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 13px;
  background: linear-gradient(135deg, var(--lav-deep), var(--pink));
}

/* звёздный дождь */
.game-hud {
  display: flex; justify-content: space-between; margin-bottom: 10px;
  font-weight: 900; font-size: 16px; color: var(--lav-deep);
}
.game-stage {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow); min-height: 420px; flex: 1;
}
.gs-start {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(30, 20, 60, .55); color: #fff; text-align: center;
  font-weight: 800; cursor: pointer;
}
.gs-star {
  position: absolute; z-index: 3; border: none; background: transparent;
  cursor: pointer; padding: 6px; line-height: 1;
  filter: drop-shadow(0 0 10px rgba(255, 209, 102, .9));
  animation: starIn .25s ease-out;
  transition: opacity .5s;
}
.gs-star.fade { opacity: .25; }
.gs-star.pop { animation: starPop .2s ease-out forwards; }
@keyframes starIn { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1); } }
@keyframes starPop { to { transform: scale(1.8); opacity: 0; } }

/* мемори */
.memory-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.memory-grid.small { grid-template-columns: repeat(3, 1fr); max-width: 300px; margin: 0 auto; }
.mem-card {
  position: relative; aspect-ratio: 3 / 3.4; border: none; cursor: pointer;
  border-radius: var(--r-md); background: transparent; perspective: 400px;
  font-family: inherit; padding: 0;
}
.mc-back, .mc-face {
  position: absolute; inset: 0; border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  backface-visibility: hidden; transition: transform .35s;
  box-shadow: var(--shadow-soft); font-size: 30px;
}
.mc-back { background: linear-gradient(135deg, var(--lav), var(--pink)); }
.mc-face { background: #fff; transform: rotateY(180deg); }
.mc-face small { font-size: 10.5px; font-weight: 900; color: var(--ink-soft); }
.mem-card.open .mc-back, .mem-card.done .mc-back { transform: rotateY(-180deg); }
.mem-card.open .mc-face, .mem-card.done .mc-face { transform: rotateY(0); }
.mem-card.done .mc-face { background: #eafff3; box-shadow: 0 0 0 2px var(--mint), var(--shadow-soft); }

/* профиль */
.profile-ava { display: flex; justify-content: center; margin-bottom: 12px; }
.profile-ava img { width: 130px; height: 130px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: var(--shadow); }

/* ============================================================
   ИТЕРАЦИЯ 5: школа, 3 в ряд, тетрис, палитры комнаты
   ============================================================ */

/* ФИКС: героиня всегда над фоновой картинкой (фото/урок/питомец) */
.hero-holder { position: relative; z-index: 2; }
.photo-hero, .lesson-hero { position: relative; z-index: 2; }

/* палитра комнаты: тонируем только фоны-комнаты */
.tintable { filter: var(--room-tint, none); }

/* цветной кружок-палитра в магазине */
.color-chip {
  display: block; width: 56px; height: 56px; border-radius: 50%;
  border: 4px solid #fff; box-shadow: var(--shadow-soft);
}

/* оценки в школе */
.grade-badge { padding: 1px 8px; border-radius: 999px; color: #fff; font-size: 11px; }
.grade-badge.g5 { background: #4cbc86; }
.grade-badge.g4 { background: #7ba7e8; }
.grade-badge.g3 { background: #e8a659; }

/* вопрос и варианты ответов */
.school-q {
  font-size: 20px; font-weight: 900; text-align: center;
  padding: 26px 18px; margin-bottom: 14px; font-family: 'Manrope';
}
.school-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.school-opt {
  border: 3px solid transparent; border-radius: var(--r-md); cursor: pointer;
  background: var(--card); box-shadow: var(--shadow-soft);
  padding: 16px 10px; font-family: inherit; font-weight: 800; font-size: 16px;
  color: var(--ink); transition: all .15s;
}
.school-opt:active { transform: scale(.97); }
.school-opt.right { border-color: #4cbc86; background: #eafff3; }
.school-opt.wrong { border-color: var(--danger); background: #fff0f0; }

/* три в ряд */
.m3-board {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px;
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-soft);
  padding: 10px;
}
.m3-cell {
  aspect-ratio: 1; border: none; border-radius: 11px; cursor: pointer;
  background: #edf2f8; font-size: 24px; display: grid; place-items: center;
  transition: transform .15s, box-shadow .15s; padding: 0;
}
.m3-cell.sel { transform: scale(1.12); box-shadow: 0 0 0 3px var(--lav-deep); z-index: 2; }
.m3-cell.empty { background: transparent; }

/* тетрис */
.tet-wrap {
  display: flex; justify-content: center;
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-soft);
  padding: 12px;
}
#tet-canvas { background: #edf2f8; border-radius: 12px; }
.tet-controls { display: flex; justify-content: center; gap: 12px; margin-top: 12px; }
.tet-btn {
  width: 62px; height: 54px; border: none; border-radius: 18px; cursor: pointer;
  background: var(--card); box-shadow: var(--shadow-soft);
  font-size: 22px; color: var(--lav-deep); font-weight: 900;
  transition: transform .12s;
}
.tet-btn:active { transform: scale(.92); background: #e9ebf8; }

/* достижения — теперь кнопки */
.ach-cell { border: none; font-family: inherit; cursor: pointer; }

/* ============================================================
   Постановка героини «на пол»: мягкая эллипс-тень под ногами
   (сами PNG теперь генерируются БЕЗ тени и обрезаются по ступни)
   ============================================================ */
.hero-holder { display: flex; flex-direction: column; align-items: center; }
.hero-holder::after {
  content: '';
  display: block;
  width: 62%;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(80, 50, 140, .30) 0%, rgba(80, 50, 140, .12) 55%, transparent 75%);
}
/* картинка героини больше не носит собственную drop-shadow */
.hero-img.cutout { filter: none; }

/* ---------- переключатель языка в профиле ---------- */
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lang-btn {
  display: flex; align-items: center; gap: 8px;
  border: 2.5px solid transparent; border-radius: var(--r-md);
  background: #eef1f8; padding: 11px 13px; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 13.5px; color: var(--ink);
  transition: all .15s;
}
.lang-btn.active { border-color: var(--lav-deep); background: #e9ebf8; }
.lang-btn:active { transform: scale(.97); }
.lang-flag { font-size: 18px; }

/* аватар-кукла: круглый кроп головы из full-body PNG */
.tb-avatar-doll { object-position: 50% 4%; background: linear-gradient(160deg, #e9ebf8, #ffe9d9); }
.profile-ava .profile-doll { object-position: 50% 4%; background: linear-gradient(160deg, #e9ebf8, #ffe9d9); }

/* ============================================================
   ИТЕРАЦИЯ 7: сценарный движок и грейды
   ============================================================ */

/* карточка текущей главы на главной */
.story-card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: linear-gradient(135deg, #eef0fb, #fdf3ec);
  border: 2px solid #dcdff5; border-radius: var(--r-lg);
  padding: 12px 14px; margin-top: 12px; cursor: pointer;
  font-family: inherit; text-align: left;
  box-shadow: var(--shadow-soft); transition: transform .15s, border-color .2s;
}
.story-card:active { transform: scale(.98); }
.story-card.ready {
  border-color: var(--lav-deep);
  background: linear-gradient(135deg, var(--lav-deep), var(--pink));
  color: #fff;
  animation: storyPulse 2.4s ease-in-out infinite;
}
@keyframes storyPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(126, 127, 217, .35); }
  50% { box-shadow: 0 6px 28px rgba(126, 127, 217, .65); }
}
.story-card.done-all { cursor: default; }
.sc-portrait { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; object-position: 50% 12%; background: #fff; flex: none; border: 2px solid #fff; }
.sc-emoji { font-size: 30px; flex: none; }
.sc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sc-act { font-weight: 900; font-size: 13.5px; }
.sc-hint { font-size: 11.5px; opacity: .85; line-height: 1.35; }
.sc-track { display: block; height: 6px; border-radius: 3px; background: rgba(126,127,217,.2); overflow: hidden; }
.sc-fill { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--lav-deep), var(--pink)); }
.sc-go { font-weight: 900; font-size: 13px; flex: none; opacity: .9; }

/* экран-сценка */
.story-screen { padding: 0 !important; }
.story-stage { position: relative; flex: 1; min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.story-close { position: absolute; top: 14px; right: 14px; z-index: 6; color: var(--ink); }
.story-title {
  position: absolute; top: 16px; left: 16px; z-index: 5;
  background: rgba(20, 27, 52, .6); color: #fff; border-radius: 999px;
  padding: 7px 14px; font-size: 12.5px; font-weight: 800;
}
.story-dialog {
  position: relative; z-index: 5; display: flex; align-items: flex-end; gap: 10px;
  margin: 14px; cursor: pointer;
}
.sd-portrait { width: 92px; height: 92px; border-radius: 24px; overflow: hidden; flex: none; background: rgba(255,255,255,.85); border: 3px solid #fff; box-shadow: var(--shadow); display: grid; place-items: center; }
.sd-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; }
.sd-emoji { font-size: 44px; }
.sd-bubble {
  flex: 1; background: rgba(255, 255, 255, .96); border-radius: 20px 20px 20px 6px;
  box-shadow: var(--shadow); padding: 13px 15px; min-height: 92px;
}
.sd-name { font-weight: 900; font-size: 12px; color: var(--lav-deep); margin-bottom: 4px; }
.sd-text { font-size: 14.5px; line-height: 1.45; font-weight: 600; }
.sd-next { font-size: 10.5px; color: var(--ink-soft); margin-top: 6px; text-align: right; }

/* выбор пути (развилка) */
.story-choice { position: relative; z-index: 5; display: flex; gap: 12px; margin: 0 14px 14px; }
.choice-card {
  flex: 1; position: relative; border: 3px solid #fff; border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; min-height: 170px; padding: 0;
  box-shadow: var(--shadow); display: flex; align-items: flex-end;
  transition: transform .15s;
}
.choice-card:active { transform: scale(.96); }
.choice-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.choice-label {
  position: relative; z-index: 2; width: 100%; padding: 10px 12px;
  background: linear-gradient(transparent, rgba(20, 27, 52, .8));
  color: #fff; font-weight: 900; font-size: 13.5px; font-family: inherit;
  text-shadow: 0 2px 6px rgba(0,0,0,.5);
}

/* коллекция уникальных предметов */
.collection-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.coll-cell {
  background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-soft);
  padding: 8px 6px; text-align: center;
}
.coll-cell img { width: 56px; height: 56px; object-fit: contain; }
.coll-name { font-size: 9.5px; font-weight: 800; color: var(--ink-soft); line-height: 1.2; margin-top: 4px; }

/* ============================================================
   ИТЕРАЦИЯ 8: живые сценки
   ============================================================ */
#story-bgbox img.story-bg-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bg-fade-in { animation: bgFade .7s ease; }
@keyframes bgFade { from { opacity: 0; } to { opacity: 1; } }

/* персонажи на сцене */
.story-actors {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 4% 26%;
}
.actor { height: 38vh; max-height: 340px; object-fit: contain; animation: actorIn .5s ease both; filter: drop-shadow(0 12px 16px rgba(20, 27, 52, .35)); }
.actor-hero { margin-left: 6%; }
.actor-avrora { height: 44vh; max-height: 390px; margin-right: 2%; }
.story-actors:has(.actor-hero):not(:has(.actor-avrora)):not(:has(.actor-mama)) { justify-content: center; }
/* трое на сцене (я + мама + Аврора) — уменьшаем, чтобы влезли по ширине */
.story-actors:has(.actor-hero):has(.actor-mama):has(.actor-avrora) { padding: 0 2% 26%; }
.story-actors:has(.actor-hero):has(.actor-mama):has(.actor-avrora) .actor { height: 30vh; max-height: 268px; margin: 0; }
.story-actors:has(.actor-hero):has(.actor-mama):has(.actor-avrora) .actor-mama { height: 32vh; max-height: 285px; }
.story-actors:has(.actor-hero):has(.actor-mama):has(.actor-avrora) .actor-avrora { height: 34vh; max-height: 300px; }
@keyframes actorIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.actor.tappable { pointer-events: auto; cursor: pointer; animation: actorIn .5s ease both, tapGlow 1.6s ease-in-out infinite .5s; }
@keyframes tapGlow {
  0%, 100% { filter: drop-shadow(0 12px 16px rgba(20,27,52,.35)); }
  50% { filter: drop-shadow(0 12px 22px rgba(126,127,217,.85)); }
}
.actor-bounce { animation: actorBounce .4s ease !important; }
@keyframes actorBounce { 30% { transform: translateY(14px) scaleY(.94); } 65% { transform: translateY(-10px); } }

/* подсказка тап-действия */
.action-hint {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 6;
  background: rgba(255, 255, 255, .95); border-radius: 999px;
  padding: 10px 18px; font-weight: 800; font-size: 13.5px; color: var(--ink);
  box-shadow: var(--shadow); white-space: nowrap;
  animation: pointeBounce 1.8s ease-in-out infinite;
}
.action-hint b { color: var(--lav-deep); }

/* варианты ответа в диалоге */
.sd-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.sd-choice {
  border: 2px solid #dcdff5; background: #f6f7fd; border-radius: 14px;
  padding: 11px 14px; font-family: inherit; font-weight: 800; font-size: 13.5px;
  color: var(--ink); cursor: pointer; text-align: left; transition: all .15s;
}
.sd-choice:active { transform: scale(.97); background: #e9ebf8; border-color: var(--lav-deep); }

/* ============================================================
   Онбординг: настройка «Я + Мама»
   ============================================================ */
.custom-duo {
  display: flex; align-items: flex-end; justify-content: center; gap: 6px;
  min-height: 250px; margin-bottom: 12px;
}
.duo-fig {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; border-radius: var(--r-lg); padding: 6px 8px 8px;
  border: 2.5px solid transparent; transition: all .2s; position: relative;
}
.duo-fig.active { border-color: var(--lav-deep); background: rgba(126,127,217,.08); }
.duo-fig figcaption { font-weight: 900; font-size: 12.5px; color: var(--ink); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duo-fig.active figcaption { color: var(--lav-deep); }
.duo-girl { height: 168px; object-fit: contain; object-position: bottom; }
.duo-mama { height: 236px; object-fit: contain; object-position: bottom; }

.custom-tabs { display: flex; gap: 10px; margin-bottom: 14px; }
.ctab {
  flex: 1; border: 2px solid #dcdff5; background: #fff; border-radius: 999px;
  padding: 11px; font-family: inherit; font-weight: 900; font-size: 14.5px;
  color: var(--ink-soft); cursor: pointer; transition: all .2s;
}
.ctab.active { background: linear-gradient(135deg, var(--lav-deep), var(--pink)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(126,127,217,.4); }

/* мама-актёр в сценке (рядом с героиней) */
.actor-mama { height: 42vh; max-height: 380px; margin-right: 4%; }

/* ============================================================
   Интуитивность 4-9: опыт до уровня, умные подсказки
   ============================================================ */
.tb-xp { font-size: 10px; font-weight: 800; color: var(--lav-deep); margin-top: 3px; white-space: nowrap; }

/* недоступная глава — мягко приглушена, но кликабельна за подсказкой */
.story-card.locked { opacity: .92; }
.story-card.locked .sc-go { font-size: 12px; }

/* окно-подсказка главы */
.hint-what { font-size: 15px; font-weight: 800; line-height: 1.4; margin-bottom: 10px; }
.hint-track { height: 10px; border-radius: 6px; background: #e6e8f6; overflow: hidden; margin: 6px 0 4px; }
.hint-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--lav-deep), var(--pink)); transition: width .3s; }
.hint-frac { font-size: 12px; font-weight: 800; color: var(--ink-soft); margin-bottom: 10px; }
.hint-level { font-size: 13px; background: #eef0fb; border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; }
.hint-grow { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; background: #fff6ec; border-radius: 12px; padding: 8px 12px; }
