/* Flowers Reflection Game Specific Styles */

/* Import Google Font for premium headers */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Outfit:wght@500;800;900&display=swap');

.game-container {
    background: linear-gradient(180deg, #A1C4FD 0%, #C2E9FB 50%, #E8F5E9 85%, #C8E6C9 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    font-family: 'Fredoka', 'Comic Sans MS', sans-serif;
    min-height: 100vh;
}

/* Background Clouds and Butterflies */
.bg-clouds {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 300px;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 100px;
    filter: blur(2px);
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
}

.cloud-1 {
    width: 170px;
    height: 60px;
    top: 50px;
    left: -200px;
    animation: floatCloud 35s linear infinite;
}

.cloud-1::before {
    width: 80px;
    height: 80px;
    top: -40px;
    left: 30px;
}

.cloud-1::after {
    width: 60px;
    height: 60px;
    top: -30px;
    left: 90px;
}

.cloud-2 {
    width: 250px;
    height: 80px;
    top: 120px;
    left: -300px;
    animation: floatCloud 50s linear infinite 5s;
    opacity: 0.65;
}

.cloud-2::before {
    width: 120px;
    height: 120px;
    top: -60px;
    left: 40px;
}

.cloud-2::after {
    width: 90px;
    height: 90px;
    top: -45px;
    left: 120px;
}

.cloud-3 {
    width: 120px;
    height: 45px;
    top: 30px;
    right: 50px;
    animation: floatCloud 25s linear infinite reverse;
    opacity: 0.8;
}

.cloud-3::before {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 20px;
}

.cloud-3::after {
    width: 40px;
    height: 40px;
    top: -20px;
    left: 55px;
}

@keyframes floatCloud {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(100vw + 400px));
    }
}

/* Background Butterflies */
.bg-butterflies {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.butterfly {
    position: absolute;
    font-size: 24px;
    opacity: 0.8;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.butterfly-1 {
    top: 25%;
    left: 10%;
    animation: flyButterfly1 12s ease-in-out infinite;
}

.butterfly-2 {
    top: 45%;
    right: 15%;
    animation: flyButterfly2 18s ease-in-out infinite;
}

@keyframes flyButterfly1 {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    25% {
        transform: translate(40px, -50px) rotate(15deg) scale(1.1);
    }

    50% {
        transform: translate(80px, 10px) rotate(-10deg) scale(0.9);
    }

    75% {
        transform: translate(30px, 40px) rotate(20deg) scale(1);
    }
}

@keyframes flyButterfly2 {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg) scale(0.9);
    }

    30% {
        transform: translate(-60px, -30px) rotate(-20deg) scale(1);
    }

    60% {
        transform: translate(-30px, 40px) rotate(15deg) scale(0.85);
    }
}

/* Custom Header elements */
.progress-display {
    background: #FFFFFF;
    border: 4px solid #4A4A8C;
    border-radius: 20px;
    height: 64px;
    padding: 0 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 24px;
    font-weight: bold;
    color: #4A4A8C;
    box-shadow: 0 6px 12px rgba(74, 74, 140, 0.15);
    z-index: 10;
    transition: all 0.3s ease;
}

.progress-value {
    color: #FF6B6B;
    font-size: 28px;
    font-weight: 900;
}

.header-logo {
    height: 35px;
    max-width: 200px;
    width: auto;
    object-fit: contain;
    margin-left: 15px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.05);
}

/* Main Area Layout */
.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    padding: 20px 20px 40px 20px;
    z-index: 5;
    min-height: calc(100vh - 200px);
}


.title-container {
    text-align: center;
    margin-bottom: 15px;
    margin-top: -31px;
    z-index: 10;
}

