﻿/* styles.css вЂ” Meme Hub */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

:root {
    --app-viewport-width: 100vw;
    --app-viewport-height: 100dvh;

    /* РРіСЂРѕРІР°СЏ СЃРІРµС‚Р»Р°СЏ РїР°Р»РёС‚СЂР° */
    --bg-1: #ffe7c2;
    --bg-2: #ffb077;
    --bg-3: #fff5d4;

    --surface: #ffffff;
    --surface-alt: #fff5e6;
    --surface-border: rgba(255, 148, 37, 0.18);

    --ink: #2a1b3d;
    --ink-soft: #533d6b;
    --ink-mute: #9484a3;

    --accent: #ff7a18;
    --accent-warm: #ff3f6c;
    --accent-cool: #38b6ff;
    --accent-purple: #b14eff;
    --good: #2bbd6e;
    --bad: #ff3f6c;
    --gold: #ffc926;
    --bg-pattern-image: none;
    /* Размер тайла паттерна адаптивный (mobile-first): см. медиазапросы ниже.
       Управляет и background-size, и overscan, и дистанцией дрейфа. */
    --bg-pattern-tile: 240px;

    --shadow-card: 0 12px 30px rgba(80, 30, 0, 0.16);
    --shadow-soft: 0 4px 14px rgba(80, 30, 0, 0.12);
    --shadow-pop: 0 6px 0 rgba(80, 30, 0, 0.16); /* "depth" РІ РґСѓС…Рµ Clash */
}

html, body {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    overflow: hidden;
    font-family: "Baloo 2", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-weight: 700;
    color: var(--ink);
    /* РЎРѕС‡РЅС‹Р№ РёРіСЂРѕРІРѕР№ С„РѕРЅ: СЃРѕР»РЅС†Рµ, РѕР±Р»Р°РєР°, РјСЏРіРєРёР№ РіСЂР°РґРёРµРЅС‚ */
    background:
        radial-gradient(420px 260px at 80% 14%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 70%),
        radial-gradient(280px 180px at 18% 62%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%),
        radial-gradient(circle at 10% 12%, rgba(255, 201, 38, 0.65) 0%, rgba(255, 201, 38, 0) 22%),
        linear-gradient(180deg, #ffd089 0%, #ff9f57 60%, #ff7a4a 100%);
    touch-action: manipulation;
    overscroll-behavior: none;
    scrollbar-width: none;
}
body {
    position: fixed;
    inset: 0;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar { display: none; }

body::before {
    content: "";
    position: fixed;
    inset: calc(var(--bg-pattern-tile) * -1);
    z-index: 0;
    pointer-events: none;
    background-image: var(--bg-pattern-image);
    background-repeat: repeat;
    background-size: var(--bg-pattern-tile) var(--bg-pattern-tile);
    opacity: 1;
    will-change: transform;
    animation: bg-pattern-drift 96s linear infinite;
}

@keyframes bg-pattern-drift {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(calc(var(--bg-pattern-tile) * -1), var(--bg-pattern-tile), 0); }
}

/* Тайл паттерна крупнее на больших экранах, мельче на телефонах —
   чтобы плотность мемов соответствовала разрешению. */
@media (min-width: 640px) {
    :root { --bg-pattern-tile: 320px; }
}
@media (min-width: 1024px) {
    :root { --bg-pattern-tile: 420px; }
}

.icon { display: inline-block; line-height: 1; }
.icon img, img.icon { display: inline-block; vertical-align: middle; }

/* ===== Loading screen ===== */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: var(--bg-1);
    transition: opacity 0.25s;
}
#loading-screen.hidden { opacity: 0; pointer-events: none; }
.loader-mark {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    background:
        radial-gradient(circle at 30% 30%, var(--accent) 0%, var(--accent-warm) 70%);
    box-shadow: 0 0 60px rgba(255, 148, 37, 0.4);
    animation: loader-pulse 1.4s ease-in-out infinite;
}
@keyframes loader-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
.loader-progress {
    width: min(280px, 60vw);
    height: 8px;
    background: rgba(0,0,0,0.08);
    border-radius: 999px;
    overflow: hidden;
}
#loader-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm));
    transition: width 0.2s;
}

/* ===== Game container ===== */
#game-container {
    position: fixed;
    inset: 0;
    z-index: 1;
    width: var(--app-viewport-width);
    height: var(--app-viewport-height);
    overflow: hidden;
}

.scene {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* ===== Audio settings ===== */
.audio-settings-root {
    position: fixed;
    inset: 0;
    z-index: 1450;
    display: grid;
    place-items: center;
    padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
        max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.audio-settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(62, 38, 28, 0.58);
    backdrop-filter: blur(5px);
}
.audio-settings-card {
    position: relative;
    width: min(380px, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: 20px 18px 18px;
    border: 3px solid rgba(255, 255, 255, 0.94);
    border-radius: 24px;
    background: linear-gradient(180deg, #fffdf7 0%, #fff0d7 100%);
    box-shadow: 0 9px 0 rgba(164, 78, 24, 0.22), 0 24px 50px rgba(74, 38, 20, 0.28);
}
.audio-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}
.audio-settings-header h2 {
    font-size: clamp(24px, 6vw, 30px);
    line-height: 1;
}
.audio-settings-close {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border: 0;
    border-radius: 15px;
    background: #fff7e8;
    color: var(--accent);
    box-shadow: 0 4px 0 rgba(164, 78, 24, 0.16);
    font-size: 22px;
    cursor: pointer;
}
.audio-settings-row {
    width: 100%;
    min-height: 66px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 54px;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 9px 12px;
    border: 2px solid rgba(255, 126, 45, 0.16);
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(164, 78, 24, 0.12);
}
.audio-settings-row-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffb34f 0%, #ff7a18 100%);
    color: white;
    font-size: 24px;
}
.audio-settings-row-icon .icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: contain;
    filter: brightness(0) invert(1);
    font-family: Arial, sans-serif;
    font-size: 25px;
    line-height: 1;
    transform: translate(-1px, -1px);
}
.audio-settings-row strong { font-size: 17px; }
.audio-settings-switch {
    width: 54px;
    height: 30px;
    padding: 3px;
    border-radius: 999px;
    background: #aab4c3;
    transition: background 0.15s ease;
}
.audio-settings-switch i {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 5px rgba(20, 30, 60, 0.24);
    transition: transform 0.15s ease;
}
.audio-settings-row.is-on .audio-settings-switch { background: var(--accent); }
.audio-settings-row.is-on .audio-settings-switch i { transform: translateX(24px); }

@media (orientation: landscape) and (max-height: 520px) {
    .audio-settings-card {
        width: min(360px, 92vw);
        padding: 12px 14px 14px;
        border-radius: 20px;
    }
    .audio-settings-header { margin-bottom: 5px; }
    .audio-settings-header h2 { font-size: 22px; }
    .audio-settings-row {
        min-height: 58px;
        grid-template-columns: 42px minmax(0, 1fr) 54px;
        margin-top: 8px;
        padding: 7px 10px;
    }
    .audio-settings-row-icon { width: 42px; height: 42px; border-radius: 13px; }
    .audio-settings-row-icon .icon { width: 23px; height: 23px; }
    .audio-settings-row strong { font-size: 15px; }
    .audio-settings-close { width: 40px; height: 40px; flex-basis: 40px; }
}

/* =====================================
   HUB v2 (tab navigation)
   ===================================== */
.hub-scene-v2 {
    padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0) 0;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.hub-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
    gap: 12px;
    flex-shrink: 0;
}
.hub-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}
.hub-settings-button {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, 0.78);
    border-radius: 14px;
    background: linear-gradient(180deg, #fffaf0 0%, #ffd991 100%);
    color: var(--ink);
    box-shadow: 0 4px 0 rgba(164, 78, 24, 0.2), 0 8px 16px rgba(164, 78, 24, 0.12);
    cursor: pointer;
    padding: 0;
}
.hub-settings-button .icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    line-height: 1;
    font-family: Arial, sans-serif;
    transform: translateY(-1px);
}
.hub-settings-button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(164, 78, 24, 0.2);
}

/* === Р•РґРёРЅР°СЏ В«pillВ»-РєРЅРѕРїРєР° РґР»СЏ С‚РѕРїР±Р°СЂР° === */
.hub-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    min-height: 44px;
    font-weight: 900;
    font-size: 18px;
    color: var(--ink);
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 12px rgba(160, 100, 0, 0.18);
    cursor: pointer;
    appearance: none;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
    transition: transform 0.12s ease, filter 0.12s ease;
}
.hub-pill:active { transform: scale(0.96); }
.hub-pill:disabled { opacity: 0.55; cursor: default; }

.hub-coin-badge {
    background: linear-gradient(180deg, #fff7c2 0%, #ffd83a 100%);
    animation: coin-bob 2.6s ease-in-out infinite;
}
@keyframes coin-bob {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50%      { transform: translateY(-2px) rotate(1deg); }
}
.hub-coin-icon { animation: coin-spin 4s linear infinite; display: inline-block; font-size: 18px; }
@keyframes coin-spin {
    0%, 90%, 100% { transform: scaleX(1); }
    95% { transform: scaleX(-1); }
}

.hub-btn-ad {
    background: linear-gradient(180deg, #ff8a4c 0%, #ff5a3c 100%);
    color: white;
    text-shadow: 0 1px 0 rgba(120, 30, 0, 0.35);
    min-width: 82px;
    justify-content: center;
    font-size: clamp(12px, 3.2vw, 15px);
    padding-left: 12px;
    padding-right: 12px;
    white-space: nowrap;
}
.hub-ad-icon img, .hub-ad-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}
.hub-ad-icon img { object-fit: contain; }
.hub-ad-coin-icon img, .hub-ad-coin-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}
.hub-ad-coin-icon img { object-fit: contain; }

.hub-view {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    scrollbar-width: none;
    padding: 4px 14px 18px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.hub-view::-webkit-scrollbar { display: none; }
.hub-tab-character .hub-view {
    overflow: hidden;
    justify-content: center;
    gap: 0;
    padding-top: 0;
    padding-bottom: 8px;
}

.hub-section-title {
    margin: 16px 4px 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: white;
    font-weight: 900;
    text-shadow: 0 2px 0 rgba(160, 50, 0, 0.25);
}
.hub-section-title-big {
    font-size: 26px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: white;
    text-shadow: 0 3px 0 rgba(160, 50, 0, 0.35), 0 6px 12px rgba(0, 0, 0, 0.18);
    margin: 8px 4px 16px;
    font-weight: 900;
}

/* === Character stage === */
.hub-character-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 2px 0 6px;
    min-height: 0;
    width: 100%;
    max-width: 620px;
    align-self: center;
    flex-shrink: 0;
}

.hub-arrow {
    appearance: none;
    border: 3px solid white;
    background: linear-gradient(180deg, #fff 0%, #ffd166 100%);
    color: var(--ink);
    width: 52px;
    height: 52px;
    border-radius: 999px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(160, 100, 0, 0.18), 0 6px 16px rgba(255, 148, 37, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}
.hub-arrow:active { transform: translateY(2px) scale(0.95); }

.hub-character-area {
    display: grid;
    grid-template-rows: minmax(0, auto) auto auto auto;
    justify-items: center;
    align-items: start;
    gap: 14px;
    flex: 1;
    max-width: 360px;
    min-width: 0;
    position: relative;
}

.hub-character-portrait {
    position: relative;
    width: clamp(150px, 40vmin, 260px);
    height: clamp(150px, 40vmin, 260px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    transition: transform 0.1s;
    animation: hub-portrait-breathe 3s ease-in-out infinite;
    isolation: isolate;
    transform-origin: center bottom;
    margin-bottom: 8px;
}
/* РњСЏРіРєР°СЏ РѕРІР°Р»СЊРЅР°СЏ С‚РµРЅСЊ РїРѕРґ РїРµСЂСЃРѕРЅР°Р¶РµРј (РІРјРµСЃС‚Рѕ РєРІР°РґСЂР°С‚РЅРѕР№ РїРѕРґРєР»Р°РґРєРё). */
.hub-character-portrait::after {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 2%;
    height: 16%;
    background: radial-gradient(ellipse at center, rgba(40, 25, 70, 0.55), rgba(40, 25, 70, 0) 70%);
    border-radius: 50%;
    filter: blur(3px);
    pointer-events: none;
    z-index: 0;
    animation: hub-portrait-shadow 3s ease-in-out infinite;
}
@keyframes hub-portrait-breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.006); }
}
@keyframes hub-portrait-shadow {
    0%, 100% { transform: scaleX(1) scaleY(1); opacity: 0.9; }
    50% { transform: scaleX(0.72) scaleY(0.7); opacity: 0.45; }
}
.hub-character-portrait img {
    width: 92%;
    height: 92%;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 8px 14px rgba(40, 60, 100, 0.32)) drop-shadow(0 0 22px rgba(255, 200, 50, 0.55));
    position: relative;
    z-index: 2;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.hub-bounce { animation: hub-bounce 0.22s ease; }
