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

html, body {
    overflow: hidden;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

#main-canvas {
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════
   CROSSHAIR
   ═══════════════════════════════════════════ */
:root {
    --xhair-color: rgba(255, 255, 255, 0.85);
    --xhair-arm-w: 18px;
    --xhair-half-w: 9px;
}
#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 100;
}
#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background: var(--xhair-color);
}
#crosshair::before {
    width: var(--xhair-arm-w); height: 2px;
    top: -1px; left: calc(-1 * var(--xhair-half-w));
}
#crosshair::after {
    width: 2px; height: var(--xhair-arm-w);
    top: calc(-1 * var(--xhair-half-w)); left: -1px;
}
/* Hide cross arms for dot/circle styles */
#crosshair.xhair-hide-arms::before,
#crosshair.xhair-hide-arms::after {
    display: none;
}
#crosshair-dot {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 3px; height: 3px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 101;
}
/* Preview crosshair uses same custom props */
#xhair-preview-el::before,
#xhair-preview-el::after {
    content: '';
    position: absolute;
    background: var(--xhair-color);
}
#xhair-preview-el::before {
    width: var(--xhair-arm-w); height: 2px;
    top: -1px; left: calc(-1 * var(--xhair-half-w));
}
#xhair-preview-el::after {
    width: 2px; height: var(--xhair-arm-w);
    top: calc(-1 * var(--xhair-half-w)); left: -1px;
}
#xhair-preview-el.xhair-hide-arms::before,
#xhair-preview-el.xhair-hide-arms::after {
    display: none;
}

/* ═══════════════════════════════════════════
   HUD GLOBALS
   ═══════════════════════════════════════════ */
.hud {
    position: fixed;
    pointer-events: none;
    z-index: 50;
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    color: #e0e8ef;
    user-select: none;
}

/* Panel background helper */
.hud-panel {
    background: linear-gradient(135deg, rgba(8, 18, 28, 0.82), rgba(12, 24, 36, 0.75));
    border: 1px solid rgba(0, 200, 220, 0.25);
    border-radius: 4px;
    backdrop-filter: blur(4px);
}



/* Cyan accent glow */
.accent {
    color: #00e5ff;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.5);
}
.accent-warm {
    color: #ff6b35;
    text-shadow: 0 0 6px rgba(255, 107, 53, 0.4);
}

/* ═══════════════════════════════════════════
   BOTTOM-LEFT: HEALTH + ARMOR
   ═══════════════════════════════════════════ */
#hud-health-panel {
    bottom: 20px;
    left: 20px;
    padding: 10px 16px;
    min-width: 200px;
}

.health-row, .armor-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.armor-row {
    margin-bottom: 0;
}

