:root {
  --bg1: #e8f3d6;
  --bg2: #b9d99a;
  --accent: #5b8c3a;
  --accent-dark: #3e6526;
  --tile: #fffaf0;
  --tile-edge: #d9c7a3;
  --tile-text: #4a3523;
  --sel: #f2b84b;
  --cell: rgba(255, 255, 255, .35); /* пустые клетки ответа — фон главы просвечивает (было .72: сетка закрывала картинку) */
  --cell-filled: #fffaf0;
  --text: #2f3b22;
  --danger: #d9534f;
  --tile-size: 90px;
  --cell-size: 40px;
  --hog-size: 56px;  /* ёжик и его реплики растут с высотой экрана (задаёт layout() в game.js) */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }

.bg-layer {
  position: fixed; inset: 0; z-index: -1; background-size: cover; background-position: center top; /* на широком экране видна верхняя, «живая» часть картинки */
}
.bg-layer.wide { background-position: center; }
/* ответ в две колонки: слева короткие слова, справа длинные */
.answer.two-col { flex-direction: row; align-items: flex-start; gap: 20px; }
.answer-col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.answer.two-col .answer-col:first-child { align-items: flex-end; }
.answer.two-col .answer-col:last-child { align-items: flex-start; }
/* светлая вуаль поверх картинки, чтобы буквы читались */
.bg-layer[style*="url"]::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.25), rgba(255,255,255,.45) 45%, rgba(255,255,255,.2));
}
.hog-img { width: 100%; height: 100%; object-fit: contain; }
.mascot { position: relative; }
.mascot [data-pose] { position: absolute; inset: 0; opacity: 0; }
.mascot [data-pose].on { opacity: 1; }
/* ёжик из слоёв: картинка позы + предметы нарядов поверх (координаты — в % от картинки позы) */
.hog-stack { position: relative; width: 100%; height: 100%; }
.hog-stack > img { position: absolute; pointer-events: none; }
.hog-stack > .hog-img { inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* заплатки нарядов (tools/build_wear.py): место — в % кадра спрайта, высокие вещи выходят вверх за кадр */
.hog-stack > .wear { max-width: none; }
/* маски «спрятать у ёжика» от каждой надетой вещи — пересечение (видно только то, что оставили все) */
.hog-stack > .hog-img.masked { -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat; -webkit-mask-composite: source-in; mask-composite: intersect; }
.find-img { width: 1.15em; height: 1.15em; object-fit: contain; vertical-align: middle; }
.chapter .find .find-img { width: 42px; height: 42px; }

#app {
  /* на компьютере длинная сторона поля не больше чем вдвое длиннее короткой (требование 1.6.2.2) */
  height: 100%; max-width: max(520px, min(70vh, 760px)); margin: 0 auto;
  display: flex; flex-direction: column;
  /* вырез под камеру: в браузере — env(), в Android-приложении — --safe-top/--safe-bottom (их ставит MainActivity) */
  padding: max(env(safe-area-inset-top), var(--safe-top, 0px)) 12px max(env(safe-area-inset-bottom), var(--safe-bottom, 0px));
}
#app.loading { visibility: hidden; }

