/* ================= RESET ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

/* ================= PAGE BACKGROUND ================= */
body {
    min-height: 100vh;                    /* allow page to grow */
    background: radial-gradient(circle at top, #1f2933, #0f172a);
    display: flex;
    justify-content: center;              /* horizontal center */
    align-items: flex-start;              /* ⭐ FIX: no vertical clipping */
    padding: 20px 0;                      /* space from top */
    color: #f8fafc;
    overflow-x: hidden;                   /* safety */
}

/* ================= MAIN CARD ================= */
.game-card {
    width: 100%;
    max-width: 360px;                     /* mobile friendly */
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
}

/* ================= SCOREBOARD ================= */
.scoreboard {
    display: flex;
    justify-content: center;              /* center pills */
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;                      /* wrap instead of cut */
}

/* Score pills */
.score {
    padding: 8px 12px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;                  /* no text break */
}

/* Colors */
.player { background: linear-gradient(135deg, #22d3ee, #3b82f6); }
.ai     { background: linear-gradient(135deg, #f43f5e, #fb7185); }
.draw   { background: linear-gradient(135deg, #a78bfa, #6366f1); }

/* ================= GAME CONTENT ================= */
.game-container {
    text-align: center;
}

/* ================= MODES ================= */
.mode-select {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 12px 0;
    flex-wrap: wrap;                      /* mobile safe */
}

/* ================= CONTROLS ================= */
.controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
}

/* ================= BUTTONS ================= */
button {
    padding: 10px 18px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #22d3ee, #3b82f6);
    color: white;
    font-weight: 600;
}

button:active {
    transform: scale(0.96);
}

/* ================= BOARD ================= */
.board {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 90px); /* smaller for mobile */
    gap: 12px;
    margin: 20px auto;
}

/* ================= CELLS ================= */
.cell {
    width: 90px;
    height: 90px;
    background: rgba(255,255,255,0.12);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    cursor: pointer;
}

/* Mark animation */
.cell.mark {
    animation: pop 0.25s ease forwards;
}

/* Winning cell */
.cell.win {
    background: linear-gradient(135deg, #22d3ee, #3b82f6);
    box-shadow: 0 0 15px rgba(34,211,238,0.6);
}

/* Pop animation */
@keyframes pop {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ================= WIN LINE ================= */
.win-line {
    position: absolute;
    height: 6px;
    width: 0;
    background: linear-gradient(90deg, #22d3ee, #a78bfa);
    box-shadow: 0 0 20px #22d3ee;
    border-radius: 10px;
    transform-origin: left center;
    transition: width 0.4s ease;
    pointer-events: none;
}

/* ================= HIDE DIFFICULTY ================= */
#difficultyContainer {
    display: none;
}

/* ================= EXTRA SMALL PHONES ================= */
@media (max-width: 360px) {
    .board {
        grid-template-columns: repeat(3, 80px);
    }

    .cell {
        width: 80px;
        height: 80px;
        font-size: 2.1rem;
    }

    .score {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
}
