/* ============ Fonts ============ */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/nunito-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/nunito-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/nunito-cyrillic-800-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/nunito-latin-800-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/nunito-cyrillic-900-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/nunito-latin-900-normal.woff2') format('woff2');
}

/* ============ Reset & platform protections ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: var(--app-height, 100%);
  overflow: hidden;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: none;
  background: #0c0925;
  font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
}

#ui-root, .screen, #game-canvas {
  height: 100%;
  height: var(--app-height, 100%);
}

/* ============ Геометрия HUD ============ */
/* Панель оружия рисуется ИЗ этих переменных, и из них же считается её правый
   край — кольцо прогресса привязано к нему и не может уехать на чужой блок.
   (Ровно так сломалось на Safari: кольцо стояло по жёсткому right:190px и
   пряталось под кнопкой аккаунта, раздутой длинным ником.)
   --hud-top — общая «линия старта» левой колонки: ниже неё начинаются и панель
   оружия, и кольцо. Её считает JS по РЕАЛЬНОЙ высоте строки «имя + уровень»
   (HUD._syncHudTop, ResizeObserver), поэтому длинное имя предмета, тизер
   прогрессии или баннерная полоса не могут наехать на панель ни при каком
   размере кадра — медиазапросы этого не умеют, они не знают длины текста. */
:root {
  /* желаемый размер ячейки; медиазапросы меняют именно его, а фактический
     --wp-size ужимается до того, что реально влезает по высоте */
  --wp-base: 68px;
  --wp-cols: 2;
  --wp-rows: 9;        /* 18 орудий / --wp-cols */
  --wp-gap: 7px;
  --wp-left: 8px;
  --hud-top: 64px;
  --hud-bottom: 12px;
  --wp-fit: calc((var(--app-height, 100vh) - var(--hud-top) - var(--hud-bottom)
                  - (var(--wp-rows) - 1) * var(--wp-gap) - 8px) / var(--wp-rows));
  /* две декларации подряд — страховка для старых движков: если min() не
     поддерживается, вторая строка отбрасывается при парсинге и ячейка просто
     остаётся базового размера (панель тогда прокрутится, но не сломается) */
  --wp-size: var(--wp-base);
  --wp-size: min(var(--wp-base), var(--wp-fit));
  /* +8px — горизонтальные паддинги самой панели */
  --panel-right: calc(var(--wp-left) + var(--wp-cols) * var(--wp-size)
                      + (var(--wp-cols) - 1) * var(--wp-gap) + 8px);
  /* высота полосы геймплейного баннера: ненулевая только там, где баннер не
     помещается в пустой центр верхней полосы и весь верхний HUD едет вниз */
  --top-inset: 0px;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  touch-action: none;
  z-index: 2;
  /* до первого движения мыши свой прицел ещё не рисуется — показываем OS-crosshair */
  cursor: crosshair;
}
/* the game draws its own crosshair — hide the OS cursor while it is visible */
#game-canvas.custom-cursor { cursor: none; }

button, .btn, .wp-cell, .obj-card, .icon-btn {
  touch-action: none;
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

/* ============ Backdrop (dark neon space, pre-blurred gradients — no filter) ============ */
#room-bg {
  position: fixed;
  inset: 0;
  z-index: 1;
  background-size: cover;
  background-position: center 40%;
  background-color: #0c0925;
}

/* ============ Loading ============ */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background:
    radial-gradient(120% 90% at 50% 110%, rgba(63,185,232,.22) 0%, rgba(63,185,232,0) 55%),
    radial-gradient(80% 60% at 12% 8%, rgba(216,79,192,.16) 0%, rgba(216,79,192,0) 60%),
    linear-gradient(160deg, #241b52 0%, #181240 55%, #0c0925 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .45s ease, visibility .45s;
}
#loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-inner { text-align: center; }
.loading-logo { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
.loading-bar-wrap {
  width: 220px; height: 14px; margin: 26px auto 10px;
  background: rgba(6,4,20,.6); border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(130,150,255,.25);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.4);
}
#loading-bar {
  height: 100%; width: 0%; border-radius: 10px;
  background: linear-gradient(90deg, #4ee7ff, #ff5ecf);
  box-shadow: 0 0 12px rgba(78,231,255,.55);
  transition: width .25s ease;
}
#loading-text { color: #dfe8ff; font-weight: 800; font-size: 15px; opacity: .9; }

/* ============ UI root & screens ============ */
/* IMPORTANT: no ID selectors for pointer-events on children — ID specificity
   would override .screen.active and make overlays unclickable */
#ui-root { position: fixed; inset: 0; z-index: 3; pointer-events: none; }

.screen {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .28s ease, visibility .28s;
}
.screen.active { opacity: 1; visibility: visible; pointer-events: auto; }

/* HUD passes clicks through to canvas */
#hud { position: absolute; inset: 0; pointer-events: none !important; opacity: 1; visibility: visible; }
#hud > * { pointer-events: auto; }
#hud .no-events { pointer-events: none !important; }

/* ============ HUD: percent ring ============ */
/* Кольцо стоит под строкой «имя + уровень» и правее панели оружия (просьба
   ревьюера CrazyGames: центр верхней полосы отдан баннеру 320×50). Позиция
   считается от --panel-right, поэтому переезжает вместе с панелью на всех
   раскладках и ни при каких ширинах не попадает под верхний правый ряд. */
#percent-wrap {
  --ring: 86px;
  position: absolute;
  top: var(--hud-top);
  left: calc(var(--panel-right) + 14px);
  width: var(--ring);
  text-align: center; pointer-events: none !important;
}
#percent-ring {
  display: block;
  width: var(--ring); height: var(--ring);
  filter: drop-shadow(0 0 7px rgba(78,231,255,.35)) drop-shadow(0 3px 8px rgba(0,0,0,.4));
}
#percent-ring .ring-bg {
  fill: rgba(12,9,38,.55);
  stroke: rgba(130,150,255,.2);
  stroke-width: 7;
}
#percent-ring .ring-fill {
  fill: none;
  stroke: url(#ring-grad);
  stroke-width: 7;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset .35s ease;
}
#percent-num {
  position: absolute; top: 0; left: 0; right: 0;
  height: var(--ring);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--ring) * 0.24);
  font-weight: 900; color: #fff; line-height: 1;
  text-shadow: 0 2px 0 rgba(8,6,26,.6), 0 0 14px rgba(78,231,255,.35);
  letter-spacing: .5px;
  transition: transform .12s ease;
}
#percent-num.bump { transform: scale(1.12); }
#percent-ring .ring-fill.done {
  stroke: #58e87c;
  filter: drop-shadow(0 0 5px rgba(88,232,124,.7));
}

/* ============ HUD: top-left (object name + level/xp) ============ */
#top-left {
  position: absolute; top: calc(10px + var(--top-inset)); left: 14px;
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  pointer-events: none !important;
}
#obj-name {
  font-size: 15px; font-weight: 800; color: rgba(238,242,255,.96);
  text-shadow: 0 2px 4px rgba(0,0,0,.5);
  background: rgba(16,12,42,.55);
  border: 1px solid rgba(130,150,255,.24);
  padding: 6px 14px; border-radius: 20px;
  pointer-events: none !important;
  max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============ HUD: top-right buttons ============ */
#top-right {
  position: absolute; top: calc(10px + var(--top-inset)); right: 12px;
  display: flex; gap: 10px; align-items: center;
}
.icon-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(180deg, rgba(62,55,128,.92), rgba(32,26,76,.94));
  border: 1.5px solid rgba(140,160,255,.32);
  box-shadow: 0 3px 0 rgba(10,8,30,.85), 0 5px 12px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s ease;
  position: relative;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(10,8,30,.85), 0 3px 6px rgba(0,0,0,.35); }
.icon-btn svg { width: 28px; height: 28px; }
.icon-btn.off svg { opacity: .38; }
.icon-btn.off::after {
  content: ''; position: absolute; width: 34px; height: 4px; border-radius: 2px;
  background: #e05555; transform: rotate(-45deg);
}

/* ============ HUD: weapon panel (left side) ============ */
/* Панель живёт в полосе между строкой «имя + уровень» и низом окна и
   центрируется ВНУТРИ неё: на любой высоте кадра она физически не может
   наехать на верхний HUD. Ячейки при этом ужимаются (--wp-fit), поэтому все
   18 орудий видны без прокрутки даже в коротком окне Chromebook. */
#wp-panel {
  position: absolute; left: var(--wp-left);
  top: var(--hud-top); bottom: var(--hud-bottom);
  display: grid; grid-template-columns: repeat(var(--wp-cols), var(--wp-size, 68px));
  align-content: center;
  align-content: safe center; /* при переполнении ряды не уезжают под верхний HUD */
  gap: var(--wp-gap);
  padding: 4px;
  /* страховка: если все ряды всё же не влезают (экстремально низкое окно) —
     скроллим, а не обрезаем нижние оружия */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#wp-panel::-webkit-scrollbar { display: none; }
