* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; }

/* CRT-сканлайны поверх всего */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
  /* без mix-blend-mode: смешивание поверх всего экрана iPhone пересчитывал на каждом кадре прокрутки */
}

/* ---- Дев-панель (видна только вне Telegram) ---- */
.devbar {
  height: 44px;
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  overflow-x: auto;
}
.devbar .logo { font-family: var(--font-pixel); font-size: 10px; color: var(--acid); margin-right: 10px; white-space: nowrap; }
.devbar .tab {
  border: 0; background: transparent; color: var(--text-dim);
  padding: 7px 12px; border-radius: 99px; cursor: pointer; white-space: nowrap; font-size: 13px;
}
.devbar .tab.active { background: var(--surface-2); color: var(--text); }
.devbar .spacer { flex: 1; }
.devbar .note { font-size: 12px; color: var(--text-mute); white-space: nowrap; }
body.in-telegram .devbar { display: none; }

/* ---- Колонка приложения (ширина телефона) ---- */
.app {
  position: relative;
  height: calc(100dvh - 44px);
  max-width: 440px;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(120% 60% at 50% 38%, #2a1550 0%, #150d2a 45%, var(--bg) 80%);
}
body.in-telegram .app { height: 100dvh; }
@media (min-width: 700px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); box-shadow: 0 0 80px rgba(0, 0, 0, 0.6); }
}
.app.wide { max-width: 1240px; background: var(--bg); overflow-y: auto; }
.app.shake { animation: screen-shake 0.45s linear; }
@keyframes screen-shake {
  10%, 50%, 90% { transform: translate(-6px, 3px); }
  30%, 70% { transform: translate(6px, -3px); }
}
.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: flex; flex-direction: column; }
.app.wide .screen { position: static; }

