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

body {
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', Arial, sans-serif;
    touch-action: none;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
    position: fixed;
    width: 100%;
    height: 100%;
    color: #fff;
    user-select: none;
}

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

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.hidden {
    display: none !important;
}

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

#hud > * {
    pointer-events: auto;
}

/* Crosshair */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 0 2px rgba(0,0,0,0.8);
    z-index: 20;
    pointer-events: none;
}

/* Health Bar */
.health-bar {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 250px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.health-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.3s ease;
    border-radius: 8px;
}

.health-bar.low .health-bar-fill {
    background: linear-gradient(90deg, #f44336, #ff5722);
}

/* Ammo Display */
.ammo-display {
    position: absolute;
    bottom: 30px;
    right: 30px;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.ammo-display .current {
    font-size: 36px;
}

.ammo-display .reserve {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.6);
}

/* Kill Feed */
.kill-feed {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kill-feed-entry {
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    animation: feedFadeIn 0.3s ease;
}

.kill-feed-entry.fade-out {
    animation: feedFadeOut 0.5s ease forwards;
}

@keyframes feedFadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes feedFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Scoreboard */
.scoreboard-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 20px;
    min-width: 500px;
    z-index: 30;
}

.scoreboard-overlay h2 {
    text-align: center;
    margin-bottom: 12px;
    font-size: 20px;
    color: #ffc107;
}

.scoreboard-table {
    width: 100%;
    border-collapse: collapse;
}

.scoreboard-table th,
.scoreboard-table td {
    padding: 6px 12px;
    text-align: center;
}

.scoreboard-table th {
    color: #aaa;
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.scoreboard-table tr.self {
    background: rgba(255, 193, 7, 0.15);
}

/* Minimap */
.minimap {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.minimap canvas {
    width: 100%;
    height: 100%;
}

/* Weapon Selector */
.weapon-selector {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.weapon-slot {
    width: 60px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.2s;
}

.weapon-slot.active {
    border-color: #ffc107;
    background: rgba(255, 193, 7, 0.2);
}

.weapon-slot .key {
    font-size: 9px;
    color: rgba(255,255,255,0.5);
}

/* Menus */
.menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.menu-panel {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 40px;
    min-width: 400px;
    text-align: center;
}

.menu-panel h1 {
    font-size: 48px;
    background: linear-gradient(90deg, #ffc107, #ff5722);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.menu-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    margin: 8px 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.menu-btn:active {
    transform: translateY(0);
}

.menu-btn.locked {
    background: linear-gradient(135deg, #444 0%, #555 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

.menu-btn .lock-icon::before {
    content: "🔒 ";
}

/* Damage flash */
.damage-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(255,0,0,0.4) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 15;
}

.damage-flash.active {
    opacity: 1;
}

/* Match End Screen */
.match-end {
    text-align: center;
}

.match-end h1 {
    font-size: 36px;
    margin-bottom: 10px;
}

.match-end .stats {
    margin: 20px 0;
    font-size: 18px;
    line-height: 1.8;
}

.match-end .xp-earned {
    font-size: 24px;
    color: #ffc107;
    font-weight: bold;
    margin: 15px 0;
}

/* Achievement popup */
.achievement-popup {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(255,193,7,0.9), rgba(255,87,34,0.9));
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    z-index: 40;
    animation: achievementPop 0.4s ease, feedFadeOut 0.5s ease 3s forwards;
}

@keyframes achievementPop {
    0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
    70% { transform: translateX(-50%) scale(1.1); }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* Death screen */
.death-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(120, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 25;
    pointer-events: none;
    animation: deathPulse 1.5s ease-in-out infinite;
}

.death-overlay h1 {
    font-size: 64px;
    color: #ff1a1a;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8), 0 4px 8px rgba(0,0,0,0.6);
    margin-bottom: 10px;
    letter-spacing: 8px;
}

.death-overlay .killer-info {
    font-size: 20px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 20px;
}

.death-overlay .respawn-timer {
    font-size: 36px;
    color: #ffc107;
    font-weight: bold;
}

@keyframes deathPulse {
    0%, 100% { background: rgba(120, 0, 0, 0.45); }
    50% { background: rgba(120, 0, 0, 0.6); }
}

/* Reload indicator */
.reload-bar {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 6px;
    background: rgba(0,0,0,0.5);
    border-radius: 3px;
    overflow: hidden;
}

.reload-bar-fill {
    height: 100%;
    background: #ffc107;
    width: 0%;
    transition: width 0.05s linear;
}
