/* ========== GLOBAL STYLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

body {
    background: linear-gradient(135deg, #1e1e2f, #2a2a40);
    color: #fff;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s ease;
}

.container {
    text-align: center;
    width: 90%;
    max-width: 450px;
}

/* ========== MODE BUTTON ========== */
.mode-btn {
    background: #6c63ff;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 15px;
    transition: 0.25s ease;
}

.mode-btn:hover {
    background: #837dff;
}

/* ========== TITLE ========== */
.title {
    font-size: 2.2rem;
    margin-bottom: 20px;
    font-weight: 700;
}

/* ========== SCOREBOARD ========== */
.scoreboard {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.08);
    padding: 12px 20px;
    border-radius: 12px;
    backdrop-filter: blur(6px);
    transition: 0.3s ease;
}

.score {
    display: flex;
    gap: 8px;
    font-size: 1.1rem;
}

/* ========== GAME BOARD ========== */
.board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-gap: 10px;
    justify-content: center;
    margin: 20px auto;
}

.cell {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    transition: 0.25s ease, transform 0.15s ease;
}

/* Cell Click Animation */
.cell.clicked {
    transform: scale(1.2);
}
.cell.clicked-end {
    transform: scale(1);
}

/* Hover Effect */
.cell:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* Disable filled cells */
.cell.filled {
    pointer-events: none;
}

/* Winning Animation */
.winner {
    background: #4caf50 !important;
    color: white;
    animation: winPulse 0.7s ease-in-out infinite alternate;
}

@keyframes winPulse {
    from { transform: scale(1.05); }
    to   { transform: scale(1.15); }
}

/* ========== TURN INDICATOR ========== */
.turn-indicator {
    margin: 18px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

/* ========== RESTART BUTTON ========== */
.restart-btn {
    background: #ff4f4f;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: white;
    transition: 0.2s;
}

.restart-btn:hover {
    background: #ff7070;
    transform: scale(1.07);
}

/* ========== POPUP BASE STYLE ========== */
.player-popup,
.mode-popup,
.difficulty-popup,
.winner-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

/* ========== POPUP BOX ========== */
.popup-box,
.winner-box {
    background: #2b2b40;
    padding: 25px;
    width: 300px;
    text-align: center;
    border-radius: 12px;
    color: white;
    animation: popIn 0.4s ease forwards;
}

/* Inputs */
.popup-box input {
    width: 90%;
    padding: 10px;
    margin: 8px 0 15px 0;
    border-radius: 6px;
    border: none;
}

/* Buttons inside popups */
.popup-box button,
#winnerPopup button {
    background: #6c63ff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    transition: 0.2s;
}

.popup-box button:hover,
#winnerPopup button:hover {
    background: #837dff;
}

/* Big Buttons (Mode & Difficulty) */
.big-btn {
    width: 90%;
    padding: 12px;
    margin: 10px 0;
    border-radius: 8px;
    border: none;
    background: #6c63ff;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.25s;
}

.big-btn:hover {
    background: #837dff;
}

/* Note under AI name */
.note {
    font-size: 0.8rem;
    margin-top: -5px;
    margin-bottom: 10px;
    opacity: 0.7;
}

/* Winner Popup Animation */
.winner-popup {
    animation: fadeIn 0.4s ease forwards;
}

.winner-box {
    animation: popIn 0.45s ease forwards;
    transform: scale(0.5);
    opacity: 0;
    background: #2b2b40;
    border: 2px solid #6c63ff;
    box-shadow: 0 0 20px rgba(108, 99, 255, 0.4);
}

/* Fade Background Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Popup Zoom Animation */
@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ========== LIGHT MODE ========== */
.light-mode {
    background: #f0f0f0 !important;
    color: #222;
}

.light-mode .cell {
    background: rgba(0, 0, 0, 0.1);
    color: #222;
}

.light-mode .scoreboard {
    background: rgba(0, 0, 0, 0.15);
}

.light-mode .restart-btn {
    background: #d9534f;
}

.light-mode .mode-btn {
    background: #333;
    color: #fff;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 450px) {
    .board {
        grid-template-columns: repeat(3, 80px);
        grid-gap: 8px;
    }

    .cell {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}
