/* TỐI ƯU MOBILE VÀ CƠ BẢN */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Quicksand', sans-serif;
    background-image: url('hinhnen.jpg');
    background-position: 25% bottom;
    background-size: cover;
    background-repeat: no-repeat;
    color: #333;
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* Chống cuộn ngang, dọc khi không cần thiết */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* HIỆU ỨNG SƯƠNG MÙ ĐÀ LẠT */
.fog-container {
    position: absolute;
    width: 100vw;
    height: 100vh;
    background: url('https://www.transparenttextures.com/patterns/stardust.png');
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
    animation: drift 60s linear infinite;
}

@keyframes drift {
    from { background-position: 0 0; }
    to { background-position: -1000px 1000px; }
}

/* VÙNG CHỨA NỘI DUNG CHÍNH */
.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 500px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
}

/* QUẢN LÝ CÁC MÀN HÌNH */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* FONT CHỮ PIXEL & RETRO */
.pixel-text {
    font-family: 'VT323', monospace;
    letter-spacing: 1px;
}

.retro-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    color: #d13054;
    text-shadow: 2px 2px 0px #fff;
    margin: 20px 0 10px;
    line-height: 1.5;
}

.retro-subtitle {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 20px;
}

.title-text {
    font-size: 1.8rem;
    color: #2F4F4F; /* Màu xanh lá thông */
    text-shadow: 2px 2px 4px rgba(255,255,255,0.7);
    margin: 20px 0 30px;
    line-height: 1.4;
}

/* HÌNH ẢNH GIF */
.pixel-img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    background-color: rgba(255, 255, 255, 0.7);
    border: 4px solid #fff;
    border-radius: 12px;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}
.pixel-img.small {
    width: 100px;
    height: 100px;
}

/* NÚT BẤM CHUNG */
.pixel-btn {
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    padding: 10px 20px;
    margin: 10px;
    border: 3px solid #333;
    border-radius: 8px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    box-shadow: 4px 4px 0px #333;
    transition: transform 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.pixel-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px #333;
}

/* NÚT YES / NO (MÀN 1) */
.buttons-container {
    position: relative;
    width: 100%;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.btn-yes {
    background-color: #a8e6cf; /* Xanh lá nhạt */
    color: #1a563f;
    font-weight: bold;
    z-index: 2;
    transition: all 0.3s ease;
}

.btn-no {
    background-color: #ffb7b2; /* Hồng nhạt */
    color: #8c2721;
    z-index: 1;
    transition: transform 0.3s ease;
}

/* FORM VÀ LƯỚI HOẠT ĐỘNG */
.input-wrapper {
    background: #fff;
    border: 4px solid #d13054;
    border-radius: 8px;
    padding: 10px 15px;
    box-shadow: 4px 4px 0px rgba(209,48,84,0.3);
    margin-bottom: 25px;
    min-width: 220px; /* Bắt buộc có độ rộng tối thiểu */
    display: inline-block;
}

.pixel-input {
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    border: none;
    outline: none;
    color: #333;
    background: transparent;
    width: 100%; /* Chiếm hết độ rộng của wrapper */
    min-height: 40px; /* Đảm bảo có chiều cao */
    text-align: center;
}

.activities-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    width: 100%;
}

.activity-btn {
    font-size: 1.2rem;
    padding: 8px 15px;
    margin: 0;
    border-color: #d13054;
    color: #d13054;
    box-shadow: 3px 3px 0px #d13054;
    background: #fff;
}

.activity-btn.selected {
    background-color: #d13054;
    color: #fff;
}

.btn-submit {
    background-color: #a8e6cf;
    width: 80%;
    margin-top: 10px;
}

/* MÀN HÌNH CHỐT KÈO */
.summary-box {
    background: rgba(255, 255, 255, 0.9);
    border: 4px solid #d13054;
    border-radius: 8px;
    padding: 15px;
    width: 90%;
    margin-bottom: 20px;
    box-shadow: 4px 4px 0px rgba(209,48,84,0.3);
    text-align: left;
}

.summary-box p {
    font-size: 1.4rem;
    margin: 5px 0;
}

.btn-love-note {
    background-color: #ffd3b6;
    color: #d13054;
    border-color: #d13054;
    box-shadow: 4px 4px 0px #d13054;
}

/* CỬA SỔ POP-UP WINDOWS RETRO */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.window-box {
    background-color: #f0f0f0;
    border: 3px solid #333;
    border-radius: 4px;
    width: 100%;
    max-width: 400px;
    box-shadow: 6px 6px 0px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
}

.window-header {
    background-color: #d13054;
    color: #fff;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #333;
}

.window-title {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
}

.window-close {
    background: #ccc;
    border: 2px solid #333;
    box-shadow: 2px 2px 0px #333;
    cursor: pointer;
    font-weight: bold;
    font-family: monospace;
    padding: 0 4px;
}
.window-close:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #333;
}

.window-content {
    padding: 20px;
    background: #fff;
}

.love-text {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
    text-align: left;
}


