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

body {
    background-color: #1a1a1a;
    background-image: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('https://images.unsplash.com/photo-1572507013703-f0b7e472dbdf?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    overflow: hidden;
    font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
    color: white;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    perspective: 1000px;
    transform-style: preserve-3d;
}

/* HUD (Heads-Up Display) */
.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 20px;
    z-index: 100;
}

.score, .timer {
    color: white;
    font-size: 24px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.hud-btn {
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 5px 15px;
    font-size: 20px;
    cursor: pointer !important; /* Force pointer cursor */
    transition: all 0.2s;
}

.hud-btn:hover {
    background-color: rgba(0, 0, 0, 0.7);
    transform: scale(1.05);
}

/* Ensure buttons always show the pointer cursor, even in game mode */
button {
    cursor: pointer !important;
}

.targets-container {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.target {
    position: absolute;
    width: 100px;
    height: 100px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform-style: preserve-3d;
    transition: transform 0.1s;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
}

.target.legitimate {
    background-image: url('target.svg');
}

.target.innocent {
    background-image: url('bystander.svg');
}

/* Score popup animation */
.score-popup {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 200;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

.score-popup.positive {
    color: #4CAF50;
}

.score-popup.negative {
    color: #F44336;
}

.gun {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 150px;
    transform-style: preserve-3d;
    z-index: 900;
}

.gun-barrel {
    position: absolute;
    width: 20px;
    height: 150px;
    background: linear-gradient(to right, #333, #666, #333);
    border: 2px solid #222;
    border-radius: 10px;
    bottom: 0;
    left: 50%;
    transform-origin: bottom center;
    transform: translateX(-50%) rotateX(60deg);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
}

/* Gun base */
.gun::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 60px;
    background: linear-gradient(to right, #333, #666, #333);
    border: 2px solid #222;
    border-radius: 10px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
}

/* Custom cursor approach - only for desktop */
@media (hover: hover) and (pointer: fine) {
    .game-active {
        cursor: crosshair;
        cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="18" fill="rgba(255,0,0,0.1)" stroke="rgba(255,0,0,0.8)" stroke-width="3"/><line x1="20" y1="0" x2="20" y2="40" stroke="rgba(255,0,0,0.8)" stroke-width="3"/><line x1="0" y1="20" x2="40" y2="20" stroke="rgba(255,0,0,0.8)" stroke-width="3"/></svg>') 20 20, crosshair;
    }
    
    /* Hide the crosshair element on desktop since we use cursor */
    .game-active .crosshair {
        display: none !important;
    }
}

/* Crosshair styling */
.crosshair {
    position: fixed; /* Use fixed instead of absolute for better mobile positioning */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 0, 0, 0.8);
    background-color: rgba(255, 0, 0, 0.1);
    pointer-events: none;
    z-index: 1000;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Crosshair lines */
.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background-color: rgba(255, 0, 0, 0.8);
    margin: 0;
    padding: 0;
}

.crosshair::before {
    width: 3px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.crosshair::after {
    width: 100%;
    height: 3px;
    top: 50%;
    transform: translateY(-50%);
}

/* Make crosshair more visible on mobile */
.mobile-device .crosshair {
    width: 60px;
    height: 60px;
    border-width: 3px;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.bullet {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: yellow;
    border: 2px solid orange;
    border-radius: 50%;
    transform-style: preserve-3d;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 10px yellow;
}

@keyframes bulletTrail {
    from { transform: translateZ(0) scale(1); opacity: 1; }
    to { transform: translateZ(-500px) scale(0.5); opacity: 0; }
}

@keyframes moveLeft {
    from { transform: translateX(110vw) translateZ(-500px); }
    to { transform: translateX(-10vw) translateZ(-500px); }
}

@keyframes moveRight {
    from { transform: translateX(-10vw) translateZ(-500px); }
    to { transform: translateX(110vw) translateZ(-500px); }
}

.hit-effect {
    position: absolute;
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 0, 0.7);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 200;
    box-shadow: 0 0 20px yellow, inset 0 0 10px red;
}

.hit-effect.innocent-hit {
    background-color: rgba(255, 0, 0, 0.7);
    box-shadow: 0 0 20px red, inset 0 0 10px darkred;
}

/* Game screens */
.start-screen, .game-over, .pause-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    text-align: center;
    gap: 20px;
}

.game-over, .pause-screen {
    display: none; /* Hidden by default */
}

h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

h2 {
    font-size: 24px;
    margin-bottom: 15px;
    color: white;
}

.difficulty-selector {
    margin: 20px 0;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.difficulty-btn {
    padding: 10px 20px;
    font-size: 18px;
    background-color: #555;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.difficulty-btn:hover {
    background-color: #777;
}

.difficulty-btn.active {
    background-color: #4CAF50;
}

.action-btn {
    padding: 15px 30px;
    font-size: 24px;
    background-color: #F44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.action-btn:hover {
    background-color: #D32F2F;
    transform: scale(1.05);
}

#start-btn {
    background-color: #4CAF50;
}

#start-btn:hover {
    background-color: #388E3C;
}

#resume-btn {
    background-color: #2196F3;
}

#resume-btn:hover {
    background-color: #1976D2;
}


.back-to-library {
    display: block;
    padding: 10px;
    background-color: #d32f2f;
    border: 2px solid #fff;
    border-radius: 20px;
    position: fixed;
    top: 20px;
    right: 20px;
}
.back-to-library a {
    color: #fff;
    text-decoration: none;
}
@media (max-width: 600px) {
    .back-to-library {
        font-size: 14px;
        padding: 4px 8px;
        top:auto;
        bottom: 100px;
    }
}

/* Touch Instructions Overlay */
.touch-instructions {
    position: fixed;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 18px;
    z-index: 1000;
    text-align: center;
    transition: opacity 1s ease-out;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

/* Mobile device specific styles */
.mobile-device .hud {
    top: 10px;
    left: 10px;
    gap: 10px;
}

.mobile-device .score, 
.mobile-device .timer {
    font-size: 20px;
    padding: 4px 12px;
}

.mobile-device .hud-btn {
    font-size: 18px;
    padding: 4px 12px;
}

.mobile-device .back-to-library {
    font-size: 14px;
    padding: 4px 8px;
}

.mobile-device .target {
    width: 80px;
    height: 80px;
}

/* Make buttons bigger on mobile for better touch targets */
.mobile-device .action-btn,
.mobile-device .difficulty-btn {
    padding: 15px 30px;
    font-size: 20px;
    margin: 5px;
}

/* Adjust difficulty buttons layout for smaller screens */
@media (max-width: 600px) {
    .difficulty-buttons {
        flex-direction: column;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
}

/* Orientation overlay for mobile devices */
.orientation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.orientation-message {
    text-align: center;
    color: white;
    padding: 20px;
    max-width: 80%;
}

.rotate-icon {
    font-size: 4rem;
    animation: rotate 2s infinite linear;
    margin-bottom: 20px;
}

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