:root {
    --primary-color: #4CAF50;
    --secondary-color: #ffcc00;
    --text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    --background-dark: rgba(0, 0, 0, 0.8);
    --hint-glow: rgba(215, 238, 8, 0.8);
    --font-family: Arial, sans-serif;
    --spacing-sm: 10px;
    --spacing-md: 20px;
    --transition: 0.3s ease;
    --pause-text-height: 36px;
    --goblin-small-size: 110px;
    --goblin-large-size: 130px;
    --goblin-super-size: 160px;
    --goblin-small-size-mobile: 70px;
    --goblin-large-size-mobile: 90px;
    --goblin-super-size-mobile: 100px;
    --goblin-speed: 5s;
    --heart-float-distance: -100px;
    --wave-scale: 50;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: var(--font-family);
    background: url('assets/background.jpg') no-repeat center/cover;
    height: 100vh;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.game-container {
    text-align: center;
    height: 100vh;
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.loading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 4000;
    pointer-events: none;
}

.loading-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.loading-bar-container {
    width: 300px; /* Ширина контейнера полосы */
    height: 20px; /* Высота полосы */
    background: #fffdfd; /* Цвет фона контейнера */
    border-radius: 10px;
    overflow: hidden;
    z-index: 2; /* Чтобы полоса была выше .loading-image */
}

.loading-bar {
    width: 0%; /* Начальная ширина */
    height: 100%;
    background: #4caf50; /* Цвет полосы загрузки */
    transition: width 0.3s ease; /* Плавный переход для изменения ширины */
}

.settings-icon {
    position: fixed;
    top: clamp(10px, 2vh, 20px);
    right: clamp(30px, 5vw, 60px);
    width: clamp(20px, 5vw, 40px);
    height: auto;
    cursor: pointer;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.gear-icon {
    width: 180%;
    height: 180%;
    transition: transform var(--transition);
}

.settings-icon:hover .gear-icon {
    transform: rotate(90deg);
}

.settings-label {
    margin-top: 5px;
    font-size: 14px;
    color: rgba(237, 243, 237, 0.89);
    white-space: nowrap;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.993);
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    padding: 2px 5px;
}

.settings-screen,
.start-screen,
.pause-screen {
    font-size: clamp(10px, 5vw, 20px);
    display: none;  
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-dark);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    pointer-events: auto;
}

#noHeartsScreen,
#noPotionsScreen {
    font-size: clamp(12px, 4vw, 16px);
    display: none;  
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 500px;
    height: auto;
    min-height: 300px;
    max-height: 60vh;
    justify-content: center;
    align-items: center;
    z-index: 2500;
    pointer-events: auto;
    background: transparent;
}

/* Контейнер для параллельного расположения кнопок */
.settings-buttons-container {
    display: flex;
    justify-content: space-evenly; /* Равномерное распределение кнопок */
    gap: clamp(5px, 2vw, 10px); /* Адаптивный отступ между кнопками */
    flex-wrap: nowrap; /* Кнопки в одной строке */
    width: 100%; /* Занимает всю ширину контейнера */
    max-width: 100%; /* Ограничение для предотвращения выхода за пределы */
    padding: 0 clamp(5px, 1vw, 10px); /* Отступы по бокам */
    box-sizing: border-box;
}

/* Стили для кнопок (замена inline-стилей) */
.settings-button {
    background-color: var(--primary-color);
    color: white;
    padding: clamp(6px, 1.5vw, 10px) clamp(8px, 2vw, 12px); /* Уменьшенные отступы */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(12px, 3.5vw, 16px); /* Адаптивный шрифт */
    width: clamp(80px, 22vw, 100px); /* Фиксированная ширина для одинакового размера */
    min-height: clamp(35px, 8vw, 45px); /* Минимальная высота */
    text-align: center;
    white-space: normal; /* Разрешить перенос текста */
    overflow-wrap: break-word; /* Перенос слов при необходимости */
    display: flex;
    align-items: center;
    justify-content: center; /* Центрирование текста */
    margin: 0; /* Убраны внешние отступы */
    transition: background-color var(--transition);
    box-sizing: border-box;
}

.settings-button:hover {
    background-color: #45a049;
}

.pause-screen {
    flex-direction: column;
}