.wp-cell {
  /* pan-y (перебивает глобальный touch-action:none кнопок): на низких экранах
     панель скроллится — вертикальный свайп по ячейкам должен её прокручивать;
     JS-фолбэк у границ панели по-прежнему давит pull-to-refresh */
  touch-action: pan-y;
  width: var(--wp-size, 68px); height: var(--wp-size, 68px);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(56,50,118,.92) 0%, rgba(34,28,82,.94) 60%, rgba(24,19,60,.95) 100%);
  border: 2px solid rgba(130,150,255,.3);
  box-shadow: 0 3px 8px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.1);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s ease;
  overflow: hidden;
}
.wp-cell:active { transform: scale(.94); }
.wp-cell.selected {
  border-color: #4ee7ff;
  background: linear-gradient(160deg, rgba(38,84,128,.95) 0%, rgba(24,52,104,.95) 70%, rgba(18,36,84,.95) 100%);
  box-shadow: 0 0 0 2px rgba(78,231,255,.35), 0 0 16px rgba(78,231,255,.4), 0 3px 8px rgba(0,0,0,.4);
}
.wp-cell svg.wp-icon { width: 72%; height: 72%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.wp-cd {
  position: absolute; inset: 0;
  background: rgba(8,6,26,.62);
  transform-origin: bottom;
  transform: scaleY(0);
  pointer-events: none;
}
/* бейдж закрытого орудия = требуемый уровень (тизер прогрессии) */
.wp-lock {
  position: absolute; right: 2px; bottom: 2px;
  min-width: 22px; height: 20px; padding: 0 4px; border-radius: 7px;
  background: linear-gradient(180deg, #ffd94e, #f0a820);
  border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; color: #3a2a06; line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
/* орудие-приз 7-го дня: вместо уровня — подарок */
.wp-lock.daily {
  background: linear-gradient(180deg, #ff8ae0, #e0359f);
  padding: 0 3px;
}
.wp-lock.daily svg { width: 13px; height: 13px; }
/* закрытое орудие — тёмный силуэт: видно форму, но не детали (интрига) */
.wp-cell.locked svg.wp-icon { opacity: .6; filter: brightness(.14) saturate(0); }
.wp-cell.locked { background: linear-gradient(160deg, rgba(40,35,86,.92), rgba(22,18,54,.95)); }
/* только что открытое орудие пульсирует, чтобы игрок его нашёл и попробовал */
.wp-cell.fresh { animation: wp-fresh 1.2s ease-in-out 5; }
@keyframes wp-fresh {
  0%,100% { box-shadow: 0 3px 8px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.1); }
  50% { box-shadow: 0 0 0 3px rgba(94,242,255,.85), 0 0 22px rgba(94,242,255,.8); }
}
/* фейды-подсказки скролла нижней ленты оружия: живут только в мобильном
   портрете (медиаблок в конце файла), на остальных раскладках скрыты */
.wp-fade { display: none; }

/* ============ HUD: level badge + XP bar (top-left) ============ */
#lvl-widget {
  display: flex; align-items: center; gap: 8px;
  pointer-events: none !important;
}
#lvl-badge {
  position: relative; flex: none;
  width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(86,76,172,.97), rgba(28,22,74,.97));
  border: 2px solid rgba(94,242,255,.55);
  box-shadow: 0 0 10px rgba(78,231,255,.35), 0 3px 8px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.15);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1;
}
#lvl-num {
  font-size: 18px; font-weight: 900; color: #fff;
  text-shadow: 0 0 8px rgba(78,231,255,.6), 0 1px 2px rgba(0,0,0,.5);
}
#lvl-label {
  font-size: 8px; font-weight: 800; color: #9fb4ff;
  letter-spacing: .5px; margin-top: 1px;
}
#lvl-badge.pulse { animation: lvl-pulse .45s ease; }
#lvl-badge.ping { animation: lvl-pulse .55s ease; }
@keyframes lvl-pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.22); }
  100% { transform: scale(1); }
}
/* расходящееся кольцо при левел-апе */
#lvl-badge.ping::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid #4ee7ff;
  animation: lvl-ping .75s ease-out forwards;
}
@keyframes lvl-ping {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}
#xp-track {
  position: relative;
  width: 132px; height: 18px; border-radius: 10px;
  background: rgba(16,12,42,.65);
  border: 1px solid rgba(130,150,255,.3);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.45);
}
#xp-fill {
  height: 100%; width: 0%;
  border-radius: 10px;
  /* бесшовный бегущий градиент: края совпадают, панорамирование зациклено */
  background: linear-gradient(90deg, #35c6ee, #b44de8, #35c6ee);
  background-size: 200% 100%;
  animation: xp-flow 2.4s linear infinite;
  box-shadow: 0 0 10px rgba(78,180,255,.55);
  transition: width .35s ease;
}
@keyframes xp-flow {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
#xp-fill.full { filter: brightness(1.6); box-shadow: 0 0 18px rgba(140,240,255,.95); }
#xp-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800; color: #eaf2ff;
  letter-spacing: .3px;
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
}
/* бонус-звезда, летящая из точки разрушения в бейдж уровня */
.xp-star {
  position: absolute; width: 30px; height: 30px; z-index: 20;
  pointer-events: none !important;
  transform: translate(-50%,-50%);
  transition: left .6s cubic-bezier(.4,-0.2,.7,1), top .6s cubic-bezier(.4,-0.2,.7,1),
              transform .6s ease, opacity .6s ease;
  filter: drop-shadow(0 0 6px rgba(78,231,255,.8));
}

/* ============ Countdown before timed ad ============ */
/* Показ по таймеру используют Яндекс и Playgama; на CrazyGames/Poki элемент
   просто никогда не показывается. Без transition (замирает в headless-
   композиторе) и без transform-анимаций геометрии. */
#cd-note {
  position: absolute; left: 50%; top: 21%; transform: translateX(-50%);
  font-size: clamp(19px, 4vw, 34px); font-weight: 900; color: #fff;
  text-shadow: 0 2px 0 rgba(8,6,26,.6), 0 0 16px rgba(78,231,255,.55);
  background: rgba(16,12,42,.72);
  border: 1.5px solid rgba(130,150,255,.4);
  padding: 10px 28px; border-radius: 32px;
  white-space: nowrap;
  opacity: 0; visibility: hidden;
  pointer-events: none !important;
  z-index: 25;
}
#cd-note.show { opacity: 1; visibility: visible; }
#cd-note.tick { animation: cd-tick .4s ease-out; }
@keyframes cd-tick {
  0% { text-shadow: 0 2px 0 rgba(8,6,26,.6), 0 0 30px rgba(78,231,255,.95); }
  100% { text-shadow: 0 2px 0 rgba(8,6,26,.6), 0 0 16px rgba(78,231,255,.55); }
}

/* ============ Level-up banner ============ */
#lvlup-note {
  position: absolute; left: 0; right: 0; top: 19%;
  text-align: center;
  pointer-events: none !important;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
  z-index: 6;
}
#lvlup-note.show { opacity: 1; visibility: visible; }
#lvlup-text {
  display: inline-block; position: relative;
  font-size: clamp(22px, 6vw, 54px);
  font-weight: 900; color: #fff;
  -webkit-text-stroke: 1.5px #1a1348;
  text-shadow: 0 3px 0 #1a1348, 0 0 22px rgba(94,242,255,.75), 0 0 46px rgba(180,77,232,.5);
  letter-spacing: 2px;
}
#lvlup-note.show #lvlup-text { animation: win-pop .5s cubic-bezier(.2,1.6,.4,1) both; }
#lvlup-burst {
  position: absolute; left: 50%; top: 50%;
  width: 240px; height: 240px; border-radius: 50%;
  transform: translate(-50%,-50%);
  opacity: 0;
}
#lvlup-note.show #lvlup-burst {
  background: radial-gradient(circle, rgba(94,242,255,.4), rgba(180,77,232,.18) 45%, rgba(94,242,255,0) 70%);
  animation: lvl-burst .8s ease-out both;
}
@keyframes lvl-burst {
  0% { transform: translate(-50%,-50%) scale(.2); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(2.4); opacity: 0; }
}

/* ============ HUD: bottom-right buttons ============ */
#bottom-right {
  position: absolute; right: 12px; bottom: 12px;
  display: flex; gap: 10px; align-items: flex-end;
}
#btn-objects {
  width: 74px; height: 74px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(62,55,128,.95), rgba(32,26,76,.96));
  border: 2px solid rgba(94,242,255,.5);
  box-shadow: 0 4px 0 rgba(10,8,30,.85), 0 0 16px rgba(78,231,255,.3), 0 6px 12px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s ease;
}
#btn-objects:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(10,8,30,.85), 0 3px 6px rgba(0,0,0,.35); }
#btn-objects svg { width: 54px; height: 54px; }
#btn-restart {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(180deg, rgba(62,55,128,.92), rgba(32,26,76,.94));
  border: 1.5px solid rgba(140,160,255,.32);
  box-shadow: 0 3px 0 rgba(10,8,30,.85), 0 5px 12px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s ease;
}
#btn-restart:active { transform: translateY(2px) rotate(-40deg); }
#btn-restart svg { width: 26px; height: 26px; }

/* ============ Damage numbers ============ */
.dmg-num {
  position: absolute;
  font-weight: 900; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 4px 8px rgba(0,0,0,.25);
  pointer-events: none !important;
  transform: translate(-50%, -50%);
  animation: dmg-float 0.9s ease-out forwards;
  z-index: 5;
  will-change: transform, opacity;
}
@keyframes dmg-float {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(.5); }
  12%  { opacity: 1; transform: translate(-50%,-60%) scale(1.15); }
  25%  { transform: translate(-50%,-70%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-160%) scale(.92); }
}

