@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #111111, #222222, #333333);
    background-size: cover;
    font-family: 'Poppins', sans-serif;
    color: #fff;
    flex-direction: column;
}

.container {
    position: relative;
    width: 400px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container .spinBtn {
    position: absolute;
    width: 80px;
    height: 80px;
    background: #fff;
    border-radius: 50%;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.1em;
    border: 4px solid rgba(0, 0, 0, 0.75);
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.container .spinBtn:hover {
    transform: scale(1.1) rotate(3deg);
    box-shadow: 0 0 20px rgba(255, 223, 0, 0.7);
    background: linear-gradient(135deg, #ffdd33, #ffaa00);
}

.container .spinBtn::before {
    content: '';
    position: absolute;
    top: -28px;
    width: 20px;
    height: 30px;
    background: #fff;
    clip-path: polygon(50% 0, 15% 100%, 85% 100%);
}

.container .wheel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #333;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 0 5px #333, 0 0 0 15px #fff, 0 0 0 18px #111;
    transition: 5s ease-in-out;
    /* transition: transform 5s cubic-bezier(0.1, 0.7, 0.4, 1); */
}

.container .wheel .number {
    position: absolute;
    width: 50%;
    height: 50%;
    background: var(--clr);
    transform-origin: bottom right;
    transform: rotate(calc(45deg * var(--i)));
    /* Clip path for 8 segments */
    clip-path: polygon(0% 0%, 56% 0, 100% 100%, 0% 56%);
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    cursor: pointer;
}

.container .wheel .number span {
    position: relative;
    transform: rotate(45deg);
    font-size: 2em;
    font-weight: 700;
    color: #fff;
    text-shadow: 3px 5px 2px rgba(0, 0, 0, 0.15);
}

.container .wheel .number span::before {
    content: '';
    position: absolute;
    font-size: 0.75em;
    font-weight: 500;
}

/* Popup */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.popup-content {
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.popup-content h2 {
    margin-bottom: 10px;
    font-weight: 700;
    color: #333;
}

#scratchCard {
    width: 250px;
    height: 150px;
    border-radius: 10px;
    cursor: crosshair;
}

/* Toast message */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #4caf50;
    color: #fff;
    padding: 12px 25px;
    border-radius: 25px;
    display: none;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Spin Again Button */
.spinAgainBtn {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #333;
    border: 2px solid #000;
    border-radius: 25px;
    padding: 10px 25px;
    font-weight: 600;
    cursor: pointer;
    display: none;
    z-index: 101;
}

/* Confetti Canvas */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    pointer-events: none;
    z-index: 99998;
}

/* --- Congrats Popup Styles --- */
.congrats-popup {
    pointer-events: auto;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.congrats-box {
    background: linear-gradient(135deg, #ffffff, #fafafa);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 0 25px rgba(255, 223, 0, 0.7);
    transform: scale(0.7);
    animation: popupScale 0.6s ease forwards;
    position: relative;
    z-index: 2;
    max-width: 90%;
    padding: 25px 35px;
}

.congrats-box h2 {
    font-size: 2rem;
    color: #111;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    margin-bottom: 10px;
    animation: glowText 1.5s ease-in-out infinite alternate;
}

.congrats-box p {
    font-size: 1.25rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 500;
}

.congrats-box button {
    background: linear-gradient(135deg, #ffcc00, #ff9900);
    color: #111;
    border: none;
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.congrats-box button:hover {
    background: linear-gradient(135deg, #ffdd33, #ffaa00);
    box-shadow: 0 0 15px rgba(255, 200, 0, 0.9);
    transform: scale(1.05);
}

.congrats-para {
    opacity: 0;
    animation: fadeInCondition 0.8s ease 0.5s forwards;
}

@keyframes fadeInCondition {
    to {
        opacity: 1;
    }
}

.congrats-box p.congrats-para {
    font-size: 12px !important;
    color: #777;
    line-height: 1.4;
    margin-top: 12px;
    padding: 0 8px;
}

/* Popup animations */
@keyframes popupScale {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes glowText {
    from {
        text-shadow: 0 0 5px #fff, 0 0 10px #ff0, 0 0 20px #ff0;
    }

    to {
        text-shadow: 0 0 15px #fff, 0 0 25px #ffbf00, 0 0 40px #ffbf00;
    }
}

.offer-terms {
    max-width: 600px;
    text-align: center;
    color: #ccc;
    font-size: 16px;
    line-height: 1.6;
    margin-top: 60px;
    padding: 0 15px;
    font-weight: 400;
}


/* Responsive Code */
@media screen and (max-width: 465px) {
    .container {
        height: 360px;
        width: 360px;
    }

    .offer-terms {
        font-size: 11px;
        margin-top: 50px;
    }

    .congrats-box p.congrats-para {
        font-size: 8px !important;
        line-height: 1.3;
        text-align: center;
    }
}

@media screen and (max-width: 410px) {
    .container {
        height: 340px;
        width: 340px;
    }

    .congrats-box {
        padding: 25px 35px;
    }

    .congrats-box h2 {
        font-size: 1.5rem;
    }

    .congrats-box p {
        font-size: 1rem;
    }

    .congrats-box button {
        font-size: 0.9rem;
        padding: 8px 20px;
    }
}

@media screen and (max-width: 376px) {
    .container {
        height: 300px;
        width: 300px;
    }

    .container .wheel .number span {
        font-size: 1.5em;
    }
}