.settings-screen .pause-text,
.pause-screen .pause-text,
#noHeartsScreen .pause-text,
#noPotionsScreen .pause-text {
    position: absolute;
    top: auto;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(20px, 6vw, 36px);
    color: var(--secondary-color);
    text-shadow: var(--text-shadow);
    margin: 0 0 20px 0;
    z-index: 2500;
    pointer-events: none;
    white-space: nowrap;
    display: none;
    text-align: center;
    width: 100%;
}

#settingsTitle {
    font-size: 36px;
    color: #333;
    text-shadow: var(--text-shadow);
    margin: 0 0 var(--spacing-md) 0;
    text-align: center;
}

#settingsIcon {
    z-index: 2100;
}

.settings-content {
    background: #eeeeea;
    padding: var(--spacing-md);
    border-radius: var(--spacing-sm);
    text-align: center;
    width: 300px;
    box-shadow: 0 0 var(--spacing-sm) rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.settings-content label {
    font-size: 20px;
    color: #333;
    margin: 0 auto;
    text-align: center;
    width: 100%;
}

.language-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: nowrap;
}

.language-button {
    font-size: 16px;
    padding: 8px 12px;
    border: 2px solid #4CAF50;
    border-radius: 5px;
    background-color: #ffffff;
    color: #333;
    cursor: pointer;
    pointer-events: auto;
    touch-action: auto;
    z-index: 1010;
    transition: background-color 0.2s, color 0.2s;
}

.language-button:hover,
.language-button:focus {
    background-color: #4CAF50;
    color: #ffffff;
}

.language-button.active {
    background-color: #4CAF50;
    color: #ffffff;
    font-weight: bold;
}

.music-toggle {
    display: flex;
    align-items: center;
    margin-top: 20px;
}

.music-icon {
    width: 50px;
    height: 50px;
    margin-right: 10px;
}

.music-slider {
    width: 60px;
    height: 20px;
    background-color: var(--primary-color);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background-color var(--transition);
}

.music-slider.off {
    background-color: #ccc;
}

.slider-ball {
    width: 16px;
    height: 16px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: left var(--transition);
}

.music-slider.off .slider-ball {
    left: 42px;
}

.settings-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 30px;
    color: #333;
    cursor: pointer;
    transition: color var(--transition);
}

.settings-close:hover {
    color: #ff0000;
}


#startButton,
#resumeButton {
    padding: 20px 40px;
    font-size: 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color var(--transition);
}

#resumeButton {
    margin-top: var(--spacing-md);
    z-index: 3000;
}

#startButton:hover,
#resumeButton:hover {
    background-color: #45a049;
}

.potion-container {
    position: absolute;
    right: clamp(15px, 5vw, 40px);
    top: clamp(90px, 15vh, 140px);
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: top right;
    z-index: 2000;
}

.potion-wrapper {
    position: relative;
    display: inline-block;
}

.progress-potion.locked {
    opacity: 0.5;
    pointer-events: none;
}

.progress-potion {
    width: clamp(50px, 8vw, 80px); 
    height: auto;
    cursor: pointer;
    transition: transform var(--transition), filter var(--transition);
    z-index: 11;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.progress-potion.active {
    animation: vibrate 0.3s infinite, glow 1s infinite;
}

#potionCounter {
    position: absolute;
    bottom: -5px;
    right: -10px;
    font-size: 25px;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 12;
}

.potion-timer {
    position: absolute;
    bottom: -10px;
    left: -20px;
    font-size: 14px;
    color: white;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 2px 5px;
    border-radius: 5px;
    display: none;
}

.potion {
    position: absolute;
    display: block;
    width: clamp(50px, 10vw, 60px);
    height: clamp(50px, 10vw, 60px);
    background-image: url('assets/potion.png');
    background-size: cover;
    cursor: pointer;
    pointer-events: auto;
    z-index: 100;
    will-change: transform, opacity;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    opacity: 1;
}

.potion.moving {
    animation: flyPotion 5s linear forwards;
}

.potion.paused {
    animation-play-state: paused;
}