@keyframes hub-bounce {
    0% { transform: scale(1); }
    40% { transform: scale(0.92); }
    100% { transform: scale(1); }
}

.hub-character-name {
    position: relative;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    max-width: min(320px, 72vw);
    padding: 3px 14px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: 0 4px 14px rgba(130, 72, 0, 0.14);
    font-size: 26px;
    font-weight: 900;
    text-align: center;
    color: var(--ink);
    text-shadow: 0 2px 0 white, 0 4px 12px rgba(255, 148, 37, 0.35);
    letter-spacing: 0;
    line-height: 1.05;
}
.hub-character-desc {
    max-width: min(340px, 82vw);
    min-height: 18px;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.25;
    text-align: center;
    font-weight: 800;
}
.hub-character-counter {
    font-size: 12px;
    color: var(--ink-mute);
    background: var(--surface);
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 700;
}
.hub-tap-hint {
    font-size: 13px;
    color: var(--ink-soft);
    text-align: center;
}
.hub-tap-hint-warn { color: var(--bad); }

.hub-float-coin {
    position: absolute;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-weight: 900;
    font-size: 26px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.25);
    pointer-events: none;
    z-index: 10;
    animation: hub-float 0.7s ease-out forwards;
}
@keyframes hub-float {
    0% { opacity: 0; transform: translate(-50%, 10px) scale(0.9); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -60px) scale(1.2); }
}

/* === Featured / quick play === */
.hub-goals {
    width: 100%;
    min-width: 0;
    max-width: 680px;
    align-self: center;
}
.hub-goals-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
}
.hub-goal-item {
    background: var(--surface);
    border-radius: 12px;
    padding: 9px 12px;
    border: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.hub-goal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.hub-goal-tag {
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.hub-goal-tag-meta {
    background: var(--surface-alt);
    color: var(--ink);
}
.hub-goal-name {
    font-size: 14px;
    font-weight: 900;
    color: var(--ink);
}
.hub-goal-desc {
    font-size: 12px;
    color: var(--ink-soft);
    font-weight: 600;
}
.hub-goal-reward {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.hub-goal-reward .icon { width: 16px; height: 16px; }
.hub-goal-empty {
    text-align: center;
    font-size: 14px;
    color: var(--ink-soft);
    padding: 7px 0;
}

/* === Games grid === */
.hub-games-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-bottom: 8px;
}
@media (min-width: 540px) {
    .hub-games-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 820px) {
    .hub-games-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.hub-game-card {
    appearance: none;
    border: 3px solid white;
    background: linear-gradient(180deg, #ffffff 0%, #fff1d4 100%);
    color: var(--ink);
    padding: 16px 10px 14px;
    border-radius: 22px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.1s;
    box-shadow: var(--shadow-card), inset 0 -4px 0 rgba(160, 100, 0, 0.06);
    position: relative;
    overflow: visible;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}
.hub-game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(120deg, transparent 8%, rgba(255,255,255,0.55) 28%, transparent 48%);
    opacity: 0;
    transform: translateX(-24%);
    pointer-events: none;
}
.hub-game-card:hover {
    transform: translateY(-2px);
}
.hub-game-card:hover::before {
    opacity: 1;
    animation: card-shine 0.7s ease-out;
}
.hub-game-card { transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s; }
.hub-game-card:hover {
    transform: translateY(-4px) rotate(-0.5deg);
    box-shadow: var(--shadow-card), 0 14px 24px rgba(255, 90, 60, 0.25);
}
.hub-game-card:active { transform: translateY(2px) scale(0.98); }
@keyframes card-shine {
    0% { transform: translateX(-45%); }
    100% { transform: translateX(45%); }
}
.hub-game-card::after {
    /* Р”РµРєРѕСЂР°С‚РёРІРЅС‹Р№ Р±Р»РёРє РІ СѓРіР»Сѓ */
    content: '';
    position: absolute;
    top: -10px;
    right: -10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
}
.hub-game-icon {
    font-size: 38px;
    line-height: 1;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--accent) 0%, var(--accent-warm) 100%);
    color: white;
    border-radius: 22px;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    box-shadow: 0 6px 0 rgba(160, 50, 0, 0.18), 0 8px 18px rgba(255, 90, 60, 0.32);
    border: 3px solid white;
    transform: rotate(-3deg);
}
.hub-game-card:nth-child(2n) .hub-game-icon { transform: rotate(3deg); background: linear-gradient(160deg, var(--accent-cool) 0%, var(--accent-purple) 100%); }
.hub-game-card:nth-child(3n) .hub-game-icon { transform: rotate(-2deg); background: linear-gradient(160deg, var(--good) 0%, #1f8e54 100%); }
.hub-game-emoji { font-size: 38px; line-height: 1; }
.hub-game-name {
    font-weight: 900;
    font-size: 15px;
    text-align: center;
    position: relative;
    z-index: 1;
    color: var(--ink);
    width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}
.hub-game-best { font-size: 11px; color: var(--ink-mute); font-weight: 800; position: relative; z-index: 1; text-transform: uppercase; letter-spacing: 0.04em; }

.hub-game-card-compact { padding: 12px 8px 10px; }
.hub-game-card-compact .hub-game-icon { width: 56px; height: 56px; }
.hub-game-card-compact .hub-game-emoji { font-size: 32px; }
.hub-game-card-compact .hub-game-name { font-size: 13px; }

.daily-reward-card {
    position: relative;
    margin: 0 auto 10px;
    width: 100%;
    max-width: 760px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fff1cf 100%);
    border: 2px solid rgba(255, 184, 77, 0.42);
    box-shadow: var(--shadow-soft);
}
.daily-reward-title {
    font-size: 15px;
    font-weight: 950;
    color: var(--ink);
}
.daily-reward-desc,
.daily-reward-meta {
    font-size: 12px;
    font-weight: 780;
    line-height: 1.2;
    color: var(--ink-soft);
}
.daily-reward-meta { color: var(--accent-warm); }
.daily-reward-meta .icon,
.daily-reward-meta img.icon {
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
    display: inline-block;
    object-fit: contain;
    vertical-align: -4px;
    margin: 0 2px;
}
.daily-reward-btn {
    appearance: none;
    border: 2px solid white;
    border-radius: 14px;
    min-height: 42px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(180deg, var(--good) 0%, #1f8e54 100%);
    color: white;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 4px 0 rgba(20, 80, 40, 0.28);
    cursor: pointer;
}
.daily-reward-btn:disabled {
    background: linear-gradient(180deg, #c9c3cf 0%, #8c8396 100%);
    box-shadow: none;
    cursor: default;
}
.daily-reward-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
.daily-map-info-btn {
    appearance: none;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.95);
    background: rgba(74, 58, 94, 0.1);
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1;
    font-weight: 950;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    justify-content: center;
}
.daily-map-info-btn:hover {
    background: var(--accent);
    color: white;
}
.daily-map {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    margin: 0;
}
.daily-map-panel {
    width: min(760px, 100%);
    margin: 0 auto 12px;
    padding: 12px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.88) 0%, rgba(255,244,223,0.92) 100%);
    border: 2px solid rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow-card);
}
.daily-map-panel[hidden] { display: none; }

/* === Карта входа — модальное окно === */
.daily-map-modal-root {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.daily-map-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 14, 32, 0.5);
    backdrop-filter: blur(4px);
}
.daily-map-modal-card {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    background: linear-gradient(180deg, #fff 0%, #fff4df 100%);
    border: 3px solid white;
    border-radius: 22px;
    padding: 20px 18px 18px;
    box-shadow: 0 24px 52px rgba(0, 0, 0, 0.26);
    color: var(--ink);
}
.daily-map-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 12px;
}
.daily-map-modal-title {
    font-size: 16px;
    font-weight: 950;
    color: var(--ink);
}
.daily-map-modal-hint {
    font-size: 11px;
    line-height: 1.2;
    color: var(--ink-mute);
    font-weight: 750;
    text-align: right;
}
.daily-map-modal-close {
    appearance: none;
    width: 100%;
    margin-top: 14px;
    border: 0;
    border-radius: 14px;
    padding: 10px 16px;
    background: rgba(42, 27, 61, 0.1);
    color: var(--ink);
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
}
.daily-map-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 10px;
}
.daily-map-title {
    font-size: 14px;
    font-weight: 950;
    color: var(--ink);
}
.daily-map-hint {
    font-size: 11px;
    line-height: 1.2;
    color: var(--ink-mute);
    font-weight: 750;
    text-align: right;
}
.daily-map-day {
    min-width: 0;
    padding: 8px 6px 9px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-soft);
    text-align: center;
}
.daily-map-day.is-current {
    border-color: var(--accent-warm);
    background: linear-gradient(180deg, #fff 0%, #ffe4b3 100%);
}
.daily-map-day.is-claimed { opacity: 0.68; }
.daily-map-label {
    font-size: 10px;
    font-weight: 950;
    color: var(--accent-warm);
    text-transform: uppercase;
}
.daily-map-reward {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.1;
    font-weight: 850;
    color: var(--ink);
}
.daily-map-reward .icon {
    width: 16px;
    height: 16px;
    max-width: 16px;
    max-height: 16px;
    display: inline-block;
    object-fit: contain;
    font-size: 14px;
    vertical-align: -4px;
    margin-right: 3px;
}

/* PNG-сундуки внутри текста наград всегда компактные. Исходное разрешение
   ассета не должно влиять на высоту строки или карточки. */
.reward-inline-icon {
    width: 22px !important;
    height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    display: inline-block !important;
    object-fit: contain;
    vertical-align: -6px;
    flex: 0 0 22px;
}
.reward-inline-icon-lg {
    width: 30px !important;
    height: 30px !important;
    max-width: 30px !important;
    max-height: 30px !important;
    flex-basis: 30px;
    vertical-align: middle;
}

/* === Tab bar === */
.hub-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    background: linear-gradient(180deg, #fff7e0 0%, #fff 100%);
    padding: 10px 8px calc(10px + env(safe-area-inset-bottom, 0));
    border-top: 3px solid white;
    box-shadow: 0 -8px 24px rgba(160, 100, 0, 0.12);
    flex-shrink: 0;
    gap: 6px;
    min-height: 72px;
}
.hub-tab {
    position: relative;
    appearance: none;
    border: 2px solid transparent;
    background: transparent;
    color: var(--ink-mute);
    padding: 8px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    border-radius: 16px;
    min-height: 60px;
    transition: transform 0.1s;
}
.hub-tab .icon { font-size: 24px; line-height: 1; }
.hub-tab span {
    max-width: 100%;
    line-height: 1.05;
    overflow-wrap: anywhere;
}
.hub-tab.active {
    color: white;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-warm) 100%);
    border-color: white;
    box-shadow: 0 4px 0 rgba(160, 50, 0, 0.22), 0 6px 14px rgba(255, 90, 60, 0.4);
    transform: translateY(-4px);
}
.hub-tab:active { transform: scale(0.96) translateY(-2px); }
.hub-tab-badge {
    position: absolute;
    top: 6px;
    right: 15%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff3f6c;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(255, 63, 108, 0.45);
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.16s, transform 0.16s;
}
.hub-tab.has-badge .hub-tab-badge {
    opacity: 1;
    transform: scale(1);
}

