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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.game-container {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.game-header {
    margin-bottom: 30px;
}

.game-title {
    font-size: 2.5em;
    color: #2c3e50;
    letter-spacing: 3px;
    margin-bottom: 35px;
    font-weight: 700;
    text-transform: uppercase;
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8f9fa;
    padding: 20px 35px;
    border-radius: 15px;
    min-width: 110px;
    transition: all 0.3s ease;
    border: 2px solid #e9ecef;
}

.player-score {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.05);
}

.player-score .score {
    color: #3498db;
}

.bot-score {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.05);
}

.bot-score .score {
    color: #e74c3c;
}

.score-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.player-label {
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 8px;
    color: #6c757d;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.score {
    font-size: 2.5em;
    font-weight: 700;
}

.current-player {
    font-size: 1em;
    color: #495057;
    margin-bottom: 30px;
    padding: 10px 25px;
    display: inline-block;
    letter-spacing: 2px;
    font-weight: 600;
    background: #e9ecef;
    border-radius: 20px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 140px);
    grid-template-rows: repeat(3, 140px);
    gap: 15px;
    margin: 0 auto 40px;
}

.cell {
    background: #f8f9fa;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4.5em;
    font-weight: 700;
    transition: all 0.3s ease;
    position: relative;
    border: 3px solid #e9ecef;
}

.cell:hover {
    transform: translateY(-3px);
    border-color: #dee2e6;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    background: #fff;
}

.cell.x {
    color: #3498db;
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.cell.o {
    color: #e74c3c;
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popIn {
    0% { 
        transform: scale(0); 
        opacity: 0; 
    }
    70% { 
        transform: scale(1.15); 
    }
    100% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

.cell.winner {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

.restart-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px 45px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.4);
    background: #2980b9;
}

.restart-btn:active {
    transform: translateY(-1px);
}

.winner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.4s ease;
}

.winner-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.winner-modal {
    background: white;
    padding: 60px 80px;
    border-radius: 25px;
    text-align: center;
    animation: slideIn 0.4s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes slideIn {
    from { 
        transform: translateY(30px);
        opacity: 0; 
    }
    to { 
        transform: translateY(0);
        opacity: 1; 
    }
}

.winner-modal h2 {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 40px;
    font-weight: 700;
    letter-spacing: 2px;
}

.winner-modal h2.player-win {
    color: #27ae60;
}

.winner-modal h2.bot-win {
    color: #e74c3c;
    font-size: 2.8em;
}

.play-again-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

.play-again-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(39, 174, 96, 0.4);
    background: #229954;
}

@media (max-width: 768px) {
    .game-container {
        padding: 30px 20px;
    }
    
    .game-title {
        font-size: 2em;
    }
    
    .game-board {
        grid-template-columns: repeat(3, 100px);
        grid-template-rows: repeat(3, 100px);
        gap: 12px;
    }
    
    .cell {
        font-size: 3.5em;
    }
    
    .score-board {
        gap: 25px;
    }
    
    .score-item {
        padding: 15px 25px;
        min-width: 90px;
    }
    
    .winner-modal {
        padding: 40px 50px;
    }
    
    .winner-modal h2 {
        font-size: 2.2em;
    }
}


.combo-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5em;
    font-weight: 800;
    color: #27ae60;
    z-index: 9999;
    display: none;
    pointer-events: none;
    letter-spacing: 3px;
}

@keyframes comboPopup {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9998;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.streak-item {
    background: #fff3cd;
    border-color: #ffc107;
}

.streak-item .player-label {
    color: #856404;
}

.streak-item .score {
    color: #856404;
}

.score-item {
    border: 2px solid transparent;
}

.cell {
    position: relative;
    overflow: visible;
}

.cell::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.2);
    transform: translate(-50%, -50%);
    transition: all 0.2s ease;
}

.cell:active::after {
    width: 80%;
    height: 80%;
}
