* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
    touch-action: none;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        overflow: hidden;
    }
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    position: relative;
}

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
        border-radius: 10px;
        max-width: 100%;
    }
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    color: #333;
    margin-bottom: 15px;
    font-size: 2em;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.3em;
        margin-bottom: 10px;
    }
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 10px;
}

.stat {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
}

@media (max-width: 768px) {
    .stats {
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .stat {
        padding: 8px 12px;
        font-size: 0.9em;
        flex: 1;
        min-width: 80px;
    }
}

.stat .label {
    margin-right: 8px;
    opacity: 0.9;
}

#gameCanvas {
    display: block;
    border: 3px solid #667eea;
    border-radius: 10px;
    background: #000;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

@media (max-width: 768px) {
    #gameCanvas {
        border-width: 2px;
        border-radius: 8px;
        width: 100% !important;
        height: auto !important;
    }
}

.controls {
    text-align: center;
    margin-top: 20px;
    color: #555;
}

.controls p {
    margin-bottom: 15px;
    font-size: 0.95em;
}

@media (max-width: 768px) {
    .controls {
        margin-top: 10px;
    }
    
    .controls p {
        font-size: 0.8em;
        margin-bottom: 10px;
    }
}

.controls button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    margin: 5px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    z-index: 1000;
}

.game-over h2 {
    color: #764ba2;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.game-over p {
    font-size: 1.5em;
    margin-bottom: 30px;
    color: #333;
}

.game-over-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.game-over button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    flex: 1;
    min-width: 150px;
}

.game-over button:hover {
    transform: scale(1.05);
}

.hidden {
    display: none;
}

/* Leaderboard */
.leaderboard {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    z-index: 1002;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.leaderboard h2 {
    color: #764ba2;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.leaderboard-loading,
.leaderboard-empty {
    padding: 40px;
    color: #666;
    font-size: 1.2em;
}

.leaderboard-list {
    margin: 20px 0;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 60px 1fr 120px;
    align-items: center;
    padding: 15px 20px;
    margin: 8px 0;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid transparent;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.leaderboard-entry.top-three {
    background: linear-gradient(135deg, #fff9e6, #ffe6cc);
    border-left-color: #ffa500;
    font-weight: bold;
}

.leaderboard-entry.top-three:first-child {
    background: linear-gradient(135deg, #fffacd, #ffd700);
    border-left-color: #ffd700;
}

.leaderboard-rank {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

.leaderboard-entry.top-three .leaderboard-rank {
    color: #ff8c00;
}

.leaderboard-name {
    text-align: left;
    font-size: 1.1em;
    color: #333;
    padding-left: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-score {
    font-size: 1.3em;
    font-weight: bold;
    color: #764ba2;
    text-align: right;
}

.leaderboard button {
    margin-top: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.leaderboard button:hover {
    transform: scale(1.05);
}

.player-setup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    z-index: 1001;
    border: 2px solid #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    min-width: 400px;
}

.player-setup h2 {
    margin-top: 0;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.player-setup .form-group {
    margin: 20px 0;
    text-align: left;
}

.player-setup label {
    display: block;
    margin-bottom: 8px;
    color: #00ffff;
    font-weight: bold;
}

.player-setup input[type="text"],
.player-setup select {
    width: 100%;
    padding: 12px;
    border: 2px solid #00ffff;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}

.player-setup input[type="text"]:focus,
.player-setup select:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.player-setup button[type="submit"] {
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 18px;
    background: linear-gradient(135deg, #00ffff, #0088ff);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.player-setup button[type="submit"]:hover {
    background: linear-gradient(135deg, #00ffff, #00aaff);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.7);
    transform: scale(1.05);
}

/* Mobile controls */
.mobile-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    pointer-events: none;
}

.mobile-shoot-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e8f4f8, #d0e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(200, 220, 255, 0.6), 
                0 0 30px rgba(255, 255, 255, 0.4),
                inset 0 0 20px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
    border: 3px solid rgba(255, 255, 255, 0.8);
    position: relative;
    animation: snowflakeGlow 2s ease-in-out infinite;
}

.mobile-shoot-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(200, 220, 255, 0.8),
                0 0 40px rgba(255, 255, 255, 0.6);
    filter: brightness(1.2);
}

.mobile-shoot-btn:active span {
    transform: scale(0.85);
}

.mobile-shoot-btn span {
    font-size: 32px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8))
            drop-shadow(0 0 4px rgba(200, 220, 255, 0.6));
    animation: snowflakeSparkle 1.5s ease-in-out infinite;
    transition: transform 0.1s ease-out;
}

@keyframes snowflakeGlow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(200, 220, 255, 0.6), 
                    0 0 30px rgba(255, 255, 255, 0.4),
                    inset 0 0 20px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(200, 220, 255, 0.8), 
                    0 0 40px rgba(255, 255, 255, 0.6),
                    inset 0 0 25px rgba(255, 255, 255, 0.4);
    }
}

@keyframes snowflakeSparkle {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8))
                drop-shadow(0 0 4px rgba(200, 220, 255, 0.6));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 12px rgba(255, 255, 255, 1))
                drop-shadow(0 0 8px rgba(200, 220, 255, 0.8));
    }
}

@media (max-width: 768px) {
    .mobile-controls {
        bottom: 15px;
        right: 15px;
    }
    
    .mobile-shoot-btn {
        width: 60px;
        height: 60px;
    }
    
    .mobile-shoot-btn span {
        font-size: 28px;
    }
    
    .player-setup {
        min-width: 90%;
        max-width: 400px;
        padding: 30px 20px;
    }
    
    .player-setup h2 {
        font-size: 1.3em;
    }
    
    .game-over {
        min-width: 90%;
        max-width: 400px;
        padding: 30px 20px;
    }
    
    .game-over h2 {
        font-size: 1.8em;
    }
    
    .game-over p {
        font-size: 1.2em;
    }
    
    .game-over-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-over button {
        min-width: 100%;
        padding: 12px 30px;
        font-size: 1em;
    }
    
    .leaderboard {
        min-width: 90%;
        max-width: 500px;
        padding: 30px 20px;
    }
    
    .leaderboard h2 {
        font-size: 1.8em;
    }
    
    .leaderboard-entry {
        grid-template-columns: 50px 1fr 100px;
        padding: 12px 15px;
        font-size: 0.9em;
    }
    
    .leaderboard-rank {
        font-size: 1.1em;
    }
    
    .leaderboard-name {
        font-size: 1em;
        padding-left: 10px;
    }
    
    .leaderboard-score {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .mobile-shoot-btn {
        width: 55px;
        height: 55px;
    }
    
    .mobile-shoot-btn span {
        font-size: 24px;
    }
    
    .stats {
        gap: 5px;
    }
    
    .stat {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