.health-icon, .armor-icon {
    font-size: 16px;
    font-weight: 700;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.health-icon { color: #00e5ff; }
.armor-icon { color: #4a90d9; }

.bar-container {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.bar-fill-health {
    height: 100%;
    background: linear-gradient(90deg, #00e5ff, #00bcd4);
    border-radius: 2px;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}
.bar-fill-health.warning {
    background: linear-gradient(90deg, #ffab00, #ff6d00);
    box-shadow: 0 0 8px rgba(255, 171, 0, 0.4);
}
.bar-fill-health.critical {
    background: linear-gradient(90deg, #ff1744, #d50000);
    box-shadow: 0 0 8px rgba(255, 23, 68, 0.4);
    animation: pulse-critical 0.6s ease-in-out infinite alternate;
}

@keyframes pulse-critical {
    from { opacity: 1; }
    to { opacity: 0.6; }
}

.bar-pct {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

/* Player name tag under health */
#hud-player-name {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(0, 229, 255, 0.7);
    border-top: 1px solid rgba(0, 200, 220, 0.15);
    padding-top: 5px;
}

/* Stamina bar */
.stamina-row {
    margin-top: 4px;
}
.stamina-container {
    height: 4px !important;
}
.bar-fill-stamina {
    height: 100%;
    background: linear-gradient(90deg, #ffab00, #ffd600);
    border-radius: 2px;
    transition: width 0.1s ease-out;
    box-shadow: 0 0 4px rgba(255, 171, 0, 0.3);
}
.bar-fill-stamina.low {
    background: linear-gradient(90deg, #ff6d00, #ff3d00);
    box-shadow: 0 0 6px rgba(255, 61, 0, 0.4);
}
.bar-fill-stamina.empty {
    background: linear-gradient(90deg, #ff1744, #d50000);
    animation: pulse-critical 0.6s ease-in-out infinite alternate;
}

/* ═══════════════════════════════════════════
   BOTTOM-CENTER: WEAPON + AMMO
   ═══════════════════════════════════════════ */
/* Grenade counter */
#hud-grenade {
    bottom: 76px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Share Tech Mono', monospace;
}
.grenade-icon {
    font-size: 16px;
    filter: grayscale(0.3);
}
.grenade-count {
    font-size: 18px;
    font-weight: 700;
    color: #c8d0d8;
    letter-spacing: 1px;
}
.grenade-count.empty {
    color: #546e7a;
}

#hud-weapon-panel {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px 10px;
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 320px;
}

/* Weapon info left side */
.weapon-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.weapon-name {
    font-size: 13px;
    font-weight: 600;
    color: #b0bec5;
    letter-spacing: 0.5px;
}

.weapon-mode {
    display: flex;
    align-items: center;
    gap: 6px;
}

.weapon-mode-icon {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: #00e5ff;
}

.weapon-mode-label {
    font-size: 11px;
    font-weight: 500;
    color: #78909c;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.weapon-category {
    font-size: 10px;
    color: #546e7a;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Divider */
.weapon-divider {
    width: 1px;
    height: 40px;
    background: rgba(0, 200, 220, 0.2);
}

/* Ammo display */
.ammo-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.ammo-current {
    font-family: 'Share Tech Mono', monospace;
    font-size: 42px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}
.ammo-current.low {
    color: #ff6d00;
    text-shadow: 0 0 10px rgba(255, 109, 0, 0.4);
}
.ammo-current.empty {
    color: #ff1744;
    text-shadow: 0 0 10px rgba(255, 23, 68, 0.4);
    animation: pulse-critical 0.4s ease-in-out infinite alternate;
}

.ammo-separator {
    font-family: 'Share Tech Mono', monospace;
    font-size: 20px;
    color: #546e7a;
    margin: 0 2px;
    align-self: center;
}

.ammo-reserve {
    font-family: 'Share Tech Mono', monospace;
    font-size: 20px;
    color: #78909c;
    align-self: center;
}

/* ═══════════════════════════════════════════
   BOTTOM-RIGHT: WEAPON SLOTS
   ═══════════════════════════════════════════ */
#hud-slots-panel {
    bottom: 20px;
    right: 20px;
    padding: 6px 12px;
    min-width: 140px;
    overflow: hidden;
    /* 3 visible rows: prev(18px) + active(22px) + next(18px) + gaps */
    height: 72px;
    position: fixed;
}

#slot-reel {
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.slot-row {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-family: 'Share Tech Mono', monospace;
    height: 18px;
    flex-shrink: 0;
}

.slot-row.hint {
    font-size: 11px;
    color: #546e7a;
}

.slot-row.active {
    font-size: 14px;
    font-weight: 600;
    color: #e0e8ef;
    height: 22px;
    border-left: 2px solid #00e5ff;
    padding-left: 8px;
}

.slot-key {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    color: #78909c;
    flex-shrink: 0;
}
.weapon-slot.active .slot-key {
    border-color: rgba(0, 229, 255, 0.5);
    color: #00e5ff;
}

.slot-name {
    font-size: 12px;
    font-weight: 500;
    color: #78909c;
    white-space: nowrap;
}
.weapon-slot.active .slot-name {
    color: #e0e8ef;
}

/* ═══════════════════════════════════════════
   TOP-LEFT: KILL FEED
   ═══════════════════════════════════════════ */
#hud-killfeed {
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 380px;
}

.killfeed-entry {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    background: rgba(8, 18, 28, 0.65);
    border-left: 2px solid rgba(0, 229, 255, 0.4);
    border-radius: 2px;
    color: #b0bec5;
    animation: killfeed-in 0.3s ease-out;
    transition: opacity 0.5s ease;
}
.killfeed-entry .killer { color: #00e5ff; font-weight: 600; }
.killfeed-entry .victim { color: #ff6b35; font-weight: 600; }
.killfeed-entry .weapon-tag { color: #78909c; }

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

/* ═══════════════════════════════════════════
   TOP-CENTER: GAME INFO BAR
   ═══════════════════════════════════════════ */
#hud-topbar {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 24px 8px;
    text-align: center;
    border-radius: 0 0 6px 6px;
    border-top: none;
    min-width: 260px;
}

.topbar-mode {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #00e5ff;
    margin-bottom: 2px;
}

.topbar-sub {
    font-size: 10px;
    color: #546e7a;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ═══════════════════════════════════════════
   TOP-RIGHT: PLAYER STATS
   ═══════════════════════════════════════════ */
#hud-player-stats {
    top: 20px;
    right: 20px;
    padding: 10px 14px;
    text-align: right;
    min-width: 160px;
}

.stats-name {
    font-size: 15px;
    font-weight: 700;
    color: #e0e8ef;
    letter-spacing: 0.5px;
}

.stats-row {
    font-size: 11px;
    color: #78909c;
    margin-top: 3px;
}
.stats-row .val {
    color: #e0e8ef;
    font-weight: 600;
}
.stats-row .kills { color: #00e5ff; font-weight: 600; }
.stats-row .deaths { color: #ff6b35; font-weight: 600; }

/* ═══════════════════════════════════════════
   CENTER: RELOAD / STATUS INDICATOR
   ═══════════════════════════════════════════ */
#hud-reload-indicator {
    top: 55%;
    left: 50%;
    transform: translate(-50%, 0);
    padding: 6px 18px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #ffab00;
    text-shadow: 0 0 8px rgba(255, 171, 0, 0.5);
    background: rgba(8, 18, 28, 0.6);
    border: 1px solid rgba(255, 171, 0, 0.25);
    border-radius: 3px;
    display: none;
}

/* Reload progress bar inside indicator */
.reload-bar {
    height: 3px;
    margin-top: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}
.reload-bar-fill {
    height: 100%;
    background: #ffab00;
    border-radius: 2px;
    transition: width 0.05s linear;
    width: 0%;
}

/* Flashing reload prompt when mag is empty */
#hud-reload-indicator.reload-prompt {
    color: #ff1744;
    text-shadow: 0 0 12px rgba(255, 23, 68, 0.7);
    border-color: rgba(255, 23, 68, 0.4);
    font-size: 16px;
    animation: reload-flash 0.6s ease-in-out infinite;
}
@keyframes reload-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ═══════════════════════════════════════════
   CENTER: DEATH / RESPAWN OVERLAY
   ═══════════════════════════════════════════ */
#hud-death-overlay {
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(10, 0, 0, 0.5);
    z-index: 200;
}

.death-text {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: #ff1744;
    text-shadow: 0 0 20px rgba(255, 23, 68, 0.6);
}

.respawn-text {
    font-size: 14px;
    color: #78909c;
    letter-spacing: 2px;
    margin-top: 8px;
}

/* ═══════════════════════════════════════════
   WEAPON SWITCH INDICATOR (center hint)
   ═══════════════════════════════════════════ */
#hud-switch-indicator {
    top: 40%;
    left: 50%;
    transform: translate(-50%, 0);
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #e0e8ef;
    background: rgba(8, 18, 28, 0.65);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 3px;
    display: none;
    text-align: center;
}

/* ═══════════════════════════════════════════
   HIT MARKER
   ═══════════════════════════════════════════ */
#hitmarker {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 102;
    opacity: 0;
}
#hitmarker::before,
#hitmarker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    background: #ffffff;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}
#hitmarker::before {
    transform: translate(-50%, -50%) rotate(45deg);
}
#hitmarker::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}
#hitmarker.active {
    animation: hitmarker-pop 0.3s ease-out forwards;
}
@keyframes hitmarker-pop {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.6); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.0); }
}

/* ═══════════════════════════════════════════
   FPS COUNTER
   ═══════════════════════════════════════════ */
#hud-fps {
    top: 80px;
    right: 20px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: #76ff03;
    text-shadow: 0 0 4px rgba(118, 255, 3, 0.3);
    text-align: right;
}
#hud-ping {
    top: 96px;
    right: 20px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: #76ff03;
    text-shadow: 0 0 4px rgba(118, 255, 3, 0.3);
    text-align: right;
}

