@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;600;700&display=swap');

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #050505;
    font-family: 'Rajdhani', sans-serif;
    color: #fff;
}

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

/* Modern Tactical Crosshair */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
    transition: transform 0.1s ease-out;
}
#crosshair::before, #crosshair::after {
    content: '';
    position: absolute;
    background: #00ffcc;
    box-shadow: 0 0 5px #00ffcc;
}
#crosshair::before {
    top: 14px;
    left: 0;
    width: 30px;
    height: 2px;
}
#crosshair::after {
    top: 0;
    left: 14px;
    width: 2px;
    height: 30px;
}
#crosshair .dot {
    position: absolute;
    top: 13px;
    left: 13px;
    width: 4px;
    height: 4px;
    background: red;
    border-radius: 50%;
    box-shadow: 0 0 5px red;
}

/* Glassmorphism HUD Overlay */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: none;
}

/* Slanted Tactical Health/Armor Bars */
#top-left {
    position: absolute;
    bottom: 40px; /* Moved to bottom left like standard FPS */
    left: 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bar-container {
    width: 300px;
    height: 35px;
    background: rgba(10, 15, 25, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    transform: skewX(-15deg);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

#health-bar, #armor-bar {
    width: 100%;
    height: 100%;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: inset 0 0 10px rgba(255,255,255,0.3);
}

#health-bar {
    background: linear-gradient(90deg, #8b0000, #ff1a1a);
}

#armor-bar {
    background: linear-gradient(90deg, #004d99, #1a8cff);
}

.bar-text {
    position: absolute;
    top: 0;
    left: 15px;
    color: white;
    font-size: 24px;
    font-weight: 700;
    line-height: 35px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    transform: skewX(15deg); /* Counter skew */
    letter-spacing: 1px;
}

/* Top Center: Zone & Alive */
#top-center {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
}

.hud-panel {
    background: rgba(10, 15, 25, 0.8);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 25px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    border-top: 3px solid #00ffcc;
}

.hud-panel.warning {
    border-top: 3px solid #ff1a1a;
}

.hud-panel-title {
    font-size: 14px;
    color: #a0aab5;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.hud-panel-value {
    font-size: 32px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

#time-left { color: #ffcc00; text-shadow: 0 0 15px rgba(255,204,0,0.5); }
#alive-count { color: #00ffcc; text-shadow: 0 0 15px rgba(0,255,204,0.5); }

/* Top Right: Minimap */
#top-right {
    position: absolute;
    top: 30px;
    right: 40px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.minimap-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    padding: 5px;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(0,0,0,0.5));
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    margin-bottom: 20px;
}

#minimap {
    border-radius: 50%;
    background: rgba(4, 15, 26, 0.9);
    width: 100%;
    height: 100%;
}

/* Radar Sweep Effect */
.minimap-wrapper::after {
    content: '';
    position: absolute;
    top: 5px; left: 5px; right: 5px; bottom: 5px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 70%, rgba(0, 255, 204, 0.4) 100%);
    animation: radar-sweep 4s linear infinite;
    pointer-events: none;
}

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

#kill-feed {
    width: 250px;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kill-msg {
    background: linear-gradient(90deg, transparent, rgba(255, 26, 26, 0.4));
    padding: 5px 15px;
    border-right: 3px solid #ff1a1a;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    animation: slide-in 0.3s ease-out, fade-out 4s 3s forwards;
}

@keyframes slide-in {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fade-out {
    to { opacity: 0; transform: translateY(-10px); }
}

/* Bottom Right: Ammo */
#bottom-right {
    position: absolute;
    bottom: 40px;
    right: 40px;
}

#weapon-info {
    background: rgba(10, 15, 25, 0.85);
    padding: 15px 30px;
    border-radius: 8px 0 8px 8px;
    border-right: 4px solid #00ffcc;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    text-align: right;
    transform: skewX(-10deg);
}

#weapon-name {
    font-size: 18px;
    color: #a0aab5;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
    transform: skewX(10deg);
}

#ammo-count {
    font-size: 50px;
    font-weight: 700;
    color: #fff;
    transform: skewX(10deg);
    text-shadow: 0 0 15px rgba(255,255,255,0.5);
}

#ammo-count span {
    font-size: 24px;
    color: #6c7a89;
}

/* Damage Overlay */
#damage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 150px rgba(255,0,0,0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s;
    z-index: 5;
}

/* Start Screen (Cinematic) */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://images.unsplash.com/photo-1542640244-7e672d6cb466?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#start-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(5,10,20,0.4) 0%, rgba(5,10,20,0.95) 100%);
}

.menu-box {
    position: relative;
    background: rgba(10, 15, 25, 0.6);
    padding: 60px 80px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(0, 255, 204, 0.3);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 30px rgba(0,255,204,0.1);
    backdrop-filter: blur(15px);
    max-width: 600px;
}

.menu-box h1 {
    color: #fff;
    font-size: 64px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(0,255,204,0.6);
}

