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

body {
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    background: linear-gradient(135deg, #F5F5DC 0%, #FFFACD 50%, #FFE4B5 100%);
    overflow: hidden;
    position: relative;
    width: 100vw;
    height: 100vh;
}

#shapesCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#shapesCanvas:active {
    cursor: grabbing;
}

/* Кнопка закриття */
.close-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    text-decoration: none;
}

.close-button:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    background: #ff6b6b;
}

.close-button svg {
    width: 30px;
    height: 30px;
    stroke: #333;
    transition: stroke 0.3s ease;
}

.close-button:hover svg {
    stroke: white;
}

.close-button:active {
    transform: scale(1.05) rotate(90deg);
}

/* Кнопка очищення */
.clear-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.clear-button:hover {
    transform: scale(1.15);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    background: #4ECDC4;
}

.clear-button svg {
    width: 30px;
    height: 30px;
    stroke: #333;
    transition: stroke 0.3s ease;
}

.clear-button:hover svg {
    stroke: white;
}

.clear-button:active {
    transform: scale(1.05);
}

/* Адаптивність для планшетів */
@media (max-width: 768px) {
    .close-button,
    .clear-button {
        width: 50px;
        height: 50px;
    }

    .close-button svg,
    .clear-button svg {
        width: 25px;
        height: 25px;
    }
}

/* Адаптивність для мобільних телефонів */
@media (max-width: 480px) {
    /* ВАЖЛИВО: Збільшуємо кнопки для дітей 3 років */
    .close-button,
    .clear-button {
        width: 70px;
        height: 70px;
        top: 10px;
    }

    .close-button {
        right: 10px;
    }

    .clear-button {
        left: 10px;
    }

    .close-button svg,
    .clear-button svg {
        width: 35px;
        height: 35px;
    }

    /* Збільшуємо тінь для кращої видимості на малому екрані */
    .close-button,
    .clear-button {
        box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
    }
}

/* Дуже маленькі телефони */
@media (max-width: 400px) {
    .close-button,
    .clear-button {
        width: 65px;
        height: 65px;
        top: 5px;
    }

    .close-button {
        right: 5px;
    }

    .clear-button {
        left: 5px;
    }

    .close-button svg,
    .clear-button svg {
        width: 32px;
        height: 32px;
    }
}

/* Landscape orientation для телефонів */
@media (max-width: 896px) and (orientation: landscape) {
    .close-button,
    .clear-button {
        width: 55px;
        height: 55px;
        top: 5px;
    }

    .close-button {
        right: 5px;
    }

    .clear-button {
        left: 5px;
    }

    .close-button svg,
    .clear-button svg {
        width: 28px;
        height: 28px;
    }
}

/* Touch-specific improvements */
@media (hover: none) and (pointer: coarse) {
    /* Видаляємо hover ефекти на touch пристроях */
    .close-button:hover,
    .clear-button:hover {
        transform: none;
        background: white;
    }

    .close-button:hover svg,
    .clear-button:hover svg {
        stroke: #333;
    }

    /* Додаємо active стани для тактильного відгуку */
    .close-button:active {
        transform: scale(0.9) rotate(90deg);
        background: #ff6b6b;
    }

    .close-button:active svg {
        stroke: white;
    }

    .clear-button:active {
        transform: scale(0.9);
        background: #4ECDC4;
    }

    .clear-button:active svg {
        stroke: white;
    }

    /* Видаляємо синє виділення при натисканні */
    .close-button,
    .clear-button {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
    }

    /* Покращуємо cursor для touch */
    #shapesCanvas {
        cursor: default;
    }

    #shapesCanvas:active {
        cursor: default;
    }

    /* Мінімальна область для натискання */
    .close-button,
    .clear-button {
        min-width: 44px;
        min-height: 44px;
    }
}
