/* Медовая империя — игровой редизайн */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Основная палитра */
    --honey-primary: #D4A017;
    --honey-warm: #E8B923;
    --honey-gold: #F5C842;
    --honey-light: #FFF4D4;
    --honey-dark: #B8860B;
    --amber: #E6A800;
    --cream: #FFFBF0;
    --cream-dark: #F5EDE0;
    --wood: #5C4033;
    --wood-light: #8B6914;
    --leaf: #3D6B2C;
    --leaf-light: #5A8C3E;
    --sky-top: #4A90D9;
    --sky-mid: #7BB8E8;
    --sky-warm: #E8D5A3;
    /* Фон — яркий луг, без серости */
    --bg-sky-deep: #5B9BD5;
    --bg-sky-mid: #7EC8E3;
    --bg-sky-warm: #FFE4A8;
    --bg-meadow-light: #FFF8E0;
    --bg-hill-far: rgba(90, 150, 70, 0.35);
    --bg-hill-near: rgba(70, 140, 55, 0.75);
    --shadow-soft: rgba(92, 64, 51, 0.12);
    --shadow-gold: rgba(212, 160, 23, 0.4);
    --glass-bg: rgba(255, 251, 240, 0.85);
    --glass-border: rgba(212, 160, 23, 0.25);

    /* Игровой стиль — HUD и панели */
    --game-panel-bg: linear-gradient(165deg, #FFFBF5 0%, #FFF8E8 100%);
    --game-panel-border: 3px solid var(--honey-primary);
    --game-panel-radius: 24px;
    --game-panel-shadow: 0 12px 48px rgba(92, 64, 51, 0.18), 0 0 0 1px rgba(212, 160, 23, 0.15);
    --hud-height: 64px;
    --hud-bg: linear-gradient(180deg, rgba(255, 248, 235, 0.98) 0%, rgba(255, 240, 210, 0.95) 100%);
    --hud-border: 2px solid var(--honey-primary);
    --card-game-bg: linear-gradient(145deg, #FFFDF8 0%, #FFF8E8 100%);
    --card-game-border: 2px solid rgba(212, 160, 23, 0.4);
    --card-game-radius: 20px;
    --card-game-shadow: 0 6px 24px rgba(92, 64, 51, 0.1), inset 0 1px 0 rgba(255,255,255,0.9);
    --btn-game-radius: 16px;
    --modal-game-border: 4px solid var(--honey-primary);
    --modal-game-radius: 28px;

    /* Мобильная адаптация: реальные размеры viewport и футера */
    --footer-h: 72px;
    --app-height: 100vh;
    --fab-h: 0px;
}

/* П. 1.10.2: без системного скроллбара и без swipe-to-refresh */
html {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
}

body {
    height: 100%;
    overflow: hidden;
    overflow-x: hidden;
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    /* ВАЖНО: не фиксируем body, иначе на мобилке возможен checkerboarding (мигание/тайлы) */
    position: relative;
    width: 100%;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(180deg, #E8C850 0%, #FFE8A8 25%, #FFF4D4 55%, #FFFBF0 85%, #FFFEF8 100%);
    color: var(--wood);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    transition: filter 0.3s ease;
    /* Единственный скролл — внутри #game-container (собственные средства прокрутки) */
}

/* Не даём выделять/тянуть элементы и открывать контекстное меню по long-press */
#game-container, #game-container * {
    -webkit-touch-callout: none;
}

button,
.honey-jar,
.buy-btn,
.footer-btn,
.building-tab-btn,
.ad-reward-btn,
.rebirth-btn,
.rebirth-info-btn {
    touch-action: manipulation;
}

button:focus,
button:focus-visible {
    outline: none;
}


#game-container {
    /* Fallbacks для разных браузеров + динамическая высота на мобильных */
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--app-height, 100dvh);
    /* Фиксируем игровой контейнер на весь экран: скролл только внутри него, без системного скролла окна */
    position: fixed;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overflow-anchor: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* П. 1.10.2: overscroll не передаётся браузеру — нет pull-to-refresh */
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

#game-container::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

.game-layout {
    display: flex;
    max-width: 1500px;
    margin: 0 auto;
    gap: 0;
    /* Нижний отступ зависит от высоты футера и ряда быстрых кнопок */
    padding: 8px 10px calc(var(--footer-h, 72px) + var(--fab-h, 0px) + 20px);
    position: relative;
    z-index: 51;
    align-items: flex-start;
}

.left-panel {
    width: 280px;
    flex-shrink: 0;
    margin-right: -8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.right-panel {
    width: 280px;
    flex-shrink: 0;
    margin-left: -8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-block {
    background: rgba(255, 248, 235, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid rgba(212, 160, 23, 0.35);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 6px 24px rgba(92, 64, 51, 0.12);
}

.panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--honey-dark);
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(212, 160, 23, 0.25);
}

.panel-quests .quests-list {
    max-height: none;
    overflow: visible;
}

.panel-upgrades .upgrades-grid {
    max-height: 560px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--honey-primary) rgba(212, 160, 23, 0.15);
}

.panel-upgrades .upgrades-grid::-webkit-scrollbar {
    width: 8px;
}

.panel-upgrades .upgrades-grid::-webkit-scrollbar-track {
    background: rgba(212, 160, 23, 0.08);
    border-radius: 10px;
    margin: 4px 0;
}

.panel-upgrades .upgrades-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--honey-warm) 0%, var(--honey-primary) 50%, var(--honey-dark) 100%);
    border-radius: 10px;
    border: 2px solid rgba(255, 248, 235, 0.5);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.panel-upgrades .upgrades-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--honey-gold) 0%, var(--honey-warm) 50%, var(--honey-primary) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 8px rgba(212, 160, 23, 0.3);
}