/* верхняя панель */
.topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; height: calc(52px * var(--ui-scale, 1)); flex: none; }
.topbar-left { justify-self: start; display: flex; align-items: center; gap: 10px; }
.topbar-right { justify-self: end; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: calc(40px * var(--ui-scale, 1)); height: calc(40px * var(--ui-scale, 1)); border-radius: 12px; border: none;
  background: rgba(255, 255, 255, .6); font-size: calc(20px * var(--ui-scale, 1));
}
.title { text-align: center; line-height: 1.15; text-shadow: 0 0 6px #fff, 0 0 12px rgba(255,255,255,.8); }
.chapter-name { font-size: calc(13px * var(--ui-scale, 1)); opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.level-name { font-weight: 700; font-size: calc(18px * var(--ui-scale, 1)); white-space: nowrap; } /* «Уровень 115» не переносится */
.title { min-width: 0; }
@media (max-width: 420px) { /* телефон: в центре панели мало места */
  .level-name { font-size: 15px; }
  .chapter-name { font-size: 12px; }
  .coins { min-width: 0; padding: 5px 7px; font-size: 14px; gap: 4px; }
  .coins .coin { width: 14px; height: 14px; }
  .topbar .icon-btn { width: 34px; height: 34px; font-size: 17px; }
  .topbar, .topbar-left, .topbar-right { gap: 4px; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; } /* заголовок — в оставшемся месте между группами кнопок, без наложения */
}
.coins {
  display: flex; align-items: center; gap: 6px; min-width: 70px; justify-content: flex-end;
  background: rgba(255, 255, 255, .6); border-radius: 20px; padding: 6px 12px; font-weight: 700; font-size: calc(16px * var(--ui-scale, 1));
}
.coin {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe58a, #e0a82e); box-shadow: inset 0 -1px 0 #b98314;
}

/* игровая зона */
.play { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; min-height: 0; }
.answer { display: flex; flex-direction: column; align-items: center; gap: 5px; margin-top: clamp(10px, 2.5vh, 32px); } /* воздух под верхней панелью */
.row { display: flex; gap: 4px; }
.row.found .cell { background: var(--cell-filled); }
.row.just-found .cell { animation: pop .35s ease; } /* только что найденный ряд; остальные при перерисовке не прыгают */
.cell {
  width: var(--cell-size); height: var(--cell-size); border-radius: 8px;
  background: var(--cell); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: calc(var(--cell-size) * .55); text-transform: uppercase;
  box-shadow: inset 0 1px 3px rgba(60, 40, 20, .15), 0 0 0 1.5px rgba(90, 70, 40, .22);
}
.cell.hint { color: var(--accent); }
.row.found .cell { color: var(--tile-text); }

.helper { display: flex; align-items: center; gap: 8px; height: var(--helper-h, var(--hog-size)); width: 100%; flex: none; position: relative; }
.helper::after { content: ""; width: var(--hog-spacer, var(--hog-size)); flex: none; } /* противовес ёжику — облачко по центру экрана */
/* набираемое слово показывается поверх строки ёжика, отдельная полоса не нужна */
.helper .preview { position: absolute; inset: 0; height: auto; pointer-events: none; }
.helper.has-word .bubble { opacity: 0; transition: none; } /* слово поверх — облачко прячется сразу, без просвечивающих краёв */
.mascot { width: var(--hog-size); height: var(--hog-size); flex: none; }
.mascot svg { width: 100%; height: 100%; }
.mascot.happy svg, .mascot.happy img { animation: hop .5s ease; }
.bubble {
  flex: 1; background: #fff; border-radius: 14px; padding: calc(var(--hog-size) * .13) calc(var(--hog-size) * .2); font-size: var(--bubble-font, 16px); line-height: 1.22;
  position: relative; min-height: 20px; opacity: 0; transition: opacity .2s; text-align: center; text-wrap: balance;
}
.bubble.show { opacity: 1; }
.bubble::before {
  content: ""; position: absolute; left: -7px; top: 50%; margin-top: -7px;
  border: 7px solid transparent; border-right-color: #fff; border-left: 0;
}

.preview {
  height: 40px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: clamp(24px, calc(var(--hog-size) * .42), 40px); font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
}
.preview span { background: #fff; border-radius: 10px; padding: 2px 14px; }
.preview.bad span { background: var(--danger); color: #fff; animation: shake .35s; }
.preview.extra span { background: #8fc1e8; color: #fff; }
.preview.good span { background: var(--accent); color: #fff; }

.board-wrap { position: relative; flex: none; margin-bottom: 6px; }
.board { display: grid; gap: 8px; position: relative; z-index: 1; }
/* след пути — под плитками (виден в зазорах): поверх он перечёркивал буквы и вспыхивал полосой на ещё белой плитке */
.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.trail polyline { fill: none; stroke: rgba(242, 184, 75, .75); stroke-linecap: round; stroke-linejoin: round; }
.tile {
  width: var(--tile-size); height: var(--tile-size); border-radius: 16px;
  background: var(--tile); border-bottom: 5px solid var(--tile-edge);
  display: flex; align-items: center; justify-content: center; position: relative;
  font-weight: 800; font-size: calc(var(--tile-size) * .5); color: var(--tile-text); text-transform: uppercase;
  transition: transform .1s; /* цвет выделения — сразу, без перехода: иначе новая буква «мигает» */
}
.tile .num {
  position: absolute; right: 7px; top: 5px; font-size: calc(var(--tile-size) * .22); font-weight: 700; opacity: .65;
}
.tile.sel { background: var(--sel); transform: scale(.95); }
.tile.gone { visibility: hidden; }
.tile.vanish { animation: vanish .35s forwards; }
.tile.tut { animation: pulse 1.2s infinite; background: #fff1c4; box-shadow: 0 0 0 3px #f2b84b; } /* всё первое слово подсвечено сразу */
.tile.tut.sel { animation: none; background: var(--sel); } /* выделение сильнее подсказки 1-го уровня */

.actions { display: flex; justify-content: space-around; gap: 8px; height: 70px; flex: none; padding-bottom: 8px; }
.act-btn {
  flex: 1; border: none; border-radius: 16px; background: rgba(255, 255, 255, .7);
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
}
.act-ico { font-size: 22px; line-height: 1; }
.act-label { font-size: 12px; margin-top: 3px; }
.badge {
  position: absolute; top: 4px; right: 8px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 6px;
}
.act-btn.hidden { display: none; }
.act-btn.next { background: var(--accent); color: #fff; }
@media (max-width: 420px) { /* пять кнопок на телефоне */
  .actions { gap: 5px; }
  .act-label { font-size: 11px; white-space: nowrap; }
  .act-btn .badge { right: 3px; }
}
/* режим доп. слов: ряды — доп. слова уровня, у плиток нет чисел (они не кончаются) */
.board.free .tile .num { display: none; }
.answer.extras-mode .row.found .cell { background: #dcecf8; color: #2c5a7c; }
.tile.back { animation: tile-back .45s ease-out; }
@keyframes tile-back { from { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } to { transform: scale(1); } }
.act-btn.attention { animation: pulse 1.2s infinite; }
.act-btn.dim { opacity: .55; }
.score-note { font-size: 14px; opacity: .75; margin-top: -4px; }
/* находки в окнах — на мягком круге, чтобы белое пёрышко и капля не терялись на белом */
.basket .find-img, .dialog p .find-img {
  background: radial-gradient(circle, #e9f1df 55%, #d3e2c2); border-radius: 50%; padding: 4px; box-sizing: content-box;
}

/* окна */
.overlay {
  position: fixed; inset: 0; background: rgba(30, 45, 20, .55); z-index: 10;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.overlay.hidden { display: none; }
.dialog {
  position: relative; display: flex; flex-direction: column;
  background: #fffdf6; border-radius: 22px; width: 100%; max-width: 380px;
  max-height: 90vh; overflow: hidden; text-align: center; /* углы скруглены всегда, прокрутка — внутри */
}
.dialog-body {
  overflow-y: auto; overflow-x: hidden; padding: 20px; touch-action: pan-y; overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges; /* место под полосу с обеих сторон — центр не съезжает, когда она появляется */
}
/* Полоса прокрутки: тонкая, с отступами сверху и снизу, чтобы не заходить на скруглённые углы.
   Chrome/Safari — через ::-webkit-scrollbar (стандартные scrollbar-* их отключили бы),
   Firefox — scrollbar-width (он не знает ::-webkit-scrollbar). */
.dialog-body::-webkit-scrollbar { width: 10px; }
.dialog-body::-webkit-scrollbar-track { background: transparent; margin: 22px 0; }
.dialog-body::-webkit-scrollbar-thumb {
  background: rgba(80, 60, 40, .28); border-radius: 5px;
  border: 3px solid transparent; background-clip: padding-box; /* визуально 4 px, отступ от края окна */
}
.dialog-body::-webkit-scrollbar-thumb:hover { background-color: rgba(80, 60, 40, .45); }
@supports not selector(::-webkit-scrollbar) {
  .dialog-body { scrollbar-width: thin; scrollbar-color: rgba(80, 60, 40, .3) transparent; }
}
.dialog-close {
  position: absolute; top: 10px; right: 10px; z-index: 2; display: none;
  width: 36px; height: 36px; border-radius: 50%; border: none; padding: 0;
  background: rgba(240, 232, 214, .95); color: var(--text); font-size: 24px; line-height: 36px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.dialog.closable .dialog-close { display: block; }
.dialog.closable .dialog-body { padding-top: 24px; }
.dialog h2 { margin: 6px 0 10px; font-size: 22px; }
.dialog p { margin: 8px 0; }
.dialog .mascot { margin: 0 auto; width: 90px; height: 90px; }
.btn {
  display: block; width: 100%; border: none; border-radius: 14px; padding: 13px; margin-top: 10px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 17px; border-bottom: 4px solid var(--accent-dark);
  line-height: 22px; /* фиксированная высота строки: эмодзи (📺, 🎡) не делают кнопку выше */
}
.btn.secondary { background: #eee6d4; color: var(--text); border-bottom-color: #cfc3a8; }
.btn:disabled { opacity: .45; }
.progress { height: 14px; background: #eadfc6; border-radius: 8px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--accent); transition: width .6s; }
.words-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0; }
.words-list span { background: #e7f0dc; border-radius: 8px; padding: 4px 8px; text-transform: uppercase; font-weight: 700; font-size: 14px; }
.chapters { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.chapter {
  border-radius: 16px; padding: 12px 14px; color: #fff; display: flex; align-items: center; gap: 12px;
}
.chapter.locked { filter: grayscale(.9); opacity: .6; }
.chapter .find { font-size: 34px; width: 46px; flex: none; display: flex; align-items: center; justify-content: center; } /* одинаковая ширина — кнопки уровней в карточках начинаются ровно */
.chapter .ch-title { font-weight: 800; font-size: 17px; }
.chapter > div:last-child { flex: 1; min-width: 0; }
.chapter .ch-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 13px 6px; margin-top: 8px; } /* по 5 в строке, на всю ширину; между рядами 13px — галочка (top -6px) не налезает на счётчик доп. слов ряда выше (bottom -6px) */
.chapter .ch-levels button {
  width: 100%; height: 34px; border-radius: 9px; border: none; background: rgba(255, 255, 255, .85);
  color: #333; font-weight: 700; font-size: 14px; padding: 0;
}
/* текущий уровень — белая кнопка с зелёной обводкой; золотой — найдены все доп. слова */
.chapter .ch-levels button { position: relative; }
.chapter .ch-levels button.cur { background: #fff; box-shadow: 0 0 0 3px var(--accent), 0 2px 6px rgba(0, 0, 0, .2); }
.chapter .ch-levels button.gold {
  background: linear-gradient(160deg, #fff1a8, #f2c14e 70%); color: #6b4a12;
  box-shadow: inset 0 -2px 0 rgba(160, 110, 20, .35);
}
/* пройденный уровень — тёмно-зелёная кнопка с галочкой */
.chapter .ch-levels button.done:not(.gold) { background: #3e6526; color: #fff; } /* золотой (все доп. слова) остаётся золотым */
.chapter .ch-levels button.done:not(.gold)::after {
  content: "✓"; position: absolute; top: -6px; right: -4px; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; color: #3e6526; font-size: 11px; font-weight: 900; line-height: 15px; box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.chapter .ch-levels button.done:not(.gold).cur { box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(0, 0, 0, .2); }
.legend-done { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: #3e6526; color: #fff; font-size: 11px; font-weight: 900; line-height: 16px; text-align: center; }
.chapter .ch-levels button.gold.cur { box-shadow: 0 0 0 3px var(--accent), inset 0 -2px 0 rgba(160, 110, 20, .35); }
.chapter .ch-levels button.gold::after, .chapter .ch-levels button.star::after {
  content: "★"; position: absolute; top: -7px; right: -5px; font-size: 13px; line-height: 1;
  color: #e0a21f; text-shadow: 0 0 2px #fff, 0 0 3px #fff;
}
.my-score { font-size: 18px; margin: 4px 0; }
.my-score b { font-size: 24px; color: var(--accent-dark); }
.score-rules { font-size: 13px; opacity: .7; margin: 0 0 10px; }
.score-rules span { white-space: nowrap; }
.login-box { background: #eef6e6; border-radius: 14px; padding: 12px 14px; margin: 10px 0 14px; font-size: 14px; }
.login-box .btn { margin-top: 8px; }
.login-box small { display: block; opacity: .7; margin-top: 6px; }
.leaders { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.leader { display: flex; align-items: center; gap: 10px; background: #f6f1e4; border-radius: 12px; padding: 7px 10px; }
.leader.me { background: #fff3c4; box-shadow: 0 0 0 2px #f2c14e; }
.leader .rank { width: 30px; text-align: center; font-weight: 800; color: #7a6a4e; flex: none; }
.leader .rank.top1 { color: #d4a017; } .leader .rank.top2 { color: #9aa0a6; } .leader .rank.top3 { color: #b87333; }
.leader > img, .leader .ava { width: 32px; height: 32px; border-radius: 50%; flex: none; background: #e0d6c0; object-fit: cover; }
.leader .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader .pts { font-weight: 800; }
.leaders-gap { text-align: center; opacity: .5; line-height: 1; }
.leaders-note { font-size: 14px; opacity: .75; }
/* монеты — только счётчик, не кнопка */
.coins { cursor: default; pointer-events: none; }
/* кнопка колеса: красная точка — есть бесплатное вращение; до 10-го уровня приглушена */
.icon-btn { position: relative; }
.icon-btn.has-dot::after {
  content: ""; position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; border-radius: 50%;
  background: #e5484d; box-shadow: 0 0 0 2px #fff; animation: pulse 1.4s infinite;
}
.icon-btn.locked { opacity: .5; }
.wheel-sub { opacity: .8; white-space: nowrap; } /* одна строка в обоих вариантах — окно не меняет высоту */
.wheel-wrap { position: relative; width: min(280px, 72vw, 40vh); aspect-ratio: 1; margin: 22px auto 10px; } /* на невысоких экранах меньше — окну не нужна прокрутка */
/* колесо крутится внутри круглой рамки с overflow: hidden — углы вращающегося блока не выходят
   за окно и не включают/выключают полосу прокрутки (иначе окно «прыгало» десятки раз за вращение) */
.wheel-clip { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; box-shadow: 0 6px 18px rgba(0, 0, 0, .18), 0 0 0 6px #e0a82e; }
.wheel { width: 100%; height: 100%; border-radius: 50%; }
.wheel-svg { width: 100%; height: 100%; display: block; }
.wheel-pointer {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%); z-index: 2;
  border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid #d9534f;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3));
}
.wheel-result { min-height: 1.6em; line-height: 1.6em; font-size: 20px; margin: 6px 0; } /* место под строку приза заранее — окно не меняет высоту */
/* лавка */
.shop-coins { font-size: 18px; margin: 2px 0 10px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.shop-note { font-size: 13px; opacity: .7; margin: 0 0 10px; }
.shop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.shop-hero { width: min(170px, 24vh); aspect-ratio: 1; margin: calc(10px + min(170px, 24vh) * .26) auto 0; } /* сверху место: высокие шапки и посох выходят за кадр ёжика */
.shop-try { font-size: 13px; opacity: .7; margin: 4px 0 0; min-height: 1.3em; }
.shop-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-bottom: 10px; }
.shop-tab {
  position: relative; border: none; border-radius: 10px; background: #f0e9d8; padding: 6px 2px 5px;
  font-size: 10.5px; line-height: 1.15; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
}
.shop-tab span { font-size: 20px; line-height: 1; }
.shop-tab.on { background: var(--accent); color: #fff; }
.shop-tab .dot-on { position: absolute; top: 4px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: #e0a82e; }
.shop-item.trying { box-shadow: 0 0 0 2px #e0a82e; }
.shop-item { background: #f6f1e4; border-radius: 14px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.shop-item.on { background: #e9f3dd; box-shadow: 0 0 0 2px var(--accent); }
.shop-img { width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border: none; background: none; padding: 6px; }
.shop-img > img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* значок вещи — ёжик в обычной позе только в этой вещи; сверху место для высоких шапок и посоха */
.shop-hog { width: 80%; aspect-ratio: 1; margin-top: 18%; }
.shop-soon { font-size: 13px; opacity: .5; }
.shop-name { font-size: 12.5px; font-weight: 700; line-height: 1.2; min-height: 2.4em; display: flex; align-items: center; justify-content: center; text-align: center; hyphens: auto; overflow-wrap: anywhere; }
.shop-btn {
  width: 100%; border: none; border-radius: 10px; padding: 6px 4px; font-weight: 800; font-size: 14px; line-height: 18px;
  background: #fff; color: var(--text); display: flex; align-items: center; justify-content: center; gap: 4px;
}
.shop-btn.buy { background: var(--accent); color: #fff; }
.shop-btn.worn { background: transparent; color: var(--accent-dark); }
.shop-btn:disabled:not(.worn) { opacity: .5; }
.mascot { cursor: default; }
.leader .hog-ava { width: 48px; height: 48px; margin: -6px 0; flex: none; } /* крупнее — чтобы был виден наряд */
.legend { font-size: 13px; opacity: .75; margin: 0 0 12px; }
/* пройденный уровень с ненайденными доп. словами: сколько осталось — оранжевый кружок внизу справа */
.chapter .ch-levels button.has-left::before {
  content: attr(data-left); position: absolute; bottom: -6px; right: -4px; min-width: 15px; height: 15px; padding: 0 3px;
  box-sizing: border-box; border-radius: 8px; background: #f08a24; color: #fff; font-size: 10px; font-weight: 900;
  line-height: 15px; text-align: center; box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.legend-left { display: inline-block; min-width: 16px; height: 16px; border-radius: 8px; background: #f08a24; color: #fff; font-size: 11px; font-weight: 900; line-height: 16px; text-align: center; }
.legend-gold { color: #e0a21f; font-size: 15px; }
.gold-line { color: #b9851a; font-weight: 700; }
.chapter .ch-levels button:disabled { opacity: .4; }
.basket { font-size: 30px; letter-spacing: 6px; margin: 6px 0; }
.reward-line { font-weight: 700; color: var(--accent-dark); }

.cell.pending { color: transparent; }
.cell.landed { animation: pop .3s ease; background: var(--cell-filled); }
.flier {
  position: fixed; z-index: 20; pointer-events: none; transform-origin: 0 0;
  display: flex; align-items: center; justify-content: center; border-radius: 12px;
  background: var(--sel); color: var(--tile-text); font-weight: 800; text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
}
.level-banner {
  position: absolute; left: 50%; top: 50%; z-index: 4; pointer-events: none; white-space: nowrap;
  background: var(--accent); color: #fff; font-weight: 800; font-size: clamp(20px, calc(var(--tile-size) * .3), 34px);
  padding: .35em 1.1em; border-radius: 999px; border-bottom: 4px solid var(--accent-dark);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.hand {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none;
  font-size: 44px; line-height: 1; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3));
}
.confetti {
  position: fixed; top: -40px; width: 9px; height: 14px; border-radius: 2px; z-index: 30; pointer-events: none; /* стартуют за верхним краем */
}
.dialog h3 { margin: 18px 0 6px; font-size: 17px; }
.rules { text-align: left; padding-left: 20px; margin: 0; font-size: 14px; line-height: 1.4; }
.rules li { margin: 5px 0; }
.game-title { font-size: 13px; letter-spacing: .5px; opacity: .65; margin-bottom: -4px; }
.credits { font-size: 12px; opacity: .65; line-height: 1.35; margin-top: 14px; }

.flier.extra { background: #8fc1e8; color: #fff; }
/* буква подсказки: летит из кнопки «Подсказка», в клетке — цветом подсказки, клетка остаётся прозрачной */
.flier.hint { background: var(--cell-filled); color: var(--accent); }
.cell.hint-in { animation: pop .3s ease; }
/* кнопка «Доп. слова»: вспышка, когда долетели буквы нового доп. слова, и короткое мигание для повтора */
.act-btn.got { animation: extras-glow .9s ease-out; }
.act-btn.again { animation: extras-blink .5s ease-out; }
.badge.pop { animation: badge-pop .45s ease-out; }
@keyframes extras-glow {
  0% { background: #cfe7f8; box-shadow: 0 0 0 0 rgba(90, 166, 214, .75); transform: scale(1.06); }
  60% { background: #e3f1fb; box-shadow: 0 0 0 14px rgba(90, 166, 214, 0); transform: scale(1); }
  100% { box-shadow: 0 0 0 0 rgba(90, 166, 214, 0); }
}
@keyframes extras-blink { 0%, 100% { background: rgba(255, 255, 255, .7); } 40% { background: #e3f1fb; } }
@keyframes badge-pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); background: #5aa6d6; } 100% { transform: scale(1); } }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes vanish { to { transform: scale(0); opacity: 0; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); box-shadow: 0 0 0 4px rgba(242, 184, 75, .7); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } }
.icon-btn.hidden { display: none; }

/* заставка загрузки */
.loader {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(180deg, var(--bg1), var(--bg2)); transition: opacity .35s;
}
.loader.gone { opacity: 0; pointer-events: none; }
.loader-title { font-size: 30px; font-weight: 800; color: var(--accent-dark); }
.loader-text { font-size: 16px; opacity: .75; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 5px solid rgba(91, 140, 58, .25); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* главное меню */
.menu {
  position: fixed; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top), var(--safe-top, 0px)) 16px max(16px, env(safe-area-inset-bottom), var(--safe-bottom, 0px));
  background: rgba(255, 253, 246, .35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.menu.hidden { display: none; }
/* пока открыто меню, под его размытием ничего не шевелится (иначе backdrop-filter пересчитывается каждый кадр) */
body.menu-open #boardWrap * { animation-play-state: paused; }
body.menu-open .hand { display: none; }
.menu-card {
  width: 100%; max-width: 360px; max-height: 100%; overflow-y: auto; text-align: center;
  background: rgba(255, 253, 246, .93); border-radius: 26px; padding: 22px 20px 18px;
  box-shadow: 0 10px 30px rgba(40, 50, 20, .25);
}
.menu-title { font-size: 30px; font-weight: 800; color: var(--accent-dark); line-height: 1.1; }
.menu-hog { width: min(150px, 22vh); height: min(150px, 22vh); margin: calc(6px + min(150px, 22vh) * .26) auto 2px; }
.menu-where { font-size: 15px; opacity: .8; margin-bottom: 4px; }
.menu-coins { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; margin-bottom: 12px; }
.menu-coins .coin { width: 16px; height: 16px; }
.menu-card .btn { margin-top: 8px; white-space: nowrap; }
.menu-card .btn.play { font-size: 20px; padding-top: 14px; padding-bottom: 14px; }
.menu-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 8px; }
.menu-row.odd .btn:last-child { grid-column: 1 / -1; } /* нечётная кнопка — во всю ширину */
.menu-row .btn { margin-top: 8px; font-size: 15px; padding-left: 6px; padding-right: 6px; }
.menu-card .btn.has-dot { position: relative; }
.menu-card .btn.has-dot::after { /* бесплатное вращение сегодня ещё не использовано */
  content: ""; position: absolute; top: 7px; right: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger);
}

/* бонусный уровень на время: монетка в каждой клетке ответа, часы вместо номера уровня */
.cell.coin-cell .coin { width: 62%; height: 62%; box-shadow: inset 0 -2px 0 #b98314, 0 1px 2px rgba(120, 80, 10, .3); }
.coin.coin-flier { position: fixed; z-index: 60; pointer-events: none; margin: 0; }
.level-name.bonus-timer { font-weight: 800; font-variant-numeric: tabular-nums; }
.level-name.bonus-timer.hurry { color: #c0392b; animation: pulse 1s infinite; }
