/* =========================
   BASE
========================= */

body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 200px;
    background-image: url("/media/4.png");
    background-size: cover;
    background-repeat: repeat;
    background-position: center;
}

/* =========================
   FORMULAIRE
========================= */

#gender-form {
    margin: 20px 0;
}

#gender-form button,
#spin {
    padding: 12px 24px;
    margin: 10px;
    font-size: 16px;
    background-color: #6c5ce7;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#gender-form button:hover,
#spin:hover {
    background-color: #5649c0;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* =========================
   ROULETTE
========================= */

.wheel-container {
    width: 300px;
    height: 300px;
    margin: 20px auto;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

#wheel {
    width: 100%;
    height: 100%;
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.sector {
    position: absolute;
    width: 100%;
    height: 50%;
    top: 0;
    left: 0;
    transform-origin: bottom center;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
}

.sector:nth-child(1) { background-color: #ff6b6b; }
.sector:nth-child(2) { background-color: #4ecdc4; }

/* =========================
   ANIMATIONS D’APPARITION
========================= */

.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* =========================
   CONFETTIS
========================= */

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: 0;
    pointer-events: none;
    z-index: 9999;
    border-radius: 50%;
    animation: fall linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* =========================
   MODALES
========================= */

.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 10000;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    padding: 15px;
    border-radius: 12px;
    max-width: 400px;
    position: relative;
    animation: modalIn 0.4s ease forwards;
}

@keyframes modalIn {
    from { transform: translateY(-30px); }
    to { transform: translateY(0); }
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
}

/* =========================
   IMAGE BÉBÉ – ANIMATION VIVANTE
========================= */

#image-modal {
  align-items: flex-start;
  padding-top: 57vh; /* position sous la première */
  background-color: transparent;
}

.image-modal img {
    max-width: 300px;
    width: 100%;
    border-radius: 12px;
    background: white;

    animation:
        imagePop 0.5s ease forwards,
        babySway 4s ease-in-out infinite;

    animation-delay: 0s, 0.8s;
    transform-origin: center bottom;
}

@keyframes imagePop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes babySway {
    0%   { transform: rotate(-3deg) translateY(0); }
    50%  { transform: rotate(2deg) translateY(-4px); }
    100% { transform: rotate(-3deg) translateY(0); }
}

/* =========================
   POINTEUR
========================= */

.pointer {
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 20px solid #e74c3c;
    margin: 0 auto;
    margin-top: -200px;
    position: relative;
    z-index: 10;
    top: 25px;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 768px) {
    body {
        margin: 20px;
        background-size: contain;
        background-position: center top;
        background-color: #000;
    }

    .wheel-container {
        width: 240px;
        height: 240px;
    }
}