/* === Shop tab content === */
.shop-coins {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 18px;
    background: var(--surface);
    padding: 6px 14px;
    border-radius: 999px;
    align-self: flex-start;
    box-shadow: var(--shadow-soft);
    margin: 0 4px 12px;
}
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 14px;
    padding-bottom: 8px;
    min-width: 0;
}
@media (min-width: 540px) {
    .shop-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
}
@media (min-width: 820px) {
    .shop-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
}
.shop-card-item {
    appearance: none;
    border: 2px solid transparent;
    background: var(--surface);
    border-radius: 16px;
    min-height: 228px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.1s;
    color: var(--ink);
    cursor: pointer;
    text-align: center;
}
.character-collection-card {
    min-height: 184px;
    display: grid;
    grid-template-rows: minmax(92px, 1fr) minmax(34px, auto) auto;
    align-items: center;
    justify-items: center;
    gap: 7px;
    padding-top: 16px;
}
.shop-card-item.locked {
    background: linear-gradient(180deg, #ffffff 0%, #f0ecf5 100%);
    border-color: rgba(55, 42, 70, 0.14);
}
.shop-card-item.owned { border-color: rgba(255, 148, 37, 0.4); }
.shop-card-item.selected {
    border-color: var(--accent);
    border-width: 3px;
    box-shadow: var(--shadow-soft), 0 0 0 3px rgba(255, 148, 37, 0.25), 0 8px 22px rgba(255, 148, 37, 0.45);
    transform: translateY(-2px);
}
.shop-card-item.selected::before {
    content: '★';
    position: absolute;
    top: -10px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: linear-gradient(180deg, #ffd83a 0%, #ff8c1a 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    border: 2px solid white;
    box-shadow: 0 3px 6px rgba(160, 50, 0, 0.3);
    z-index: 2;
}
.shop-card-item { position: relative; }
.shop-card-icon {
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: end;
    border-radius: 22px;
}
.shop-card-icon img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(70, 35, 0, 0.16)); }
.shop-card-name {
    font-size: 14px; text-align: center; font-weight: 800;
    min-height: 36px; color: var(--ink);
    display: flex; align-items: center; justify-content: center;
    line-height: 1.15;
    max-width: 100%;
    overflow-wrap: anywhere;
}
.shop-card-desc {
    min-height: 50px;
    color: var(--ink-mute);
    font-size: 11px;
    line-height: 1.25;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.shop-card-btn {
    appearance: none;
    width: 100%;
    padding: 10px 6px;
    background: linear-gradient(180deg, var(--good) 0%, #1f8e54 100%);
    border: 2px solid white;
    border-radius: 12px;
    color: white;
    font-weight: 900;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 3px 0 rgba(20, 80, 40, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    line-height: 1.05;
    white-space: normal;
}
.shop-card-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(20, 80, 40, 0.35); }
.shop-card-btn:disabled {
    background: linear-gradient(180deg, #c4c4c4 0%, #8d8d8d 100%);
    color: white;
    cursor: not-allowed;
    box-shadow: 0 3px 0 rgba(60, 60, 60, 0.3);
    opacity: 0.95;
}
.shop-card-item.selected .shop-card-btn {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-warm) 100%);
    color: white;
    box-shadow: 0 3px 0 rgba(160, 50, 0, 0.3);
}
.shop-card-item.locked .shop-card-btn {
    background: linear-gradient(180deg, #565064 0%, #30283d 100%);
    box-shadow: 0 3px 0 rgba(20, 16, 28, 0.35);
}
.mystery-character-img,
.hub-character-portrait.is-mystery img,
.shop-card-item.locked .shop-card-icon img {
    filter: brightness(0.03) saturate(0.4) contrast(1.45) blur(2.5px) drop-shadow(0 10px 18px rgba(25, 18, 38, 0.48));
    opacity: 0.82;
    transform: scale(1.04);
}
.reward-modal-character-img.mystery-character-img {
    filter: brightness(0.02) saturate(0.35) contrast(1.7) blur(3.5px) drop-shadow(0 16px 24px rgba(15, 10, 25, 0.62));
    opacity: 0.78;
}
.shop-card-item.locked .shop-card-icon::after,
.hub-character-portrait.is-mystery::before,
.chest-opening-reel::after {
    content: '?';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 42px;
    font-weight: 900;
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.55);
    z-index: 4;
}
.shop-card-icon,
.chest-opening-reel {
    position: relative;
}

/* ===== Starter choice ===== */
.starter-choice-root {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.starter-choice-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 22, 48, 0.58);
    backdrop-filter: blur(4px);
}
.starter-choice-card {
    position: relative;
    width: min(360px, calc(100vw - 32px));
    max-width: 360px;
    min-width: 0;
    max-height: calc(100dvh - 28px - env(safe-area-inset-bottom, 0px));
    overflow: hidden;
    border-radius: 24px;
    border: 4px solid white;
    background: linear-gradient(180deg, #ffffff 0%, #fff1d8 100%);
    box-shadow: var(--shadow-card);
    padding: clamp(14px, 2.8dvh, 24px);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.7dvh, 14px);
}
.starter-choice-kicker {
    color: var(--accent-warm);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}
.starter-choice-title {
    color: var(--ink);
    font-size: clamp(24px, 5dvh, 38px);
    line-height: 1;
    font-weight: 1000;
    overflow-wrap: anywhere;
}
.starter-choice-subtitle {
    color: var(--ink-mute);
    font-weight: 750;
    font-size: clamp(12px, 2dvh, 15px);
}
.starter-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(8px, 1.8dvh, 14px);
    min-width: 0;
}
.starter-choice-option {
    appearance: none;
    border: 2px solid rgba(255, 184, 77, 0.32);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,224,163,0.72));
    min-height: clamp(94px, 16dvh, 126px);
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 6px 0 rgba(160, 80, 0, 0.12);
    min-width: 0;
}
.starter-choice-option:active {
    transform: translateY(2px);
    box-shadow: 0 4px 0 rgba(160, 80, 0, 0.12);
}
.starter-choice-art {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.starter-choice-art img {
    width: min(88%, 88px);
    height: min(88%, 88px);
    object-fit: contain;
    filter: drop-shadow(0 8px 10px rgba(70, 35, 0, 0.18));
}
.starter-choice-name {
    color: var(--ink);
    font-size: clamp(11px, 1.9dvh, 14px);
    font-weight: 900;
    line-height: 1.05;
    max-width: 100%;
    overflow-wrap: anywhere;
}
.starter-choice-bonus {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    align-self: center;
    color: #2b2550;
    background: rgba(255, 209, 102, 0.45);
    border: 1px solid rgba(255, 184, 77, 0.44);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: clamp(11px, 1.8dvh, 14px);
    font-weight: 850;
    max-width: 100%;
    line-height: 1.18;
}
.starter-choice-bonus .icon,
.starter-choice-bonus .icon img {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    object-fit: contain;
}
@media (max-width: 520px) {
    .starter-choice-root {
        justify-content: flex-start;
        align-items: flex-start;
        padding: calc(10px + env(safe-area-inset-top, 0px)) 10px calc(18px + env(safe-area-inset-bottom, 0px));
    }
    .starter-choice-card {
        width: 340px;
        max-width: calc(100vw - 20px);
        box-sizing: border-box;
        padding: 10px;
        gap: 7px;
        max-height: calc(100dvh - 28px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
    .starter-choice-title {
        font-size: clamp(24px, 8vw, 32px);
    }
    .starter-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .starter-choice-option {
        min-height: clamp(88px, 16dvh, 120px);
        border-radius: 15px;
        padding: 6px;
    }
    .starter-choice-art img {
        width: min(84%, 82px);
        height: min(84%, 82px);
    }
    .starter-choice-subtitle {
        font-size: 11px;
        line-height: 1.14;
    }
    .starter-choice-bonus {
        border-radius: 14px;
        padding: 7px 10px;
        font-size: 11px;
    }
}
/* Landscape (ПК/планшет горизонтально): мемы в один ряд, карточка широкая и низкая,
   чтобы контент не упирался в высоту вьюпорта и ничего не обрезалось. */
@media (orientation: landscape) {
    .starter-choice-card {
        width: min(880px, calc(100vw - 32px));
        max-width: 880px;
        padding: clamp(12px, 2.4dvh, 22px);
        gap: clamp(8px, 1.6dvh, 14px);
    }
    .starter-choice-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: clamp(7px, 1vw, 12px);
    }
    .starter-choice-option {
        min-height: clamp(96px, 22dvh, 150px);
        padding: 8px 6px;
    }
    .starter-choice-art img {
        width: min(86%, 96px);
        height: min(86%, 96px);
    }
}
@media (orientation: landscape) and (max-height: 420px) {
    .starter-choice-card {
        width: min(820px, calc(100vw - 24px));
        padding: 10px;
        gap: 6px;
    }
    .starter-choice-grid {
        gap: 7px;
    }
    .starter-choice-option {
        min-height: 100px;
        padding: 6px;
    }
    .starter-choice-art img {
        width: 72px;
        height: 72px;
    }
    .starter-choice-subtitle {
        display: none;
    }
    .starter-choice-bonus {
        border-radius: 12px;
        padding: 6px 10px;
    }
}

/* =====================================
   Mini-game scene
   ===================================== */
.minigame-scene {
    /* Прозрачный фон — в полях/зазорах вокруг игрового поля проступает
       общий дрейфующий паттерн (body::before), как в хабе. Холст игр
       рисует своё поле поверх и ничего не перекрывает. */
    background: transparent;
}
.mg-hud {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) max-content;
    align-items: center;
    justify-content: stretch;
    position: relative;
    padding: 12px 14px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
    border-bottom: 3px solid white;
    box-shadow: 0 4px 0 rgba(160, 80, 0, 0.10), 0 6px 18px rgba(160, 80, 0, 0.08);
    z-index: 5;
    flex-shrink: 0;
    gap: 10px;
}
.mg-hud-btn {
    appearance: none;
    background: linear-gradient(180deg, #fff 0%, #ffd089 100%);
    border: 3px solid white;
    color: var(--ink);
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 22px;
    cursor: pointer;
    font-weight: 900;
    box-shadow: 0 4px 0 rgba(160, 80, 0, 0.22), var(--shadow-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.mg-hud-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(160, 80, 0, 0.22); }
.mg-hud-coins, .mg-hud-score {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 900;
    font-size: 18px;
    padding: 8px 14px;
    border-radius: 999px;
    background: white;
    box-shadow: var(--shadow-soft);
    border: 2px solid var(--surface-border);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.mg-hud-coins {
    grid-column: 3;
    grid-row: 1;
    min-width: 92px;
    justify-content: center;
    justify-self: end;
    background: linear-gradient(180deg, #fff7c2 0%, #ffd83a 100%);
}
.mg-hud-score {
    position: absolute;
    left: 50%;
    top: 50%;
    min-width: 0;
    max-width: min(42vw, 220px);
    justify-content: center;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #2b2550 0%, #151a35 100%);
    border: 2px solid rgba(255,255,255,0.88);
    box-shadow: 0 5px 0 rgba(20, 15, 45, 0.24), 0 10px 22px rgba(35, 30, 70, 0.22);
    padding: 7px 16px;
    pointer-events: none;
    color: white;
    text-shadow: 0 2px 0 rgba(0,0,0,0.32);
}
.mg-score-label { display: none; }
.mg-score-value {
    font-size: clamp(24px, 5vw, 34px);
    line-height: 1;
    font-weight: 1000;
    letter-spacing: 0;
}
.mg-hud-score.score-bump {
    animation: scoreBump 0.34s ease-out;
}
.mg-score-pop {
    position: absolute;
    z-index: 12;
    top: 66px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    color: #1f1738;
    font-size: 32px;
    font-weight: 1000;
    text-shadow: 0 2px 0 rgba(255,255,255,0.82), 0 0 16px rgba(255,209,102,0.92);
    animation: scorePop 0.72s ease-out forwards;
}
@keyframes scoreBump {
    0% { transform: translate(-50%, -50%) scale(1); }
    45% { transform: translate(-50%, -50%) scale(1.18); }
    100% { transform: translate(-50%, -50%) scale(1); }
}
@keyframes scorePop {
    0% { opacity: 0; transform: translate(-50%, 12px) scale(0.7); }
    18% { opacity: 1; transform: translate(-50%, 0) scale(1.18); }
    100% { opacity: 0; transform: translate(-50%, -44px) scale(0.96); }
}
.mg-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
    background: var(--surface);
    max-height: calc(100vw * 16 / 9);
}
.mg-canvas { display: block; width: 100%; height: 100%; }

.mg-intro {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.68), rgba(255,244,222,0.84)),
        radial-gradient(circle at 18% 22%, rgba(255, 184, 77, 0.38), transparent 34%),
        radial-gradient(circle at 82% 74%, rgba(56, 182, 255, 0.28), transparent 36%);
    backdrop-filter: blur(4px);
}
.mg-intro.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}
.mg-intro-card {
    width: min(420px, 100%);
    max-height: min(560px, calc(100vh - 112px));
    overflow: hidden;
    padding: clamp(12px, 2.4dvh, 22px);
    border-radius: 24px;
    border: 4px solid white;
    background: linear-gradient(180deg, #ffffff 0%, #fff4df 100%);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(7px, 1.8dvh, 14px);
    text-align: center;
    min-height: 0;
}
.mg-intro-kicker {
    font-size: 11px;
    font-weight: 900;
    color: var(--accent-warm);
    text-transform: uppercase;
}
.mg-intro-title {
    font-size: clamp(24px, 7vw, 34px);
    font-weight: 900;
    color: var(--ink);
    line-height: 1;
}
.mg-intro-character {
    width: clamp(58px, 13dvh, 96px);
    height: clamp(58px, 13dvh, 96px);
    border-radius: 26px;
    background: linear-gradient(180deg, #fff 0%, #ffe0a3 100%);
    border: 3px solid white;
    box-shadow: 0 8px 0 rgba(160, 80, 0, 0.12), var(--shadow-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.mg-intro-character img {
    width: 86%;
    height: 86%;
    object-fit: contain;
    filter: drop-shadow(0 8px 8px rgba(70, 35, 0, 0.18));
}
.mg-intro-character-fallback { font-size: 46px; font-weight: 900; }
.mg-intro-rules {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1.3dvh, 10px);
    overflow: hidden;
    min-height: 0;
}
.mg-intro-rule {
    display: grid;
    grid-template-columns: 32px 1fr;
    align-items: center;
    gap: 12px;
    padding: clamp(7px, 1.4dvh, 11px) clamp(9px, 1.8dvh, 13px);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 184, 77, 0.28);
    color: var(--ink);
    font-weight: 750;
    text-align: left;
    line-height: 1.12;
    font-size: clamp(11px, 1.75dvh, 14px);
}
.mg-intro-rule-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    font-weight: 900;
    box-shadow: 0 3px 0 rgba(160, 80, 0, 0.22);
}
.mg-intro-start {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-warm));
    color: white;
    border-color: transparent;
    min-height: clamp(42px, 7dvh, 58px);
    font-size: clamp(13px, 2.1dvh, 17px);
    box-shadow: 0 6px 0 rgba(160, 80, 0, 0.28), 0 10px 22px rgba(255, 124, 24, 0.36);
    animation: mg-start-glow 2s ease-in-out infinite;
}
.mg-intro-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 8px;
    flex-shrink: 0;
}
.mg-intro-back {
    background: rgba(255,255,255,0.88);
    min-height: 46px;
    width: 46px;
    padding: 0;
    border-radius: 14px;
    font-size: 20px;
    box-shadow: 0 3px 0 rgba(90, 70, 40, 0.12);
}
@keyframes mg-start-glow {
    0%, 100% { filter: saturate(1); }
    50% { filter: saturate(1.18) brightness(1.04); }
}

