/* Main Body */
body {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f4f8;
    color: #333;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* Main App Container */
#app {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 30px;
    text-align: center;
    max-width: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 500px;
    justify-content: center;
}

h1 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 2.8em;
    font-weight: 700;
}

h2 {
    color: #34495e;
    margin-bottom: 20px;
    font-size: 2em;
    font-weight: 700;
}

/* Page Containers */
.page {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.page.active {
    display: flex;
}

/* Buttons */
button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 15px 30px;
    margin: 10px;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    min-width: 180px;
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Game Page */
#game-info {
    font-size: 1.4em;
    font-weight: bold;
    margin-bottom: 20px;
    color: #34495e;
    min-height: 30px;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 10px;
    width: 90%;
    max-width: 350px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 20px auto;
    background-color: #ecf0f1;
    border-radius: 10px;
    padding: 10px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.cell {
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4em;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.cell:hover {
    background-color: #e0e6eb;
}

.cell.x {
    color: #e74c3c;
}

.cell.o {
    color: #2ecc71;
}

.cell.disabled {
    cursor: not-allowed;
    background-color: #f5f5f5;
}

#game-messages {
    font-size: 1.1em;
    color: #555;
    min-height: 25px;
    margin-top: 10px;
}

/* Score */
#score-page table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#score-page th, #score-page td {
    border: 1px solid #ddd;
    padding: 12px 15px;
    text-align: center;
    font-size: 1.1em;
}

#score-page th {
    background-color: #3498db;
    color: white;
    font-weight: 700;
}

#score-page tr:nth-child(even) {
    background-color: #f2f2f2;
}

#score-page tr:hover {
    background-color: #e0e0e0;
}

#final-winner-message {
    font-size: 1.8em;
    font-weight: bold;
    color: #27ae60;
    margin-top: 25px;
    margin-bottom: 20px;
}

@media (max-width: 480px) {
    #app {
        padding: 15px;
        min-height: 400px;
    }
    h1 {
        font-size: 2.2em;
        margin-bottom: 15px;
    }
    h2 {
        font-size: 1.6em;
        margin-bottom: 15px;
    }
    button {
        padding: 12px 20px;
        font-size: 1em;
        min-width: 150px;
    }
    #game-info {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    #game-board {
        width: 95%;
        max-width: 300px;
        grid-gap: 8px;
        padding: 8px;
    }
    .cell {
        font-size: 3em;
    }
    #score-page th, #score-page td {
        padding: 8px 10px;
        font-size: 0.9em;
    }
    #final-winner-message {
        font-size: 1.4em;
    }
}
