/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    image-rendering: pixelated; /* Memastikan rendering gambar/elemen tajam ala pixel art */
}

body {
    font-family: 'Press Start 2P', monospace;
    background-color: #ffd1dc; /* Pink lembut */
    background-image: 
        radial-gradient(#ffb3c6 20%, transparent 20%),
        radial-gradient(#ffb3c6 20%, transparent 20%);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    /* Kursor kustom pixel art berbentuk hati */
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z' fill='%23ff4d6d' stroke='%23800020' stroke-width='2'/%3E%3C/svg%3E") 12 12, auto;
}

/* Memastikan tombol dan elemen interaktif juga menggunakan kursor kustom */
button, a, .retro-btn, .control-btn, .desktop-icon {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z' fill='%23ff758f' stroke='%23800020' stroke-width='2'/%3E%3C/svg%3E") 12 12, pointer !important;
}

/* Desktop Icons */
.desktop-icons {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 2;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    text-align: center;
    user-select: none;
}

.icon-image {
    font-size: 32px;
    margin-bottom: 5px;
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.15));
    transition: transform 0.1s ease;
}

.desktop-icon:active .icon-image {
    transform: scale(0.9);
}

.icon-label {
    font-size: 8px;
    color: #800020;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 2px 4px;
    border: 1px solid #800020;
    border-radius: 2px;
    text-shadow: 1px 1px 0px #fff;
}

/* Love Meter */
.love-meter-container {
    width: 100%;
    margin-bottom: 10px;
}

.love-meter-label {
    font-size: 8px;
    color: #800020;
    margin-bottom: 5px;
    text-align: left;
}

.retro-progress-bar {
    width: 100%;
    height: 16px;
    background-color: #ffffff;
    border: 3px solid #800020;
    box-shadow: inset 1px 1px 0px #b07d8a;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background-color: #ff4d6d;
    transition: width 0.3s ease;
}

/* Retro Textarea */
.retro-textarea {
    width: 100%;
    height: 100%;
    border: 3px solid #800020;
    background-color: #ffffff;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    color: #800020;
    padding: 10px;
    resize: none;
    outline: none;
    line-height: 1.6;
}

/* Slot Machine */
.slot-machine {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.slot-screen {
    font-size: 20px;
    background-color: #ffffff;
    border: 3px solid #800020;
    padding: 10px;
    width: 100%;
    text-align: center;
    box-shadow: inset 2px 2px 0px #b07d8a;
}

/* Paint App */
.color-swatch {
    cursor: pointer;
    box-shadow: inset 1px 1px 0px #fff;
}

.color-swatch.active {
    outline: 2px solid #800020;
    box-shadow: none;
}

/* Container Hujan Hati */
#heart-rain-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Agar tidak menghalangi klik pada tombol */
    z-index: 10;
}

/* Jendela Utama Retro (Windows 95 / 8-bit Style) */
.retro-window {
    width: 90%;
    max-width: 500px;
    background-color: #f3c6d1; /* Pastel pink */
    border: 5px solid #800020; /* Border tebal warna merah hati */
    box-shadow: 
        inset 3px 3px 0px #fff, 
        inset -3px -3px 0px #b07d8a,
        6px 6px 0px rgba(0, 0, 0, 0.2); /* Bayangan kotak retro */
    position: absolute; /* Diubah ke absolute agar bisa di-drag dengan benar */
    z-index: 5;
    display: flex;
    flex-direction: column;
}

/* Title Bar */
.title-bar {
    background: linear-gradient(90deg, #ff4d6d, #ff85a2); /* Gradasi pink/merah hati */
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid #800020;
    color: #ffffff;
    font-size: 12px;
    text-shadow: 2px 2px 0px #800020;
    cursor: move; /* Kursor drag */
    user-select: none;
}

.title-bar-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-bar-controls {
    display: flex;
    gap: 4px;
}

/* Tombol Kontrol Window */
.control-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    width: 22px;
    height: 22px;
    background-color: #f3c6d1;
    border: 2px solid #800020;
    box-shadow: inset 1px 1px 0px #fff, inset -1px -1px 0px #b07d8a;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #800020;
    padding-bottom: 2px;
}

.control-btn:active {
    box-shadow: inset -1px -1px 0px #fff, inset 1px 1px 0px #b07d8a;
    padding-top: 2px;
    padding-bottom: 0;
}

/* Window Body */
.window-body {
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 25px;
}

