/* --- Theme --- */
body {
    background-color: #f8bbd0; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    transition: opacity 0.3s ease-in-out;
    opacity: 1; 
}

body.fade-out {
    opacity: 0; 
}

.container {
    background-color: #fff3fa; 
    padding: 40px;
    border-radius: 15px; 
    box-shadow: 0 10px 25px rgba(93, 64, 55, 0.2); 
    text-align: center;
    border: 2px solid #5d4037; 
    max-width: 90%;
}

h1 {
    color: #5d4037; 
    margin-bottom: 20px;
}

p {
    color: #5d4037; 
    font-size: 1.2rem;
    margin-bottom: 20px;
}

/* --- Buttons --- */
.buttons {
    margin-top: 30px;
}

button {
    background-color: #5d4037; 
    color: white; 
    padding: 12px 25px;
    font-size: 1rem;
    border: none;
    border-radius: 25px; 
    margin: 0 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

#yesButton:hover {
    background-color: #ec407a; 
    transform: scale(1.05); 
}

/* --- Game --- */
.game-container {
    max-width: 500px;
    width: 90%;
}

.photo-frame {
    margin: 20px auto;
    border: 4px solid #5d4037; 
    padding: 5px;
    border-radius: 10px;
    background-color: white;
}

#game-image {
    width: 100%;
    height: auto;
    border-radius: 5px;
    display: block;
    max-height: 300px; 
    object-fit: cover;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 10px;
    margin-top: 15px;
}

.option-btn {
    background-color: #f8bbd0; 
    color: #5d4037; 
    border: 2px solid #5d4037; 
    padding: 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: 0.2s;
}

.option-btn:hover {
    background-color: #ec407a; 
    color: white;
    transform: scale(1.02);
}

.correct {
    background-color: #4caf50 !important; 
    color: white !important;
    border-color: #2e7d32 !important;
}

.wrong {
    background-color: #f44336 !important; 
    color: white !important;
    border-color: #c62828 !important;
}

.feedback-msg {
    font-weight: bold;
    margin-top: 5px;
    min-height: 20px;
    margin-bottom: 5px;
}

.next-btn {
    margin-top: 15px;
    background-color: #5d4037;
    color: white;
    width: 100%;
}

/* --- Gallery --- */
.main-gallery-container {
    max-width: 1000px; 
    width: 95%;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 20px;
    margin-top: 20px;
    justify-content: center; 
}

.gallery-item {
    width: 100%;
    height: 300px; 
    object-fit: cover;
    border-radius: 10px;
    border: 3px solid #5d4037;
    cursor: pointer;
    transition: transform 0.3s ease;
    background-color: white;
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(93, 64, 55, 0.3);
}

.gallery-item.solved {
    border-color: #4caf50; 
    opacity: 0.6;
}

/* --- Questions --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 100; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(93, 64, 55, 0.8); 
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden; 
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #fff;
    padding: 25px;
    border-radius: 15px;
    width: 95%;
    max-width: 700px;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 4px solid #f8bbd0;
    transform: scale(0.95);
    transition: transform 0.3s ease-out;

    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-image-box {
    width: 100%;
    height: 400px;
    
    background-color: transparent; 
    border: none; 
    display: flex;
    justify-content: center;
    align-items: center;

    margin-bottom: 10px;
    margin-top: 35px; /* Space for X button */
    
    overflow: hidden; 
}

#modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; 
    display: block;
    border-radius: 10px; 
}

/* Close Button (X) */
.close-btn {
    position: absolute;
    top: 15px; 
    right: 20px;
    
    font-size: 32px; 
    font-weight: bold;
    color: #5d4037;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
    
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.8);
}

.close-btn:hover {
    color: #ec407a;
    background-color: #fff;
}

.secondary-btn {
    margin-top: 5px; /* Reduced gap substantially */
    background-color: transparent;
    border: 2px solid #5d4037;
    color: #5d4037;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
}

.secondary-btn:hover {
    background-color: #f8bbd0;
}

/* --- Phone Styling --- */
@media (max-width: 600px) {
    .container {
        padding: 20px; 
    }

    h1 {
        font-size: 1.5rem; 
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }

    .gallery-item {
        height: 150px; 
    }

    .modal-content {
        padding: 15px;
        width: 90%;
    }

    .modal-image-box {
        height: 250px;
        margin-top: 30px;
    }

    .close-btn {
        top: 10px;
        right: 10px;
        font-size: 24px;
        width: 30px;
        height: 30px;
    }
    
    .options-grid {
        gap: 8px;
    }
}