.mg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(30, 50, 80, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 10;
    backdrop-filter: blur(3px);
}
.mg-overlay.hidden { display: none; }
.mg-overlay-card {
    background: var(--surface);
    border-radius: 26px;
    padding: 24px;
    width: min(380px, 100%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
    box-shadow: var(--shadow-card);
    border: 4px solid white;
    animation: overlay-pop 0.4s cubic-bezier(.34,1.56,.64,1) both;
    position: relative;
    overflow: visible;
}
@keyframes overlay-pop {
    0% { transform: scale(0.6) rotate(-4deg); opacity: 0; }
    70% { transform: scale(1.04) rotate(1deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
.mg-overlay-title {
    font-size: 28px;
    font-weight: 900;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 0 white, 0 4px 8px rgba(255,148,37,0.35);
}
.mg-confetti {
    position: absolute;
    inset: 0;
    overflow: visible;
    pointer-events: none;
}
.mg-confetti span {
    position: absolute;
    width: 10px;
    height: 14px;
    border-radius: 3px;
    top: 30%;
    left: 50%;
    animation: confetti-fall 1.2s ease-out forwards;
}
@keyframes confetti-fall {
    0%   { opacity: 1; transform: translate(0,0) rotate(0); }
    100% { opacity: 0; transform: translate(var(--cx, 0), var(--cy, 120px)) rotate(var(--rot, 180deg)); }
}
.mg-overlay-row { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 16px; color: var(--ink); }
.mg-record { color: var(--accent); font-weight: 800; font-size: 13px; }
.mg-overlay-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.mg-btn {
    appearance: none;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--surface-border);
    background: var(--surface-alt);
    color: var(--ink);
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
}
.mg-btn:active { transform: scale(0.98); }
.mg-btn:disabled { opacity: 0.55; cursor: default; }
.mg-btn-ad {
    align-self: center;
    width: min(228px, 100%);
    background: linear-gradient(135deg, #37b6ff 0%, var(--accent) 62%, var(--accent-warm) 100%);
    color: white;
    border-color: transparent;
    font-size: 13.5px;
    padding: 8px 12px;
    min-height: 42px;
    position: relative;
    overflow: hidden;
    animation: mg-ad-pulse 1.55s ease-in-out infinite;
}
.mg-overlay-actions .mg-btn-ad {
    order: -1;
    margin-bottom: 0;
    align-self: stretch;
    width: 100%;
    min-height: 52px;
    padding: 11px 14px;
    font-size: 16px;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 5px 0 rgba(20, 80, 150, 0.24), 0 10px 22px rgba(55, 182, 255, 0.24);
}
.mg-btn-double {
    flex-direction: row;
    line-height: 1;
    border-radius: 13px;
    gap: 7px;
}
.mg-btn-double .mg-ad-icon,
.mg-btn-double .mg-ad-icon img {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
}
.mg-btn-ad::after {
    content: '';
    position: absolute;
    inset: -40% auto -40% -35%;
    width: 34%;
    transform: rotate(18deg);
    background: rgba(255,255,255,0.38);
    animation: mg-ad-shine 2.1s ease-in-out infinite;
}
.mg-ad-icon img { width: 14px; height: 14px; object-fit: contain; vertical-align: middle; }
.mg-btn-replay {
    background: linear-gradient(180deg, #2bdc7f 0%, #1f9a5d 100%);
    color: white;
    border-color: white;
    font-size: 17px;
    min-height: 52px;
    box-shadow: 0 5px 0 rgba(18, 92, 50, 0.32), 0 8px 18px rgba(43, 220, 127, 0.24);
}
.mg-btn-quiet {
    background: transparent;
    border-color: rgba(74, 58, 94, 0.16);
    color: var(--ink-mute);
    box-shadow: none;
    min-height: 38px;
    font-size: 13px;
}
@keyframes mg-ad-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 148, 37, 0.28); }
    50% { box-shadow: 0 0 0 6px rgba(255, 148, 37, 0); }
}
@keyframes mg-ad-shine {
    0%, 38% { left: -35%; }
    62%, 100% { left: 112%; }
}

/* ===== Edible mini-game ===== */
.mg-edible {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
    gap: 14px;
    align-items: stretch;
    background: var(--bg-1);
}
.ed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.ed-lives { display: inline-flex; gap: 4px; font-size: 22px; }
.ed-streak { color: var(--ink-soft); font-weight: 800; }
.ed-timer {
    flex: 1;
    height: 10px;
    background: var(--surface);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}
.ed-timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--good), var(--accent));
    transition: width 0.1s linear;
}
.ed-timer-fill.warn { background: linear-gradient(90deg, var(--accent-warm), var(--bad)); }

.ed-arena {
    position: relative;
    flex: 1;
    display: grid;
    grid-template-columns: minmax(60px, 0.22fr) minmax(0, 1fr) minmax(60px, 0.22fr);
    align-items: stretch;
    gap: 8px;
    min-height: 0;
}
.ed-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 18px;
    border: 3px dashed transparent;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow-soft);
    color: var(--ink-soft);
    font-weight: 800;
    font-size: 12px;
    padding: 8px 4px;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    text-align: center;
    overflow: hidden;
}
.ed-zone .ed-zone-icon { font-size: 26px; line-height: 1; }
.ed-trash-icon { font-size: 30px; }
.ed-zone-no { color: var(--bad); border-color: rgba(255, 63, 108, 0.35); }
.ed-zone-yes { color: var(--good); border-color: rgba(43, 189, 110, 0.35); }
.ed-zone:active { transform: scale(0.98); }
.ed-zone.active { transform: scale(1.04); }
.ed-zone-no.active { background: rgba(255, 63, 108, 0.2); border-color: var(--bad); }
.ed-zone-yes.active { background: rgba(43, 189, 110, 0.2); border-color: var(--good); }

.ed-card-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    min-height: 0;
}
/* РџРµСЂСЃРѕРЅР°Р¶ С‚РµРїРµСЂСЊ РІРЅСѓС‚СЂРё yes-Р·РѕРЅС‹ */
.ed-character {
    width: clamp(44px, 11vmin, 72px);
    height: clamp(44px, 11vmin, 72px);
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(40, 60, 100, 0.28));
    transform-origin: 50% 80%;
    flex-shrink: 0;
}
.ed-character-img { width: 100%; height: 100%; object-fit: contain; }
.ed-character.mood-yum { animation: ed-char-yum 0.55s ease-out; }
.ed-character.mood-yuck { animation: ed-char-yuck 0.55s ease-out; }
.ed-character.mood-sad { animation: ed-char-sad 0.55s ease-out; }
.ed-character.mood-wave { animation: ed-char-wave 0.55s ease-out; }
.ed-character.mood-hungry { animation: ed-char-hungry 0.4s ease-in-out infinite alternate; }
.ed-character.mood-idle { animation: none; }
@keyframes ed-char-yum {
    0% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-10px) scale(1.22); }
    100% { transform: translateY(0) scale(1); }
}
@keyframes ed-char-wave {
    0%, 100% { transform: rotate(0); }
    30% { transform: rotate(-10deg); }
    70% { transform: rotate(10deg); }
}
@keyframes ed-char-yuck {
    0% { transform: translateY(0) rotate(0); }
    40% { transform: translateY(-4px) rotate(-14deg) scale(0.9); }
    100% { transform: translateY(0) rotate(0); }
}
@keyframes ed-char-sad {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(6px) scale(0.92); }
    100% { transform: translateY(0) scale(1); }
}
@keyframes ed-char-hungry {
    0% { transform: scale(1) rotate(-4deg); }
    100% { transform: scale(1.08) rotate(4deg); }
}

.ed-card {
    position: relative;
    flex: 1;
    background: var(--surface);
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2.2vmin, 16px);
    padding: clamp(16px, 3vmin, 22px);
    transition: background 0.2s, transform 0.05s linear;
    box-shadow: var(--shadow-card);
    min-height: 0;
    border: 3px solid white;
    user-select: none;
    cursor: grab;
}
.ed-card.ed-grabbed { cursor: grabbing; transition: none; }
.ed-card.ed-correct {
    background: linear-gradient(180deg, rgba(43,189,110,0.55), rgba(43,189,110,0.15));
    border-color: #2bbd6e;
    box-shadow: 0 0 0 4px rgba(43,189,110,0.5), var(--shadow-card);
    animation: ed-flash-correct 0.28s ease-out;
}
.ed-card.ed-wrong {
    background: linear-gradient(180deg, rgba(233,79,79,0.55), rgba(233,79,79,0.15));
    border-color: #e94f4f;
    box-shadow: 0 0 0 4px rgba(233,79,79,0.5), var(--shadow-card);
    animation: ed-flash-wrong 0.28s ease-out;
}
@keyframes ed-flash-correct {
    0% { background: rgba(43,189,110,0.85); }
    100% { background: rgba(43,189,110,0.55); }
}
@keyframes ed-flash-wrong {
    0% { background: rgba(233,79,79,0.85); }
    100% { background: rgba(233,79,79,0.55); }
}
.ed-card[data-swipe="yes"] { box-shadow: 0 0 0 4px rgba(43, 189, 110, 0.4), var(--shadow-card); }
.ed-card[data-swipe="no"]  { box-shadow: 0 0 0 4px rgba(255, 63, 108, 0.4), var(--shadow-card); }
.ed-card::before, .ed-card::after {
    position: absolute;
    top: 18px;
    font-size: 22px;
    font-weight: 900;
    padding: 6px 14px;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s;
    border: 3px solid currentColor;
}
.ed-card::before {
    content: '✕ НЕТ';
    left: 14px;
    color: var(--bad);
    transform: rotate(-12deg);
}
.ed-card::after {
    content: 'ДА ✓';
    right: 14px;
    color: var(--good);
    transform: rotate(12deg);
}
.ed-card[data-swipe="yes"]::after { opacity: 1; }
.ed-card[data-swipe="no"]::before { opacity: 1; }

.ed-question {
    width: 100%;
    font-size: 18px;
    color: var(--ink-soft);
    font-weight: 800;
    text-align: center;
    line-height: 1.16;
}
.ed-icon-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 3vmin, 22px);
    min-height: 0;
    max-width: 100%;
}
.ed-icon {
    width: min(18vmin, 88px);
    height: min(18vmin, 88px);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}
