body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: 'Orbitron', 'Outfit', sans-serif;
    color: #fff;
    user-select: none;
}

#game-container {
    width: 100%;
    height: 100%;
}

.back-home-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    text-decoration: none;
    color: #00d2ff;
    font-weight: bold;
    font-size: 0.8rem;
    padding: 10px 15px;
    border: 1px solid rgba(0, 210, 255, 0.3);
    border-radius: 5px;
    backdrop-filter: blur(5px);
    z-index: 200;
    transition: all 0.3s;
    letter-spacing: 2px;
}

.back-home-btn:hover {
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
    transform: translateY(-2px);
}

#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
}

.score-container {
    font-size: 24px;
    font-weight: bold;
    color: #00d2ff;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
    margin-bottom: 10px;
}

.health-bar-bg {
    width: 200px;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

#health-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff0055, #ff00ff);
    transition: width 0.3s;
}

/* --- Stylish Volume Controller --- */
.volume-control {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 40px;
    border: 1px solid rgba(0, 210, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.1);
    pointer-events: auto;
    width: fit-content;
    transition: all 0.3s ease;
}

.volume-control:hover {
    border-color: rgba(0, 210, 255, 0.6);
    box-shadow: 0 0 25px rgba(0, 210, 255, 0.2);
}

.volume-control span {
    font-size: 0.7rem;
    font-weight: 800;
    color: #00d2ff;
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(0, 210, 255, 0.6);
}

.volume-control input[type="range"] {
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
    overflow: hidden;
}

/* Track styling for Webkit */
.volume-control input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Thumb styling for Webkit */
.volume-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid #00d2ff;
    border-radius: 4px;
    /* Power-cell shape */
    cursor: pointer;
    box-shadow: -100px 0 0 100px rgba(0, 210, 255, 0.8), 0 0 15px #00d2ff;
    margin-top: -5px;
    /* Centers thumb on track */
    transition: all 0.2s ease;
}

.volume-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: -100px 0 0 100px rgba(0, 210, 255, 1), 0 0 20px #00d2ff;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
}

h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #00d2ff, #fff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 12px;
    text-transform: uppercase;
    filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.5));
}

p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #636e72;
    line-height: 1.6;
}

.btn {
    padding: 15px 50px;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 3px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    background: #00d2ff;
    color: white;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn:hover {
    transform: scale(1.05);
}

.btn.glow {
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
}

.damage-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.3);
    pointer-events: none;
    z-index: 150;
    opacity: 0;
}

.heal-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 255, 170, 0.3);
    pointer-events: none;
    z-index: 150;
    opacity: 0;
}

.score-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 217, 0, 0.2);
    pointer-events: none;
    z-index: 150;
    opacity: 0;
}

.flash-active {
    animation: flash-anim 0.3s ease-out;
}

@keyframes flash-anim {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.leaderboard {
    margin-top: 20px;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    border-collapse: collapse;
}

.leaderboard th {
    color: #636e72;
    font-size: 0.9rem;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard td {
    padding: 8px 0;
    font-weight: 500;
}

.leaderboard .rank {
    color: #00d2ff;
    width: 40px;
}

.leaderboard .score {
    text-align: right;
}

/* Tutorial & Secondary Buttons */
.menu-btns {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-top: 10px;
}

.btn.secondary {
    background: transparent;
    border: 2px solid #00d2ff;
    color: #00d2ff;
    padding: 12px 30px;
    font-size: 1rem;
    font-family: 'Orbitron', sans-serif;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn.secondary:hover {
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
    transform: scale(1.05);
}

.tutorial-card {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 210, 255, 0.3);
    border-radius: 20px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 210, 255, 0.1);
    position: relative;
    padding-top: 50px;
}

.lang-switch {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-switch .divider {
    width: 1px;
    height: 15px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 5px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
}

.lang-btn.active {
    background: rgba(0, 210, 255, 0.2);
    border-color: #00d2ff;
    color: #00d2ff;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.tutorial-card h2 {
    font-family: 'Orbitron', sans-serif;
    color: #00d2ff;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.tutorial-card p {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 25px;
    line-height: 1.5;
}

.tutorial-media {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    border: 2px solid rgba(0, 210, 255, 0.2);
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    background: rgba(0, 210, 255, 0.05);
}

.tutorial-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.tut-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.tut-btn:hover {
    background: rgba(0, 210, 255, 0.2);
    border-color: #00d2ff;
}

.tut-btn.close {
    background: rgba(255, 0, 85, 0.2);
    border-color: #ff0055;
    color: #ff0055;
}

.tut-btn.close:hover {
    background: #ff0055;
    color: white;
}

.tut-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}


.tut-btn.action {
    background: #00d2ff;
    color: white;
    font-weight: 800;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.5);
    border: none;
    padding: 10px 25px;
}

.tut-btn.action:hover {
    background: #fff;
    color: #00d2ff;
    transform: scale(1.1);
}

.practice-prompt {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    padding: 20px 40px;
    border-radius: 10px;
    border-left: 5px solid #00d2ff;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 1000;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s;
}

.practice-prompt.hidden {
    opacity: 0;
}

.practice-success {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Much darker for contrast */
    border: 2px solid rgba(0, 255, 170, 0.3);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s;
}

.practice-success.hidden {
    opacity: 0;
    pointer-events: none;
}

.practice-success span {
    font-size: 5rem;
    font-weight: 900;
    color: #00ffaa;
    text-shadow: 0 0 20px #00ffaa, 0 0 40px #00ffaa;
    letter-spacing: 20px;
    transform: scale(0.8);
    animation: success-pulse 1s infinite alternate;
}

@keyframes success-pulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    100% {
        transform: scale(1.1);
        filter: brightness(1.5);
    }
}

/* --- Mobile Optimization (Moved to end to ensure override) --- */
@media screen and (max-width: 600px) {
    .back-home-btn {
        top: auto !important;
        bottom: 20px !important;
        right: 20px !important;
        font-size: 0.7rem;
        padding: 8px 12px;
    }

    h1 {
        font-size: 2rem;
        letter-spacing: 6px;
    }

    .score-container {
        font-size: 1.2rem;
    }

    .health-bar-bg {
        width: 150px;
    }

    .tutorial-nav {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tut-btn {
        padding: 8px 12px;
        font-size: 0.65rem;
    }

    .tut-btn.action {
        padding: 8px 15px;
        flex-basis: 100%;
        order: -1;
    }

    .practice-prompt {
        width: 80% !important;
        padding: 15px 20px !important;
        font-size: 0.9rem !important;
        text-align: center;
    }

    .practice-success span {
        font-size: 2.2rem !important;
        /* Smaller for narrow phones */
        letter-spacing: 3px !important;
        width: 100%;
        text-align: center;
    }
}