/* ============ Crosshair ============ */
#crosshair {
  position: absolute; width: 56px; height: 56px;
  pointer-events: none !important;
  transform: translate(-50%,-50%);
  z-index: 4;
  transition: opacity .2s;
}

/* ============ Win overlay (нейтральное имя — адблокеры прячут id со словом banner) ============ */
#win-note {
  position: absolute; left: 0; right: 0; top: 34%;
  text-align: center;
  padding: 0 10px;
  pointer-events: none !important;
  opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility .3s;
}
#win-note.show { opacity: 1; visibility: visible; }
#win-text {
  display: inline-block;
  max-width: 100%; /* самая длинная фраза не имеет права вылезти за экран */
  /* нижняя граница 26px: на ширине 320 фраза «РАЗГРОМЛЕНО!» при 40px вылезала за края */
  font-size: clamp(26px, 9vw, 92px);
  font-weight: 900;
  color: #fff;
  -webkit-text-stroke: 2px #1a1348;
  text-shadow: 0 4px 0 #1a1348, 0 0 26px rgba(94,242,255,.6), 0 0 60px rgba(255,94,207,.45), 0 8px 22px rgba(0,0,0,.5);
  letter-spacing: 2px;
  transform: rotate(-4deg);
  animation: win-pop .55s cubic-bezier(.2,1.6,.4,1) both;
}
@keyframes win-pop {
  0% { transform: rotate(-4deg) scale(0); }
  70% { transform: rotate(-4deg) scale(1.15); }
  100% { transform: rotate(-4deg) scale(1); }
}
#win-sub {
  margin-top: 8px;
  font-size: 19px; font-weight: 800; color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,.45);
}

/* Next button */
#btn-next {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  padding: 14px 42px;
  border-radius: 30px;
  font-size: 22px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #35c6ee, #4a7df0 55%, #a44de8);
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 5px 0 #1c2a72, 0 0 22px rgba(78,180,255,.5), 0 8px 16px rgba(0,0,0,.4);
  text-shadow: 0 2px 3px rgba(0,0,0,.3);
  opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility .3s, transform .1s;
  animation: next-pulse 1.4s ease-in-out infinite;
}
#btn-next.show { opacity: 1; visibility: visible; }
#btn-next:active { transform: translateX(-50%) translateY(3px); box-shadow: 0 2px 0 #1c2a72, 0 4px 8px rgba(0,0,0,.3); }
@keyframes next-pulse {
  0%,100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.045); }
}
/* вариант пульса без translateX(-50%) — для раскладок, где кнопка не по центру */
@keyframes next-pulse-flat {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

/* ============ Toast ============ */
#toast {
  position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: rgba(18,14,48,.92);
  border: 1px solid rgba(130,150,255,.3);
  color: #fff; font-weight: 800; font-size: 16px;
  padding: 12px 24px; border-radius: 26px;
  max-width: 82vw; text-align: center;
  opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility .3s, transform .3s;
  pointer-events: none !important;
  z-index: 30;
}
#toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(-8px); }

/* ============ Tutorial hint ============ */
#tut-hint {
  position: absolute; left: 50%; top: 58%; transform: translateX(-50%);
  pointer-events: none !important;
  text-align: center;
  transition: opacity .4s;
}
#tut-hint .tut-hand { animation: tap-anim 1.1s ease-in-out infinite; }
@keyframes tap-anim {
  0%,100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(10px) scale(.88); }
  60% { transform: translateY(10px) scale(.88); }
}
#tut-hint .tut-text {
  margin-top: 6px; font-size: 20px; font-weight: 900; color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.5);
}

/* ============ Object selector overlay ============ */
#select-screen {
  background: rgba(10,8,30,.85);
  backdrop-filter: blur(5px);
  display: flex; flex-direction: column;
}
.sel-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 8px;
  flex-wrap: wrap;
}
.sel-title {
  font-size: 26px; font-weight: 900; color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,.4);
  margin-right: auto;
}
.sel-level {
  display: flex; align-items: center; gap: 7px;
  background: rgba(16,12,42,.6); border: 1px solid rgba(130,150,255,.24);
  border-radius: 22px; padding: 7px 16px 7px 9px;
}
.sel-level svg { width: 24px; height: 24px; }
.sel-level span { color: #7defff; font-weight: 900; font-size: 18px; }
#btn-close-select {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(180deg, #ff8a7a, #e65546);
  border: 3px solid #fff;
  box-shadow: 0 3px 0 #b03a2e, 0 5px 10px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 900;
}
#btn-close-select:active { transform: translateY(2px); }

#obj-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
  padding: 6px 16px 20px;
  align-content: start;
}
#obj-grid::-webkit-scrollbar { display: none; }

.cat-header {
  grid-column: 1 / -1;
  color: #fff; font-weight: 900; font-size: 19px;
  text-shadow: 0 2px 4px rgba(0,0,0,.4);
  padding: 10px 2px 0;
  display: flex; align-items: center; gap: 8px;
}
.cat-header::after { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, rgba(94,242,255,.4), rgba(255,94,207,.15)); border-radius: 1px; }

