:root {
    --x-color: #ff5ca8;
    --o-color: #38dff4;
}

body {
    margin: 0;
    display: grid;
    place-items: center;
    color: #fff;
    background: radial-gradient(circle at top, #42405a, #1b1b24 70%);
    font-family: system-ui, sans-serif;
}

.tic-tac-toe {
    width: min(92vw, 520px);
    text-align: center;
}

.game-title {
    width: fit-content;
    margin: 0 auto 8px;
    padding: 8px 24px;
    border-radius: 12px;
    background: #a000a0;
    font-size: clamp(1.8rem, 8vw, 2.7rem);
}

.game-board {
    --cell-size: clamp(82px, 27vw, 124px);
    width: fit-content;
    margin: 14px auto;
    display: grid;
    grid-template-columns: repeat(3, var(--cell-size));
    border: 4px solid var(--turn-color, var(--x-color));
    border-radius: 16px;
    overflow: hidden;
    background: #11213a;
    box-shadow: 0 0 28px color-mix(in srgb, var(--turn-color, var(--x-color)) 50%, transparent);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    display: grid;
    place-items: center;
    border: 1px solid #ecd7ba;
    color: #fff;
    background: transparent;
    font: 900 clamp(3rem, 17vw, 5.2rem)/1 system-ui, sans-serif;
    cursor: inherit;
    touch-action: manipulation;
}

.cell:hover,
.cell:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    outline: 4px solid #fff;
    outline-offset: -6px;
}

.cell[data-player="X"] {
    color: var(--x-color);
    text-shadow: 0 0 18px rgba(255, 92, 168, 0.68);
}

.cell[data-player="O"] {
    color: var(--o-color);
    text-shadow: 0 0 18px rgba(56, 223, 244, 0.68);
}

.cell.is-winning {
    background: rgba(255, 232, 92, 0.22);
    animation: winner-pop 600ms ease-in-out infinite alternate;
}

.game-status {
    min-height: 1.5em;
    margin: 12px 0;
    color: #ffe77a;
    font-size: clamp(1rem, 4vw, 1.3rem);
    font-weight: 800;
}

@keyframes winner-pop {
    to { transform: scale(0.88); }
}

@media (max-height: 650px) and (orientation: landscape) {
    body { place-items: start center; }
    .tic-tac-toe { padding-top: 8px; }
    .game-title { font-size: 1.5rem; }
    .game-board { --cell-size: min(19vh, 92px); }
    .gamez-turn-indicator { margin: 6px auto; }
}
