html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Gill Sans',serif;
    text-align: center;
}

.game-title{
    display: flex;
    justify-content: center;
    align-items: center;
    color: #0f4fc5;
    padding: 10px;
    width: auto;
    margin: 2%;
}

main{
    height: 100%;
    width: auto;
    display: flex;
    flex-direction: column;
    /* gap: 50vh; */

}

.section_two{
    margin: 5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5rem;
}

.game-navigations{
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 7rem;
}

.game-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.game-buttons button {
    border: solid 1px red;
    border-radius: 0.6rem;
    padding: 1.5rem 2rem;
    width: 10rem;
}

.farm-navs {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.farm-navs div {
    padding: 2rem;
}

.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.popup-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 80%;
    max-width: 600px;
    height: auto;
    max-height: 80%;
    /* SVG blue gradient background */
    background: linear-gradient(to bottom, #96cff0, #b4ddf4, #fff);
    border-radius: 20px;
    text-align: left;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    padding: 30px;
    border: 4px solid #dfe655;
}
.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    background-color: #708b39;
    border: 2px solid #dfe655;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1001;
}
.close-btn:hover {
    background-color: #844727;
    transform: none;
}
.popup-content h2 {
    margin-bottom: 20px;
    color: #623213;
    text-align: center;
    font-size: 28px;
    border-bottom: 2px solid #dfe655;
    padding-bottom: 10px;
}
.popup-content p {
    margin-bottom: 12px;
    color: #54290b;
    font-size: 18px;
    line-height: 1.5;
}

.win-popup-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.win-popup {
    width: 80%;
    max-width: 500px;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    /* SVG gradient background similar to the blue sky */
    background: linear-gradient(to bottom, #96cff0, #b4ddf4, #fff);
    border: 4px solid #dfe655;
}

.win-popup h2 {
    color: #623213;
    margin-bottom: 20px;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.win-popup p {
    color: #54290b;
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: bold;
}

.win-popup span {
    font-size: 20px;
    color: #708b39;
    font-weight: bold;
}

.win-popup .popup-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.win-popup button {
    margin: 5px;
    padding: 12px 24px;
    font-size: 18px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    background-color: #708b39;
    color: white;
    border: 2px solid #dfe655;
    min-width: 150px;
}

.win-popup button:hover {
    background-color: #54290b;
    color: #dfe655;
}

@media (max-width: 600px) {
    .win-popup .popup-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .win-popup button {
        width: 100%;
        max-width: 250px;
    }
}

#finalWinPopup {
    background: linear-gradient(to bottom, #dfe655, #b4cd57, #92b558);
    border: 4px solid #96cff0;
}

#finalWinPopup h2 {
    color: #54290b;
    border-bottom: 2px solid #96cff0;
    padding-bottom: 10px;
}

#finalWinPopup button {
    background-color: #54290b;
    border: 2px solid #96cff0;
}

#finalWinPopup button:hover {
    background-color: #96cff0;
    color: #54290b;
}

/* Intro page styles */
.intro-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 3rem;
}

.intro-title h1 {
    font-size: 3.5rem;
    color: #333;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
}

.intro-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 300px;
}

.intro-buttons button {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.primary-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
}

.primary-btn:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

.secondary-btn {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.secondary-btn:hover {
    background-color: #e9e9e9;
    transform: scale(1.05);
}

.back-btn {
    padding: 0.8rem 1.5rem;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    cursor: pointer;
    margin-top: 2rem;
}

/* Instructions popup */
#instructionsPopup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

#gameBoardContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#gameBoardContainer .svg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

#gameBoardContainer .svg-container object {
    pointer-events: none;
}

/* Make sure SVG buttons remain clickable but don't grow/shrink */
#gamePageSvg, #levelSelectionSvg1, #levelSelectionSvg2 {
    pointer-events: auto !important;
}

/* Disable hover effects on navigation buttons */
#gamePageSvg #back-button,
#gamePageSvg #home-button,
#levelSelectionSvg1 #back-button,
#levelSelectionSvg1 #home-button,
#levelSelectionSvg2 #back-button,
#levelSelectionSvg2 #home-button {
    transform: none !important;
    transition: none !important;
}

