/* ===== Global Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    font-family: 'Poppins', sans-serif;
    background: radial-gradient(circle at top, #6a0dad, #0a0a4f, #000);
    padding: 1rem;
    overflow-x: hidden;
}

/* ===== Header ===== */
header h1 {
    margin-top: 1rem;
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    text-shadow: 0 0 5px #ff4d4d, 0 0 10px #ffaa00, 0 0 20px #00ffff;
}

/* ===== Game Wrapper ===== */
.game-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* ===== Game Board ===== */
.container {
    display: grid;
    gap: clamp(0.5rem, 2vw, 1rem);
    grid-template-columns: repeat(3, minmax(80px, 120px));
    grid-auto-rows: minmax(80px, 120px);
}

/* ===== Cells ===== */
.container>div {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 18px;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.25s ease;
}

.container>div:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    border: 2px solid #ff4d4d;
}

/* ===== Buttons ===== */
.container>div button {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 18px;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: bold;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s ease;
}

/* X Style */
.container>div button.x {
    color: #ff4d4d;
    text-shadow: 0 0 10px rgba(255, 77, 77, 0.9);
}

/* O Style */
.container>div button.o {
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.9);
}

/* Hover Effect */
.container>div button:hover {
    transform: scale(1.15);
}

/* ===== Win Overlay (NO SHIFT) ===== */
.win-game {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    gap: 1.5rem;
    z-index: 100;
}

/* Message */
.win-game #msg {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: bold;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 0 10px #ff4d4d, 0 0 20px #00ffff, 0 0 30px #ffaa00;
}

/* ===== Buttons ===== */
.win-game button, .reset {
    padding: 0.6rem 2rem;
    font-size: clamp(1rem, 3vw, 1.4rem);
    border-radius: 30px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    background: linear-gradient(90deg, #ff4d4d, #ffaa00, #00ffff);
    color: #fff;
    transition: all 0.25s ease;
}

.win-game button:hover, .reset:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

/* ===== Reset Container ===== */
#reset-container {
    margin-top: 1rem;
}

/* ===== Hide Class ===== */
.hide {
    display: none;
}

/* ===== Mobile Optimization ===== */
@media (max-width: 480px) {

    body {
        justify-content: space-evenly;
    }

    .container {
        grid-template-columns: repeat(3, 85px);
        grid-auto-rows: 85px;
        gap: 0.6rem;
    }

    .container>div button {
        font-size: 2.2rem;
    }

    .win-game #msg {
        font-size: 2rem;
    }
}