/* Import Font & CSS Variables */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root {
    --bg-color: #f0f2f5;
    --text-color: #333;
    --card-bg: #ffffff;
    --pointer-color: #e74c3c;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding-top: 60px;
    overflow-x: hidden;
}

.toolbar {
    position: fixed; top: 0; left: 0;
    width: 100%;
    background-color: var(--card-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
    display: flex; justify-content: center; flex-wrap: wrap;
    padding: 10px 5px;
    z-index: 1000;
    gap: 5px;
}

.toolbar button {
    background: none; border: none; font-size: 0.9rem;
    padding: 8px 12px; cursor: pointer; border-radius: 5px;
    transition: background-color 0.2s;
}

.app-container {
    display: flex; flex-direction: column; align-items: center;
    padding: 20px; gap: 30px; width: 100%;
    box-sizing: border-box;
}

.wheel-section { display: flex; flex-direction: column; align-items: center; }

/* Kontainer Utama Roda */
.wheel-container {
    position: relative;
    width: 90vw; 
    max-width: 500px;
    aspect-ratio: 1 / 1; /* Memastikan rasio tetap bulat sempurna */
    display: flex;
    justify-content: center;
    align-items: center;
}

.confetti-canvas {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 50;
    pointer-events: none;
}

#wheelCanvas { 
    width: 100% !important; 
    height: 100% !important; 
    display: block;
}

.wheel-pointer {
    position: absolute;
    top: 50%;
    left: -15px; 
    transform: translateY(-50%);
    width: 0; height: 0;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
    border-left: 40px solid var(--pointer-color); 
    z-index: 60;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
}

/* PERBAIKAN TOTAL TOMBOL TENGAH */
.spin-prompt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Menarik elemen kembali ke tengah titik pusat */
    width: 25%;
    height: 25%;
    min-width: 80px; /* Mencegah teks bertumpuk di layar kecil */
    min-height: 80px;
    background-color: white;
    border-radius: 50%;
    display: flex; /* Gunakan flex untuk memusatkan teks di dalam lingkaran putih */
    justify-content: center;
    align-items: center;
    text-align: center;
    font-weight: bold;
    font-size: clamp(0.7rem, 2vw, 1rem); /* Ukuran teks adaptif */
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    border: 3px solid #eee;
    box-shadow: 0 0 10px rgba(0,0,0,0.1) inset;
    z-index: 100; /* Pastikan di atas canvas apa pun */
}

/* Controls Section */
.controls-section {
    width: 100%; max-width: 450px; background: var(--card-bg);
    padding: 20px; border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    box-sizing: border-box;
}

#namesTextarea {
    width: 100%; height: 200px; border: 2px solid #ddd;
    border-radius: 8px; padding: 10px; font-size: 1rem;
    resize: vertical; box-sizing: border-box;
}

.entry-actions { display: flex; gap: 10px; margin: 15px 0; }

#spinButton {
    width: 100%; padding: 15px; font-size: 1.2rem; font-weight: bold;
    color: white; background: linear-gradient(45deg, #2ecc71, #28b463);
    border: none; border-radius: 8px; cursor: pointer;
}

.button-danger {
    width: 100%; padding: 12px; margin-top: 10px;
    font-size: 1rem; font-weight: bold;
    color: var(--pointer-color); background-color: #fde2e2;
    border: 1px solid var(--pointer-color); border-radius: 8px;
}

.button-secondary {
    display: block; text-align: center; width: 100%;
    padding: 12px; margin-top: 10px; font-size: 1rem;
    color: #555; border: 1px solid #ccc; border-radius: 8px;
    text-decoration: none; box-sizing: border-box;
}

/* Modal & Animations */
.modal {
    display: none; position: fixed; z-index: 2000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    align-items: center; justify-content: center;
}
.modal.show { display: flex; }
.modal-content {
    background-color: #fff; padding: 20px 30px; border-radius: 15px;
    width: 90%; max-width: 500px; position: relative;
}

@media (min-width: 992px) {
    .app-container { flex-direction: row; align-items: flex-start; justify-content: center; }
    .wheel-container { width: 500px; height: 500px; }
}

@keyframes fadeIn { from {opacity: 0;} to {opacity: 1;} }