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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

.game-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-mode-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid transparent;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.mode-btn.active {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    border-color: white;
}

.mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.3);
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: bold;
}

.multiplayer-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    backdrop-filter: blur(5px);
}

.player-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: bold;
}

.player1-score {
    color: #2ecc71;
}

.player2-score {
    color: #e74c3c;
}

.room-info {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

#roomCode {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
}

#joinRoomBtn, #createRoomBtn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    padding: 8px 16px;
    font-size: 0.9em;
    margin: 0;
}

.score, .high-score {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
    min-width: 120px;
}

.level-info {
    margin-bottom: 20px;
}

.level-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.level-display {
    font-size: 1.1em;
    font-weight: bold;
    min-width: 150px;
    text-align: center;
}

.level-btn {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.level-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.level-btn:active {
    transform: translateY(0);
}

.level-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#gameCanvas {
    border: 3px solid white;
    border-radius: 10px;
    background-color: #2c3e50;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    margin: 20px 0;
}

.controls {
    margin: 20px 0;
}

button {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

.instructions {
    margin-top: 20px;
    font-size: 0.9em;
    opacity: 0.8;
}

.instructions p {
    margin: 5px 0;
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    z-index: 1000;
}

.game-over h2 {
    color: #ff6b6b;
    margin-bottom: 15px;
    font-size: 2em;
}

.game-over p {
    font-size: 1.2em;
    margin-bottom: 10px;
}

/* Mobile Controls */
.mobile-controls {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.control-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.control-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: translateY(0);
    background: linear-gradient(45deg, #2980b9, #3498db);
}

/* Touch-friendly canvas */
#gameCanvas {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .game-container {
        padding: 20px;
        margin: 0;
        width: 100%;
        max-width: 400px;
    }
    
    h1 {
        font-size: 2em;
        margin-bottom: 15px;
    }
    
    #gameCanvas {
        width: 320px;
        height: 320px;
        max-width: 90vw;
        max-height: 90vw;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .score, .high-score {
        min-width: auto;
        padding: 8px 16px;
    }
    
    .level-info {
        margin-bottom: 15px;
    }
    
    .level-controls {
        gap: 10px;
        padding: 8px 15px;
    }
    
    .level-display {
        font-size: 1em;
        min-width: 120px;
    }
    
    .level-btn {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
    
    button {
        padding: 10px 20px;
        font-size: 1em;
    }
    
    .game-mode-selector {
        flex-direction: column;
        gap: 8px;
    }
    
    .mode-btn {
        padding: 8px 16px;
        font-size: 0.9em;
    }
    
    .multiplayer-info {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .player-info {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
        text-align: center;
    }
    
    .room-info {
        flex-direction: column;
        gap: 8px;
    }
    
    #roomCode {
        width: 100%;
        max-width: 200px;
    }
    
    #joinRoomBtn, #createRoomBtn {
        width: 100%;
        max-width: 150px;
    }
    
    .mobile-controls {
        display: flex !important;
    }
    
    .desktop-instruction {
        display: none !important;
    }
    
    .mobile-instruction {
        display: block !important;
    }
    
    .instructions {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    #gameCanvas {
        width: 280px;
        height: 280px;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3em;
    }
    
    .game-info {
        font-size: 1em;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .game-container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    #gameCanvas {
        width: 250px;
        height: 250px;
    }
    
    .mobile-controls {
        margin: 10px 0;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2em;
    }
    
    .instructions {
        font-size: 0.8em;
        margin-top: 10px;
    }
}