.level-container {
    position: absolute;
    top: clamp(10px, 2vh, 20px);
    left: 50%;
    transform: translateX(-50%) scale(2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: rgb(232, 236, 236);
    transform-origin: center top;
    z-index: 2000;
}

#levelCounter {
    margin-left: -10px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.993);
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.level-bar {
    width: 160px;
    height: 15px;
    right: -10px;
    background-color: #cfcdcd;
    border-radius: 10px;
    overflow: hidden;
    margin-right: 10px;
    position: relative;
}

.level-fill {
    width: 0;
    height: 100%;
    background-color: var(--primary-color);
    transition: width var(--transition);
}

.heart-container {
    position: absolute;
    top: clamp(40px, 8vh, 55px);
    left: calc(50% - 55px);
    transform: translateX(-50%) scale(2);
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center top;
    z-index: 2000;
}

.progress-heart-wrapper {
    position: relative;
    display: inline-block;
}

.progress-heart {
    width: 30px;
    height: 30px;
    margin-right: 5px;
    margin-left: 30px;
    margin-top: 5px;
    transition: transform var(--transition), filter var(--transition);
    cursor: pointer;
    position: relative;
    z-index: 11;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.progress-heart.active {
    animation: vibrate 0.3s infinite, glow 1s infinite;
}

#heartCounter {
    position: absolute;
    bottom: -10px;
    right: -5px;
    font-size: 16px;
    color: white !important;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 12;
}

.heart-bar {
    width: 160px;
    height: 15px;
    background-color: #cfcdcd;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    pointer-events: none;
    margin-left: 0;
}

.heart-fill {
    width: 0;
    height: 100%;
    background-color: var(--primary-color);
    transition: width var(--transition);
}

#clickImageContainer {
    width: clamp(250px, min(40vw, 50vh), 400px);
    height: auto;
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    transform-origin: center bottom;
    transition: opacity var(--transition);
    will-change: transform, opacity;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#clickImage {
    width: 100%;
    height: auto;
    display: block;
    position: relative;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    cursor: pointer;
    animation: pulse 1.2s ease-in-out infinite;
    object-fit: contain;
    object-position: 50% 100%;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

#clickImageOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

#clickImage.damage {
    animation: damageFlash 0.3s ease forwards;
}

#clickImageContainer::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 120%;
    height: 20px;
    background: radial-gradient(circle, rgba(255, 204, 0, 0.5), transparent 70%);
    opacity: 0.8;
    z-index: -1;
}

.heart {
    position: absolute;
    background-image: url('assets/heart.png');
    background-size: cover;
    pointer-events: none;
    will-change: transform, opacity;
}

.heart.floating {
    animation: float 2s ease-out forwards;
}

#levelUpContainer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgb(225, 250, 4);
    background-color: rgba(250, 250, 250, 0);
    padding: 10px 20px;
    border-radius: 5px;
    opacity: 0;
    display: none;
    z-index: 1000;
    pointer-events: none;
    will-change: opacity;
    transition: opacity 0.5s ease-out;
}

#levelUpContainer.visible {
    opacity: 1;
}

#levelUpContainer.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

.wave {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: rgba(229, 255, 0, 0.979);
    border-radius: 50%;
    will-change: transform, opacity;
}

.wave.expanding {
    animation: waveAnimation 1s ease-out forwards;
}

#goblinsContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.goblin.small { width: var(--goblin-small-size); height: var(--goblin-small-size); }
.goblin.large { width: var(--goblin-large-size); height: var(--goblin-large-size); }
.goblin.super { width: var(--goblin-super-size); height: var(--goblin-super-size); }

.goblin {
    position: absolute;
    cursor: pointer;
    pointer-events: auto;
    touch-action: auto;
    transition: opacity var(--transition);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    z-index: 10;
    will-change: left, top, opacity;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    --startX: 0px;
    --startY: 0px;
    --endX: 0px;
    --endY: 0px;
}

.goblin.moving {
    -webkit-animation: moveToCenter var(--goblin-speed, 5s) linear forwards;
    -moz-animation: moveToCenter var(--goblin-speed, 5s) linear forwards;
    animation: moveToCenter var(--goblin-speed, 5s) linear forwards;
}

.goblin.paused {
    -webkit-animation-play-state: paused;
    -moz-animation-play-state: paused;
    animation-play-state: paused;
}

