/* ===== СобериКод: стили =====
   Без внешних шрифтов и библиотек — только системные шрифты, чтобы ничего не грузилось из интернета. */

:root {
  --blue: #4A7DFF; --blue-dark: #2E5BD9; --yellow: #FFD34E; --orange: #FFA53A;
  --pink: #FF6FA8; --green: #2FBF7F; --green-dark: #22A56A; --purple: #8B5CF6; --red: #F0453A;
  /* --muted затемнён до контраста 6:1 на белом: серый текст читают и дети
     с плохим зрением, и учитель с проектора. Требование WCAG AA — 4.5:1. */
  --bg: #F5F8FF; --card: #fff; --text: #1F2544; --muted: #565E80; --line: #E3E8F6;
  --shadow: 0 8px 24px rgba(74, 125, 255, .12); --radius: 18px;
  --c-motion: #4A7DFF; --c-looks: #8B5CF6; --c-sound: #2FBF7F; --c-control: #FF9A2E;
  --c-collect: #12B3A4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* Браузер прячет [hidden] правилом display: none, но любое своё display
   (а у кнопок оно flex) это правило перебивает — и скрытая кнопка остаётся
   на экране. Поэтому прячем явно. */
[hidden] { display: none !important; }
/* overscroll-behavior-x: лента предметов прокручивается вбок, и у её края
   браузер начинал «листать назад» — ребёнок уезжал с сайта. */
html { -webkit-text-size-adjust: 100%; overscroll-behavior-x: none; }
body { overscroll-behavior-x: none; }
/* Шрифт системный — ни одного скачанного байта. Размер и межстрочный интервал
   подняты под младшего школьника: он читает по слогам, и мелкий плотный текст
   для него не «компактный», а нечитаемый. */
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 17px; line-height: 1.6; min-height: 100vh;
  display: flex; flex-direction: column;
}
/* Длинная строка сбивает ребёнка со строки при переносе взгляда */
p { max-width: 68ch; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }
svg { display: block; }
.muted { color: var(--muted); }
.small-note { font-size: 13px; color: var(--muted); margin-top: 14px; }
.small-note a { color: var(--blue); font-weight: 700; }