.obj-card {
  /* pan-y so vertical swipes over cards still scroll the grid on touch */
  touch-action: pan-y;
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(56,50,118,.95), rgba(28,23,70,.96));
  border: 2px solid rgba(130,150,255,.28);
  box-shadow: 0 4px 10px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
  padding: 8px 6px 9px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative;
  transition: transform .12s ease;
}
.obj-card:active { transform: scale(.95); }
.obj-card.current { border-color: #4ee7ff; box-shadow: 0 0 0 2px rgba(78,231,255,.35), 0 0 16px rgba(78,231,255,.35), 0 4px 10px rgba(0,0,0,.35); }
.obj-thumb {
  width: 82px; height: 82px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 38%, #322a6e, #191340);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.obj-thumb img, .obj-thumb canvas { width: 100%; height: 100%; }
.obj-card .obj-title {
  font-size: 12.5px; font-weight: 800; color: #e6ebff;
  text-align: center; line-height: 1.15;
  /* длинные русские имена («Сундук с сокровищами») — в две строки, не обрезать;
     min-height под 2 строки, чтобы галочки соседних карточек не прыгали по высоте */
  max-width: 100%; overflow: hidden; min-height: calc(2 * 1.15em);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.obj-card .obj-state {
  font-size: 12px; font-weight: 900;
  display: flex; align-items: center; gap: 4px;
  min-height: 18px;
}
.obj-state svg { width: 15px; height: 15px; }
.obj-state.done { color: #7dffab; }

/* ============ Confetti canvas ============ */
#fx-canvas {
  /* над игровым canvas (2), но ПОД #ui-root (3): конфетти не рисуется поверх экрана выбора */
  position: fixed; inset: 0; z-index: 2;
  pointer-events: none;
  width: 100%; height: 100%;
}

/* ============ Responsive ============ */
/* max-height 620: при базовых ячейках 68px панель из 8 рядов = 601px —
   на высотах 561-620 нижний ряд оружия уходил за экран */
@media (max-width: 760px), (max-height: 620px) {
  :root { --wp-base: 54px; --wp-gap: 5px; }
  #percent-wrap { --ring: 74px; }
  #obj-name { font-size: 12px; max-width: 30vw; }
  #lvl-badge { width: 40px; height: 40px; }
  #lvl-num { font-size: 15px; }
  #lvl-label { font-size: 7px; }
  #xp-track { width: 102px; height: 16px; }
  #xp-text { font-size: 10px; }
  .icon-btn { width: 48px; height: 48px; }
  #btn-objects { width: 62px; height: 62px; }
  #btn-objects svg { width: 46px; height: 46px; }
  #btn-restart { width: 48px; height: 48px; }
  #btn-boosts { width: 48px; height: 48px; }
  #btn-boosts svg { width: 27px; height: 27px; }
  .wp-lock { min-width: 18px; height: 17px; font-size: 10px; border-width: 1.5px; }
  #btn-next { font-size: 18px; padding: 12px 34px; bottom: 10px; min-height: 44px; }
}
@media (max-height: 470px) {
  :root { --wp-base: 48px; }
}
/* Короткие ПОРТРЕТНЫЕ окна (сплит-скрин 450×510): 2-колоночная панель из 8 рядов
   не влезала по высоте и верхом лезла под колонку имени/монет */
@media (orientation: portrait) and (max-height: 560px) {
  :root { --wp-base: 44px; --wp-gap: 4px; }
}
/* Десктоп средней высоты (621-716px): панель 68px (601px высотой) верхней ячейкой
   залезала под пилюлю имени/монет — уменьшаем только ячейки панели */
@media (min-width: 761px) and (min-height: 621px) and (max-height: 716px) {
  :root { --wp-base: 54px; --wp-gap: 5px; }
}
/* short screens (landscape phones): 4-column weapon grid — 8 рядов пальцевого
   размера по высоте не помещаются. orientation-guard: в коротких ПОРТРЕТНЫХ
   окнах (сплит-скрин 450×510) широкая 4-колоночная панель наезжала бы на кольцо.
   ТОЛЬКО для телефонов/планшетов (System Info площадки): Chromebook и ноутбук с
   короткой рамкой — это десктоп, и раскладка там обязана остаться десктопной
   (2 колонки слева), просто с ячейками помельче. */
@media (orientation: landscape) and (max-height: 520px) {
  html:not([data-device="desktop"]) { --wp-cols: 4; --wp-rows: 5; }
  /* кольцо привязано к правому краю панели (см. --panel-right) — своего дока
     ему больше не нужно; в коротком ландшафте оно просто мельче */
  #percent-wrap { --ring: 64px; }
  #obj-name { max-width: 22vw; }
  #xp-track { width: 84px; }
}
/* Телефон в ландшафте: полосы под баннер нет физически (320px высоты уже
   заняты панелью и кнопками), а вписать 320×50 в верхнюю строку рядом с именем
   и кнопками на такой ширине невозможно — баннер там не показываем.
   Короткие окна ДЕСКТОПА (Chromebook, MacBook — от 900px ширины) баннер
   получают: у них центр верхней полосы свободен. */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 900px) {
  #promo-strip { display: none !important; }
}
/* экраны уже самого баннера: он обязан помещаться в окно игры целиком */
@media (max-width: 339px) {
  #promo-strip { display: none !important; }
}

/* Ширины до 1024px: строка «имя + уровень» складывается в столбик — в ряд она
   дотягивалась до баннера 320×50 в центре верхней полосы. Кольцо при этом
   опускается: столбик выше строки.
   min-height 621: на низких окнах (800×600, 1024×600) столбик наоборот упирался
   верхними ячейками панели оружия — там остаётся строка, а от баннера её
   спасает ограничение ширины ниже. */
@media (max-width: 1023px) and (min-height: 621px) {
  #top-left { flex-direction: column; align-items: flex-start; gap: 6px; }
  /* кольцу и панели своих правок не нужно: --hud-top считается по фактической
     высоте #top-left и опускает их ровно настолько, насколько вырос столбик */
}
/* Баннер стоит в центре верхней полосы — левый блок не имеет права до него
   дотянуться ни при каком имени предмета (самое длинное — «Сундук с
   сокровищами»). Ограничение только там, где баннер ИНЛАЙНОВЫЙ: на узких
   экранах он занимает свою полосу и HUD и так ниже. */
/* Ужимать сам контейнер нельзя: виджет уровня фиксированной ширины из него
   просто торчит. Поэтому при инлайновом баннере уменьшаем виджет и даём имени
   предмета ровно тот остаток, который есть до баннера. */
@media (min-width: 700px) and (max-width: 1199px) {
  html.promo-on #lvl-badge { width: 40px; height: 40px; }
  html.promo-on #lvl-num { font-size: 15px; }
  html.promo-on #lvl-label { font-size: 7px; }
  html.promo-on #xp-track { width: 102px; height: 16px; }
  html.promo-on #xp-text { font-size: 10px; }
  html.promo-on #obj-name { max-width: calc(50vw - 350px); }
}
/* Строка-тизер «Дальше: <орудие> · ур. N» шире полоски опыта и растягивала
   колонку уровня до баннера. Не прячем её (это цель, ради которой играют
   дальше), а укладываем в ширину полоски опыта в две строки мелким кеглем. */
@media (min-width: 700px) and (max-width: 1279px) and (min-height: 621px) {
  html.promo-on #next-wp {
    max-width: 102px; white-space: normal; font-size: 9.5px; line-height: 1.15;
  }
}
/* В низком окне вторая строка тизера упирала блок в панель оружия (она там
   начинается уже с 58px) — тизер убираем, роль «что дальше» играют силуэты
   закрытых ячеек с номерами уровней */
@media (min-width: 700px) and (max-width: 1279px) and (max-height: 620px) {
  html.promo-on #next-wp { display: none; }
}
/* В столбике имя стоит НАД виджетом и конкурирует только с краем баннера.
   min-width 700: ниже баннер уходит в свою полосу, и формула «полэкрана минус
   баннер» дала бы имени считанные пиксели (на 390px — 5px). */
@media (min-width: 700px) and (max-width: 1023px) and (min-height: 621px) {
  html.promo-on #obj-name { max-width: calc(50vw - 190px); }
}
/* Низкое и узкое окно: строка «имя + уровень» рядом с баннером не помещается
   даже с обрезкой — прячем имя (оно есть в списке предметов и в тосте при
   смене предмета), уровень важнее */
@media (min-width: 700px) and (max-width: 1023px) and (max-height: 620px) {
  html.promo-on #obj-name { display: none; }
}
/* Телефон в ландшафте (низкий И узкий): столбик «имя над уровнем» верхом упирался
   в панель оружия — она там занимает почти всю высоту. Возвращаем строку: место
   в центре полосы свободно, потому что баннер на такой ширине не показывается. */
@media (orientation: landscape) and (max-height: 470px) and (max-width: 900px) {
  #top-left { flex-direction: row; align-items: center; gap: 8px; }
  #obj-name { max-width: 22vw; }
}
/* ...а на коротких портретах панель оружия раньше поднималась до столбика имени —
   теперь её верх ограничен --hud-top, так что своей поправки ей не нужно */
@media (max-width: 500px) and (orientation: portrait) and (max-height: 720px) {
  /* панель ниже строки имени — центрированный тост ложился на её верхние ячейки
     (диапазон 431-500px не покрывался докингом ≤430) */
  #toast {
    left: auto; right: 12px; transform: none;
    bottom: 150px; max-width: min(60vw, 240px);
  }
  #toast.show { transform: translateY(-8px); }
}

/* Узкие экраны: баннер 320×50 не помещается в верхнюю полосу рядом с именем и
   кнопками — он занимает собственную полосу сверху, а весь верхний HUD едет
   вниз. Класс promo-on ставит контроллер баннера, и только когда площадка
   реально отдала баннер (без рекламы раскладка не дёргается). */
@media (max-width: 699px) {
  html.promo-on { --top-inset: 58px; }
}

/* Вырезы/индикатор iPhone: отступы от краёв не меньше safe-area */
@supports (padding: max(0px)) {
  :root { --wp-left: max(8px, env(safe-area-inset-left)); }
  #top-left {
    left: max(14px, env(safe-area-inset-left));
    top: calc(max(10px, env(safe-area-inset-top)) + var(--top-inset));
  }
  #top-right {
    right: max(12px, env(safe-area-inset-right));
    top: calc(max(10px, env(safe-area-inset-top)) + var(--top-inset));
  }
  #bottom-right { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  #btn-next { bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* Планшет в портрете (601-820px): центрированная «Далее» краем доставала до
   колонки кнопок справа-снизу — поднимаем её над ними. Блок стоит ПОСЛЕ
   @supports: тот задаёт #btn-next bottom и иначе перебил бы это правило. */
@media (min-width: 601px) and (max-width: 820px) and (orientation: portrait) {
  #btn-next { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 86px); }
  #toast { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 152px); }
}

/* Узкий портрет: центрированная «Далее» наезжала на кнопки справа-снизу —
   докуем её к правому краю выше кнопок */
@media (max-width: 430px) and (orientation: portrait) {
  /* виджет уровня шире старой пилюли монет — ужимаем, чтобы не цеплял
     кольцо прогресса по центру (на 360px зазор был отрицательный) */
  #lvl-badge { width: 36px; height: 36px; }
  #lvl-num { font-size: 13.5px; }
  #xp-track { width: 74px; height: 15px; }
  #xp-text { font-size: 10px; letter-spacing: 0; }
  #btn-next {
    left: auto; right: 12px; bottom: 88px;
    transform: none;
    animation-name: next-pulse-flat;
  }
  #btn-next:active { transform: translateY(3px); }
  /* тост по центру низа накрывал докованную «Далее» (победа: тост «+60 монет»
     и кнопка видимы одновременно) и панель оружия слева — докуем вправо выше кнопки */
  #toast {
    left: auto; right: 12px; transform: none;
    bottom: 150px; max-width: min(60vw, 240px);
  }
  #toast.show { transform: translateY(-8px); }
}

/* Короткий ландшафт: «Далее» цепляла нижний ряд панели оружия —
   уменьшаем и ставим между панелью и кнопками справа */
@media (orientation: landscape) and (max-height: 520px) {
  /* Кнопок в правом нижнем углу стало три (подарок/рестарт/предметы) — в ряд
     они съедали полосу, где живёт «Далее» (на Яндексе и Playgama панель оружия
     ещё и сдвинута на 70px под сайдбар). В этой раскладке ставим их столбиком. */
  #bottom-right { flex-direction: column; align-items: flex-end; gap: 8px; }
  #btn-next {
    left: auto;
    right: 80px;
    right: max(80px, calc(68px + env(safe-area-inset-right)));
    bottom: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    transform: none;
    animation-name: next-pulse-flat;
    font-size: 15px; padding: 9px 20px; min-height: 44px;
  }
  #btn-next:active { transform: translateY(2px); }
  /* между панелью оружия и колонкой кнопок остаётся ~100px: миниатюру
     следующего предмета в этой раскладке прячем, иначе «Далее» упирается в панель */
  #next-peek { display: none; }
  /* bottom:110 на высоте 320 — середина экрана, тост лез на текст победы;
     по центру цеплял панель оружия; bottom:84 — выше кнопки «Объекты» (верх ~74px) */
  #toast {
    left: auto; transform: none;
    right: 80px;
    right: max(80px, calc(68px + env(safe-area-inset-right)));
    bottom: 62px; max-width: 34vw;
    font-size: 14px; padding: 9px 18px;
  }
  #toast.show { transform: translateY(-8px); }
}