/* HIỆU ỨNG MÂY TRÔI VÀ CHIM BAY */
.clouds {
    position: absolute;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.cloud {
    position: absolute;
    background: #fff;
    border-radius: 50px;
    opacity: 0.7;
    animation: moveClouds linear infinite;
}
.cloud::before, .cloud::after {
    content: '';
    position: absolute;
    background: #fff;
    border-radius: 50%;
}
.cloud-1 {
    width: 100px; height: 30px;
    top: 15%; left: -150px;
    animation-duration: 40s;
}
.cloud-1::before { width: 50px; height: 50px; top: -25px; left: 10px; }
.cloud-1::after { width: 40px; height: 40px; top: -15px; right: 15px; }

.cloud-2 {
    width: 80px; height: 25px;
    top: 30%; left: -100px;
    animation-duration: 55s;
    animation-delay: 5s;
    opacity: 0.5;
}
.cloud-2::before { width: 40px; height: 40px; top: -20px; left: 10px; }
.cloud-2::after { width: 30px; height: 30px; top: -10px; right: 10px; }

.cloud-3 {
    width: 120px; height: 35px;
    top: 5%; left: -200px;
    animation-duration: 65s;
    animation-delay: 15s;
    opacity: 0.6;
}
.cloud-3::before { width: 60px; height: 60px; top: -30px; left: 15px; }
.cloud-3::after { width: 50px; height: 50px; top: -20px; right: 15px; }

@keyframes moveClouds {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 200px)); }
}

.birds {
    position: absolute;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.bird {
    position: absolute;
    width: 20px; height: 10px;
    border-bottom: 2px solid #333;
    border-radius: 50%;
    animation: flyBird linear infinite;
}
.bird::after {
    content: '';
    position: absolute;
    right: -18px; top: 0;
    width: 20px; height: 10px;
    border-bottom: 2px solid #333;
    border-radius: 50%;
}
.bird-1 {
    top: 20%; left: -50px;
    animation-duration: 25s;
    animation-delay: 2s;
    transform: scale(0.6) rotate(15deg);
}
.bird-2 {
    top: 25%; left: -50px;
    animation-duration: 35s;
    animation-delay: 12s;
    transform: scale(0.4) rotate(10deg);
}

@keyframes flyBird {
    0% { transform: translateX(0) scale(0.6) rotate(15deg); }
    100% { transform: translateX(calc(100vw + 100px)) translateY(-100px) scale(0.6) rotate(15deg); }
}

.text-bg-box {
    background-color: rgba(255, 255, 255, 0.75);
    padding: 10px 20px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.5);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}
.text-bg-box .title-text, .text-bg-box .retro-subtitle {
    margin: 0;
}

/* PHỤ ĐỀ ÂM NHẠC */
.subtitles-container {
    position: fixed;
    bottom: 30px; /* Đặt dưới cùng nhưng cách một khoảng an toàn */
    left: 0;
    width: 100vw;
    text-align: center;
    pointer-events: none;
    z-index: 1000;
}
#subtitle-text {
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.4rem;
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 90%;
}
#subtitle-text.show {
    opacity: 1;
}

/* CREDIT NGƯỜI HÁT */
.singer-credit {
    position: fixed;
    top: 15px;
    right: 20px;
    z-index: 1000;
    font-size: 1.2rem;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 8px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* TỐI ƯU CHO GIAO DIỆN ĐIỆN THOẠI */
@media (max-width: 768px) {
    /* Thu nhỏ chữ trung tâm */
    .title-text {
        font-size: 1.2rem;
        margin: 10px 0 15px;
    }
    
    /* Đẩy chữ Giọng hát xuống một chút để không bị che bởi tai thỏ iPhone */
    .singer-credit {
        top: 20px;
        right: 15px;
        font-size: 0.9rem;
        padding: 4px 8px;
    }

    /* Kéo phụ đề xuống thấp hơn và thu nhỏ */
    .subtitles-container {
        bottom: 10px;
    }
    #subtitle-text {
        font-size: 1.1rem;
        padding: 8px 12px;
    }

    /* Đẩy toàn bộ nội dung lên trên để nút nằm trên đầu nhân vật */
    .app-container {
        justify-content: flex-start;
        padding-top: 50px; /* Khoảng cách từ đỉnh màn hình xuống */
    }

    .buttons-container {
        position: relative;
        bottom: auto;
        height: auto;
        min-height: 80px;
        align-items: center;
        flex-wrap: wrap; /* Cho phép rớt dòng nếu nút Yes quá to */
        justify-content: center;
    }
    
    .pixel-btn {
        font-size: 1.1rem;
        padding: 10px 15px;
    }
    
    /* Thu nhỏ GIF một chút */
    .pixel-img {
        width: 120px;
        height: 120px;
    }
    
    .pixel-img.small {
        width: 80px;
        height: 80px;
    }

    /* Thu gọn lưới chọn hoạt động để không bị trồi xuống phụ đề */
    .activities-grid {
        gap: 5px;
        margin-bottom: 10px;
    }
    
    .activity-btn {
        font-size: 1rem;
        padding: 5px 10px;
    }
}