/* Maskot Pixel Heart (Murni CSS) */
.pixel-heart-wrapper {
    margin-bottom: 10px;
    height: 80px; /* Memberi ruang agar tidak terpotong */
    width: 90px;
    position: relative;
}

.pixel-heart {
    position: absolute;
    left: 10px; /* (90px wrapper width - 70px heart width) / 2 */
    top: 10px;  /* (80px wrapper height - 60px heart height) / 2 */
    width: 10px;
    height: 10px;
    background-color: transparent; /* Biarkan transparan agar pixel pertama digambar lewat box-shadow */
    transform-origin: 35px 30px; /* Titik tengah dari bounding box hati 70px x 60px */
    animation: heartbeat 0.8s infinite alternate;
    /* Membuat bentuk hati pixel art menggunakan box-shadow */
    box-shadow:
        /* Baris 1: dua puncak hati */
        10px 0 #ff4d6d, 20px 0 #ff4d6d, 40px 0 #ff4d6d, 50px 0 #ff4d6d,
        /* Baris 2 */
        0px 10px #ff4d6d, 10px 10px #ff4d6d, 20px 10px #ff4d6d, 30px 10px #ff4d6d, 40px 10px #ff4d6d, 50px 10px #ff4d6d, 60px 10px #ff4d6d,
        /* Baris 3 */
        0px 20px #ff4d6d, 10px 20px #ff4d6d, 20px 20px #ff4d6d, 30px 20px #ff4d6d, 40px 20px #ff4d6d, 50px 20px #ff4d6d, 60px 20px #ff4d6d,
        /* Baris 4 */
        10px 30px #ff4d6d, 20px 30px #ff4d6d, 30px 30px #ff4d6d, 40px 30px #ff4d6d, 50px 30px #ff4d6d,
        /* Baris 5 */
        20px 40px #ff4d6d, 30px 40px #ff4d6d, 40px 40px #ff4d6d,
        /* Baris 6: ujung bawah hati */
        30px 50px #ff4d6d;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z' fill='%23ff758f' stroke='%23800020' stroke-width='2'/%3E%3C/svg%3E") 12 12, pointer !important;
}

/* Speech Bubble Retro */
.speech-bubble {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 200px;
    background: #ffffff;
    border: 3px solid #800020;
    padding: 8px;
    font-size: 8px;
    color: #800020;
    text-align: center;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.15);
    z-index: 20;
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.speech-bubble.show {
    transform: translateX(-50%) scale(1);
}

.speech-bubble::after {
    content: "";
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: #ffffff transparent;
    display: block;
    width: 0;
    z-index: 22;
}

.speech-bubble::before {
    content: "";
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #800020 transparent;
    display: block;
    width: 0;
    z-index: 21;
}

/* Animasi Detak Jantung */
@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.15);
    }
}
}

/* Animasi Detak Jantung */
@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.15);
    }
}

/* Teks Pertanyaan */
#question-text {
    font-size: 14px;
    line-height: 1.8;
    color: #800020; /* Merah hati */
    text-shadow: 1px 1px 0px #fff;
    word-wrap: break-word;
}

/* Group Tombol */
.button-group {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
    position: relative;
    min-height: 50px;
}

/* Tombol Retro */
.retro-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    padding: 12px 24px;
    border: 4px solid #800020;
    background-color: #ff85a2; /* Coral/Pink */
    color: #ffffff;
    cursor: pointer;
    outline: none;
    text-shadow: 2px 2px 0px #800020;
    box-shadow: 
        inset 2px 2px 0px #fff, 
        inset -2px -2px 0px #b07d8a,
        4px 4px 0px rgba(0, 0, 0, 0.15);
}

.retro-btn:active {
    box-shadow: 
        inset -2px -2px 0px #fff, 
        inset 2px 2px 0px #b07d8a;
    transform: translate(2px, 2px);
}

/* Tombol YES Spesifik */
.btn-yes {
    background-color: #ff4d6d; /* Pink kemerahan */
}

.btn-yes:hover {
    background-color: #ff758f;
}

/* Tombol NO Spesifik */
.btn-no {
    background-color: #a0a0a0; /* Abu-abu retro */
    color: #ffffff;
    text-shadow: 2px 2px 0px #505050;
    border-color: #505050;
    box-shadow: 
        inset 2px 2px 0px #fff, 
        inset -2px -2px 0px #707070,
        4px 4px 0px rgba(0, 0, 0, 0.15);
    transition: left 0.15s ease-out, top 0.15s ease-out; /* Transisi mulus saat menghindar */
}

