body {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    padding: 0;
}

body header {
    width: 100%;
}

main {
    width: 100%;
    align-items: center;
    flex: 1;
}

main.start {
    display: flex;
    justify-content: center;
    font-size: 1.5rem;
    color: black;
}

#start-button::before {
    content: "✔";
    margin-inline-end: 10px;
}

#start-options-title {
    text-align: center;
}

main.playing {
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: auto auto;
    grid-template-areas:
        "play    score  "
        "answers answers";
}

main.ended {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
}

main:not(.start) #start-options,
main:not(.playing) #boxes-container,
main:not(.playing) #score,
main:not(.playing) #play-button-container,
main:not(.ended) .end-of-game {
    display: none;
}

footer {
    width: 100%;
}

#alefbeys-container {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    flex: 1;
    aspect-ratio: 10/9;
    gap: 8px;
}

#play-button-container {
    grid-area: play;
    text-align: center;
}

#play-button {
    font-size: 300%;
    color:#89c5f4;
}

.blinking {
    animation: blink .4s cubic-bezier(.5, 0, 1, 1) infinite alternate;
}

#top-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: absolute;
    top: 10%;
}

#score {
    font-size: 2em;
    color: black;
    padding: 5px;
    border-radius: 5px;
    text-align: center;
    grid-area: score;
}

main.ended #end-of-game-message-buttons {
    display: flex;
    justify-content: center;
    gap: 29px;
    flex-wrap: wrap;
    font-size: 1.5rem;
    color: black;
}

#back-to-lesson-button {
    color: black;
}

#boxes-container {
    display: grid;
    grid-template: 1fr 1fr / 1fr 1fr;
    gap: 10px;
    flex: 1;
    grid-area: answers;
    justify-items: stretch;
}

.answer {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    color: #000;
    position: relative;
    font-family: serif;
    font-weight: bold;
    cursor: pointer;
    transition: background-color .2s;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, .2);
    border: 2px solid #000;
    overflow: hidden;
    container-type: size;
    height: max(100px, min(30vh, 50vw));
}

.answer .text {
    font-size: 41cqh;
}

@media (hover: hover) {
    .answer:hover:not(.answered) {
        background-color: #89c5f4;
        color: #fff;
    }
}

.answer.answered.correct {
    background-color: #83ff83;
}

.answer.answered:not(.correct) {
    background-color: #ff000030;
}

.answer.answered::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-size: 2.5rem;
}

.answer.answered.correct::before {
    content: "✅";
    color: #00ff00;
}

.answer.answered:not(.correct)::before {
    content: "❌";
    color: #ff0000;
}

#final-score {
    font-size: 2em;
    color: black;
    padding: 5px;
    border-radius: 5px;
    font-weight: bold;
}

#end-of-game-image {
    max-width: 100%;
    max-height: 100%;
}

@media (aspect-ratio > 6/5) and (height < 550px) {
    #alefbeys-container {
        padding: 0 20px;
    }

    main.playing {
        grid-template-areas:
            "play  answers  score  ";
        grid-template-rows: auto;
        grid-template-columns: 2fr 3fr 2fr;
    }

    main.ended {
        display: grid;
        grid-template-rows: auto auto;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "final-score end-buttons"
            "final-image end-buttons";
        justify-items: center;
    }

    #end-of-game-image-container {
        grid-area: final-image;
        height: calc((100vh - 78px)* 62 / 100);
    }

    #end-of-game-message-buttons {
        grid-area: end-buttons;
    }

    #final-score {
        grid-area: final-score;
    }

}

@container (width < 250px) {
    .answer.answered::before {
        font-size: 20cqmin;
    }
}

@media (height < 430px) {
    body {
        height: auto;
    }
    main {
        flex: calc(100vh - 78px);
    }
}