/* Кубокрафт — воксельная песочница раздела «Информатика».
   Мир рисует WebGL на <canvas>, а весь интерфейс — обычная разметка поверх.
   Так кнопки остаются крупными и доступными с клавиатуры, а сцена не тратит
   кадры на отрисовку текста. */

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

:root {
  --bg1: #DFF3FF;
  --bg2: #EAF6E4;
  --bg3: #FFF3DC;
  --theme-accent: #4EC5F1;
  --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-start {
  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;
}

.sub {
  margin: 22px 0 10px;
  font-size: clamp(20px, 4vw, 26px);
}

.rules {
  max-width: 620px;
  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: 640px;
  margin: 0 auto 14px;
  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;
}

/* ================= выбор мира ================= */

.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}

.world-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 3px solid transparent;
  border-radius: 18px;
  background: var(--card);
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(46, 42, 79, .1);
  text-align: center;
}

.world-btn .wb-icon { font-size: 30px; line-height: 1; }
.world-btn .wb-name { font-size: 16px; font-weight: 800; }
.world-btn .wb-note { font-size: 13px; opacity: .7; line-height: 1.25; }

/* Полоска прижата к низу: карточки в ряду тянутся до общей высоты, а
   название то в одну строку, то в две — без этого полоски соседей стояли
   на разной высоте и ряд выглядел сбитым. */
.world-btn .wb-strip {
  width: 100%;
  height: 12px;
  border-radius: 6px;
  margin-top: auto;
}

.world-btn[aria-pressed="true"] {
  border-color: var(--ink);
  transform: translateY(-2px);
}

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

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

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

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
}

.hud button, .hud .stick { 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;
  justify-content: flex-start;
  overflow: hidden;
}

.mini-btn {
  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);
}

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

.theme-chip { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mini-btn { flex: none; }

.coord-chip { font-variant-numeric: tabular-nums; }

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

.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.done .task-fill { background: var(--ok); }
.task-bar.flash { animation: flash-bar .6s ease; }

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

/* прицел */

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
}

.crosshair span {
  position: absolute;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 0 2px rgba(0, 0, 0, .6);
}

.crosshair span:first-child { left: 11px; top: 0; width: 4px; height: 26px; border-radius: 2px; }
.crosshair span:last-child { top: 11px; left: 0; height: 4px; width: 26px; border-radius: 2px; }

.mine-bar {
  position: absolute;
  left: 50%;
  top: calc(50% + 26px);
  transform: translateX(-50%);
  width: 90px;
  height: 9px;
  border-radius: 5px;
  background: rgba(0, 0, 0, .35);
  overflow: hidden;
  opacity: 0;
  transition: opacity .15s;
}

.mine-bar.on { opacity: 1; }
.mine-bar i { display: block; height: 100%; width: 0; background: #FFD166; }

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

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

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

/* панель предметов */

.hotbar {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 3px 12px rgba(46, 42, 79, .18);
  pointer-events: auto;
}

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

.slot canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
/* Волосяная рамка по краю значка. Слот и карточка светлые, и белые блоки —
   снег, стекло — теряли на них границу: вместо кубика оставалось пустое
   место. Рамка возвращает ребро, а тёмным блокам ничего не портит. */
.slot canvas,
.recipe .r-icon canvas { outline: 1px solid rgba(46, 42, 79, .22); outline-offset: -1px; }

.slot .n {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
}

.slot.on { border-color: var(--ink); transform: translateY(-3px); }
.slot.empty { background: rgba(46, 42, 79, .08); }

@media (max-width: 560px) {
  .slot { width: 38px; height: 38px; border-radius: 10px; }
  .hotbar { gap: 3px; padding: 4px; }
}

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

.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.off { display: none; }
/* Запасной путь для мыши: клавиши ходьбы есть, джойстик лишний. */
.touch-ui.no-stick .stick { display: none; }
.touch-ui.no-stick #btnJump { 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: repeat(2, 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-row: span 2; order: 2; }
.act-btn:active { transform: translateY(2px); }

/* всплывающая подсказка о мире */

.hint-tip {
  position: absolute;
  left: 50%;
  bottom: 78px;
  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); } }

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