.game-title {
    font-family: 'Outfit', sans-serif;
    font-size: 52px;
    font-weight: 900;
    color: #3F51B5;
    text-shadow:
        3px 3px 0px #FFFFFF,
        -1px -1px 0px #FFFFFF,
        1px -1px 0px #FFFFFF,
        -1px 1px 0px #FFFFFF,
        0px 8px 15px rgba(63, 81, 181, 0.25);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    animation: titleEntrance 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-subtitle {
    font-size: 22px;
    color: #4A4A8C;
    font-weight: 600;
    text-shadow: 1px 1px 0 #FFF, -1px -1px 0 #FFF;
    opacity: 0.9;
}

@keyframes titleEntrance {
    0% {
        transform: translateY(-50px) scale(0.8);
        opacity: 0;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Flowers Grid Section */
.flowers-grid-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 40px;
    display: block;
    flex: 1;
    z-index: 10;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    scrollbar-width: thin;
    scrollbar-color: #4A4A8C rgba(255, 255, 255, 0.3);
}

/* Custom Scrollbar for Flowers Grid */
.flowers-grid-container::-webkit-scrollbar {
    width: 10px;
}

.flowers-grid-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.flowers-grid-container::-webkit-scrollbar-thumb {
    background: #4A4A8C;
    border-radius: 10px;
    border: 2px solid #FFF9C4;
}

.flowers-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 30px;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 10px 0;
}

/* Individual Flower Item */
.flower-item {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.1));
}

.flower-img-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.5s ease;
}

.flower-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* Floating animation helper - staggered via JS */
.flower-item.float-anim {
    animation: floatFlower 4s ease-in-out infinite;
}

.flower-number {
    position: absolute;
    top: 39%; /* Lift up to align perfectly with the flower's center (stem is at the bottom) */
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 900;
    color: #1A237E;
    text-shadow:
        2px 2px 0px #FFFFFF,
        -1px -1px 0px #FFFFFF,
        1px -1px 0px #FFFFFF,
        -1px 1px 0px #FFFFFF;
    pointer-events: none;
    z-index: 5;
    transition: all 0.3s ease;
}

/* Hover & Interactive States */
.flower-item:hover {
    transform: translateY(-8px) scale(1.12);
    filter: drop-shadow(0 15px 25px rgba(255, 107, 107, 0.25));
}

.flower-item:hover .flower-img-wrapper {
    transform: rotate(15deg);
}

.flower-item:active {
    transform: scale(0.92);
}

/* Disabled/Visited State */
.flower-item.disabled {
    filter: grayscale(1) opacity(0.35) !important;
    cursor: not-allowed;
    pointer-events: none;
    transform: scale(0.9) !important;
    animation: none !important;
}

.flower-item.disabled .flower-number {
    display: none;
}

/* Stave decorative green checkmark when disabled */
.flower-item.disabled::after {
    content: '✓';
    position: absolute;
    top: 39%; /* Align with the flower's center core */
    left: 50%;
    transform: translate(-50%, -50%) scale(1.1);
    font-size: 38px;
    font-weight: 900;
    color: #2E7D32;
    background: #E8F5E9;
    border: 4px solid #2E7D32;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    animation: popCheckmark 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popCheckmark {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-45deg);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.1) rotate(0);
        opacity: 1;
    }
}

@keyframes floatFlower {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Characters Block */
.character-left {
    position: fixed;
    left: 20px;
    bottom: 30px;
    width: 260px;
    z-index: 4;
    pointer-events: none;
    transition: all 0.3s ease;
    animation: floatCharacter 6s ease-in-out infinite;
}

.character-left img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.2));
}

@keyframes floatCharacter {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-12px) rotate(1.5deg);
    }
}



/* --- QUESTION MODAL (POPUP) --- */
/* Custom styled modal overlay with warm summer meadow style */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(161, 196, 253, 0.75); /* Beautiful light-blue sky blur */
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9000;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.question-card {
    background: radial-gradient(circle, #FFFFFF 0%, #FFF9C4 100%);
    border: 8px solid #FF6B6B; /* Thick beautiful floral pink border */
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.25),
        inset 0 0 20px rgba(255, 255, 255, 0.8);
    border-radius: 40px;
    width: 90%;
    max-width: 680px;
    padding: 50px 40px;
    text-align: center;
    position: relative;
    transform: scale(0.85) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.modal-overlay.show .question-card {
    transform: scale(1) translateY(0);
}

/* Circular top badge for question number - styled like a mini flower/sun */
.question-number-badge {
    background: #FFD93D;
    border: 5px solid #FF6B6B;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 8px 16px rgba(255, 107, 107, 0.3);
}

.question-number-badge span {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 900;
    color: #4A4A8C;
    text-shadow: 1.5px 1.5px 0px #FFFFFF;
}

/* Question Content area styling */
.question-content {
    width: 100%;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
}

#modalQuestionText {
    font-family: 'Fredoka', 'Comic Sans MS', sans-serif;
    font-size: 32px;
    line-height: 1.45;
    color: #4A4A8C; /* Highly readable dark purple-indigo matching the theme */
    font-weight: 700;
    text-shadow: 2px 2px 0px #FFFFFF; /* High contrast drop-shadow */
}

