/* Базове скидання стилів */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1a1a;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #ffffff;
    overflow: hidden;
    /* Заборона скролу */
    user-select: none;
    /* Заборона виділення тексту під час гри */
    touch-action: none;
    /* Оптимізація для тач-пристроїв */
    background: url('/assets/bg.webp') no-repeat center center;
}



/* Контейнер для ігрового поля */
#gameCanvas {
    background-color: #187FAE;
    border: 15px solid #ffffff;
    border-top: none;
    border-radius: 0px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(77, 148, 255, 0.1);
    max-width: 95vw;
    max-height: 95vh;
    height: auto;
    aspect-ratio: 550 / 700;
}

.game-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background-size: cover;
    gap: 30px;
}

#gameCanvas {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    background: #187FB0;
}

/* Стилізація фону за чашкою (опціонально) */
body::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #2c3e50 0%, #000000 100%);
    opacity: 0.4;
    z-index: -1;
}

/* Анімація для Game Over (додається через JS за бажанням) */
.game-over-flash {
    animation: flash 0.5s ease-out;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.stat-box {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    padding: 10px 15px;
    border: 2px solid #ffffff;
    border-radius: 15px;
}

.elements-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 70px;
    padding: 15px 10px;
    background: #187FB0;
    border-radius: 30px;
    min-height: 450px;
    background: linear-gradient(#1980AF, #64C9FB);
}

.powers-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 80px;
    padding-top: 15px;
}

:root {
    --snowflake-fill: 0%;
    --star-fill: 0%;
}

.power-element {
    width: 80px;
    height: 80px;
    background: rgba(30, 60, 90, 0.6);
    /* Синій фон кола з макета */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.icon-mask {
    width: 60px;
    height: 60px;
    /* Використовуємо маску для створення форми */
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;

    /* Початковий стан: сірий колір (порожня іконка) */
    background-color: rgba(255, 255, 255, 0.2);
    transition: background 0.3s ease;
}

/* Специфічні маски для кожної сили */
.snowflake-icon {
    /* Кодована SVG іконка як маска */
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22,11h-4.17l3.24-3.24l-1.41-1.41L15,11h-2V9l4.66-4.66l-1.41-1.41L13,6.17V2h-2v4.17L7.76,2.93L6.34,4.34L11,9v2H9L4.34,6.34L2.93,7.76L6.17,11H2v2h4.17l-3.24,3.24l1.41,1.41L9,13h2v2l-4.66,4.66l1.41,1.41L11,17.83V22h2v-4.17l3.24,3.24l1.41-1.41L13,15v-2h2l4.66,4.66l1.41-1.41L17.83,13H22V11z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22,11h-4.17l3.24-3.24l-1.41-1.41L15,11h-2V9l4.66-4.66l-1.41-1.41L13,6.17V2h-2v4.17L7.76,2.93L6.34,4.34L11,9v2H9L4.34,6.34L2.93,7.76L6.17,11H2v2h4.17l-3.24,3.24l1.41,1.41L9,13h2v2l-4.66,4.66l1.41,1.41L11,17.83V22h2v-4.17l3.24,3.24l1.41-1.41L13,15v-2h2l4.66,4.66l1.41-1.41L17.83,13H22V11z'/%3E%3C/svg%3E");

    background: linear-gradient(to top,
            #00BFFF var(--snowflake-fill),
            rgba(255, 255, 255, 0.2) var(--snowflake-fill));
}

.star-icon {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12,17.27L18.18,21l-1.64-7.03L22,9.24l-7.19-0.61L12,2L9.19,8.63L2,9.24l5.46,4.73L5.82,21L12,17.27z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12,17.27L18.18,21l-1.64-7.03L22,9.24l-7.19-0.61L12,2L9.19,8.63L2,9.24l5.46,4.73L5.82,21L12,17.27z'/%3E%3C/svg%3E");

    background: linear-gradient(to top,
            #FFD700 var(--star-fill),
            rgba(255, 255, 255, 0.2) var(--star-fill));
}

.power-element.ready {
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
    animation: pulse 2s infinite;
    cursor: pointer;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.next-element-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 20px;
    background: #187FB0;
    border-radius: 30px;
    background: #187FAF;
}

.elements-preview-container .element-preview-item,
.next-element-container .element-preview-item {
    width: 40px;
    height: 40px;
    background-color: red;
    border-radius: 20px;
    position: relative;
}

.elements-preview-container .element-preview-item.toy {
    margin-top: 8px;
}

.elements-preview-container .element-preview-item.bell {
    margin-top: 4px;
}

.elements-preview-container .element-preview-item.element-preview-item.mustache {
    margin-top: 4px;
}

.next-element-container .element-preview-item.toy {
    margin-top: 0px !important;
}

.element-preview-item img {
    position: absolute;
    width: 100%;
    height: 100%;
    /* object-fit: contain; */
    pointer-events: none;
}

.element-preview-item.santa {
    background-color: red;
}

.element-preview-item.deer {
    background-color: #9F7953;
}

.element-preview-item.elf {
    background-color: #89d587;
}

.element-preview-item.showman {
    background-color: #f2f2f2;
}

.element-preview-item.penguin {
    background-color: #214E78;
}

.element-preview-item.mustache {
    background-color: #8A2689;
}

.element-preview-item.cookie {
    background-color: #e8ba8a;
}

.element-preview-item.toy {
    background-color: #98DCFE;
}

.element-preview-item.candy {
    background-color: #FFBEBE;
}

.element-preview-item.bell {
    background-color: #D7D7D7;
}

.element-preview-item.ball {
    background-color: #FF5A59;
}

.lives-container {
    display: flex;
    flex-direction: row;
    gap: 5px;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 10px;
    background: rgba(30, 60, 90, 0.6);
    margin-top: 10px;
    /* border: 1px solid rgba(255, 255, 255, 0.1); */
}

.live-element {
    width: 25px;
    height: 25px;
    /* SVG маска серця */
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;

    transition: all 0.3s ease;
}

/* Активне життя — яскраво червоне зі світінням */
.live-element.active {
    background-color: #ff4d4d;
    filter: drop-shadow(0 0 5px rgba(255, 77, 77, 0.6));
    /* Легка пульсація "биття серця" */
    animation: heartBeat 2s infinite ease-in-out;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.1);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.15);
    }

    60% {
        transform: scale(1);
    }
}

/* Втрачене життя — сіре та напівпрозоре */
.live-element.inactive {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(0.9);
}

/* Стан активного світіння */
.active-glow {
    filter: drop-shadow(0 0 15px rgba(0, 191, 255, 0.8)) drop-shadow(0 0 30px rgba(0, 191, 255, 0.4));
    transform: scale(1.1);
    /* Легке збільшення */
    border: 2px solid rgba(255, 255, 255, 0.8);
    animation: snowflake-pulse 2s infinite ease-in-out;
}

/* Анімація пульсації для активного стану */
@keyframes snowflake-pulse {
    0% {
        filter: drop-shadow(0 0 10px rgba(0, 191, 255, 0.6));
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(0, 191, 255, 0.9));
        transform: scale(1.15);
    }

    100% {
        filter: drop-shadow(0 0 10px rgba(0, 191, 255, 0.6));
    }
}

@keyframes flash {
    0% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(2);
    }

    100% {
        filter: brightness(1);
    }
}