* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #dff6ff, #eefcff);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #17324d;
}

.container {
    width: 95%;
    max-width: 600px;
    text-align: center;
}

h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.subtitle {
    color: #57809c;
    margin-bottom: 20px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.player,
.turn {
    background: white;
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.player {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player strong {
    font-size: 20px;
}

.player-x strong {
    color: #2389da;
}

.player-o strong {
    color: #e74c3c;
}

.turn {
    font-size: 14px;
}

.board {
    width: min(90vw, 500px);
    height: min(90vw, 500px);
    margin: auto;

    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);

    gap: 10px;

    padding: 10px;

    background: #9bd8f5;
    border-radius: 20px;

    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.cell {
    width: 100%;
    height: 100%;

    border: none;
    border-radius: 15px;

    background: white;

    cursor: pointer;

    font-size: clamp(45px, 12vw, 90px);
    font-weight: bold;

    display: flex;
    justify-content: center;
    align-items: center;

    transition: 0.15s;
}

.cell:hover:not(.used) {
    background: #e9f8ff;
    transform: scale(0.97);
}

.cell.used {
    cursor: not-allowed;
}

.cell.x {
    color: #2389da;
}

.cell.o {
    color: #e74c3c;
}

.message {
    margin: 18px 0;

    min-height: 24px;

    font-size: 17px;
    font-weight: bold;
}

#restartBtn {
    border: none;
    padding: 12px 25px;

    border-radius: 12px;

    background: #2389da;
    color: white;

    font-size: 16px;
    font-weight: bold;

    cursor: pointer;

    transition: 0.2s;
}

#restartBtn:hover {
    transform: translateY(-2px);
    background: #176fb5;
}


/* MODAL */

.modal {
    position: fixed;
    inset: 0;

    background: rgba(0,0,0,0.5);

    display: none;

    justify-content: center;
    align-items: center;

    padding: 20px;

    z-index: 999;
}

.modal.show {
    display: flex;
}

.quiz-box {
    width: 100%;
    max-width: 600px;

    background: white;

    border-radius: 20px;

    padding: 25px;

    box-shadow: 0 20px 50px rgba(0,0,0,0.25);

    animation: popup 0.2s ease;
}

@keyframes popup {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 20px;

    font-size: 18px;
    font-weight: bold;
}

#closeQuiz {
    border: none;
    background: none;

    font-size: 30px;

    cursor: pointer;

    color: #777;
}

#question {
    font-size: 20px;
    line-height: 1.5;

    margin-bottom: 20px;
}

.answer {
    width: 100%;

    padding: 14px;

    margin-bottom: 10px;

    border: 2px solid #dcebf3;

    border-radius: 12px;

    background: white;

    text-align: left;

    font-size: 16px;

    cursor: pointer;

    transition: 0.15s;
}

.answer:hover {
    background: #eefaff;
    border-color: #72c8ef;
}

.answer.correct {
    background: #d9f8e3;
    border-color: #28a745;
}

.answer.wrong {
    background: #ffe0e0;
    border-color: #e74c3c;
}

.answer:disabled {
    cursor: default;
}

#result {
    margin-top: 15px;

    font-size: 17px;
    font-weight: bold;

    min-height: 25px;
}


/* MOBILE */

@media (max-width: 500px) {

    h1 {
        font-size: 25px;
    }

    .game-info {
        flex-wrap: wrap;
        justify-content: center;
    }

    .turn {
        order: -1;
        width: 100%;
    }

    .player {
        flex: 1;
    }

    .board {
        gap: 7px;
        padding: 7px;
        border-radius: 15px;
    }

    .cell {
        border-radius: 10px;
    }

    .quiz-box {
        padding: 18px;
    }

    #question {
        font-size: 17px;
    }
}