/* ═══════════════════════════════════════════
   SETTINGS PANEL
   ═══════════════════════════════════════════ */
#settings-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 300;
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
}
#settings-overlay.open {
    display: flex;
}

#settings-panel {
    width: 460px;
    background: linear-gradient(135deg, rgba(8, 18, 28, 0.95), rgba(12, 24, 36, 0.92));
    border: 1px solid rgba(0, 200, 220, 0.3);
    border-radius: 6px;
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 18px;
    border-bottom: 1px solid rgba(0, 200, 220, 0.15);
}
.settings-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #00e5ff;
    text-transform: uppercase;
}
.settings-close {
    font-size: 22px;
    color: #546e7a;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}
.settings-close:hover {
    color: #ff1744;
}

/* Tabs */
.settings-tabs {
    display: flex;
    padding: 0 10px;
    border-bottom: 1px solid rgba(0, 200, 220, 0.1);
    flex-shrink: 0;
    overflow-x: auto;
}
.settings-tab {
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #546e7a;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 6px 10px 4px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.settings-tab:hover {
    color: #b0bec5;
}
.settings-tab.active {
    color: #00e5ff;
    border-bottom-color: #00e5ff;
}

/* Tab content */
.settings-body {
    padding: 10px 18px;
    flex-direction: column;
    gap: 10px;
    display: none;
}
.settings-body.active {
    display: flex;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.setting-label {
    font-size: 11px;
    font-weight: 600;
    color: #b0bec5;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.setting-control {
    display: flex;
    align-items: center;
    gap: 12px;
}
.setting-control input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.setting-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00e5ff;
    border: 2px solid rgba(0, 229, 255, 0.4);
    box-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
    cursor: pointer;
}
/* Styled select dropdown */
.setting-select {
    flex: 1;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: #e0e8ef;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(0, 200, 220, 0.25);
    border-radius: 3px;
    padding: 5px 8px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2300e5ff'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}
.setting-select option {
    background: #0c1824;
    color: #e0e8ef;
}
.setting-select:hover {
    border-color: rgba(0, 229, 255, 0.4);
}

.setting-control input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00e5ff;
    border: 2px solid rgba(0, 229, 255, 0.4);
    box-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
    cursor: pointer;
}
.setting-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: #e0e8ef;
    min-width: 44px;
    text-align: right;
}

