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

body {
    font-family: 'Outfit', 'Inter', 'Segoe UI', sans-serif;
    background: #000;
    color: white;
    overflow: hidden;
    position: relative;
    width: 100vw;
    height: 100vh;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

.hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hud > * {
    pointer-events: auto;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Changed from flex-start to align with powerups */
    padding: 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
}

.game-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 18px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    min-width: 90px;
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    border-color: rgba(78, 205, 196, 0.5);
}

.stat-label {
    font-size: 0.8em;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.4em;
    font-weight: bold;
    color: #4ecdc4;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
    transition: all 0.3s ease;
}

.stat-value.combo-active {
    color: #ff6b6b;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.8);
    transform: scale(1.2);
}

.powerup-status {
    display: flex;
    gap: 10px;
    align-items: center;
}

.powerup-pill {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
    animation: fadeIn 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

.powerup-pill.shield { background: rgba(78, 205, 196, 0.3); color: #4ecdc4; border-color: #4ecdc4; }
.powerup-pill.rapid { background: rgba(255, 107, 107, 0.3); color: #ff6b6b; border-color: #ff6b6b; }
.powerup-pill.multi { background: rgba(255, 217, 61, 0.3); color: #ffd93d; border-color: #ffd93d; }
.powerup-pill.time { background: rgba(149, 231, 126, 0.3); color: #95e77e; border-color: #95e77e; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hud-buttons {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(78, 205, 196, 0.3);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.icon-btn:hover {
    background: rgba(78, 205, 196, 0.3);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.5);
}

.hud-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
}

.controls-hint {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: #aaa;
    justify-content: center;
}

.controls-hint span {
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 15px;
    border: 1px solid rgba(78, 205, 196, 0.3);
    backdrop-filter: blur(10px);
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 10, 10, 0.9);
    padding: 50px;
    border-radius: 40px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    text-align: center;
    z-index: 1000;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.8), 0 0 50px rgba(255, 107, 107, 0.1);
    min-width: 450px;
    backdrop-filter: blur(30px);
    animation: gameOverPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes gameOverPop {
    from { opacity: 0; transform: translate(-50%, -40%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.game-over-content h2 {
    color: #ff6b6b;
    font-size: 2.5em;
    margin-bottom: 25px;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.final-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.final-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.final-label {
    color: #aaa;
    font-size: 1em;
}

.final-value {
    color: #4ecdc4;
    font-size: 1.3em;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.new-high-score .final-label {
    color: #ffd93d;
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(255, 217, 61, 0.8);
}

.new-high-score .final-value {
    color: #ffd93d;
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(255, 217, 61, 0.8);
    animation: pulse 1s ease-in-out infinite;
}

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

.game-over-buttons {
    display: flex;
    justify-content: center;
}

.action-btn {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

.settings-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    background: rgba(15, 15, 25, 0.85);
    padding: 40px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    z-index: 1000;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    min-width: 400px;
    backdrop-filter: blur(25px);
    animation: panelPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes panelPop {
    from { opacity: 0; transform: translate(-50%, -45%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.settings-content h3 {
    color: #fff;
    font-size: 2em;
    font-weight: 800;
    margin-bottom: 30px;
    letter-spacing: -0.5px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.setting-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.setting-item label {
    color: #eee;
    font-size: 0.95em;
    font-weight: 500;
}

/* Styled Range Input */
input[type="range"] {
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #4ecdc4;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Styled Select */
.setting-item select {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9em;
    outline: none;
    cursor: pointer;
}

/* Styled Checkbox as Toggle Switch */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

input[type="checkbox"]:checked {
    background: #4ecdc4;
}

input[type="checkbox"]::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

input[type="checkbox"]:checked::after {
    transform: translateX(20px);
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .hud-top, .hud-bottom {
        padding: 15px;
    }
    
    .game-stats {
        gap: 10px;
    }
    
    .stat-item {
        min-width: 60px;
        padding: 8px 12px;
    }
    
    .controls-hint {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .controls-hint span {
        font-size: 0.8em;
        padding: 6px 10px;
    }
    
    .final-stats {
        gap: 10px;
    }
}