/* Base Styles */
:root {
    --primary: #4DA8DA;
    --primary-light: #82C2E6;
    --secondary: #FFB703;
    --accent: #FB8500;
    --success: #2A9D8F;
    --text-main: #264653;
    --bg-main: #E9F5F9;
    --white: #FFFFFF;

    /* Room Colors */
    --room-bath: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    --room-kitchen: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    --room-laundry: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    --room-garden: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-bottom: 2rem;
}

h1,
h2,
h3,
.modal-emoji {
    font-family: 'Fredoka One', cursive;
}

/* Background Animations */
.bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bubble {
    position: absolute;
    bottom: -100px;
    background-color: rgba(77, 168, 218, 0.2);
    border-radius: 50%;
    animation: rise 10s infinite ease-in;
}

.bubble:nth-child(1) {
    width: 40px;
    height: 40px;
    left: 10%;
    animation-duration: 8s;
}

.bubble:nth-child(2) {
    width: 20px;
    height: 20px;
    left: 20%;
    animation-duration: 5s;
    animation-delay: 1s;
}

.bubble:nth-child(3) {
    width: 50px;
    height: 50px;
    left: 35%;
    animation-duration: 7s;
    animation-delay: 2s;
}

.bubble:nth-child(4) {
    width: 80px;
    height: 80px;
    left: 50%;
    animation-duration: 11s;
    animation-delay: 0s;
}

.bubble:nth-child(5) {
    width: 35px;
    height: 35px;
    left: 70%;
    animation-duration: 6s;
    animation-delay: 3s;
}

.bubble:nth-child(6) {
    width: 60px;
    height: 60px;
    left: 85%;
    animation-duration: 12s;
    animation-delay: 1s;
}

@keyframes rise {
    0% {
        transform: translateY(0) translateX(0);
    }

    50% {
        transform: translateY(-590px) translateX(30px);
    }

    100% {
        transform: translateY(-1180px) translateX(-30px);
    }
}

/* Header */
.app-header {
    text-align: center;
    padding: 2rem 1rem;
    width: 100%;
    max-width: 800px;
}

h1 {
    font-size: 2.8rem;
    color: var(--primary);
    text-shadow: 2px 2px 0px var(--white), 4px 4px 0px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.app-header p {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

/* Score Board */
.score-board {
    background: var(--white);
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    gap: 15px;
    border: 4px solid var(--secondary);
}

.star-icon {
    font-size: 2rem;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

#score-text {
    font-size: 1.8rem;
    font-family: 'Fredoka One', cursive;
    color: var(--accent);
}

.progress-container {
    width: 150px;
    height: 15px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--secondary), var(--accent));
    transition: width 0.5s ease-out;
    border-radius: 10px;
}

/* House Layout */
.house-container {
    width: 95%;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.15));
}

.roof {
    display: none;
}

.house-grid {
    position: relative;
    width: 100%;
    padding: 0;
    border: none;
}

.house-bg-img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
}



/* Interactive Elements */
.interactive-element {
    position: absolute;
    pointer-events: auto;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
    border: 2px solid var(--white);
}

.interactive-element.found {
    opacity: 0.5;
    transform: scale(0.9) translateZ(0);
    filter: grayscale(80%);
    border-color: #ccc;
    pointer-events: none;
}

.interactive-element:not(.found):hover {
    transform: scale(1.2) translateZ(0);
    box-shadow: 0 0 25px rgba(255, 255, 255, 1);
    border-color: var(--accent);
}

.emoji {
    display: none;
}

.glow {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: pulse 2s infinite;
    opacity: 0;
}

.interactive-element:not(.found) .glow {
    opacity: 1;
}

@keyframes pulse {
    0% {
        transform: scale(1) translateZ(0);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.5) translateZ(0);
        opacity: 0;
    }
}

/* Positioning Elements on the Image (values are overall percentages) */
/* Bathroom */
.shower {
    top: 45%;
    left: 38%;
}

.sink {
    top: 45%;
    left: 50%;
}

.toilet {
    top: 60%;
    left: 50%;
}

/* Kitchen */
.faucet {
    top: 70%;
    left: 23%;
}

.dishwasher {
    top: 75%;
    left: 18%;
}

.glass {
    top: 80%;
    left: 22%;
}

/* Laundry */
.washing-machine {
    top: 75%;
    left: 38%;
}

.cleaning-products {
    top: 85%;
    left: 40%;
}

.leak {
    bottom: 5%;
    right: 10%;
}

/* Garden */
.rain-barrel {
    top: 70%;
    left: 55%;
}

.watering-can {
    top: 85%;
    left: 60%;
}

.car-wash {
    top: 64%;
    left: 72%;
}

.pool {
    top: 50%;
    left: 85%;
}

.computer {
    top: 75%;
    left: 50%;
}

.compost {
    top: 85%;
    left: 2%;
}

.vigieau {
    top: 27%;
    left: 27%;
}

/* Ground */
.ground-base {
    display: none;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(38, 70, 83, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--white);
    width: 90%;
    max-width: 500px;
    border-radius: 30px;
    padding: 2rem;
    position: relative;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    border: 8px solid var(--primary-light);
    text-align: center;
}

.modal-overlay.hidden .modal-content {
    transform: scale(0.5) translateY(100px);
}

.close-btn {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #E76F51;
    color: white;
    border: 4px solid white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.close-btn:hover {
    transform: scale(1.1) rotate(90deg);
    background: #D62828;
}

.modal-header {
    margin-bottom: 1.5rem;
}

.modal-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: 0.5rem;
}

h2#modal-title {
    color: var(--primary);
    font-size: 2rem;
}

.modal-body p {
    font-size: 1.3rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.modal-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.points-awarded {
    font-family: 'Fredoka One';
    font-size: 1.5rem;
    color: var(--accent);
    background: #FFF3E0;
    padding: 5px 20px;
    border-radius: 20px;
    border: 2px dashed var(--accent);
    animation: pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

.action-btn {
    background: linear-gradient(to bottom, var(--success), #21867a);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.5rem;
    font-family: 'Fredoka One', cursive;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(42, 157, 143, 0.4), inset 0 -4px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.action-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 25px rgba(42, 157, 143, 0.5), inset 0 -4px 0 rgba(0, 0, 0, 0.1);
}

.action-btn:active {
    transform: translateY(2px);
    box-shadow: 0 5px 10px rgba(42, 157, 143, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.1);
}

/* Victory Modal Styles */
.victory-content {
    border-color: var(--secondary);
    background: linear-gradient(135deg, white, #FFFAEE);
}

.victory-content h2 {
    color: var(--text-main);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.trophy {
    font-size: 6rem;
    margin: 1rem 0;
    animation: bounce 2s infinite ease-in-out;
}

/* Responsive */
@media (max-width: 768px) {
    .house-grid {
        height: auto;
    }

    h1 {
        font-size: 2rem;
    }

    .score-board {
        padding: 0.8rem 1.5rem;
    }

    .interactive-element {
        width: 15px;
        height: 15px;
    }
}