/* ---- Кнопки ---- */
.btn {
  border: 0; cursor: pointer;
  padding: 14px 20px;
  border-radius: 12px;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  letter-spacing: 0.01em;
  transition: transform 0.1s, filter 0.2s;
}
.btn:active { transform: translateY(2px); }
.btn.primary { background: var(--acid); color: var(--acid-ink); box-shadow: 0 4px 0 #7fa800, 0 0 24px rgba(200, 255, 46, 0.25); }
.btn.ghost { background: var(--surface-2); color: var(--text); box-shadow: 0 4px 0 #15121f; }
.btn.danger { background: var(--mogged); color: #fff; box-shadow: 0 4px 0 #8f1010, 0 0 22px rgba(255, 43, 43, 0.3); } /* необратимое: удалить (0112) */
.btn.small { padding: 9px 14px; font-size: 12px; }
/* «Ещё пачка» (features/0026): монет хватает — золотая, не хватает — приглушена */
/* features/0029: обычная пачка — бирюзовая, как её обёртка; золотая — золото */
.btn.buy { background: linear-gradient(#8ff8ff, #2fc6e0); color: #062a33; box-shadow: 0 4px 0 #1a8aa0, 0 0 22px rgba(61, 242, 255, 0.35); }
.btn.buy small { color: rgba(6, 42, 51, 0.7); }
.btn.gold { background: linear-gradient(#ffe27a, #f2b300); color: #2b1b00; box-shadow: 0 4px 0 #a86a00, 0 0 22px rgba(255, 210, 58, 0.35); }
.btn.gold small { color: rgba(43, 27, 0, 0.7); }
.btn.ghost:disabled { opacity: 0.5; cursor: default; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; padding: 0; line-height: 1; /* круг не сжимается, когда шапке тесно */
  border: 1px solid var(--line); background: rgba(27, 23, 41, 0.7);
  display: grid; place-items: center; cursor: pointer; font-size: 16px;
}

/* ---- Экран пачки ---- */
.pack-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 0;
  position: relative; z-index: 5;
}
.pill {
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; /* в тесной шапке ужимается только надпись */
  font-family: var(--font-pixel); font-size: 9px; color: var(--text-dim);
  padding: 9px 10px; border-radius: 99px; background: rgba(27, 23, 41, 0.75); border: 1px solid var(--line);
}
.pill b { color: var(--acid); font-weight: 400; }
.top-btns { display: flex; gap: 6px; flex-shrink: 0; }
/* Язык (0111): флаг текущего языка на сцене пачки, слева — напротив 🎯 */
.icon-btn.lang-btn { position: absolute; top: 18px; left: 12px; z-index: 8; width: 46px; height: 46px; font-size: 22px; }
.stage.summary-on .lang-btn { display: none; }
.icon-btn.lang-btn::after { content: attr(data-code); position: absolute; right: -4px; bottom: -3px; padding: 1px 3px; border-radius: 5px; background: var(--acid); color: var(--acid-ink); font: 400 6px var(--font-pixel); }
/* Язык в профиле (0111) */
.prof-lang { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 10px; font-size: 13px; color: var(--text-dim); }
.prof-lang-seg { display: flex; gap: 4px; }
.prof-lang-seg button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 9px; padding: 7px 10px; font: 600 12px var(--font-body); cursor: pointer; }
.prof-lang-seg button.on { border-color: var(--acid); color: var(--acid); }
.pack-top { gap: 6px; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.icon-btn.coll-btn { width: auto; padding: 0 8px 0 10px; border-radius: 99px; gap: 6px; grid-auto-flow: column; font-size: 14px; }
.coll-btn b { font-family: var(--font-pixel); font-size: 10px; font-weight: 400; color: var(--acid); }
/* Баланс в шапке: число, крупная монета, на её краю — маленький «+» (пополнить) */
.wallet-coin { position: relative; display: inline-grid; font-size: 20px; line-height: 1; }
.wallet-coin .coin { margin: 0; vertical-align: 0; }
.wallet-plus { position: absolute; right: -5px; bottom: -4px; display: grid; place-items: center; width: 12px; height: 12px; border-radius: 50%;
  font: normal 800 11px/1 var(--font-body); color: var(--acid-ink); background: var(--acid); box-shadow: 0 0 0 1.5px #1b1729, 0 0 6px rgba(200, 255, 46, 0.55); }
.icon-btn[hidden] { display: none; }

/* Пачка дня уже открыта / ошибка */
.summary.wait h2 { font-size: 18px; }
.countdown { font-family: var(--font-pixel); font-size: 26px; color: var(--acid); text-shadow: 0 0 18px rgba(200, 255, 46, 0.35); }
/* Пачки за монеты (features/0029) */
.buy-packs { display: grid; gap: 10px; width: 100%; max-width: 340px; margin: 4px auto 0; }
.buy-packs .btn { display: grid; gap: 2px; justify-items: center; }
.buy-packs .btn small { font-family: var(--font-body); font-weight: 400; font-size: 11px; }
.buy-note { margin: 0 !important; font-size: 12px !important; color: var(--text-dim); }
.buy-note .link { border: 0; background: none; padding: 0; color: var(--acid); font: inherit; cursor: pointer; text-decoration: underline; }
.next-pack { font-size: 12px !important; color: var(--text-mute) !important; margin: 0 !important; }

/* ---- Коллекция ---- */
#screen-collection { overflow-y: auto; }
.coll { padding: 14px 16px 32px; }
.coll-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.coll-top h1 { margin: 0; font-family: var(--font-display); font-size: 22px; }
body.in-telegram #collBack { display: none; }
.coll-stats { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }
.coll-stats b { color: var(--text); font-size: 15px; }
.coll-stats span { font-family: var(--font-pixel); font-size: 8px; color: var(--c); border: 1px solid var(--c); border-radius: 99px; padding: 5px 8px; }
.coll-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; }
.coll-grid .card { --card-w: 100%; min-width: 0; cursor: pointer; }
.coll-empty { grid-column: 1 / -1; color: var(--text-dim); text-align: center; padding: 40px 10px; line-height: 1.5; }
.stage { position: relative; flex: 1; min-height: 0; }
.pack-holder { position: absolute; inset: 0; cursor: pointer; transition: opacity 0.4s;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; } /* пачку держат пальцем (features/0026) */
.pack-gl { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.reveal { position: absolute; inset: 0; pointer-events: none; }
.reveal > * { pointer-events: auto; }
/* Одиночная карта дня: кнопки ниже карты, без пустого лотка (0072). */
#screen-pack.single-reveal .tray { display: none; }
.stage.card-actions-on .reveal { top: 68px; bottom: 128px; container-type: size; }
.stage.card-actions-on .deck-card { --card-w: min(78vw, 290px, calc(100cqh * 0.716)); }
.card-reveal-actions { position: absolute; bottom: 8px; left: 14px; right: 14px; z-index: 21; }
.card-reveal-actions[hidden] { display: none; }
.daily-summary-actions { width: 100%; max-width: 360px; }
.daily-card-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.daily-card-buttons:has(> :only-child) { grid-template-columns: 1fr; }
.daily-card-buttons .btn { min-height: 48px; padding: 11px 6px; font-size: 11px; line-height: 1.4; }
.daily-card-buttons .btn.gold { display: grid; gap: 2px; place-content: center; }
.daily-card-buttons .btn.gold small { font: 600 12px/1.2 var(--font-body); color: #fff3c9; background: #241c31; padding: 2px 6px; border-radius: 6px; justify-self: center; }
.daily-card-buttons .btn:disabled { opacity: 0.6; cursor: wait; }
.daily-card-note, .summary .daily-card-note { margin: 9px 0 0; min-height: 30px; font-size: 11px; line-height: 1.4; text-align: center; color: var(--text-dim); }
/* «Ротнуть»: портал в области карты, кнопки и навигация остаются на своих местах. */
.reroll-fx { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.reroll-portal { --orbit: min(112px, calc((100cqh - 64px) * .43)); position: absolute; left: 50%; top: calc(50% - 20px); translate: -50% -50%; width: min(82%, 268px, calc(100cqh - 64px)); aspect-ratio: 1; animation: reroll-open 420ms ease-out both; }
.reroll-halo { position: absolute; inset: -14%; border-radius: 50%; background: radial-gradient(circle, #9e4aff45, #c8ff2e18 48%, transparent 70%); animation: reroll-pulse 1.7s ease-in-out infinite alternate; }
.reroll-ring { position: absolute; inset: 5%; border-radius: 50%; background: conic-gradient(from 20deg, #c8ff2e, #9c5fff, transparent 32%, #c8ff2e 48%, #a875ff 72%, transparent 89%, #c8ff2e); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60% 69%, transparent 71%); mask: radial-gradient(circle, transparent 58%, #000 60% 69%, transparent 71%); animation: reroll-spin 1.9s linear infinite; }
.reroll-ring.inner { inset: 18%; opacity: .7; animation-direction: reverse; animation-duration: 2.7s; }
.reroll-core { position: absolute; inset: 28%; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, #322145, #100b1c 65%); box-shadow: 0 0 28px #9b5fff55, inset 0 0 16px #c8ff2e33; color: var(--acid); font: min(72px, 19cqh)/1 var(--font-body); animation: reroll-spin 3.2s linear infinite reverse; }
.reroll-spark { position: absolute; left: 50%; top: 50%; font-size: 20px; line-height: 1; translate: -50% -50%; animation: reroll-orbit 3.4s linear infinite; animation-delay: calc(var(--i) * -.425s); }
.reroll-caption { position: absolute; left: 8%; right: 8%; bottom: 1%; text-align: center; color: var(--acid); font: 10px/1.5 var(--font-pixel); text-shadow: 2px 2px #0b0a12; opacity: 0; transition: opacity .2s; }
.reroll-caption span { display: block; margin-top: 8px; color: var(--text-dim); font: 13px/1.4 var(--font-body); }
.reroll-fx.waiting .reroll-caption { opacity: 1; }
.reroll-fx.revealing .reroll-caption { opacity: 0; }
.reroll-fx.closing { opacity: 0; transition: opacity .45s; }
.card.deck-card.reroll-card { z-index: 12; pointer-events: none; transition: none; }
.reroll-card .card-tilt { transform: none; }
.reroll-fx.paused * { animation-play-state: paused; }
@keyframes reroll-open { from { opacity: 0; scale: .4; } to { opacity: 1; scale: 1; } }
@keyframes reroll-spin { to { rotate: 360deg; } }
@keyframes reroll-pulse { to { scale: 1.16; opacity: .6; } }
@keyframes reroll-orbit { from { transform: rotate(0deg) translateX(var(--orbit)) rotate(0deg) scale(.7); opacity: .3; } 50% { opacity: 1; } to { transform: rotate(360deg) translateX(var(--orbit)) rotate(-360deg) scale(1); opacity: .3; } }
@media (prefers-reduced-motion: reduce) {
  .reroll-fx * { animation: none; }
  .reroll-spark { display: none; }
  .reroll-card .card-flip { transition-duration: .12s; }
}
@media (max-height: 620px) {
  .stage.card-actions-on .reveal { top: 64px; bottom: 128px; }
  .daily-card-note { min-height: 24px; margin-top: 7px; }
}
/* Окно карточки: вертикальные жесты — браузеру (прокрутка оборота), горизонтальные — нам (листание) */
#modal, #modalCard { touch-action: pan-y; }
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; image-rendering: pixelated; z-index: 20; }
/* Вспышка разрыва пачки — на весь экран и мягко гаснет к краям: раньше обрывалась ровной линией над лотком карт */
.flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; z-index: 45;
  background: radial-gradient(ellipse 90% 75% at 50% 42%, rgba(255, 255, 255, 0.78) 0 28%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.2) 72%, rgba(255, 255, 255, 0) 100%); }
.flash.go { animation: flash 0.6s ease-out; }
.flash.gold { background: radial-gradient(circle, #fff7d1, #ffc531 60%, transparent); }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }

/* Подсказка — сверху, над картой: внизу её не замечали. Не вплотную к кнопкам шапки (features/0026),
   по бокам место под кнопку заданий 🎯 */
.hint {
  position: absolute; left: 0; right: 0; top: 26px; z-index: 15; /* над стопкой карт (z 10) — на низких экранах она подходит к подсказке */
  text-align: center; min-height: 18px; white-space: nowrap;
  font-family: var(--font-pixel); font-size: 10px; color: var(--acid);
  text-shadow: 0 0 12px rgba(200, 255, 46, 0.4), 2px 2px 0 #0b0a12;
  padding: 0 62px; pointer-events: none; /* по бокам — место под 🎯 */
  animation: blink 1.4s steps(2) infinite;
  transition: top 0.2s;
}
@keyframes blink { 50% { opacity: 0.45; } }

/* Стопка карт */
.card.deck-card {
  position: absolute; left: 50%; top: 50%;
  --card-w: min(72vw, 290px, calc((100dvh - 330px) * 0.716));
  translate: -50% -50%;
  cursor: pointer;
  transition: transform 0.5s cubic-bezier(0.2, 1.3, 0.4, 1), opacity 0.4s, translate 0.5s;
}
.card.deck-card.dealing { transform: translateY(40vh) scale(0.4) rotate(-12deg); opacity: 0; }
.deck-card.anticipate .card-tilt { animation: anticipate 0.12s linear infinite; }
@keyframes anticipate { 25% { translate: -1.5% 0.5%; } 75% { translate: 1.5% -0.5%; } }
.card.deck-card.leaving { transition: transform 0.45s cubic-bezier(0.5, 0, 0.8, 0.4), opacity 0.45s; opacity: 0; }

.rarity-banner {
  position: absolute; left: 0; right: 0; top: 20px; z-index: 16;
  text-align: center;
  font-family: var(--font-pixel); font-size: 15px;
  color: var(--rar); text-shadow: 0 0 18px var(--rar), 3px 3px 0 #0b0a12;
  opacity: 0; transform: scale(0.6);
  transition: opacity 0.25s, transform 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
  pointer-events: none;
}
.rarity-banner.show { opacity: 1; transform: none; }
/* Редкость на месте подсказки — подсказка «ТАПНИ, ЧТОБЫ ЗАБРАТЬ» уезжает строкой ниже, а не поверх */
.rarity-banner.show ~ .hint { top: 42px; }

/* Лоток с открытыми картами */
.tray { display: flex; justify-content: center; gap: 10px; padding: 0 16px 12px; min-height: 96px; }
.tray:empty { display: none; } /* итог и ожидание пачки — без пустого места внизу, блок по центру экрана */
.stage.summary-on .quest-btn { display: none; } /* итог пачки: 🎯 не перекрывает текст */
.slot {
  width: 64px; aspect-ratio: 63 / 88;
  border-radius: 6px; border: 1.5px dashed var(--line);
  display: grid; place-items: center;
}
.slot .card { --card-w: 64px; cursor: pointer; }
.slot .card .face { box-shadow: none; }
.slot.filled { border-color: transparent; }

/* Итог пачки */
.summary {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 18px;
  padding: 16px;
  overflow-y: auto; overscroll-behavior: contain; /* на низком экране итог прокручивается, кнопки не уходят за край */
}
.summary h2 { margin: 0; font-family: var(--font-display); font-size: 20px; text-align: center; }
.summary p { margin: -8px 0 0; color: var(--text-dim); font-size: 13px; text-align: center; }
.summary-row { display: flex; gap: 10px; justify-content: center; }
.summary-row .card { --card-w: min(30vw, 128px); cursor: pointer; animation: pop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) backwards; }
.summary-row .card:nth-child(2) { animation-delay: 0.08s; }
.summary-row .card:nth-child(3) { animation-delay: 0.16s; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.actions { display: flex; gap: 10px; }

/* ---- Модалка карточки ---- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 6, 14, 0.82);
  backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal { touch-action: none; overscroll-behavior: contain; }
.modal .card { --card-w: min(84vw, 380px, calc((100dvh - 160px) * 0.716)); cursor: grab; animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.modal .caption { color: var(--text-dim); font-size: 13px; text-align: center; }
/* Листание карточек свайпом и стрелками */
.modal-stage { position: relative; display: flex; align-items: center; justify-content: center; }
#modalCard { transition: transform 0.18s ease-out, opacity 0.18s; will-change: transform; }
#modalCard.dragging { transition: none; }
#modalCard.in-l { animation: slide-in-l 0.22s ease-out; }
#modalCard.in-r { animation: slide-in-r 0.22s ease-out; }
#modalCard.in-l .card, #modalCard.in-r .card { animation: none; }
@keyframes slide-in-l { from { transform: translateX(-40%); opacity: 0; } }
@keyframes slide-in-r { from { transform: translateX(40%); opacity: 0; } }
.modal-nav { position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); width: 36px; height: 56px; border: 0; border-radius: 12px; background: rgba(14, 11, 24, 0.7); color: var(--text); font: 700 28px var(--font-body); cursor: pointer; }
.modal-nav.prev { left: -6px; }
.modal-nav.next { right: -6px; }
.modal-nav[hidden] { display: none; }
.modal-nav { transition: opacity 0.6s ease; }
.modal-nav.fade { opacity: 0; pointer-events: none; }
.modal-count { font: 400 9px var(--font-pixel); color: var(--text-mute); margin-top: -10px; }
.modal-count[hidden] { display: none; }

/* ---- Галерея ---- */
.gallery { padding: 24px 20px 60px; }
.gallery h1, .palette h1 { font-family: var(--font-display); font-size: 26px; margin: 0 0 6px; }
.gallery .lead, .palette .lead { color: var(--text-dim); margin: 0 0 24px; max-width: 760px; line-height: 1.5; }
.g-row { margin-bottom: 34px; }
.g-row h3 { font-family: var(--font-pixel); font-weight: 400; font-size: 11px; margin: 0 0 14px; display: flex; gap: 10px; align-items: center; }
.g-row h3 i { width: 12px; height: 12px; display: inline-block; }
.g-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px 18px; }
.g-item { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.g-item .card { --card-w: 100%; cursor: pointer; }
.g-item span { font-size: 12px; color: var(--text-dim); text-align: center; }
.g-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }

/* ---- Палитра ---- */
.palette { padding: 24px 20px 60px; }
.p-section { margin-bottom: 36px; }
.p-section h2 { font-family: var(--font-pixel); font-weight: 400; font-size: 12px; color: var(--acid); margin: 0 0 14px; }
.p-section > p { color: var(--text-dim); font-size: 14px; margin: -6px 0 14px; max-width: 760px; line-height: 1.5; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sw { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.sw .c { height: 64px; }
.sw .m { padding: 9px 11px; display: grid; gap: 2px; }
.sw .m b { font-size: 13px; font-weight: 600; }
.sw .m code { font-size: 11px; color: var(--text-dim); }
.wheel-wrap { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 28px; align-items: center; }
@media (max-width: 800px) { .wheel-wrap { grid-template-columns: 1fr; } }
.wheel { width: 100%; height: auto; }
.beats { display: grid; gap: 6px; font-size: 14px; }
.beats div { display: grid; grid-template-columns: 120px 18px 120px 1fr; gap: 8px; align-items: center; padding: 6px 10px; background: var(--surface); border-radius: 8px; }
.beats .why { color: var(--text-dim); font-size: 13px; }
.fonts { display: grid; gap: 12px; }
.fonts div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.fonts small { display: block; color: var(--text-dim); font-family: var(--font-body); font-size: 12px; margin-bottom: 6px; }
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.frames .f { height: 90px; border-radius: 12px; display: flex; align-items: flex-end; padding: 8px 10px; font-size: 12px; font-weight: 600; color: #0b0a12; }

/* ---- Лаборатория ---- */
.lab { padding: 24px 20px 60px; }
.lab h1 { font-family: var(--font-display); font-size: 26px; margin: 0 0 6px; }
.lab .lead { color: var(--text-dim); margin: 0 0 14px; max-width: 820px; line-height: 1.5; }
.lab-status { display: inline-block; font-size: 13px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text-dim); margin-bottom: 18px; }
.lab-status.ok { color: var(--acid); }
.lab-grid { display: grid; grid-template-columns: 240px 1fr 260px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .lab-grid { grid-template-columns: 1fr; } }
.lab-form { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.lab-form label { display: grid; gap: 4px; font-size: 12px; color: var(--text-dim); }
.lab-form select { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; font: inherit; font-size: 13px; }
.lab-actions { display: flex; gap: 8px; margin-top: 6px; }
.lab-actions .btn { flex: 1; }
.lab-actions .btn:disabled { filter: grayscale(1) brightness(0.6); cursor: wait; }
.lab-form .lab-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.lab-check input { width: 16px; height: 16px; accent-color: var(--acid); }
.lab-draw { margin-top: 10px; }
.lab-views { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lab-views figure { margin: 0; display: grid; gap: 8px; }
.lab-views figcaption { font-size: 13px; color: var(--text-dim); text-align: center; }
.viewer {
  position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden;
  background: #0b0a12 center / cover; image-rendering: pixelated;
  box-shadow: inset 0 0 0 1px var(--line);
}
.viewer-gl { width: 100%; height: 100%; display: block; image-rendering: pixelated; cursor: grab; }
.viewer-empty { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-pixel); font-size: 10px; color: #fff; background: rgba(11, 10, 18, 0.55); }
.viewer.stale .viewer-gl { opacity: 0.25; }
.viewer.working::after {
  content: 'ЛЕПИТ…'; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-pixel); font-size: 12px; color: var(--acid); background: rgba(11, 10, 18, 0.55);
  animation: blink 1s steps(2) infinite;
}
.lab-concept { grid-column: 1 / -1; font-size: 15px; line-height: 1.45; }
.lab-concept small { display: block; color: var(--text-dim); font-size: 12px; margin-top: 6px; line-height: 1.6; }
.lab-err { color: var(--mogged); }
.lab-side { display: grid; gap: 12px; }
.lab-side .card { cursor: pointer; }
.lab-json summary { cursor: pointer; font-size: 13px; color: var(--text-dim); }
.lab-json pre { max-height: 280px; overflow: auto; font-size: 11px; background: var(--bg-2); padding: 10px; border-radius: 10px; }
.lab-h2 { font-family: var(--font-pixel); font-weight: 400; font-size: 12px; color: var(--acid); margin: 34px 0 14px; }
.lab-history { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.lab-hist-item { display: grid; gap: 8px; }
.lab-hist-item .card { cursor: pointer; }
.lab-hist-item span { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.lab-muted { color: var(--text-mute); }
.pill i { font-style: normal; color: var(--text-mute); margin-left: 4px; }

/* ---- Сравнение графики ---- */
.gfx { padding: 24px 20px 60px; }
.gfx h1 { font-family: var(--font-display); font-size: 26px; margin: 0 0 6px; }
.gfx .lead { color: var(--text-dim); margin: 0 0 18px; max-width: 820px; line-height: 1.5; }
.gfx-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 26px; }
.gfx-style { display: grid; gap: 6px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.gfx-style.active { border-color: var(--acid); }
.gfx-style span { font-size: 13px; color: var(--text-dim); line-height: 1.4; }
.gfx-style .btn { justify-self: start; margin-top: 4px; }
.gfx-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 18px 14px; max-width: 1100px; }
.gfx-head { font-family: var(--font-pixel); font-size: 10px; color: var(--acid); text-align: center; }
.gfx-grid .card { cursor: pointer; }
.gfx-empty { display: grid; place-items: center; aspect-ratio: 63 / 88; border: 1.5px dashed var(--line); border-radius: 12px; color: var(--text-mute); font-size: 12px; }
.gfx-bgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 26px; }
.gfx-bgs figure { margin: 0; display: grid; gap: 4px; }
.gfx-bgs img, .gfx-bgs .missing div { width: 100%; aspect-ratio: 5 / 4; object-fit: cover; border-radius: 8px; background: var(--surface); }
.gfx-bgs figcaption { font-size: 12px; color: var(--text-dim); }

/* Рот-коин (features/0019): одинаково золотой на всех устройствах, без картинок и эмодзи */
.coin {
  display: inline-block; width: 1em; height: 1em; margin: 0 0.06em; vertical-align: -0.14em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c2 0 12%, #ffd23a 30%, #f2a900 62%, #b87400 100%);
  box-shadow: inset 0 0 0 0.09em #a86a00, inset 0 0 0 0.2em rgba(255, 236, 150, 0.55), 0 0.05em 0.12em rgba(0, 0, 0, 0.45);
  position: relative;
}
.coin::after {
  content: ''; position: absolute; inset: 0.3em; border-radius: 50%;
  box-shadow: inset 0 0 0 0.06em rgba(140, 86, 0, 0.7);
}

/* Задания дня — кнопка 🎯 справа под звуком (features/0026), «!» — награда ждёт */
.quest-btn {
  position: absolute; top: 18px; right: 12px; z-index: 8; width: 46px; height: 46px; font-size: 24px;
  border: 2px solid rgba(163, 150, 190, 0.5);
  background: radial-gradient(circle at 35% 30%, #4a2f86, #221a3a 70%);
  box-shadow: none;
}
.quest-btn:active { transform: scale(0.94); }
.quest-btn.pending { border-color: var(--acid); }
.quest-btn.pending::after {
  content: ''; position: absolute; inset: -3px; border: 2px solid var(--acid); border-radius: inherit;
  pointer-events: none; animation: quest-ring 2.2s ease-in-out infinite;
}
@keyframes quest-ring {
  0%, 100% { opacity: 0.35; box-shadow: 0 0 4px rgba(200, 255, 46, 0.2); }
  50% { opacity: 1; box-shadow: 0 0 18px rgba(200, 255, 46, 0.65); }
}
.page-hidden .quest-btn.pending::after { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .quest-btn.pending::after { animation: none; opacity: 0.7; } }
.quest-btn b { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px;
  font: 400 8px/16px var(--font-pixel); color: var(--acid-ink); background: var(--acid); box-shadow: 0 0 10px rgba(200, 255, 46, 0.6); }
.quest-btn b:empty { display: none; }
#profileBody .quests { border: 0; padding: 0; background: none; }

/* ---- Переплавка и подкормка (features/0030) ---- */
.coll-top .forge-btn { margin-left: auto; }
.pick { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: var(--bg, #0b0a12); }
.pick-top { padding: 14px 16px 8px; }
.pick-top h2 { margin: 0 0 4px; font: 700 18px var(--font-display); }
.pick-top p { margin: 0; font-size: 12px; line-height: 1.4; color: var(--text-dim); }
.pick-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px 16px 16px; align-content: start; }
.pick-grid .card { --card-w: 100%; cursor: pointer; transition: opacity 0.15s, transform 0.15s, filter 0.15s; }
.pick-grid .card.off { opacity: 0.3; filter: grayscale(0.8); cursor: default; }
.pick-grid .card.picked { transform: scale(0.94); outline: 3px solid var(--acid); outline-offset: 2px; border-radius: 10px; }
.pick-grid .card.picked::after { content: '✓'; position: absolute; right: 6%; bottom: 6%; z-index: 9; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font: 700 15px var(--font-display); color: var(--acid-ink); background: var(--acid); }
.pick-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: rgba(14, 11, 24, 0.97); }
.pick-sum { flex: 1; font-size: 13px; line-height: 1.35; }
.pick-sum b { color: var(--acid); }
.pick-sum small { color: var(--text-dim); }
.pick-btns { display: flex; gap: 8px; }
.pick-btns .btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.blender { position: fixed; inset: 0; z-index: 80; pointer-events: none; background: rgba(11, 10, 18, 0.55); }
.blender-card { position: fixed; margin: 0; transition: transform 0.85s cubic-bezier(0.55, 0, 0.75, 0.2), opacity 0.85s; }
.blender-label { position: absolute; left: 0; right: 0; top: 58%; text-align: center; font: 400 11px var(--font-pixel); color: var(--acid); animation: blink 1.4s steps(2) infinite; }
.blender-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, #fff, rgba(200, 255, 46, 0.6) 30%, transparent 65%); opacity: 0; }
.blender.boom .blender-flash { animation: blender-boom 0.38s ease-out; }
@keyframes blender-boom { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }

/* Слияние тиража (features/0089): превью и выбор фона поверх экрана */
.fuse-body { flex: 1; overflow-y: auto; padding: 4px 16px 16px; }
.fuse-preview { display: flex; justify-content: center; padding: 8px 0 14px; }
.fuse-preview .card { --card-w: min(62vw, 240px); }
.fuse-label { font: 600 13px var(--font-body); color: var(--text-dim); margin-bottom: 8px; }
.fuse-bgs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.fuse-bgs button { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: 500 13px var(--font-body); text-align: left; cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fuse-bgs button i { font-style: normal; font-size: 18px; flex: none; }
.fuse-bgs button.on { border-color: var(--acid); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--acid); }

/* Заставка загрузки при запуске (features/0103) */
.boot { position: fixed; inset: 0; z-index: 9999; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--bg); transition: opacity .25s; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-logo { font: 400 22px var(--font-pixel); color: var(--acid); letter-spacing: .08em; text-shadow: 3px 3px 0 var(--pink); }
.boot-bar { width: 200px; height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.boot-bar i { display: block; width: 0; height: 100%; background: var(--acid); transition: width .2s; }
.boot p { margin: 0; font-size: 13px; color: var(--text-dim); }