.goblin-health {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 5px;
    pointer-events: none;
    background-color: #ccc;
    border-radius: 3px;
    overflow: hidden;
    z-index: 10;
}

.goblin-health-fill {
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-color: red;
    transition: width 0.2s ease;
}

.hint {
    position: absolute;
    font-size: clamp(16px, 3vw, 24px);
    color: rgb(215, 238, 8);
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    max-width: 90%;
    width: auto;
    text-align: center;
    box-sizing: border-box;
    z-index: 1500;
    max-height: 80vh;
    overflow-y: auto;
    line-height: 1.2;
    overflow-wrap: break-word;
}

.hint.visible {
    opacity: 1;
}

.hint.highlight-hint {
    animation: vibrate-hint 0.3s infinite, glow-hint 1s infinite;
}

#leavesContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

.leaf {
    position: absolute;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    pointer-events: auto;
    will-change: transform, opacity;
    z-index: 10;
}

.leaf-1 { background-image: url('assets/leaf1.png'); }
.leaf-2 { background-image: url('assets/leaf2.png'); }
.leaf-3 { background-image: url('assets/leaf3.png'); }

.leaf.falling {
    animation: fall var(--fall-duration) linear forwards;
}

.leaf.clicked {
    animation: fadeOut 0.5s ease forwards;
    pointer-events: none;
}

.leaf.paused {
    animation-play-state: paused !important;
    -webkit-animation-play-state: paused !important;
}

.leaf-bonus {
    position: absolute;
    pointer-events: none;
    transform-origin: center;
    user-select: none;
}

#autoClicksText {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: black;
    font-style: italic;
    pointer-events: none;
    z-index: 11;
    white-space: nowrap
}
/* Контейнер контента модального окна (аналогично NoHearts) */
.shop-content {
    background: #ffffff;
    border-radius: 12px;
    padding: clamp(10px, 2vw, 15px);
    width: 100%;
    height: 100%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-sizing: border-box;
}

/* Кнопка закрытия (аналогично NoHearts) */
.shop-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    transition: color var(--transition);
    -webkit-user-select: none;
    user-select: none;
}

.shop-close:hover {
    color: var(--primary-color);
}

/* Кнопка покупки в каждом предложении */
.buy-button {
    padding: 8px 16px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background var(--transition);
    margin-top: 10px;
    -webkit-user-select: none;
    user-select: none;
}

.buy-button:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* Уведомление об успешной покупке (если ещё нет) */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 128, 0, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 3000;
    font-size: 16px;
    animation: fadeInOut 3s ease-in-out;
    -webkit-user-select: none;
    user-select: none;
    z-index: 3000;
}

.notification.success {
  background-color: #4caf50;
}
.notification.error {
  background-color: #ff4d4d;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

/* Дополнительно: фон модального окна для затемнения */
.shop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2400; /* Ниже shopScreen, но выше остальных */
    display: none;
}

.shop-icon {
    position: fixed;
    left: clamp(10px, 2vw, 20px);
    width: clamp(20px, 5vw, 40px);
    top: 5px;
    height: auto;
    cursor: pointer;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    box-sizing: border-box;
    padding-left: env(safe-area-inset-left, 5px);
}

.shop-icon-img {
    width: 180%;
    height: 180%;
    transition: transform var(--transition);
}

.shop-icon:hover .shop-icon-img {
    transform: scale(1.1);
}

.shop-label {
    margin-top: 5px;
    font-size: clamp(12px, 3vw, 14px); /* Адаптивный шрифт */
    color: rgba(237, 243, 237, 0.89);
    white-space: nowrap;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.993);
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    padding: 2px 5px;
    max-width: calc(100vw - clamp(20px, 5vw, 40px) - 10px); /* Ограничение ширины */
    overflow: hidden;
    text-overflow: ellipsis; /* Обрезка длинного текста */
}

#shopScreen {
    font-size: clamp(12px, 4vw, 16px);
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(300px, 90vw, 600px); /* Увеличена ширина для горизонтального вида */
    max-width: 90%;
    height: auto;
    min-height: clamp(150px, 30vh, 200px); /* Уменьшена высота */
    max-height: 80vh; /* Ограничение по высоте */
    justify-content: center;
    align-items: center;
    z-index: 2500;
    pointer-events: auto;
    background: transparent;
}