/* Hint text for settings */
.setting-hint {
    font-size: 10px;
    color: #546e7a;
    letter-spacing: 0.5px;
}
.setting-hint-row {
    gap: 10px;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: background 0.2s;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: #546e7a;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
    background: rgba(0, 229, 255, 0.2);
}
.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(20px);
    background: #00e5ff;
}

/* Option buttons (crosshair style) */
.setting-select-row {
    gap: 6px;
}
.setting-option {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #78909c;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.setting-option:hover {
    color: #e0e8ef;
    border-color: rgba(255, 255, 255, 0.2);
}
.setting-option.active {
    color: #00e5ff;
    border-color: rgba(0, 229, 255, 0.5);
    background: rgba(0, 229, 255, 0.08);
}

/* Color swatches */
.setting-color-row {
    gap: 6px;
}
.setting-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
    padding: 0;
}
.setting-color:hover {
    transform: scale(1.15);
}
.setting-color.active {
    border-color: #e0e8ef;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
}

/* Crosshair preview */
.xhair-preview {
    margin-top: 2px;
    display: flex;
    justify-content: center;
}
.xhair-preview-bg {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    position: relative;
}
#xhair-preview-el {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
#xhair-preview-el::before,
#xhair-preview-el::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
}
#xhair-preview-el::before {
    width: 18px; height: 2px;
    top: -1px; left: -9px;
}
#xhair-preview-el::after {
    width: 2px; height: 18px;
    top: -9px; left: -1px;
}
#xhair-preview-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px; height: 3px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.settings-footer {
    padding: 8px 18px 10px;
    border-top: 1px solid rgba(0, 200, 220, 0.15);
    text-align: center;
}
#settings-reset {
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #78909c;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    padding: 6px 20px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
#settings-reset:hover {
    color: #ff6b35;
    border-color: rgba(255, 107, 53, 0.3);
}

