/* «Роблокс» — студия и мини-игры раздела «Информатика» (docs/21-roblox.md).
   Мир рисует WebGL на <canvas>, а весь интерфейс — обычная разметка поверх:
   кнопки остаются крупными и доступными с клавиатуры, а сцена не тратит
   кадры на отрисовку текста. */

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

:root {
  --bg1: #E8EEFF;
  --bg2: #F1E9FF;
  --bg3: #FFF1E4;
  --ink: #2E2A4F;
  --accent: #FF7A59;
  --ok: #3BC97D;
  --bad: #FF5A6E;
  --card: #FFFFFF;
  --exit-space: 0px;
}

html, body { height: 100%; margin: 0; }

body {
  font-family: "Naukino Emoji", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; }

.hidden { display: none !important; }

/* ================= экраны ================= */

#app { position: relative; z-index: 1; height: 100%; }

.screen { display: none; }
.screen.active { display: block; }

#scr-hub, #scr-avatar {
  height: 100%;
  overflow-y: auto;
  padding: 60px 16px 32px;
  text-align: center;
}

.title {
  margin: 0 0 12px;
  font-size: clamp(30px, 7vw, 46px);
  letter-spacing: .5px;
}

.title.small { font-size: clamp(24px, 5vw, 34px); }

.rules {
  max-width: 640px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.45;
  opacity: .85;
}

.best { margin-top: 14px; font-size: 16px; opacity: .8; }

/* ================= совёнок ================= */

.hero-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 660px;
  margin: 0 auto 16px;
  text-align: left;
}

.hero-row.tight { margin-bottom: 8px; }

.hero-art {
  flex: none;
  font-size: 46px;
  line-height: 1;
  transition: transform .2s;
}

.hero-art.small { font-size: 30px; }
.hero-art.hero-jump { animation: hero-jump .5s ease; }
.hero-art.hero-shake { animation: hero-shake .5s ease; }

@keyframes hero-jump {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-14px) scale(1.06); }
}

@keyframes hero-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px) rotate(-4deg); }
  40%, 80% { transform: translateX(7px) rotate(4deg); }
}

.bubble {
  position: relative;
  flex: 1 1 auto;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 4px 14px rgba(46, 42, 79, .14);
  font-size: 17px;
  line-height: 1.4;
}

.bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 20px;
  border: 8px solid transparent;
  border-right-color: var(--card);
  border-left: 0;
}

.bubble.small { font-size: 15px; padding: 9px 13px; }

/* ================= кнопки ================= */

.big-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 26px;
  border: none;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(46, 42, 79, .18);
  transition: transform .12s, background .15s;
}

.big-btn:hover { filter: brightness(1.05); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(46, 42, 79, .18); }
.big-btn.alt { background: #6C63C7; }
.big-btn[disabled] { opacity: .45; cursor: default; box-shadow: none; }

.start-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
}

:focus-visible { outline: 3px solid #2E2A4F; outline-offset: 2px; }

/* ================= витрина ================= */

/* Фигурка слева, витрина справа: на телефоне столбиком. Так первый экран
   отвечает сразу на оба вопроса — «кем играю» и «во что играю». */
.avatar-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: center;
  max-width: 940px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.avatar-card {
  flex: 0 0 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 4px 14px rgba(46, 42, 79, .12);
}

.avatar-card .big-btn { min-height: 46px; font-size: 15px; padding: 0 10px; gap: 6px; white-space: nowrap; }

.ava-canvas { width: 150px; height: 205px; display: block; }
.ava-canvas.big { width: 220px; height: 293px; }

.hub-grid {
  flex: 1 1 380px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  text-align: left;
}

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 14px 12px;
  border: 3px solid transparent;
  border-radius: 22px;
  background: var(--card);
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(46, 42, 79, .1);
  text-align: left;
  color: inherit;
}

.hub-card:hover { transform: translateY(-2px); border-color: rgba(46, 42, 79, .22); }
.hub-card .hc-icon { font-size: 34px; line-height: 1; }
.hub-card .hc-name { font-size: 19px; font-weight: 800; }
.hub-card .hc-note { font-size: 14px; opacity: .78; line-height: 1.3; }
.hub-card .hc-tag {
  align-self: flex-start;
  margin-top: auto;
  padding: 3px 9px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}
