:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8f9ff;
    --border: #dfe5f2;
    --text: #1f2740;
    --muted: #7b869b;
    --accent: #6c5ce7;
    --accent-strong: #8e7cff;
    --shadow-soft: 0 10px 30px rgba(25, 32, 53, 0.08);
    --radius: 18px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: var(--bg);
    min-height: 100vh;
    padding: 0;
    color: var(--text);
}

.page-header {
    background: #ffffff;
    border-bottom: 1px solid rgba(110, 128, 170, 0.14);
    box-shadow: 0 6px 24px rgba(20, 30, 60, 0.06);
    padding: 18px 20px;
}

.page-header nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.page-header nav a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
    transition: 0.25s ease;
}

.page-header nav a:hover {
    color: var(--accent);
}

.page-main {
    display: flex;
    justify-content: center;
    padding: 24px 20px 40px;
}

.contenedor {
    background: var(--surface);
    width: min(760px, 100%);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    text-align: center;
    border: 1px solid rgba(110, 128, 170, 0.14);
}

h1 {
    margin-bottom: 25px;
    color: #20263a;
    font-size: 2rem;
    font-weight: 800;
}

.volver {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.volver:hover {
    text-decoration: underline;
}

.panel {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.jugador {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.jugador label {
    margin-bottom: 8px;
    font-weight: 800;
    color: #49536c;
}

.jugador input {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    font-size: 16px;
}

.jugador input:focus {
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
    border-color: rgba(108, 92, 231, 0.45);
    outline: none;
}

.botones {
    margin: 20px 0;
}

button {
    padding: 12px 22px;
    margin: 5px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.25s ease;
    color: white;
    box-shadow: 0 10px 20px rgba(108, 92, 231, 0.18);
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    background-size: 200%;
    font-weight: 700;
}

button:hover {
    background-position: right;
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(108, 92, 231, 0.28);
}

button:active {
    transform: translateY(1px);
}

#turno {
    margin: 20px 0;
    color: #59647a;
    font-size: 18px;
    font-weight: 700;
}

#tablero {
    display: grid;
    grid-template-columns: repeat(3, 120px);
    grid-template-rows: repeat(3, 120px);
    gap: 12px;
    justify-content: center;
    margin: 25px auto;
    padding: 10px;
    background: var(--surface-soft);
    border-radius: 24px;
    border: 1px solid rgba(108, 92, 231, 0.2);
    box-shadow: var(--shadow-soft);
}

.celda {
    background: white;
    border: 2px solid rgba(108, 92, 231, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 60px;
    font-weight: 800;
    transition: all 0.25s ease;
    user-select: none;
    border-radius: 14px;
}

.celda:hover {
    background: #f7f8ff;
    box-shadow: 0 12px 20px rgba(25, 32, 53, 0.08);
}

.celda.x {
    color: var(--accent);
}

.celda.o {
    color: #ff5f78;
}

.celda.ganadora {
    box-shadow: inset 0 0 0 4px rgba(108, 92, 231, 0.45);
    animation: parpadeo 1s infinite alternate;
}

@keyframes parpadeo {
    from {
        box-shadow: inset 0 0 0 4px rgba(108, 92, 231, 0.35);
    }
    to {
        box-shadow: inset 0 0 0 4px rgba(108, 92, 231, 0.8);
    }
}

.marcador {
    margin-top: 20px;
    padding: 20px;
    background: var(--surface-soft);
    border-radius: 18px;
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow-soft);
}

.marcador h2 {
    margin-bottom: 15px;
    color: #20263a;
}

.marcador p {
    margin: 6px 0;
    font-size: 16px;
    color: var(--muted);
}

#mensaje {
    margin-top: 15px;
    font-size: 18px;
    color: var(--accent);
    font-weight: 700;
    min-height: 24px;
}

@media (max-width: 700px) {
    .contenedor {
        width: 100%;
    }

    .panel {
        flex-direction: column;
    }

    #tablero {
        grid-template-columns: repeat(3, 90px);
        grid-template-rows: repeat(3, 90px);
    }

    .celda {
        font-size: 45px;
    }
}