/* Reset & Base Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    overflow-x: hidden; 
    min-height: 100vh; 
    transition: background 0.5s ease; 
}

/* =========================================
   MAIN PASSCODE LOGIN OVERLAY
   ========================================= */
.main-login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.4s ease;
}

.main-login-box {
    background: white;
    padding: 35px 25px;
    border-radius: 20px;
    text-align: center;
    width: 90%;
    max-width: 340px;
    box-shadow: 0 10px 30px rgba(255, 105, 180, 0.4);
    border: 3px solid #ffb6c1;
}

.main-login-box h2 {
    color: #d81b60;
    margin-bottom: 8px;
    font-size: 20px;
}

.main-login-box p {
    color: #666;
    font-size: 13px;
    margin-bottom: 20px;
}

.main-login-box input {
    width: 100%;
    padding: 12px;
    font-size: 22px;
    letter-spacing: 8px;
    text-align: center;
    border: 2px solid #ffb6c1;
    border-radius: 12px;
    outline: none;
    color: #d81b60;
    background: #fff0f5;
    margin-bottom: 15px;
}

.main-login-box button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%);
    color: #d81b60;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 105, 180, 0.3);
    transition: transform 0.2s;
}

.main-login-box button:hover {
    transform: scale(1.02);
}

.error-text {
    color: #e63946;
    font-size: 12px;
    font-weight: bold;
    margin-top: 12px;
}

/* =========================================
   NAVIGATION MENU & SIDEBAR
   ========================================= */

.disabled-link {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
}

.anniversary-ready {
    color: #ff1493 !important;
    background: #fff0f5;
    padding: 6px 12px;
    border-radius: 8px;
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(255, 20, 147, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 20, 147, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 20, 147, 0); }
}

.top-nav { display: none; }

.hamburger-btn {
    position: fixed;
    top: 20px;
    right: 25px;
    font-size: 24px;
    color: white;
    background: rgba(0, 0, 0, 0.3); 
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    backdrop-filter: blur(5px);
    transition: transform 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.hamburger-btn:hover { transform: scale(1.1); }

/* Animasi Surat Masuk Elegan di Tengah Layar */
@keyframes letterPopIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.letter-popup-animation {
    animation: letterPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border: 3px solid #ff1493 !important;
    background: #fff0f5 !important;
    max-width: 360px !important;
}

/* =========================================
   FLOATING NOTE BUBBLE (GERAKAN ZIG-ZAG & RANDOM)
   ========================================= */
.floating-note-bubble {
    position: fixed;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ff69b4;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.5);
    backdrop-filter: blur(5px);
    /* Menggunakan animasi gerak acak/zigzag lintas layar */
    animation: randomZigZag 18s ease-in-out infinite;
    transition: transform 0.2s;
}

.floating-note-bubble:hover {
    transform: scale(1.2);
}

/* Efek kedip kalau belum dibaca */
.floating-note-bubble.unread {
    animation: randomZigZag 18s ease-in-out infinite, unreadPulse 1.5s ease-in-out infinite;
    border-color: #ff4500;
    background: #fff0f5;
}

@keyframes unreadPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 69, 0, 0.6); }
    70% { box-shadow: 0 0 0 12px rgba(255, 69, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 69, 0, 0); }
}

/* Lintasan Zig-zag & Melintas Acak di Tengah Layar */
@keyframes randomZigZag {
    0%   { top: 10vh; left: 5vw; }
    15%  { top: 70vh; left: 30vw; }
    30%  { top: 25vh; left: 75vw; }
    45%  { top: 80vh; left: 85vw; }
    60%  { top: 40vh; left: 50vw; }
    75%  { top: 15vh; left: 80vw; }
    90%  { top: 65vh; left: 15vw; }
    100% { top: 10vh; left: 5vw; }
}


/* =========================================
   CUTE NOTE MODAL STYLING
   ========================================= */