/* ============ Weapon unlock modal ============ */
/* важно: правила ПОСЛЕ «#hud > *» — скрытая модалка не должна ловить тапы */
#wp-modal {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  background: rgba(8,6,26,.62);
  /* рендер под модалкой заморожен (uiPaused) — blur по статичному кадру дёшев */
  backdrop-filter: blur(4px);
  /* без transition: opacity/visibility-транзишен на этом элементе замирал на
     стартовом значении (компоситор) — модалка «открывалась» невидимой;
     появление анимирует карточка (wpm-pop), фон включается мгновенно */
  opacity: 0; visibility: hidden; pointer-events: none;
}
#wp-modal.show { opacity: 1; visibility: visible; pointer-events: auto; }
.wpm-card {
  position: relative;
  width: min(340px, 92vw);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(56,50,118,.97), rgba(26,21,64,.98));
  border: 2px solid rgba(130,150,255,.35);
  box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 30px rgba(78,231,255,.15), inset 0 1px 0 rgba(255,255,255,.1);
  padding: 20px 20px 18px;
  text-align: center;
}
/* появление — вспышка обводки, НЕ transform: scale-анимация двигала геометрию
   кнопок, и при рассинхроне анимации hit-test ввода промахивался мимо крестика/CTA;
   box-shadow не влияет на hit-test даже у замёрзшей анимации */
#wp-modal.show .wpm-card { animation: wpm-glow .5s ease-out; }
@keyframes wpm-glow {
  0% { box-shadow: 0 0 0 3px rgba(94,242,255,.85), 0 0 34px rgba(94,242,255,.5), 0 10px 40px rgba(0,0,0,.5); }
  100% { box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 30px rgba(78,231,255,.15), inset 0 1px 0 rgba(255,255,255,.1); }
}
.wpm-icon {
  width: 92px; height: 92px; margin: 0 auto 10px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(38,84,128,.9), rgba(18,36,84,.9));
  border: 2px solid rgba(94,242,255,.4);
  box-shadow: 0 0 18px rgba(78,231,255,.25), inset 0 1px 0 rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
}
.wpm-icon svg { width: 72%; height: 72%; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.wpm-name {
  font-size: 21px; font-weight: 900; color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 2px 4px rgba(0,0,0,.4);
}
.wpm-req {
  font-size: 13.5px; font-weight: 900; color: #ffd23e;
  margin-bottom: 8px;
}
.wpm-desc {
  font-size: 14px; color: #c9d4ff; line-height: 1.4;
  margin-bottom: 16px;
}
.wpm-cta.waiting { filter: grayscale(.55); opacity: .75; }
.wpm-cta {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; min-height: 52px;
  padding: 11px 16px;
  border-radius: 28px;
  font-size: 16px; font-weight: 900; color: #3a2a06;
  background: linear-gradient(180deg, #ffd94e, #f0a820);
  border: 2px solid #fff;
  box-shadow: 0 4px 0 #b07908, 0 6px 14px rgba(0,0,0,.35);
  transition: transform .1s ease;
}
.wpm-cta:active { transform: translateY(3px); box-shadow: 0 1px 0 #b07908, 0 3px 7px rgba(0,0,0,.3); }
.wpm-cta svg { width: 26px; height: 26px; flex: none; }
.wpm-cta-ico { display: flex; align-items: center; flex: none; }
.wpm-cta span { line-height: 1.15; }
.wpm-close {
  position: absolute; top: 8px; right: 8px;
  width: 44px; height: 44px; border-radius: 50%; /* touch target ≥44px */
  background: rgba(16,12,42,.6);
  border: 1.5px solid rgba(130,150,255,.35);
  color: #dfe8ff; font-size: 16px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.wpm-close:active { transform: scale(.92); }
/* короткие экраны (ландшафт телефона): карточка компактнее, чтобы влезть в 320px */
@media (max-height: 520px) {
  .wpm-card { padding: 12px 16px 12px; width: min(320px, 92vw); }
  .wpm-icon { width: 60px; height: 60px; margin-bottom: 6px; }
  .wpm-name { font-size: 17px; margin-bottom: 4px; }
  .wpm-desc { font-size: 12.5px; margin-bottom: 10px; }
  .wpm-cta { min-height: 44px; font-size: 14px; }
}

/* ============ Прогрессия: тизер следующего орудия ============ */
#lvl-col { display: flex; flex-direction: column; gap: 3px; }
#next-wp {
  font-size: 10.5px; font-weight: 800; color: #9fb4ff;
  text-shadow: 0 1px 3px rgba(0,0,0,.65);
  max-width: 44vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: none !important;
}
#next-wp.teaser { color: #ffd23e; }
/* на телефонах строка-тизер расширяла колонку уровня до кольца прогресса —
   там роль тизера играют силуэты закрытых ячеек с номерами уровней */
@media (max-height: 560px), (max-width: 600px) and (orientation: portrait) {
  #next-wp { display: none; }
}
/* Узкие окна (<700px), где тизер ещё виден: он не имеет права расширять колонку
   уровня — иначе строка «имя + уровень» дотягивается до кнопок справа (нашёл
   плотный свип на 608×600). Укладываем его в ширину полоски опыта, в две строки. */
@media (max-width: 699px) {
  #next-wp { max-width: 102px; white-space: normal; font-size: 9.5px; line-height: 1.15; }
}

/* ============ Бонусы из наград дня (опыт / перезарядка) ============ */
/* живут под кольцом прогресса: кольцо докуется по раскладкам само, и чипы
   переезжают вместе с ним, не расширяя колонку имени/уровня */
/* чипы бонусов выравнены по ЛЕВОМУ краю кольца: центрированные они выходили
   бы за него в обе стороны и цепляли панель оружия слева */
#chips {
  position: absolute; top: calc(var(--ring) + 2px); left: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  pointer-events: none !important;
}
#boost-chip, #cd-chip, #pow-chip, #help-chip {
  display: none; align-items: center; gap: 5px;
  border: 1.5px solid #fff; border-radius: 16px;
  padding: 3px 10px 3px 6px;
  font-size: 12px; font-weight: 900; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  pointer-events: none !important;
}
#boost-chip {
  background: linear-gradient(180deg, rgba(255,217,78,.96), rgba(240,168,32,.96));
  color: #3a2a06;
  box-shadow: 0 2px 8px rgba(0,0,0,.35), 0 0 14px rgba(255,210,62,.4);
}
#cd-chip {
  background: linear-gradient(180deg, rgba(94,242,255,.96), rgba(46,150,220,.96));
  color: #04283a;
  box-shadow: 0 2px 8px rgba(0,0,0,.35), 0 0 14px rgba(94,242,255,.45);
}
#pow-chip {
  background: linear-gradient(180deg, rgba(255,140,70,.96), rgba(224,80,40,.96));
  color: #2e0f04;
  box-shadow: 0 2px 8px rgba(0,0,0,.35), 0 0 14px rgba(255,130,60,.45);
}
#help-chip {
  background: linear-gradient(180deg, rgba(180,150,255,.96), rgba(120,90,232,.96));
  color: #150a33;
  box-shadow: 0 2px 8px rgba(0,0,0,.35), 0 0 14px rgba(160,120,255,.45);
}
#boost-chip.show, #cd-chip.show, #pow-chip.show, #help-chip.show { display: flex; }
#boost-chip svg, #cd-chip svg, #pow-chip svg, #help-chip svg { width: 16px; height: 16px; }

/* в ландшафте телефона кольцо доковано к правому краю, а слева от него —
   панель оружия: чипы бонусов ужимаем, чтобы не задевать её */
@media (max-height: 520px) {
  #boost-chip, #cd-chip, #pow-chip, #help-chip { font-size: 10.5px; padding: 2px 8px 2px 5px; }
  #boost-chip svg, #cd-chip svg, #pow-chip svg, #help-chip svg { width: 14px; height: 14px; }
}

/* ============ Кнопка «Бонусы» (усилители + фоны арены) ============ */
/* Своя, узнаваемая кнопка рядом с подарком: тот же объём и посадка, что у
   остальных круглых кнопок HUD, но фирменная неоновая заливка cyan→magenta,
   чтобы «магазин бонусов» читался с первого взгляда. */
