body {
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background: #f0f4f8 url("https://safeoftheday.tokyo-igusa.art/sdtoto/bg01.webp") center center no-repeat; 
    color: #333;
    overflow-x: hidden;
}

/* --- Header Styles --- */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 15px;
    max-width: 90%;
    position: relative; 
    z-index: 2; /* Pastikan header di atas elemen lain jika overlap */
}

header img {
    max-width: 250px;
}

header p {
    font-size: 1.1em;
    color: #555;
}

/* --- Main Container for Wheel --- */
main{
    padding:15px;
    margin: auto
}
.wheel-container {
    position: relative; /* Penting untuk penempatan tombol dan penunjuk */
    width: 550px; /* Lebar kontainer roda */
    height: 550px; /* Tinggi kontainer roda */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    margin: auto;
    background-color: linear-gradient(110deg, #dfc37a 0%, #876429 50%, #dfc37a 100%); /* Latar belakang putih untuk roda */
    border-radius: 50%; /* Membuatnya lingkaran */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); /* Bayangan lebih dalam */
    border: 5px solid #dfc37a; /* Bingkai biru cerah */
}

/* Penunjuk Roda (Segitiga Merah) */
.wheel-container::after {
     content: '';
    position: absolute;
    top: 0; /* <--- SESUAIKAN NILAI 'top' INI */
    /* top: 10px; di kode Anda akan menempatkan panah di DALAM kontainer roda, 
       sehingga sebagian akan terpotong oleh `overflow: hidden;` pada `.wheel-container`.
       Biasanya nilai ini negatif untuk menempatkan panah di LUAR tapi dekat tepi.
       Sesuaikan angka -25px ini hingga panah terlihat sempurna. */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 25px solid #E53935; /* <--- KOREKSI KRITIS: UBAH MENJADI border-bottom */
    z-index: 0;
    transition: all 0.2s ease-out;
}


/* --- Canvas Styles --- */
canvas#wheelCanvas {
    display: block; 
    width: 120%; 
    height: auto;
    border-radius: 50%; 
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* This is correct for centering */
    /* Make sure there are no other margins, paddings, or border-box issues */
    margin: 0; /* Explicitly set margin to 0 */
    padding: 0; /* Explicitly set padding to 0 */
    box-sizing: border-box; /* Or content-box, but ensure consistency */
    text-transform: uppercase;
}

/* --- Spin Button Styles --- */
button#spinButton {
    background: linear-gradient(#74cae3, #5bc0de 60%, #4ab9db);
    border: 1px solid #00eeff;
    color: #000; 
    border-radius: 20px !important;
    padding: 15px 70px;
    font-size: 1.8em; 
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    outline: none; 
    letter-spacing: 1px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    
    position: absolute;
    top: 120%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5; 
}

button#spinButton:hover:not(:disabled) {
    background-color: #45a049; 
    transform: translate(-50%, -50%) translateY(-3px); 
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3);
}

button#spinButton:active:not(:disabled) {
    transform: translate(-50%, -50%) translateY(0); 
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

button#spinButton:disabled {
    background-color: #cccccc; 
    cursor: not-allowed;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

#bgImage {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 118%;
    height: 122%;
    border-radius: 50%;
    z-index: 2;
    pointer-events: none;
}

/* --- Result Display Styles --- */
#result {
    margin-top: 170px;
    padding: 15px 15px;
    background-color: #e8f5e9; 
    border: 2px solid #00eeff;
    border-radius: 12px;
    font-size: 1em;
    font-weight: bold;
    color: #2e7d32; 
    text-align: center;
    min-height: 15px; 
    opacity: 0; 
    transform: translateY(20px); 
    transition: opacity 0.5s ease-out, transform 0.5s ease-out; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    position: relative; 
    z-index: 2;
}

#result.show {
    opacity: 1; 
    transform: translateY(0); 
}

/* --- Footer Styles --- */
footer {
    margin-top: 50px; 
    padding: 20px;
    color: #fff;
    font-size: 0.9em;
    text-align: center;
}

/* --- Responsive Adjustments --- */
@media (max-width: 600px) {
    .wheel-container {
        width: 90vw; 
        height: 90vw;
        margin-bottom: 30px;
    }

    header h1 {
        font-size: 1.8em;
    }

    header p {
        font-size: 1em;
    }

    button#spinButton {
        padding: 12px 30px;
        font-size: 1.5em;
    }

    #result {
        font-size: 1em;
        padding: 12px 12px;
    }
}

@media (max-width: 400px) {
    button#spinButton {
        font-size: 1.3em;
        padding: 10px 25px;
    }
}

.input-section {
    background-color: #d9d9d9;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.input-section label {
    display: block;
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #4ab9db;
    font-weight: 600;
}

.input-section input[type="text"] {
    width: calc(100% - 40px); /* Kurangi padding */
    padding: 12px 20px;
    margin-bottom: 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1em;
    box-sizing: border-box; /* Pastikan padding tidak menambah lebar */
}

.input-section button {
    background: linear-gradient(#74cae3, #5bc0de 60%, #4ab9db);
    border: 0px solid #00eeff;
    color: #fff;
    border-radius: 50px;
    padding: 12px 30px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    outline: none;
    width: 100%;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.input-section button:hover {
    background-color: #4ab9db;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.input-section .message {
    margin-top: 15px;
    font-size: 1em;
    color: #e53935; /* Warna merah untuk pesan error */
    font-weight: 500;
}

.ambilKupon {
    margin-top: 20px;
    background: linear-gradient(#f17a77, #ee5f5b 60%, #ec4d49);
    box-shadow: 0px 0px 0px 0;
    border: 0px solid #00eeff;
    color: #FFFFFF;
    border-radius: 50px;
    padding: 12px 12px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    outline: none;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

/* --- Utility Class untuk Menyembunyikan Elemen --- */
.hidden {
    display: none;
}
.modal {
    display: none; /* Sembunyikan modal secara default */
    position: fixed; /* Tetap di viewport saat bergulir */
    z-index: 1000; /* Pastikan di atas semua elemen lain */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Aktifkan gulir jika konten terlalu besar */
    background-color: rgba(0,0,0,0.6); /* Latar belakang gelap transparan */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px); /* Efek blur pada latar belakang */
}

.modal-content {
    background-color: #fefefe;
    margin: auto; /* Untuk memusatkan modal */
    padding: 30px;
    border: 1px solid #888;
    width: 80%; /* Lebar modal */
    max-width: 500px; /* Lebar maksimal */
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
    position: relative;
    transform: translateY(-50px); /* Mulai sedikit di atas */
    opacity: 0; /* Mulai tidak terlihat */
    animation: fadeInSlide 0.3s forwards ease-out; /* Animasi muncul */
}

@keyframes fadeInSlide {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}


.modal-content h2 {
    color: #4ab9db; /* Warna hijau untuk judul hadiah */
    font-size: 2em;
    margin-bottom: 10px;
}

.modal-content p {
    font-size: 1.2em;
    color: #000000;
    margin-bottom: 20px;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

#modalCloseButton {
    background-color: #4ab9db; /* Warna tombol OK */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s ease;
}

#modalCloseButton:hover {
    background-color: #4ab9db;
}