.hub-card .hc-done { font-size: 13px; font-weight: 700; opacity: .7; }

/* ================= конструктор фигурки ================= */

.ava-wrap {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 820px;
  margin: 0 auto;
}

.ava-controls {
  flex: 1 1 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  max-width: 460px;
}

.ava-part { padding: 10px 14px; border-radius: 18px; background: var(--card); }
.ava-part .ap-name { font-size: 15px; font-weight: 800; margin-bottom: 7px; }
.ava-part .ap-row { display: flex; flex-wrap: wrap; gap: 7px; }

.chip-btn {
  min-height: 40px;
  min-width: 40px;
  padding: 0 12px;
  border: 3px solid transparent;
  border-radius: 13px;
  background: #F1EEFF;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.chip-btn[aria-pressed="true"] { border-color: var(--ink); }
.chip-btn.swatch { padding: 0; width: 40px; }

/* ================= холст и HUD ================= */

#scr-game { position: relative; height: 100%; }

#glCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background: #9AD7FF;
}

.hud { position: absolute; inset: 0; pointer-events: none; user-select: none; }
.hud button, .hud .stick, .hud .palette, .hud .tool-row { pointer-events: auto; }

.hud-top {
  position: absolute;
  top: 8px;
  left: calc(var(--exit-space) + 4px);
  right: 106px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.mini-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 13px;
  background: rgba(255, 255, 255, .9);
  font-size: 19px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(46, 42, 79, .14);
}

.world-chip, .coord-chip, .score-chip {
  flex: none;
  padding: 6px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .88);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.world-chip { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.coord-chip, .score-chip { font-variant-numeric: tabular-nums; }
.score-chip.pop { animation: hero-jump .4s ease; }

/* строка задания */

.task-bar {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 94vw);
  padding: 9px 14px 11px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 4px 14px rgba(46, 42, 79, .16);
}

.task-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  opacity: .75;
}

/* Строку задания можно нажать, чтобы её прочитали вслух. Ради этого ей
   нужен свой pointer-events: у всей надстройки он выключен. */
.task-text {
  margin: 3px 0 7px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  pointer-events: auto;
  cursor: pointer;
}

.task-progress { height: 7px; border-radius: 4px; background: rgba(46, 42, 79, .12); overflow: hidden; }
.task-fill { height: 100%; width: 0; border-radius: 4px; background: var(--ok); transition: width .3s; }
.task-bar.flash { animation: flash-bar .6s ease; }

@keyframes flash-bar {
  0%, 100% { background: rgba(255, 255, 255, .92); }
  40% { background: #CFF6E0; }
}

/* совёнок в углу игры */

.hero-hud {
  position: absolute;
  left: 10px;
  bottom: 150px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: min(330px, 62vw);
  transition: opacity .3s;
}

.hero-hud.quiet { opacity: 0; }

/* ================= панель студии ================= */

.studio-bar {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 3px 12px rgba(46, 42, 79, .18);
  max-width: 96vw;
}

.tool-row {
  display: flex;
  gap: 6px;
  /* Инструментов шесть, и на телефоне они в строку не помещаются:
     без переноса «Выбрать» уезжал за левый край экрана. */
  flex-wrap: wrap;
  justify-content: center;
}

.tool-btn {
  min-height: 40px;
  padding: 0 12px;
  border: 3px solid transparent;
  border-radius: 13px;
  background: #F1EEFF;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.tool-btn[aria-pressed="true"] { border-color: var(--ink); background: #E0D9FF; }
.tool-btn .t-icon { font-style: normal; margin-right: 5px; }

.palette { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; max-width: 92vw; }

.pal-btn {
  position: relative;
  width: 46px;
  height: 46px;
  border: 3px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, .9);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.pal-btn canvas { width: 100%; height: 100%; display: block; }
.pal-btn canvas { outline: 1px solid rgba(46, 42, 79, .22); outline-offset: -1px; }
.pal-btn.on { border-color: var(--ink); transform: translateY(-3px); }
.pal-btn .n {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
}

/* круглые кнопки справа */

.side-btns { position: absolute; right: 10px; top: 96px; display: flex; flex-direction: column; gap: 9px; }

.round-btn {
  position: relative;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(46, 42, 79, .16);
}

.round-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(46, 42, 79, .16); }

.round-btn .dot {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bad);
  animation: dot-pulse 1.4s ease-in-out infinite;
}