/* ═══════════════════════════════════════════
   RADAR
   ═══════════════════════════════════════════ */
#hud-radar {
    position: fixed;
    top: 12px;
    left: 12px;
    width: 170px;
    height: 170px;
    padding: 5px;
    border-radius: 6px;
    z-index: 10;
}

#radar-canvas {
    display: block;
    width: 160px;
    height: 160px;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════
   DAMAGE FEEDBACK
   ═══════════════════════════════════════════ */
#hud-damage-vignette {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(180, 0, 0, 0.6) 100%);
    transition: opacity 0.05s ease-in;
}

#hud-damage-indicators {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 51;
}

.damage-indicator {
    position: absolute;
    top: 50%; left: 50%;
    width: 6px; height: 50px;
    margin-left: -3px;
    margin-top: -120px;
    transform-origin: 3px 120px;
    opacity: 0.9;
    transition: opacity 0.3s ease-out;
}

/* ═══════════════════════════════════════════
   SCOREBOARD (Tab key overlay)
   ═══════════════════════════════════════════ */
#hud-scoreboard {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-height: 70vh;
    background: linear-gradient(135deg, rgba(8, 18, 28, 0.92), rgba(12, 24, 36, 0.88));
    border: 1px solid rgba(0, 200, 220, 0.3);
    border-radius: 6px;
    backdrop-filter: blur(8px);
    padding: 0;
    overflow: hidden;
    z-index: 250;
    pointer-events: none;
}

.scoreboard-header {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #00e5ff;
    text-align: center;
    padding: 10px 16px 6px;
    border-bottom: 1px solid rgba(0, 200, 220, 0.15);
}

.scoreboard-subheader {
    display: flex;
    padding: 6px 16px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #546e7a;
    border-bottom: 1px solid rgba(0, 200, 220, 0.1);
}

.sb-col-name { flex: 1; }
.sb-col-kills { width: 60px; text-align: center; }
.sb-col-deaths { width: 60px; text-align: center; }

#scoreboard-rows {
    max-height: 50vh;
    overflow-y: auto;
}

.sb-row {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: #b0bec5;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s;
}
.sb-row:hover {
    background: rgba(0, 229, 255, 0.04);
}
.sb-row.self {
    background: rgba(0, 229, 255, 0.08);
    color: #00e5ff;
    font-weight: 600;
}