/* Панель квестов — тёплый стиль, карточки с акцентом */
.panel-quests {
    background: linear-gradient(165deg, rgba(255, 251, 242, 0.96) 0%, rgba(255, 248, 232, 0.94) 50%, rgba(254, 242, 220, 0.92) 100%);
    border: 2px solid rgba(212, 160, 23, 0.4);
    box-shadow: 0 8px 28px rgba(139, 90, 43, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.panel-quests .panel-title {
    font-size: 1.05rem;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(212, 160, 23, 0.3);
    color: #8B6914;
}

.panel-quests .quests-list {
    gap: 12px;
}

.panel-quests .quest-slot {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(212, 160, 23, 0.28);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 1px 8px rgba(92, 64, 51, 0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.panel-quests .quest-slot.done {
    border-color: rgba(212, 160, 23, 0.45);
    box-shadow: 0 2px 12px rgba(212, 160, 23, 0.1);
}

.panel-quests .quest-desc {
    font-size: 0.92rem;
    color: #5C4A2A;
    margin: 0 0 8px 0;
    line-height: 1.35;
}

.panel-quests .quest-progress {
    height: 6px;
    background: rgba(212, 160, 23, 0.12);
    border-radius: 999px;
    margin-bottom: 6px;
}

.panel-quests .quest-fill {
    background: linear-gradient(90deg, var(--honey-dark) 0%, var(--honey-warm) 100%);
    border-radius: 999px;
}

.panel-quests .quest-nums {
    font-size: 0.85rem;
    color: #7A6B50;
    margin: 0 0 10px 0;
}

.panel-quests .quest-claim {
    width: 100%;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    background: linear-gradient(180deg, #E8C850 0%, #C9A820 100%);
    border: 1px solid rgba(139, 90, 0, 0.35);
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.2);
}

.panel-quests .quest-claim:hover:not(:disabled) {
    box-shadow: 0 3px 12px rgba(212, 160, 23, 0.3);
}

.panel-quests .quest-claim:disabled {
    background: #E8E4DC;
    border-color: rgba(160, 140, 120, 0.3);
    color: #9A8E80;
    box-shadow: none;
}

/* Панель усилений — карточки в том же тёплом стиле */
.panel-upgrades {
    background: linear-gradient(165deg, rgba(255, 251, 242, 0.96) 0%, rgba(255, 248, 232, 0.94) 50%, rgba(254, 242, 220, 0.92) 100%);
    border: 2px solid rgba(212, 160, 23, 0.4);
    box-shadow: 0 8px 28px rgba(139, 90, 43, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.panel-upgrades .panel-title {
    font-size: 1.05rem;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(212, 160, 23, 0.3);
    color: #8B6914;
}

.panel-upgrades .upgrades-grid {
    gap: 12px;
}

.panel-upgrades .upgrade-card {
    flex: 1 1 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(212, 160, 23, 0.25);
    border-radius: 14px;
    border-left: 4px solid rgba(180, 140, 60, 0.5);
    box-shadow: 0 2px 12px rgba(92, 64, 51, 0.08);
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s, transform 0.2s;
}

.panel-upgrades .upgrade-card .upgrade-info {
    flex: 1;
    min-height: 0;
}

.panel-upgrades .upgrade-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(92, 64, 51, 0.12);
}

.panel-upgrades .upgrade-card.affordable {
    background: rgba(255, 252, 240, 0.95);
    border-color: rgba(212, 160, 23, 0.45);
    border-left-color: var(--honey-primary);
    box-shadow: 0 4px 16px rgba(212, 160, 23, 0.18);
}

.panel-upgrades .upgrade-card.affordable:hover {
    box-shadow: 0 6px 20px rgba(212, 160, 23, 0.25);
}

.panel-upgrades .upgrade-card.affordable::after {
    display: none;
}

.panel-upgrades .upgrade-name {
    font-size: 1rem;
    color: #5C4A2A;
    margin-bottom: 4px;
}

.panel-upgrades .upgrade-desc {
    font-size: 0.85rem;
    color: #7A6B50;
    line-height: 1.35;
    margin-bottom: 10px;
}

.panel-upgrades .upgrade-card .buy-btn {
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 700;
    background: linear-gradient(135deg, #E8C850 0%, var(--honey-primary) 50%, #B8860B 100%);
    border: 2px solid rgba(139, 90, 0, 0.4);
    box-shadow: 0 2px 10px rgba(212, 160, 23, 0.3), inset 0 1px 0 rgba(255,255,255,0.35);
}

.panel-upgrades .upgrade-card .buy-btn:hover:not(:disabled) {
    box-shadow: 0 3px 14px rgba(212, 160, 23, 0.4), inset 0 1px 0 rgba(255,255,255,0.4);
}

.panel-upgrades .upgrade-card:not(.affordable) .buy-btn {
    background: linear-gradient(135deg, #E8E2D8 0%, #D8D0C4 100%);
    border-color: rgba(160, 140, 120, 0.35);
    color: #8A7E70;
}

.panel-upgrades .upgrade-card.purchased {
    background: rgba(230, 220, 200, 0.6);
    border-color: rgba(139, 120, 80, 0.3);
    cursor: default;
}

.panel-upgrades .upgrade-card.purchased:hover {
    transform: none;
}

.panel-upgrades .upgrade-owned {
    font-size: 0.9rem;
    font-weight: 600;
    color: #5A8C3E;
}

/* Окно новостей — заметный блок: контрастный фон, крупный читаемый текст */
.panel-news {
    background: linear-gradient(165deg, #FFF9ED 0%, #FFF0D4 50%, #FFE8C0 100%);
    border: 2px solid rgba(180, 120, 20, 0.5);
    box-shadow: 0 8px 32px rgba(100, 70, 20, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.panel-news .panel-title {
    font-size: 1.15rem;
    font-weight: 800;
    padding-bottom: 12px;
    border-bottom: 3px solid rgba(180, 120, 20, 0.45);
    color: #6B4A0A;
}

.panel-news .news-ticker {
    min-height: 140px;
    max-height: 560px;
    overflow-y: auto;
    padding: 8px 0;
    margin: 0 -4px;
}

.news-item {
    font-size: 1.12rem;
    line-height: 1.5;
    font-weight: 600;
    color: #3D2E18;
    margin: 0;
    padding: 16px 18px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    border-left: 5px solid #C9A020;
    box-shadow: 0 3px 12px rgba(80, 55, 20, 0.12);
}

.news-item.news-current {
    min-height: 3.2em;
    font-size: 1.18rem;
    font-weight: 700;
    color: #2D2212;
    background: #FFFDF5;
    border-left-color: #B8860B;
    border-left-width: 6px;
    box-shadow: 0 6px 20px rgba(180, 120, 20, 0.2);
}

.news-item.news-pop {
    animation: newsPop 0.55s ease-out;
}

/* Панель рекламных наград — под новостями */
.panel-ad-rewards {
    background: linear-gradient(165deg, #FFF9ED 0%, #FFEDD5 30%, #FFE4BC 70%, #FFD9A0 100%);
    border: 2px solid rgba(212, 160, 23, 0.5);
    box-shadow: 0 6px 24px rgba(180, 120, 20, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(212, 160, 23, 0.1);
    position: relative;
    overflow: hidden;
}

.panel-ad-rewards::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, transparent 100%);
    pointer-events: none;
}

.panel-ad-rewards .panel-title {
    font-size: 1.1rem;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(212, 160, 23, 0.45);
    color: #6B4A0A;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.ad-rewards-desc {
    font-size: 0.82rem;
    color: #7A5A2A;
    margin: 0 0 12px 0;
    line-height: 1.4;
    opacity: 0.95;
}

.ad-rewards-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ad-reward-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 2px solid rgba(212, 160, 23, 0.45);
    border-radius: 14px;
    background: linear-gradient(145deg, #FFFDF5 0%, #FFF5E0 40%, #FFEBC8 100%);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #5C4A2A;
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s, box-shadow 0.25s, border-color 0.2s, background 0.2s;
    box-shadow: 0 3px 12px rgba(140, 90, 20, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
}

.ad-reward-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transition: left 0.5s ease;
}

.ad-reward-btn:hover:not(:disabled)::after {
    left: 150%;
}

.ad-reward-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 6px 20px rgba(212, 160, 23, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border-color: var(--honey-primary);
    background: linear-gradient(145deg, #FFFEF8 0%, #FFF8E8 40%, #FFF0D0 100%);
}

.ad-reward-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
}

.ad-reward-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    filter: grayscale(0.15);
}

.ad-reward-btn .ad-reward-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 235, 180, 0.5) 100%);
    border-radius: 10px;
    border: 1px solid rgba(212, 160, 23, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 6px rgba(140, 90, 20, 0.1);
}

.ad-reward-btn .ad-reward-text {
    flex: 1;
    min-width: 0;
}

.ad-reward-btn .ad-reward-name {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: #5C4A2A;
    margin-bottom: 2px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.ad-reward-btn .ad-reward-desc {
    font-size: 0.78rem;
    color: #7A6B50;
    font-weight: 500;
    line-height: 1.3;
}

.ad-reward-btn .ad-reward-cooldown {
    font-size: 0.72rem;
    color: #6B8E23;
    margin-top: 4px;
    font-weight: 600;
}

@keyframes newsPop {
    0% { opacity: 0; transform: translateY(10px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

#main-content { position: relative; z-index: 0; flex: 1; min-width: 0; }

/* ========== РЕДИЗАЙН ЗАДНЕГО ФОНА ========== */
.parallax-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Небо — могучее: глубокое сверху, золотой горизонт империи. Переход при смене тира. */
.sky-layer {
    background: linear-gradient(180deg,
        #2D6BB8 0%,
        #4A90E0 12%,
        #6BB0F0 28%,
        #9ACCF5 42%,
        #C8E4F0 55%,
        #E8F0D8 68%,
        #FFE8A0 80%,
        #FFD850 90%,
        #FFE8A8 95%,
        #FFF4D8 100%
    );
    box-shadow: inset 0 -40vh 80vh -20vh rgba(255, 220, 100, 0.15);
    transition: background 1.2s ease, box-shadow 1.2s ease;
}

/* Космос в небе (вкладка 3) */
.sky-layer .sky-space-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3; /* поверх облаков/пчёл, но под UI */
}

.sky-space-haze {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 60%;
    background: radial-gradient(circle at 60% 22%,
        rgba(120, 190, 255, 0.18) 0%,
        rgba(120, 120, 255, 0.10) 30%,
        rgba(20, 40, 80, 0.0) 68%);
    opacity: 0.9;
}

.sky-stars {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 55%;
    pointer-events: none;
}

.sky-stars .sky-star {
    position: absolute;
    font-size: 12px;
    opacity: 0.7;
    filter: drop-shadow(0 2px 6px rgba(255,255,255,0.25));
    animation: starTwinkle 3.5s ease-in-out infinite;
}

.sky-stars .s1 { left: 12%; top: 22%; animation-delay: 0.1s; }
.sky-stars .s2 { left: 28%; top: 10%; animation-delay: 0.8s; font-size: 11px; }
.sky-stars .s3 { left: 46%; top: 18%; animation-delay: 1.4s; font-size: 10px; }
.sky-stars .s4 { left: 62%; top: 8%; animation-delay: 0.5s; font-size: 11px; }
.sky-stars .s5 { left: 78%; top: 24%; animation-delay: 1.1s; font-size: 10px; }
.sky-stars .s6 { left: 90%; top: 12%; animation-delay: 1.7s; font-size: 10px; }

.sky-space-item {
    position: absolute;
    filter: drop-shadow(0 6px 18px rgba(0,0,0,0.25));
    opacity: 0.88;
    animation: meadowFloat 7.5s ease-in-out infinite;
}

.sky-space-item .scene-illus.emoji-icon {
    display: block;
    line-height: 1;
    font-size: 2.2rem;
}

.sky-universe .scene-illus.emoji-icon { font-size: 2.8rem; }
.sky-blackhole .scene-illus.emoji-icon { font-size: 2.6rem; }

/* Лучи солнца — могучее золотое сияние */
.sun-rays {
    position: absolute;
    top: 14%;
    left: 50%;
    width: 520px;
    height: 520px;
    transform: translate(-50%, -50%);
    transition: width 0.8s ease, height 0.8s ease, opacity 0.8s ease;
    background: radial-gradient(ellipse 85% 85% at 50% 50%,
        rgba(255, 245, 180, 0.5) 0%,
        rgba(255, 230, 140, 0.28) 30%,
        rgba(255, 215, 90, 0.12) 55%,
        rgba(255, 200, 60, 0.04) 75%,
        transparent 90%);
    animation: raysPulse 8s ease-in-out infinite;
}

@keyframes raysPulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.9; transform: translate(-50%, -50%) scale(1.12); }
}

/* Солнце — центр империи, мощное и тёплое. Переход при смене тира. */
.sun {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 140px;
    transition: width 0.8s ease, height 0.8s ease, box-shadow 1s ease;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%,
        #FFFEF8,
        #FFE87C 20%,
        #F5C842 45%,
        #E8A820 70%,
        #D4A017 100%);
    box-shadow:
        0 0 140px rgba(255, 235, 160, 0.95),
        0 0 280px rgba(255, 215, 100, 0.55),
        0 0 400px rgba(255, 200, 60, 0.2),
        inset -12px -12px 50px rgba(255, 255, 255, 0.65),
        inset 8px 8px 28px rgba(230, 170, 50, 0.25);
    animation: sunGlow 6s ease-in-out infinite;
}

@keyframes sunGlow {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.94; transform: translateX(-50%) scale(1.08); }
}

/* Облака — объёмные, пушистые, с подсветкой и лёгким покачиванием */
.cloud {
    position: absolute;
    background: radial-gradient(ellipse 70% 60% at 35% 35%,
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 254, 250, 0.98) 20%,
        rgba(255, 251, 242, 0.95) 45%,
        rgba(255, 248, 235, 0.9) 70%,
        rgba(248, 242, 230, 0.85) 100%);
    border-radius: 50%;
    filter:
        drop-shadow(0 20px 45px rgba(100, 140, 190, 0.22))
        drop-shadow(0 8px 24px rgba(80, 120, 170, 0.18))
        drop-shadow(0 0 60px rgba(255, 255, 255, 0.15));
    box-shadow:
        inset -6px -8px 28px rgba(255, 255, 255, 0.85),
        inset 4px 4px 18px rgba(255, 250, 240, 0.5),
        inset 0 6px 20px rgba(240, 235, 225, 0.3);
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse 60% 60% at 30% 35%,
        #ffffff 0%,
        #fffefc 25%,
        #fffbf5 55%,
        #fff8ef 85%,
        #fdf5eb 100%);
    box-shadow:
        inset -4px -6px 20px rgba(255, 255, 255, 0.8),
        inset 2px 2px 12px rgba(255, 252, 245, 0.6);
}

.cloud-1 {
    width: 165px; height: 68px; top: 3%; left: 2%;
    animation: cloudMove 38s linear infinite;
}
.cloud-1::before { width: 88px; height: 88px; top: -42px; left: 12px; }
.cloud-1::after { width: 96px; height: 62px; top: -28px; right: -18px; }

.cloud-2 {
    width: 142px; height: 60px; top: 14%; right: 4%;
    animation: cloudMove 44s linear infinite 6s;
}
.cloud-2::before { width: 76px; height: 76px; top: -38px; left: 10px; }
.cloud-2::after { width: 82px; height: 54px; top: -26px; right: -16px; }

.cloud-3 {
    width: 128px; height: 52px; top: 6%; left: 44%;
    animation: cloudMove 34s linear infinite 3s;
}
.cloud-3::before { width: 66px; height: 66px; top: -34px; left: 14px; }
.cloud-3::after { width: 72px; height: 48px; top: -22px; right: -14px; }

.cloud-4 {
    width: 152px; height: 62px; top: 24%; left: 12%;
    animation: cloudMove 40s linear infinite 10s;
}
.cloud-4::before { width: 80px; height: 80px; top: -40px; left: 14px; }
.cloud-4::after { width: 86px; height: 56px; top: -26px; right: -16px; }

.cloud-5 {
    width: 134px; height: 56px; top: 4%; right: 26%;
    animation: cloudMove 36s linear infinite 2s;
}
.cloud-5::before { width: 70px; height: 70px; top: -36px; left: 12px; }
.cloud-5::after { width: 76px; height: 50px; top: -24px; right: -14px; }

.cloud-6 {
    width: 118px; height: 50px; top: 18%; left: 58%;
    animation: cloudMove 42s linear infinite 5s;
}
.cloud-6::before { width: 62px; height: 62px; top: -32px; left: 14px; }
.cloud-6::after { width: 68px; height: 44px; top: -22px; right: -12px; }

.cloud-7 {
    width: 146px; height: 60px; top: 10%; right: 12%;
    animation: cloudMove 39s linear infinite 7s;
}
.cloud-7::before { width: 78px; height: 78px; top: -38px; left: 12px; }
.cloud-7::after { width: 84px; height: 54px; top: -26px; right: -16px; }

.cloud-8 {
    width: 138px; height: 56px; top: 20%; left: 32%;
    animation: cloudMove 37s linear infinite 9s;
}
.cloud-8::before { width: 72px; height: 72px; top: -36px; left: 14px; }
.cloud-8::after { width: 78px; height: 50px; top: -24px; right: -14px; }

@keyframes cloudMove {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(110vw); }
}

/* Холмы — многослойный луг, округлые «игровые» волны */
.hills-layer {
    z-index: 1;
}

.hill {
    position: absolute;
    bottom: 0;
    border-radius: 50% 50% 0 0 / 30% 30% 0 0;
    transition: background 1s ease, box-shadow 1s ease;
}

.hill-far {
    left: -30%;
    width: 160%;
    height: 38%;
    background: linear-gradient(180deg,
        rgba(85, 150, 70, 0.4) 0%,
        rgba(90, 155, 72, 0.5) 35%,
        rgba(100, 160, 78, 0.45) 65%,
        rgba(145, 175, 95, 0.25) 85%,
        rgba(180, 190, 120, 0.15) 100%);
    box-shadow: inset 0 -30px 60px -20px rgba(255, 220, 100, 0.08);
    animation: hillSway 12s ease-in-out infinite;
}

.hill-mid {
    left: -20%;
    width: 140%;
    height: 50%;
    background: linear-gradient(180deg,
        rgba(60, 140, 55, 0.6) 0%,
        rgba(68, 148, 58, 0.65) 30%,
        rgba(78, 152, 62, 0.55) 60%,
        rgba(125, 165, 82, 0.3) 85%,
        rgba(170, 185, 110, 0.15) 100%);
    box-shadow: inset 0 -40px 80px -25px rgba(255, 230, 120, 0.1);
    animation: hillSway 9s ease-in-out infinite 1.5s;
}

.hill-near {
    left: -10%;
    width: 120%;
    height: 58%;
    background: linear-gradient(180deg,
        rgba(50, 130, 48, 0.8) 0%,
        rgba(58, 138, 52, 0.75) 25%,
        rgba(68, 145, 55, 0.65) 55%,
        rgba(155, 178, 92, 0.3) 85%,
        rgba(200, 210, 140, 0.12) 100%);
    box-shadow: inset 0 -50px 100px -30px rgba(255, 235, 130, 0.12);
    animation: hillSway 7s ease-in-out infinite 0.8s;
}

@keyframes hillSway {
    0%, 100% { transform: translateX(0) scaleX(1); }
    50% { transform: translateX(4px) scaleX(1.02); }
}

/* Трава — полоса луга + отдельные травинки */
.grass-layer {
    z-index: 2;
}

.grass-layer::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 24%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(90, 150, 68, 0.28) 15%,
        rgba(72, 138, 58, 0.55) 50%,
        rgba(65, 128, 52, 0.75) 80%,
        rgba(140, 160, 75, 0.35) 100%);
    border-radius: 50% 50% 0 0 / 15% 15% 0 0;
    box-shadow: inset 0 -20px 50px -15px rgba(255, 230, 120, 0.06);
}

.grass-blade {
    position: absolute;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg,
        transparent,
        rgba(90, 150, 65, 0.75) 25%,
        rgba(65, 130, 55, 0.95) 100%);
    border-radius: 2px;
    transform-origin: bottom center;
    animation: grassSway 4s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(70, 130, 55, 0.3);
}

.g1 { left: 3%; height: 52px; animation-delay: 0s; }
.g2 { left: 12%; height: 68px; animation-delay: 0.4s; }
.g3 { left: 22%; height: 46px; animation-delay: 0.75s; }
.g4 { left: 36%; height: 60px; animation-delay: 0.2s; }
.g5 { left: 56%; height: 54px; animation-delay: 0.5s; }
.g6 { left: 70%; height: 72px; animation-delay: 0.15s; }
.g7 { left: 84%; height: 48px; animation-delay: 0.6s; }
.g8 { left: 93%; height: 62px; animation-delay: 0.35s; }

@keyframes grassSway {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* Декоративные цветы на фоне */
.flowers-decor {
    z-index: 2;
}

.decor-flower {
    position: absolute;
    font-size: 2.2rem;
    opacity: 0.75;
    filter: drop-shadow(0 4px 10px rgba(50, 70, 40, 0.2));
    animation: flowerFloat 7s ease-in-out infinite;
}

.f1 { bottom: 18%; left: 5%; animation-delay: 0s; }
.f2 { bottom: 12%; right: 8%; animation-delay: 1.4s; }
.f3 { bottom: 24%; left: 42%; animation-delay: 2.4s; }
.f4 { bottom: 20%; right: 32%; animation-delay: 0.7s; }
.f5 { bottom: 28%; left: 26%; font-size: 1.9rem; animation-delay: 1.8s; }
.f6 { bottom: 14%; right: 52%; font-size: 1.7rem; animation-delay: 3s; }

@keyframes flowerFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(4deg); }
}

/* Пчёлы в небе — лёгкий параллакс */
.bees-bg {
    z-index: 2;
}

.bg-bee {
    position: absolute;
    font-size: 1.35rem;
    opacity: 0.4;
    filter: drop-shadow(0 2px 8px rgba(40, 50, 30, 0.2));
    animation: bgBeeFly 20s linear infinite;
}

.bb1 { top: 14%; left: 4%; animation-duration: 24s; animation-delay: 0s; }
.bb2 { top: 26%; right: 6%; animation-duration: 22s; animation-delay: -6s; }
.bb3 { top: 10%; left: 48%; animation-duration: 26s; animation-delay: -12s; font-size: 1.05rem; }
.bb4 { top: 32%; left: 22%; animation-duration: 21s; animation-delay: -4s; opacity: 0.32; }
.bb5 { top: 20%; right: 32%; animation-duration: 23s; animation-delay: -8s; font-size: 1.15rem; }

@keyframes bgBeeFly {
    0% { transform: translateX(-30px) translateY(0) rotate(-6deg); }
    25% { transform: translateX(18vw) translateY(-25px) rotate(4deg); }
    50% { transform: translateX(40vw) translateY(8px) rotate(-3deg); }
    75% { transform: translateX(60vw) translateY(-18px) rotate(5deg); }
    100% { transform: translateX(105vw) translateY(0) rotate(-6deg); }
}

/* Банки мёда внизу — тонкий акцент */
.honey-jars-bg {
    z-index: 2;
    bottom: 0;
}

.bg-jar {
    position: absolute;
    font-size: 1.8rem;
    opacity: 0.18;
    bottom: 2.5%;
    filter: drop-shadow(0 3px 10px rgba(50, 40, 25, 0.25));
}

.j1 { left: 6%; animation: jarFloat 7s ease-in-out infinite; }
.j2 { left: 44%; animation: jarFloat 8s ease-in-out infinite 2s; font-size: 1.5rem; }
.j3 { right: 10%; animation: jarFloat 6s ease-in-out infinite 1s; }

@keyframes jarFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Соты — узор могучей империи, чуть заметнее. Меняется по тиру. */
.honeycomb-overlay {
    position: fixed;
    transition: background-image 1s ease, mask-image 1s ease;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='110' viewBox='0 0 64 110'%3E%3Cpath fill='%23D4A017' fill-opacity='0.09' d='M32 0L64 27.5v55L32 110 0 82.5V27.5z'/%3E%3Cpath fill='%23D4A017' fill-opacity='0.06' d='M0 55L32 82.5 64 55 32 27.5z'/%3E%3C/svg%3E");
    background-size: 64px 110px;
    mask-image: radial-gradient(ellipse 95% 90% at 50% 35%, black 25%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 95% 90% at 50% 35%, black 25%, transparent 70%);
    pointer-events: none;
    z-index: 3;
}

/* ========== ФОН ПО ТИРАМ (по купленным постройкам) ========== */
.bg-tier-extras {
    z-index: 2;
    top: 0; left: 0; width: 100%; height: 100%;
}

.bg-tier-extras > div {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

#game-container[data-bg-tier="1"] .bg-tier-1,
#game-container[data-bg-tier="2"] .bg-tier-2,
#game-container[data-bg-tier="3"] .bg-tier-3,
#game-container[data-bg-tier="4"] .bg-tier-4,
#game-container[data-bg-tier="5"] .bg-tier-5 {
    opacity: 1;
}

/* Тир 1: улей/королева — лёгкий след пыльцы в небе */
.bee-trail {
    background: radial-gradient(ellipse 80% 40% at 50% 20%,
        rgba(255, 235, 120, 0.08) 0%, transparent 50%);
    animation: beeTrailPulse 4s ease-in-out infinite;
}
@keyframes beeTrailPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Тир 2: завод/сад/пасека — ветряки/мельницы вдали */
.windmill-layer {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    padding-bottom: 18%;
}
.windmill {
    position: absolute;
    bottom: 15%;
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
    opacity: 0.85;
}
.windmill.w1 { left: 8%; animation: windmillFloat 6s ease-in-out infinite; }
.windmill.w2 { right: 12%; animation: windmillFloat 7s ease-in-out infinite 1.5s; }
.windmill-body { display: block; }
.windmill-blade {
    display: inline-block;
    margin-left: 2px;
    animation: windmillSpin 3s linear infinite;
}
.windmill.w2 .windmill-blade { animation-duration: 4s; animation-direction: reverse; }
@keyframes windmillFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes windmillSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Тир 3: замок/лавка/лаборатория — силуэт замка и золотые блики */
.castle-layer { display: block; }
.castle-silhouette {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 420px;
    height: 35%;
    max-height: 200px;
    background: linear-gradient(180deg, transparent 0%, transparent 30%,
        rgba(60, 50, 45, 0.5) 45%,
        rgba(45, 38, 35, 0.85) 70%,
        rgba(35, 30, 28, 0.95) 100%);
    clip-path: polygon(20% 100%, 18% 55%, 25% 55%, 25% 35%, 35% 35%, 35% 50%, 42% 50%, 42% 25%, 52% 25%, 52% 50%, 58% 50%, 58% 35%, 68% 35%, 68% 55%, 75% 55%, 73% 100%, 50% 85%, 27% 100%);
    box-shadow: inset 0 -20px 40px rgba(255, 220, 120, 0.08);
}
.golden-bokeh {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 25% 30%, rgba(255, 230, 140, 0.12) 0%, transparent 35%),
        radial-gradient(circle at 75% 25%, rgba(255, 215, 100, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 50% 70%, rgba(255, 240, 160, 0.06) 0%, transparent 45%);
    animation: bokehPulse 5s ease-in-out infinite;
}
@keyframes bokehPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Тир 4: медовый город — силуэт города и река мёда */
.city-layer { display: block; }
.city-silhouette {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    max-height: 220px;
    background: linear-gradient(180deg, transparent 0%, transparent 25%,
        rgba(50, 45, 55, 0.4) 40%,
        rgba(40, 36, 48, 0.75) 65%,
        rgba(30, 26, 38, 0.9) 100%);
    clip-path: polygon(0 100%, 0 70%, 5% 65%, 8% 80%, 12% 55%, 18% 75%, 22% 50%, 28% 70%, 35% 45%, 42% 65%, 48% 40%, 55% 60%, 62% 35%, 70% 55%, 78% 45%, 85% 60%, 92% 50%, 98% 65%, 100% 70%, 100% 100%);
    box-shadow: inset 0 -30px 60px rgba(200, 160, 60, 0.06);
}
.honey-river-reflect {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 25%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(255, 220, 100, 0.08) 20%,
        rgba(230, 180, 80, 0.15) 50%,
        rgba(210, 160, 60, 0.12) 100%);
    animation: riverShine 3s ease-in-out infinite;
}
@keyframes riverShine {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

/* Тир 5: космос — звёзды, луна, планета, туманность */
.space-layer { display: block; }
.stars-layer {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 20% 15%, rgba(255,255,255,0.9) 0%, transparent 100%),
        radial-gradient(2px 2px at 60% 8%, rgba(255,255,255,0.85) 0%, transparent 100%),
        radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.95) 0%, transparent 100%),
        radial-gradient(2px 2px at 35% 25%, rgba(255,255,255,0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 90% 12%, rgba(255,255,255,0.8) 0%, transparent 100%),
        radial-gradient(1px 1px at 10% 18%, rgba(255,248,200,0.9) 0%, transparent 100%);
    background-size: 200% 200%;
    animation: starsTwinkle 8s ease-in-out infinite;
}
@keyframes starsTwinkle {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; }
}
.moon-orb {
    position: absolute;
    top: 12%;
    right: 15%;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #FFFEF8, #E8E4D8 40%, #C8C4B8 100%);
    box-shadow: 0 0 30px rgba(255,255,255,0.5), 0 0 60px rgba(255,248,220,0.25), inset -5px -5px 15px rgba(0,0,0,0.1);
    animation: moonGlow 6s ease-in-out infinite;
}
@keyframes moonGlow {
    0%, 100% { opacity: 0.9; box-shadow: 0 0 30px rgba(255,255,255,0.5); }
    50% { opacity: 1; box-shadow: 0 0 40px rgba(255,255,255,0.7), 0 0 80px rgba(255,248,220,0.3); }
}
.planet-silhouette {
    position: absolute;
    bottom: 15%;
    left: 10%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(80, 60, 100, 0.5), rgba(40, 30, 60, 0.8));
    box-shadow: inset -20px -20px 40px rgba(0,0,0,0.3), 0 0 60px rgba(180, 140, 255, 0.2);
    animation: planetFloat 10s ease-in-out infinite;
}
@keyframes planetFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}
.nebula-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 70% 20%, rgba(180, 140, 255, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 60% 80% at 20% 80%, rgba(255, 200, 120, 0.08) 0%, transparent 45%);
    animation: nebulaPulse 7s ease-in-out infinite;
}
@keyframes nebulaPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Имперское золотое сияние — лёгкий ореол от центра. Меняется по тиру. */
#game-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse 120% 80% at 50% 25%,
        rgba(255, 235, 160, 0.12) 0%,
        rgba(255, 220, 120, 0.06) 40%,
        transparent 70%);
    pointer-events: none;
    z-index: 1;
    transition: background 1.2s ease, opacity 1s ease;
}

