/* Блок награды — общий для игр хаба. Игра может переопределить переменные. */
.hub-reward {
  --hub-ok-bg: #e6f9ee;
  --hub-warn-bg: #fff4e0;
  --hub-card: #ffffff;
  --hub-border: #e1e4e8;
  --hub-muted: #8a8f98;
  --hub-accent: #00aaff;
  --hub-cta: #02d15c;

  background: var(--hub-card);
  border: 1px solid var(--hub-border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}
.hub-reward.ok {
  /* Белая карточка с рамкой фирменного градиента игры */
  border: 2px solid transparent;
  background: linear-gradient(#fff, #fff) padding-box, var(--game-gr, #02d15c) border-box;
  box-shadow: 0 10px 30px var(--game-shadow, rgba(0, 0, 0, 0.08));
}
.hub-reward.warn { background: var(--hub-warn-bg); border-color: transparent; }
.hub-reward-title { font-weight: 700; font-size: 17px; }
.hub-reward-text { margin: 6px 0 0; color: var(--hub-muted); font-size: 14px; }

.hub-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 14px 20px;
  border: 0;
  border-radius: 14px;
  background: var(--hub-accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.hub-btn-reward {
  /* ДС: для транзакций — Success */
  background: var(--hub-cta); font-size: 18px; font-weight: 800; padding: 16px 20px; border-radius: 16px;
  box-shadow: 0 8px 20px rgba(2, 209, 92, 0.35);
}
.hub-btn-reward:hover { background: #02bc53; }

#hub-captcha { position: fixed; bottom: 0; right: 0; }

.hub-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 200;
  transform: translateX(-50%);
  background: #1a1d1f; color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 14px;
}

/* Панель на фоне игры и прогресс-бар партии — общие для игр хаба. */
.hub-panel {
  background: #fff; border-radius: 22px; padding: 22px 20px;
  box-shadow: 0 10px 30px rgba(0, 80, 140, 0.1);
}
.hub-progress { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.hub-bar { flex: 1; display: flex; gap: 5px; }
.hub-bar i { flex: 1; height: 12px; border-radius: 6px; background: rgba(0, 60, 110, 0.12); transition: background 0.2s; }
.hub-bar i.ok { background: #02d15c; }
.hub-bar i.bad { background: #f62434; }
.hub-bar i.cur { background: var(--game-gr, #00aaff); box-shadow: 0 0 0 3px var(--game-shadow, rgba(0, 170, 255, 0.25)); }
.hub-bar.small i { height: 8px; }
.hub-score { font-weight: 800; font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ——— тема игр по дизайн-системе ———
   Каждая игра выбирает свой фирменный градиент ДС классом на body:
   theme-sky1 (Sky → Mint), theme-sky2 (Sky → Flamingo), theme-orange1
   (Orange → Violet), theme-orange2 (Orange → Flamingo). Из него — шапка, фон, главные кнопки, счёт. */
:root {
  --gr-sky1: linear-gradient(120deg, #00aaff, #09e5ac);
  --gr-sky2: linear-gradient(120deg, #00aaff, #e64de6);
  --gr-orange1: linear-gradient(120deg, #ff7120, #aa5aff);
  --gr-orange2: linear-gradient(120deg, #ff7120, #e64de6);
}
body.theme-sky1 { --game-gr: var(--gr-sky1); --game-c1: 0, 170, 255; --game-c2: 9, 229, 172; }
body.theme-sky2 { --game-gr: var(--gr-sky2); --game-c1: 0, 170, 255; --game-c2: 230, 77, 230; }
body.theme-orange2 { --game-gr: var(--gr-orange2); --game-c1: 255, 113, 32; --game-c2: 230, 77, 230; }
body.theme-orange1 { --game-gr: var(--gr-orange1); --game-c1: 255, 113, 32; --game-c2: 170, 90, 255; }
body[class*="theme-"] {
  --game-shadow: rgba(var(--game-c1), 0.3);
  /* Фон экранов: цветные «пятна» из цветов градиента поверх светлого серого */
  --game-glow:
    radial-gradient(120% 60% at 0% 0%, rgba(var(--game-c1), 0.22), transparent 60%),
    radial-gradient(90% 55% at 100% 35%, rgba(var(--game-c2), 0.18), transparent 60%),
    radial-gradient(100% 50% at 20% 100%, rgba(var(--game-c2), 0.12), transparent 60%),
    linear-gradient(#f9f9fb, #f5f5f5);
}

/* Шапка — фирменный градиент, белый текст */
body[class*="theme-"] .top {
  background: var(--game-gr); border-bottom: 0; color: #fff;
  box-shadow: 0 6px 20px var(--game-shadow); position: relative; z-index: 2;
}
body[class*="theme-"] .top h1 { color: #fff; font-weight: 900; font-size: 19px; letter-spacing: -0.01em; }
body[class*="theme-"] .top .sub { color: rgba(255, 255, 255, 0.88); }
body[class*="theme-"] .reward-chip {
  background: #fff; color: #333; font-weight: 800; padding: 6px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Счёт и крупные числа — градиентным текстом */
.hub-gr-text {
  background: var(--game-gr); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* Конфетти на итоговом экране */
.hub-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.hub-confetti i {
  position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px;
  animation: hub-fall var(--d, 2s) cubic-bezier(0.25, 0.6, 0.4, 1) var(--delay, 0s) forwards;
}
@keyframes hub-fall {
  to { transform: translate(var(--dx, 0), 110vh) rotate(var(--r, 540deg)); opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) { .hub-confetti { display: none; } }

/* ——— награда: начисление, начислено ——— */
.hub-spinner {
  width: 34px; height: 34px; margin: 4px auto 10px; border-radius: 50%;
  border: 4px solid rgba(var(--game-c1, 0, 170, 255), 0.18); border-top-color: rgb(var(--game-c1, 0, 170, 255));
  animation: hub-spin 0.8s linear infinite;
}
@keyframes hub-spin { to { transform: rotate(360deg); } }
.hub-reward.loading { padding: 22px 16px; }
.hub-reward.redeemed {
  padding: 20px 16px; border: 2px solid transparent;
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(120deg, #02d15c, #09e5ac) border-box;
  box-shadow: 0 10px 30px rgba(2, 209, 92, 0.2);
  animation: hub-pop 0.35s cubic-bezier(0.34, 1.6, 0.64, 1);
}
@keyframes hub-pop { from { transform: scale(0.92); opacity: 0.4; } }
.hub-check {
  width: 44px; height: 44px; margin: 0 auto 6px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #02d15c; color: #fff; font-size: 24px; font-weight: 900;
  box-shadow: 0 6px 16px rgba(2, 209, 92, 0.4);
}
.hub-amount { font-size: 46px; font-weight: 900; line-height: 1; color: #02bc53; }
.hub-amount-sub { font-size: 17px; font-weight: 800; margin-top: 4px; }

/* ——— «когда возвращаться» и другие игры ——— */
.hub-after { display: flex; flex-direction: column; gap: 12px; }
.hub-next {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef0f2;
  font-size: 13px; font-weight: 700; color: var(--muted, #8a8f98); text-align: center;
}
.hub-cta {
  display: block; text-align: center; text-decoration: none; cursor: pointer;
  padding: 16px 20px; border-radius: 16px; font-weight: 900; font-size: 18px;
  color: #fff; background: #333333; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.hub-cta:active { transform: scale(0.98); }
/* ДС: Secondary — вторая кнопка рядом с основной */
.hub-cta.secondary { background: #ebebeb; color: #333; box-shadow: none; }
button.hub-cta { width: 100%; border: 0; font: inherit; font-weight: 900; font-size: 18px; }

/* ——— товар: избранное и корзина ——— */
.hub-prod {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 10px;
  background: #fff; border-radius: 16px; padding: 10px 12px 12px; text-align: left;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}
.hub-prod-main { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; border: 0; background: none; padding: 0 36px 0 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.hub-prod-main img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.hub-prod-name { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hub-prod-price { font-weight: 900; font-size: 16px; margin-top: 2px; }
.hub-fav {
  position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: #f5f5f5; color: #8f8f8f; font-size: 20px; line-height: 1; cursor: pointer;
  transition: transform 0.15s;
}
.hub-fav.on { color: #f62434; background: #fee9eb; animation: hub-pop 0.3s; }
.hub-fav:disabled { opacity: 0.6; }
.hub-prod-actions { grid-column: 1 / -1; }
.hub-cart {
  width: 100%; border: 0; border-radius: 12px; padding: 10px; cursor: pointer;
  background: #02d15c; color: #fff; font: inherit; font-weight: 800; font-size: 14px;
}
.hub-cart.on { background: #ccf6de; color: #02bc53; cursor: default; }

/* ——— карточка товара поверх игры ——— */
.hub-modal-bg {
  position: fixed; inset: 0; z-index: 250; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center; animation: hub-fade 0.2s;
}
@keyframes hub-fade { from { opacity: 0; } }
.hub-modal {
  position: relative; width: 100%; max-width: 560px; max-height: 90%; overflow-y: auto;
  background: #fff; border-radius: 24px 24px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; text-align: left; color: #333;
  animation: hub-up 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes hub-up { from { transform: translateY(100%); } }
.hub-modal-x {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: #f5f5f5; font-size: 16px; cursor: pointer; color: #333;
}
.hub-modal-img { width: 100%; height: 240px; object-fit: contain; background: #fff; }
.hub-modal-name { font-size: 16px; line-height: 1.35; }
.hub-modal-price { font-size: 26px; font-weight: 900; }
.hub-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.hub-modal-actions .hub-cart { padding: 14px; font-size: 15px; }
.hub-fav.wide {
  position: static; width: auto; height: auto; border-radius: 12px; padding: 14px; font-size: 15px; font-weight: 800;
}
.hub-modal-actions .wide-link { grid-column: 1 / -1; text-align: center; text-decoration: none; }

/* ——— итоговый экран: единый компактный вид для всех игр ———
   Результат, награда, «когда возвращаться» и кнопки помещаются на первый
   экран телефона, кнопки не уезжают вниз. */
body[class*="theme-"] .done { gap: 10px; padding-top: 12px; padding-bottom: 24px; }
.hub-panel.hub-result { padding: 14px 16px; gap: 4px !important; }
.hub-panel.hub-result .big, .hub-panel.hub-result .big-time { font-size: 40px; line-height: 1.05; }
/* Очки — спокойно, тёмно-серым: главное на итогах — бонусы */
.hub-panel.hub-result .big, .hub-panel.hub-result .big-time {
  background: none; -webkit-text-fill-color: currentColor; color: #333;
}
.hub-panel.hub-result h2 { margin: 0; font-size: 18px; font-weight: 900; }
.hub-panel.hub-result .comment { margin-top: 2px; font-size: 14px; font-weight: 700; }
.hub-panel.hub-result > .muted { font-size: 13px; }
.hub-panel.hub-result .head { display: flex; align-items: center; justify-content: center; gap: 8px; }
.hub-panel.hub-result .line { display: flex; align-items: center; justify-content: center; gap: 8px; }
.hub-panel.hub-result .line .pill { margin: 0 !important; }

.hub-reward { padding: 12px 14px; }
.hub-reward .hub-btn { margin-top: 10px; padding: 12px 16px; }
.hub-reward-title { font-size: 16px; }
/* «+30 бонусов» — одна строка с галочкой, вдвое ниже прежнего */
.hub-reward.redeemed {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 12px;
  padding: 10px 14px; text-align: left; animation: hub-pop 0.35s cubic-bezier(0.34, 1.6, 0.64, 1);
}
.hub-reward.redeemed .hub-check { grid-row: span 2; width: 38px; height: 38px; margin: 0; font-size: 20px; }
.hub-reward.redeemed .hub-amount { font-size: 24px; line-height: 1.15; }
.hub-reward.redeemed .hub-reward-text { margin: 0; font-size: 13px; }
.hub-reward.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; }
.hub-reward.loading .hub-spinner { width: 24px; height: 24px; margin: 0; border-width: 3px; }

.hub-after { gap: 10px; }
.hub-cta { padding: 13px 18px; font-size: 16px; border-radius: 14px; }
button.hub-cta { font-size: 16px; }

/* ——— карточка игры (первый экран по ссылке) ——— */
.hub-gcard { width: 100%; max-width: 420px; margin: 0 auto; background: #fff; border-radius: 24px; overflow: hidden; box-shadow: 0 14px 34px rgba(var(--game-c1, 0, 170, 255), 0.18); }
.hub-gcard-pic { aspect-ratio: 2 / 1; background: var(--game-gr, #00aaff); }
.hub-gcard-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hub-gcard-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.hub-gcard-body h2 { margin: 0; font-size: 26px; font-weight: 900; line-height: 1.15; }
.hub-gcard-sub { margin: -4px 0 0; color: var(--muted, #6b6b6b); font-size: 15px; }
.hub-gcard-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hub-gchip { padding: 5px 10px; border-radius: 99px; background: #f2f3f5; font-size: 13px; font-weight: 700; color: #333; }
.hub-gchip.prize { background: var(--game-gr, #02d15c); color: #fff; }
.hub-gcard-played { padding: 10px 12px; border-radius: 14px; background: #eefaf3; color: #02a14a; font-weight: 800; font-size: 14px; }
.hub-gcard-note { margin: 0; font-size: 13px; color: var(--muted, #6b6b6b); }
.hub-gcard-note a { color: inherit; font-weight: 700; }
.hub-gcard-how summary { cursor: pointer; font-weight: 700; color: var(--muted, #6b6b6b); font-size: 14px; }
.hub-gcard-how p { margin: 6px 0 0; font-size: 14px; line-height: 1.4; }
body.card-mode .top { display: none; }
.card-screen { padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); }
.hub-splash { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; animation: hub-splash-in 0.35s ease-out; }
.hub-splash b { font-size: 28px; font-weight: 900; background: var(--game-gr); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hub-splash span { color: var(--muted, #6b6b6b); font-weight: 800; font-size: 18px; }
@keyframes hub-splash-in { from { opacity: 0; transform: translateY(8px); } }

/* ——— товары в конце игры: горизонтальная лента ——— */
.hub-endp { margin-top: 6px; }
.hub-endp .hub-endp-title { margin: 0 0 8px; font-size: 17px; font-weight: 900; text-align: left; }
.hub-strip {
  display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  margin: 0 -16px; padding: 2px 16px 14px; scroll-padding-inline: 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.hub-strip::-webkit-scrollbar { display: none; }
.hub-mini {
  position: relative; flex: 0 0 148px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px;
  background: #fff; border-radius: 16px; padding: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06); text-align: left;
}
.hub-mini-main { display: flex; flex-direction: column; gap: 4px; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.hub-mini-main img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.hub-mini-name { font-size: 12px; line-height: 1.3; min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hub-mini-price { font-weight: 900; font-size: 15px; }
.hub-mini .hub-fav { top: 6px; right: 6px; width: 32px; height: 32px; font-size: 17px; }
.hub-mini .hub-cart { margin-top: auto; padding: 8px; font-size: 13px; }
