/* =========================================================
   GAMESO — TIC TAC TOE
   Professional Responsive Game Design
========================================================= */

:root {
    --bg: #080b14;
    --bg-secondary: #0e1320;
    --card: #121827;
    --card-hover: #171f31;

    --text: #ffffff;
    --muted: #9aa3b5;

    --primary: #6c5ce7;
    --primary-light: #8175ee;
    --accent: #00d4ff;

    --border: rgba(255, 255, 255, 0.08);

    --radius: 18px;
}


/* =========================================================
   RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    color: var(--text);

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(108, 92, 231, 0.13),
            transparent 36%
        ),
        var(--bg);

    line-height: 1.6;

    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    border: 0;
}


/* =========================================================
   HEADER
========================================================= */

.game-header {
    position: sticky;
    top: 0;
    z-index: 100;

    height: 70px;

    background:
        rgba(8, 11, 20, 0.88);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    border-bottom:
        1px solid var(--border);
}

.header-inner {
    width:
        min(1100px, calc(100% - 32px));

    height: 100%;

    margin: auto;

    display: flex;

    align-items: center;
    justify-content: space-between;
}


/* =========================================================
   LOGO
========================================================= */

.logo {
    display: flex;

    align-items: center;

    gap: 9px;

    font-size: 20px;

    font-weight: 800;
}

.logo span {
    width: 35px;
    height: 35px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--accent)
        );

    font-size: 18px;
}

.logo strong {
    background:
        linear-gradient(
            90deg,
            #ffffff,
            #bdb9ff
        );

    -webkit-background-clip: text;
    background-clip: text;

    -webkit-text-fill-color: transparent;
}


/* =========================================================
   BACK BUTTON
========================================================= */

.back-button {
    min-height: 40px;

    padding: 0 15px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    color: var(--muted);

    background:
        rgba(255, 255, 255, 0.03);

    border:
        1px solid var(--border);

    border-radius: 10px;

    font-size: 13px;

    font-weight: 600;

    transition: 0.25s ease;
}

.back-button:hover {
    color: white;

    background:
        rgba(255, 255, 255, 0.07);

    border-color:
        rgba(108, 92, 231, 0.35);

    transform: translateX(-2px);
}


/* =========================================================
   MAIN
========================================================= */

.game-page {
    padding: 55px 0 80px;
}

.game-container {
    width:
        min(900px, calc(100% - 32px));

    margin: auto;
}


/* =========================================================
   GAME HEADING
========================================================= */

.game-heading {
    text-align: center;

    margin-bottom: 30px;
}

.game-label {
    display: inline-block;

    margin-bottom: 10px;

    color: #9b93ff;

    font-size: 11px;

    font-weight: 800;

    letter-spacing: 1px;
}

.game-heading h1 {
    font-size:
        clamp(32px, 5vw, 48px);

    line-height: 1.1;

    letter-spacing: -1.5px;

    font-weight: 800;
}

.game-heading p {
    max-width: 620px;

    margin: 12px auto 0;

    color: var(--muted);

    font-size: 14px;
}


/* =========================================================
   GAME BOX
========================================================= */

.game-box {
    width:
        min(520px, 100%);

    margin: auto;

    padding: 18px;

    background:
        linear-gradient(
            145deg,
            #141b2b,
            #0e1422
        );

    border:
        1px solid var(--border);

    border-radius: 22px;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.35);
}


/* =========================================================
   PLAYER STATUS
========================================================= */

.game-status {
    display: grid;

    grid-template-columns:
        1fr auto 1fr;

    align-items: center;

    gap: 10px;

    margin-bottom: 15px;
}

.player-box {
    min-height: 58px;

    padding: 8px 12px;

    display: flex;

    align-items: center;

    gap: 10px;

    background:
        rgba(255, 255, 255, 0.035);

    border:
        1px solid var(--border);

    border-radius: 13px;

    opacity: 0.55;

    transition: 0.25s ease;
}

.player-box.active {
    opacity: 1;

    background:
        rgba(108, 92, 231, 0.12);

    border-color:
        rgba(108, 92, 231, 0.4);

    box-shadow:
        0 8px 25px rgba(108, 92, 231, 0.08);
}