@keyframes dot-pulse { 50% { transform: scale(1.35); } }

/* сенсорное управление */

.touch-ui { position: absolute; inset: 0; pointer-events: none; }
.touch-ui.no-stick .stick { display: none; }
.touch-ui.no-stick #btnJump { display: none; }
/* Мыши хватает клавиш: прыжок на пробеле, бег на Shift. */
.touch-ui.no-stick #btnDash { display: none; }

.stick {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .35);
  border: 3px solid rgba(255, 255, 255, .7);
  touch-action: none;
}

.stick i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

.act-btns {
  position: absolute;
  right: 12px;
  bottom: 14px;
  display: grid;
  /* Слева столбиком «действие» и «бежать», справа во всю высоту прыжок.
     Без явного места третья кнопка вытесняла прыжок за нижний край. */
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  gap: 10px;
  align-items: end;
  justify-items: center;
}

.act-btn {
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .88);
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(46, 42, 79, .18);
  pointer-events: auto;
}

.act-btn.big { width: 76px; height: 76px; font-size: 32px; grid-column: 2; grid-row: 1 / span 2; }
.act-btn:active { transform: translateY(2px); }
/* Бег пальцем: кнопка не нажимается на ходу, а остаётся включённой. */
.act-btn.on { background: var(--accent, #6C5CE7); box-shadow: 0 3px 0 rgba(46, 42, 79, .3); }

/* подсказки поверх мира */

.hint-tip {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(46, 42, 79, .9);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  animation: tip-in .3s ease;
}

@keyframes tip-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Разбор ошибки у ворот: живёт поверх мира, а не окном — окно было бы
   паузой, которую ребёнок пережидает, не читая. */
.gate-note {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, 92vw);
  padding: 16px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 34px rgba(46, 42, 79, .3);
  font-size: 17px;
  line-height: 1.45;
  text-align: center;
  animation: tip-in .3s ease;
  pointer-events: auto;
}

.gate-note b { display: block; margin-bottom: 6px; font-size: 20px; }

/* приглашение захватить мышь */

.lock-veil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(46, 42, 79, .35);
  cursor: pointer;
  z-index: 40;
}

.lock-card { padding: 18px 26px; border-radius: 20px; background: rgba(255, 255, 255, .95); text-align: center; max-width: 90vw; }
.lock-title { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.lock-keys { margin: 0; font-size: 15px; line-height: 1.5; opacity: .85; }

/* ================= окна ================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(46, 42, 79, .45);
  overflow-y: auto;
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px 20px 22px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 12px 40px rgba(46, 42, 79, .3);
}

.modal-card.wide { width: min(740px, 100%); }

.modal-x {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 13px;
  background: rgba(46, 42, 79, .08);
  font-size: 19px;
  cursor: pointer;
}

.modal-title { margin: 0 0 10px; font-size: 24px; padding-right: 44px; }
.modal-note { margin: 0 0 10px; font-size: 15px; line-height: 1.45; opacity: .85; }

/* задания */

.book-q { margin: 12px 0 10px; font-size: clamp(19px, 4.4vw, 24px); font-weight: 800; line-height: 1.35; cursor: pointer; }

.answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }

.ans-btn {
  min-height: 60px;
  padding: 10px 14px;
  border: 3px solid transparent;
  border-radius: 18px;
  background: #F1EEFF;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  transition: transform .12s;
}