.ed-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.ed-name { font-size: 18px; font-weight: 800; text-align: center; min-height: 26px; line-height: 1.14; }
.ed-name.hidden { visibility: hidden; }
.ed-feedback { min-height: 28px; font-size: 22px; font-weight: 900; color: var(--accent); text-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.ed-card.ed-correct .ed-feedback { color: #1a9c58; }
.ed-card.ed-wrong .ed-feedback { color: #c0392b; font-size: 16px; }

.ed-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ed-btn {
    appearance: none;
    padding: 16px;
    border-radius: 16px;
    border: none;
    color: white;
    font-weight: 800;
    font-size: 18px;
    cursor: pointer;
    min-height: 64px;
    box-shadow: var(--shadow-soft);
}
.ed-btn-no { background: linear-gradient(135deg, var(--bad), #c0392b); }
.ed-btn-yes { background: linear-gradient(135deg, var(--good), #1f8e54); }
.ed-btn:active { transform: scale(0.97); }

/* ===== Whack-a-meme ===== */
.mg-whack {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 14px;
    gap: 12px;
    background: var(--bg-1);
}
.wh-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border-radius: 14px;
    padding: 10px 16px;
    box-shadow: var(--shadow-soft);
}
.wh-timer { font-size: 22px; font-weight: 900; color: var(--accent); }
.wh-target { display: inline-flex; align-items: center; gap: 6px; }
.wh-target img { width: 36px; height: 36px; object-fit: contain; }
.wh-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(var(--wh-cols, 3), minmax(0, 1fr));
    gap: 10px;
    align-content: center;
    justify-content: center;
    place-items: center;
    width: 100%;
    max-width: min(540px, 90vmin);
    max-height: 100%;
    margin: 0 auto;
    min-height: 0;
}
.wh-cell {
    appearance: none;
    border: 3px solid white;
    background:
        radial-gradient(circle at 50% 30%, rgba(255,255,255,0.8), rgba(255,255,255,0) 70%),
        linear-gradient(180deg, #ffe7c2 0%, #ffd089 100%);
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 5px 0 rgba(160, 80, 0, 0.2), var(--shadow-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background 0.1s;
    min-height: 0;
    aspect-ratio: 1 / 1;
    width: 100%;
}
.wh-cell img { width: 86%; height: 86%; object-fit: contain; }
.wh-target img { width: 54px; height: 54px; object-fit: contain; }
.wh-cell.wh-trap-cell {
    background: linear-gradient(180deg, #fff4f4 0%, #ffd0d0 100%);
    border-color: rgba(233, 79, 79, 0.45);
}
.wh-cell.wh-trap-cell img {
    width: 76%;
    height: 76%;
    filter: drop-shadow(0 5px 7px rgba(160, 20, 20, 0.25));
}
.wh-cell:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(160, 80, 0, 0.2); }
.wh-cell.wh-hit { background: rgba(43,189,110,0.5); }
.wh-cell.wh-miss { background: rgba(233,79,79,0.5); }
.wh-pop { animation: wh-pop 0.2s ease-out; }
@keyframes wh-pop {
    0% { transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ===== Memory ===== */
.mg-memory {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 14px;
    gap: 12px;
    background: var(--bg-1);
}
.mm-header {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border-radius: 14px;
    padding: 8px 14px;
    box-shadow: var(--shadow-soft);
}
.mm-level { font-weight: 800; color: var(--ink); white-space: nowrap; }
.mm-timer-bar {
    flex: 1;
    height: 10px;
    background: var(--surface-alt);
    border-radius: 999px;
    overflow: hidden;
}
.mm-timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--good), var(--accent));
    transition: width 0.1s linear;
    border-radius: 999px;
}
.mm-timer-fill.warn {
    background: linear-gradient(90deg, #ff6b6b, #ff3366);
    animation: timer-pulse 0.5s ease-in-out infinite alternate;
}
@keyframes timer-pulse {
    from { opacity: 1; }
    to { opacity: 0.6; }
}
.mm-timer-label { font-weight: 900; color: var(--accent); font-size: 18px; min-width: 28px; text-align: right; }
.mm-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(var(--mm-cols, 4), minmax(0, 1fr));
    gap: 8px;
    align-content: center;
    justify-content: center;
    place-items: center;
}
.mm-grid > .mm-card { width: 100%; max-width: 140px; }
.mm-card {
    appearance: none;
    border: none;
    padding: 0;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    perspective: 800px;
    background: transparent;
    aspect-ratio: 1 / 1;
}
.mm-card-back, .mm-card-face {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s;
    box-shadow: var(--shadow-soft);
    border: 3px solid white;
}
.mm-card-back {
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.3), transparent 60%),
        linear-gradient(135deg, var(--accent-cool), #1c7eb6);
    color: white;
    transform: rotateY(0);
}
.mm-card-back::after { content: '★'; font-size: 36px; color: white; font-weight: 900; text-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.mm-card-face {
    background: var(--surface);
    transform: rotateY(180deg);
    padding: 6px;
}
.mm-card-face img { width: 88%; height: 88%; object-fit: contain; }
.mm-card.mm-flipped .mm-card-back { transform: rotateY(180deg); }
.mm-card.mm-flipped .mm-card-face { transform: rotateY(360deg); }
.mm-card.mm-matched .mm-card-face { background: linear-gradient(180deg, rgba(43,189,110,0.25), rgba(43,189,110,0.10)); }

/* ===== Catch intro ===== */
.mg-catch { position: relative; height: 100%; }
.catch-wrap { position: absolute; inset: 0; }
.catch-intro {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255, 243, 194, 0.92), rgba(255, 176, 119, 0.88));
    transition: opacity 0.3s;
    padding: 20px;
}
.catch-intro.hidden { opacity: 0; pointer-events: none; }
.catch-intro-card {
    background: white;
    border: 3px solid white;
    box-shadow: var(--shadow-card);
    border-radius: 22px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    width: min(360px, 100%);
}
.catch-intro-title { font-size: 22px; font-weight: 900; color: var(--ink); }
.catch-intro-rows { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.catch-intro-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--surface-alt);
    border-radius: 14px;
    font-weight: 700;
}
.catch-halo {
    width: 32px; height: 32px; border-radius: 50%;
    display: inline-block;
}
.catch-halo.good { background: radial-gradient(circle, rgba(43,189,110,0.85), rgba(43,189,110,0.2)); }
.catch-halo.bad  { background: radial-gradient(circle, rgba(255,63,108,0.85), rgba(255,63,108,0.2)); }
.catch-intro-hint { font-size: 13px; color: var(--ink-mute); text-align: center; }
.catch-intro-start {
    appearance: none;
    border: 3px solid white;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-warm) 100%);
    color: white;
    font-weight: 900;
    font-size: 18px;
    padding: 12px 32px;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 5px 0 rgba(160, 50, 0, 0.3);
}
.catch-intro-start:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(160, 50, 0, 0.3); }

/* ===== Score/coin animations ===== */
.hub-coin-badge.pulse { animation: coin-pulse 0.35s ease; }
@keyframes coin-pulse {
    0% { transform: scale(1); }
    35% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* РђРєС‚РёРІРЅС‹Р№ С‚Р°Р± вЂ” Р»С‘РіРєР°СЏ РїСѓР»СЊСЃР°С†РёСЏ */
.hub-tab.active .icon { animation: tab-icon-bounce 1.4s ease-in-out infinite; }
@keyframes tab-icon-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* РљР°СЂС‚РѕС‡РєР° РёРіСЂС‹ вЂ” Р»С‘РіРєРѕРµ РїРѕРєР°С‡РёРІР°РЅРёРµ РёРєРѕРЅРєРё */
.hub-game-card .hub-game-icon { animation: card-icon-wiggle 6s ease-in-out infinite; }
.hub-game-card:nth-child(2n) .hub-game-icon { animation-delay: 0.5s; }
.hub-game-card:nth-child(3n) .hub-game-icon { animation-delay: 1s; }
@keyframes card-icon-wiggle {
    0%, 90%, 100% { transform: rotate(-3deg); }
    45% { transform: rotate(-3deg) translateY(-2px); }
    60% { transform: rotate(3deg) translateY(0); }
}

/* Floating star sparkle when tapping character */
.hub-spark {
    position: absolute;
    pointer-events: none;
    font-size: 20px;
    animation: hub-spark-fly 0.6s ease-out forwards;
}
@keyframes hub-spark-fly {
    0%   { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(0.6); }
    100% { opacity: 0; transform: translate(var(--dx, 30px), var(--dy, -40px)) rotate(180deg) scale(1.4); }
}

/* ===== Adaptive ===== */
@media (max-width: 380px) {
    .hub-arrow { width: 42px; height: 42px; font-size: 20px; }
    .hub-game-icon { width: 50px; height: 50px; }
    .hub-game-emoji { font-size: 30px; }
    .hub-topbar { padding: 8px 10px 4px; }
    .hub-coin-badge { padding: 8px 14px; font-size: 18px; }
    .hub-view { padding-inline: 10px; }
    .hub-goals-list { gap: 5px; }
    .hub-game-card-compact { padding: 10px 5px 8px; }
    .hub-game-card-compact .hub-game-name { font-size: 12px; }
    .hub-game-best { font-size: 10px; }
}

@media (orientation: landscape) and (max-height: 520px) {
    .hub-topbar {
        padding: 6px 10px 4px;
    }
    .hub-coin-badge {
        min-height: 40px;
        padding: 7px 14px;
        font-size: 18px;
    }
    .hub-btn {
        min-height: 40px;
        padding: 8px 12px;
    }
    .hub-tab-character .hub-view {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        padding: 2px 12px 8px;
    }
    .hub-character-stage,
    .hub-goals {
        max-width: none;
    }
    .hub-character-stage {
        gap: 6px;
        padding: 0;
    }
    .hub-character-portrait {
        width: min(36vh, 190px);
        height: min(36vh, 190px);
        border-radius: 22px;
    }
    .hub-character-name {
        font-size: clamp(18px, 5vh, 24px);
    }
    .hub-character-counter,
    .hub-tap-hint {
        font-size: 11px;
    }
    .hub-section-title {
        margin: 0 2px 8px;
        font-size: 11px;
    }
    .hub-goals-list {
        gap: 6px;
    }
    .hub-goal-item { padding: 7px 10px; }
    .hub-goal-name { font-size: 13px; }
    .hub-tabs {
        min-height: 58px;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0));
    }
    .hub-tab {
        min-height: 44px;
        padding: 4px 2px;
        font-size: 11px;
        gap: 2px;
    }
    .hub-tab .icon {
        font-size: 21px;
    }
}