#shopTitle {
    font-size: clamp(18px, 5vw, 24px);
    color: #333;
    text-shadow: var(--text-shadow);
    margin: 0 0 var(--spacing-md) 0;
    text-align: center;
}

.shop-offers {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-evenly;
    gap: clamp(5px, 2vw, 10px);
    width: 100%;
    background: transparent;
    border: none;
    padding: clamp(5px, 1vw, 10px);
    box-shadow: none;
}
.offer-title {
    font-weight: bold;
    font-size: 18px;
    color: #333;
    padding: 8px 12px;
    border: 2px solid #4CAF50; /* Зеленая рамка */
    border-radius: 5px;
    margin-bottom: 10px;
    text-align: center;
    background-color: #f0f0f0; /* Легкий серый фон для контраста */
    width: 100%;
}

.shop-offer {
    min-width: clamp(80px, 25vw, 120px); /* Компактные карточки */
    background: #ffffff;
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    padding: clamp(5px, 1.5vw, 10px);
    box-shadow: 0 0 5px rgba(0, 0, 5, 0.3);
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}
.offer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.offer-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.offer-image {
    width: clamp(25px, 6vw, 35px); /* Адаптивный размер иконок */
    height: clamp(25px, 6vw, 35px);
}

.offer-quantity {
    font-size: clamp(14px, 4vw, 16px);
    color: #333;
    font-weight: bold;
}

@keyframes vibrate {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

@keyframes glow {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
    100% { filter: brightness(1); }
}

@keyframes vibrate-hint {
    0% { transform: translateY(0); }
    25% { transform: translateY(-5px); }
    50% { transform: translateY(5px); }
    75% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

@keyframes glow-hint {
    0% { text-shadow: 0 0 5px var(--hint-glow); }
    50% { text-shadow: 0 0 15px var(--hint-glow), 0 0 25px var(--hint-glow); }
    100% { text-shadow: 0 0 5px var(--hint-glow); }
}

@keyframes flyPotion {
    from {
        transform: translateY(var(--startY, -50px));
        opacity: 1;
    }
    to {
        transform: translateY(var(--endY, 100vh));
        opacity: 1;
    }
}

@keyframes pulse {
    0% { transform: translateX(-50%) translateY(5px) scale(1); }
    50% { transform: translateX(-50%) translateY(5px) scale(1.05); }
    100% { transform: translateX(-50%) translateY(5px) scale(1); }
}

@keyframes damageFlash {
    0% { filter: brightness(1) hue-rotate(0deg); }
    50% { filter: brightness(2) hue-rotate(-40deg); }
    100% { filter: brightness(1) hue-rotate(0deg); }
}

@keyframes float {
    0% { transform: translateY(0) translateX(0) scale(1); opacity: 1; }
    100% { transform: translateY(var(--heart-float-distance)) translateX(var(--random-x)) scale(0.5); opacity: 0; }
}

@keyframes fadeOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.8); }
}

@keyframes waveAnimation {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(var(--wave-scale)); opacity: 0; }
}

@keyframes moveToElf {
    from {
        left: var(--startX);
        top: var(--startY);
    }
    to {
        left: var(--endX);
        top: var(--endY);
    }
}

@keyframes fall {
    0% {
        transform: translateX(0) rotate(0deg);
        top: var(--startY, -50px);
    }
    100% {
        transform: translateX(var(--deviation)) rotate(var(--rotation));
        top: 100vh;
    }
}