.cute-note-box {
    background: #fff0f5 !important;
    border: 3px solid #ffb6c1;
    border-radius: 20px !important;
    padding: 30px 20px 20px !important;
    box-shadow: 0 10px 25px rgba(255, 105, 180, 0.3);
}

.cute-note-box h2 {
    color: #d81b60;
    margin-bottom: 15px;
    font-size: 18px;
}

.note-text-display {
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 2px dashed #ffb6c1;
    color: #555;
    font-size: 14px;
    min-height: 80px;
    max-height: 180px;
    overflow-y: auto;
    text-align: left;
    margin-bottom: 15px;
    white-space: pre-wrap;
}

.cute-note-box textarea {
    width: 100%;
    height: 100px;
    padding: 12px;
    border: 2px solid #ffb6c1;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    resize: none;
    background: white;
    color: #333;
    margin-bottom: 15px;
}

.note-actions {
    display: flex;
    gap: 10px;
}

.cute-btn-primary {
    width: 100%;
    padding: 10px;
    background: #ff69b4;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(255, 105, 180, 0.3);
}

.cute-btn-secondary {
    flex: 1;
    padding: 10px;
    background: white;
    color: #d81b60;
    border: 2px solid #ffb6c1;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}

.cute-btn-danger {
    flex: 1;
    padding: 10px;
    background: #ffe4e1;
    color: #e63946;
    border: 1px solid #ffb6c1;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}

.close-note {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #d81b60;
}



/* =========================================
   FLOATING THEME BUBBLE
   ========================================= */
.floating-theme-btn {
    position: fixed;
    top: 75px;
    right: 27px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid #ffb6c1;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 105, 180, 0.3);
    backdrop-filter: blur(5px);
    animation: floatingBubble 3s ease-in-out infinite;
    transition: transform 0.2s, background 0.2s;
}

.floating-theme-btn:hover {
    transform: scale(1.15) rotate(15deg);
    background: white;
}

@keyframes floatingBubble {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0px); }
}