.menu-box h1 span {
    color: #00ffcc;
}

.menu-box p {
    color: #a0aab5;
    font-size: 20px;
    margin-bottom: 40px;
    letter-spacing: 1px;
}

#player-name {
    padding: 15px 25px;
    font-size: 22px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.5);
    color: white;
    margin-bottom: 30px;
    width: 100%;
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#player-name:focus {
    border-color: #00ffcc;
    box-shadow: 0 0 15px rgba(0,255,204,0.3);
}

#btn-start {
    padding: 20px 0;
    font-size: 32px;
    background: #00ffcc;
    color: #050a14;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 0 20px rgba(0,255,204,0.4);
}

#btn-start:hover {
    background: #fff;
    box-shadow: 0 0 30px rgba(255,255,255,0.8);
    transform: translateY(-3px);
}

.instructions {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    text-align: left;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
}

.instructions-block h3 {
    color: #00ffcc;
    font-size: 16px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.instructions-block p {
    color: #6c7a89;
    font-size: 16px;
    margin-bottom: 5px;
}

/* Mobile Controls Update */
#mobile-controls {
    display: none;
}
.joystick {
    position: absolute;
    bottom: 50px;
    left: 50px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    pointer-events: auto;
    backdrop-filter: blur(5px);
}
.joystick .knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.6);
}
#mobile-buttons {
    position: absolute;
    bottom: 50px;
    right: 50px;
    display: flex;
    gap: 20px;
    pointer-events: auto;
}
.action-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(10,15,25,0.6);
    border: 2px solid rgba(0,255,204,0.5);
    color: #00ffcc;
    font-weight: 700;
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    backdrop-filter: blur(5px);
}
.action-btn.large {
    width: 100px;
    height: 100px;
    font-size: 24px;
    background: rgba(255,26,26,0.3);
    border-color: #ff1a1a;
    color: #fff;
    box-shadow: 0 0 20px rgba(255,26,26,0.4);
}
.action-btn:active {
    transform: scale(0.9);
}

/* Responsive / Mobile View Overhaul */
@media (max-width: 900px), (max-height: 600px) {
    /* Reset transforms from previous attempts if any */
    #top-left, #top-right, #top-center, #bottom-right {
        transform: none !important;
    }

    /* Zone & Alive -> Move to Top Left */
    #top-center {
        top: 10px;
        left: 10px;
        transform: none !important;
        flex-direction: row; /* Side by side */
        gap: 5px;
    }
    .hud-panel {
        padding: 5px 10px;
    }
    .hud-panel-title {
        font-size: 10px;
        margin-bottom: 0;
    }
    .hud-panel-value {
        font-size: 18px;
    }

    /* Minimap & Kills -> Top Right */
    #top-right {
        top: 10px;
        right: 10px;
        transform: none !important;
    }
    .minimap-wrapper {
        width: 90px;
        height: 90px;
        margin-bottom: 5px;
    }
    #kill-counter {
        padding: 2px 10px !important;
    }
    #kills {
        font-size: 18px !important;
    }

    /* Weapon Info -> Move to right side, above fire button */
    #bottom-right {
        bottom: 130px;
        right: 10px;
        transform: none !important;
    }
    #weapon-info {
        padding: 5px 15px;
    }
    #weapon-name {
        font-size: 12px;
    }
    #ammo-count {
        font-size: 24px;
    }
    #ammo-count span {
        font-size: 14px;
    }

    /* Health & Armor -> Move to Top Center below top left/right */
    #top-left {
        top: 70px;
        left: 10px;
        transform: none !important;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    .bar-container {
        width: 150px;
        height: 18px;
    }
    .bar-text {
        font-size: 12px;
        line-height: 18px;
        left: 10px;
    }

    /* Start screen */
    .menu-box {
        padding: 20px;
        width: 95%;
    }
    .menu-box h1 {
        font-size: 32px;
    }
    .menu-box p {
        font-size: 14px;
        margin-bottom: 20px;
    }
    #player-name {
        font-size: 16px;
        padding: 10px;
        margin-bottom: 15px;
    }
    #btn-start {
        font-size: 22px;
        padding: 15px 0;
    }
    .instructions-block h3 {
        font-size: 14px;
    }
    .instructions-block p {
        font-size: 12px;
    }

    /* Mobile Controls */
    #mobile-controls {
        display: block !important;
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        z-index: 50; /* Above HUD */
    }

    .joystick {
        bottom: 30px;
        left: 20px;
        width: 100px;
        height: 100px;
    }
    .joystick .knob {
        width: 40px;
        height: 40px;
    }

    #mobile-buttons {
        bottom: 30px;
        right: 20px;
        gap: 15px;
    }

    .action-btn {
        width: 55px;
        height: 55px;
        font-size: 14px;
    }
    .action-btn.large {
        width: 75px;
        height: 75px;
        font-size: 18px;
    }
}