/* Медиа-запросы: Мобильные устройства (портрет) */
@media (max-width: 767px) and (orientation: portrait) {
    #clickImageContainer {
        width: clamp(300px, 50vw, 350px);
        max-width: 90vw;
        max-height: 85vh;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
        padding: 0;
    }
    #clickImage {
        width: 100%;
        height: auto;
        display: block;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        object-position: 50% 100%;
    }
    .notification {
        font-size: 14px;
        padding: 8px 16px;
    }
    .settings-icon {
        width: 20px;
        height: 20px;
        right: 30px;
    }
    #settingsTitle {
        font-size: 20px;
    }
    .settings-content {
        width: 180px;
    }
    .settings-content label {
        font-size: 16px;
    }
    .language-button {
        font-size: 12px;
        padding: 4px 8px;
    }
    .potion-container {
        right: clamp(10px, 3vw, 15px);
        top: clamp(60px, 10vh, 90px);
        margin-top: clamp(10px, 2vmin, 20px);
    }
    .progress-potion {
        width: clamp(50px, 5vw, 60px);
        height: auto;
    }
    .potion {
        width: clamp(50px, 8vw, 60px);
        height: clamp(50px, 8vw, 60px);
    }
    #potionCounter {
        font-size: 18px;
        width: clamp(8px, 4vh, 12px);
        height: auto;
        bottom: -8px;
        right: -8px;
    }
    #heartCounter {
        font-size: 12px;
        width: clamp(8px, 4vh, 12px);
        height: auto;
        bottom: -8px;
        right: -8px;
    }
    .level-container {
        top: clamp(5px, 1vh, 10px);
        left: 50%;
        transform: translateX(-50%) scale(1.2);
        font-size: 20px;
    }
    .level-bar {
        width: 100px;
        height: 12px;
        margin-left: 0;
        margin-right: 0;
    }
    .heart-container {
        top: clamp(30px, 6vh, 40px);
        left: calc(50% - 10px);
        transform: translateX(-50%) scale(1.2);
    }
    .progress-heart {
        margin-left: 0;
    }
    .heart-bar {
        top: -5px;
        width: 100px;
        height: 12px;
        margin-left: 5px;
    }
    .goblin.small { width: var(--goblin-small-size-mobile); height: var(--goblin-small-size-mobile); }
    .goblin.large { width: var(--goblin-large-size-mobile); height: var(--goblin-large-size-mobile); }
    .goblin.super { width: var(--goblin-super-size-mobile); height: var(--goblin-super-size-mobile); }
    .hint {
        font-size: clamp(12px, 4vw, 16px);
        padding: 8px 16px;
        max-width: 85%;
    }
    .pause-screen {
        font-size: 15px;
    }
    #resumeButton {
        padding: 10px 20px;
        font-size: 16px;
        margin-top: var(--spacing-sm);
    }
    .leaf {
        width: clamp(6px, 4vh, 8px);
        height: auto;
    }
    #autoClicksText {
        font-size: 10px;
    }
    #levelUpContainer {
        font-size: 16px;
        white-space: nowrap;
    }
    .shop-icon {
        width: clamp(35px, 6vw, 45px);
    }
    .shop-label {
        font-size: clamp(15px, 4vw, 18px);
        max-width: calc(100vw - clamp(20px, 5vw, 30px) - 10px);
    }
    #shopScreen {
        width: clamp(250px, 70vw, 350px);
        min-height: clamp(80px, 25vh, 110px);
        max-height: 55vh;
        transform: translate(-50%, -50%) scale(0.7);
        font-size: clamp(15px, 4vw, 25px);
    }
    #shopTitle {
        font-size: clamp(16px, 4vw, 20px);
    }
    .shop-content {
        padding: clamp(8px, 2vw, 12px);
    }
    .shop-offers {
        flex-direction: column;
        align-items: center;
    }
    .shop-offer {
        min-width: 80%;
        margin-bottom: 10px;
    }
    .offer-image {
        width: 30px;
        height: 30px;
    }
    .offer-quantity {
        font-size: 16px;
    }
    .settings-button {
        width: clamp(70px, 20vw, 90px); /* Уменьшенная ширина */
        padding: clamp(4px, 1vw, 8px) clamp(6px, 1.5vw, 10px);
        font-size: clamp(10px, 3vw, 14px); /* Меньший шрифт */
        min-height: clamp(30px, 7vw, 40px);
    }
    .offer-image {
        width: 32px;
        height: 32px;
    }
    .offer-quantity {
        font-size: 16px;
    }
}

