body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#header {
    background: white;
    padding: 25px 50px;
    display: flex;
    align-items: center;
    gap: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

#logo {
    height: 120px;
    width: auto;
    object-fit: contain;
}

#headerContent {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#comingSoon {
    color: #495057;
    font-size: 20px;
    font-weight: 400;
    margin: 0;
    line-height: 1.5;
}

#canvasSection {
    background: white;
    padding: 60px 20px;
}

#canvasContainer {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
}

#canvasContainer.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    border-radius: 0;
    z-index: 9999;
}

#gameCanvas {
    display: block;
    cursor: crosshair;
    width: 100%;
    height: 700px;
    border: none;
}

#canvasContainer.fullscreen #gameCanvas {
    height: 100vh;
}

#fullscreenBtn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #333;
    border-radius: 12px;
    padding: 12px 18px;
    cursor: pointer;
    font-size: 22px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    font-weight: bold;
    color: #333;
}

#fullscreenBtn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* START button - shown on small screens or when not in fullscreen */
.start-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 3px solid white;
    border-radius: 15px;
    padding: 20px 60px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.start-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 12px 32px rgba(0,0,0,0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.start-button:active {
    transform: translate(-50%, -50%) scale(1.05);
}

/* Close button - shown in fullscreen mode */
.close-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 0, 0, 0.9);
    color: white;
    border: 3px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-button:hover {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

/* START button - hidden by default on large screens */
.start-button {
    display: none;
}

/* Hide fullscreen button on small screens */
@media (max-width: 768px) {
    #fullscreenBtn {
        display: none;
    }
    
    .start-button {
        display: block;
    }
}

/* Show START button when not in fullscreen */
#canvasContainer:not(.fullscreen) .start-button {
    display: block;
}

/* Hide START button when in fullscreen */
#canvasContainer.fullscreen .start-button {
    display: none !important;
}

/* Show close button when in fullscreen */
#canvasContainer.fullscreen .close-button {
    display: flex !important;
}

/* Hide close button when not in fullscreen */
#canvasContainer:not(.fullscreen) .close-button {
    display: none !important;
}

/* Hide fullscreen button when in fullscreen mode */
#canvasContainer.fullscreen #fullscreenBtn {
    display: none !important;
}

#questionCards {
    background: #f8f9fa;
    padding: 80px 50px;
}

#questionCardsContainer {
    max-width: 1200px;
    margin: 0 auto;
}

#questionCards h2 {
    text-align: center;
    font-size: 42px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 50px 0;
}

.question-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: stretch;
}

.question-card {
    background: white;
    border: none;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
    z-index: 2;
    position: relative;
}

.card-footer {
    padding: 15px 20px;
    border-radius: 0 0 10px 10px;
    z-index: 2;
    position: relative;
}

/* Header and footer colors matching overlay colors */
.card-math .card-header,
.card-math .card-footer {
    background: #667eea; /* Blue-purple - full opacity */
}

.card-science .card-header,
.card-science .card-footer {
    background: #22c55e; /* Green - full opacity */
}

.card-language .card-header,
.card-language .card-footer {
    background: #ef4444; /* Red - full opacity */
}

.question-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0);
    transition: background 0.3s ease;
    z-index: 1;
    border-radius: 10px;
}

.question-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.question-card:hover::before {
    background: rgba(0,0,0,0.2);
}

.card-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.card-image-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
}

.question-card img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    z-index: 1;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Different colored overlays for each card */
.card-math .card-overlay {
    background: rgba(102, 126, 234, 0.3); /* Blue-purple */
}

.card-science .card-overlay {
    background: rgba(34, 197, 94, 0.3); /* Green */
}

.card-language .card-overlay {
    background: rgba(239, 68, 68, 0.3); /* Red */
}

.question-card:hover .card-overlay {
    opacity: 0.5;
}

.card-footer p {
    margin: 0;
    color: white;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

#footer {
    background: #2c3e50;
    color: white;
    padding: 60px 50px 30px;
}

#footerContent {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

#footerLogo {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#footerLogo img {
    height: 80px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

#footerLogo p {
    color: #b0b0b0;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.footer-section h3 {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 12px;
}

.footer-section ul li a {
    color: #b0b0b0;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: white;
}