#btn-boosts {
  position: relative;
  width: 52px; height: 52px; border-radius: 50%;
  background:
    radial-gradient(120% 100% at 30% 20%, rgba(94,242,255,.42), rgba(94,242,255,0) 55%),
    radial-gradient(120% 100% at 78% 82%, rgba(255,94,207,.42), rgba(255,94,207,0) 55%),
    linear-gradient(180deg, rgba(72,60,146,.96), rgba(36,28,86,.97));
  border: 2px solid rgba(94,242,255,.6);
  box-shadow:
    0 3px 0 rgba(10,8,30,.85), 0 5px 12px rgba(0,0,0,.4),
    0 0 16px rgba(120,150,255,.35), inset 0 1px 0 rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s ease;
}
#btn-boosts svg { width: 30px; height: 30px; filter: drop-shadow(0 0 5px rgba(94,242,255,.55)); }
#btn-boosts:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(10,8,30,.85), 0 3px 6px rgba(0,0,0,.35); }
#btn-boosts .dot {
  display: none; position: absolute; top: -2px; right: -2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #5ef2ff; border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(94,242,255,.9);
}
/* ролик снова доступен — кнопка мягко «дышит» свечением (без scale: рядом уже
   прыгает подарок, две скачущие кнопки в углу — это рябь) */
#btn-boosts.ready .dot { display: block; }
#btn-boosts.ready { animation: boosts-glow 2.2s ease-in-out infinite; }
@keyframes boosts-glow {
  0%, 100% { box-shadow: 0 3px 0 rgba(10,8,30,.85), 0 5px 12px rgba(0,0,0,.4), 0 0 14px rgba(94,242,255,.3), inset 0 1px 0 rgba(255,255,255,.16); }
  50% { box-shadow: 0 3px 0 rgba(10,8,30,.85), 0 5px 12px rgba(0,0,0,.4), 0 0 26px rgba(94,242,255,.75), inset 0 1px 0 rgba(255,255,255,.16); }
}

/* ============ Кнопка награды дня ============ */
#btn-daily { position: relative; }
#btn-daily svg { width: 30px; height: 30px; }
#btn-daily .dot {
  display: none; position: absolute; top: -2px; right: -2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #ff4d6d; border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(255,77,109,.8);
}
#btn-daily.ready .dot { display: block; }
#btn-daily.ready { animation: gift-pulse 1.7s ease-in-out infinite; }
@keyframes gift-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.09); } }

/* ============ Аккаунт CrazyGames ============ */
#btn-account.signed {
  width: auto; min-width: 52px; border-radius: 26px;
  padding: 0 10px; gap: 7px;
}
#btn-account img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.acc-name {
  font-size: 12px; font-weight: 800; color: #dfe8ff;
  max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Ник рядом с аватаром растягивает верхний правый ряд НА НЕИЗВЕСТНУЮ ширину
   (именно из-за этого на Safari ряд наезжал на кольцо). Оставляем его только
   там, где даже с ником ряд не дотянется до баннера в центре полосы. */
@media (max-width: 1100px) { .acc-name { display: none; } }
/* телефон в портрете: три круглые кнопки в ряд не помещаются рядом с кольцом —
   ставим их столбиком у правого края */
@media (max-width: 600px) and (orientation: portrait) {
  #top-right { flex-direction: column; }
  /* имя стоит отдельной строкой над уровнем, справа — только колонка кнопок:
     30vw обрезали даже «Сундук с сокровищами», хотя место было */
  #obj-name { max-width: calc(100vw - 120px); }
}
/* ...но в НИЗКОМ портретном окне (320×480 и подобные) строка не складывается в
   столбик, и имя делит её с виджетом уровня — оставляем ему ровно остаток до
   колонки кнопок, иначе длинное имя наезжает на них (нашёл плотный свип). */
@media (max-width: 600px) and (orientation: portrait) and (max-height: 620px) {
  #obj-name { max-width: calc(100vw - 232px); }
}

/* ============ Level-up: карточка нового орудия ============ */
/* карточка орудия — отдельной строкой ПОД «УРОВЕНЬ N!» (inline-flex встал бы
   рядом с текстом и на узких экранах уехал за край) */
#lvlup-wp {
  display: none; align-items: center; justify-content: center; gap: 11px;
  margin-top: 10px;
}
#lvlup-wp.show { display: flex; }
#lvlup-wp .lw-icon {
  width: 54px; height: 54px; border-radius: 14px; flex: none;
  background: linear-gradient(160deg, rgba(38,84,128,.96), rgba(18,36,84,.96));
  border: 2px solid rgba(94,242,255,.65);
  box-shadow: 0 0 18px rgba(78,231,255,.5);
  display: flex; align-items: center; justify-content: center;
}
#lvlup-wp .lw-icon svg { width: 78%; height: 78%; }
#lvlup-wp .lw-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
#lvlup-wp .lw-txt b { font-size: 12.5px; font-weight: 900; color: #7defff; letter-spacing: 1.2px; }
#lvlup-wp .lw-txt i {
  font-size: 19px; font-weight: 900; color: #fff; font-style: normal;
  text-shadow: 0 2px 4px rgba(0,0,0,.55);
}
/* карточка орудия и победный баннер никогда не показываются вместе (HUD.levelUp
   при видимом «РАЗГРОМЛЕНО!» уходит в тост) — зона 19% остаётся свободной.
   На низких экранах баннер уровня всё равно ужимаем: там до кольца прогресса
   сверху и до победного текста снизу остаётся считанные десятки пикселей. */
@media (max-height: 560px) {
  #lvlup-text { font-size: clamp(16px, 4.6vw, 30px); }
  #lvlup-wp { margin-top: 6px; gap: 8px; }
  #lvlup-wp .lw-icon { width: 38px; height: 38px; }
  #lvlup-wp .lw-txt b { font-size: 10px; }
  #lvlup-wp .lw-txt i { font-size: 14px; }
}
/* ландшафт телефона: кольцо прогресса докуется вправо — баннер уровня
   центрируем в свободной полосе слева от него и поднимаем выше победного текста */
@media (orientation: landscape) and (max-height: 520px) {
  #lvlup-note { top: 10%; right: 190px; }
}
/* короткий портрет (сплит-скрин): под кольцом до победного текста ~45px */
@media (orientation: portrait) and (max-height: 620px) {
  #lvlup-text { font-size: clamp(15px, 4.2vw, 24px); }
}
/* совсем низкие окна: карточка орудия ужимается */
@media (max-height: 460px) {
  #lvlup-note.with-wp #lvlup-text { font-size: clamp(16px, 4vw, 26px); }
  #lvlup-wp { margin-top: 4px; gap: 7px; }
  #lvlup-wp .lw-icon { width: 32px; height: 32px; }
  #lvlup-wp .lw-txt b { font-size: 9px; letter-spacing: .6px; }
  #lvlup-wp .lw-txt i { font-size: 12px; }
}

/* ============ Силуэт следующего предмета на кнопке «Далее» ============ */
#btn-next { display: inline-flex; align-items: center; gap: 10px; }
#next-peek {
  display: none; flex: none; width: 30px; height: 30px;
  border-radius: 8px; background: rgba(255,255,255,.24);
  align-items: center; justify-content: center; overflow: hidden;
}
#next-peek.show { display: flex; }
#next-peek img { width: 100%; height: 100%; object-fit: contain; }
#next-peek.shadowed img { filter: brightness(0) saturate(0); opacity: .92; }