/* ========== ТИРЫ ФОНА ПО ПОСТРОЙКАМ ========== */
/* Тир 0: старт — спокойный луг (базовые стили выше) */

/* Тир 1: улей/королева куплены — теплее, солнце ярче */
#game-container[data-bg-tier="1"] .sky-layer {
    background: linear-gradient(180deg,
        #3580C8 0%, #5A9EE8 14%, #7EC0F2 32%, #A8D8F5 48%,
        #D0ECD8 62%, #FFE8A0 78%, #FFD850 90%, #FFF0C0 100%);
    box-shadow: inset 0 -40vh 80vh -20vh rgba(255, 220, 100, 0.2);
}
#game-container[data-bg-tier="1"] .sun { width: 148px; height: 148px; }
#game-container[data-bg-tier="1"] .sun-rays { width: 560px; height: 560px; opacity: 1; }
#game-container[data-bg-tier="1"]::before {
    background: radial-gradient(ellipse 120% 80% at 50% 25%,
        rgba(255, 240, 170, 0.16) 0%, rgba(255, 225, 130, 0.08) 45%, transparent 72%);
}

/* Тир 2: завод/сад/пасека — золотой час, мощные лучи */
#game-container[data-bg-tier="2"] .sky-layer {
    background: linear-gradient(180deg,
        #2A6AB5 0%, #4A8ED8 10%, #6EB5EE 26%, #98D0F5 42%,
        #C5E8E8 56%, #FFE090 72%, #FFC840 86%, #FFE8A8 96%, #FFF8E0 100%);
    box-shadow: inset 0 -50vh 100vh -25vh rgba(255, 210, 80, 0.25);
}
#game-container[data-bg-tier="2"] .sun {
    width: 158px; height: 158px;
    box-shadow: 0 0 160px rgba(255, 238, 170, 0.95), 0 0 320px rgba(255, 220, 100, 0.6),
        0 0 450px rgba(255, 200, 60, 0.25), inset -12px -12px 50px rgba(255,255,255,0.65), inset 8px 8px 28px rgba(230, 170, 50, 0.3);
}
#game-container[data-bg-tier="2"] .sun-rays {
    width: 620px; height: 620px;
    background: radial-gradient(ellipse 85% 85% at 50% 50%,
        rgba(255, 248, 190, 0.55) 0%, rgba(255, 235, 150, 0.3) 32%, rgba(255, 220, 100, 0.14) 55%, transparent 78%);
}
#game-container[data-bg-tier="2"]::before {
    background: radial-gradient(ellipse 130% 85% at 50% 22%,
        rgba(255, 245, 180, 0.22) 0%, rgba(255, 230, 140, 0.12) 40%, transparent 70%);
}
#game-container[data-bg-tier="2"] .hill-far,
#game-container[data-bg-tier="2"] .hill-mid,
#game-container[data-bg-tier="2"] .hill-near {
    box-shadow: inset 0 -30px 60px -20px rgba(255, 230, 110, 0.12);
}