.ans-btn:hover { background: #E7E2FF; }
.ans-btn.right { background: #CFF6E0; border-color: var(--ok); }
.ans-btn.wrong { background: #FFE0E4; border-color: var(--bad); animation: hero-shake .45s ease; }
.ans-btn[disabled] { cursor: default; }

.book-hint {
  margin: 12px 0 0;
  padding: 11px 14px;
  border-radius: 14px;
  background: #FFF4DC;
  font-size: 16px;
  line-height: 1.45;
}

.book-hint:empty { display: none; }
.book-foot { margin-top: 14px; text-align: center; }

.chapters, .parents { margin-top: 16px; padding: 10px 14px; border-radius: 16px; background: #F6F4FF; font-size: 15px; }
.chapters summary, .parents summary { cursor: pointer; font-weight: 800; font-size: 16px; }

.ch-row { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; line-height: 1.35; }
.ch-row .ch-mark { flex: none; }
.ch-row.now { font-weight: 800; }
.ch-row.todo { opacity: .55; }

/* свойства детали */

.props-grid { display: flex; flex-direction: column; gap: 9px; }

.prop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 14px;
  background: #F6F4FF;
}

.prop-row .pr-name { flex: 1 1 auto; font-size: 15px; font-weight: 800; }
.prop-row .pr-val { min-width: 46px; text-align: center; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }

.num-btn {
  width: 34px;
  height: 34px;
  flex: none;
  border: none;
  border-radius: 10px;
  background: #fff;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(46, 42, 79, .12);
}

.num-btn[disabled] { opacity: .35; cursor: default; }

.props-math {
  margin: 12px 0 0;
  padding: 11px 14px;
  border-radius: 14px;
  background: #E8F4FF;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 700;
}

.props-btns { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.props-btns .big-btn { min-height: 46px; font-size: 16px; padding: 0 16px; }

/* скрипт */

.prog-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }

@media (max-width: 560px) { .prog-wrap { grid-template-columns: 1fr; } }

.prog {
  margin: 0;
  padding: 10px 10px 10px 34px;
  min-height: 150px;
  max-height: 330px;
  overflow-y: auto;
  scrollbar-width: thin;
  border-radius: 16px;
  background: #F1EEFF;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  /* Номер ставим сами: считаться должны команды, и только они — иначе
     список нумерует заодно «конец» и ребёнок считает лишние строки. */
  list-style: none;
  counter-reset: cmdline;
}

.prog li { position: relative; padding: 3px 4px; border-radius: 8px; cursor: pointer; line-height: 1.4; }
.prog li.cmd { counter-increment: cmdline; }

.prog li.cmd::before {
  content: counter(cmdline) ".";
  position: absolute;
  left: -24px;
  width: 20px;
  text-align: right;
  font-weight: 700;
  opacity: .55;
}

.prog li.evt { background: #FFE7B8; font-weight: 800; }
.prog li.here { background: #CFF6E0; font-weight: 800; }
.prog li.deep1 { padding-left: 18px; }
.prog li.deep2 { padding-left: 32px; }
.prog li .arg { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.prog li .arg .num-btn { width: 26px; height: 26px; font-size: 15px; }
.prog li .x { float: right; opacity: .5; font-weight: 800; }
.prog li:hover .x { opacity: 1; }
.prog .empty-note { padding: 6px 2px; opacity: .6; cursor: default; font-size: 15px; }

.cmd-pad { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; align-content: start; }

.cmd-btn {
  min-height: 46px;
  padding: 6px 8px;
  border: none;
  border-radius: 14px;
  background: #E8F4FF;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.2;
}

.cmd-btn:hover { background: #D6ECFF; }
.cmd-btn.evt { background: #FFF0CE; }
.cmd-btn.ctl { background: #EFE4FF; }
.cmd-btn[disabled] { opacity: .4; cursor: default; }
.cmd-head { grid-column: 1 / -1; margin: 6px 0 0; font-size: 13px; font-weight: 800; opacity: .6; }

.prog-btns { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.prog-btns .big-btn { min-height: 48px; font-size: 17px; padding: 0 18px; }
.prog-msg { margin: 10px 0 0; font-size: 16px; font-weight: 700; min-height: 24px; }
.prog-msg.ok { color: #218B52; }
.prog-msg.bad { color: #C4344A; }

/* покупки «Фабрики» */

.shop-list { display: flex; flex-direction: column; gap: 9px; }

.shop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 16px;
  background: #F6F4FF;
}

.shop-row.done { opacity: .6; }
.shop-row .s-icon { font-size: 26px; flex: none; }
.shop-row .s-body { flex: 1 1 auto; min-width: 0; }
.shop-row .s-name { font-size: 16px; font-weight: 800; }
.shop-row .s-cost { font-size: 14px; opacity: .85; line-height: 1.3; }
.shop-row .s-cost b.no { color: var(--bad); }

.mini-btn2 {
  flex: none;
  min-height: 42px;
  padding: 0 15px;
  border: none;
  border-radius: 14px;
  background: var(--ok);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.mini-btn2[disabled] { background: #C6C2DE; cursor: default; }

/* итоги */

.stars { font-size: 46px; text-align: center; letter-spacing: 6px; min-height: 56px; }
.stars span { display: inline-block; animation: star-pop .45s ease backwards; }
.stars span:nth-child(2) { animation-delay: .18s; }
.stars span:nth-child(3) { animation-delay: .36s; }

@keyframes star-pop {
  from { transform: scale(.2) rotate(-40deg); opacity: 0; }
  70% { transform: scale(1.25); }
}

.score { text-align: center; font-size: 19px; font-weight: 800; margin: 4px 0 12px; }
.parents ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.5; }
.parents li { margin-bottom: 6px; }
.end-btns { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

/* ================= углы ================= */

.corner-btns { position: fixed; right: 10px; top: 10px; z-index: 70; display: flex; gap: 8px; }

.icon-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, .9);
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(46, 42, 79, .14);
}

.icon-btn.off { opacity: .45; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================= кнопка «Выйти» ================= */

.exit-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 46px; padding: 0 16px; flex: none;
  border: none; border-radius: 16px;
  background: #fff; color: #3D3455;
  font: inherit; font-size: 16px; font-weight: 800; line-height: 1;
  white-space: nowrap; cursor: pointer;
  box-shadow: 0 3px 0 rgba(61, 52, 85, .12);
}
.exit-btn:hover { background: #F2EFFF; }
.exit-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(61, 52, 85, .12); }
.exit-btn--float { position: fixed; top: 10px; left: 10px; z-index: 60; }

@media (max-width: 480px) {
  .exit-btn { height: 40px; padding: 0 12px; font-size: 14px; }
  .exit-btn--float { top: 6px; left: 6px; }
}

/* Отступ объявлен на :root, а не на самой строке: рядом с «Выйти»
   встаёт кнопка «Во весь экран», и она раздвигает эту величину
   сама (games-static/common/fullscreen.js) — до строки скрипт
   не дотянется. */
@media (min-width: 481px) { :root { --exit-space: 132px; } }

@media (max-width: 560px) {
  .stick { left: 10px; bottom: 92px; width: 104px; height: 104px; }
  .stick i { width: 42px; height: 42px; margin: -21px 0 0 -21px; }
  .act-btns { right: 10px; bottom: 92px; gap: 8px; }
  .act-btn { width: 54px; height: 54px; font-size: 23px; }
  .act-btn.big { width: 66px; height: 66px; font-size: 28px; }
  .hero-hud { bottom: 200px; max-width: 74vw; }
  .hint-tip { bottom: 196px; }
  .pal-btn { width: 38px; height: 38px; border-radius: 10px; }
  .tool-btn { min-height: 38px; padding: 0 10px; font-size: 17px; }
  .tool-btn .t-name { display: none; }
  .tool-btn .t-icon { margin-right: 0; }
}

@media (max-width: 480px) {
  .hud-top { top: 52px; left: 6px; right: 6px; gap: 5px; }
  .world-chip { display: none; }
  .coord-chip, .score-chip { font-size: 12px; padding: 5px 8px; }
  .mini-btn { width: 36px; height: 36px; font-size: 17px; }
  .task-bar { top: 98px; padding: 7px 11px 9px; }
  .task-text { font-size: 14px; }
  .side-btns { top: 184px; right: 8px; }
  .round-btn { width: 46px; height: 46px; font-size: 21px; }
  .lock-keys { font-size: 13px; }
  .avatar-card { flex: 1 1 100%; }
  .ava-canvas { width: 120px; height: 164px; }
}