#gamePageSvg #back-button:hover,
#gamePageSvg #home-button:hover,
#levelSelectionSvg1 #back-button:hover,
#levelSelectionSvg1 #home-button:hover,
#levelSelectionSvg2 #back-button:hover,
#levelSelectionSvg2 #home-button:hover {
    transform: none !important;
}

@media only screen and (min-width: 320px) and (max-width: 1280px) and (orientation: landscape) {
    
    body {
    background-color: #ffffff;
    }
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.svg-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0;
    margin: 0;
    z-index: 1;
}

.svg-container object {
    width: 100%;
    height: 100%;
    object-fit: fill;
    max-height: none;
    max-width: none;
    position: absolute;
    top: 0;
    left: 0;
}

.game-page {
    position: relative;
    width: 100vw;
    height: 100vh;
}

.game-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    width: 80%;
    max-width: 800px;
    pointer-events: auto;
}

.game-container {
    display: grid;
    gap: 10px;
    width: fit-content;
    margin: 10rem auto 2rem auto;
    justify-content: center;
    z-index: 30;
    position: relative;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 10px;
    pointer-events: auto;
}

.timer-box {
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 20px;
    font-weight: bold;
    display: inline-block;
    margin: 10px auto;
    z-index: 30;
    position: relative;
}

button {
    margin: 1em;
    padding: 15px 30px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 0;
    border: none;
    background-color:  brown;
    color: white;
}

.card {
    width: 80px;
    height: 100px;
    border: 2px solid #333;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    background-color: #f8f8f8;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 40;
    pointer-events: auto;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    z-index: 41;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 42;
}

.card-front {
    color: black;
    font-size: 20px;
    background-color: #f0f0f0;
    border-radius: 3px;
}

.card-back {
    background-color: white;
    transform: rotateY(180deg);
    color: black;
    border-radius: 3px;
}

.card-content {
    font-size: 24px;
    color: black;
    z-index: 43;
}

.matched {
    background-color: #AAFFAA;
    border-color: #00AA00;
}

.matched .card-front, .matched .card-back {
    background-color: #AAFFAA;
}

#theme1Page .card-front {
    background-color: #1a8cff; /* Blue for Number theme */
}

#theme1Page .card-content {
    background-color: #e6f2ff; /* Light blue background for numbers */
}

#theme2Page .card-front {
    background-color: #2e8b57; /* Green for Alphabet theme */
}

#theme2Page .card-content {
    background-color: #e8f5e9; /* Light green background for letters */
}

section {
    text-align: center;
    align-items: center;
    justify-content: center;
}

li a{
    text-decoration: none;
    color: #fff;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    gap: 20px;
}

.game-buttons {
    display: flex;
    gap: 10px;
}

.game-buttons button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 12px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.game-buttons button:hover {
    background-color: #45a049;
}

#soundToggleBtn {
    min-width: 110px;
}

.timer-box {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

/* Cloud animations */
@keyframes float-left-to-right {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

@keyframes float-right-to-left {
    from { transform: translateX(100%); }
    to { transform: translateX(-100%); }
}

/* This will target elements with .animated-cloud class */
.animated-cloud {
    position: relative;
    animation-duration: 45s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

/* Add animation to SVG objects to penetrate the shadow DOM */
object[type="image/svg+xml"] .animated-cloud,
object[type="image/svg+xml"] [id*="cloud"],
object[type="image/svg+xml"] [id*="Cloud"],
object[type="image/svg+xml"] [class*="cloud"],
object[type="image/svg+xml"] [class*="Cloud"] {
    position: relative !important;
    transform-origin: center center !important;
}

/* Every even cloud moves left to right */
object[type="image/svg+xml"] .animated-cloud:nth-child(even),
object[type="image/svg+xml"] [id*="cloud"]:nth-child(even),
object[type="image/svg+xml"] [id*="Cloud"]:nth-child(even) {
    animation-name: float-left-to-right !important;
}

/* Every odd cloud moves right to left */
object[type="image/svg+xml"] .animated-cloud:nth-child(odd),
object[type="image/svg+xml"] [id*="cloud"]:nth-child(odd),
object[type="image/svg+xml"] [id*="Cloud"]:nth-child(odd) {
    animation-name: float-right-to-left !important;
}