.sb-row .sb-col-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sb-row .sb-col-kills {
    width: 60px;
    text-align: center;
    color: #00e5ff;
    font-weight: 600;
}
.sb-row .sb-col-deaths {
    width: 60px;
    text-align: center;
    color: #ff6b35;
}

/* ═══════════════════════════════════════════
   MATCH END OVERLAY
   ═══════════════════════════════════════════ */
#hud-match-end {
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(0, 10, 20, 0.7);
    z-index: 260;
}

.match-end-title {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 8px;
    text-transform: uppercase;
    color: #00e5ff;
    text-shadow: 0 0 30px rgba(0, 229, 255, 0.6), 0 0 60px rgba(0, 229, 255, 0.3);
    animation: match-end-pulse 1.5s ease-in-out infinite alternate;
}

.match-end-winner {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 3px;
    color: #ffab00;
    text-shadow: 0 0 10px rgba(255, 171, 0, 0.5);
    margin-top: 12px;
}

.match-end-countdown {
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    color: #78909c;
    letter-spacing: 2px;
    margin-top: 20px;
}

@keyframes match-end-pulse {
    from { opacity: 1; text-shadow: 0 0 30px rgba(0, 229, 255, 0.6), 0 0 60px rgba(0, 229, 255, 0.3); }
    to { opacity: 0.85; text-shadow: 0 0 40px rgba(0, 229, 255, 0.8), 0 0 80px rgba(0, 229, 255, 0.4); }
}

/* ═══════════════════════════════════════════
   SPAWN PROTECTION VIGNETTE
   ═══════════════════════════════════════════ */
#hud-spawn-protection {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 49;
    opacity: 0;
    border: 3px solid rgba(0, 229, 255, 0.5);
    box-shadow: inset 0 0 60px 20px rgba(0, 229, 255, 0.12),
                inset 0 0 120px 40px rgba(0, 229, 255, 0.06);
    animation: spawn-protect-pulse 0.8s ease-in-out infinite alternate;
    transition: opacity 0.3s ease;
}

@keyframes spawn-protect-pulse {
    from {
        border-color: rgba(0, 229, 255, 0.5);
        box-shadow: inset 0 0 60px 20px rgba(0, 229, 255, 0.12),
                    inset 0 0 120px 40px rgba(0, 229, 255, 0.06);
    }
    to {
        border-color: rgba(0, 229, 255, 0.2);
        box-shadow: inset 0 0 40px 10px rgba(0, 229, 255, 0.06),
                    inset 0 0 80px 20px rgba(0, 229, 255, 0.03);
    }
}

/* ═══════════════════════════════════════════
   HEADSHOT HITMARKER
   ═══════════════════════════════════════════ */
#hitmarker.headshot::before,
#hitmarker.headshot::after {
    background: #ffd700;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.9), 0 0 12px rgba(255, 60, 20, 0.5);
    width: 24px;
}
#hitmarker.headshot.active {
    animation: hitmarker-headshot-pop 0.4s ease-out forwards;
}
@keyframes hitmarker-headshot-pop {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.1); }
}

.damage-indicator::after {
    content: '';
    display: block;
    width: 0; height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 40px solid rgba(255, 30, 30, 0.8);
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    filter: drop-shadow(0 0 4px rgba(255, 0, 0, 0.5));
}

/* ═══════════════════════════════════════════
   MOBILE TOUCH CONTROLS
   ═══════════════════════════════════════════ */

/* Root container — full screen overlay, children opt-in to pointer events */
.mobile-ctrl-root {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    pointer-events: none;
    touch-action: none;
}
body.mobile-active .mobile-ctrl-root {
    display: block;
}