/* Тир 3: замок/лавка/лаборатория — имперское золото */
#game-container[data-bg-tier="3"] .sky-layer {
    background: linear-gradient(180deg,
        #1E5AA5 0%, #3A7EC8 8%, #5A9EE5 22%, #88C8F2 38%,
        #B8E4E8 52%, #FFD870 68%, #F5B830 82%, #FFD850 92%, #FFF4C8 100%);
    box-shadow: inset 0 -55vh 110vh -30vh rgba(255, 200, 60, 0.3);
}
#game-container[data-bg-tier="3"] .sun {
    width: 172px; height: 172px;
    background: radial-gradient(circle at 32% 28%, #FFFEF8, #FFE87C 18%, #F5C842 42%, #E8A020 72%, #D4A017 100%);
    box-shadow: 0 0 180px rgba(255, 242, 180, 0.98), 0 0 360px rgba(255, 225, 100, 0.65),
        0 0 500px rgba(255, 210, 70, 0.35), inset -14px -14px 55px rgba(255,255,255,0.7), inset 10px 10px 30px rgba(230, 165, 45, 0.3);
}
#game-container[data-bg-tier="3"] .sun-rays {
    width: 680px; height: 680px;
    background: radial-gradient(ellipse 88% 88% at 50% 50%,
        rgba(255, 250, 200, 0.6) 0%, rgba(255, 238, 160, 0.35) 30%, rgba(255, 225, 110, 0.16) 55%, transparent 78%);
}
#game-container[data-bg-tier="3"]::before {
    background: radial-gradient(ellipse 140% 90% at 50% 20%,
        rgba(255, 248, 190, 0.28) 0%, rgba(255, 235, 150, 0.15) 38%, transparent 68%);
}
#game-container[data-bg-tier="3"] .honeycomb-overlay {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='110' viewBox='0 0 64 110'%3E%3Cpath fill='%23D4A017' fill-opacity='0.12' d='M32 0L64 27.5v55L32 110 0 82.5V27.5z'/%3E%3Cpath fill='%23D4A017' fill-opacity='0.08' d='M0 55L32 82.5 64 55 32 27.5z'/%3E%3C/svg%3E");
}

/* Тир 4: медовый город (город/река/порт/башня/собор) — фиолетово-золотой акцент */
#game-container[data-bg-tier="4"] .sky-layer {
    background: linear-gradient(180deg,
        #2A4A88 0%, #3D6AB0 10%, #5A90D8 24%, #7EB8EE 40%,
        #A8DCE8 54%, #E8D8A8 66%, #FFD060 78%, #F0C030 88%, #FFE8A0 96%, #FFF8E8 100%);
    box-shadow: inset 0 -50vh 100vh -25vh rgba(255, 210, 80, 0.28), inset 0 0 120vh rgba(140, 100, 200, 0.06);
}
#game-container[data-bg-tier="4"] .sun {
    width: 182px; height: 182px;
    background: radial-gradient(circle at 32% 28%, #FFFEF8, #FFE87C 16%, #F5C842 40%, #E8A820 68%, #C49400 100%);
    box-shadow: 0 0 200px rgba(255, 245, 190, 0.95), 0 0 380px rgba(255, 228, 110, 0.6),
        0 0 120px rgba(200, 160, 255, 0.15), inset -14px -14px 58px rgba(255,255,255,0.72), inset 10px 10px 32px rgba(220, 160, 50, 0.32);
}
#game-container[data-bg-tier="4"] .sun-rays {
    width: 720px; height: 720px;
    background: radial-gradient(ellipse 90% 90% at 50% 50%,
        rgba(255, 252, 210, 0.58) 0%, rgba(255, 240, 170, 0.32) 30%, rgba(255, 225, 120, 0.14) 52%, rgba(230, 200, 255, 0.04) 65%, transparent 78%);
}
#game-container[data-bg-tier="4"]::before {
    background: radial-gradient(ellipse 150% 95% at 50% 18%,
        rgba(255, 250, 200, 0.3) 0%, rgba(255, 235, 160, 0.16) 35%, rgba(220, 200, 255, 0.06) 55%, transparent 70%);
}
#game-container[data-bg-tier="4"] .cloud { opacity: 0.92; }

/* Тир 5: космос (планета/галактика/туманность/вселенная) — звёздный оттенок */
#game-container[data-bg-tier="5"] .sky-layer {
    background: linear-gradient(180deg,
        #0F1E38 0%, #1A2D50 8%, #2A4A78 18%, #3D6090 30%, #5A88B8 44%,
        #88B8D8 56%, #C8E0E8 68%, #FFE090 78%, #FFC840 86%, #FFE8A8 94%, #FFF8E8 100%);
    box-shadow: inset 0 -60vh 120vh -35vh rgba(255, 220, 100, 0.22), inset 0 0 150vh rgba(80, 60, 140, 0.12);
}
#game-container[data-bg-tier="5"] .sun {
    width: 196px; height: 196px;
    background: radial-gradient(circle at 32% 28%, #FFFEFC, #FFE87C 14%, #F5C842 38%, #E8A820 65%, #B8860B 100%);
    box-shadow: 0 0 220px rgba(255, 248, 200, 0.98), 0 0 420px rgba(255, 235, 120, 0.7),
        0 0 200px rgba(180, 140, 255, 0.2), inset -16px -16px 60px rgba(255,255,255,0.75), inset 12px 12px 35px rgba(210, 155, 40, 0.35);
}
#game-container[data-bg-tier="5"] .sun-rays {
    width: 780px; height: 780px;
    background: radial-gradient(ellipse 92% 92% at 50% 50%,
        rgba(255, 252, 220, 0.62) 0%, rgba(255, 242, 180, 0.36) 28%, rgba(255, 228, 130, 0.16) 50%, rgba(200, 180, 255, 0.08) 65%, transparent 80%);
}
#game-container[data-bg-tier="5"]::before {
    background: radial-gradient(ellipse 160% 100% at 50% 15%,
        rgba(255, 252, 220, 0.32) 0%, rgba(255, 238, 170, 0.18) 32%, rgba(200, 180, 255, 0.1) 55%, transparent 72%);
}
#game-container[data-bg-tier="5"] .cloud { opacity: 0.85; filter: brightness(1.05); }
#game-container[data-bg-tier="5"] .hill-far,
#game-container[data-bg-tier="5"] .hill-mid,
#game-container[data-bg-tier="5"] .hill-near {
    box-shadow: inset 0 -40px 80px -25px rgba(255, 235, 130, 0.18), inset 0 -20px 50px -20px rgba(160, 140, 220, 0.06);
}
#game-container[data-bg-tier="5"] .honeycomb-overlay {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='110' viewBox='0 0 64 110'%3E%3Cpath fill='%23D4A017' fill-opacity='0.14' d='M32 0L64 27.5v55L32 110 0 82.5V27.5z'/%3E%3Cpath fill='%23D4A017' fill-opacity='0.1' d='M0 55L32 82.5 64 55 32 27.5z'/%3E%3C/svg%3E");
}

/* Анимация «повышение тира» — золотая вспышка при смене фона по прогрессу */
#game-container.tier-up::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 99;
    pointer-events: none;
    background: radial-gradient(ellipse 100% 70% at 50% 30%,
        rgba(255, 235, 150, 0.35) 0%,
        rgba(255, 220, 100, 0.15) 30%,
        transparent 60%);
    animation: tierUpFlash 1.6s ease-out forwards;
    opacity: 0;
}

@keyframes tierUpFlash {
    0% { opacity: 0; }
    15% { opacity: 1; }
    40% { opacity: 0.85; }
    100% { opacity: 0; }
}

.golden-dust, .fireflies-layer, .sparkles-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

#ambient-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
#bg-effects-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }

/* Северное сияние — тиры 4–5 (город, космос) */
.aurora-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
    background:
        linear-gradient(105deg, transparent 0%, rgba(120, 255, 200, 0.06) 20%, rgba(180, 255, 220, 0.1) 40%, transparent 60%),
        linear-gradient(280deg, transparent 0%, rgba(200, 120, 255, 0.07) 25%, rgba(255, 180, 220, 0.08) 50%, transparent 70%),
        linear-gradient(340deg, transparent 0%, rgba(100, 200, 255, 0.05) 30%, transparent 55%);
    background-size: 250% 200%, 200% 250%, 220% 180%;
    animation: auroraMove 18s ease-in-out infinite;
}
#game-container[data-bg-tier="4"] .aurora-layer,
#game-container[data-bg-tier="5"] .aurora-layer {
    opacity: 1;
}
@keyframes auroraMove {
    0%, 100% { background-position: 0% 0%, 100% 30%, 50% 50%; }
    33% { background-position: 100% 50%, 0% 80%, 80% 20%; }
    66% { background-position: 50% 100%, 50% 0%, 20% 80%; }
}

/* Живое небо — медленно двигающийся ореол поверх неба */
.living-sky-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(ellipse 120% 80% at 50% 20%,
        rgba(255, 245, 200, 0.08) 0%,
        rgba(255, 230, 160, 0.04) 40%,
        transparent 65%);
    background-size: 150% 150%;
    animation: livingSky 20s ease-in-out infinite;
}
@keyframes livingSky {
    0%, 100% { background-position: 0% 0%; opacity: 1; }
    50% { background-position: 30% 20%; opacity: 0.85; }
}

/* Плавающие боке-шары — золотистые круги в небе (тир 1+) */
.bokeh-container {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}
.bokeh-orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 248, 220, 0.35), rgba(255, 230, 150, 0.12));
    opacity: 0;
    transition: opacity 1s ease;
    animation: bokehFloat 15s ease-in-out infinite;
}
#game-container[data-bg-tier="1"] .bokeh-orb,
#game-container[data-bg-tier="2"] .bokeh-orb,
#game-container[data-bg-tier="3"] .bokeh-orb,
#game-container[data-bg-tier="4"] .bokeh-orb,
#game-container[data-bg-tier="5"] .bokeh-orb {
    opacity: 1;
}
.bokeh-orb.b1 { left: 5%; top: 15%; width: 40px; height: 40px; animation-delay: 0s; }
.bokeh-orb.b2 { left: 25%; top: 8%; width: 60px; height: 60px; animation-delay: -2s; animation-duration: 18s; }
.bokeh-orb.b3 { left: 55%; top: 12%; width: 35px; height: 35px; animation-delay: -4s; animation-duration: 14s; }
.bokeh-orb.b4 { left: 75%; top: 18%; width: 50px; height: 50px; animation-delay: -1s; animation-duration: 20s; }
.bokeh-orb.b5 { left: 15%; top: 35%; width: 70px; height: 70px; animation-delay: -5s; animation-duration: 16s; }
.bokeh-orb.b6 { left: 85%; top: 28%; width: 45px; height: 45px; animation-delay: -3s; }
.bokeh-orb.b7 { left: 40%; top: 25%; width: 55px; height: 55px; animation-delay: -6s; animation-duration: 22s; }
.bokeh-orb.b8 { left: 65%; top: 35%; width: 30px; height: 30px; animation-delay: -2.5s; animation-duration: 12s; }
.bokeh-orb.b9 { left: 10%; top: 50%; width: 80px; height: 80px; animation-delay: -7s; animation-duration: 25s; }
.bokeh-orb.b10 { left: 90%; top: 45%; width: 38px; height: 38px; animation-delay: -4.5s; }
.bokeh-orb.b11 { left: 50%; top: 40%; width: 65px; height: 65px; animation-delay: -1.5s; animation-duration: 19s; }
.bokeh-orb.b12 { left: 30%; top: 55%; width: 42px; height: 42px; animation-delay: -3.5s; animation-duration: 17s; }
@keyframes bokehFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(8px, -12px) scale(1.1); }
    50% { transform: translate(-5px, 6px) scale(0.95); }
    75% { transform: translate(10px, 8px) scale(1.05); }
}