.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(720px, 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-sub { margin: 18px 0 8px; font-size: 19px; }
.modal-note { margin: 0 0 10px; font-size: 15px; line-height: 1.45; opacity: .85; }

/* рюкзак */

.bag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 6px;
}

.bag-grid .slot { width: 100%; height: 58px; cursor: default; }

/* рецепты */

.recipe-list, .smelt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recipe {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 16px;
  background: #F6F4FF;
}

.recipe.locked { opacity: .55; }

.recipe .r-icon { width: 44px; height: 44px; flex: none; border-radius: 10px; overflow: hidden; }
.recipe .r-icon canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

.recipe .r-body { flex: 1 1 auto; min-width: 0; }
.recipe .r-name { font-size: 16px; font-weight: 800; }
.recipe .r-need { font-size: 14px; opacity: .8; line-height: 1.3; }
.recipe .r-need 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; }

.fuel-line { margin: 12px 0 0; font-size: 15px; font-weight: 700; }

/* книга */

.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;
  min-height: 0;
}

.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; }

/* программа голема */

.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: 130px;
  /* Девять строк: шесть команд плюс два «конец» от вложенности и каретка.
     На 240 пикселях хвост программы уходил под нижний край. */
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  border-radius: 16px;
  background: #F1EEFF;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  /* Номер ставим сами, а не списком: считаться должны команды, и только
     они. Своими номерами список нумеровал заодно «конец» и каретку —
     три команды доходили до шестёрки, а на арене как раз написано
     «строк можно не больше 6», и ребёнок считал программу полной. */
  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.here { background: #FFE7B8; font-weight: 800; }
.prog li.run { background: #CFF6E0; font-weight: 800; }
.prog li.bad { background: #FFE0E4; font-weight: 800; }
.prog li .arg { display: inline-flex; gap: 4px; margin-left: 6px; }

.num-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

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

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

.cmd-btn:hover { background: #D6ECFF; }

.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; }

/* итоги главы */

.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; }

/* ================= украшения мира в меню ================= */

.theme-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.theme-deco span {
  position: absolute;
  font-size: 34px;
  opacity: .35;
  animation: deco-float 6s ease-in-out infinite;
}

@keyframes deco-float { 50% { transform: translateY(-10px) rotate(6deg); } }

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

.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); }
/* Вариант для игр без собственной верхней панели: тот же левый верхний угол,
   только сам по себе. Ниже модальных окон игры (у них z-index от 80). */
.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; }
}

/* Кнопка «Выйти» стоит над строкой HUD, поэтому та сдвигается вбок,
   а на узком экране прячет часть чипов под себя. */
/* Отступ объявлен на :root, а не на самой строке: рядом с «Выйти»
   встаёт кнопка «Во весь экран», и она раздвигает эту величину
   сама (games-static/common/fullscreen.js) — до строки скрипт
   не дотянется. */
@media (min-width: 481px) { :root { --exit-space: 132px; } }
/* На телефоне верхний ряд занят «Выйти» и звуком, поэтому чипы уезжают
   во вторую строку слева, а панель предметов ложится в самый низ — под
   джойстик и кнопки, иначе большой палец накрывает половину кубиков. */
@media (max-width: 560px) {
  .hotbar { bottom: 4px; gap: 3px; padding: 4px; }
  .slot { width: 34px; height: 34px; border-radius: 9px; }
  .stick { left: 10px; bottom: 58px; width: 104px; height: 104px; }
  .stick i { width: 42px; height: 42px; margin: -21px 0 0 -21px; }
  .act-btns { right: 10px; bottom: 58px; gap: 8px; }
  .act-btn { width: 54px; height: 54px; font-size: 23px; }
  .act-btn.big { width: 66px; height: 66px; font-size: 28px; }
  .hero-hud { bottom: 176px; max-width: 74vw; }
  .hint-tip { bottom: 172px; }
  .mine-bar { top: calc(50% + 22px); width: 76px; }
}

@media (max-width: 480px) {
  .hud-top {
    top: 52px;
    left: 6px;
    right: 6px;
    gap: 5px;
  }
  .theme-chip { display: none; }
  .coord-chip, .clock-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; }
}
