* {
    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('mitch-rosen-suPJtufIJtk-unsplashmed.png');
    background-size: cover;
    background-position: center;
    overflow: hidden;
    font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
    color: white;
}

/* Carnival Tent Styling */
.carnival-tent {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.tent-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: repeating-linear-gradient(90deg, 
        #e63946 0px, #e63946 40px, 
        #fff 40px, #fff 80px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    z-index: 15;
}

.tent-left-curtain, .tent-right-curtain {
    position: absolute;
    top: 40px;
    width: 80px;
    height: calc(100% - 40px);
    background: #e63946;
    z-index: 11;
}

.tent-left-curtain {
    left: 0;
    border-right: 10px solid #fff;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
}

.tent-right-curtain {
    right: 0;
    border-left: 10px solid #fff;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
}

.tent-left-curtain::after, .tent-right-curtain::after {
    content: '';
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg, 
        rgba(0, 0, 0, 0) 0px, rgba(0, 0, 0, 0) 20px, 
        rgba(0, 0, 0, 0.1) 20px, rgba(0, 0, 0, 0.1) 40px);
}

.tent-sign {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 101;
    background-color: #f1c453;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
    border: 5px solid #8b4513;
    pointer-events: none;
}

.tent-sign h1 {
    color: #8b4513;
    font-family: 'Copperplate', 'Papyrus', fantasy;
    font-size: 32px;
    text-align: center;
    text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.3);
    margin: 0;
    letter-spacing: 2px;
    white-space: nowrap;
}

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

/* HUD (Heads-Up Display) */
.hud {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 15px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.score, .timer {
    color: white;
    font-size: 24px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    background-color: rgba(139, 69, 19, 0.8);
    padding: 5px 15px;
    border-radius: 20px;
    border: 2px solid #f1c453;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

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

.hud-btn:hover {
    background-color: #ad2f39;
    transform: scale(1.05);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.6);
}

/* 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: 80px;
    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;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    /* Add carnival-inspired background pattern */
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 20%, transparent 20%),
                      radial-gradient(circle, rgba(255, 255, 255, 0.1) 20%, transparent 20%);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
}

.game-over, .pause-screen {
    display: none;
    z-index: 1010; /* Higher z-index to appear above tent elements */
}

.game-over h2, .pause-screen h2 {
    color: #f1c453;
    font-size: 2rem;
    margin-bottom: 30px;
}

#final-score {
    color: #ffdb7d;
    font-weight: bold;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
}

h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 3px 3px 5px rgba(0, 0, 0, 0.5);
    color: #f1c453;
    font-family: 'Copperplate', 'Papyrus', fantasy;
    letter-spacing: 2px;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #fff;
    text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
}

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

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

.difficulty-btn {
    background-color: #e63946;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    margin: 0 5px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    border: 2px solid white;
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
}

.difficulty-btn.active {
    background-color: #a63232;
    transform: translateY(1px);
}

.action-btn {
    background-color: #f1c453;
    color: #8b4513;
    border: none;
    border-radius: 30px;
    padding: 15px 30px;
    margin-top: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 3px solid #8b4513;
    font-family: 'Copperplate', 'Papyrus', fantasy;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.5);
    background-color: #ffdb7d;
}

#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 {
    position: relative;
    background-color: #e63946;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    border: 2px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
    cursor: pointer !important;
}

.back-to-library:hover {
    transform: scale(1.05);
    background-color: #ad2f39;
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.6);
}

.back-to-library a {
    color: white;
    text-decoration: none;
    display: block;
    font-size: 20px;
    cursor: pointer !important;
}

@media (max-width: 600px) {
    .back-to-library {
        padding: 3px 10px;
        font-size: 14px;
    }
    
    .hud {
        flex-wrap: wrap;
        justify-content: center;
        bottom: 10px;
        padding: 5px 10px;
        gap: 10px;
        width: 90%;
        max-width: 400px;
    }
    
    .difficulty-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }

    /* Mobile tent adjustments */
    .tent-left-curtain, .tent-right-curtain {
        width: 40px;
    }

    .tent-sign {
        top: 50px;
        padding: 10px 20px;
    }

    .tent-sign h1 {
        font-size: 24px;
    }

    .gun {
        bottom: 75px;
    }
}

/* 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 {
    bottom: 35px;
    padding: 2px 5px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
}

.mobile-device .score, 
.mobile-device .timer {
    font-size: 18px;
    padding: 2px 5px;
}

.mobile-device .hud-btn {
    font-size: 16px;
}

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

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

.mobile-device .tent-sign {
    top: 50px;
    font-size: 10px;
}

/* 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); }
}

.mobile-device .gun {
    bottom: 85px;
}