#footerBottom {
    max-width: 1200px;
    margin: 40px auto 0;
    padding-top: 30px;
    border-top: 1px solid #3a4a5c;
    text-align: center;
    color: #b0b0b0;
    font-size: 14px;
}

#question {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 40px;
    border-radius: 15px;
    border: 3px solid #333;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    font-size: 22px;
    font-weight: bold;
    color: #333;
    text-align: center;
    max-width: 600px;
    z-index: 10;
    pointer-events: none;
}

#ui {
    position: absolute;
    /* Position inside the grass area at the bottom - lower to avoid duck movement area */
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(144, 238, 144, 0.98);
    padding: 10px 25px;
    border-radius: 12px;
    border: 3px solid #228B22;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 10;
    width: 96%;
    max-width: 1500px;
    box-sizing: border-box;
}

#menuContent {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: center;
}

.menu-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.button-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

#ui h2 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

.rect-button {
    display: inline-block;
    margin: 0;
    padding: 8px 15px;
    background: #8B4513;
    color: white;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
}

.rect-button:hover {
    background: #A0522D;
}

.rect-button.selected {
    background: #FFD700;
    color: #333;
    box-shadow: 0 0 10px #FFD700;
}

#rectangles-left {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

#resetBtn {
    padding: 10px 25px;
    background: #FF6B6B;
    color: white;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
}

#resetBtn:hover {
    background: #FF5252;
}

#eraserBtn {
    padding: 10px 25px;
    background: #9E9E9E;
    color: white;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
}

#eraserBtn:hover:not(:disabled) {
    background: #757575;
}

#eraserBtn:disabled {
    background: #CCCCCC;
    cursor: not-allowed;
    opacity: 0.6;
}

#eraserBtn.active {
    background: #FFD700;
    color: #333;
    box-shadow: 0 0 10px #FFD700;
}

#winMessage, #loseMessage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 40px 60px;
    border-radius: 20px;
    border: 5px solid #333;
    font-size: 36px;
    font-weight: bold;
    display: none;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    z-index: 20;
}

#winMessage {
    background: rgba(255, 215, 0, 0.98);
}

#loseMessage {
    background: rgba(255, 100, 100, 0.98);
}

.info-button-area {
    cursor: pointer;
}

#explanationModal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    padding: 30px 40px;
    border-radius: 20px;
    border: 5px solid #333;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    z-index: 30;
    display: none;
    max-width: 500px;
    min-width: 400px;
}

#explanationModal h3 {
    margin-top: 0;
    color: #333;
    font-size: 24px;
}

#explanationModal .explanation-item {
    margin: 15px 0;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
    border: 2px solid #ddd;
}

#explanationModal .explanation-item strong {
    color: #333;
    font-size: 18px;
}

#explanationModal .explanation-item p {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 14px;
}

#closeExplanation {
    background: #FF6B6B;
    color: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 20px;
    width: 100%;
}

#closeExplanation:hover {
    background: #FF5252;
}

/* Responsive Design */
@media (max-width: 768px) {
    #header {
        padding: 20px;
    }

    #logo {
        height: 60px;
    }

    #comingSoon {
        font-size: 18px;
    }

    #canvasSection {
        padding: 40px 15px;
    }

    #questionCards {
        padding: 60px 30px;
    }

    #questionCards h2 {
        font-size: 32px;
    }

    .question-cards-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .question-card {
        min-height: 250px;
    }

    .card-header {
        padding: 12px 15px;
    }

    .card-header h3 {
        font-size: 18px;
    }

    .card-footer {
        padding: 12px 15px;
    }

    .card-footer p {
        font-size: 14px;
    }

    #footer {
        padding: 40px 30px 20px;
    }

    #footerContent {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    #footerLogo img {
        height: 60px;
    }
}

@media (max-width: 480px) {
    #header {
        padding: 15px;
    }

    #logo {
        height: 50px;
    }

    #comingSoon {
        font-size: 16px;
    }

    #footer {
        padding: 30px 20px 15px;
    }

    #footerLogo img {
        height: 50px;
    }

    .footer-section h3 {
        font-size: 16px;
    }

    .footer-section ul li a {
        font-size: 13px;
    }
}