/* ---------- Шапка ---------- */
header { position: sticky; top: 0; z-index: 50; background: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, .05); }
.nav { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 20px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 21px; color: var(--blue); flex-shrink: 0; }
.logo-mark { width: 36px; height: 36px; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a { padding: 8px 12px; border-radius: 10px; font-weight: 700; color: var(--muted); white-space: nowrap; transition: .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--blue); background: #EEF3FF; }
.auth-area { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.user-badge { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: #EEF3FF; font-weight: 700; }
.mini-ava { width: 32px; height: 32px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.ub-stars { display: flex; align-items: center; gap: 3px; color: #B47C00; }
.ub-stars svg { width: 18px; height: 18px; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: 12px; font-weight: 800; font-size: 15px; transition: .2s; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost { background: #EEF3FF; color: var(--blue-dark); }
.btn-ghost:hover { background: #DCE6FF; }
.btn-go { background: var(--green); color: #fff; }
.btn-go:hover { background: var(--green-dark); }
.btn-stop { background: var(--red); }
.btn-stop:hover { background: #D93229; }
.btn-hint { background: #FFF4CC; color: #9A6A00; }
.btn-hint:hover { background: #FFEBA3; }
.btn-danger { background: var(--red); color: #fff; }
.btn-white { background: #fff; color: var(--blue-dark); }
.btn-lg { min-height: 52px; padding: 13px 26px; font-size: 17px; border-radius: 14px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.link-btn { color: inherit; text-decoration: underline; padding: 0; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ---------- Страницы ---------- */
.page { display: none; flex: 1; }
.page.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 860px; }
/* Ритм страницы: белая секция — цветная — белая. Длинный ровный документ
   глазу не за что зацепить. На главной секций нет вовсе: её занимает сцена. */
section { padding: 56px 0; }
.section-white { background: #fff; }
.section-tint { background: linear-gradient(180deg, #EEF3FF, #F7EDFF); }
.section-head { text-align: center; margin-bottom: 30px; }
.section-head.left { text-align: left; margin: 0 0 18px; padding-top: 24px; }
.section-head h2 { font-size: 34px; font-weight: 900; line-height: 1.2; margin-bottom: 6px; }
.section-head p { color: var(--muted); font-size: 17px; max-width: 62ch; margin: 0 auto; }
.section-head.left p { margin-left: 0; }
.center-row { display: flex; justify-content: center; margin-top: 26px; }
.card { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h3 { font-size: 20px; margin-bottom: 8px; }

/* ---------- Главная ---------- */
.hero-visual { background: #fff; border-radius: 26px; padding: 18px; box-shadow: var(--shadow); }
.hv-stage { position: relative; aspect-ratio: 5 / 3; border-radius: 16px; background-color: #E3F6E5;
  background-image: linear-gradient(#CBEBCF 2px, transparent 2px), linear-gradient(90deg, #CBEBCF 2px, transparent 2px); background-size: 20% 33.34%; overflow: hidden; }
.hv-hero { position: absolute; width: 20%; left: 2%; top: 36%; animation: hvWalk 6s ease-in-out infinite; }
.hv-star { position: absolute; width: 16%; left: 82%; top: 38%; animation: pulse 1.6s ease-in-out infinite; }
@keyframes hvWalk { 0%, 15% { left: 2%; } 50%, 85% { left: 62%; } 100% { left: 2%; } }
.hv-blocks { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.hvb { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.hvb svg { width: 28px; height: 28px; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.course-card { background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; border-top: 6px solid var(--accent, var(--blue)); }
.c-yellow { --accent: #FFC531; --soft: #FFF6D6; --ink: #8A5E00; }
.c-blue { --accent: #4A7DFF; --soft: #E4EDFF; --ink: #2E5BD9; }
.c-pink { --accent: #FF6FA8; --soft: #FFE6F0; --ink: #C2306D; }
.c-green { --accent: #2FBF7F; --soft: #DFF6EA; --ink: #1B8558; }
.c-purple { --accent: #8B5CF6; --soft: #EEE7FE; --ink: #6333D6; }
.course-top { display: flex; justify-content: space-between; align-items: center; }
.lvl { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--soft, #E4EDFF); color: var(--ink, var(--blue-dark)); }
.grade { font-size: 14px; font-weight: 700; color: var(--muted); }
.course-hero { width: 76px; height: 76px; padding: 8px; border-radius: 20px; background: var(--soft); }
.course-hero.big { width: 96px; height: 96px; flex-shrink: 0; }
.course-card h3 { font-size: 22px; font-weight: 900; }
.course-card p { color: var(--muted); font-size: 16px; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-s { padding: 3px 10px; border-radius: 999px; background: #F0F3FB; font-size: 13px; font-weight: 700; color: var(--muted); }
.mini-progress { height: 8px; border-radius: 99px; background: #EEF1F8; overflow: hidden; }
.mini-progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.course-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); font-weight: 600; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { text-align: center; padding: 18px; }
.step-num { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 22px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.step h4 { font-size: 19px; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: 16px; }
/* Последний экран — приглашение, а не баннер: много воздуха, крупная кнопка,
   герой выглядывает из-за угла и вокруг летят искры. */
.cta-strip { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff; border-radius: 30px; padding: 56px 24px 60px; text-align: center; }
.cta-strip h2 { font-size: 34px; font-weight: 900; }
.cta-strip p { margin: 10px auto 24px; font-size: 18px; }
.cta-strip .btn-white { box-shadow: 0 10px 24px rgba(0, 0, 0, .18); }
.cta-strip .btn-white:hover { transform: translateY(-3px) scale(1.03); }
.cta-hero { position: absolute; left: 50%; top: 14px; width: 62px; transform: translateX(-50%); opacity: .95; animation: ctaBob 3.4s ease-in-out infinite; }
.cta-hero svg { width: 100%; height: auto; }
@keyframes ctaBob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -8px); } }
.cta-strip > h2 { margin-top: 56px; }
.cta-sparks i { position: absolute; width: 10px; height: 10px; border-radius: 3px; background: rgba(255, 255, 255, .55); animation: sparkle 4s ease-in-out infinite; }
.cta-sparks i:nth-child(1) { left: 8%; top: 24%; animation-delay: 0s; }
.cta-sparks i:nth-child(2) { left: 18%; top: 68%; animation-delay: .6s; }
.cta-sparks i:nth-child(3) { left: 32%; top: 18%; animation-delay: 1.2s; }
.cta-sparks i:nth-child(4) { right: 12%; top: 30%; animation-delay: .3s; }
.cta-sparks i:nth-child(5) { right: 24%; top: 72%; animation-delay: 1.5s; }
.cta-sparks i:nth-child(6) { right: 6%; top: 56%; animation-delay: .9s; }
@keyframes sparkle { 0%, 100% { opacity: .2; transform: scale(.7) rotate(0); } 50% { opacity: .9; transform: scale(1.25) rotate(45deg); } }

/* ---------- Список уроков ---------- */
.course-head { display: flex; gap: 20px; align-items: center; margin: 20px 0 24px; padding: 22px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); border-left: 6px solid var(--accent); }
.course-head h2 { font-size: 28px; font-weight: 900; margin: 4px 0; }
.course-head p { color: var(--muted); }
.lessons-list { display: flex; flex-direction: column; gap: 10px; }
.lesson-item { display: flex; align-items: center; gap: 16px; padding: 14px 18px; text-align: left; background: #fff; border-radius: 16px; box-shadow: var(--shadow); border: 2px solid transparent; transition: .2s; width: 100%; }
.lesson-item:hover:not(:disabled) { border-color: #CFDBFF; transform: translateX(4px); }
.lesson-item .num { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; background: #EEF3FF; color: var(--blue-dark); font-weight: 900; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.lesson-item.done .num { background: var(--green); color: #fff; }
.lesson-item.locked { opacity: .55; cursor: not-allowed; }
.li-text { flex: 1; display: flex; flex-direction: column; }
.li-text b { font-size: 17px; }
.li-text small { color: var(--muted); }
.stars { display: inline-flex; gap: 2px; }
.stars .st svg { width: 26px; height: 26px; }

/* ---------- Экран урока ---------- */
.lesson { padding-top: 18px; padding-bottom: 36px; }
.lesson-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.lt-title { flex: 1; min-width: 200px; }
.lt-title small { color: var(--muted); font-weight: 700; }
.lt-title h2 { font-size: 24px; font-weight: 900; line-height: 1.2; }
.dots { display: flex; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #DDE3F2; }
.dot.ok { background: var(--green); }
.dot.cur { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--blue); }
.lesson-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.col-stage, .col-code { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: #EEF3FF; margin-bottom: 12px; }
.task-hero { width: 48px; height: 48px; flex-shrink: 0; }
.task p { font-size: 16px; }
.hint-box { display: none; padding: 12px 14px; border-radius: 14px; background: #FFF4CC; color: #6B4E00; margin-bottom: 12px; font-size: 15px; }
.hint-box.show { display: block; animation: fade .25s; }

/* Сцена */
.stage { --cols: 7; --rows: 5; position: relative; width: 100%; aspect-ratio: 7 / 5; border-radius: 16px; overflow: hidden; user-select: none; }
/* Фон — нарисованное место, а не заливка. Лежит под клетками и чуть
   приглушён: поверх него должны читаться предметы и герой. */
.scene-art { position: absolute; inset: 0; z-index: 0; opacity: .8; pointer-events: none; }
.scene-art svg { width: 100%; height: 100%; display: block; }
.cells { position: absolute; inset: 0; z-index: 1; display: grid; grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(var(--rows), 1fr); }
.cell { border-right: 2px solid var(--grid-line); border-bottom: 2px solid var(--grid-line); display: flex; align-items: center; justify-content: center; }
.item { width: 76%; height: 76%; transition: transform .25s, opacity .25s; }
.item svg { width: 100%; height: 100%; }
.item.pick { width: 62%; height: 62%; }
/* Украшения не должны спорить с героем: чуть меньше и чуть мягче */
.item.deco { width: 66%; height: 66%; opacity: .95; }
.item.pick.gone { transform: scale(0) translateY(-40%); opacity: 0; }
.item.goal { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.stage.won .item.goal { animation: spin .8s ease; }
@keyframes spin { from { transform: rotate(0) scale(1.3); } to { transform: rotate(360deg) scale(1); } }
.bg-forest { --grid-line: rgba(70, 130, 80, .16); background: #E4F5DC; }
.bg-city   { --grid-line: rgba(60, 90, 140, .14); background: #DDECFF; }
.bg-space  { --grid-line: rgba(255, 255, 255, .10); background: #1E2452; }
.bg-fairy  { --grid-line: rgba(120, 80, 150, .14); background: #F6E4FF; }
.bg-beach  { --grid-line: rgba(150, 110, 40, .16); background: #CFF0FF; }
.bg-snow   { --grid-line: rgba(90, 130, 180, .16); background: #E9F4FF; }
.bg-castle { --grid-line: rgba(90, 80, 150, .14); background: #E7E6FF; }
.bg-day    { --grid-line: rgba(70, 120, 170, .14); background: #CDE9FF; }
.bg-night  { --grid-line: rgba(255, 255, 255, .10); background: #1B2347; }
/* Старые работы с прежними фонами открываются, а не падают */
.bg-meadow { --grid-line: rgba(70, 130, 80, .16); background: #E4F5DC; }
.bg-sea, .bg-sunset, .bg-rainbow { --grid-line: rgba(70, 120, 170, .14); background: #CFF0FF; }

.actor { position: absolute; width: calc(100% / var(--cols)); height: calc(100% / var(--rows));
  left: calc(100% * var(--c) / var(--cols)); top: calc(100% * var(--r) / var(--rows)); transition: left .4s ease, top .4s ease; z-index: 2; }
.actor.no-anim { transition: none; }
.sprite { width: 100%; height: 100%; padding: 6%; transition: opacity .25s, transform .3s ease-out; }
/* Подъём в прыжке — переход, а не анимация: при системном «уменьшить
   движение» браузер обрывает анимации, и прыжок пропадал. */
.sprite.lift { transform: translateY(-62%) scale(1.06); }
.sprite svg { width: 100%; height: 100%; transform: scaleX(var(--flip, 1)) scale(var(--sc, 1)) rotate(var(--rot, 0deg)); transition: transform .4s; }
.sprite.hop { animation: hop .5s ease; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-55%); } }
/* Перелёт на другую клетку: пока герой наверху, он плавно переезжает вбок */
.actor.jumping { transition: left .44s ease-in-out, top .44s ease-in-out; }
.sprite.bump { animation: bump .4s ease; }
@keyframes bump { 0%, 100% { transform: translate(0, 0); } 40% { transform: translate(calc(var(--dx) * 22%), calc(var(--dy) * 22%)) rotate(-8deg); } 70% { transform: translate(calc(var(--dx) * -6%), calc(var(--dy) * -6%)); } }
.sprite.wiggle { animation: wiggle .45s ease; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg) scale(1.08); } 75% { transform: rotate(12deg) scale(1.08); } }
.bubble { position: absolute; bottom: 92%; left: 50%; transform: translateX(-50%) scale(.6); opacity: 0; background: #fff; color: var(--text); border: 2px solid var(--text); border-radius: 14px; padding: 4px 10px; font-weight: 800; font-size: clamp(12px, 1.6vw, 16px); white-space: nowrap; transition: .2s; pointer-events: none; z-index: 3; }
.bubble::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--text); }
.bubble.show { opacity: 1; transform: translateX(-50%) scale(1); }
/* У верхнего ряда облачко уходило за край сцены, у крайних столбцов — вбок.
   Поэтому у края оно разворачивается внутрь поля. */
.bubble.b-down { bottom: auto; top: 92%; }
.bubble.b-down::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--text); }
.bubble.b-left { left: 0; transform: translateX(0) scale(.6); }
.bubble.b-left.show { transform: translateX(0) scale(1); }
.bubble.b-left::after { left: 22px; }
.bubble.b-right { left: auto; right: 0; transform: translateX(0) scale(.6); }
.bubble.b-right.show { transform: translateX(0) scale(1); }
.bubble.b-right::after { left: auto; right: 16px; }

/* Палитра и программа */
/* Заголовки — синие, а не серые: ребёнок ищет глазами цветное, и «ГЕРОЙ»,
   «ФОН», «МОЯ ПРОГРАММА» должны читаться как указатели, а не как мелкий шрифт. */
.code-label { font-size: 13px; font-weight: 800; color: var(--blue-dark); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.palette.locked, .workspace.locked { pointer-events: none; }
.palette.locked { opacity: .6; }
.pblock, .wblock { --bc: var(--c-motion); background: var(--bc); color: #fff; border-radius: 14px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18); }
.motion { --bc: var(--c-motion); }
.looks { --bc: var(--c-looks); }
.sound { --bc: var(--c-sound); }
.control { --bc: var(--c-control); }
.collect { --bc: var(--c-collect); }
.pblock { width: 70px; height: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: transform .15s; touch-action: manipulation; }
.pblock:hover { transform: translateY(-3px); }
.pblock:active { transform: scale(.94); }
.pblock .bi svg { width: 30px; height: 30px; }
.pblock .bl, .wblock .bl { font-size: 11px; font-weight: 800; }
.pblock.pulse { animation: pulseBlock .6s ease 3; box-shadow: 0 0 0 4px var(--yellow); }
@keyframes pulseBlock { 50% { transform: scale(1.15); } }
.hvb.motion, .hvb.looks, .hvb.sound, .hvb.control { background: var(--bc); }

.ws-head { display: flex; justify-content: space-between; align-items: baseline; }
.counter { font-size: 14px; color: var(--muted); font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #F0F3FB; }
.counter.full { background: #FFE9D6; color: #B25A00; }
.counter.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.workspace { min-height: 132px; border: 3px dashed #D5DDF2; border-radius: 16px; padding: 10px; margin-bottom: 14px; background: #FAFBFF; transition: .2s; }
.workspace.over { border-color: var(--blue); background: #EEF3FF; }
/* Отступ сверху и между блоками — чтобы кружок «×» не налезал на соседа */
.ws-main { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 8px; padding: 8px 4px 2px; min-height: 104px; align-content: flex-start; cursor: text; }
/* Подсказка мелкая и ниже курсора: курсор показывает, куда встанет блок,
   и он должен быть первым, что видно в пустом поле. */
.empty-hint { color: var(--muted); font-weight: 600; font-size: 13px; padding: 6px 8px; text-align: left; pointer-events: none; }
.wblock { position: relative; width: 66px; height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.wblock .bi svg { width: 28px; height: 28px; }
.wblock .rm { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: var(--text); font-weight: 900; line-height: 1; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); font-size: 15px; display: flex; align-items: center; justify-content: center; }
.say-input { width: 56px; max-width: 200px; border: none; border-radius: 6px; padding: 1px 3px; font-size: 11px; font-weight: 700; text-align: center; color: var(--text); }
.wblock.say { width: auto; min-width: 66px; padding: 0 6px; }
.wblock.running { transform: scale(1.12); box-shadow: 0 0 0 4px var(--yellow), inset 0 -4px 0 rgba(0, 0, 0, .18); z-index: 1; }
.wblock.wrong { box-shadow: 0 0 0 4px var(--red); animation: shake .4s; }
/* «Повтор» — рамка вокруг других блоков, и выглядеть он должен именно так:
   во всю ширину программы. В узкой колонке соседние блоки обтекали его
   сбоку, и было непонятно, что внутри повтора, а что после него. */
.wblock.rep { flex: 1 1 100%; width: auto; min-width: 150px; height: auto; flex-direction: column; align-items: stretch; padding: 6px 6px 8px; gap: 6px; cursor: default; }
.rep-head { display: flex; align-items: center; gap: 6px; padding: 0 4px; cursor: pointer; }
.rep-head .bi svg { width: 24px; height: 24px; }
.rep-n { background: #fff; color: #B25A00; font-weight: 900; font-size: 17px; min-width: 44px; min-height: 32px; border-radius: 10px; }
.rep-body { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; min-height: 80px; min-width: 120px; border-radius: 10px; background: rgba(255, 255, 255, .45); align-items: center; cursor: pointer; }
.rep-empty { font-size: 12px; font-weight: 700; color: #7A4300; padding: 0 6px; }
.wblock.rep.is-target .rep-body { background: rgba(255, 255, 255, .8); box-shadow: inset 0 0 0 2px #fff; }
.wblock.rep.running-rep { box-shadow: 0 0 0 4px var(--yellow); }
.ws-cursor { width: 4px; height: 58px; border-radius: 2px; background: var(--blue); align-self: center; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.controls .btn-go { min-width: 140px; }

/* Мастерская */
/* Сцену ребёнок собирает кликом по клетке, поэтому клетка должна выглядеть
   нажимаемой — но только в Мастерской, в уроке по карте не рисуют. */
#studioStage .cell { cursor: pointer; }
#studioStage .cell:hover { background: rgba(255, 255, 255, .35); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.proj-card { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.proj-preview { position: relative; height: 110px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pp-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.proj-preview span { position: relative; width: 70px; height: 70px; }
.proj-info { padding: 12px 14px; }
.proj-info h4 { font-size: 16px; }
.author { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.proj-actions { display: flex; gap: 6px; }

/* ---------- Профессии ---------- */
.quiz-cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; background: linear-gradient(135deg, #FFF6D6, #FFE6F0); }
.quiz-res { margin-bottom: 20px; border-left: 6px solid var(--green); }
.quiz-res p { margin: 6px 0 12px; }
.prof-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.prof-card { position: relative; background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border-top: 6px solid var(--pc); }
.prof-card h4 { font-size: 20px; margin-bottom: 6px; }
.prof-card p { color: var(--muted); font-size: 16px; margin-bottom: 10px; }
.prof-card small { font-weight: 700; color: var(--pc-ink); font-size: 14px; }
/* Карточка профессии: картинка и одна строчка сразу, абзац — по кнопке */
/* Иконки нарисованы белым штрихом (они живут на цветных блоках), поэтому
   плитка под ними — тёмная: на бледной подложке белая линия не видна. */
.pc-ico { display: block; width: 58px; height: 58px; padding: 11px; border-radius: 18px; background: var(--pc-ink); margin-bottom: 12px; }
.pc-ico svg { width: 100%; height: 100%; }
.prof-card .pc-fun { color: var(--text); font-size: 16px; }
.pc-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; }
.pc-more > div { overflow: hidden; }
.prof-card.open .pc-more { grid-template-rows: 1fr; }
.pc-more p { margin-top: 10px; }
.pc-toggle { color: var(--pc-ink); font-weight: 800; font-size: 14px; margin-top: 8px; }
.prof-card.compact { padding: 18px; }
.prof-card.tried { background: linear-gradient(#fff, var(--pc-soft)); }
.tried-badge { display: inline-block; margin-bottom: 8px; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--pc); color: #fff; }
.p-blue { --pc: #4A7DFF; --pc-soft: #EEF3FF; --pc-ink: #2E5BD9; }
.p-green { --pc: #2FBF7F; --pc-soft: #E5F8EF; --pc-ink: #1D8A57; }
.p-yellow { --pc: #FFC531; --pc-soft: #FFF6D6; --pc-ink: #8A5E00; }
.p-purple { --pc: #8B5CF6; --pc-soft: #F1EBFF; --pc-ink: #6A3FD6; }
.p-pink { --pc: #FF6FA8; --pc-soft: #FFE6F0; --pc-ink: #C2306D; }
.p-orange { --pc: #FF9A2E; --pc-soft: #FFF0E0; --pc-ink: #B25A00; }
.chip-s.p-blue, .chip-s.p-green, .chip-s.p-yellow, .chip-s.p-purple, .chip-s.p-pink, .chip-s.p-orange { background: var(--pc-soft); color: var(--pc-ink); }

/* ---------- Окна и уведомления ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(20, 25, 60, .5); display: none; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.modal-overlay.show { display: flex; animation: fade .2s; }
.modal { position: relative; background: #fff; border-radius: 24px; padding: 30px 26px 24px; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal.wide { max-width: 640px; }
.modal h2 { font-size: 24px; font-weight: 900; margin-bottom: 4px; }
.modal .sub { color: var(--muted); margin-bottom: 16px; }
.modal-close { position: absolute; top: 10px; right: 12px; width: 40px; height: 40px; border-radius: 50%; font-size: 26px; color: var(--muted); }
.modal-close:hover { background: #F0F3FB; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.form-group { margin-bottom: 14px; }
.form-group label, .add-students label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.form-group input, .form-group select, .add-students textarea { width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; outline: none; background: #fff; }
.form-group input:focus, .add-students textarea:focus { border-color: var(--blue); }
.code-input { text-align: center; font-size: 34px !important; font-weight: 900; letter-spacing: .4em; }
.big-code { font-size: 46px; font-weight: 900; letter-spacing: .15em; color: var(--blue-dark); }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; max-height: 320px; overflow-y: auto; }
.name-btn { padding: 14px 10px; border-radius: 14px; background: #EEF3FF; font-weight: 800; font-size: 16px; }
.name-btn:hover { background: #DCE6FF; }
.name-btn.sel { border: 2px solid var(--blue); background: #DCE6FF; }
.pic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pic-btn { aspect-ratio: 1; font-size: 40px; border-radius: 18px; background: #F4F6FC; border: 3px solid transparent; }
.pic-btn:hover { border-color: var(--blue); background: #EEF3FF; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 150%); display: flex; align-items: center; gap: 10px; max-width: min(520px, calc(100% - 24px)); background: var(--text); color: #fff; padding: 10px 18px 10px 10px; border-radius: 16px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 300; transition: transform .3s, opacity .3s; opacity: 0; visibility: hidden; transform: translate(-50%, 120px); }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.warn { background: #B4410F; }
.toast-hero { width: 40px; height: 40px; flex-shrink: 0; background: #fff; border-radius: 50%; padding: 4px; }

.success { text-align: center; }
.success .stars { margin-bottom: 8px; }
.success .stars svg { width: 54px; height: 54px; }
.success p { color: var(--muted); }
.prof-flash { margin: 16px 0 6px; padding: 14px; border-radius: 16px; background: var(--pc-soft); display: flex; flex-direction: column; gap: 2px; text-align: left; }
.prof-flash small { font-weight: 700; color: var(--pc-ink); }
.prof-flash b { font-size: 20px; }
.prof-flash span { font-size: 14px; color: var(--muted); }
.reaction { margin-top: 16px; }
.reaction p { font-weight: 700; color: var(--text); margin-bottom: 8px; }
.reaction > div { display: flex; justify-content: center; gap: 8px; }
.react { display: flex; flex-direction: column; align-items: center; padding: 8px 10px; border-radius: 14px; border: 3px solid transparent; background: #F4F6FC; min-width: 92px; }
.react span { font-size: 32px; line-height: 1.2; }
.react small { font-size: 12px; font-weight: 700; color: var(--muted); }
.react.sel { border-color: var(--green); background: #E5F8EF; }
.quiz-step { font-weight: 700; color: var(--muted); font-size: 14px; }
.quiz h2 { margin: 6px 0 16px; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt { padding: 16px; border-radius: 14px; background: #EEF3FF; font-weight: 800; font-size: 17px; text-align: left; }
.quiz-opt:hover { background: #DCE6FF; }
.prof-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 4px; text-align: left; }

/* ---------- Кабинеты ---------- */
.profile-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.profile-card { background: #fff; border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.avatar { width: 100px; height: 100px; border-radius: 50%; background: #EEF3FF; display: flex; align-items: center; justify-content: center; font-size: 52px; padding: 10px; }
.profile-card h3 { font-size: 22px; }
.stat-row { display: flex; gap: 18px; margin: 8px 0 10px; }
.stat-row b { display: block; font-size: 24px; color: var(--blue); }
.stat-row span { font-size: 13px; color: var(--muted); }
.progress-list { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.progress-list h3 { font-size: 18px; margin: 18px 0 10px; }
.progress-list h3:first-child { margin-top: 0; }
.progress-list > .btn { margin-top: 12px; }
.course-progress { margin-bottom: 12px; }
.course-progress .row { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.bar { height: 12px; border-radius: 99px; background: #EEF1F8; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }

.teacher-entry { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.teacher-entry .card > .btn { width: 100%; }
.demo-box { margin-top: 20px; padding: 16px; border-radius: 14px; background: #FFF6D6; }
.demo-box p { margin: 2px 0 10px; font-size: 14px; }
.sync-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sync-key { font-family: ui-monospace, Consolas, monospace; font-size: 15px; font-weight: 700; letter-spacing: .02em;
  word-break: break-all; padding: 12px 14px; border-radius: 12px; background: #EEF1F8; color: var(--blue-dark); }
.t-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.t-head h2 { font-size: 28px; font-weight: 900; margin: 4px 0 8px; }
.t-head-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 28px; color: var(--blue-dark); }
.stat span { color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.t-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 820px; }
.t-table th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; padding: 8px 6px; border-bottom: 2px solid var(--line); }
.t-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cell-prog { width: 80px; height: 8px; border-radius: 99px; background: #EEF1F8; overflow: hidden; margin-bottom: 2px; }
.cell-prog span { display: block; height: 100%; background: var(--green); }
.int { font-weight: 700; white-space: nowrap; }
.int-hi { color: #1D8A57; }
.int-mid { color: #8A5E00; }
.int-lo { color: var(--muted); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.add-students { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.guide { background: #fff; border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); margin-top: 20px; }
.guide summary { font-weight: 800; font-size: 18px; cursor: pointer; }
.guide ol { margin: 14px 0 10px 22px; display: flex; flex-direction: column; gap: 8px; }
.teacher-entry + .guide, .card + .guide { margin-top: 20px; }

/* ---------- О проекте ---------- */
.about h2 { font-size: 32px; font-weight: 900; margin-bottom: 14px; }
.about .lead { font-size: 19px; margin-bottom: 12px; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.about-grid h4 { font-size: 17px; margin-bottom: 4px; }
.about-grid p { color: var(--muted); }

/* ---------- Подвал ---------- */
footer { background: #fff; border-top: 1px solid var(--line); margin-top: 32px; }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 20px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.footer-links a:hover { color: var(--blue); }
.net { padding: 2px 10px; border-radius: 999px; background: #E5F8EF; color: #1D8A57; font-weight: 700; }
#printArea { display: none; }

/* ---------- Путь по курсу, достижения, салют ----------
   Звёзды отвечают на вопрос «хорошо ли я решил», а эти блоки — на вопрос
   «далеко ли я продвинулся». Для семилетки второй вопрос важнее. */
.path { margin: 16px 0 18px; }
.path-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 10px; }
.pt { width: 30px; height: 30px; border-radius: 50%; background: #EEF1F8; color: var(--muted);
  font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.pt svg { width: 20px; height: 20px; }
.pt.ok { background: #FFF1C4; }
.pt.cur { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--blue); }
.path-bar { height: 10px; border-radius: 99px; background: #EEF1F8; overflow: hidden; }
.path-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green), #7BE0B0); transition: width .5s ease; }
.path small { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; }

.award-flash { background: #FFF6D6; border-radius: 16px; padding: 14px; margin-bottom: 16px; }
.award-flash small { font-weight: 800; color: #8A5E00; }
.award-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.award-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 22px; }
.award { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  background: #fff; border: 2px solid var(--yellow); border-radius: 16px; padding: 12px 10px; }
.award b { font-size: 15px; }
.award small { color: var(--muted); font-size: 13px; }
.aw-ico { font-size: 30px; line-height: 1.1; }
.award.locked { border-color: var(--line); background: #F7F9FE; }
.award.locked .aw-ico { opacity: .45; }
.award.locked b, .award.locked small { color: var(--muted); }

/* Салют: четырнадцать бумажек, ни одной картинки */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: inherit; }
.confetti i { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px;
  background: var(--blue); animation: fall 2.2s ease-in forwards; }
.confetti i:nth-child(3n) { background: var(--yellow); }
.confetti i:nth-child(3n+1) { background: var(--pink); }
.confetti i:nth-child(4n) { background: var(--green); }
@keyframes fall {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  10% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--tilt, 0), 320px) rotate(540deg); }
}

/* ---------- Облегчённый режим и доступность ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Адаптивность ---------- */
@media (max-width: 1060px) {
  .lesson-grid { grid-template-columns: 1fr; }
  .prof-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .grid-3, .steps, .teacher-entry, .profile-grid, .about-grid, .how { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .start-panel { flex-direction: column; text-align: center; }
  .sp-text { align-items: center; }
  .sp-act { margin-left: 0; }
}
@media (max-width: 560px) {
  .container, .nav, .footer-inner { padding-left: 16px; padding-right: 16px; }
  section { padding: 32px 0; }
  .section-head h2 { font-size: 26px; }
  .prof-grid, .prof-mini { grid-template-columns: 1fr; }
  .col-stage, .col-code { padding: 12px; }
  .pblock { width: 60px; height: 60px; }
  .pblock .bi svg { width: 26px; height: 26px; }
  .wblock { width: 58px; height: 58px; }
  .lt-title h2 { font-size: 20px; }
  /* На телефоне порталы идут друг под другом, подпись больше не держит высоту */
  .p-note { min-height: 0; }
  .portal { padding: 24px 18px 20px; }
  .p-hero { width: 96px; height: 96px; }
  .cta-strip { padding: 44px 18px 48px; }
  .cta-strip h2 { font-size: 27px; }
  .course-head { flex-direction: column; align-items: flex-start; }
  .controls .btn { flex: 1 1 auto; }
  .ub-name { display: none; }
  .big-code { font-size: 38px; }
}

/* ---------- Печать карточек входа ---------- */
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10mm; }
  .print-card { border: 2px dashed #999; border-radius: 6mm; padding: 6mm; break-inside: avoid; }
  .pc-logo { display: flex; align-items: center; gap: 6px; font-weight: 900; color: #2E5BD9; }
  .pc-logo svg { width: 24px; height: 24px; }
  .pc-name { font-size: 26px; font-weight: 900; margin: 4mm 0 2mm; }
  .pc-code { font-size: 18px; }
  .pc-code b { font-size: 26px; letter-spacing: .1em; }
  .pc-note { font-size: 12px; color: #555; margin-top: 3mm; }
}

#studioTop { scroll-margin-top: 80px; }

/* ---------- Уровень сложности ---------- */
.track-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-bottom: 28px; }
.track-card { background: #fff; border-radius: var(--radius); padding: 22px 18px; box-shadow: var(--shadow);
  border: 3px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; transition: .18s; }
.track-card:hover { transform: translateY(-4px); border-color: var(--accent, var(--blue)); }
.track-card.t-junior { --accent: #FFC531; }
.track-card.t-senior { --accent: #4A7DFF; }
.tc-hero { width: 86px; height: 86px; }
.tc-hero svg { width: 100%; height: 100%; }
.track-card b { font-size: 24px; font-weight: 900; }
.tc-age { font-weight: 800; color: var(--accent); }
.tc-note { color: var(--muted); font-size: 14px; }
.track-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; justify-content: center;
  background: #fff; border-radius: 14px; padding: 10px 16px; margin-bottom: 22px; box-shadow: var(--shadow); font-size: 15px; }
.track-note .link-btn { color: var(--blue); font-weight: 800; text-decoration: underline; }

/* ---------- Главная: выбор уровня на первом экране ---------- */

/* ===== Порталы выбора уровня =====
   Две большие карточки с героем вместо таблицы сравнения. Подробности лежат
   внутри и раскрываются по наведению (мышь) или кнопке «Что внутри?» (палец):
   ребёнку они не нужны, взрослому нужны, и обоим не нужен выбор между ними. */
.level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.portal { position: relative; overflow: hidden; background: #fff; border-radius: 26px; padding: 30px 22px 24px;
  box-shadow: var(--shadow); border: 3px solid transparent; display: flex; flex-direction: column;
  align-items: center; gap: 8px; text-align: center; transition: transform .2s, border-color .2s, box-shadow .2s; }
.portal:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: 0 18px 40px rgba(74, 125, 255, .22); }
.portal.t-junior { --accent: #E8A200; --glow: #FFF1C4; }
.portal.t-senior { --accent: #4A7DFF; --glow: #DDE8FF; }
/* Свечение «портала» за героем: радиальный градиент, никаких картинок */
.p-glow { position: absolute; top: -70px; left: 50%; width: 260px; height: 260px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(circle, var(--glow) 0, transparent 70%); }
.p-hero { position: relative; width: 112px; height: 112px; animation: pBob 3.6s ease-in-out infinite; }
.p-hero svg { width: 100%; height: 100%; }
@keyframes pBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.portal:hover .p-hero { animation-duration: 1.4s; }
.portal b { position: relative; font-size: 28px; font-weight: 900; }
.p-age { font-weight: 800; color: var(--accent); }
/* Набор блоков вместо описания: что получит ребёнок, видно без чтения */
.p-blocks { display: flex; gap: 8px; margin: 10px 0 2px; }
.p-note { color: var(--muted); font-size: 15px; min-height: 46px; }
.p-start { width: 100%; margin-top: 6px; background: var(--accent); color: #fff; font-size: 18px; }
.portal.t-junior .p-start { color: #3A2A00; }
.p-start:hover { filter: brightness(1.06); transform: scale(1.02); }
/* Детали раскрываются плавно: grid-rows от 0 к 1fr работает без фиксированной высоты */
.p-details { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; width: 100%; }
.p-det-in { overflow: hidden; }
.portal:hover .p-details, .portal.open .p-details, .portal:focus-within .p-details { grid-template-rows: 1fr; }
.p-row { display: flex; gap: 10px; justify-content: space-between; text-align: left; font-size: 14.5px;
  padding: 7px 2px; border-top: 1px solid var(--line); }
.p-row:first-child { margin-top: 12px; }
.p-row i { font-style: normal; font-weight: 800; color: var(--muted); flex-shrink: 0; }
.p-more { color: var(--muted); font-size: 14px; font-weight: 700; margin-top: 4px; }
/* Мышь раскрывает детали сама, поэтому кнопка нужна только там, где нет наведения */
@media (hover: hover) { .p-more { display: none; } }

.start-panel { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center;
  background: #fff; border-radius: 22px; padding: 18px 24px; box-shadow: var(--shadow);
  border: 3px solid var(--accent); text-align: left; }
.start-panel.t-junior { --accent: #FFC531; }
.start-panel.t-senior { --accent: #4A7DFF; }
.sp-hero { width: 64px; height: 64px; flex-shrink: 0; }
.sp-hero svg { width: 100%; height: 100%; }
.sp-text { display: flex; flex-direction: column; }
.sp-text b { font-size: 22px; font-weight: 900; }
.sp-level { font-weight: 800; color: var(--accent); font-size: 14px; }
.sp-act { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; }
.sp-act .link-btn { color: var(--blue); font-weight: 800; }

/* ---------- Главная: «Как это работает» и сравнение уровней ---------- */
.how { display: grid; grid-template-columns: 1.1fr .9fr; gap: 36px; align-items: center; }
.how .steps { display: flex; flex-direction: column; gap: 18px; }
.how .step { display: flex; gap: 16px; align-items: flex-start; text-align: left; padding: 0; }
.how .step-num { margin: 0; flex-shrink: 0; width: 44px; height: 44px; font-size: 19px; }

/* ===== Мастерская на главной ===== */
/* Сетка, а не flex: шесть героев должны лечь ровными рядами, а не «пять и один» */

/* ===== Профессии на главной ===== */
.prof-teaser { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pt-card { background: #fff; border-radius: 22px; padding: 24px 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  border-bottom: 6px solid var(--pc); transition: .2s; }
.pt-card:hover { transform: translateY(-5px); box-shadow: 0 16px 34px rgba(74, 125, 255, .2); }
.pt-ico { width: 64px; height: 64px; padding: 12px; border-radius: 20px; background: var(--pc-ink); }
.pt-ico svg { width: 100%; height: 100%; }
.pt-card b { font-size: 20px; font-weight: 900; }
.pt-card span:last-child { color: var(--muted); font-size: 15px; }

/* ---------- Задание картинками и чтение вслух ---------- */
.task-body { flex: 1; min-width: 0; }
.btn-speak { flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%; background: #fff; color: var(--blue);
  box-shadow: 0 3px 10px rgba(74, 125, 255, .25); display: flex; align-items: center; justify-content: center; transition: .15s; }
.btn-speak svg { width: 24px; height: 24px; }
.btn-speak:hover { transform: scale(1.08); }
.btn-speak:active { transform: scale(.92); }

/* Цепочка «герой → что собрать → куда прийти»: читается без букв */
.task-pic { display: none; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.task-pic.show { display: flex; }
.pf-i { width: 46px; height: 46px; background: #fff; border-radius: 12px; padding: 4px; box-shadow: 0 2px 6px rgba(31, 37, 68, .12); }
.pf-i svg { width: 100%; height: 100%; }
.pf-a { font-size: 22px; font-weight: 900; color: var(--blue); }

/* Младший трек: подпись короткая, поэтому крупная */
.task.junior .task-body b { display: none; }
.task.junior #lessonTask { font-size: 22px; font-weight: 900; line-height: 1.25; }
.task.junior .pf-i { width: 54px; height: 54px; }

/* ---------- Куда смотрит герой (относительные команды) ---------- */
.facing { display: none; position: absolute; inset: 0; z-index: 1; transform: rotate(calc(var(--deg, 0) * 1deg)); transition: transform .25s; }
.stage.rel .facing { display: block; }
.facing svg { width: 42%; height: 42%; margin: 0 0 0 auto; transform: translate(10%, 118%); }


/* ---------- Адаптивность блоков главной ----------
   Эти блоки описаны ниже основного набора медиазапросов, а при равной
   специфичности в CSS побеждает последнее правило. Поэтому их мобильные
   переопределения стоят здесь, в конце файла, а не вместе с остальными. */
@media (max-width: 1060px) {
  .studio-promo { grid-template-columns: 1fr; }
  .prof-teaser { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .prof-teaser, .sp-demos { grid-template-columns: 1fr; }
  .sp-card { padding: 18px; }
}

/* ================= ГЛАВНАЯ = МАСТЕРСКАЯ =================
   Мастерская помещается в один экран: ни ребёнок, ни учитель не листают
   страницу, чтобы найти «Запустить». Высота считается не числами, а флексом —
   body ровно в окно, шапка и строка под ней берут своё, остаток достаётся
   мастерской. Поэтому раскладка не ломается ни на школьном ноутбуке
   1366×768, ни на большом мониторе, ни на проекторе. */

html.home-fit { height: 100%; }
body.home-fit { height: 100vh; height: 100svh; }
body.home-fit #page-home.active { display: flex; flex-direction: column; min-height: 0; }
/* Прятать прокрутку можно только там, где содержимое гарантированно влезает:
   на совсем низком окне лучше дать листать, чем спрятать кнопки. */
@media (min-width: 768px) and (min-height: 560px) {
  html.home-fit, body.home-fit { overflow: hidden; }
}
/* Подвал на главной спрятан: его место занимает сцена. Переключатели звука и
   облегчённого режима не потерялись — они внизу рейки выбора. */
@media (min-width: 768px) {
  body.home-fit footer { display: none; }
}

/* ----- Строка-описание под шапкой: тонкая, она для взрослого ----- */
.topline { background: #fff; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); flex: 0 0 auto; }
.topline .container { min-height: 42px; display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 6px; padding-top: 5px; padding-bottom: 5px; text-align: center; }
.topline b { color: var(--text); font-weight: 800; }
.topline span { color: #B9C0D6; }

/* ----- Три колонки: что выбрать · куда поставить · чем программировать ----- */
.studio { flex: 1 1 auto; min-height: 0; display: flex; padding: 12px 18px; }
.studio-grid { display: grid; grid-template-columns: minmax(206px, 236px) minmax(0, 1fr) minmax(296px, 360px);
  /* Ряд ровно в высоту остатка, а не по содержимому: иначе самая высокая
     колонка растягивает страницу и возвращает прокрутку. */
  grid-template-rows: minmax(0, 1fr);
  gap: 12px; width: 100%; max-width: 1560px; margin: 0 auto; min-height: 0; }
.col-pick, .studio-grid .col-stage, .studio-grid .col-code {
  background: #fff; border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 0; min-width: 0; }

/* Сцена забирает весь остаток высоты, ширину берёт из пропорции 7:5.
   Если колонка шире, чем нужно по пропорции, max-width не даёт вылезти. */
.studio-grid .col-stage { gap: 8px; }

/* Строка над сценой: показ примера видно раньше всего остального */
.stage-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 0 0 auto; }
.btn-example { background: var(--purple); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, .3); }
.btn-example:hover { background: #7A46E0; }
/* Галерея — жёлтая: это «посмотреть работы», а не действие со сценой,
   и путать её со «Стартом» нельзя. */
.btn-gallery { background: var(--yellow); color: #6B4E00; box-shadow: 0 4px 12px rgba(255, 211, 78, .45); }
.btn-gallery:hover { background: #FFC531; }

/* Детали для сцены — лентой прямо над полем: ребёнок выбирает предмет и
   сразу ставит его, не отводя глаз от сцены. Двадцать предметов в строку не
   помещаются, поэтому строка прокручивается. */
.pk-dec { flex: 0 0 auto; }
.pk-dec .code-label { margin-bottom: 4px; }
.dec-row { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.pk-dec .pick-row { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px;
  padding-bottom: 4px; scrollbar-width: thin; scroll-snap-type: x proximity;
  overscroll-behavior-x: contain; }
.pk-dec .pick { flex: 0 0 auto; width: 74px; scroll-snap-align: start; }
/* Герой и ластик всегда на месте и не уезжают вместе с лентой */
.dec-fixed { overflow: visible; flex: 0 0 auto; padding-right: 8px; border-right: 2px solid var(--line); }
.dec-fixed .pick-ico { border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 2px var(--line); }
.pick-erase { background: #FFECE9; border-color: #F7C9C2; }
.pick-erase:hover { background: #FFE0DA; border-color: #F0A99E; }
.stage-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
.stage-wrap .stage { width: auto; height: 100%; max-width: 100%; max-height: 100%; flex: 0 0 auto; }
.stage-tools { display: flex; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; margin-top: 0; }

/* Рейка выбора: иконки крупные, подписи в одну строку по 11 px */
.col-pick { gap: 6px; overflow-y: auto; scrollbar-width: thin; }
.col-pick .pk, .pk-dec { min-width: 0; flex: 0 0 auto; padding: 5px; }
/* Герой и фон — разные вопросы, и между ними нужен воздух, иначе «Зайка»
   и заголовок «ФОН» читаются как один список. */
.col-pick .pk + .pk { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.col-pick .code-label { font-size: 11px; margin-bottom: 5px; }
/* Три иконки в ряд: при двух рейка не влезает в экран, при четырёх подпись
   обрезается на «Лисёнок». */
/* Ровно три в ряд, а не сколько поместится: героев и фонов по девять, и при
   четырёх в ряду девятый оставался один внизу. Плитка крупная — ребёнок
   выбирает по картинке, а не по подписи. */
.col-pick .pick-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
/* Селектор обязан быть вложенным: класс «pick» носят и кнопки выбора,
   и предметы, лежащие на сцене (.item.pick). Без .pick-row вокруг короны
   на сцене появлялась белая плашка кнопки. */
.pick-row .pick { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 2px; border-radius: 12px;
  border: 3px solid #DFE6F7; background: #EEF2FC; min-width: 0; transition: .15s; }
.pick-row .pick:hover { background: #E2EAFF; border-color: #C3D4F7; }
.pick-row .pick.sel { border-color: var(--blue); background: #DFEAFF; box-shadow: 0 0 0 3px rgba(74, 125, 255, .18); }
.pick-row .pick small { color: var(--text); font-size: 11px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pick-ico, .pick-bg { width: 44px; height: 44px; flex: 0 0 auto; }
/* Фоны нарочно сделаны тихими, но в маленькой плитке они выцветают —
   поэтому в превью цвет подкручен, а на самой сцене остаётся спокойным. */
.pick-bg svg { filter: saturate(2) brightness(.92) contrast(1.18); }
.pick-bg { border-radius: 9px; overflow: hidden; }
.pick-bg svg { width: 100%; height: 100%; display: block; }
.pk-toggle { display: none; }
/* Переключатели для взрослого — внизу рейки, подальше от детских кнопок */
.pk-sys { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 0 0 auto; }
.pk-sys .link-btn { font-size: 12px; color: var(--muted); text-align: left; }
.pk-sys .link-btn:hover { color: var(--blue); }

/* Колонка кода: палитра и кнопки держат размер, программа забирает остаток */
.studio-grid .col-code .palette { flex: 0 0 auto; margin-bottom: 8px; }
.studio-grid .col-code .ws-head { flex: 0 0 auto; }
.studio-grid .col-code .workspace { flex: 1 1 auto; min-height: 84px; overflow-y: auto; margin-bottom: 10px; }
.studio-grid .col-code .ws-main { min-height: 0; }
.studio-grid .col-code .controls { flex: 0 0 auto; }
.studio-grid .col-code .controls .btn-go { flex: 1 1 130px; min-width: 130px; }
.studio-grid .col-code .controls .btn-save { flex: 1 1 100%; }
/* Четырнадцать блоков должны лечь в три ряда, а не в пять: в тесной колонке
   важнее видеть всю палитру сразу, чем крупную иконку.
   :not(.rep):not(.say) обязателен: «Повтор» — рамка вокруг других блоков,
   а «Сказать» растёт под текст, и жёсткий размер их ломал — содержимое
   «Повтора» вываливалось наружу, и было не понять, что внутри цикла. */
.studio-grid .pblock, .studio-grid .wblock:not(.rep):not(.say) { width: 58px; height: 58px; }
.studio-grid .pblock .bi svg, .studio-grid .wblock .bi svg { width: 26px; height: 26px; }

/* Низкое окно (ноутбук 1366×650, проектор): всё сжимается ещё на шаг */
@media (min-width: 768px) and (max-height: 720px) {
  .studio { padding: 8px 14px; }
  .studio-grid { gap: 10px; }
  .col-pick, .studio-grid .col-stage, .studio-grid .col-code { padding: 10px; }
  .col-pick { gap: 6px; }
  .pick-row .pick { padding: 3px 2px; }
  .pick-ico, .pick-bg { width: 36px; height: 36px; }
  .col-pick .pk + .pk { margin-top: 2px; padding-top: 5px; }
  .pk-sys { flex-direction: row; flex-wrap: wrap; gap: 2px 12px; }
  .pk-dec .pick { width: 64px; }
  .pk-sys { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; padding-top: 6px; }
  .studio-grid .pblock, .studio-grid .wblock:not(.rep):not(.say) { width: 52px; height: 52px; }
  .studio-grid .pblock .bi svg, .studio-grid .wblock .bi svg { width: 23px; height: 23px; }
  /* На низком окне программа ужимается первой: палитра и кнопки должны
     остаться целиком видны, а в программе обычно два-три блока. */
  .studio-grid .col-code .workspace { min-height: 56px; }
  .studio-grid .col-code .controls .btn-lg { min-height: 46px; padding: 10px 18px; }
  .stage-top .btn { min-height: 38px; padding: 7px 12px; font-size: 14px; }
}

/* Совсем низкое окно: плитки ужимаются ещё раз, но ряд остаётся по три —
   иначе девятый герой снова оказывается один. */
@media (min-width: 768px) and (max-height: 660px) {
  .pick-ico, .pick-bg { width: 30px; height: 30px; }
  .pick-row .pick small { font-size: 10px; }
  .col-pick .code-label { font-size: 10px; margin-bottom: 3px; }
}

/* Планшет и узкий ноутбук: выбор переезжает лентой над сценой, колонок две */
@media (min-width: 768px) and (max-width: 1099px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr) minmax(290px, 340px); grid-template-rows: auto minmax(0, 1fr); }
  .col-pick { grid-column: 1 / -1; grid-row: 1; flex-direction: row; gap: 14px; overflow: visible; }
  .col-pick .pk { flex: 1 1 0; }
  .pk-sys { margin-top: 0; padding-top: 0; padding-left: 12px; border-top: none; border-left: 1px solid var(--line); }
  .studio-grid .col-stage { grid-column: 1; grid-row: 2; }
  .studio-grid .col-code { grid-column: 2; grid-row: 2; }
  .studio { padding: 8px 14px; }
  /* Кнопки чуть ниже: на планшете лента выбора уже съела верх экрана */
  .studio-grid .col-code .controls .btn-lg { min-height: 46px; padding: 10px 16px; }
  /* Колонка кода здесь узкая: при блоках в 58 px палитра ложится в четыре
     ряда и выталкивает «Запустить» за экран. Пять в ряд — три ряда. */
  .studio-grid .pblock, .studio-grid .wblock:not(.rep):not(.say) { width: 52px; height: 52px; }
  .studio-grid .pblock .bi svg, .studio-grid .wblock .bi svg { width: 23px; height: 23px; }
  .studio-grid .col-code .workspace { min-height: 56px; }
  .pk-dec .pick small { font-size: 10px; }
}

/* ----- Кнопки мастерской ----- */
/* Сброс: приглушённо-красная — читается как «очистить», а не «удалить навсегда» */
.btn-reset { background: rgba(231, 76, 60, .1); color: #B3291B; box-shadow: inset 0 0 0 2px #E74C3C; }
.btn-reset:hover { background: rgba(231, 76, 60, .18); }
.toast-act { margin-left: 10px; padding: 6px 12px; border-radius: 10px; background: #fff;
  color: var(--blue-dark); font-weight: 800; font-size: 14px; flex-shrink: 0; }
#studioRun.pulse { animation: runPulse 1s ease-in-out infinite; }
@keyframes runPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(47, 191, 127, .25); } }

/* Кнопка входа: заметная, но в цвете сайта — взрослый находит её сразу */
.btn-login { background: var(--blue); color: #fff; box-shadow: 0 4px 12px rgba(74, 125, 255, .3); }
.btn-login:hover { background: var(--blue-dark); transform: translateY(-1px); }

/* ----- Галерея работ: панель поверх мастерской -----
   В потоке она не поместилась бы в экран, а ребёнку нужна не постоянно. */
.gal-sheet { display: none; position: fixed; inset: 0; z-index: 80; background: rgba(31, 37, 68, .55);
  padding: 24px 16px; overflow-y: auto; }
body.gal-open .gal-sheet { display: block; animation: fade .2s ease; }
.gal-card { max-width: 1100px; margin: 0 auto; background: var(--bg); border-radius: var(--radius); padding: 18px 20px 24px; }
.gal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gal-head h3 { font-size: 22px; }
.gallery-area { margin-top: 4px; }
.gal-title { font-size: 19px; margin: 18px 0 10px; }

/* ----- Показ примера ----- */
.tour-layer { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center;
  padding: 12px; pointer-events: none; z-index: 20; }
.tour-box { display: flex; align-items: center; gap: 12px; max-width: 100%; padding: 10px 14px;
  border-radius: 14px; background: rgba(31, 37, 68, .88); color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25); pointer-events: auto; }
.tour-skip { padding: 6px 12px; border-radius: 10px; background: rgba(255, 255, 255, .18); color: #fff; font-weight: 800; font-size: 14px; }
.tour-skip:hover { background: rgba(255, 255, 255, .3); }

/* Подсветка того места, о котором сейчас говорит показ примера: обведена
   вся карточка — «ГЕРОЙ» вместе с рядом иконок. Рамка внутренняя, потому
   что внешнюю срезает прокрутка колонки выбора; снаружи добавлен мягкий
   ореол — там, где его есть куда рисовать. Без перехода: подсветка должна
   зажигаться ровно тогда, когда о месте говорит голос. */
.tour-glow { position: relative; border-radius: 16px;
  box-shadow: inset 0 0 0 5px var(--yellow), 0 0 0 5px rgba(255, 211, 78, .5); }

/* ----- Ghost-подсказки -----
   Привязаны к элементу, а не к координатам: едут вместе с кнопкой. */
.ghost-tip { position: relative; }
.ghost-tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 10px);
  transform: translateX(-50%); white-space: nowrap; padding: 7px 12px; border-radius: 12px;
  background: var(--blue); color: #fff; font-size: 14px; font-weight: 800; box-shadow: var(--shadow);
  animation: ghostBob 1.6s ease-in-out infinite; z-index: 15; pointer-events: none; }
.ghost-tip::before { content: ''; position: absolute; left: 50%; bottom: calc(100% + 4px);
  transform: translateX(-50%); border: 7px solid transparent; border-top-color: var(--blue);
  animation: ghostBob 1.6s ease-in-out infinite; z-index: 15; pointer-events: none; }
@keyframes ghostBob { 0%, 100% { margin-bottom: 0; } 50% { margin-bottom: 6px; } }

.placeholder { text-align: center; padding: 40px 24px; }

/* ----- Шапка: бургер и меню ----- */
.burger { display: none; width: 44px; height: 44px; border-radius: 12px;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.burger span { display: block; width: 22px; height: 3px; border-radius: 2px; background: var(--blue-dark); transition: .2s; }
.burger:hover { background: #EEF3FF; }
body.menu-open .burger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
body.menu-open .burger span:nth-child(2) { opacity: 0; }
body.menu-open .burger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Панель с кнопками для телефона — на широком экране не нужна */
.mbar, .mob-save { display: none; }

/* ================= ТЕЛЕФОН (< 768px) =================
   Здесь вертикальный скролл разрешён. Порядок: сцена → запуск → «поставь на
   сцену» → герой и фон → блоки шторкой → «в галерею». */
@media (max-width: 767px) {
  html.home-fit, body.home-fit { height: auto; overflow: visible; }
  body.home-fit footer { display: block; }

  /* Шапка в одну строку: логотип, «Войти», бургер. Пункты меню — под бургер. */
  .nav { flex-wrap: nowrap; row-gap: 0; position: relative; gap: 8px; }
  .burger { display: flex; margin-left: 4px; order: 4; }
  .auth-area { margin-left: auto; order: 3; }
  .nav-links { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column;
    background: #fff; padding: 6px 16px 12px; box-shadow: 0 10px 20px rgba(31, 37, 68, .12); gap: 2px; }
  body.menu-open .nav-links { display: flex; }
  .nav-links a { padding: 12px 14px; font-size: 17px; }
  .logo span:last-child { font-size: 19px; }

  .studio { display: block; padding: 10px 14px 96px; }
  .studio-grid { display: flex; flex-direction: column; gap: 10px; }
  .studio-grid .col-stage { order: 1; gap: 8px; }
  .col-pick { order: 2; overflow: visible; background: none; box-shadow: none; padding: 0; gap: 10px; }
  .col-pick .pk { background: #fff; border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow); }
  .mob-save { order: 3; display: flex; width: 100%; min-height: 52px; font-size: 17px; }
  .studio-grid .col-code { order: 4; }

  /* Сцена первая и во всю ширину, высота из пропорции — 200–250 px */
  .studio-grid .col-stage { display: flex; flex-direction: column; }
  .stage-wrap { order: 1; display: block; flex: 0 0 auto; }
  .stage-wrap .stage { width: 100%; height: auto; max-width: none; }
  .stage-top { order: 2; }
  .stage-top .btn { flex: 1 1 auto; }
  .pk-dec { order: 3; }

  /* «Добавь детали» — крупная кнопка на всю ширину, лента раскрывается по
     ней: иначе выбор занимает первый экран вместо сцены. */
  .pk-dec .pk-toggle { display: flex; width: 100%; min-height: 52px; font-size: 16px; }
  .pk-dec .code-label, .pk-dec .pick-row { display: none; }
  body.dec-open .pk-dec .pick-row { display: flex; margin-top: 8px; }
  .pk-dec .pick { width: 80px; }

  /* Герой и фон — лента: видно четыре иконки, остальные листаются вбок */
  .col-pick .pick-row { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px; scrollbar-width: none; padding-bottom: 2px; }
  .col-pick .pick-row::-webkit-scrollbar { display: none; }
  .pick-row .pick { flex: 0 0 auto; min-width: 74px; padding: 6px; }
  .pick-ico, .pick-bg { width: 44px; height: 44px; }
  .pk-sys { flex-direction: row; gap: 16px; margin-top: 0; padding: 10px 12px; border-top: none;
    background: #fff; border-radius: 16px; box-shadow: var(--shadow); }

  /* Блоки и программа — шторка снизу по кнопке «Блоки» */
  .studio-grid .col-code { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    max-height: 72vh; overflow-y: auto; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px rgba(31, 37, 68, .18);
    transform: translateY(102%); transition: transform .25s ease; }
  body.sheet-open .studio-grid .col-code { transform: none; }
  .studio-grid .col-code .controls { display: none; }
  .studio-grid .col-code .workspace { overflow: visible; min-height: 110px; }
  .studio-grid .pblock, .studio-grid .wblock:not(.rep):not(.say) { width: 62px; height: 62px; }
  .studio-grid .pblock .bi svg, .studio-grid .wblock .bi svg { width: 28px; height: 28px; }

  .mbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -4px 16px rgba(31, 37, 68, .12); }
  .mbar .btn { flex: 1; min-height: 52px; font-size: 16px; }
  .mbar .btn-primary { flex: 0 0 auto; }

  .gal-sheet { padding: 12px 10px 90px; }
  .gal-card { padding: 14px 14px 20px; }
}

@media (max-width: 560px) {
  .topline { font-size: 13px; }
  .topline .container { min-height: 0; }
  .ub-stars { display: none; }
}
