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

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

.game-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.98);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    max-width: 95vw;
}

h1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.stat-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px;
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.stat-label {
    font-size: 0.75em;
    opacity: 0.9;
    display: block;
}

.stat-value {
    font-size: 1.3em;
    display: block;
    margin-top: 3px;
}

canvas {
    border: 4px solid #667eea;
    border-radius: 10px;
    background: #0f0f1e;
    display: block;
    margin: 15px auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    height: auto;
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1em;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

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

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

.mode-btn {
    padding: 8px 18px;
    font-size: 0.85em;
}

.mode-btn.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.settings-panel {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    text-align: left;
}

.setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 10px 0;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-switch.active {
    background: #667eea;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(24px);
}

.game-over, .level-up {
    display: none;
    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);
    z-index: 1000;
    text-align: center;
    max-width: 90vw;
}

.game-over.show, .level-up.show {
    display: block;
    animation: popIn 0.3s ease;
}

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

.leaderboard {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    margin: 5px 0;
    background: white;
    border-radius: 5px;
}

.power-up-indicator {
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: bold;
    display: none;
    margin: 10px auto;
}

.power-up-indicator.show {
    display: block;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.instructions {
    margin-top: 15px;
    color: #555;
    font-size: 0.85em;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .game-container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    canvas {
        width: 100%;
        height: auto;
    }
}