/* Large Gold "Continue" Button - Styled in sun yellow gradient */
.continue-btn {
    background: linear-gradient(135deg, #FFD93D 0%, #FFA500 100%);
    border: 4px solid #FF8C00;
    border-radius: 24px;
    color: #4A4A8C;
    font-family: 'Fredoka', sans-serif;
    font-size: 24px;
    font-weight: 700;
    padding: 14px 55px;
    cursor: pointer;
    box-shadow: 0 6px 0 #FF8C00, 0 10px 20px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    text-shadow: 1px 1px 0px #FFFFFF;
    outline: none;
}

.continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #FF8C00, 0 12px 24px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #FFE066 0%, #FFB31A 100%);
}

.continue-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #FF8C00, 0 4px 10px rgba(0,0,0,0.1);
}

/* --- VICTORY SCREEN --- */
.victory-content {
    background: radial-gradient(circle, #FFFFFF 0%, #E8F5E9 100%) !important;
    border: 8px solid #4CAF50 !important;
    border-radius: 40px !important;
    padding: 40px !important;
    max-width: 650px !important;
}

.victory-characters {
    width: 250px;
    margin: 0 auto 20px auto;
}

.victory-img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(76, 175, 80, 0.2));
    animation: victoryFloat 3s ease-in-out infinite;
}

@keyframes victoryFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-8px) scale(1.03);
    }
}

.results-message {
    font-size: 22px !important;
    line-height: 1.5;
    color: #388E3C !important;
    font-weight: 600;
    margin-bottom: 25px;
}

/* --- SETTINGS SCROLLBAR OVERRIDES --- */
.settings-content {
    border-radius: 40px;
    border: 8px solid #4A4A8C;
}

/* Responsive Overrides and Layout adjust */
@media (max-width: 1400px) {
    .character-left {
        width: 210px;
    }
}

@media (max-width: 1200px) {
    .flowers-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 25px;
    }

    .character-left {
        width: 180px;
        left: 10px;
    }
}

@media (max-width: 992px) {
    .game-title {
        font-size: 42px;
    }

    .flowers-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .flowers-grid-container {
        padding: 0 20px;
    }

    .character-left {
        display: none;
        /* Hide mascot on tablet/mobile grids to save space */
    }
}

@media (max-width: 768px) {
    .header-logo {
        height: 28px;
        max-width: 140px;
        margin-left: 8px;
    }

    .game-title {
        font-size: 32px;
        text-shadow: 2px 2px 0px #FFFFFF;
    }

    .game-subtitle {
        font-size: 18px;
    }

    .progress-display {
        font-size: 18px;
        height: 48px;
        padding: 0 15px;
    }

    .progress-value {
        font-size: 22px;
    }

    .flowers-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .flower-number {
        font-size: 24px;
        text-shadow: 1.5px 1.5px 0px #FFFFFF;
    }

    .flower-item.disabled::after {
        font-size: 26px;
        width: 38px;
        height: 38px;
        border-width: 3px;
    }

    .question-card {
        padding: 40px 25px;
    }

    #modalQuestionText {
        font-size: 24px;
    }

    .continue-btn {
        font-size: 20px;
        padding: 12px 35px;
    }
}

@media (max-width: 480px) {
    .header-logo {
        height: 22px;
        max-width: 100px;
        margin-left: 4px;
    }

    .flowers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .progress-label {
        display: none;
        /* Hide text on ultra small screens */
    }

    .progress-display {
        border-radius: 12px;
    }
}