/* Медиа-запросы: Мобильные устройства (ландшафт) */
@media (max-height: 700px) and (orientation: landscape) {
    #clickImageContainer {
        width: clamp(200px, 35vmin, 250px);
        max-height: 50vh;
        left: 50%;
        transform: translateX(-50%) scale(0.9);
        margin: 0;
        padding: 0;
    }
    #clickImage {
        width: 100%;
        height: auto;
        display: block;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        object-position: 50% 100%;
    }
    #potionCounter {
        font-size: 15px;
        width: clamp(4px, 3vh, 7px);
        height: auto;
        bottom: -8px;
        right: -8px;
    }
    #heartCounter {
        font-size: 15px;
        width: clamp(4px, 3vh, 7px);
        height: auto;
        bottom: -8px;
        right: -8px;
    }
    .level-container {
        top: clamp(5px, 4vh, 10px);
        transform: translateX(-50%) scale(0.9);
    }
    .heart-container {
        top: clamp(30px, 4vh, 35px);
        left: calc(50% - 35px);
        transform: translateX(-50%) scale(0.9);
    }
    .potion-container {
        right: clamp(10px, 3vw, 15px);
        top: clamp(60px, 10vh, 90px);
        margin-top: clamp(10px, 2vmin, 20px);
    }
    .progress-potion {
        width: clamp(40px, 40vw, 45px);
        height: auto;
    } 
    .potion {
        width: clamp(30px, 35vw, 35px);
        height: auto;
    }
    .settings-icon {
        width: 20px;
        height: 20px;
        right: 30px;
    }
    #noHeartsScreen,
    #noPotionsScreen {
        transform: translate(-50%, -50%) scale(0.8);
        width: 50%;
        min-height: 100px;
        max-height: 30vh;
        font-size: 14px;
    }
    .leaf {
        width: clamp(5px, 3vh, 7px);
        height: auto;
    }
    #shopScreen {
        min-height: clamp(80px, 20vh, 120px);
        max-height: 80vh;
        font-size: clamp(10px, 3vw, 12px);
        transform: translate(-50%, -50%) scale(0.8);
    }
    .shop-content {
        padding: clamp(8px, 1vw, 10px);
    }
    .shop-offers {
        flex-direction: row; /* Горизонтально */
        gap: clamp(8px, 1.5vw, 10px);
        overflow-x: auto;
    }
    .shop-offer {
        min-width: clamp(80px, 20vw, 100px);
        margin-bottom: 5px;
    }
    .offer-image {
        width: clamp(20px, 4vw, 25px);
        height: clamp(20px, 4vw, 25px);
    }
    .offer-quantity {
        font-size: clamp(10px, 3vw, 12px);
    }
    .notification {
        font-size: 14px;
        padding: 8px 16px;
    }
    .shop-icon {
        width: clamp(30px, 7vmin, 40px);
    }
}

/* Медиа-запросы: Планшеты (портрет) */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    #clickImageContainer {
        width: clamp(400px, 55vw, 500px);
        height: auto;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
        padding: 0;
    }
    .shop-icon {
        width: clamp(35px, 6vw, 45px);
    }
    .notification {
        font-size: 14px;
        padding: 8px 16px;
    }
    #clickImage {
        width: 100%;
        height: auto;
        display: block;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        object-position: 50% 100%;
    }
    .progress-potion {
        width: clamp(80px, 6vw, 90px);
        height: auto;
        margin-left: 30px;
        top: clamp(140px, 15vh, 180px);
    }
    .potion-container {
        width: clamp(60px, 6vw, 70px);
        height: auto;
        margin-bottom: 30px;
        top: clamp(140px, 15vh, 180px);
    }
    .potion {
        width: clamp(50px, 8vw, 60px);
        height: clamp(50px, 8vw, 60px);
    }
    .settings-icon {
        width: clamp(30px, 6vw, 40px);
        height: auto;
    }
    .settings-label {
        font-size: 20px;
    }
    .shop-label {
        font-size: 16px;
    }
    #shopScreen {
        min-height: clamp(150px, 30vh, 200px);
        max-height: 85vh;
        font-size: clamp(12px, 3.5vw, 14px);
        transform: translate(-50%, -50%) scale(1);
    }
    .shop-offers {
        flex-direction: row;
        gap: clamp(10px, 2vw, 12px);
    }
    .shop-offer {
        min-width: clamp(100px, 20vw, 120px);
    }
    .offer-image {
        width: clamp(25px, 5vw, 30px);
        height: clamp(25px, 5vw, 30px);
    }
    .offer-quantity {
        font-size: clamp(12px, 3.5vw, 14px);
    }   
}