@media (orientation: landscape) and (max-height: 360px) {
    .hub-tab-character .hub-view {
        gap: 0;
    }
    .hub-character-portrait {
        width: min(32vh, 150px);
        height: min(32vh, 150px);
    }
    .hub-character-area {
        gap: 4px;
    }
    .hub-tap-hint {
        display: none;
    }
    .hub-arrow {
        width: 40px;
        height: 40px;
    }

    .mg-hud {
        padding: 6px 14px;
    }
    .mg-hud-btn {
        width: 42px;
        height: 42px;
    }
    .mg-hud-score {
        min-width: 0;
        padding: 5px 12px;
        font-size: 15px;
    }
    .mg-hud-coins {
        min-width: 66px;
        padding: 7px 8px;
        font-size: 15px;
    }
    .mg-score-label {
        display: none;
    }
    .mg-score-pop {
        top: 54px;
        font-size: 26px;
    }
    .mg-intro {
        padding: 8px;
    }
    .mg-intro-card {
        max-height: calc(100dvh - 54px);
        padding: 10px;
        gap: 7px;
        border-radius: 18px;
    }
    .mg-intro-character {
        display: none;
        width: 58px;
        height: 58px;
        border-radius: 18px;
    }
    .mg-intro-rule {
        min-height: 38px;
        padding: 7px 9px;
        font-size: 12.5px;
        gap: 9px;
    }
    .mg-intro-title {
        font-size: 22px;
    }
    .mg-edible {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(140px, 0.42fr);
        grid-template-rows: auto minmax(0, 1fr);
        padding: 8px 14px;
        gap: 8px;
        align-items: stretch;
    }
    .ed-header {
        grid-column: 1 / -1;
        gap: 10px;
    }
    .ed-card {
        padding: 10px;
        gap: 10px;
        border-radius: 16px;
    }
    .ed-question {
        font-size: 16px;
    }
    .ed-icon {
        width: min(12vh, 52px);
        height: min(12vh, 52px);
    }
    .ed-name {
        font-size: 16px;
    }
    .ed-buttons {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 8px;
        min-height: 0;
    }
    .ed-btn {
        min-height: 0;
        padding: 8px;
        font-size: 16px;
    }
    .mg-whack {
        padding: 8px 14px;
        gap: 8px;
    }
    .wh-header {
        padding: 8px 14px;
        min-height: 44px;
    }
    .wh-grid {
        gap: 6px;
        grid-template-rows: repeat(var(--wh-rows, 3), minmax(0, 1fr));
        align-content: stretch;
        place-items: stretch;
        max-width: none;
    }
    .wh-cell {
        aspect-ratio: auto;
    }
    .mg-memory {
        padding: 8px 14px;
        gap: 8px;
    }
    .mm-header {
        padding: 7px 14px;
        min-height: 42px;
    }
    .mm-grid {
        grid-template-rows: repeat(var(--mm-rows, 3), minmax(0, 1fr));
        gap: 6px;
        align-content: stretch;
        place-items: stretch;
        min-height: 0;
    }
    .mm-grid > .mm-card {
        width: 100%;
        max-width: none;
    }
    .mm-card {
        aspect-ratio: auto;
        min-height: 0;
    }
    .catch-intro {
        padding: 8px 14px;
    }
    .catch-intro-card {
        width: min(520px, 100%);
        max-height: 100%;
        padding: 10px;
        gap: 8px;
    }
    .catch-intro-title {
        font-size: 18px;
    }
    .catch-intro-rows {
        flex-direction: row;
        gap: 8px;
    }
    .catch-intro-row {
        flex: 1;
        padding: 8px 10px;
        gap: 8px;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    body::before,
    .hub-character-portrait,
    .loader-mark {
        animation: none;
    }
    .hub-game-card:hover::before {
        animation: none;
    }
}

/* === Hub chests row === */
.hub-chests {
    margin-top: 8px;
    width: 100%;
    max-width: 760px;
    align-self: center;
    flex-shrink: 0;
}
.hub-chests-shop {
    margin-top: 0;
    padding-bottom: 12px;
}
.hub-chests-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.hub-owned-chests-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.hub-owned-chests-strip::-webkit-scrollbar { display: none; }
.hub-owned-chest-chip {
    appearance: none;
    border: 2px solid rgba(255,255,255,0.9);
    border-radius: 14px;
    min-width: 116px;
    min-height: 70px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--ink);
    font-weight: 950;
    background: linear-gradient(180deg, #fff8ea 0%, #ffd89a 100%);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
}
.hub-owned-chest-chip .hub-chest-icon {
    width: 42px;
    height: 42px;
}
.hub-owned-chest-count {
    min-width: 34px;
    padding: 5px 9px;
    border-radius: 999px;
    color: white;
    background: var(--accent);
    box-shadow: 0 2px 0 rgba(120, 60, 0, 0.22);
}
.hub-owned-chest-chip.hub-chest-common { background: linear-gradient(180deg, #fff8ea 0%, #f3d6a7 100%); }
.hub-owned-chest-chip.hub-chest-rare { background: linear-gradient(180deg, #f7fbff 0%, #d7e6f4 100%); }
.hub-owned-chest-chip.hub-chest-epic { background: linear-gradient(180deg, #fff6c8 0%, #ffc35a 100%); }
.shop-section-title {
    margin: 12px 4px 8px;
    font-size: 12px;
    color: white;
    font-weight: 950;
    text-transform: uppercase;
    text-shadow: 0 2px 0 rgba(160, 50, 0, 0.28);
}
.shop-empty {
    grid-column: 1 / -1;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 850;
    text-align: center;
}
.hub-chest-card {
    background: linear-gradient(180deg, #ffffff 0%, #fff4df 100%);
    border: 2px solid rgba(255, 148, 37, 0.22);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    padding: 10px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 8px 10px;
    align-items: center;
}
.hub-chest-preview {
    appearance: none;
    border: 0;
    background: rgba(255, 255, 255, 0.74);
    border-radius: 14px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 66px;
    cursor: pointer;
    color: var(--ink);
    font-weight: 800;
    border: 2px solid rgba(255, 255, 255, 0.9);
}
.hub-chest-preview:not(:disabled):hover { transform: translateY(-1px); }
.hub-chest-preview:disabled { opacity: 0.55; cursor: not-allowed; }
.hub-chest-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    color: var(--chest-color, #a06a3a);
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
}
.hub-chest-icon .icon,
.hub-chest-icon .icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}
.hub-chest-common .hub-chest-preview { background: linear-gradient(180deg, #fff8ea 0%, #f3d6a7 100%); }
.hub-chest-rare .hub-chest-preview { background: linear-gradient(180deg, #f7fbff 0%, #d7e6f4 100%); }
.hub-chest-epic .hub-chest-preview { background: linear-gradient(180deg, #fff6c8 0%, #ffc35a 100%); }
.hub-chest-ad .hub-chest-preview { background: linear-gradient(180deg, #e8f8ff 0%, #bdeaff 100%); }
.hub-chest-card {
    position: relative;
    overflow: hidden;
}
.hub-chest-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.42) 42%, transparent 64%);
    transform: translateX(-120%);
    pointer-events: none;
    animation: hub-card-shine 5.4s ease-in-out infinite;
}
.hub-chest-card:nth-child(2)::after { animation-delay: 0.7s; }
.hub-chest-card:nth-child(3)::after { animation-delay: 1.4s; }
.hub-chest-card:nth-child(4)::after { animation-delay: 2.1s; }
@keyframes hub-card-shine {
    0%, 72% { transform: translateX(-120%); }
    92%, 100% { transform: translateX(120%); }
}
.hub-chest-body { min-width: 0; text-align: left; }
.hub-chest-label { font-size: 13px; color: var(--ink); font-weight: 900; }
.hub-chest-desc {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.25;
    color: var(--ink-mute);
    font-weight: 700;
}
.hub-chest-meta {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 900;
    color: var(--accent);
}
.hub-chest-price {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.hub-chest-price .icon,
.hub-chest-price .icon img {
    width: 16px;
    height: 16px;
    max-width: 16px;
    max-height: 16px;
    flex: 0 0 16px;
    object-fit: contain;
    font-size: 16px;
}
.hub-chest-count { font-size: 12px; }
.hub-chest-action {
    appearance: none;
    grid-column: 1 / -1;
    border: 0;
    border-radius: 12px;
    padding: 9px 10px;
    color: white;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-warm) 100%);
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(160, 50, 0, 0.28);
}
.hub-chest-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
}
.hub-chest-action-ad {
    background: linear-gradient(180deg, #38b6ff 0%, #1f7fd1 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.hub-chest-action-ad .icon,
.hub-chest-action-ad .icon img {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}
.hub-chest-action:disabled {
    background: linear-gradient(180deg, #c8c1cf 0%, #8c8198 100%);
    cursor: not-allowed;
    box-shadow: 0 3px 0 rgba(60, 52, 70, 0.25);
}
.chest-opening-coin {
    width: 132px;
    height: 132px;
    margin: 0 auto;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #fff8d8 0%, #ffbf3f 100%);
    box-shadow: inset 0 0 0 3px rgba(255,255,255,0.85), 0 16px 30px rgba(145, 90, 0, 0.24);
    animation: chest-coin-pop 0.72s ease-in-out infinite alternate;
}
.chest-opening-coin .icon,
.chest-opening-coin .icon img {
    width: 64px;
    height: 64px;
    font-size: 64px;
    display: block;
    object-fit: contain;
    line-height: 1;
}
@keyframes chest-coin-pop {
    from { transform: translateY(0) scale(0.96); }
    to { transform: translateY(-5px) scale(1.02); }
}

/* === Chest purchase modal === */
.chest-buy-modal-root {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.chest-buy-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 14, 32, 0.5);
    backdrop-filter: blur(4px);
}
.chest-buy-card {
    position: relative;
    z-index: 1;
    width: min(380px, 100%);
    background: linear-gradient(180deg, #fff 0%, #fff4df 100%);
    border: 3px solid white;
    border-radius: 22px;
    padding: 22px 18px 18px;
    box-shadow: 0 24px 52px rgba(0, 0, 0, 0.26);
    text-align: center;
    color: var(--ink);
}
.chest-buy-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: rgba(42, 27, 61, 0.12);
    color: var(--ink);
    font-weight: 900;
}
.chest-buy-icon {
    width: 82px;
    height: 82px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--chest-color, #a06a3a);
    font-size: 48px;
    box-shadow: var(--shadow-soft);
}
.chest-buy-icon .icon,
.chest-buy-icon .icon img {
    width: 64px;
    height: 64px;
    display: block;
    object-fit: contain;
}
.chest-buy-title {
    font-size: 24px;
    font-weight: 900;
}
.chest-buy-desc {
    margin: 6px auto 10px;
    max-width: 300px;
    font-size: 14px;
    line-height: 1.3;
    color: var(--ink-soft);
    font-weight: 800;
}
.chest-buy-price {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #fff7c2;
    color: var(--accent);
    font-size: 18px;
    font-weight: 900;
    margin-bottom: 14px;
}
.chest-buy-price .icon,
.chest-buy-price .icon img {
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
    flex: 0 0 18px;
    object-fit: contain;
    font-size: 18px;
}
.chest-buy-action {
    appearance: none;
    width: 100%;
    border: 0;
    border-radius: 14px;
    padding: 13px 16px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-warm) 100%);
    color: white;
    font-size: 17px;
    font-weight: 900;
    box-shadow: 0 4px 0 rgba(160, 50, 0, 0.28);
}
.chest-buy-action:disabled {
    background: linear-gradient(180deg, #c8c1cf 0%, #8c8198 100%);
}

/* === Reward modal === */
.reward-modal-root {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    animation: reward-fade-in 0.22s ease-out;
}
.reward-modal-root.closing { animation: reward-fade-out 0.22s ease-in forwards; }
@keyframes reward-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes reward-fade-out { to { opacity: 0; transform: scale(0.96); } }
.reward-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 14, 32, 0.55);
    backdrop-filter: blur(4px);
}
.reward-modal-card {
    position: relative;
    z-index: 2;
    background: linear-gradient(180deg, #fff 0%, #fff7e8 100%);
    border-radius: 28px;
    padding: 28px 32px 22px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
    max-width: min(520px, calc(100vw - 32px));
    max-height: min(92vh, 720px);
    width: 90%;
    overflow: hidden;
    animation: reward-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes reward-pop {
    0% { transform: scale(0.4); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.reward-modal-icon {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 4px auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 96px;
    line-height: 1;
    animation: reward-icon-bob 1.6s ease-in-out infinite;
}
.reward-modal-character-img,
.reward-modal-character-emoji {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 12px 18px rgba(40, 60, 100, 0.35));
}
.reward-modal-character-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 96px;
}
.reward-modal-character-locked .reward-modal-icon::after {
    content: '?';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 72px;
    font-weight: 900;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.75);
}
.reward-modal-chest-art {
    width: 104px;
    height: 104px;
    display: grid;
    place-items: center;
    color: var(--chest-color, #a06a3a);
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.25));
}
.reward-modal-chest-art .icon,
.reward-modal-chest-art .icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}
@keyframes reward-icon-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.reward-modal-title {
    font-size: 26px;
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 4px;
}
.reward-modal-subtitle {
    font-size: 18px;
    color: var(--ink-soft);
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}
.reward-modal-details {
    font-size: 14px;
    line-height: 1.35;
    color: rgba(70, 76, 96, 0.82);
    font-weight: 700;
    margin: 2px auto 12px;
    max-width: 420px;
    max-height: 128px;
    overflow-y: auto;
    padding-right: 4px;
}
.reward-modal-coins {
    font-size: 22px;
    font-weight: 900;
    color: var(--accent);
    margin: 6px 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.reward-modal-coins .icon,
.reward-modal-coins .icon img {
    width: 24px;
    height: 24px;
    display: block;
    object-fit: contain;
}
.reward-modal-claim {
    appearance: none;
    border: 0;
    border-radius: 14px;
    padding: 12px 28px;
    color: white;
    background: linear-gradient(135deg, var(--accent), #ff7a18);
    font-weight: 900;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(255, 122, 24, 0.35);
}
.reward-modal-claim:active { transform: translateY(2px); }
.reward-modal-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.reward-modal-root.reward-modal-chest .reward-modal-card {
    width: min(400px, calc(100vw - 28px));
    padding: 22px 24px 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    align-content: center;
    row-gap: 7px;
}
.reward-modal-root.reward-modal-chest .reward-modal-icon {
    width: 108px;
    height: 108px;
    margin: 0 auto 5px;
}
.reward-modal-root.reward-modal-chest .reward-modal-title,
.reward-modal-root.reward-modal-chest .reward-modal-subtitle,
.reward-modal-root.reward-modal-chest .reward-modal-coins,
.reward-modal-root.reward-modal-chest .reward-modal-actions {
    position: relative;
    z-index: 2;
}
.reward-modal-root.reward-modal-chest .reward-modal-subtitle {
    margin-bottom: 6px;
}
.reward-modal-root.reward-modal-chest .reward-modal-coins {
    margin: 10px 0 14px;
}
.reward-modal-secondary {
    appearance: none;
    border: 2px solid white;
    border-radius: 14px;
    padding: 12px 22px;
    color: white;
    background: linear-gradient(135deg, var(--good), #1f8e54);
    font-weight: 900;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(31, 142, 84, 0.28);
}
.reward-modal-secondary:active { transform: translateY(2px); }

/* Низкий по высоте экран (десктоп landscape с урезанной высотой, mobile landscape):
   ужимаем иконку и отступы, чтобы кнопка и текст не обрезались overflow:hidden. */
@media (max-height: 620px) {
    .reward-modal-card {
        padding: 16px 26px 16px;
        max-height: calc(100dvh - 24px);
    }
    .reward-modal-icon {
        width: clamp(76px, 20vh, 132px);
        height: clamp(76px, 20vh, 132px);
        margin: 0 auto 8px;
        font-size: clamp(56px, 16vh, 92px);
    }
    .reward-modal-character-emoji { font-size: clamp(56px, 16vh, 92px); }
    .reward-modal-root.reward-modal-chest .reward-modal-icon {
        width: clamp(78px, 19vh, 104px);
        height: clamp(78px, 19vh, 104px);
    }
    .reward-modal-title { font-size: clamp(20px, 5vh, 26px); margin-bottom: 2px; }
    .reward-modal-subtitle { font-size: clamp(14px, 3.6vh, 18px); margin-bottom: 6px; }
    .reward-modal-details { max-height: 22vh; margin: 2px auto 8px; }
    .reward-modal-coins { font-size: 20px; margin: 4px 0 10px; }
}
@media (max-height: 430px) {
    .reward-modal-icon {
        width: clamp(56px, 24vh, 96px);
        height: clamp(56px, 24vh, 96px);
        margin: 0 auto 6px;
    }
    .reward-modal-character-emoji { font-size: clamp(44px, 20vh, 72px); }
    .reward-modal-root.reward-modal-chest .reward-modal-icon {
        width: clamp(62px, 22vh, 82px);
        height: clamp(62px, 22vh, 82px);
    }
    .reward-modal-title { font-size: clamp(18px, 6vh, 24px); }
    .reward-modal-subtitle { font-size: clamp(13px, 4.4vh, 16px); margin-bottom: 4px; }
    .reward-modal-details { max-height: 18vh; }
    .reward-modal-claim,
    .reward-modal-secondary { padding: 9px 22px; font-size: 15px; }
}

/* === Chest opening sequence === */
.chest-opening-root {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    animation: reward-fade-in 0.18s ease-out;
}
.chest-opening-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 12, 28, 0.68);
    backdrop-filter: blur(5px);
}
.chest-opening-card {
    position: relative;
    z-index: 2;
    width: min(380px, calc(100vw - 28px));
    min-height: 440px;
    padding: 24px 24px 22px;
    border-radius: 26px;
    border: 3px solid rgba(255, 255, 255, 0.82);
    background:
        radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 34%),
        linear-gradient(180deg, #fff7dd 0%, #fff 48%, #f4ecff 100%);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34), 0 0 0 8px rgba(255, 255, 255, 0.12);
    overflow: hidden;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.chest-opening-card::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 52%;
    width: 460px;
    height: 460px;
    transform: translate(-50%, -50%);
    background: repeating-conic-gradient(from 0deg, rgba(255, 209, 102, 0.42) 0 10deg, transparent 10deg 22deg);
    border-radius: 50%;
    opacity: 0.7;
    animation: reward-rays-spin 10s linear infinite;
    pointer-events: auto;
    cursor: pointer;
}
.chest-opening-title {
    position: relative;
    z-index: 2;
    color: var(--ink);
    font-size: 24px;
    font-weight: 900;
    text-shadow: 0 2px 0 white;
}
.chest-opening-box {
    position: relative;
    z-index: 3;
    width: 104px;
    height: 104px;
    margin: 18px auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chest-color);
    font-size: 78px;
    filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.26));
    animation: chest-opening-shake 0.42s ease-in-out infinite;
}
.chest-opening-box .icon,
.chest-opening-box .icon img {
    width: 88px;
    height: 88px;
    display: block;
    object-fit: contain;
}
@keyframes chest-opening-shake {
    0%, 100% { transform: rotate(-3deg) translateY(0); }
    50% { transform: rotate(3deg) translateY(-5px); }
}
.chest-opening-reel {
    z-index: 2;
    width: 156px;
    height: 156px;
    margin: 12px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    background: linear-gradient(180deg, #2f2940 0%, #171220 100%);
    border: 4px solid white;
    box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.14), 0 14px 28px rgba(32, 20, 44, 0.24);
    overflow: hidden;
}
.chest-opening-reel img {
    width: 132px;
    height: 132px;
    object-fit: contain;
    animation: chest-reel-pop 0.13s ease-out;
}
@keyframes chest-reel-pop {
    from { transform: scale(0.74) rotate(-8deg); opacity: 0.4; }
    to { transform: scale(1.04) rotate(3deg); opacity: 0.72; }
}
.chest-opening-caption {
    position: relative;
    z-index: 2;
    color: var(--ink-soft);
    font-size: 16px;
    font-weight: 900;
}
.chest-opening-final .chest-opening-box {
    animation: chest-open-burst 0.62s ease-out forwards;
}
.chest-opening-final .chest-opening-reel {
    animation: chest-reel-final 0.62s ease-out forwards;
}
@keyframes chest-open-burst {
    0% { transform: scale(1) rotate(0); }
    50% { transform: scale(1.26) rotate(0); filter: drop-shadow(0 0 28px rgba(255, 255, 255, 0.9)); }
    100% { transform: scale(0.9) translateY(-18px); opacity: 0; }
}
@keyframes chest-reel-final {
    0% { transform: scale(1); }
    70% { transform: scale(1.18); box-shadow: 0 0 36px rgba(255, 209, 102, 0.85); }
    100% { transform: scale(0.96); opacity: 0; }
}
/* Р›СѓС‡Рё СЃРІРµС‚Р° Р·Р° РёРєРѕРЅРєРѕР№ */
.reward-modal-rays {
    position: absolute;
    left: 50%;
    top: 110px;
    width: 360px;
    height: 360px;
    transform: translate(-50%, -50%);
    background:
        repeating-conic-gradient(
            from 0deg,
            rgba(255, 209, 102, 0.35) 0deg 12deg,
            transparent 12deg 24deg
        );
    border-radius: 50%;
    z-index: 0;
    animation: reward-rays-spin 18s linear infinite;
    pointer-events: none;
    opacity: 0.8;
    mask-image: radial-gradient(circle, rgba(0,0,0,0.65) 30%, rgba(0,0,0,0) 70%);
    -webkit-mask-image: radial-gradient(circle, rgba(0,0,0,0.65) 30%, rgba(0,0,0,0) 70%);
}
@keyframes reward-rays-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
/* РљРѕРЅС„РµС‚С‚Рё (С‚РѕС‚ Р¶Рµ РїСЂРёС‘Рј, С‡С‚Рѕ РІ mg-confetti) */
.reward-modal-confetti {
    position: absolute;
    inset: 0;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}
.reward-modal-confetti span {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    transform-origin: center;
    animation: reward-confetti 1.2s ease-out forwards;
    opacity: 0;
}
@keyframes reward-confetti {
    0%   { transform: translate(-50%, -50%) rotate(0); opacity: 0; }
    20%  { opacity: 1; }
    100% { transform: translate(calc(-50% + var(--cx)), calc(-50% + var(--cy))) rotate(var(--rot)); opacity: 0; }
}

/* === Game-over achievements list === */
.mg-overlay-achievements {
    margin: 4px 0 8px;
    padding: 10px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 209, 102, 0.25), rgba(255, 122, 24, 0.18));
    border: 2px dashed rgba(255, 122, 24, 0.5);
}
.mg-overlay-achievements-title {
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    margin-bottom: 6px;
}
.mg-overlay-achievement {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
}
.mg-overlay-achievement-icon { font-size: 22px; }
.mg-overlay-achievement-name { font-weight: 800; font-size: 14px; }
.mg-overlay-achievement-reward { font-size: 12px; color: var(--ink-soft); }
.mg-overlay-chest-drop {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 6px;
    padding: 8px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(160, 106, 58, 0.22), rgba(255, 209, 102, 0.18));
    border: 2px solid rgba(160, 106, 58, 0.45);
    font-size: 14px;
    font-weight: 800;
    color: #7a4a10;
    animation: hub-bounce 0.35s ease;
}

/* =====================================
   HUB v3: С„РѕРЅРѕРІР°СЏ Р°РЅРёРјР°С†РёСЏ, С†РµР»Рё-РІРєР»Р°РґРєР°, РєРѕРјРїР°РєС‚РЅС‹Р№ РјРѕР±РёР»СЊРЅС‹Р№ layout
   ===================================== */

/* === РђРЅРёРјРёСЂРѕРІР°РЅРЅС‹Р№ С„РѕРЅ С…Р°Р±Р° === */
.hub-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.hub-scene-v2 { position: relative; }
.hub-scene-v2 > .hub-topbar,
.hub-scene-v2 > .hub-view,
.hub-scene-v2 > .hub-tabs { position: relative; z-index: 1; }

.hub-bg-blob {
    position: absolute;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    will-change: transform;
}
.hub-bg-blob-1 {
    background: radial-gradient(circle, rgba(255, 220, 120, 0.85), transparent 70%);
    top: -8%;
    left: -10%;
    animation: hub-bg-float 16s ease-in-out infinite;
}
.hub-bg-blob-2 {
    background: radial-gradient(circle, rgba(255, 150, 200, 0.7), transparent 70%);
    bottom: 20%;
    right: -12%;
    animation: hub-bg-float 21s ease-in-out infinite reverse;
}
.hub-bg-blob-3 {
    background: radial-gradient(circle, rgba(150, 220, 255, 0.55), transparent 70%);
    top: 38%;
    left: 35%;
    width: 260px;
    height: 260px;
    animation: hub-bg-float 18s ease-in-out infinite;
    animation-delay: -6s;
}
@keyframes hub-bg-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(40px, -30px) scale(1.08); }
    66%      { transform: translate(-30px, 40px) scale(0.95); }
}

.hub-bg-spark {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 14px 4px rgba(255, 255, 255, 0.55);
    opacity: 0.5;
    animation: hub-bg-twinkle 6s ease-in-out infinite;
}
.hub-bg-spark-1 { top: 18%; left: 22%; animation-delay: -1s; }
.hub-bg-spark-2 { top: 60%; left: 12%; animation-delay: -3s; width: 7px; height: 7px; }
.hub-bg-spark-3 { top: 30%; right: 18%; animation-delay: -2s; width: 12px; height: 12px; }
.hub-bg-spark-4 { top: 75%; right: 30%; animation-delay: -4s; }
@keyframes hub-bg-twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.7); }
    50%      { opacity: 0.85; transform: scale(1.2); }
}