/* All interactive mobile controls opt-in to pointer events */
.mobile-ctrl {
    pointer-events: auto;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* ── Movement Joystick ── */
.mobile-ctrl-joystick-base {
    position: fixed;
    bottom: 40px;
    left: 30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(8, 18, 28, 0.55);
    border: 2px solid rgba(0, 200, 220, 0.25);
    box-shadow: inset 0 0 20px rgba(0, 229, 255, 0.06);
}

.mobile-ctrl-joystick-thumb {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    margin-left: -22px;
    margin-top: -22px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.35), rgba(0, 229, 255, 0.12));
    border: 2px solid rgba(0, 229, 255, 0.45);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
    transition: transform 0.04s ease-out;
}

/* ── Look Zone (right half, invisible) ── */
.mobile-ctrl-look-zone {
    position: fixed;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    /* No visual — purely a touch capture area */
}

/* ── Action Buttons (shared) ── */
.mobile-ctrl-btn {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(224, 232, 239, 0.85);
    background: linear-gradient(135deg, rgba(8, 18, 28, 0.7), rgba(12, 24, 36, 0.6));
    border: 2px solid rgba(0, 200, 220, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: background 0.08s, border-color 0.08s, transform 0.08s;
}

.mobile-ctrl-btn.active {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.25), rgba(0, 180, 200, 0.18));
    border-color: rgba(0, 229, 255, 0.6);
    transform: scale(0.93);
    color: #00e5ff;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

/* ── FIRE button — large, bottom-right ── */
.mobile-ctrl-btn-fire {
    bottom: 40px;
    right: 30px;
    width: 76px;
    height: 76px;
    font-size: 14px;
    border-color: rgba(255, 60, 60, 0.3);
    background: linear-gradient(135deg, rgba(80, 10, 10, 0.6), rgba(40, 8, 8, 0.5));
}
.mobile-ctrl-btn-fire.active {
    background: linear-gradient(135deg, rgba(255, 60, 60, 0.35), rgba(200, 30, 30, 0.25));
    border-color: rgba(255, 80, 80, 0.7);
    color: #ff5252;
    box-shadow: 0 0 16px rgba(255, 60, 60, 0.35);
}

/* ── ADS button — above fire ── */
.mobile-ctrl-btn-ads {
    bottom: 136px;
    right: 38px;
    width: 60px;
    height: 60px;
    font-size: 12px;
}

/* ── JUMP button — right edge, middle ── */
.mobile-ctrl-btn-jump {
    bottom: 216px;
    right: 30px;
    width: 56px;
    height: 56px;
    font-size: 11px;
}

/* ── Small buttons — reload, grenade, crouch, switch ── */
.mobile-ctrl-btn-reload {
    bottom: 288px;
    right: 36px;
    width: 48px;
    height: 48px;
    font-size: 10px;
}

.mobile-ctrl-btn-grenade {
    bottom: 350px;
    right: 36px;
    width: 48px;
    height: 48px;
    font-size: 10px;
}

.mobile-ctrl-btn-crouch {
    bottom: 40px;
    right: 126px;
    width: 52px;
    height: 52px;
    font-size: 10px;
}

.mobile-ctrl-btn-switch {
    bottom: 110px;
    right: 120px;
    width: 48px;
    height: 48px;
    font-size: 10px;
}

/* ── Settings/Pause button — top-right ── */
.mobile-ctrl-btn-settings {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 20px;
    opacity: 0.6;
}
.mobile-ctrl-btn-settings.active {
    opacity: 1;
}

/* ── Hide mobile controls in lobby ── */
body.in-lobby .mobile-ctrl-root {
    display: none !important;
}

/* ── Mobile: adjust HUD to not overlap controls ── */
body.mobile-active #hud-slots-panel {
    bottom: 130px;
    right: 130px;
}
body.mobile-active #hud-weapon-panel {
    bottom: 6px;
    transform: translateX(-60%);
}
body.mobile-active #hud-health-panel {
    bottom: 170px;
    left: 10px;
}
body.mobile-active #hud-grenade {
    bottom: 170px;
}

/* ── Hide mobile controls on non-mobile ── */
body:not(.mobile-active) .mobile-ctrl-root {
    display: none !important;
}