#scene-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
#particles-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* === Центр: без сплошной панели, фон виден между блоками === */
.main-center {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    max-width: 640px;
    margin: 0 auto;
}
.main-center .game-header,
.main-center .rebirth-bar,
.main-center .honey-jar-section,
.main-center .buildings-section,
.main-center .game-footer {
    background: rgba(255, 248, 235, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid rgba(212, 160, 23, 0.35);
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(92, 64, 51, 0.1);
}
.main-center .game-header {
    padding: 12px 18px 14px;
    overflow: hidden;
}
/* Первая строка: логотип + мёд/заработок; вторая строка: шкала уровня на всю ширину */
.main-center .game-header .logo { order: 1; }
.main-center .game-header .header-right { order: 2; }
.main-center .game-header .level-display {
    order: 3;
    flex-basis: 100%;
    width: 100%;
    min-width: 0;
    max-width: none;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}
.main-center .game-header .level-bar {
    order: 1;
    flex: 1;
    min-width: 0;
    height: 18px;
}
.main-center .game-header .level-badge {
    order: 2;
    flex-shrink: 0;
}
.main-center .rebirth-bar { margin: 0; padding: 8px 12px; }
.main-center .buildings-section { padding: 10px 14px; }
.main-center .game-footer { padding: 10px 14px; }

/* === HUD-шапка (игровой верхний бар) === */
.game-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    min-height: 52px;
    padding: 10px 18px 12px;
    background: var(--hud-bg);
    border-bottom: var(--hud-border);
    box-shadow: 0 4px 16px rgba(212, 160, 23, 0.12);
}

.logo {
    display: flex;
    align-items: center;
    gap: 18px;
}

.logo-icon {
    font-size: clamp(2.2rem, 4vw, 2.8rem);
    filter: drop-shadow(0 4px 14px rgba(0,0,0,0.28));
    animation: beeFloat 2.8s ease-in-out infinite;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo-title {
    font-family: 'Comfortaa', cursive;
    font-size: clamp(1.3rem, 4vw, 1.75rem);
    font-weight: 700;
    line-height: 1.15;
    color: transparent;
    background: linear-gradient(135deg, #9A6B0A 0%, var(--honey-dark) 30%, var(--honey-warm) 60%, var(--amber) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: none;
    letter-spacing: 0.02em;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15)) drop-shadow(0 0 20px rgba(255, 200, 50, 0.2));
}

.logo-subtitle:empty { display: none; }
.logo-subtitle {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--honey-dark);
    opacity: 0.9;
}

@keyframes beeFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-12px) rotate(2deg); }
}

/* Уровень и опыт — в HUD, крупная шкала */
.level-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    max-width: 320px;
}
.level-badge {
    font-size: 1rem;
    font-weight: 700;
    color: var(--honey-dark);
    background: linear-gradient(135deg, var(--honey-light) 0%, #FFE8A8 50%, #FFF4D4 100%);
    padding: 8px 18px;
    border-radius: 999px;
    box-shadow: 0 3px 12px var(--shadow-soft), inset 0 1px 0 rgba(255,255,255,0.8);
    border: 2px solid rgba(212, 160, 23, 0.4);
}
.level-bar {
    width: 100%;
    height: 16px;
    background: var(--cream-dark);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid rgba(212, 160, 23, 0.2);
}
.level-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--honey-dark) 0%, var(--honey-warm) 100%);
    border-radius: 999px;
    transition: width 0.55s ease-out;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}
.stat-level-bar {
    margin: 4px 0 12px;
    height: 12px;
    max-width: 100%;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    min-width: 0;
}

.quests-upgrades-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Панель перерождения — под шапкой */
.rebirth-bar {
    z-index: 100000;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 16px;
    margin: 0 0 12px;
    background: linear-gradient(135deg, rgba(232, 213, 255, 0.25) 0%, rgba(212, 192, 240, 0.2) 50%, rgba(139, 107, 176, 0.15) 100%);
    border-radius: var(--card-game-radius);
    border: 1px solid rgba(139, 107, 176, 0.35);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 4px 16px rgba(139, 107, 176, 0.12);
}

.rebirth-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    position: relative;
}

.rebirth-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #4A3560;
    background: rgba(255,255,255,0.6);
    border: 2px solid #9B7BB8;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(139, 107, 176, 0.2);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.rebirth-info-btn:hover {
    background: rgba(255,255,255,0.9);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(139, 107, 176, 0.3);
}

/* Всплывающая панель условий перерождения */
.rebirth-popover {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    z-index: 100000;
    min-width: 280px;
    max-width: 420px;
}

.rebirth-popover.hidden {
    display: none;
}

.rebirth-popover-inner {
    z-index: 100000;
    position: relative;
    padding: 14px 18px 14px;
    background: linear-gradient(145deg, #FFFBFE 0%, #F5EBFF 100%);
    border: 2px solid #9B7BB8;
    border-radius: var(--card-game-radius);
    box-shadow: 0 12px 32px rgba(139, 107, 176, 0.35), 0 0 0 1px rgba(255,255,255,0.5) inset;
}

.rebirth-popover-title {
    margin: 0 0 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #3D2E50;
}

.rebirth-popover-content {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #4A3560;
}

.rebirth-popover-content strong {
    color: #3D2E50;
}

.rebirth-popover-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 1.4rem;
    line-height: 1;
    color: #6A5A7A;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.rebirth-popover-close:hover {
    color: #3D2E50;
    background: rgba(139, 107, 176, 0.15);
}

.rebirth-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    min-height: 40px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #3D2E50;
    background: linear-gradient(145deg, #F5EBFF 0%, #E8D5FF 50%, #D4C0F0 100%);
    border: 2px solid #9B7BB8;
    border-radius: var(--btn-game-radius);
    cursor: pointer;
    box-shadow:
        0 4px 14px rgba(139, 107, 176, 0.25),
        inset 0 1px 0 rgba(255,255,255,0.5);
    transition: transform 0.2s, box-shadow 0.25s, background 0.25s, border-color 0.2s;
}

.rebirth-btn .rebirth-icon {
    font-size: 1.35rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

.rebirth-btn .rebirth-text {
    letter-spacing: 0.02em;
}

.rebirth-btn .rebirth-label {
    padding: 4px 12px;
    background: rgba(255,255,255,0.6);
    border-radius: 999px;
    font-size: 0.95rem;
    color: #4A3560;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 1px 3px rgba(139, 107, 176, 0.2);
}

.rebirth-btn:not(:disabled):hover {
    background: linear-gradient(145deg, #FFF5FF 0%, #F0E5FF 50%, #E0D0F5 100%);
    border-color: #A88BC4;
    transform: translateY(-2px);
    box-shadow:
        0 8px 24px rgba(139, 107, 176, 0.4),
        0 0 20px rgba(212, 160, 255, 0.2),
        inset 0 1px 0 rgba(255,255,255,0.6);
}

.rebirth-btn:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(139, 107, 176, 0.3), inset 0 1px 0 rgba(255,255,255,0.5);
}

.rebirth-btn:disabled {
    opacity: 0.75;
    cursor: default;
    transform: none;
    background: linear-gradient(145deg, #E8E0F0 0%, #D8D0E8 100%);
    border-color: #B8B0C8;
    color: #6A5A7A;
    box-shadow: 0 2px 8px rgba(139, 107, 176, 0.1);
}

.rebirth-btn:disabled .rebirth-label {
    background: rgba(255,255,255,0.4);
    color: #5A4A6A;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid var(--honey-primary);
    border-radius: var(--btn-game-radius);
    background: var(--glass-bg);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--wood);
    cursor: pointer;
    box-shadow: 0 3px 14px var(--shadow-soft);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.action-btn:hover {
    background: var(--honey-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 22px var(--shadow-gold);
}

.action-btn .emoji-icon {
    font-size: 1.1em;
}

.resources-panel {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    min-width: 0;
}

.resource {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--card-game-bg);
    border-radius: var(--card-game-radius);
    box-shadow: var(--card-game-shadow);
    border: var(--card-game-border);
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 0;
}

.resource.honey-resource {
    min-width: 120px;
}

.resource.income-resource {
    min-width: 100px;
    overflow: hidden;
}

.resource:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px var(--shadow-gold);
}

.resource-icon { font-size: 1.4rem; flex-shrink: 0; }

.resource-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--wood);
    font-family: 'Outfit', sans-serif;
    font-variant-numeric: tabular-nums;
    min-width: 3.5em;
    text-align: right;
    display: inline-block;
}

.honey-resource .resource-value {
    min-width: 5.5em;
}

.income-resource .resource-value {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resource-value.pulse { animation: numberPulse 0.25s ease-out; }

@keyframes numberPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.resource-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wood-light);
    opacity: 0.9;
}

/* === Главная кнопка — банка мёда (чистый вариант) === */
.honey-jar-section {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 18px 16px 24px;
}

.jar-wrapper {
    position: relative;
}

.honey-jar {
    position: relative;
    width: 130px;
    height: 130px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    background: 
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.65) 0%, transparent 48%),
        radial-gradient(circle at 68% 72%, rgba(160, 110, 30, 0.25) 0%, transparent 50%),
        linear-gradient(160deg, #FFE87C 0%, #F0C842 30%, #E0A820 60%, #C08818 100%);
    box-shadow: 
        0 4px 12px rgba(60, 45, 25, 0.2),
        inset 0 6px 20px rgba(255, 255, 255, 0.45),
        inset 0 -4px 14px rgba(120, 80, 20, 0.2);
    transition: transform 0.12s ease-out, box-shadow 0.2s ease;
}

.jar-shine,
.jar-fill,
.jar-glow,
.jar-inner-glow {
    z-index: 1;
}

.jar-body {
    display: block;
    position: relative;
    z-index: 3; /* иконка банки всегда поверх эффектов */
}

.jar-icon {
    position: relative;
    z-index: 4;
}

.honey-jar:hover {
    transform: scale(1.08);
    box-shadow: 
        0 6px 16px rgba(60, 45, 25, 0.22),
        inset 0 6px 20px rgba(255, 255, 255, 0.5),
        inset 0 -4px 14px rgba(120, 80, 20, 0.18);
}

.honey-jar:active {
    transform: scale(0.96);
    transition-duration: 0.05s;
    box-shadow: 
        0 2px 8px rgba(50, 35, 20, 0.18),
        inset 0 8px 24px rgba(0, 0, 0, 0.08),
        inset 0 -2px 10px rgba(80, 50, 10, 0.15);
}

.jar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease-out;
}

.honey-jar:active .jar-icon {
    transform: scale(0.92);
}

.jar-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--wood);
    white-space: nowrap;
    font-family: 'Comfortaa', cursive;
    letter-spacing: 0.02em;
    opacity: 0.95;
}

.jar-glow {
    display: none;
}

.jar-shine {
    position: absolute;
    top: 14%;
    left: 20%;
    width: 32%;
    height: 40%;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.55) 52%, transparent 65%);
    border-radius: 50%;
    pointer-events: none;
    animation: jarShine 3.5s ease-in-out infinite;
}

@keyframes jarShine {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.15); }
}

.jar-inner-glow {
    display: none;
}

.jar-fill {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 72%;
    height: 0%;
    background: linear-gradient(180deg, transparent, rgba(230, 184, 0, 0.78));
    border-radius: 0 0 50% 50%;
    pointer-events: none;
    transition: height 0.35s ease;
    box-shadow: inset 0 -6px 16px rgba(255, 193, 7, 0.4);
}

/* События */
.event-banner {
    position: relative;
    z-index: 15;
    margin: 14px 20px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--honey-light), var(--cream));
    border-radius: 18px;
    border: 2px solid var(--honey-primary);
    box-shadow: 0 6px 28px var(--shadow-gold);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    animation: bannerPop 0.45s ease-out;
}

@keyframes bannerPop {
    from { opacity: 0; transform: translateY(-24px); }
    to { opacity: 1; transform: translateY(0); }
}

.event-name { font-weight: 700; font-size: 1.15rem; font-family: 'Comfortaa', cursive; }
.event-desc { font-size: 0.9rem; opacity: 0.9; }
.event-timer { margin-left: auto; font-weight: 700; color: var(--wood); }

/* Активные бонусы от рекламы — отдельный блок под кнопкой, каждый бонус в свой ряд */
.active-boosts-container {
    position: relative;
    z-index: 15;
    margin: 10px 20px 16px;
    padding: 0;
    display: none;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    justify-content: flex-start;
}