.player-symbol {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    flex-shrink: 0;

    border-radius: 10px;

    background:
        rgba(255, 255, 255, 0.06);

    font-size: 20px;

    font-weight: 900;
}

#playerX .player-symbol {
    color: #8175ee;
}

#playerO .player-symbol {
    color: #00d4ff;
}

.player-box small {
    display: block;

    color: var(--muted);

    font-size: 9px;

    line-height: 1.2;

    text-transform: uppercase;

    letter-spacing: 0.8px;
}

.player-box strong {
    display: block;

    margin-top: 2px;

    color: white;

    font-size: 15px;
}

.vs {
    color: #697284;

    font-size: 10px;

    font-weight: 800;

    letter-spacing: 1px;
}


/* =========================================================
   TURN MESSAGE
========================================================= */

.turn-message {
    min-height: 38px;

    display: flex;

    align-items: center;
    justify-content: center;

    margin-bottom: 14px;

    color: var(--muted);

    font-size: 13px;

    font-weight: 600;
}

.turn-message strong {
    margin: 0 4px;

    color: white;

    font-weight: 800;
}


/* =========================================================
   TIC TAC TOE BOARD
========================================================= */

.tic-tac-toe-board {
    width: min(390px, 100%);

    aspect-ratio: 1 / 1;

    margin: 0 auto;

    padding: 8px;

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 8px;

    background:
        rgba(255, 255, 255, 0.025);

    border:
        1px solid var(--border);

    border-radius: 18px;
}


/* =========================================================
   CELLS
========================================================= */

.cell {
    appearance: none;

    min-width: 0;
    min-height: 0;

    display: grid;

    place-items: center;

    color: white;

    background:
        linear-gradient(
            145deg,
            #151d2d,
            #101725
        );

    border:
        1px solid rgba(255, 255, 255, 0.06);

    border-radius: 13px;

    font-size:
        clamp(40px, 9vw, 64px);

    font-weight: 900;

    line-height: 1;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.cell:hover {
    background:
        linear-gradient(
            145deg,
            #1a2335,
            #151e30
        );

    border-color:
        rgba(108, 92, 231, 0.3);

    transform: translateY(-2px);
}

.cell:active {
    transform: scale(0.96);
}


/* =========================================================
   X
========================================================= */

.cell.x {
    color: #8175ee;

    text-shadow:
        0 0 25px rgba(129, 117, 238, 0.3);
}


/* =========================================================
   O
========================================================= */

.cell.o {
    color: #00d4ff;

    text-shadow:
        0 0 25px rgba(0, 212, 255, 0.25);
}


/* =========================================================
   WINNING CELLS
========================================================= */

.cell.winner {
    background:
        linear-gradient(
            145deg,
            rgba(108, 92, 231, 0.35),
            rgba(0, 212, 255, 0.12)
        );

    border-color:
        rgba(129, 117, 238, 0.65);

    box-shadow:
        0 0 25px rgba(108, 92, 231, 0.18);

    animation:
        winnerPulse 0.8s ease-in-out infinite alternate;
}

@keyframes winnerPulse {

    from {
        transform: scale(1);
    }

    to {
        transform: scale(0.96);
    }
}


/* =========================================================
   DRAW CELLS
========================================================= */

.cell.draw-cell {
    border-color:
        rgba(255, 255, 255, 0.12);
}


/* =========================================================
   SCORE PANEL
========================================================= */

.score-panel {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 8px;

    margin-top: 14px;
}

.score-item {
    padding: 10px 6px;

    text-align: center;

    background:
        rgba(255, 255, 255, 0.035);

    border:
        1px solid var(--border);

    border-radius: 11px;
}

.score-item span {
    display: block;

    color: var(--muted);

    font-size: 9px;

    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: 0.6px;
}

.score-item strong {
    display: block;

    margin-top: 2px;

    color: white;

    font-size: 20px;

    line-height: 1.2;
}


/* =========================================================
   NEW GAME BUTTON
========================================================= */

.restart-button {
    width: 100%;

    min-height: 46px;

    margin-top: 13px;

    display: flex;

    align-items: center;
    justify-content: center;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            #5144d7
        );

    border-radius: 11px;

    font-size: 13px;

    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 10px 25px rgba(108, 92, 231, 0.22);

    transition: 0.25s ease;
}

