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

body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: black;
}

.container {
    text-align: center;
}

h1 {
    margin-bottom: 20px;
    color: white;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 5px;
    margin: 20px auto;
    background-color: #333;
    padding: 5px;
}

.cell {
    background-color: white;
    border: none;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cell:hover {
    background-color: #f5f5f5;
}

.cell:disabled {
    cursor: not-allowed;
}

.game-info {
    margin-top: 20px;
}

#gameStatus {
    font-size: 18px;
    margin-bottom: 10px;
    color: white;
}

#resetBtn {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#resetBtn:hover {
    background-color: #0056b3;
}

/* Start Screen Styles */
.start-screen {
    text-align: center;
    border: 3px solid white;
    padding: 40px 80px;
    border-radius: 0;
    background-color: rgba(255, 255, 255, 0.1);
    width: 400px;
    margin: 0 auto;
}

#playBtn {
    padding: 15px 30px;
    font-size: 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
}

#playBtn:hover {
    background-color: #218838;
}

/* Player Selection Styles */
.player-selection {
    text-align: center;
    border: 3px solid white;
    padding: 40px 80px;
    border-radius: 0;
    background-color: rgba(255, 255, 255, 0.1);
    width: 400px;
    margin: 0 auto;
}

.player-selection p {
    font-size: 18px;
    margin-bottom: 20px;
    color: white;
}

.player-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* Game Mode Selection Styles */
.game-mode-selection {
    text-align: center;
    border: 3px solid white;
    padding: 40px 80px;
    border-radius: 0;
    background-color: rgba(255, 255, 255, 0.1);
    width: 400px;
    margin: 0 auto;
}

.game-mode-selection p {
    font-size: 18px;
    margin-bottom: 20px;
    color: white;
}

/* Dropdown Styles */
.dropdown-section {
    margin-bottom: 20px;
}

.dropdown-section label {
    display: block;
    color: white;
    font-size: 16px;
    margin-bottom: 8px;
}

.dropdown {
    width: 200px;
    padding: 10px;
    font-size: 16px;
    border: 2px solid white;
    border-radius: 5px;
    background-color: white;
    color: black;
    cursor: pointer;
}

.dropdown:focus {
    outline: none;
    border-color: #007bff;
}

.continue-btn {
    padding: 12px 30px;
    font-size: 16px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

.continue-btn:hover {
    background-color: #218838;
}

.player-btn {
    padding: 12px 25px;
    font-size: 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.player-btn:hover {
    background-color: #0056b3;
}

/* Game piece colors */
.cell.x {
    color: red;
}

.cell.o {
    color: blue;
}

/* Turn indicator styles */
.turn-indicator {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.turn-btn {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #333;
    color: white;
    border: 2px solid #666;
    border-radius: 5px;
    cursor: default;
}

.turn-btn.active {
    background-color: #007bff;
    border-color: #007bff;
}

/* Close button styles */
.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.game-screen {
    position: relative;
}

/* Win modal styles */
.win-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.win-content {
    position: relative;
    background-color: yellow;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
}

.win-content .close-btn {
    color: black;
}

/* Sound Toggle Button */
.sound-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: none;
    border: 2px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    z-index: 1000;
}

.sound-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sound-toggle.muted {
    opacity: 0.5;
}

#winMessage {
    font-size: 36px;
    color: black;
    margin: 0;
}

/* Confetti Animation */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1001;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    animation: confetti-fall 3s linear infinite;
}

.confetti:nth-child(2n) { background: #4ecdc4; }
.confetti:nth-child(3n) { background: #45b7d1; }
.confetti:nth-child(4n) { background: #f9ca24; }
.confetti:nth-child(5n) { background: #6c5ce7; }
.confetti:nth-child(6n) { background: #a29bfe; }

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 5px;
        min-height: 100vh;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
        padding: 5px;
    }
    
    .start-screen, .player-selection, .game-mode-selection {
        width: 95%;
        max-width: 350px;
        padding: 30px 20px;
        margin: 0 auto;
        border-width: 2px;
    }
    
    h1 {
        font-size: 32px;
        margin-bottom: 20px;
    }
    
    .game-board {
        grid-template-columns: repeat(3, min(25vw, 100px));
        grid-template-rows: repeat(3, min(25vw, 100px));
        gap: 4px;
        margin: 20px auto;
        max-width: 320px;
    }
    
    .cell {
        font-size: clamp(24px, 8vw, 36px);
        min-height: 60px;
    }
    
    .turn-indicator {
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .turn-btn {
        padding: 12px 16px;
        font-size: 14px;
        flex: 1;
        min-height: 44px;
    }
    
    .player-buttons {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
    
    .player-btn {
        width: 220px;
        padding: 16px 25px;
        font-size: 18px;
        min-height: 50px;
    }
    
    #playBtn, .continue-btn {
        padding: 16px 40px;
        font-size: 18px;
        width: 220px;
        min-height: 50px;
    }
    
    #resetBtn {
        padding: 14px 30px;
        font-size: 16px;
        margin-top: 20px;
        min-height: 48px;
    }
    
    .dropdown {
        width: 280px;
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
    }
    
    .win-content {
        padding: 30px 20px;
        margin: 20px;
        width: 90%;
        max-width: 320px;
    }
    
    #winMessage {
        font-size: 28px;
    }
    
    .sound-toggle {
        top: 10px;
        right: 10px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .start-screen, .player-selection, .game-mode-selection {
        width: 98%;
        padding: 25px 15px;
        border-width: 2px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .game-board {
        grid-template-columns: repeat(3, min(28vw, 85px));
        grid-template-rows: repeat(3, min(28vw, 85px));
        gap: 3px;
        max-width: 280px;
    }
    
    .cell {
        font-size: clamp(20px, 7vw, 30px);
        min-height: 50px;
    }
    
    .turn-btn {
        padding: 10px 12px;
        font-size: 13px;
        min-height: 40px;
    }
    
    .player-btn {
        width: 200px;
        padding: 14px 20px;
        font-size: 16px;
        min-height: 48px;
    }
    
    #playBtn, .continue-btn {
        width: 200px;
        padding: 14px 30px;
        font-size: 16px;
        min-height: 48px;
    }
    
    .dropdown {
        width: 240px;
        padding: 12px;
        font-size: 15px;
        min-height: 44px;
    }
    
    #winMessage {
        font-size: 24px;
    }
    
    .sound-toggle {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

@media (max-width: 360px) {
    .start-screen, .player-selection, .game-mode-selection {
        width: 100%;
        padding: 20px 10px;
        margin: 5px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .game-board {
        grid-template-columns: repeat(3, min(30vw, 75px));
        grid-template-rows: repeat(3, min(30vw, 75px));
        gap: 2px;
        max-width: 240px;
    }
    
    .cell {
        font-size: clamp(18px, 6vw, 26px);
        min-height: 45px;
    }
    
    .player-btn, #playBtn, .continue-btn {
        width: 180px;
        padding: 12px 20px;
        font-size: 15px;
        min-height: 44px;
    }
    
    .dropdown {
        width: 200px;
        padding: 10px;
        font-size: 14px;
        min-height: 40px;
    }
    
    .turn-btn {
        padding: 8px 10px;
        font-size: 12px;
        min-height: 36px;
    }
    
    #winMessage {
        font-size: 20px;
    }
}