.active-boost {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #FFFBF0 0%, #FFF4E0 35%, #FFEBC4 100%);
    border: 2px solid var(--honey-primary);
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(92, 64, 51, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.active-boost::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--honey-gold), var(--honey-dark));
    border-radius: 18px 0 0 18px;
}

.boost-icon {
    font-size: 1.8rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 235, 200, 0.8) 100%);
    border-radius: 12px;
    border: 1px solid rgba(212, 160, 23, 0.4);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 2px 8px rgba(140, 90, 20, 0.15);
}

.boost-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.boost-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #4A3520;
    font-family: 'Comfortaa', cursive;
    line-height: 1.25;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.boost-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #8B6914;
    line-height: 1.2;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.boost-timer {
    font-size: 0.78rem;
    font-weight: 700;
    color: #6B4A0A;
    line-height: 1.2;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

@keyframes boostSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Комбо — компактная надпись */
.combo-display {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 14px;
    background: linear-gradient(135deg, var(--honey-gold), var(--amber));
    border-radius: 16px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--wood);
    box-shadow: 0 4px 14px var(--shadow-gold);
    z-index: 12;
    font-family: 'Comfortaa', cursive;
}

.combo-display.combo-pop {
    animation: comboBounce 0.35s ease-out;
}

@keyframes comboBounce {
    0% { transform: translateX(-50%) scale(0.5); }
    70% { transform: translateX(-50%) scale(1.15); }
    100% { transform: translateX(-50%) scale(1); }
}

/* Достижения тост */
.achievement-toast {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    padding: 18px 28px;
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    border-radius: 20px;
    border: 3px solid var(--honey-primary);
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 18px;
    z-index: 200;
    max-width: 92%;
}

.achievement-toast.toast-show {
    animation: toastIn 0.45s ease-out;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-40px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast-icon, .ach-icon { font-size: 2.2rem; display: inline-block; vertical-align: middle; }

/* Сцена луга — крупнее, чтобы отображать игру */
.meadow-scene {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 58%;
    pointer-events: none;
    z-index: 2;
}

.meadow-scene .meadow-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120%;
    background: linear-gradient(180deg,
        rgba(0,0,0,0) 10%,
        rgba(93, 138, 62, 0.10) 45%,
        rgba(74, 124, 35, 0.18) 78%,
        rgba(80, 120, 40, 0.20) 100%);
    border-radius: 50% 50% 0 0 / 12% 12% 0 0;
}

/* Сглаживание нижнего перехода “травы” */
.meadow-scene .meadow-ground::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 28%;
    background: linear-gradient(180deg,
        rgba(0,0,0,0) 0%,
        rgba(255, 248, 235, 0.08) 55%,
        rgba(255, 248, 235, 0.14) 100%);
    filter: blur(0.4px);
    border-radius: inherit;
    pointer-events: none;
}

.meadow-city-haze {
    position: absolute;
    left: 0;
    bottom: 20%;
    width: 100%;
    height: 26%;
    background: linear-gradient(180deg, rgba(255, 240, 200, 0) 0%, rgba(255, 220, 150, 0.12) 45%, rgba(160, 120, 60, 0.14) 100%);
    filter: blur(1px);
    opacity: 0.9;
}

.meadow-river-band {
    position: absolute;
    left: -10%;
    bottom: 9%;
    width: 120%;
    height: 10%;
    background: linear-gradient(90deg, rgba(120, 210, 255, 0.10) 0%, rgba(90, 190, 255, 0.20) 35%, rgba(120, 210, 255, 0.10) 70%, rgba(90, 190, 255, 0.16) 100%);
    border-radius: 999px;
    filter: blur(0.3px);
    opacity: 0.8;
}

.meadow-space-haze {
    position: absolute;
    left: 0;
    bottom: 42%;
    width: 100%;
    height: 30%;
    background: radial-gradient(circle at 60% 40%, rgba(120, 190, 255, 0.12) 0%, rgba(120, 120, 255, 0.06) 35%, rgba(0,0,0,0) 70%);
    pointer-events: none;
}

.meadow-stars {
    position: absolute;
    left: 0;
    bottom: 45%;
    width: 100%;
    height: 30%;
    pointer-events: none;
}

.meadow-stars .meadow-star {
    position: absolute;
    font-size: 14px;
    opacity: 0.7;
    filter: drop-shadow(0 2px 6px rgba(255,255,255,0.25));
    animation: starTwinkle 3.5s ease-in-out infinite;
}

.meadow-stars .s1 { left: 12%; top: 25%; animation-delay: 0.1s; }
.meadow-stars .s2 { left: 28%; top: 8%; animation-delay: 0.8s; font-size: 12px; }
.meadow-stars .s3 { left: 46%; top: 18%; animation-delay: 1.4s; font-size: 10px; }
.meadow-stars .s4 { left: 62%; top: 6%; animation-delay: 0.5s; font-size: 12px; }
.meadow-stars .s5 { left: 78%; top: 22%; animation-delay: 1.1s; font-size: 10px; }
.meadow-stars .s6 { left: 90%; top: 10%; animation-delay: 1.7s; font-size: 11px; }

@keyframes starTwinkle {
    0%, 100% { opacity: 0.45; transform: scale(1); }
    50% { opacity: 0.95; transform: scale(1.12); }
}

.meadow-space {
    opacity: 0.85;
    filter: drop-shadow(0 4px 18px rgba(0,0,0,0.28));
    animation-duration: 7.5s;
}

.meadow-city-skyline {
    opacity: 0.45;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.20));
    transform: translateX(-50%);
}

.meadow-item {
    position: absolute;
    filter: drop-shadow(0 4px 14px rgba(0,0,0,0.2));
    animation: meadowFloat 5.5s ease-in-out infinite;
}

.meadow-item .scene-illus.emoji-icon {
    display: block;
    line-height: 1;
    font-size: 2.4rem;
}

.meadow-hive .scene-illus.emoji-icon { font-size: 2.2rem; }
.meadow-flower .scene-illus.emoji-icon { font-size: 2.1rem; }
.meadow-factory .scene-illus.emoji-icon { font-size: 2.6rem; }
.meadow-garden .scene-illus.emoji-icon { font-size: 2.4rem; }
.meadow-apiary .scene-illus.emoji-icon { font-size: 2.8rem; }
.meadow-honey-city .scene-illus.emoji-icon { font-size: 2.6rem; }
.meadow-honey-tower .scene-illus.emoji-icon { font-size: 2.7rem; }
.meadow-honey-cathedral .scene-illus.emoji-icon { font-size: 2.6rem; }
.meadow-honey-exchange .scene-illus.emoji-icon,
.meadow-honey-rail .scene-illus.emoji-icon,
.meadow-honey-university .scene-illus.emoji-icon,
.meadow-honey-port .scene-illus.emoji-icon,
.meadow-honey-river .scene-illus.emoji-icon { font-size: 2.1rem; }

.meadow-space .scene-illus.emoji-icon { font-size: 2.2rem; }
.meadow-space-universe .scene-illus.emoji-icon { font-size: 2.8rem; }
.meadow-space-blackhole .scene-illus.emoji-icon { font-size: 2.6rem; }

.meadow-item .scene-svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
}

.meadow-scene.scene-updated {
    animation: sceneFlash 0.5s ease-out;
}

@keyframes sceneFlash {
    0% { filter: brightness(1); }
    40% { filter: brightness(1.15); }
    100% { filter: brightness(1); }
}

.building-card.just-purchased {
    animation: purchaseCelebrate 0.7s ease-out;
}

@keyframes purchaseCelebrate {
    0% { box-shadow: 0 0 0 0 rgba(212, 160, 23, 0.6); }
    50% { box-shadow: 0 0 40px 8px rgba(212, 160, 23, 0.5); }
    100% { box-shadow: 0 10px 40px var(--shadow-soft); }
}

.meadow-hive { filter: drop-shadow(0 5px 16px rgba(0,0,0,0.22)); }
.meadow-flower { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.18)); }
.meadow-factory { position: relative; display: block; }
.meadow-factory .scene-svg { filter: drop-shadow(0 5px 18px rgba(0,0,0,0.3)); }
.meadow-factory .factory-smoke {
    position: absolute;
    top: -14px;
    left: 50%;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, rgba(255, 248, 220, 0.5) 0%, rgba(180, 180, 180, 0.35) 50%, transparent 70%);
    border-radius: 50%;
    transform: translateX(-50%);
    animation: smokeRise 4.5s ease-out infinite;
}
.meadow-factory .factory-smoke.s2 { left: 55%; width: 12px; height: 12px; top: -10px; animation-delay: 1.3s; }
.meadow-factory .factory-honey-drip {
    position: absolute;
    bottom: -10px;
    left: 45%;
    width: 8px;
    height: 14px;
    background: linear-gradient(180deg, var(--honey-gold), var(--honey-dark));
    border-radius: 0 0 4px 4px;
    animation: honeyDripAnim 2.2s ease-in-out infinite;
}

@keyframes honeyDripAnim {
    0%, 58% { opacity: 0.9; transform: scaleY(1); }
    78% { opacity: 0.5; transform: scaleY(1.35); }
    100% { opacity: 0.9; transform: scaleY(1); }
}

@keyframes smokeRise {
    0% { opacity: 0.65; transform: translateX(-50%) translateY(0) scale(0.8); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-55px) scale(2.8); }
}

.meadow-apiary { position: relative; }
.meadow-apiary .scene-svg { filter: drop-shadow(0 6px 24px rgba(0,0,0,0.3)); }
.meadow-apiary .apiary-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 130%;
    height: 130%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(212, 160, 23, 0.25) 0%, transparent 65%);
    border-radius: 50%;
    animation: apiaryGlow 3.5s ease-in-out infinite;
}

@keyframes apiaryGlow {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}

.meadow-castle { position: relative; }
.meadow-castle .scene-illus.emoji-icon,
.meadow-castle .scene-svg { font-size: 3.5rem; filter: drop-shadow(0 6px 20px rgba(0,0,0,0.3)); }
.meadow-castle .castle-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140%;
    height: 140%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(212, 160, 23, 0.2) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}

.meadow-shop .scene-illus.emoji-icon,
.meadow-shop .scene-svg { font-size: 2rem; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2)); }
.meadow-lab .scene-illus.emoji-icon,
.meadow-lab .scene-svg { font-size: 2.2rem; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2)); }

.meadow-queen { position: relative; }
.meadow-queen .scene-svg { filter: drop-shadow(0 5px 18px rgba(212, 160, 23, 0.35)); }
.meadow-queen .queen-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 160%;
    height: 160%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(245, 200, 66, 0.22) 0%, transparent 65%);
    border-radius: 50%;
    animation: queenGlow 2.2s ease-in-out infinite;
}

@keyframes queenGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.meadow-garden .scene-svg { filter: drop-shadow(0 4px 16px rgba(74, 124, 35, 0.35)); }

@keyframes meadowFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Бабочки */
.butterflies-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.butterfly {
    position: absolute;
    font-size: 1.6rem;
    opacity: 0.65;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
    animation: butterflyFly 11s ease-in-out infinite;
}

@keyframes butterflyFly {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(55px, -45px) rotate(18deg); }
    50% { transform: translate(-35px, 35px) rotate(-12deg); }
    75% { transform: translate(45px, 55px) rotate(10deg); }
}

/* Статистика */
.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid rgba(139, 105, 20, 0.15);
    font-size: 1.05rem;
}

.stat-row:last-of-type { border-bottom: none; }

/* Достижения */
.achievement-item {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px;
    margin: 10px 0;
    border-radius: 18px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    transition: all 0.25s;
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, rgba(255, 244, 212, 0.95), rgba(255, 251, 240, 0.9));
    border-color: var(--honey-primary);
    box-shadow: 0 4px 20px var(--shadow-gold);
}

.achievement-item.locked {
    opacity: 0.7;
}

.ach-desc { font-size: 0.9rem; color: var(--wood-light); }

/* На мобилке достижения внутри статистики */
.stats-achievements-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid rgba(212, 160, 23, 0.25);
}
.stats-achievements-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--honey-dark);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
}
.stats-achievements-list .achievement-item {
    margin: 8px 0;
    padding: 12px;
}

/* Всплывающие числа — внутри панели, не выходят за границы */
#floating-numbers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.floating-number {
    position: absolute;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--honey-gold);
    font-family: 'Comfortaa', cursive;
    text-shadow: 
        0 0 24px rgba(255, 217, 61, 0.9),
        0 0 48px rgba(255, 179, 71, 0.5),
        0 3px 6px rgba(0,0,0,0.35);
    animation: floatUp 1.3s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(0.85); }
    30% { opacity: 1; transform: translateY(-24px) scale(1.25); }
    100% { opacity: 0; transform: translateY(-100px) scale(1.5); }
}

