:root {
    --primary: #ff6b81; /* Pink */
    --secondary: #70a1ff; /* Biru */
    --bg: #f1f2f6;
    --card: #ffffff;
    --text: #2f3542;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text);
}

.hidden { display: none !important; }

.card {
    background: var(--card);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    text-align: center;
    width: 300px;
    animation: fadeIn 0.5s ease;
}

input {
    width: 90%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* Tombol Umum */
button {
    background: #9E86F4;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    margin-top: 10px;
    transition: transform 0.1s;
}
button:active { transform: scale(0.98); }

/* Tombol Mode Selection */
.mode-btn { margin-bottom: 10px; padding: 15px; font-weight: bold; }
.mode-btn.online { background: linear-gradient(45deg, var(--secondary), var(--primary)); }
.mode-btn.bot { background: #57606f; }

.error { color: red; font-size: 0.9rem; }

/* Game UI */
#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
}

.score-board {
    display: flex;
    justify-content: space-around;
    width: 100%;
    background: #ffffff;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    font-weight: bold;
}
.score-item.arap { color: var(--secondary); }
.score-item.alya { color: var(--primary); }

.header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
}

.player-badge {
    background: #e0e0e0; 
    color: #888;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    transition: all 0.3s;
    opacity: 0.5;
    border: 2px solid transparent;
}

/* Warna Dinamis */
.player-badge.is-X {
    background-color: var(--secondary) !important;
    color: white !important;
    border-color: var(--secondary);
}
.player-badge.is-O {
    background-color: var(--primary) !important;
    color: white !important;
    border-color: var(--primary);
}
.player-badge.active {
    opacity: 1 !important;
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.vs { align-self: center; font-weight: bold; color: #aaa; }

#status-bar {
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 1.1rem;
    color: #555;
}

.board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    background: #ccc;
    padding: 5px;
    border-radius: 10px;
    width: 90vw;
    max-width: 400px;
    aspect-ratio: 1;
}

.cell {
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
}

.cell.X { 
    color: var(--secondary) !important; 
    text-shadow: 0 0 5px rgba(112, 161, 255, 0.4);
}
.cell.O { 
    color: var(--primary) !important; 
    text-shadow: 0 0 5px rgba(255, 107, 129, 0.4);
}

.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    animation: popIn 0.3s ease;
}
@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Paste kode CSS lama Anda di sini, lalu tambahkan ini di paling bawah */

/* Menu Styles */
#menu-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

#menu-container button {
    font-size: 1.1rem;
    padding: 15px;
    margin-bottom: 10px;
    transition: transform 0.1s;
}

#menu-container button:active {
    transform: scale(0.95);
}

/* ... CSS LAMA TETAP DIPAKAI ... */

/* Tambahkan Style ini di paling bawah */

#name-selection-container, #menu-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

#name-selection-container button, #menu-container button {
    font-size: 1.1rem;
    padding: 15px;
    margin-bottom: 10px;
    width: 100%;
}

/* =========================================
   ANIMASI LOVE PARTICLE (TAMBAHAN BARU)
   ========================================= */

/* 1. Container Partikel (Layer Belakang) */
#love-particles-container {
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    overflow: hidden;
    pointer-events: none; /* SANGAT PENTING: Supaya game tetap bisa diklik */
    z-index: 0; /* Di belakang game */
}

/* 2. Style Teks Melayang */
.love-particle {
    position: absolute;
    bottom: -50px; /* Mulai dari bawah layar */
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    user-select: none;
    will-change: transform, opacity;
    text-shadow: 0 0 5px rgba(255,255,255, 0.8); /* Glow putih dikit biar kebaca */
    font-family: 'Segoe UI', sans-serif;
}

/* 3. Keyframes Gerakan (Bawah ke Atas) */
@keyframes floatUp {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8; /* Muncul */
    }
    90% {
        opacity: 0.8; 
    }
    100% {
        /* Bergerak ke atas layar sambil goyang kiri/kanan (drift-x diatur JS) */
        transform: translateY(-110vh) translateX(var(--drift-x)) rotate(var(--rot));
        opacity: 0; /* Hilang */
    }
}

/* 4. Pastikan UI Game Tampil DI DEPAN Partikel */
#name-selection-container,
#menu-container,
#login-container,
#game-container {
    position: relative;
    z-index: 10; /* Lebih tinggi dari partikel (0) */
}

/* Modal Popup Paling Depan */
.modal {
    z-index: 100 !important;
}

/* Paste di paling bawah style.css */

/* Efek Kotak Menang */
.cell.win {
    background-color: #f1c40f !important; /* Kuning Emas */
    color: #fff !important;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.8);
    z-index: 5;
    border: 2px solid #fff;
}