@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');


:root {

    --purple: #9b42f2;
    --purple-light: #c44df4;
    --purple-dark: #7b2ddd;

    --text: #28202f;
    --muted: #887b91;

    --white: #ffffff;

}


* {
    box-sizing: border-box;
}


body {

    margin: 0;

    min-height: 100vh;

    padding: 25px 16px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    font-family: "Inter", Arial, sans-serif;


    /* SAME PURPLE/PINK STYLE */

    background:
        radial-gradient(
            circle at 15% 15%,
            rgba(255,255,255,.16),
            transparent 28%
        ),

        linear-gradient(
            135deg,
            #7c2ddd 0%,
            #9d43f0 48%,
            #c34cf3 100%
        );

}



/* =========================
   GAME CONTAINER
========================= */

.game-container {

    width: min(560px, 100%);

    padding: 28px;

    border-radius: 28px;

    background: rgba(255,255,255,.97);

    box-shadow:
        0 25px 65px rgba(66,17,111,.28);

}



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

.header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 15px;

}


.mini-title {

    margin: 0 0 5px;

    color: var(--purple);

    font-size: 11px;

    font-weight: 800;

    letter-spacing: 2px;

}


h1 {

    margin: 0;

    color: var(--text);

    font-size: clamp(30px, 7vw, 43px);

    line-height: 1;

    letter-spacing: -1.8px;

}



/* =========================
   RESTART BUTTON
========================= */

.restart-btn {

    border: none;

    padding: 11px 15px;

    border-radius: 12px;

    background: #f0e4ff;

    color: var(--purple-dark);

    font: inherit;

    font-size: 13px;

    font-weight: 700;

    cursor: pointer;

    transition: .2s ease;

}


.restart-btn:hover {

    transform: translateY(-2px);

    background: #e8d7ff;

}


.restart-btn:active {

    transform: scale(.95);

}



/* =========================
   SCOREBOARD
========================= */

.scoreboard {

    margin: 25px 0 20px;

    display: grid;

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

    align-items: center;

    gap: 10px;

}


.player-card {

    display: flex;

    align-items: center;

    gap: 9px;

    padding: 9px;

    border-radius: 15px;

    opacity: .45;

    transition: .2s ease;

}


/* CURRENT PLAYER */

.player-card.active {

    opacity: 1;

    background: #f7efff;

}


.player-card:last-child {

    justify-content: flex-end;

}



/* X / O BOX */

.symbol {

    width: 40px;

    height: 40px;

    display: grid;

    place-items: center;

    border-radius: 11px;

    background: #f0e3ff;

    font-size: 24px;

    font-weight: 800;

}


.symbol.x {

    color: #a93cf0;

}


.symbol.o {

    color: #7843e5;

}



/* PLAYER LABEL */

.label {

    display: block;

    color: var(--muted);

    font-size: 8px;

    font-weight: 800;

    letter-spacing: 1px;

}


.player-card strong {

    display: block;

    margin-top: 1px;

    color: var(--text);

    font-size: 19px;

}



/* TURN TEXT */

.turn {

    color: var(--purple-dark);

    font-size: 12px;

    font-weight: 800;

    white-space: nowrap;

}



/* =========================
   GAME BOARD
========================= */

.board {

    position: relative;

    width: min(430px, 100%);

    aspect-ratio: 1;

    margin: auto;


    display: grid;

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

    gap: 10px;

}



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

.cell {

    border: none;

    border-radius: 17px;


    background:
        linear-gradient(
            145deg,
            #ffffff,
            #f0e7ff
        );


    box-shadow:

        inset 0 0 0 1px
        rgba(127,45,220,.08),

        0 4px 10px
        rgba(91,35,150,.04);


    color: #a53bee;

    font-family: "Inter", sans-serif;

    font-size: clamp(
        48px,
        13vw,
        76px
    );

    font-weight: 800;

    cursor: pointer;


    transition:

        transform .15s ease,

        box-shadow .2s ease,

        background .2s ease;

}



/* HOVER */

.cell:hover:not(:disabled) {

    transform: translateY(-3px);


    background:
        linear-gradient(
            145deg,
            #ffffff,
            #eadcff
        );


    box-shadow:

        0 10px 24px
        rgba(112,41,200,.15);

}



/* CLICK */

.cell:active:not(:disabled) {

    transform: scale(.96);

}



/* O COLOR */

.cell.o-mark {

    color: #7843e5;

}



/* WINNING CELLS */

.cell.win {

    background:
        linear-gradient(
            145deg,
            #e5caff,
            #f5e5ff
        );


    box-shadow:

        0 0 0 3px
        rgba(154,62,240,.25),

        0 8px 22px
        rgba(127,45,220,.16);


    animation: winner .35s ease;

}



/* =========================
   WINNING LINE
========================= */

.win-line {

    position: absolute;

    display: none;

    height: 6px;

    border-radius: 99px;

    pointer-events: none;


    background:
        linear-gradient(
            90deg,
            #8436e5,
            #c44df4
        );


    box-shadow:

        0 3px 12px
        rgba(133,54,229,.4);


    transform-origin: left center;

}



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

.message {

    min-height: 25px;

    margin-top: 17px;

    text-align: center;

    color: var(--purple-dark);

    font-size: 14px;

    font-weight: 700;

}



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

footer {

    margin-top: 15px;

    color: rgba(255,255,255,.82);

    font-size: 11px;

}


footer b {

    color: #fff;

}



/* =========================
   ANIMATION
========================= */

@keyframes winner {

    0% {

        transform: scale(.9);

    }

    70% {

        transform: scale(1.05);

    }

    100% {

        transform: scale(1);

    }

}



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

@media (max-width: 520px) {

    body {

        padding: 15px;

    }


    .game-container {

        padding: 20px;

        border-radius: 22px;

    }


    .scoreboard {

        grid-template-columns:
            1fr 1fr;

    }


    .turn {

        grid-column: 1 / -1;

        grid-row: 2;

        text-align: center;

    }


    .player-card:last-child {

        justify-content: flex-start;

    }

}