.sidebar {
    position: fixed;
    top: 0;
    right: -300px; 
    width: 250px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3); 
    backdrop-filter: blur(10px);
    z-index: 1002;
    transition: right 0.4s ease;
    padding-top: 80px;
}
.sidebar.active { right: 0; }
.close-sidebar { position: absolute; top: 20px; left: 20px; font-size: 35px; color: white; cursor: pointer; }
.sidebar ul { list-style: none; padding: 0 20px; }
.sidebar ul li { margin-bottom: 25px; }
.sidebar ul li a { color: white; text-decoration: none; font-size: 18px; font-weight: bold; display: block; }
.sidebar ul li a:hover { color: #ffd1dc; }

/* =========================================
   CUSTOM DROPDOWN - DIPISAH TOTAL AGAR TIDAK BENTROK
   ========================================= */
.game-mode-selector {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    margin-bottom: 10px;
    position: relative;
}

.custom-dropdown {
    width: 48%;
    position: relative;
    background: white;
    border: 2px solid #ffb6c1;
    border-radius: 12px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    user-select: none;
}

.dropdown-selected {
    padding: 10px 8px;
    color: #d81b60;
    font-weight: bold;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item {
    padding: 10px;
    font-size: 11px;
    color: #d81b60;
    font-weight: bold;
    text-align: left;
    border-bottom: 1px solid #ffe4e1;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #fff0f5;
}

.dropdown-item.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.dropdown-item.disabled:hover {
    background: white;
}

/* Dropdown Menu khusus Game Mode */
#game-mode-menu {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    background: white;
    border: 2px solid #ffb6c1;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(255, 105, 180, 0.2);
    z-index: 100;
    
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#game-mode-menu.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Dropdown Menu khusus Level (Dipisah total dari game-mode-menu) */
#level-menu {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    background: white;
    border: 2px solid #ffb6c1;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(255, 105, 180, 0.2);
    z-index: 100;
    
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#level-menu.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* =========================================
   PENGATURAN 8 VARIASI TEMA CUTE
   ========================================= */
body.theme-1 { background-color: #1a1a1a; }
body.theme-1 .photo-card { border: 10px solid #fff; box-shadow: 2px 2px 15px rgba(0,0,0,0.8); }

body.theme-2 { background-color: #f4f1ea; }
body.theme-2 .photo-card { border: 15px solid #fff; border-bottom-width: 45px; box-shadow: 0 4px 8px rgba(0,0,0,0.2); }

body.theme-3 { background-color: #ffd1dc; background-image: radial-gradient(#ffb6c1 10%, transparent 11%); background-size: 20px 20px; }
body.theme-3 .photo-card { border: 5px solid #fff; border-radius: 10px; box-shadow: 0 4px 15px rgba(255,105,180,0.4); }

body.theme-4 { background-color: #a2d2ff; }
body.theme-4 .photo-card { border: 8px solid #fff; border-radius: 5px; box-shadow: 4px 4px 0 #333; }

body.theme-5 { background-color: #e3d5ff; background-image: radial-gradient(#c7b8ea 10%, transparent 11%); background-size: 20px 20px; }
body.theme-5 .photo-card { border: 6px solid #fff; border-radius: 12px; box-shadow: 0 4px 15px rgba(138, 43, 226, 0.2); }

body.theme-6 { background-color: #d8f3dc; background-image: radial-gradient(#b7e4c7 10%, transparent 11%); background-size: 20px 20px; }
body.theme-6 .photo-card { border: 6px solid #fff; border-radius: 12px; box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2); }

body.theme-7 { background-color: #ffdad6; background-image: radial-gradient(#f4acb7 10%, transparent 11%); background-size: 20px 20px; }
body.theme-7 .photo-card { border: 6px solid #fff; border-radius: 12px; box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2); }

body.theme-8 { background-color: #fefae0; background-image: radial-gradient(#faedcd 10%, transparent 11%); background-size: 20px 20px; }
body.theme-8 .photo-card { border: 6px solid #fff; border-radius: 12px; box-shadow: 0 4px 15px rgba(212, 163, 89, 0.2); }

/* =========================================
   GALLERY & CARD LAYOUT
   ========================================= */
.gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 80px 20px 20px;
    min-height: 100vh;
    gap: 25px;
}
.empty-state { color: #888; font-size: 1.2rem; text-align: center; margin-top: 20vh; background: rgba(255,255,255,0.7); padding: 10px 20px; border-radius: 5px; }

.photo-card {
    width: 250px;
    height: auto;
    transition: transform 0.3s ease, z-index 0s;
    cursor: pointer;
    background: white;
    transform: rotate(calc(var(--rot) * 1deg));
}
.photo-card img { width: 100%; height: auto; display: block; object-fit: cover; }
.photo-card:hover { transform: scale(1.15) rotate(0deg) !important; z-index: 50; position: relative; }

/* =========================================
   LIGHTBOX MODAL
   ========================================= */
#lightbox-modal {
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
}
#lightbox-modal.hidden { display: none !important; }
.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255,255,255,0.3);
    object-fit: contain;
    animation: zoomIn 0.3s ease;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 45px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}
.lightbox-close:hover { color: #bbb; text-decoration: none; }
@keyframes zoomIn {
    from {transform: scale(0.7); opacity: 0;}
    to {transform: scale(1); opacity: 1;}
}

/* =========================================
   MODAL UPLOAD
   ========================================= */
.hidden { display: none !important; }
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 2000; }
.modal-content { background: white; padding: 30px; border-radius: 10px; width: 90%; max-width: 400px; position: relative; text-align: center; }
.close-btn { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; }
#file-input { margin: 20px 0; }
#submit-upload { background: #333; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-weight: bold;}
#submit-upload:hover { background: #555; }
#upload-status { margin-top: 15px; font-size: 14px; color: #e63946; font-weight: bold; }

/* =========================================
   GAME SECTION & LOGIN PANEL
   ========================================= */
#game-section { 
    padding: 70px 15px 20px; 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    align-items: center;
}

.game-panel { 
    background: rgba(255,255,255,0.95); 
    padding: 30px; 
    border-radius: 20px; 
    text-align: center; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    margin-top: 20vh;
    width: 100%;
    max-width: 350px;
}
.game-panel input { padding: 12px; margin: 15px 0; width: 100%; border: 2px solid #ffb6c1; border-radius: 10px; font-size: 16px; outline: none;}
.game-panel button { padding: 12px 20px; background: #ff69b4; color: white; border: none; border-radius: 10px; font-weight: bold; cursor: pointer; width: 100%; font-size: 16px;}

#game-arena { 
    width: 100%; 
    max-width: 600px; 
    display: flex; 
    flex-direction: column; 
    gap: 12px;
}

/* =========================================
   GAME HEADER & BOX SIMETRIS
   ========================================= */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: stretch; 
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4e1 100%);
    padding: 12px;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(255, 105, 180, 0.15);
    width: 100%;
    border: 2px solid #ffb6c1;
    gap: 10px;
}

.game-box {
    background: white;
    padding: 12px;
    border-radius: 15px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48%; 
    text-align: center;
}

.target-clue p {
    font-weight: bold;
    color: #ff69b4;
    margin-bottom: 6px;
    font-size: 13px;
}

#target-photo-container {
    width: 75px;
    height: 75px;
    position: relative;
    border: 2px dashed #ffb6c1;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.target-clue img {
    width: 75px;
    height: 75px;
    object-fit: cover;
}

.target-clue canvas {
    width: 75px;
    height: 75px;
    display: block;
}

.game-info .score-text {
    font-size: 11px;
    color: #555;
    font-weight: bold;
    margin-bottom: 10px;
    line-height: 1.4;
}

#start-game-btn {
    margin-bottom: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%);
    color: #d81b60;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(255, 105, 180, 0.3);
    transition: all 0.2s ease;
}
#start-game-btn:hover {
    transform: translateY(-2px) scale(1.03);
}

#leaderboard-btn {
    padding: 6px 10px;
    background: #fff0f5;
    color: #ff69b4;
    border: 1px solid #ffb6c1;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
}
#leaderboard-btn:hover {
    background: #ffe4e1;
}

/* =========================================
   AREA GAME SCATTER / PILIHAN TEBAKAN
   ========================================= */
#scatter-area { 
    position: relative; 
    width: 100%; 
    height: 55vh; 
    background: rgba(0,0,0,0.15); 
    border-radius: 15px; 
    overflow: hidden; 
    border: 2px dashed rgba(255,255,255,0.4);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
}

.scattered-photo { 
    position: absolute; 
    width: 85px; 
    height: 85px; 
    object-fit: cover; 
    border: 3px solid white; 
    border-radius: 4px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    cursor: pointer; 
}

/* Styling Pilihan untuk Mode Tebak Foto */
.guess-option-card {
    width: 95px;
    height: 95px;
    border: 3px solid white;
    border-radius: 10px;
    object-fit: cover;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
    background: white;
}
.guess-option-card:hover {
    transform: scale(1.1);
}

/* =========================================
   MODAL LEADERBOARD POP-UP
   ========================================= */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 2000; }
.modal-content { background: white; padding: 25px; border-radius: 15px; width: 90%; max-width: 320px; position: relative; text-align: center; }
.modal-content h2 { color: #ff69b4; margin-bottom: 15px; font-size: 18px; }

#leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

#leaderboard-list li {
    background: #fff0f5;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    color: #d81b60;
    font-weight: bold;
    border: 1px solid #ffe4e1;
}

.close-leaderboard {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 22px;
    cursor: pointer;
    color: #888;
}

#target-photo[src=""] { display: none; }
#target-photo:not([src=""]) { display: inline-block; }
