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

body {
    font-family: 'Arial', sans-serif;
    background: #0a0a0a;
    color: #fff;
    overflow: hidden;
    cursor: default;
}

/* Global Header */
.global-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    z-index: 9999;
    border-bottom: 1px solid rgba(139, 0, 0, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

.logo-diamond {
    font-size: 2rem;
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.logo-text {
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #8b0000;
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* Landing Screen */
#landingScreen {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0000 100%);
    background-size: 400% 400%;
    animation: gradientShift 10s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.landing-container {
    text-align: center;
    max-width: 800px;
    padding: 20px;
}

.glitch-title {
    position: relative;
    margin-bottom: 20px;
}

.game-title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    color: #8b0000;
    text-shadow: 
        0 0 10px rgba(139, 0, 0, 0.8),
        0 0 20px rgba(139, 0, 0, 0.6),
        0 0 40px rgba(139, 0, 0, 0.4);
    letter-spacing: 8px;
    position: relative;
    animation: flicker 3s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    41%, 43% { opacity: 0.8; }
    45%, 47% { opacity: 0.9; }
    49%, 51% { opacity: 0.85; }
}

.game-tagline {
    font-size: 1.5rem;
    color: #fff;
    letter-spacing: 4px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.game-description {
    font-size: 1.1rem;
    color: #cbd5e1;
    margin-bottom: 40px;
    line-height: 1.6;
}

.leaderboard-preview {
    background: rgba(139, 0, 0, 0.1);
    border: 2px solid rgba(139, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin: 30px 0;
    backdrop-filter: blur(5px);
}

.leaderboard-preview h3 {
    color: #8b0000;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.leader-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leader-item {
    color: #cbd5e1;
    font-size: 1rem;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

.survive-btn {
    position: relative;
    padding: 20px 60px;
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #8b0000 0%, #ff0000 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(139, 0, 0, 0.6);
    letter-spacing: 3px;
}

.survive-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px rgba(255, 0, 0, 0.8);
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    animation: rotate 4s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.controls-hint {
    margin-top: 40px;
    color: #94a3b8;
    font-size: 0.9rem;
}

.controls-hint strong {
    color: #8b0000;
}

/* Game Screen */
#gameScreen {
    background: #000;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* HUD */
.hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.hud-top-left {
    position: absolute;
    top: 80px;
    left: 30px;
}

.hud-label {
    display: block;
    color: #8b0000;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-shadow: 0 0 5px rgba(139, 0, 0, 0.8);
}

.train-health-container {
    margin-bottom: 25px;
}

.health-bar {
    width: 250px;
    height: 30px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #8b0000;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.health-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff0000 0%, #8b0000 100%);
    transition: width 0.3s ease;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
}

.health-value {
    display: inline-block;
    margin-left: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
}

.score-container {
    margin-top: 15px;
}

.score-display {
    font-size: 2.5rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.powerup-container {
    margin-top: 20px;
}

.powerup-indicator {
    background: rgba(139, 0, 0, 0.9);
    border: 2px solid #ff8800;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ff8800;
    text-transform: uppercase;
    animation: powerupPulse 1s infinite;
    box-shadow: 0 0 20px rgba(255, 136, 0, 0.8);
}

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

.hud-top-right {
    position: absolute;
    top: 80px;
    right: 30px;
    text-align: right;
}

.distance-container {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #8b0000;
    border-radius: 10px;
    padding: 15px 25px;
    margin-bottom: 15px;
}

.distance-value {
    font-size: 3rem;
    font-weight: 900;
    color: #8b0000;
    text-shadow: 0 0 15px rgba(139, 0, 0, 0.8);
}

.distance-unit {
    font-size: 1.2rem;
    color: #cbd5e1;
    margin-left: 5px;
}

.flashlight-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

.flashlight-indicator span {
    font-size: 1.5rem;
}

.battery-bar {
    width: 100px;
    height: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #8b0000;
    border-radius: 3px;
    overflow: hidden;
}

.battery-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ffd700 0%, #ff8c00 100%);
    transition: width 0.3s ease;
}

/* Crosshair */
.crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

.crosshair-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: #8b0000;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(139, 0, 0, 0.8);
}

.crosshair-line {
    position: absolute;
    background: #8b0000;
    box-shadow: 0 0 3px rgba(139, 0, 0, 0.8);
}

.crosshair-top, .crosshair-bottom {
    width: 2px;
    height: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.crosshair-top { top: 0; }
.crosshair-bottom { bottom: 0; }

.crosshair-left, .crosshair-right {
    height: 2px;
    width: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.crosshair-left { left: 0; }
.crosshair-right { right: 0; }

/* Action Prompt */
.action-prompt {
    position: absolute;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(139, 0, 0, 0.9);
    border: 2px solid #8b0000;
    border-radius: 10px;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.8);
}

.action-prompt.show {
    opacity: 1;
}

/* Reload Indicator */
.reload-indicator {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
}

.reload-indicator.active {
    display: flex;
}

.reload-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #8b0000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hit Marker */
.hit-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    opacity: 0;
    pointer-events: none;
}

.hit-marker::before,
.hit-marker::after {
    content: '';
    position: absolute;
    background: #8b0000;
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.8);
}

.hit-marker::before {
    width: 30px;
    height: 4px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.hit-marker::after {
    width: 30px;
    height: 4px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
}

.hit-marker.show {
    opacity: 1;
    animation: hitMarkerFade 0.3s ease;
}

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

/* Damage Vignette */
.damage-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 30%, rgba(139, 0, 0, 0) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.damage-vignette.active {
    opacity: 1;
    background: radial-gradient(circle at center, transparent 30%, rgba(139, 0, 0, 0.6) 100%);
}

/* Game Over Screen */
#gameOverScreen {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0000 100%);
}

.gameover-container {
    text-align: center;
    max-width: 900px;
    padding: 20px;
}

.gameover-title {
    font-size: clamp(3rem, 10vw, 7rem);
    font-weight: 900;
    color: #8b0000;
    text-shadow: 
        0 0 20px rgba(139, 0, 0, 1),
        0 0 40px rgba(139, 0, 0, 0.8),
        0 0 60px rgba(139, 0, 0, 0.6);
    letter-spacing: 10px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

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

.death-message {
    font-size: 1.3rem;
    color: #cbd5e1;
    margin-bottom: 30px;
}

.final-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-label {
    font-size: 0.9rem;
    color: #8b0000;
    letter-spacing: 2px;
    font-weight: 700;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.gif-container {
    margin: 40px 0;
    border: 3px solid #8b0000;
    border-radius: 15px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
}

#gifCanvas {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 10px;
}

.gif-label {
    margin-top: 15px;
    color: #8b0000;
    font-weight: 700;
    letter-spacing: 2px;
}

.gameover-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 30px 0;
}

.btn-primary, .btn-secondary, .btn-tertiary {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, #8b0000 0%, #ff0000 100%);
    color: #fff;
    box-shadow: 0 5px 20px rgba(139, 0, 0, 0.6);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 0, 0, 0.8);
}

.btn-secondary {
    background: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);
    color: #fff;
    border: 2px solid #8b0000;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #2a2a2a 0%, #4a4a4a 100%);
    transform: translateY(-3px);
}

.btn-tertiary {
    background: transparent;
    color: #cbd5e1;
    border: 2px solid #cbd5e1;
}

.btn-tertiary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.share-options {
    margin-top: 30px;
    padding: 20px;
    background: rgba(139, 0, 0, 0.1);
    border: 2px solid rgba(139, 0, 0, 0.3);
    border-radius: 15px;
}

.share-options.hidden {
    display: none;
}

.share-options h3 {
    color: #8b0000;
    margin-bottom: 15px;
}

.share-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-btn.twitter {
    background: #1DA1F2;
    color: #fff;
}

.share-btn.discord {
    background: #5865F2;
    color: #fff;
}

.share-btn.reddit {
    background: #FF4500;
    color: #fff;
}

.share-btn.download {
    background: #2ecc71;
    color: #fff;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

/* Loading Screen */
#loadingScreen {
    background: #0a0a0a;
}

.loading-container {
    text-align: center;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 5px solid rgba(139, 0, 0, 0.3);
    border-top-color: #8b0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

.loading-text {
    font-size: 1.5rem;
    color: #8b0000;
    letter-spacing: 3px;
    animation: flicker 2s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .global-header {
        padding: 0 20px;
    }

    .nav-links {
        gap: 15px;
        font-size: 0.9rem;
    }

    .hud-top-left, .hud-top-right {
        top: 70px;
        left: 15px;
        right: 15px;
    }

    .health-bar {
        width: 180px;
    }

    .distance-value {
        font-size: 2rem;
    }

    .final-stats {
        flex-direction: column;
        gap: 20px;
    }

    .gameover-buttons {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary, .btn-tertiary {
        width: 100%;
    }
}

.hidden {
    display: none !important;
}