/* ============ Тень неразрушенного предмета в списке ============ */
.obj-card.shadowed .obj-thumb { background: radial-gradient(circle at 50% 38%, #3d3486, #1d1748); }
.obj-card.shadowed .obj-thumb img { filter: brightness(0) saturate(0); opacity: .93; }
.obj-card.shadowed .obj-title { color: #8f9ddb; letter-spacing: 2px; }
.obj-card.shadowed::after {
  content: '?'; position: absolute; right: 9px; top: 6px;
  font-size: 15px; font-weight: 900; color: rgba(159,180,255,.5);
}
/* предмет только что разрушен — карточка «проявляется» вспышкой */
.obj-card.revealed .obj-thumb { animation: card-reveal .9s ease-out; }
@keyframes card-reveal {
  0% { filter: brightness(3.2); transform: scale(.88); }
  60% { filter: brightness(1.4); transform: scale(1.06); }
  100% { filter: none; transform: scale(1); }
}
/* ============ Закрытые категории предметов (награды 4-го и 6-го дня) ============ */
.cat-header.locked { color: #9fb4ff; }
.cat-lock {
  font-size: 12px; font-weight: 900; color: #ffd23e;
  background: rgba(16,12,42,.7);
  border: 1px solid rgba(255,210,62,.45);
  border-radius: 14px; padding: 3px 10px;
  white-space: nowrap;
}
.obj-card.cat-locked { opacity: .72; }
.obj-card.cat-locked .obj-thumb img { filter: brightness(0) saturate(0); opacity: .55; }
.obj-lock {
  position: absolute; right: 6px; bottom: 6px;
  width: 26px; height: 26px; border-radius: 8px;
  background: rgba(16,12,42,.85);
  border: 1.5px solid rgba(255,210,62,.6);
  display: flex; align-items: center; justify-content: center;
}
/* CSS перебивает presentation-атрибуты SVG: базовый замок коричневый и на
   тёмном бейдже читался бы как пятно */
.obj-lock svg { width: 16px; height: 16px; }
.obj-lock svg rect, .obj-lock svg path { fill: #ffd23e; stroke: #ffd23e; }

.sel-coll {
  display: flex; align-items: center;
  background: rgba(16,12,42,.6); border: 1px solid rgba(130,150,255,.24);
  border-radius: 22px; padding: 7px 14px;
  color: #e6ebff; font-weight: 800; font-size: 14px; white-space: nowrap;
}

/* ============ Баннерный слот геймплея ============ */
/* Единственный баннер игры — 320×50 сверху по центру (требование ревьюера
   CrazyGames). Контейнер ПОЛНОСТЬЮ ПРОЗРАЧНЫЙ: своей подложки, рамки и тени у
   него нет. Ревьюер отдельно попросил убрать «кастомный чёрный контейнер» —
   если на баннер нет спроса, игрок не должен видеть пустую тёмную плашку.
   pointer-events нужны — клик по рекламе обязан доходить до iframe площадки. */
.promo-slot {
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex: none;
  background: transparent; border: none; box-shadow: none;
}
#promo-strip {
  position: absolute;
  top: 6px; left: 50%; transform: translateX(-50%);
  width: 320px; height: 50px;
  display: none;
}
#promo-strip.on { display: flex; }
@supports (padding: max(0px)) {
  #promo-strip { top: max(6px, env(safe-area-inset-top)); }
}

/* ============ Хаб наград: вкладки ============ */
/* Все rewarded-предложения живут на одном неигровом экране (требование
   площадки — кнопки роликов не в геймплее): календарь, усилители и фоны. */
.hub-tabs {
  display: flex; gap: 6px; margin: 0 44px 12px 0;
}
.hub-tab {
  flex: 1; min-height: 42px; padding: 7px 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 14px;
  font-size: 13px; font-weight: 900; color: #b9c6ff;
  background: rgba(16,12,42,.5);
  border: 1.5px solid rgba(130,150,255,.22);
}
.hub-tab svg { width: 18px; height: 18px; flex: none; }
.hub-tab.on {
  color: #fff;
  background: linear-gradient(180deg, rgba(78,120,240,.65), rgba(46,64,160,.65));
  border-color: #4ee7ff;
  box-shadow: 0 0 14px rgba(78,231,255,.28);
}
.hub-pane { display: none; }
.hub-pane.on { display: block; }
.hub-title {
  font-size: 21px; font-weight: 900; color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,.45);
}
.hub-sub { margin-top: 4px; font-size: 12.5px; font-weight: 700; color: #9fb4ff; }
.hub-noads {
  display: none;
  margin-top: 10px; font-size: 12px; font-weight: 800; color: #ffb0b0;
}
.hub-noads.on { display: block; }

/* ---------- карточки усилителей ---------- */
.boost-grid { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.boost-card {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 9px 10px; border-radius: 16px;
  background: linear-gradient(165deg, rgba(46,40,102,.95), rgba(24,19,60,.96));
  border: 2px solid rgba(130,150,255,.25);
}
.boost-card.active { border-color: #7dffab; box-shadow: 0 0 16px rgba(125,255,171,.28); }
.b-icon { width: 38px; height: 38px; flex: none; }
.b-icon svg { width: 100%; height: 100%; }
.b-body { flex: 1; min-width: 0; }
.b-name { font-size: 14.5px; font-weight: 900; color: #fff; }
.b-desc { font-size: 11.5px; font-weight: 700; color: #9fb4ff; line-height: 1.2; }
.b-cta {
  flex: none; min-height: 44px; padding: 8px 14px;
  display: flex; align-items: center; gap: 7px;
  border-radius: 22px; font-size: 13px; font-weight: 900; color: #3a2a06;
  background: linear-gradient(180deg, #ffd94e, #f0a820);
  border: 2px solid #fff;
  box-shadow: 0 4px 0 #b07908, 0 6px 14px rgba(0,0,0,.35);
  max-width: 46%;
}
.b-cta:active { transform: translateY(3px); box-shadow: 0 1px 0 #b07908; }
.b-cta.waiting { filter: grayscale(.55); opacity: .75; }
.b-cta svg { width: 20px; height: 20px; flex: none; }
.b-cta-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- карточки фонов ---------- */
.theme-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px;
}
.theme-card {
  padding: 6px 6px 8px; border-radius: 16px;
  background: linear-gradient(165deg, rgba(46,40,102,.95), rgba(24,19,60,.96));
  border: 2px solid rgba(130,150,255,.25);
  display: flex; flex-direction: column; gap: 5px;
}
.theme-card.current { border-color: #4ee7ff; box-shadow: 0 0 16px rgba(78,231,255,.32); }
.t-prev {
  position: relative;
  height: 62px; border-radius: 11px;
  border: 1px solid rgba(255,255,255,.16);
  overflow: hidden;
}
/* неоновое кольцо арены в превью — цвет приходит из палитры темы (--t-ring) */
.t-prev::after {
  content: '';
  position: absolute; left: 17%; right: 17%; bottom: 14%;
  height: 38%; border-radius: 50%;
  border: 2px solid var(--t-ring, #4ee7ff);
  box-shadow: 0 0 9px var(--t-ring, #4ee7ff);
  opacity: .9;
}
.t-lock {
  display: none;
  position: absolute; inset: 0; border-radius: 10px;
  background: rgba(8,6,26,.55);
  align-items: center; justify-content: center;
  z-index: 1; /* поверх кольца арены (::after рисуется последним) */
}
.t-lock svg { width: 28px; height: 28px; }
/* базовая иконка замка коричневая — на тёмном превью перекрашиваем в золото */
.t-lock svg rect, .t-lock svg path { fill: #ffd23e; stroke: #ffd23e; }
.theme-card.locked .t-lock { display: flex; }
.t-name { font-size: 12.5px; font-weight: 900; color: #fff; }
.t-cta { font-size: 11px; font-weight: 800; color: #9fb4ff; line-height: 1.15; }
.theme-card.current .t-cta { color: #7df2ff; }
.theme-card.locked .t-cta { color: #ffd23e; }
.theme-card:disabled { opacity: .6; }
@media (max-height: 560px) {
  .hub-tabs { margin-bottom: 8px; }
  .hub-tab { min-height: 38px; font-size: 12px; }
  .hub-title { font-size: 17px; }
  .boost-grid, .theme-grid { gap: 6px; margin: 8px 0 2px; }
  .boost-card { padding: 6px 8px; gap: 8px; }
  .b-icon { width: 30px; height: 30px; }
  .b-name { font-size: 13px; }
  .b-desc { font-size: 10.5px; }
  .b-cta { min-height: 38px; font-size: 12px; padding: 6px 10px; }
  .t-prev { height: 46px; }
}
/* ландшафт телефона: заголовок и подпись съедали место, из-за них четвёртый
   усилитель уезжал под фолд — на 320px высоты все карточки должны быть видны */
@media (max-height: 400px) {
  .hub-title, .hub-sub { display: none; }
  .boost-card { padding: 5px 8px; }
  .b-icon { width: 26px; height: 26px; }
  .b-cta { min-height: 40px; padding: 5px 10px; }
  .boost-grid { margin: 6px 0 2px; }
  .t-prev { height: 38px; }
}
@media (max-width: 420px) {
  .hub-tab span { display: none; }
  .hub-tab svg { width: 22px; height: 22px; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ Награда дня ============ */
/* Экраны-оверлеи выше баннеров HUD: у «УРОВЕНЬ N!» свой z-index 6, и без
   этого он рисовался поверх открытой карточки экрана */
#select-screen, #daily-screen, #boosts-screen { z-index: 10; }

#daily-screen, #boosts-screen {
  background: rgba(10,8,30,.86);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
}
.hub-card {
  position: relative;
  width: min(560px, 96vw);
  max-height: 100%;
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  scrollbar-width: none;
  border-radius: 24px;
  background: linear-gradient(165deg, rgba(56,50,118,.97), rgba(26,21,64,.98));
  border: 2px solid rgba(130,150,255,.35);
  box-shadow: 0 12px 44px rgba(0,0,0,.55), 0 0 30px rgba(78,231,255,.15);
  padding: 18px 16px 16px;
  text-align: center;
}
.hub-card::-webkit-scrollbar { display: none; }
.daily-title {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 24px; font-weight: 900; color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,.45);
}
.daily-title svg { width: 30px; height: 30px; }
.daily-hello { margin-top: 5px; font-size: 14px; font-weight: 800; color: #9fb4ff; }
.daily-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 12px; }
.d-cell {
  position: relative;
  border-radius: 14px; padding: 8px 4px 9px; min-height: 104px;
  background: linear-gradient(165deg, rgba(46,40,102,.95), rgba(24,19,60,.96));
  border: 2px solid rgba(130,150,255,.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.d-day { font-size: 11px; font-weight: 900; color: #9fb4ff; letter-spacing: .4px; }
.d-icon { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; }
.d-icon svg { width: 100%; height: 100%; }
.d-label { font-size: 11.5px; font-weight: 800; color: #e6ebff; line-height: 1.15; padding: 0 2px; }
.d-grand { font-size: 11px; font-weight: 900; color: #ffd23e; letter-spacing: 1.2px; }
.d-cell.grand {
  grid-column: span 3; flex-direction: row; justify-content: center; gap: 14px; min-height: 92px;
  background: linear-gradient(150deg, rgba(122,74,26,.95), rgba(62,36,92,.96));
  border-color: rgba(255,210,62,.75);
  box-shadow: 0 0 22px rgba(255,200,60,.35), inset 0 1px 0 rgba(255,255,255,.12);
}
.d-cell.grand .d-icon { width: 62px; height: 62px; }
.d-cell.grand .d-label { font-size: 16px; color: #fff; }
.d-cell.grand .d-day { color: #ffe08a; }
.d-cell.today {
  border-color: #4ee7ff;
  animation: today-pulse 1.9s ease-in-out infinite;
}
@keyframes today-pulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(78,231,255,.3), 0 0 14px rgba(78,231,255,.3); }
  50% { box-shadow: 0 0 0 3px rgba(78,231,255,.6), 0 0 26px rgba(78,231,255,.6); }
}
.d-cell.future { opacity: .8; }
.d-cell.claimed { opacity: .55; }
.d-check {
  position: absolute; inset: 0; border-radius: 12px;
  background: rgba(8,6,26,.5);
  display: flex; align-items: center; justify-content: center;
}
.d-check svg { width: 38px; height: 38px; }
.daily-actions { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.daily-cta {
  min-width: min(280px, 84%); min-height: 52px; padding: 12px 28px;
  border-radius: 28px; font-size: 19px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #35c6ee, #4a7df0 55%, #a44de8);
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 5px 0 #1c2a72, 0 8px 16px rgba(0,0,0,.4);
  text-shadow: 0 2px 3px rgba(0,0,0,.3);
}
.daily-cta:active { transform: translateY(3px); box-shadow: 0 2px 0 #1c2a72; }
.daily-cta.done {
  background: linear-gradient(135deg, #4a4a72, #33334f);
  box-shadow: 0 5px 0 #22223a, 0 8px 16px rgba(0,0,0,.35);
  color: #cfd8ff;
}
.daily-hint { margin-top: 10px; font-size: 12px; color: #9fb4ff; font-weight: 700; }
.hub-close {
  position: absolute; top: 8px; right: 8px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(16,12,42,.6);
  border: 1.5px solid rgba(130,150,255,.35);
  color: #dfe8ff; font-size: 16px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.hub-close:active { transform: scale(.92); }
/* короткие экраны (ландшафт телефона): календарь ужимается, чтобы влезть в 320px */
@media (max-height: 560px) {
  .hub-card { padding: 12px 12px 12px; }
  .daily-title { font-size: 18px; }
  .daily-title svg { width: 22px; height: 22px; }
  .daily-grid { gap: 6px; margin: 10px 0 9px; }
  .d-cell { min-height: 74px; padding: 6px 3px; }
  .d-icon { width: 28px; height: 28px; }
  .d-label { font-size: 10px; }
  .d-day { font-size: 10px; }
  .d-cell.grand { min-height: 66px; }
  .d-cell.grand .d-icon { width: 42px; height: 42px; }
  .d-cell.grand .d-label { font-size: 13px; }
  .daily-cta { min-height: 44px; font-size: 16px; padding: 9px 22px; }
  .daily-hint { margin-top: 6px; font-size: 11px; }
}
/* очень низкие окна (ландшафт телефона 320-460px): календарь в одну строку,
   кнопки рядом — «Забрать» обязана быть видна без прокрутки карточки */
@media (max-height: 460px) {
  .daily-grid { grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 8px 0; }
  .d-cell { min-height: 64px; padding: 4px 2px; gap: 1px; }
  .d-cell.grand { grid-column: span 1; flex-direction: column; min-height: 64px; }
  .d-cell.grand .d-icon { width: 26px; height: 26px; }
  .d-cell.grand .d-label { font-size: 9px; }
  .d-icon { width: 24px; height: 24px; }
  .d-label { font-size: 9px; line-height: 1.05; }
  .d-day { font-size: 9px; }
  .d-check svg { width: 26px; height: 26px; }
  .d-grand, .daily-hello, .daily-hint { display: none; }
  .daily-actions { flex-direction: row; gap: 8px; }
  .daily-cta { min-width: 0; flex: 1; }
}

/* ============ Mobile portrait: bottom weapon bar ============ */
/* Телефоны в портрете: вместо вертикальной сетки слева — горизонтальная лента
   снизу во всю ширину с нативным скроллом. Аффордансы скролла: обрезанная
   крайняя ячейка, затемняющие фейды по краям и пульсирующий шеврон.
   ВАЖНО: блок стоит В КОНЦЕ файла — переопределяет по порядку каскада все
   ранние медиаправила панели (left:max(...), --wp-base).
   ГЕЙТ ПО УСТРОЙСТВУ (System Info площадки): лента — телефонная раскладка.
   Десктоп (в том числе Chromebook и ноутбук с узким окном) остаётся на боковой
   сетке, как на Windows: `html:not([data-device="desktop"])` перед каждым
   правилом. Класс устройства ставит main.js, и «desktop» он выдаёт только при
   наличии точного указателя — телефон эту раскладку не получит даже если
   площадка ошибётся в System Info. */
@media (orientation: portrait) and (max-width: 600px) {
  html:not([data-device="desktop"]) {
    /* панель уехала вниз — кольцо прогресса встаёт к левому краю */
    --panel-right: 0px;
    --wpb-cell: 58px;
    /* полная высота ленты: ячейка + вертикальные паддинги + жестовая зона iPhone */
    --wpb-h: calc(var(--wpb-cell) + 16px + env(safe-area-inset-bottom, 0px));
  }
  html:not([data-device="desktop"]) #wp-panel {
    left: 0; right: 0; top: auto; bottom: 0; transform: none;
    display: flex; flex-direction: row; align-items: center;
    gap: 8px;
    max-height: none;
    padding: 8px max(12px, env(safe-area-inset-right))
             calc(8px + env(safe-area-inset-bottom, 0px))
             max(12px, env(safe-area-inset-left));
    overflow-x: auto; overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    /* мягкая доводка к границе ячейки — в кадре не остаётся «полусрезанной» первой ячейки */
    scroll-snap-type: x proximity;
    scroll-padding-left: max(12px, env(safe-area-inset-left));
    background: linear-gradient(180deg, rgba(12,9,37,0) 0%, rgba(12,9,37,.88) 38%, rgba(10,8,32,.94) 100%);
  }
  html:not([data-device="desktop"]) .wp-cell {
    flex: none;
    width: var(--wpb-cell); height: var(--wpb-cell);
    touch-action: pan-x; /* горизонтальный свайп по ячейкам двигает ленту */
    scroll-snap-align: start;
  }
  /* --- фейды по краям: намекают, что за краем есть ещё ячейки --- */
  html:not([data-device="desktop"]) .wp-fade {
    display: flex; align-items: center;
    position: absolute; bottom: 0;
    width: 54px; height: var(--wpb-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    pointer-events: none !important;
    opacity: 0; transition: opacity .25s;
    z-index: 5;
  }
  html:not([data-device="desktop"]) #wp-fade-l {
    left: 0; justify-content: flex-start;
    background: linear-gradient(90deg, rgba(10,8,32,.92) 0%, rgba(12,9,37,0) 100%);
  }
  html:not([data-device="desktop"]) #wp-fade-r {
    right: 0; justify-content: flex-end;
    background: linear-gradient(270deg, rgba(10,8,32,.92) 0%, rgba(12,9,37,0) 100%);
  }
  #hud.wp-can-l #wp-fade-l, #hud.wp-can-r #wp-fade-r { opacity: 1; }
  html:not([data-device="desktop"]) .wp-fade svg {
    width: 22px; height: 22px; margin: 0 3px;
    filter: drop-shadow(0 0 6px rgba(78,231,255,.8));
  }
  /* шеврон подталкивает взгляд в сторону скрытых ячеек (элемент некликабельный —
     transform-анимация без fill безопасна для hit-test) */
  html:not([data-device="desktop"]) #wp-fade-r svg { animation: wpb-nudge-r 1.3s ease-in-out infinite; }
  html:not([data-device="desktop"]) #wp-fade-l svg { animation: wpb-nudge-l 1.3s ease-in-out infinite; }
  @keyframes wpb-nudge-r { 0%,100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
  /* scaleX(-1) зеркалит общий шеврон влево; translateX внутри флипа тоже зеркалится */
  @keyframes wpb-nudge-l { 0%,100% { transform: scaleX(-1) translateX(0); } 50% { transform: scaleX(-1) translateX(4px); } }

  /* --- нижний UI приподнимается над лентой --- */
  html:not([data-device="desktop"]) #bottom-right { bottom: calc(var(--wpb-h) + 8px); }
  /* «Далее»: справа над кнопкой «Объекты» (по центру пересекалась бы с колонкой кнопок) */
  html:not([data-device="desktop"]) #btn-next {
    left: auto; right: 12px;
    bottom: calc(var(--wpb-h) + 82px);
    transform: none;
    animation-name: next-pulse-flat;
    font-size: 18px; padding: 12px 34px; min-height: 44px;
  }
  html:not([data-device="desktop"]) #btn-next:active { transform: translateY(3px); }
  /* тост — над «Далее», чтобы на победе не накрывал ни её, ни ленту */
  html:not([data-device="desktop"]) #toast {
    left: auto; right: 12px; transform: none;
    bottom: calc(var(--wpb-h) + 142px);
    max-width: min(60vw, 240px);
  }
  html:not([data-device="desktop"]) #toast.show { transform: translateY(-8px); }
}
