/* Reset & Prevent Scrolling */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Wadah Bubble Melayang (PENTING BIAR GAK NYANGKUT) */
#bubble-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(100vh - 80px); /* 80px disisakan buat area input bawah */
    overflow: hidden;
    touch-action: none;
}

/* Tema Aquarium Laut Dalam */
body, html { 
    width: 100vw; 
    height: 100vh; 
    overflow: hidden; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    touch-action: none; 
    background: linear-gradient(135deg, #0a3d62 0%, #1b263b 100%);
    color: #fff; /* Teks default putih biar masuk ke tema gelap */
    position: relative;
}

/* Gelembung Air Background */
body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: 
        radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 15%),
        radial-gradient(circle at 30% 60%, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 25%),
        radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 20%),
        radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 30%);
    pointer-events: none;
}

/* Desain Bubble Curhatan */
.bubble {
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 15px;
    font-size: 13px;
    font-weight: 600;
    color: #000; /* Teks Hitam Pekat biar kebaca jelas di bubble putih */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    cursor: grab;
    user-select: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.bubble:active { 
    cursor: grabbing; 
    transform: scale(1.1); 
    box-shadow: 0 15px 35px rgba(255, 255, 255, 0.2); 
}

/* Badge Reaksi Kecil di Gelembung Melayang */
.bubble-reactions { 
    position: absolute; 
    bottom: -10px; 
    right: 0; 
    background: #222; 
    color: white;
    border-radius: 10px; 
    padding: 2px 5px; 
    font-size: 12px; 
    display: none; 
}

/* Area Input di Bawah (Tema Gelap Elegan) */
.input-area { 
    position: absolute; 
    bottom: 0; 
    width: 100%; 
    min-height: 80px; 
    background: rgba(0, 0, 0, 0.4); 
    backdrop-filter: blur(15px);
    display: flex; 
    
    /* FIX KHUSUS APK (PWA): Otomatis nambahin jarak sesuai tebal navigasi HP */
    padding: 15px 15px calc(15px + env(safe-area-inset-bottom)) 15px; 
    
    gap: 10px; 
    z-index: 100; 
    border-top: 1px solid rgba(255,255,255,0.1); 
}

#curhat-input { 
    flex: 1; 
    border-radius: 20px; 
    border: 1px solid #444; 
    padding: 10px 20px; 
    background: #1a1c29; 
    color: white; 
    resize: none; 
    font-size: 14px; 
    outline: none; 
}

#btn-send { 
    padding: 0 25px; 
    border-radius: 20px; 
    border: none; 
    background: linear-gradient(45deg, #00d2ff, #3a7bd5); 
    color: white; 
    font-weight: bold; 
    cursor: pointer; 
    transition: 0.2s; 
}

#btn-send:active { 
    transform: scale(0.95); 
}

/* Modal Full Text (Pas gelembung diklik) */
#modal { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.8); z-index: 1000; 
    display: flex; justify-content: center; align-items: center; 
    opacity: 1; transition: opacity 0.3s; 
}
#modal.hidden { opacity: 0; pointer-events: none; }

.modal-content { 
    background: #1a1c29; padding: 30px; border-radius: 20px; 
    width: 90%; max-width: 400px; position: relative; 
    border: 1px solid #3a7bd5; text-align: center; 
}

#btn-close { 
    position: absolute; top: 10px; right: 15px; 
    background: transparent; border: none; color: white; 
    font-size: 24px; cursor: pointer; 
}

#modal-text { 
    font-size: 18px; line-height: 1.5; margin: 20px 0; 
    word-wrap: break-word; max-height: 50vh; overflow-y: auto; 
}

.reaction-title { font-size: 12px; color: #aaa; margin-bottom: 10px; }
.reaction-bar { display: flex; justify-content: center; gap: 10px; margin-bottom: 15px; }

.btn-react { 
    background: #2a2d3e; border: none; font-size: 24px; 
    padding: 10px; border-radius: 50%; cursor: pointer; transition: 0.2s; 
}
.btn-react:hover { background: #3a3d5e; transform: scale(1.1); }

#active-reactions { 
    font-size: 16px; background: rgba(255,255,255,0.05); 
    padding: 10px; border-radius: 10px; min-height: 40px; 
}

/* Level Reaksi Warna Gelembung */
.bubble.silver { border: 3px solid #C0C0C0; box-shadow: 0 0 20px rgba(192, 192, 192, 0.8); }
.bubble.gold { border: 3px solid #FFD700; box-shadow: 0 0 25px rgba(255, 215, 0, 0.9); }
.bubble.diamond { border: 3px solid #00FFFF; box-shadow: 0 0 35px rgba(0, 255, 255, 1); background: rgba(0, 255, 255, 0.3); color: #000; }

/* Animasi Emot Terbang */
.flying-emoji {
    position: fixed; font-size: 28px; pointer-events: none; 
    z-index: 9999; animation: flyUp 1.5s ease-out forwards;
}

@keyframes flyUp {
    0% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-200px) scale(2) rotate(30deg); opacity: 0; }
}
