/* ==========================================================================
   Neon Rider - Stylesheet
   ========================================================================== */

:root {
    --bg-color: #03030f;
    --panel-bg: rgba(10, 10, 30, 0.6);
    --panel-border: rgba(0, 242, 254, 0.2);
    --neon-cyan: #00f2fe;
    --neon-magenta: #ff007f;
    --neon-yellow: #fefe00;
    --neon-green: #39ff14;
    --text-color: #e0e0ff;
    --font-primary: 'Rajdhani', sans-serif;
    --font-mono: 'Orbitron', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Container */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Game Canvas */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Glassmorphism Panel base */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* HUD Overlay */
#hud {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    height: 60px;
    z-index: 10;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-family: var(--font-mono);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-item .label {
    font-size: 0.7rem;
    color: rgba(224, 224, 255, 0.6);
    letter-spacing: 2px;
    margin-bottom: 2px;
}

.hud-item .value {
    font-size: 1.3rem;
    font-weight: 700;
}

/* Neon Glows */
.glow-cyan {
    text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px rgba(0, 242, 254, 0.5);
    color: var(--neon-cyan);
}

.glow-magenta {
    text-shadow: 0 0 10px var(--neon-magenta), 0 0 20px rgba(255, 0, 127, 0.5);
    color: var(--neon-magenta);
}

.glow-text {
    text-shadow: 0 0 15px var(--neon-cyan), 0 0 30px rgba(0, 242, 254, 0.6);
    color: #fff;
}

/* Hearts / Power */
#hearts {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.heart {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.15);
    text-shadow: none;
    transition: all 0.3s ease;
}

.heart.active {
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow), 0 0 20px rgba(254, 254, 0, 0.8);
    transform: scale(1.1);
}

/* Screens / Overlays */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(3, 3, 15, 0.85);
    padding: 20px;
    transition: opacity 0.5s ease;
}

.overlay-screen.active {
    display: flex;
}

.screen-content {
    max-width: 500px;
    width: 100%;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    animation: slideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideIn {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.screen-content h1 {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    margin-bottom: 5px;
}

.screen-content h2 {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--neon-magenta);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 6px;
    margin-bottom: 25px;
    text-shadow: 0 0 8px rgba(255, 0, 127, 0.4);
}

.instructions {
    text-align: left;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.instructions h3 {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--neon-cyan);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.instructions ul {
    list-style: none;
    margin-bottom: 12px;
}

.instructions li {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.key {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-right: 10px;
    font-weight: bold;
}

.item {
    font-size: 1.1rem;
    margin-right: 10px;
    display: inline-block;
    width: 24px;
    text-align: center;
}

.goal {
    color: var(--neon-yellow);
    text-align: center;
    font-weight: 700;
    margin-top: 10px;
}

/* Result Box */
.result-box {
    margin: 20px 0 30px;
    background: rgba(0, 242, 254, 0.05);
    border: 1px dashed var(--neon-cyan);
    border-radius: 8px;
    padding: 15px;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.res-label {
    font-size: 0.8rem;
    color: rgba(224, 224, 255, 0.6);
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.res-value {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 900;
}

.reason {
    color: var(--neon-magenta);
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

/* Buttons */
.action-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
}

.glow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.6), 0 0 40px rgba(255, 0, 127, 0.4);
}

.action-btn:active {
    transform: translateY(1px);
}

/* Sound Toggle */
#sound-toggle {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    z-index: 15;
    cursor: pointer;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

#sound-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

/* On-Screen D-Pad Controls */
#controls-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    display: none; /* Only shown on mobile/touch interfaces */
}

.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 140px;
    height: 140px;
}

.dpad-middle-row {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

.dpad-center {
    width: 44px;
    height: 44px;
    background: rgba(10, 10, 30, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
}

.ctrl-btn {
    width: 44px;
    height: 44px;
    background: rgba(10, 10, 30, 0.8);
    border: 1.5px solid var(--neon-cyan);
    border-radius: 8px;
    color: var(--neon-cyan);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.1s ease;
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.2);
}

.ctrl-btn:active, .ctrl-btn.active {
    background: var(--neon-cyan);
    color: #000;
    box-shadow: 0 0 15px var(--neon-cyan);
    transform: scale(0.95);
}

#btn-up, #btn-down {
    margin: 2px 0;
}

/* Touch Detection Show Controls */
.touch-device #controls-container {
    display: block;
}

.touch-device #hud {
    top: 10px;
    height: 50px;
    padding: 0 15px;
}

.touch-device .hud-item .value {
    font-size: 1.1rem;
}

/* Landscape Mode Check and Adjustments */
@media (max-height: 500px) {
    #hud {
        top: 10px;
        height: 50px;
    }
    
    #controls-container {
        bottom: 10px;
        left: 10px;
    }
    
    .dpad {
        width: 120px;
        height: 120px;
    }
    
    .ctrl-btn {
        width: 38px;
        height: 38px;
    }
    
    .dpad-center {
        width: 38px;
        height: 38px;
    }
}

#back-to-portal {
    position: absolute;
    bottom: 15px;
    left: 15px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    z-index: 15;
    cursor: pointer;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

#back-to-portal:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}