/* === РЈСЃРёР»РµРЅРЅС‹Р№ glow РїРѕСЂС‚СЂРµС‚Р° === */
.hub-tab-character .hub-character-portrait img {
    filter:
        drop-shadow(0 8px 14px rgba(40, 60, 100, 0.35))
        drop-shadow(0 0 28px rgba(255, 200, 50, 0.7))
        drop-shadow(0 0 6px rgba(255, 255, 255, 0.95));
}

/* === РљРЅРѕРїРєР°-СЏСЂР»С‹Рє В«Р¦РµР»РёВ» РЅР° РіР»Р°РІРЅРѕР№ === */
.hub-goals-shortcut {
    appearance: none;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid white;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.12s;
    flex-shrink: 0;
}
.hub-goals-shortcut:active { transform: scale(0.96); }
.hub-goals-shortcut .icon { font-size: 16px; }

/* === Goals tab === */
.hub-goals-content {
    width: min(760px, 100%);
    margin: 0 auto;
}
.goals-progress-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 12px 14px;
    margin: 4px 4px 14px;
    border: 2px solid white;
    box-shadow: var(--shadow-soft);
}
.goals-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}
.goals-progress-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-mute);
    font-weight: 800;
}
.goals-progress-value {
    font-size: 18px;
    font-weight: 900;
    color: var(--accent);
}
.goals-progress-bar {
    height: 10px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    overflow: hidden;
}
.goals-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm));
    border-radius: 999px;
    transition: width 0.4s ease;
}

