body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #6eb5ff 0%, #ffffff 100%);
    color: #333;
    text-align: center;
}

#game {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: #004aad;
    color: #fff;
    padding: 15px 0;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

h1 {
    margin: 0;
    font-size: 2em;
}

button {
    background-color: #008cba;
    border: none;
    color: white;
    padding: 12px 24px;
    text-align: center;
    font-size: 16px;
    margin: 10px;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    touch-action: manipulation;
}

/* Only apply hover effects on devices that support hover */
@media (hover: hover) {
    button:hover {
        background-color: #005f73;
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }
}

/* Active state for touch devices */
button:active {
    background-color: #005f73;
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.secondary {
    background-color: #6c757d;
}

img {
    max-width: 100%;
    height: auto;
    max-height: 40vh;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

img:hover {
    transform: scale(1.02);
}

.hidden {
    display: none;
}

#quiz-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
}

#quiz-options button {
    width: 80%;
    max-width: 300px;
}

#quiz-feedback {
    margin: 20px 0;
    font-weight: bold;
    min-height: 24px;
}

.feedback-correct {
    color: #28a745;
    animation: fadeIn 0.3s ease;
}

.feedback-wrong {
    color: #dc3545;
    animation: fadeIn 0.3s ease;
}

.correct-answer {
    background-color: #28a745 !important;
}

.wrong-answer {
    background-color: #dc3545 !important;
}

#progress {
    font-size: 1.2em;
    margin: 20px 0;
    color: #004aad;
}

#quiz-question {
    font-size: 1.3em;
    margin: 20px 0;
    color: #004aad;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.month-display {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Memory Game Styles */
.memory-game-container {
    width: 100%;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

#memory-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    max-height: 75vh;
    aspect-ratio: 1.5/1;
    perspective: 1000px;
    margin: 0;
}

.memory-card {
    position: relative;
    aspect-ratio: 3/4;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    margin: 0;
}

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

.memory-card.matched {
    animation: cardMatch 0.4s ease-in-out;
    pointer-events: none;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(14px, 3vw, 24px);
    font-weight: bold;
    overflow: hidden;
}

.card-front {
    transform: rotateY(180deg);
    background: #fff;
}

.card-back {
    background: #004aad;
    color: white;
    font-size: clamp(20px, 4vw, 32px);
}

.img-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 8px;
}

.number-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

@keyframes cardMatch {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .memory-game-container {
        padding: 15px;
    }

    #memory-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(6, 1fr);
        gap: 8px;
        max-height: 70vh;
        aspect-ratio: 1/1.5;
    }
}

@media (max-width: 480px) {
    .memory-game-container {
        padding: 10px;
    }

    #memory-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(8, 1fr);
        gap: 6px;
        max-height: 65vh;
        aspect-ratio: 0.75/2;
    }
}

.cover-image {
    width: 300px;
    height: 300px;
    margin: 80px auto 40px;
    display: block;
    border-radius: 0;
    box-shadow: none;
    transition: none;
}

.cover-image:hover {
    transform: none;
}

/* Hide cover image when any game mode is active */
main:not(:has(#welcome:not(.hidden))) ~ .cover-image,
main:has(#learn-mode:not(.hidden)) ~ .cover-image,
main:has(#quiz-mode:not(.hidden)) ~ .cover-image,
main:has(#memory-mode:not(.hidden)) ~ .cover-image {
    display: none;
}