/* Офлайн бонус */
.offline-bonus {
    background: linear-gradient(135deg, var(--honey-light), var(--cream));
    padding: 18px 28px;
    border-radius: 20px;
    margin: 18px 0;
    text-align: center;
    border: 2px solid var(--honey-primary);
    box-shadow: 0 6px 28px var(--shadow-gold);
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Секции (игровой стиль) === */
.buildings-section {
    padding: 12px 16px 18px;
}

.section-title {
    font-family: 'Comfortaa', cursive;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--wood);
    margin-bottom: 12px;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0,0,0,0.06);
    letter-spacing: -0.3px;
}

.buildings-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.building-tab-btn {
    padding: 8px 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wood);
    background: var(--card-game-bg);
    border: 2px solid var(--glass-border);
    border-radius: var(--btn-game-radius);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 10px var(--shadow-soft);
}

.building-tab-btn:hover:not(:disabled) {
    background: var(--honey-light);
    border-color: var(--honey-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-gold);
}

.building-tab-btn.active {
    background: linear-gradient(145deg, #FFFBF0 0%, #FFF4D4 100%);
    border-color: var(--honey-primary);
    color: var(--wood);
    box-shadow: 0 4px 16px var(--shadow-gold), inset 0 1px 0 rgba(255,255,255,0.5);
}

.building-tab-btn.locked:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    color: var(--wood-light);
}

/* Квесты */
.quests-section {
    margin-bottom: 28px;
}
.quests-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.quest-slot {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px 18px;
    box-shadow: 0 4px 20px var(--shadow-soft);
    transition: border-color 0.25s, box-shadow 0.25s;
}
.quest-slot.done {
    border-color: var(--honey-primary);
    box-shadow: 0 4px 24px var(--shadow-gold);
}
.quest-desc {
    font-weight: 600;
    color: var(--wood);
    margin-bottom: 8px;
    font-size: 1rem;
}
.quest-progress {
    height: 6px;
    background: var(--cream-dark);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
}
.quest-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--honey-dark) 0%, var(--honey-warm) 100%);
    border-radius: 999px;
    transition: width 0.4s ease-out;
}
.quest-nums {
    font-size: 0.9rem;
    color: var(--wood-light);
    margin-bottom: 12px;
}
.quest-claim {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--wood);
    background: linear-gradient(135deg, var(--honey-gold) 0%, var(--honey-primary) 50%, var(--honey-dark) 100%);
    border: 2px solid var(--honey-dark);
    border-radius: 14px;
    box-shadow: 0 4px 16px var(--shadow-gold), inset 0 1px 0 rgba(255,255,255,0.35);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.quest-claim:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px var(--shadow-gold), inset 0 1px 0 rgba(255,255,255,0.4);
}
.quest-claim:active:not(:disabled) {
    transform: translateY(0);
}
.quest-claim:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: linear-gradient(135deg, var(--cream-dark) 0%, #E8E0D0 100%);
    border-color: var(--glass-border);
    box-shadow: none;
}

.upgrades-section {
    margin-bottom: 28px;
}

.upgrades-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.upgrade-card {
    flex: 1 1 150px;
    padding: 16px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 2px solid var(--glass-border);
    box-shadow: 0 6px 24px var(--shadow-soft);
    transition: all 0.28s;
    overflow: hidden;
}

.upgrade-card.affordable {
    border-color: var(--honey-primary);
    background: linear-gradient(145deg, #FFFBF0 0%, #FFF4D4 50%, #FFEEB8 100%);
    box-shadow: 0 0 24px rgba(212, 160, 23, 0.35);
}

.upgrade-card.affordable::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: upgradeShine 2.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes upgradeShine {
    0% { left: -100%; }
    100% { left: 180%; }
}

.upgrade-card:hover { transform: translateY(-4px); }

.upgrade-name { font-weight: 700; color: var(--wood); display: block; font-size: 1.05rem; }
.upgrade-desc { font-size: 0.88rem; color: var(--wood-light); opacity: 0.92; }

.buildings-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Карточки построек — игровой стиль (карточки как в игре) */
.building-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: var(--card-game-bg);
    border-radius: var(--card-game-radius);
    border: var(--card-game-border);
    box-shadow: var(--card-game-shadow);
    transition: all 0.28s;
}

.building-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 32px var(--shadow-soft);
}

.building-card.affordable {
    border-color: var(--honey-primary);
    background: linear-gradient(145deg, #FFFBF0 0%, #FFF4D4 50%, #FFEEB8 100%);
    box-shadow: 0 0 28px rgba(212, 160, 23, 0.35), var(--card-game-shadow);
}

.building-card.affordable:hover {
    box-shadow: 0 0 40px rgba(212, 160, 23, 0.45);
}

.building-card.affordable::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 38%, rgba(255,255,255,0.22) 45%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0.22) 55%, transparent 62%);
    animation: cardShine 3.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cardShine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.building-card.maxed .buy-btn {
    opacity: 0.6;
    cursor: default;
}

.building-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.building-actions .buy-btn {
    min-width: 0;
}

.buy-10-btn,
.buy-25-btn,
.buy-max-btn {
    font-size: 0.9rem;
    padding: 8px 14px;
}

.buy-10-btn .cost-text,
.buy-25-btn .cost-text,
.buy-max-btn .cost-text {
    font-weight: 700;
}

.building-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(145deg, #FFFDF8 0%, #FFF5E0 100%);
    border-radius: 16px;
    border: 2px solid rgba(212, 160, 23, 0.35);
    box-shadow: inset 0 2px 8px rgba(255,255,255,0.9), 0 2px 8px rgba(0,0,0,0.06);
}

.building-icon .svg-icon,
.building-icon .emoji-icon {
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.12));
    transition: transform 0.35s;
}

.building-card.affordable:hover .building-icon .svg-icon,
.building-card.affordable:hover .building-icon .emoji-icon {
    transform: scale(1.12) rotate(-4deg);
}

.building-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.building-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--wood);
    font-family: 'Comfortaa', cursive;
}

.building-desc {
    font-size: 0.82rem;
    color: var(--wood-light);
    opacity: 0.9;
}

.building-progress {
    height: 6px;
    background: rgba(212, 160, 23, 0.12);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--honey-primary), var(--amber));
    border-radius: 999px;
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(212, 160, 23, 0.4);
}

.building-count {
    font-size: 0.82rem;
    color: var(--leaf);
    font-weight: 600;
}

.buy-btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--btn-game-radius);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, var(--honey-gold) 0%, var(--honey-primary) 50%, var(--honey-dark) 100%);
    color: var(--wood);
    box-shadow: 
        0 4px 20px var(--shadow-gold),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: all 0.25s;
}

.buy-btn.small { padding: 10px 18px; font-size: 0.9rem; }

.buy-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 28px var(--shadow-gold);
}

.buy-btn:active:not(:disabled) { transform: scale(0.98); }

.buy-btn:disabled {
    background: linear-gradient(135deg, #c4b8a8, #a89888);
    color: #8a7a6a;
    cursor: not-allowed;
    box-shadow: none;
}

/* Декоративные пчёлы */
.bees-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
    overflow: hidden;
}

.decor-bee {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0.55;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.18));
    animation: beePath 9s ease-in-out infinite;
}

@keyframes beePath {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(45px, -35px) rotate(18deg); }
    40% { transform: translate(-35px, 28px) rotate(-12deg); }
    60% { transform: translate(28px, 45px) rotate(10deg); }
    80% { transform: translate(-40px, -24px) rotate(-14deg); }
}

/* Футер — игровое меню */
.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    background: var(--hud-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    z-index: 20;
    border-top: var(--hud-border);
    box-shadow: 0 -4px 24px rgba(212, 160, 23, 0.1);
}

.mobile-only { display: none !important; }

.footer-btn {
    padding: 10px 16px;
    border: 2px solid var(--honey-primary);
    border-radius: var(--btn-game-radius);
    background: var(--card-game-bg);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--wood);
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: var(--card-game-shadow);
}

.mobile-fab-row {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--footer-h, 72px) + 14px);
    z-index: 25;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding: 0 16px;
    pointer-events: none;
}

.mobile-fab-row > * { pointer-events: auto; }

.mobile-fab-btn {
    width: clamp(72px, 22vmin, 96px);
    height: clamp(72px, 22vmin, 96px);
    padding: 0;
    border-radius: 999px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    line-height: 1;
    background: linear-gradient(160deg, #FFFEF9 0%, #FFF9E6 25%, #FFEFB8 60%, #FFE08A 100%);
    border: 4px solid var(--honey-primary);
    box-shadow:
        0 10px 32px rgba(92, 64, 51, 0.22),
        0 6px 18px rgba(212, 160, 23, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset,
        inset 0 2px 0 rgba(255, 255, 255, 0.85);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.2s ease;
}

.mobile-fab-btn:hover {
    transform: scale(1.08);
    box-shadow:
        0 14px 40px rgba(92, 64, 51, 0.24),
        0 8px 24px rgba(212, 160, 23, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset,
        inset 0 2px 0 rgba(255, 255, 255, 1);
    border-color: var(--honey-dark);
}

.mobile-fab-btn:active {
    transform: scale(0.94);
    box-shadow:
        0 4px 20px rgba(92, 64, 51, 0.2),
        inset 0 3px 12px rgba(0, 0, 0, 0.08);
}

/* Специфичность выше, чем у .footer-btn .emoji-icon { 1em } в icons.css */
.footer-btn.mobile-fab-btn .emoji-icon {
    margin-right: 0 !important;
    display: block;
    line-height: 1;
    font-size: 2em !important;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.15));
}

/* Индикатор уведомления (красная точка) */
.mobile-fab-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(145deg, #F44336 0%, #C62828 100%);
    border: 3px solid rgba(255, 251, 240, 0.98);
    box-shadow: 0 4px 14px rgba(198, 40, 40, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.footer-btn:hover {
    background: var(--honey-light);
    transform: translateY(-3px);
    box-shadow: 0 8px 28px var(--shadow-gold);
}

.footer-btn:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.daily-reward-btn {
    background: linear-gradient(135deg, #FFE8A8 0%, var(--honey-light) 100%);
    border-color: var(--honey-dark);
}

/* Мобильные модалки квестов/усилений — без двойных заголовков */
#quests-modal .panel-title,
#upgrades-modal .panel-title {
    display: none;
}

#quests-modal .panel-block,
#upgrades-modal .panel-block {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

#ad-modal .panel-title { display: none; }
#ad-modal .panel-block {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}
#ad-modal #close-ad {
    margin-top: 1.25rem;
}

/* На мобилке "За рекламу" открываем снизу, а не в правой колонке */
@media (max-width: 1000px) {
    .right-panel { display: none; }
    .right-panel .panel-ad-rewards { display: none; }

    /* Новости в центре: ширина как у игровых карточек */
    .panel-news {
        width: 100%;
        max-width: 640px;
        margin: 0 auto;
    }
}

/* Модальные окна — игровой стиль */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(92, 64, 51, 0.4);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-content {
    background: var(--game-panel-bg);
    padding: 32px 36px;
    border-radius: var(--modal-game-radius);
    max-width: 440px;
    width: 100%;
    border: var(--modal-game-border);
    box-shadow: 
        0 24px 80px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(212, 160, 23, 0.2);
    max-height: 85vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--honey-primary) var(--cream-dark);
}

.modal-content::-webkit-scrollbar {
    width: 10px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--cream-dark);
    border-radius: 10px;
    margin: 8px 0;
}

.modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--honey-primary) 0%, var(--honey-dark) 100%);
    border-radius: 10px;
    border: 2px solid var(--cream-dark);
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--honey-warm) 0%, var(--honey-primary) 100%);
}

.modal-content.modal-scroll {
    max-width: 520px;
}

.modal-content .quests-list {
    margin-bottom: 24px;
}

.modal-content .upgrades-grid {
    margin-bottom: 24px;
}

.modal-content h3 {
    font-family: 'Comfortaa', cursive;
    text-align: center;
    color: var(--wood);
    font-size: 1.6rem;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid rgba(212, 160, 23, 0.3);
}

/* Модалка подтверждения перерождения */
.rebirth-confirm-content {
    max-width: 400px;
    background: linear-gradient(145deg, #FFFBFE 0%, #F5EBFF 100%);
    border: 2px solid #9B7BB8;
    box-shadow: 0 16px 48px rgba(139, 107, 176, 0.35), 0 0 0 1px rgba(255,255,255,0.4) inset;
    text-align: center;
}

.rebirth-confirm-title {
    font-family: 'Comfortaa', cursive;
    font-size: 1.5rem;
    color: #3D2E50;
    margin: 0 0 16px;
    padding: 0 0 12px;
    border-bottom: 2px solid rgba(139, 107, 176, 0.35);
    text-align: center;
}

.rebirth-confirm-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    line-height: 1.55;
    color: #4A3560;
    margin: 0 0 24px;
    padding: 0;
    text-align: left;
    display: block;
}