.restart-button:hover {
    transform: translateY(-2px);

    box-shadow:
        0 14px 30px rgba(108, 92, 231, 0.32);
}

.restart-button:active {
    transform: translateY(0);
}


/* =========================================================
   INFORMATION
========================================================= */

.game-info-section {
    max-width: 760px;

    margin: 65px auto 0;
}

.game-info-section h2,
.related-section h2 {
    margin-bottom: 13px;

    color: white;

    font-size: 23px;

    line-height: 1.3;

    letter-spacing: -0.5px;
}

.game-info-section h2:not(:first-child) {
    margin-top: 38px;
}

.game-info-section p {
    margin-bottom: 12px;

    color: var(--muted);

    font-size: 14px;

    line-height: 1.8;
}

.game-info-section ul {
    padding-left: 20px;

    color: var(--muted);

    font-size: 14px;

    line-height: 2;
}

.game-info-section li {
    padding-left: 3px;
}

.game-info-section strong {
    color: white;
}


/* =========================================================
   RELATED GAMES
========================================================= */

.related-section {
    max-width: 760px;

    margin: 65px auto 0;
}

.related-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 12px;
}

.related-card {
    min-height: 100px;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 7px;

    background: var(--card);

    border:
        1px solid var(--border);

    border-radius: 14px;

    transition: 0.25s ease;
}

.related-card:hover {
    transform: translateY(-3px);

    background: var(--card-hover);

    border-color:
        rgba(108, 92, 231, 0.35);

    box-shadow:
        0 12px 25px rgba(0, 0, 0, 0.2);
}

.related-card span {
    font-size: 30px;
}

.related-card strong {
    color: white;

    font-size: 12px;
}


/* =========================================================
   FOOTER
========================================================= */

footer {
    padding: 22px 20px;

    text-align: center;

    background: #060810;

    border-top:
        1px solid var(--border);

    color: #697284;

    font-size: 11px;
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 700px) {

    .game-page {
        padding: 40px 0 60px;
    }

    .game-heading {
        margin-bottom: 22px;
    }

    .game-heading h1 {
        font-size: 34px;
    }

    .game-heading p {
        font-size: 13px;
    }

    .game-box {
        padding: 11px;

        border-radius: 17px;
    }

    .tic-tac-toe-board {
        gap: 6px;

        padding: 6px;

        border-radius: 15px;
    }

    .cell {
        border-radius: 10px;
    }

    .game-info-section {
        margin-top: 50px;
    }

    .related-section {
        margin-top: 50px;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .related-card {
        min-height: 70px;

        flex-direction: row;

        justify-content: flex-start;

        padding: 0 18px;
    }

    .related-card span {
        font-size: 25px;
    }
}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 420px) {

    .game-header {
        height: 62px;
    }

    .header-inner {
        width: calc(100% - 24px);
    }

    .logo {
        font-size: 18px;
    }

    .logo span {
        width: 32px;
        height: 32px;

        font-size: 16px;
    }

    .back-button {
        min-height: 36px;

        padding: 0 10px;

        font-size: 11px;
    }

    .game-container {
        width: calc(100% - 20px);
    }

    .game-heading h1 {
        font-size: 29px;
    }

    .game-heading p {
        font-size: 12px;
    }

    .game-status {
        gap: 6px;
    }

    .player-box {
        min-height: 50px;

        padding: 6px 8px;

        gap: 7px;
    }

    .player-symbol {
        width: 32px;
        height: 32px;

        font-size: 17px;
    }

    .player-box small {
        font-size: 8px;
    }

    .player-box strong {
        font-size: 13px;
    }

    .vs {
        font-size: 8px;
    }

    .turn-message {
        font-size: 12px;
    }

    .cell {
        font-size: 40px;

        border-radius: 9px;
    }

    .score-item {
        padding: 8px 4px;
    }

    .score-item span {
        font-size: 8px;
    }

    .score-item strong {
        font-size: 17px;
    }

    .game-info-section h2,
    .related-section h2 {
        font-size: 20px;
    }

    .game-info-section p,
    .game-info-section ul {
        font-size: 13px;
    }
}


/* =========================================================
   ACCESSIBILITY
========================================================= */

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);

    outline-offset: 3px;
}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        transition-duration: 0.01ms !important;

        animation-duration: 0.01ms !important;
    }
}