.goals-section-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: white;
    font-weight: 900;
    text-shadow: 0 2px 0 rgba(160, 50, 0, 0.3);
    margin: 12px 4px 8px;
}
.goals-section-label-muted {
    color: rgba(255, 255, 255, 0.7);
    margin-top: 18px;
}
.goals-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.daily-quests-card {
    background: rgba(255, 255, 255, 0.74);
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    padding: 12px;
    margin: 0 4px 12px;
}
.daily-quests-title {
    font-size: 16px;
    font-weight: 950;
    color: var(--ink);
}
.daily-quests-subtitle {
    font-size: 12px;
    color: var(--ink-soft);
    font-weight: 750;
    margin: 2px 0 10px;
}
.goal-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 10px 12px;
    border: 2px solid white;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.goal-card-done {
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.6);
}
.goal-card-ready {
    border-color: rgba(43, 189, 110, 0.6);
    box-shadow: var(--shadow-soft), 0 0 0 3px rgba(43, 189, 110, 0.12);
}
.goal-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.goal-card-tag {
    font-size: 10px;
    font-weight: 900;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.goal-card-tag-meta { background: var(--accent-cool, #5cd1ff); }
.goal-card-tag-daily { background: var(--good); }
.goal-card-reward {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.goal-card-reward .icon { width: 16px; height: 16px; font-size: 14px; }
.goal-card-name {
    font-size: 14px;
    font-weight: 900;
    color: var(--ink);
}
.goal-card-done .goal-card-name { color: var(--good); }
.goal-card-desc {
    font-size: 12px;
    color: var(--ink-soft);
    font-weight: 600;
}
.goal-progress-mini {
    position: relative;
    height: 16px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
}
.goal-progress-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm));
    border-radius: 999px;
    transition: width 0.3s ease;
}
.goal-progress-mini-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    color: var(--ink);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.goal-claim-btn {
    appearance: none;
    border: 0;
    border-radius: 11px;
    min-height: 36px;
    padding: 8px 10px;
    color: white;
    background: linear-gradient(180deg, var(--good) 0%, #1f8e54 100%);
    font-size: 13px;
    font-weight: 950;
    box-shadow: 0 3px 0 rgba(20, 80, 40, 0.25);
    cursor: pointer;
}
.wh-heart,
.wh-heart img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

/* === РљРѕРјРїР°РєС‚РЅС‹Р№ РјРѕР±РёР»СЊРЅС‹Р№ HUB === */
@media (max-width: 480px) {
    .hub-scene-v2 {
        padding-top: max(env(safe-area-inset-top, 0), 4px);
    }
    .hub-topbar {
        padding: 8px 14px 4px;
    }
    .hub-pill {
        min-height: 34px;
        padding: 6px 10px;
        font-size: 15px;
    }
    .hub-btn-ad {
        min-width: 66px;
        padding: 5px 9px;
        justify-content: center;
    }
    .hub-ad-icon img,
    .hub-ad-icon {
        width: 15px;
        height: 15px;
        flex-basis: 15px;
    }
    .hub-tab-character .hub-view {
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: hidden;
        gap: 6px;
        padding: 0 12px 12px;
    }
    .hub-character-stage {
        gap: 6px;
        padding: 0;
        align-items: center;
    }
    .hub-tab-character .hub-character-portrait {
        width: min(28vh, 170px, 48vw);
        height: min(28vh, 170px, 48vw);
        margin-bottom: 22px;
    }
    .hub-tab-character .hub-character-portrait img {
        width: 86%;
        height: 86%;
    }
    .hub-arrow {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-width: 2px;
        flex-shrink: 0;
    }
    .hub-tab-character .hub-character-name {
        font-size: 18px;
        min-height: 28px;
        max-width: min(260px, 68vw);
        padding: 2px 12px;
        line-height: 1.05;
    }
    .hub-tab-character .hub-character-area {
        gap: 14px;
    }
    .hub-character-desc {
        max-width: min(260px, 70vw);
        font-size: 11px;
        line-height: 1.15;
        min-height: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .hub-character-counter {
        font-size: 11px;
        padding: 1px 8px;
    }
    .hub-section-title {
        margin: 8px 4px 6px;
        font-size: 11px;
    }
    .hub-chests { margin: 4px 0 0; }
    .hub-chests-row { grid-template-columns: 1fr; }
    .hub-chest-card {
        padding: 8px;
        grid-template-columns: 52px minmax(0, 1fr) minmax(82px, 0.35fr);
        grid-template-rows: auto;
        gap: 7px;
        border-radius: 14px;
    }
    .hub-chest-preview { min-height: 58px; }
    .hub-chest-icon { width: 34px; height: 34px; }
    .hub-chest-label { font-size: 12px; }
    .hub-chest-desc {
        font-size: 10px;
        line-height: 1.18;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .hub-chest-meta {
        font-size: 11px;
        margin-top: 2px;
    }
    .hub-chest-action {
        grid-column: auto;
        align-self: stretch;
        padding: 7px 6px;
        font-size: 12px;
        line-height: 1.1;
    }
    .hub-tabs { min-height: 64px; }
    .hub-tab { font-size: 10.5px; padding-inline: 2px; }
    .hub-tab .icon { font-size: 22px; }
    .daily-reward-card {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding: 10px 12px;
        margin-bottom: 8px;
    }
    .daily-reward-btn {
        width: 100%;
        justify-content: center;
    }
    .mg-hud {
        grid-template-columns: 42px minmax(0, 1fr) max-content;
        padding: 7px 10px;
        gap: 6px;
    }
    .mg-hud-btn {
        width: 42px;
        height: 42px;
    }
    .mg-hud-score {
        min-width: 0;
        padding: 5px 11px;
        font-size: 15px;
    }
    .mg-hud-coins {
        min-width: 66px;
        padding: 7px 8px;
        font-size: 15px;
    }
    .mg-score-label {
        display: none;
    }
    .mg-intro {
        padding: 8px;
    }
    .mg-intro-card {
        max-height: calc(100dvh - 56px);
        padding: 12px;
        gap: 8px;
    }
    .mg-intro-character {
        width: 68px;
        height: 68px;
        border-radius: 18px;
    }
    .mg-intro-actions .mg-btn {
        min-height: 40px;
        padding: 8px 8px;
        font-size: 13px;
    }
    .mg-intro-back {
        width: 42px;
        min-height: 42px;
        padding: 0;
    }
    .shop-grid {
        grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
        gap: 10px;
    }
    .hub-tab-characters .shop-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    .shop-card-item {
        min-height: 214px;
        padding: 12px 10px;
    }
    .character-collection-card {
        min-height: 154px;
        grid-template-rows: 72px 34px 30px;
        padding: 10px 5px 7px;
        gap: 5px;
    }
    .character-collection-card .shop-card-icon {
        width: 64px;
        height: 64px;
    }
    .character-collection-card .shop-card-name {
        min-height: 30px;
        font-size: 11px;
        line-height: 1.05;
    }
    .character-collection-card .shop-card-btn {
        min-height: 28px;
        padding: 5px 3px;
        border-radius: 9px;
        font-size: 10px;
    }
}

@media (max-height: 720px) {
    .hub-tab-character .hub-character-portrait {
        width: min(28vh, 162px, 50vw);
        height: min(28vh, 162px, 50vw);
        margin-bottom: 20px;
    }
}
@media (max-height: 620px) {
    .hub-tab-character .hub-character-portrait {
        width: min(22vh, 124px, 46vw);
        height: min(22vh, 124px, 46vw);
        margin-bottom: 16px;
    }
    .hub-tab-character .hub-character-name {
        min-height: 24px;
        font-size: 16px;
        padding: 1px 10px;
    }
    .hub-chest-card { padding: 7px; gap: 6px 8px; }
    .hub-chest-icon { width: 30px; height: 30px; }
    .hub-chest-action { padding: 7px 8px; }
}

/* Десктоп/широкий landscape: игра заточена под вертикаль, но на ПК всегда
   горизонталь и много свободного места — делаем портрет героя крупнее.
   Размер привязан к высоте (vh), ширины на ПК всегда в избытке. */
@media (orientation: landscape) and (min-width: 900px) {
    .hub-tab-character .hub-character-portrait {
        width: clamp(220px, 46vh, 380px);
        height: clamp(220px, 46vh, 380px);
        margin-bottom: 18px;
    }
    .hub-tab-character .hub-character-name {
        font-size: clamp(22px, 4.2vh, 30px);
    }
}

/* =====================================
   JUICE LAYER — тактильность, отзывчивость, micro-feedback.
   Анимируем только transform/opacity/box-shadow/filter → без reflow и
   обрезаний. Палитра не меняется (используем существующие токены).
   ===================================== */

/* Плавный отклик нажатий для всего семейства кнопок. */
.hub-btn-ad,
.hub-arrow,
.hub-tab,
.mg-hud-btn,
.mg-btn,
.shop-card-btn,
.hub-chest-action,
.daily-reward-btn,
.reward-modal-claim,
.reward-modal-secondary,
.hub-goals-shortcut {
    transition: transform 0.11s cubic-bezier(.34, 1.56, .64, 1),
                box-shadow 0.11s ease,
                filter 0.11s ease;
}

/* Ховер-лифт только при настоящем курсоре (десктоп) — на тач-экранах
   состояние :hover залипает, поэтому исключаем его. */
@media (hover: hover) and (pointer: fine) {
    .hub-btn-ad:not(:disabled):hover,
    .hub-arrow:hover,
    .hub-tab:hover,
    .mg-hud-btn:not(:disabled):hover,
    .mg-btn:not(:disabled):hover,
    .shop-card-btn:not(:disabled):hover,
    .hub-chest-action:not(:disabled):hover,
    .daily-reward-btn:not(:disabled):hover,
    .reward-modal-claim:hover,
    .reward-modal-secondary:hover,
    .hub-goals-shortcut:hover {
        transform: translateY(-2px);
        filter: brightness(1.05) saturate(1.03);
    }
    .shop-card-item:not(.locked):hover,
    .character-collection-card:not(.locked):hover {
        transform: translateY(-3px);
        filter: brightness(1.02);
    }
}

/* «Приземление» при нажатии там, где отклик был мгновенным/только scale. */
.mg-btn:active { transform: translateY(3px) scale(0.99); }
.hub-chest-action:not(:disabled):active { transform: translateY(2px); }
.daily-reward-btn:not(:disabled):active { transform: translateY(2px); }
.reward-modal-secondary:active { transform: translateY(2px); }
.hub-goals-shortcut:active { transform: translateY(2px) scale(0.97); }

/* Пульс-кольцо привлекает взгляд к ОДНОМУ действию на экран:
   готовая ежедневная награда и кнопка получения награды. */
@keyframes juice-pulse-good {
    0%, 100% { box-shadow: 0 4px 0 rgba(20, 80, 40, 0.28), 0 0 0 0 rgba(43, 189, 110, 0.5); }
    50%      { box-shadow: 0 4px 0 rgba(20, 80, 40, 0.28), 0 0 0 10px rgba(43, 189, 110, 0); }
}
.daily-reward-btn:not(:disabled) { animation: juice-pulse-good 1.6s ease-in-out infinite; }

@keyframes juice-pulse-accent {
    0%, 100% { box-shadow: 0 6px 14px rgba(255, 122, 24, 0.35), 0 0 0 0 rgba(255, 201, 38, 0.55); }
    50%      { box-shadow: 0 6px 14px rgba(255, 122, 24, 0.35), 0 0 0 12px rgba(255, 201, 38, 0); }
}
.reward-modal-claim { animation: juice-pulse-accent 1.5s ease-in-out infinite; }

/* Мягкое появление карточек при открытии вкладки (backwards — без захвата
   итогового transform, чтобы ховер/нажатие продолжали работать). */
@keyframes juice-card-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
.shop-card-item,
.character-collection-card,
.hub-game-card {
    animation: juice-card-in 0.28s ease backwards;
}

/* Бамп счётчика монет при изменении (класс вешает JS). */
@keyframes juice-coin-bump {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}
.hub-coin-badge.coin-bump { animation: juice-coin-bump 0.34s ease; }

@media (prefers-reduced-motion: reduce) {
    .daily-reward-btn:not(:disabled),
    .reward-modal-claim,
    .shop-card-item,
    .character-collection-card,
    .hub-game-card,
    .hub-coin-badge.coin-bump {
        animation: none;
    }
}