.rebirth-confirm-text strong {
    color: #3D2E50;
    font-weight: 700;
}

.rebirth-confirm-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.rebirth-confirm-actions .btn {
    flex: 1;
    min-width: 120px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-rebirth-cancel {
    padding: 14px 20px;
    border: 2px solid #B8B0C8;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #4A3560;
    background: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.btn-rebirth-cancel:hover {
    background: #F0E8F8;
    border-color: #9B7BB8;
    transform: translateY(-1px);
}

.btn-rebirth-ok {
    padding: 14px 20px;
    background: linear-gradient(145deg, #E8D5FF 0%, #D4C0F0 100%);
    border: 2px solid #9B7BB8;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #3D2E50;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(139, 107, 176, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-rebirth-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(139, 107, 176, 0.4);
}

.leaderboard-list {
    margin-bottom: 28px;
    padding-left: 28px;
}

.leaderboard-list li {
    padding: 14px 0;
    border-bottom: 1px solid rgba(139, 105, 20, 0.15);
    font-size: 1.08rem;
}

.leaderboard-list li::marker {
    color: var(--honey-dark);
    font-weight: 700;
}

.btn-gold {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 18px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, var(--honey-gold) 0%, var(--honey-primary) 50%, var(--honey-dark) 100%);
    color: var(--wood);
    box-shadow: 0 8px 28px var(--shadow-gold);
    transition: transform 0.25s;
}

.btn-gold:hover { transform: scale(1.03); }

.btn-reset {
    width: 100%;
    padding: 12px 18px;
    margin-bottom: 12px;
    border: 2px solid rgba(139, 69, 19, 0.4);
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wood);
    background: var(--cream-dark);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-reset:hover {
    background: #E8DED0;
    border-color: var(--wood-light);
}

.hidden { display: none !important; }

/* Адаптив — планшеты и телефоны */
@media (max-width: 1000px) {
    .mobile-only { display: inline-flex !important; }
    .left-panel { display: none; }

    .game-layout {
        flex-direction: column;
        align-items: stretch;
        padding-left: max(10px, env(safe-area-inset-left, 0px));
        padding-right: max(10px, env(safe-area-inset-right, 0px));
    }
    .left-panel, .right-panel { width: 100%; max-width: 100%; }
    .panel-upgrades .upgrades-grid { max-height: 320px; }
    /* Мёд и доход в два ряда — только колонка и отступ между рядами, размер как у Rebirth задаём в 640px */
    .resources-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        min-width: 0;
    }
    .resources-panel .resource {
        width: 100%;
        justify-content: space-between;
    }

    /* Доход: число и "/сек" должны быть рядом и у правого края (без огромного пробела) */
    .resources-panel .resource.income-resource {
        justify-content: flex-start;
        white-space: nowrap;
    }
    .resources-panel .resource.income-resource .resource-value {
        margin-left: auto;
        min-width: 0;
        text-align: right;
    }
    .resources-panel .resource.income-resource .resource-label {
        margin-left: 2px;
        white-space: nowrap;
    }

    /* Кнопку достижений убираем — они внутри Статистики */
    #achievements-btn {
        display: none !important;
    }
}

/* Мобильные: убираем backdrop-filter и убираем мерцание от тайловой заливки — одна панель = один слой */
@media (max-width: 1000px) {
    /* Яндекс.Игры (мобильный WebView): фиксированный скроллящийся контейнер + momentum scroll + много fixed-слоёв
       часто дают checkerboarding (видно "квадраты"/мгновенное исчезновение UI при тапе/скролле).
       Поэтому на мобилке делаем контейнер НЕ fixed и переводим фон/канвасы в absolute внутри контейнера. */
    #game-container {
        position: relative;
        inset: auto;
        scroll-behavior: auto;
        -webkit-overflow-scrolling: auto;
        /* Лёгкий “луг” без параллакса: чтобы был зелёный низ, но без лагов/слоёв */
        background: linear-gradient(180deg,
            #7EC8E3 0%,
            #FFE8A8 45%,
            #FFF4D4 62%,
            #BFEA8A 78%,
            #66B84A 100%);
    }

    /* Canvas частиц при скролле даёт тайловую перерисовку — на мобилке отключаем */
    #particles-canvas {
        display: none !important;
    }

    /* Убираем эмодзи-декор на фоне (пчёлы/банки/цветы на заднике) — они тоже провоцируют лаги в WebView */
    .flowers-decor,
    .bees-bg,
    .honey-jars-bg,
    .decor-flower,
    .bg-bee,
    .bg-jar {
        display: none !important;
    }

    /* И эмодзи-объекты на лужайке (meadow-scene) — оставляем только зелёный градиент земли */
    .meadow-scene .meadow-item {
        display: none !important;
    }

    /* filter на эмодзи провоцирует отдельные GPU-слои и checkerboarding — убираем */
    .emoji-icon,
    .svg-icon,
    .resource-icon .emoji-icon,
    .logo-icon .emoji-icon,
    .jar-icon .emoji-icon,
    .building-icon .emoji-icon,
    .decor-flower .emoji-icon,
    .meadow-item .scene-illus.emoji-icon {
        filter: none !important;
    }

    /* Самая стабильная схема для Яндекс WebView: один лёгкий фон (градиент) без "слоёного" параллакса.
       Иначе при скролле часто появляется checkerboarding (квадраты) даже на мощных телефонах. */
    .parallax-layer { display: none !important; }
    #game-container::before { display: none !important; }

    #game-container.tier-up::after {
        position: absolute;
    }

    /* Канвасы/эффекты как абсолютные слои внутри контейнера (вместо fixed по viewport) */
    #ambient-canvas,
    #bg-effects-canvas,
    #scene-canvas,
    #particles-canvas,
    .golden-dust,
    .fireflies-layer,
    .sparkles-layer,
    .aurora-layer,
    .living-sky-overlay {
        position: absolute !important;
        inset: 0;
    }

    /* Фоновые анимации (облака/трава/сияние и т.п.) на мобильном WebView часто дают лаги — отключаем */
    .parallax-layer,
    .parallax-layer * ,
    .aurora-layer,
    .living-sky-overlay,
    .bokeh-layer,
    .bokeh-orb,
    .cloud,
    .cloud::before,
    .cloud::after,
    .sun,
    .sun-rays,
    .grass-blade,
    .decor-flower,
    .bg-bee,
    .bg-jar {
        animation: none !important;
        transition: none !important;
    }

    .panel-block,
    .main-center .game-header,
    .main-center .rebirth-bar,
    .main-center .honey-jar-section,
    .main-center .buildings-section,
    .main-center .game-footer,
    .game-footer,
    .achievement-toast,
    .quest-slot,
    .upgrade-card,
    .modal {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        /* Не форсим отдельные GPU-слои для каждого блока — иначе на слабых телефонах начинается checkerboarding */
        transform: none !important;
        -webkit-backface-visibility: visible;
        backface-visibility: visible;
        contain: none;
    }

    /* Дополнительно: убираем тяжёлые тени на мобилке — это снижает "квадраты" при скролле */
    .panel-block,
    .resource,
    .building-card,
    .upgrade-card,
    .modal-content,
    .main-center .game-header,
    .main-center .buildings-section,
    .game-footer {
        box-shadow: none !important;
    }
    .panel-block { background: #FFF8EB; }
    .main-center .game-header,
    .main-center .rebirth-bar,
    .main-center .honey-jar-section,
    .main-center .buildings-section,
    .main-center .game-footer { background: #FFF8EB; }
    .game-footer { background: var(--hud-bg); }
    .achievement-toast { background: #FFFBF5; }
    .quest-slot { background: #FFFBF5; }
    .upgrade-card { background: #FFFBF5; }
    .upgrade-card.affordable { background: linear-gradient(145deg, #FFFBF0 0%, #FFF4D4 50%, #FFEEB8 100%); }
    .modal { background: rgba(92, 64, 51, 0.55); }

    /* Убираем «шум» поверх экрана на мобилке: SVG feTurbulence часто даёт тайлы/мигание при скролле/кликах */
    #game-container::after { display: none !important; }
}

@media (max-width: 640px) {
    .game-layout { padding: 8px 6px calc(var(--footer-h, 72px) + var(--fab-h, 0px) + 32px); }
    .main-center { max-width: 100%; min-width: 0; }
    .game-header {
        padding: 10px 12px;
        gap: 8px 12px;
        min-height: 48px;
    }
    .logo { gap: 12px; }
    .logo-icon { font-size: 2rem; }
    .logo-title { font-size: 1.2rem; }
    .logo-subtitle { font-size: 0.7rem; letter-spacing: 0.08em; }
    .resources-panel { flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; }
    .resource { padding: 8px 14px; min-height: 44px; }
    .resource.honey-resource { min-width: 0; }
    .resource.income-resource { min-width: 0; overflow: hidden; }
    .resource-value { font-size: 1.15rem; }
    .resource-icon { font-size: 1.35rem; }
    .level-display { min-width: 0; max-width: 100%; flex: 1 1 120px; }
    .level-badge { font-size: 0.9rem; padding: 6px 12px; }
    .level-bar { height: 12px; }
    .main-center .game-header .level-bar { height: 14px; }
    .rebirth-bar { padding: 8px 12px; margin-bottom: 10px; }
    .rebirth-btn { min-height: 44px; padding: 8px 14px; }
    .rebirth-btn .rebirth-text { font-size: 0.9rem; }
    .rebirth-label { font-size: 0.9rem; }
    .panel-block { padding: 10px 12px; }
    .panel-title { font-size: 0.95rem; }
    .section-title { font-size: 1.1rem; }
    .buildings-section { padding-bottom: calc(20px + var(--fab-h, 0px) + 24px); }
    
    .active-boosts-container {
        margin: 8px 10px 12px;
        gap: 8px;
    }
    
    .active-boost {
        padding: 10px 14px;
        gap: 10px;
        border-radius: 14px;
    }
    
    .active-boost::before {
        width: 3px;
        border-radius: 14px 0 0 14px;
    }
    
    .boost-icon {
        font-size: 1.5rem;
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }
    
    .boost-name {
        font-size: 0.8rem;
    }
    
    .boost-value {
        font-size: 0.85rem;
    }
    
    .boost-timer {
        font-size: 0.7rem;
    }
}

@media (max-width: 540px) {
    .building-card {
        grid-template-columns: 48px 1fr;
        grid-template-rows: auto auto;
        gap: 10px;
        padding: 10px 12px;
    }
    .building-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
    .buy-btn { grid-column: auto; min-height: 44px; padding: 8px 12px; font-size: 0.88rem; }
    .building-icon { width: 48px; height: 48px; }
    .building-icon .svg-icon,
    .building-icon .emoji-icon { font-size: 1.6rem; }
    .building-name { font-size: 0.95rem; }
    .building-desc { font-size: 0.8rem; }
    .honey-jar { width: 100px; height: 100px; min-width: 100px; }
    .jar-icon .emoji-icon { font-size: 2.4rem; }
    .jar-label { font-size: 0.85rem; }
    .buildings-section { padding: 12px 14px calc(20px + var(--fab-h, 0px) + 24px); }
    .buildings-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        padding-bottom: 4px;
        margin-bottom: 8px;
    }
    .buildings-tabs::-webkit-scrollbar { display: none; }
    .building-tab-btn { flex-shrink: 0; padding: 8px 12px; font-size: 0.88rem; }
    .honey-jar-section { padding: 12px 0; }
}

/* Маленькие телефоны (узкий экран) */
@media (max-width: 420px) {
    .game-layout { padding: 6px 4px calc(var(--footer-h, 72px) + var(--fab-h, 0px) + 28px); }
    .game-header { padding: 8px 10px; gap: 6px 10px; }
    .logo-title { font-size: 1.05rem; }
    .logo-subtitle { display: none; }
    .resource-value { font-size: 1rem; }
    .resource-label { font-size: 0.8rem; }
    .level-badge { font-size: 0.85rem; padding: 5px 10px; }
    .rebirth-btn .rebirth-text { font-size: 0.8rem; }
    .rebirth-label { font-size: 0.8rem; }
    .game-footer {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
        gap: 8px;
    }
    .footer-btn {
        padding: 10px 12px;
        font-size: 0.85rem;
        min-height: 44px;
    }
    .modal-content {
        margin: 12px;
        padding: 20px 16px;
        max-height: 88vh;
        border-radius: 20px;
    }
    .modal-content h3 { font-size: 1.35rem; margin-bottom: 16px; }
    .rebirth-popover-inner { padding: 12px 14px; max-width: calc(100vw - 24px); }
    .rebirth-popover { min-width: 0; max-width: calc(100vw - 24px); }
    .panel-upgrades .upgrades-grid { max-height: 280px; }
    .panel-quests .quest-slot { padding: 10px 12px; }
    .offline-bonus { font-size: 0.9rem; padding: 10px 12px; margin: 8px; }
}