/* ── Mobile: settings panel responsive ── */
@media (max-width: 520px) {
    #settings-panel {
        width: 100%;
        max-width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
        display: flex;
        flex-direction: column;
    }
    .settings-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
    }
    .settings-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .settings-tab {
        padding: 8px 8px 6px;
        font-size: 9px;
    }
    .setting-group {
        padding: 8px 12px;
    }
    .setting-label {
        font-size: 11px;
    }
    .settings-close {
        font-size: 28px;
        padding: 4px 8px;
    }
    .settings-footer {
        padding: 8px 12px;
    }
    #settings-return-lobby {
        padding: 10px 16px;
        font-size: 12px;
    }
}

/* ── Landscape orientation hint ── */
@media (orientation: portrait) {
    body.mobile-active::after {
        content: 'ROTATE TO LANDSCAPE';
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.85);
        color: #00e5ff;
        font-family: 'Rajdhani', sans-serif;
        font-size: 20px;
        font-weight: 700;
        letter-spacing: 4px;
        z-index: 99999;
        pointer-events: none;
    }
}

/* ═══════════════════════════════════════════
   GAME MODE HUD ELEMENTS
   ═══════════════════════════════════════════ */

/* Match Timer */
#hud-match-timer {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Share Tech Mono', 'Rajdhani', monospace;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #00e5ff;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    z-index: 200;
    pointer-events: none;
}

#hud-match-timer.timer-critical {
    color: #ff3030;
    text-shadow: 0 0 10px rgba(255, 48, 48, 0.6);
    animation: timer-flash 0.5s ease-in-out infinite alternate;
}

@keyframes timer-flash {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

/* Team Scores */
#hud-team-scores {
    position: fixed;
    top: 44px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Share Tech Mono', 'Rajdhani', monospace;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 3px;
    z-index: 200;
    pointer-events: none;
    background: rgba(0, 10, 20, 0.6);
    padding: 4px 16px;
    border: 1px solid rgba(0, 200, 220, 0.2);
}

.team-score {
    display: flex;
    align-items: center;
    gap: 6px;
}

.team-blue-score {
    color: #4488ff;
    text-shadow: 0 0 8px rgba(68, 136, 255, 0.4);
}

.team-red-score {
    color: #ff4444;
    text-shadow: 0 0 8px rgba(255, 68, 68, 0.4);
}

.team-score-divider {
    color: #556;
    font-size: 24px;
}

.team-label {
    font-size: 12px;
    opacity: 0.7;
    letter-spacing: 2px;
}

#team-score-1, #team-score-2 {
    font-size: 28px;
    min-width: 24px;
    text-align: center;
}

/* Flag Status (CTF) */
#hud-flag-status {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Share Tech Mono', 'Rajdhani', monospace;
    font-size: 12px;
    letter-spacing: 2px;
    color: #aaa;
    z-index: 200;
    pointer-events: none;
    background: rgba(0, 10, 20, 0.5);
    padding: 4px 12px;
    border: 1px solid rgba(0, 200, 220, 0.15);
}

.flag-status-label {
    color: #778;
    font-size: 10px;
    letter-spacing: 3px;
}

/* Warmup Countdown Overlay */
#hud-warmup-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(0, 10, 20, 0.5);
    z-index: 250;
    pointer-events: none;
}

.warmup-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 8px;
    color: #889;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.warmup-countdown {
    font-family: 'Share Tech Mono', monospace;
    font-size: 96px;
    font-weight: 700;
    color: #00e5ff;
    text-shadow: 0 0 40px rgba(0, 229, 255, 0.6), 0 0 80px rgba(0, 229, 255, 0.3);
    animation: warmup-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes warmup-pulse {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(1.1); opacity: 0.8; }
}

/* Scoreboard team colors */
.sb-row.team-blue .sb-col-name {
    color: #4488ff;
}
.sb-row.team-red .sb-col-name {
    color: #ff4444;
}
