:root {
    --bg-color: #0b0e14;
    --primary-color: #ff9d00;
    --primary-dark: #b87100;
    --accent-color: #00ffaa;
    --danger-color: #ff3333;
    --text-main: #ffffff;
    --text-dim: #a0aab5;
    --hud-bg: rgba(11, 14, 20, 0.7);
    --hud-border: rgba(255, 255, 255, 0.1);
    
    --font-heading: 'Teko', sans-serif;
    --font-body: 'Roboto', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* Prevent text selection */
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: var(--font-body);
    color: var(--text-main);
    touch-action: none; /* Prevent default touch actions like pinch zoom on mobile */
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background-color: #000;
}

/* Tactical Visor Overlay */
#game-container::after {
    content: '';
    position: absolute;
    top:0; left:0; width:100%; height:100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    z-index: 10;
    box-shadow: inset 0 0 150px rgba(0,255,170,0.1);
}

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

/* ------------------- DAMAGE OVERLAY ------------------- */
#damage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    box-shadow: inset 0 0 100px rgba(255, 0, 0, 0);
    transition: box-shadow 0.2s ease;
}

#damage-overlay.active {
    box-shadow: inset 0 0 100px rgba(255, 0, 0, 0.8);
    animation: pulseDamage 0.5s infinite alternate;
}

@keyframes pulseDamage {
    from { box-shadow: inset 0 0 80px rgba(255, 0, 0, 0.5); }
    to { box-shadow: inset 0 0 150px rgba(255, 0, 0, 0.9); }
}

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

#hud.hidden {
    display: none;
}

#hud-top {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

#player-count {
    background: var(--hud-bg);
    border: 1px solid var(--hud-border);
    padding: 10px 20px;
    border-radius: 4px;
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.hud-label {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text-dim);
    line-height: 1;
}

#alive-val {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--text-main);
    line-height: 1;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

/* MINIMAP */
#minimap-container {
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--hud-border);
    border-radius: 50%; /* Circular Minimap */
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.8), inset 0 0 15px rgba(0,0,0,0.8);
}

#minimapCanvas {
    width: 100%;
    height: 100%;
}

/* BOTTOM LEFT (Health) */
#hud-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#health-bar-container {
    width: 250px;
    height: 20px;
    background: rgba(0,0,0,0.6);
    border: 2px solid var(--hud-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

#health-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #00ffaa, #00b377);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(0, 255, 170, 0.5);
}

.hud-stats {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px #000;
}

.hud-kills {
    color: var(--primary-color);
}

/* BOTTOM RIGHT (Weapon) */
#hud-bottom-right {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--hud-bg);
    border: 1px solid var(--hud-border);
    backdrop-filter: blur(5px);
    border-radius: 8px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.7);
}

#weapon-info {
    text-align: right;
}

#weapon-name {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--text-dim);
    line-height: 1;
}

#ammo-count {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    line-height: 1;
    color: var(--text-main);
}

#ammo-max {
    font-size: 1.5rem;
    color: var(--text-dim);
}

#weapon-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.3));
}

/* ZONE WARNING */
#zone-warning {
    position: absolute;
    top: 150px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-heading);
    color: var(--danger-color);
    font-size: 3rem;
    text-transform: uppercase;
    text-shadow: 0 0 20px var(--danger-color);
    opacity: 0;
    transition: opacity 0.3s;
}

#zone-warning.active {
    opacity: 1;
    animation: blinkText 1s infinite alternate;
}

@keyframes blinkText {
    from { opacity: 1; }
    to { opacity: 0.3; }
}

/* ------------------- MOBILE CONTROLS ------------------- */
#mobile-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    pointer-events: none; /* Let touches pass through where no buttons exist */
}
#mobile-controls:not(.hidden) {
    display: block; /* Shown only on mobile devices */
}

/* Joystick */
#joystick-left {
    position: absolute;
    bottom: 50px;
    left: 50px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    pointer-events: auto;
    display: none; /* hidden by default, shown via JS if touch detected */
}

.joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    pointer-events: none;
}

#action-buttons {
    position: absolute;
    bottom: 50px;
    right: 50px;
    pointer-events: auto;
    display: none;
}

.action-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 157, 0, 0.4);
    border: 2px solid var(--primary-color);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(255, 157, 0, 0.3);
    outline: none;
}
.action-btn:active {
    background: rgba(255, 157, 0, 0.7);
    transform: scale(0.95);
}

/* ------------------- UI SCREENS (Menus) ------------------- */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    background: rgba(11, 14, 20, 0.85); /* Dark blur background */
    backdrop-filter: blur(10px);
    transition: opacity 0.3s;
    opacity: 0;
    visibility: hidden;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}
.screen.hidden {
    display: none;
}

/* Main Menu Typography & Styling */
.menu-bg-blur {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/thumbnail.png');
    background-size: cover;
    background-position: center;
    opacity: 0.4;
    z-index: -1;
}

.branding {
    text-align: center;
    margin-bottom: 50px;
    animation: dropIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-icon {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    margin-bottom: 20px;
    border: 2px solid var(--primary-color);
}

.branding h1 {
    font-family: var(--font-heading);
    font-size: 5rem;
    line-height: 0.9;
    text-shadow: 0 10px 20px rgba(0,0,0,0.8);
    color: #fff;
    margin: 0;
}
.branding h1 span {
    color: var(--primary-color);
}
.branding h1 small {
    font-size: 2rem;
    letter-spacing: 5px;
    color: var(--text-dim);
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 300px;
}

.premium-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    padding: 15px 30px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 2rem;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 157, 0, 0.4);
    transition: all 0.2s ease;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}
.premium-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-20deg);
    transition: left 0.5s;
}
.premium-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(255, 157, 0, 0.6);
}
.premium-btn:hover::before {
    left: 150%;
}
.premium-btn:active {
    transform: translateY(2px);
}

.secondary-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 10px 20px;
    color: var(--text-dim);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.secondary-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* Instructions Panel */
.panel {
    background: rgba(11, 14, 20, 0.95);
    border: 1px solid var(--primary-color);
    padding: 40px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 30px rgba(255, 157, 0, 0.2);
}

.panel h2 {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 20px;
}

.guide-item {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 8px;
}
.guide-item .icon {
    font-size: 2.5rem;
    margin-right: 20px;
}
.guide-item p {
    font-size: 1.1rem;
    line-height: 1.5;
}

#btn-close-instructions {
    width: 100%;
    margin-top: 20px;
}

/* End Screen */
.stats-panel {
    margin: 30px 0;
    text-align: center;
    font-size: 1.5rem;
}
.stats-panel p {
    margin: 10px 0;
}
.stats-panel span {
    color: var(--primary-color);
    font-weight: bold;
}

.glitch-text {
    font-family: var(--font-heading);
    font-size: 5rem;
    color: var(--danger-color);
    text-shadow: 2px 2px 0 #0ff, -2px -2px 0 #f0f;
    animation: glitch 1s infinite alternate;
}

@keyframes dropIn {
    0% { transform: translateY(-50px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .branding h1 { font-size: 4rem; }
    .game-icon { width: 100px; height: 100px; }
    #hud-bottom-right { bottom: 120px; /* Make space for joystick */ }
    #hud-bottom-left { bottom: 120px; }
    #minimap-container { width: 120px; height: 120px; }
}
