/* Модальное окно с анимацией загрузки */
.loading-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.loading-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease-in-out;
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease-in-out;
}

.loading-animation {
    font-size: 100px;
    margin: 20px 0;
    position: relative;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Человечек */
.stick-man {
    font-size: 120px; /* человек больше молотка */
    display: inline-block;
    animation: bounce 0.5s ease-in-out infinite;
}

/* Молоток */
.hammer {
    font-size: 50px; /* молоток меньше человека */
    position: absolute;
    top: 28px; /* подгон под "руку" человечка */
    left: calc(50% + 35px);
    transform-origin: left 80%;
    animation: hammerSwing 0.5s ease-in-out infinite;
}

/* Звездочки (при ударе) */
.stars {
    position: absolute;
    top: 20px;
    left: 50%;
    font-size: 40px;
    opacity: 0;
    animation: starsAppear 0.5s ease-in-out infinite;
}

/* Анимация качания молотка */
@keyframes hammerSwing {
    0% { transform: rotate(-35deg); }
    50% { transform: rotate(15deg); }
    100% { transform: rotate(-35deg); }
}

/* SVG пещерный человек */
.caveman-wrapper {
    width: 200px;
    height: 170px;
    position: relative;
}

.caveman-svg {
    width: 200px;
    height: 170px;
    overflow: visible;
}

.caveman-body {
    animation: cavemanBounce 0.6s ease-in-out infinite;
}

.caveman-arm {
    transform-origin: 115px 70px; /* плечо */
    animation: cavemanSwing 0.6s ease-in-out infinite;
}

.caveman-club {
    transform-origin: 140px 85px; /* хват на дубине */
}

@keyframes cavemanSwing {
    0% { transform: rotate(-30deg); }
    50% { transform: rotate(10deg); }
    100% { transform: rotate(-30deg); }
}

@keyframes cavemanBounce {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.hit-stars {
    position: absolute;
    top: 10px;
    left: 120px;
    width: 60px;
    height: 60px;
    pointer-events: none;
}

.hit-stars > span {
    position: absolute;
    opacity: 0;
    animation: starPop 0.6s ease-in-out infinite;
}

.hit-stars > span:nth-child(1) { left: 0; top: 10px; animation-delay: 0s; }
.hit-stars > span:nth-child(2) { left: 20px; top: 0; animation-delay: 0.1s; }
.hit-stars > span:nth-child(3) { left: 40px; top: 15px; animation-delay: 0.2s; }

@keyframes starPop {
    0% { transform: scale(0) rotate(0deg); opacity: 0; }
    40% { transform: scale(1) rotate(180deg); opacity: 1; }
    100% { transform: scale(0.6) rotate(360deg); opacity: 0; }
}

/* Анимация подпрыгивания человечка */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0) scale(1, 1);
    }
    25% {
        transform: translateY(-5px) scale(1.05, 0.95);
    }
    50% {
        transform: translateY(5px) scale(0.95, 1.05);
    }
}

/* Анимация звездочек */
@keyframes starsAppear {
    0%, 40% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50%, 90% {
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) rotate(360deg);
    }
}

/* Текст загрузки */
.loading-text {
    font-size: 18px;
    color: #333;
    margin: 16px 0 6px 0;
    font-weight: bold;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-subtext {
    font-size: 14px;
    color: #666;
    margin-top: 6px;
}

/* Анимация пульсации текста */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Сообщение об успехе */
.success-message {
    display: none;
}

.success-message.show {
    display: block;
    animation: successPop 0.5s ease-out;
}

.success-icon {
    font-size: 100px;
    color: #4CAF50;
    margin: 20px 0;
    animation: successBounce 0.6s ease-out;
}

.success-text {
    font-size: 24px;
    color: #4CAF50;
    font-weight: bold;
    margin: 20px 0;
}

.success-details {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes successBounce {
    0% {
        transform: scale(0) rotate(0deg);
    }
    50% {
        transform: scale(1.2) rotate(180deg);
    }
    75% {
        transform: scale(0.9) rotate(270deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
    }
}

/* Кнопка закрытия */
.close-button {
    display: none;
    margin-top: 20px;
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.close-button:hover {
    transform: scale(1.05);
}

.close-button.show {
    display: inline-block;
    animation: fadeIn 0.3s ease-in-out 0.5s both;
}

