/* Colors and Constants */
:root {
    --bg-dark: #040914;
    --bg-vortex-center: #010307;
    --neon-cyan: #00f3ff;
    --neon-blue: #0066ff;
    --neon-green: #39ff14;
    --danger-red: #ff3366;
    --gold: #ffd700;
    --glass-bg: rgba(6, 18, 38, 0.65);
    --glass-border: rgba(0, 243, 255, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --font-primary: 'Outfit', sans-serif;
    --font-heading: 'Cinzel', serif;
}

/* Base resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-primary);
    color: #e0f2fe;
}

/* Main Container */
#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #0b2545 0%, #040914 100%);
}

/* Canvas stretching */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
}

/* HUD System */
#hud {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    gap: 15px;
    pointer-events: none;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 20px;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.hud-item {
    flex: 1;
    min-width: 100px;
}

.health-panel {
    flex: 2;
    max-width: 350px;
}

.hud-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: rgba(224, 242, 254, 0.6);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.hud-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

.health-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-top: 4px;
}

.health-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--neon-green) 0%, #00ffaa 100%);
    border-radius: 5px;
    box-shadow: 0 0 8px var(--neon-green);
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.health-bar-fill.warning {
    background: linear-gradient(90deg, #ff9900 0%, #ffcc00 100%);
    box-shadow: 0 0 8px #ff9900;
}

.health-bar-fill.critical {
    background: linear-gradient(90deg, var(--danger-red) 0%, #ff5e00 100%);
    box-shadow: 0 0 12px var(--danger-red);
}

/* Overlays (Start & Game Over Screens) */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 9, 20, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.glass-card {
    background: rgba(8, 22, 46, 0.75);
    border: 1px solid rgba(0, 243, 255, 0.25);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.15), var(--glass-shadow);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    padding: 40px 30px;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.overlay.active .glass-card {
    transform: translateY(0);
}

.game-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffffff 0%, #a5f3fc 50%, var(--neon-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.game-title.text-red {
    background: linear-gradient(135deg, #ffffff 0%, #fecdd3 50%, var(--danger-red) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(255, 51, 102, 0.3));
}

.game-tagline {
    font-size: 0.95rem;
    color: rgba(224, 242, 254, 0.7);
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Instructions */
.instructions-card, .stats-card {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.instruction-title {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--neon-cyan);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.instruction-list {
    list-style-type: none;
}

.instruction-list li {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: rgba(224, 242, 254, 0.85);
    display: flex;
    justify-content: space-between;
}

.instruction-list li strong {
    color: #ffffff;
}

/* Stats */
.stats-card {
    text-align: center;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.stat-row strong {
    color: var(--neon-cyan);
    font-family: var(--font-heading);
    font-size: 1.25rem;
}

/* Buttons */
.glow-btn {
    width: 100%;
    padding: 15px 30px;
    font-family: var(--font-primary);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--neon-blue) 0%, #0099ff 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 102, 255, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.2);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.glow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.6), 0 0 15px rgba(0, 243, 255, 0.4);
    background: linear-gradient(135deg, #0077ff 0%, var(--neon-cyan) 100%);
}

.glow-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(0, 102, 255, 0.4);
}

#game-over-screen .glow-btn {
    background: linear-gradient(135deg, var(--danger-red) 0%, #e11d48 100%);
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.4);
}

#game-over-screen .glow-btn:hover {
    background: linear-gradient(135deg, #f43f5e 0%, #ff5e00 100%);
    box-shadow: 0 6px 20px rgba(255, 51, 102, 0.6), 0 0 15px rgba(255, 94, 0, 0.4);
}

.restart-hint {
    margin-top: 15px;
    font-size: 0.8rem;
    color: rgba(224, 242, 254, 0.45);
}

.restart-hint span {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Mobile Input Controls */
#mobile-controls {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 15;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.touch-btn {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: rgba(8, 22, 46, 0.6);
    border: 2px solid rgba(0, 243, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.1);
    color: var(--neon-cyan);
    font-size: 1.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.1s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.touch-btn:active {
    background: rgba(0, 243, 255, 0.25);
    border-color: var(--neon-cyan);
    transform: scale(0.9);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.5);
}

.thrust-btn {
    width: auto;
    min-width: 120px;
    height: 65px;
    border-radius: 30px;
    font-size: 1rem;
    font-family: var(--font-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-color: rgba(57, 255, 20, 0.3);
    color: var(--neon-green);
    align-self: center;
}

.thrust-btn:active {
    background: rgba(57, 255, 20, 0.25);
    border-color: var(--neon-green);
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.5);
}

/* Responsiveness Settings */
@media (max-width: 768px) {
    #hud {
        top: 15px;
        gap: 8px;
    }
    
    .glass-panel {
        padding: 6px 12px;
    }
    
    .hud-label {
        font-size: 0.65rem;
        margin-bottom: 2px;
    }
    
    .hud-value {
        font-size: 1.15rem;
    }
    
    .health-bar-container {
        height: 8px;
    }
    
    .game-title {
        font-size: 1.8rem;
    }
    
    .game-tagline {
        font-size: 0.85rem;
    }
    
    .glass-card {
        padding: 30px 20px;
    }
    
    .instructions-card, .stats-card {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    /* Show mobile buttons on small screens */
    #mobile-controls {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Device Orientation / Landscape optimization for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #hud {
        top: 10px;
        width: 95%;
    }
    
    .glass-card {
        max-width: 600px;
        padding: 15px 30px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .game-title {
        width: 100%;
        margin-bottom: 5px;
        font-size: 1.6rem;
    }
    
    .game-tagline {
        width: 100%;
        margin-bottom: 10px;
        font-size: 0.8rem;
    }
    
    .instructions-card, .stats-card {
        width: 100%;
        margin-bottom: 10px;
        padding: 10px;
    }
    
    .glow-btn {
        width: auto;
        min-width: 200px;
        padding: 10px 20px;
    }
    
    #mobile-controls {
        bottom: 15px;
        padding: 0 15px;
    }
    
    .touch-btn {
        width: 60px;
        height: 60px;
        font-size: 1.4rem;
    }
    
    .thrust-btn {
        height: 50px;
    }
}