/* Hati Jatuh (Rain Hearts) */
.falling-heart {
    position: absolute;
    font-size: 24px;
    color: #ff4d6d;
    user-select: none;
    pointer-events: none;
    animation: fall linear forwards;
    z-index: 11;
}

@keyframes fall {
    0% {
        transform: translateY(-50px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(105vh) rotate(360deg);
        opacity: 0;
    }
}

/* Dialog Box Retro Kustom */
.retro-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background-color: #f3c6d1;
    border: 4px solid #800020;
    box-shadow: 
        inset 2px 2px 0px #fff, 
        inset -2px -2px 0px #b07d8a,
        6px 6px 0px rgba(0, 0, 0, 0.3);
    z-index: 100;
    display: flex;
    flex-direction: column;
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Efek Getar Jendela */
.shake {
    animation: shake 0.2s ease-in-out 2;
}

@keyframes shake {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-8px, 0); }
    50% { transform: translate(8px, 0); }
    75% { transform: translate(-8px, 0); }
    100% { transform: translate(0, 0); }
}

/* Elemen Latar Belakang Melayang (Sakura/Hati) */
.floating-bg-item {
    position: absolute;
    font-size: 14px;
    color: rgba(255, 77, 109, 0.4); /* Transparan agar estetik */
    user-select: none;
    pointer-events: none;
    animation: floatUp linear infinite;
    z-index: 1;
}

@keyframes floatUp {
    0% {
        transform: translateY(105vh) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-10vh) translateX(50px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0.7); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.retro-dialog-header {
    background: #ff4d6d;
    padding: 4px 8px;
    color: white;
    font-size: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #800020;
}

.retro-dialog-body {
    padding: 20px 15px;
    text-align: center;
    font-size: 10px;
    color: #800020;
    line-height: 1.6;
}

.retro-dialog-footer {
    padding: 10px;
    display: flex;
    justify-content: center;
    border-top: 2px dashed #ff85a2;
}

/* Tombol BGM di Pojok Kanan Bawah */
.bgm-control {
    position: fixed;
    bottom: 55px; /* Dinaikkan agar tidak tertutup taskbar */
    right: 15px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bgm-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 8px 12px;
    background-color: #ff85a2;
    border: 3px solid #800020;
    color: white;
    box-shadow: inset 2px 2px 0px #fff, inset -2px -2px 0px #b07d8a;
    cursor: pointer;
}

.bgm-btn:active {
    box-shadow: inset -2px -2px 0px #fff, inset 2px 2px 0px #b07d8a;
    transform: translate(1px, 1px);
}

/* Theme Styles */
body.theme-blue {
    background-color: #d0e1fd;
    background-image: 
        radial-gradient(#a2c4fd 20%, transparent 20%),
        radial-gradient(#a2c4fd 20%, transparent 20%);
}
body.theme-blue .retro-window {
    background-color: #e2ecfc;
    border-color: #1d3557;
}
body.theme-blue .title-bar {
    background: linear-gradient(90deg, #457b9d, #a8dadc);
    border-bottom-color: #1d3557;
}
body.theme-blue .retro-btn {
    background-color: #a8dadc;
    color: #1d3557;
    border-color: #1d3557;
    text-shadow: none;
}

body.theme-green {
    background-color: #d8f3dc;
    background-image: 
        radial-gradient(#b7e4c7 20%, transparent 20%),
        radial-gradient(#b7e4c7 20%, transparent 20%);
}
body.theme-green .retro-window {
    background-color: #e8f5e9;
    border-color: #1b4332;
}
body.theme-green .title-bar {
    background: linear-gradient(90deg, #2d6a4f, #52b788);
    border-bottom-color: #1b4332;
}
body.theme-green .retro-btn {
    background-color: #74c69d;
    color: #1b4332;
    border-color: #1b4332;
    text-shadow: none;
}

/* Minesweeper Cell Styles */
.mines-cell {
    width: 36px;
    height: 36px;
    background-color: #ffd1dc;
    border: 3px solid;
    border-color: #fff #800020 #800020 #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}
.mines-cell.revealed {
    background-color: #fff;
    border: 1px solid #800020;
}
.mines-cell.flagged::after {
    content: "🚩";
}

/* Responsivitas Layar Kecil */
@media (max-width: 480px) {
    #question-text {
        font-size: 11px;
    }
    .retro-btn {
        font-size: 10px;
        padding: 10px 18px;
    }
    .title-bar-text {
        font-size: 10px;
    }
}
