/* ===================================
   Flolio Game HUD — CS-Style
   =================================== */

/* ---- HUD Container ---- */
#flolio-hud {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    font-family: 'Orbitron', 'Inter', monospace;
    user-select: none;
}
#flolio-hud * { pointer-events: auto; }

/* ---- Crosshair ---- */
.flolio-hud__crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    z-index: 55;
    transition: transform 100ms ease;
}
.flolio-hud__crosshair.ch-spread { transform: translate(-50%, -50%) scale(1.6); }

.flolio-hud__crosshair span {
    position: absolute;
    background: var(--fl-accent, #00ff88);
    border-radius: 1px;
}
/* Cross pattern */
.flolio-hud__crosshair span:nth-child(1) { top:0; left:50%; transform:translateX(-50%); width:2px; height:8px; margin-top: 2px; }
.flolio-hud__crosshair span:nth-child(2) { bottom:0; left:50%; transform:translateX(-50%); width:2px; height:8px; margin-bottom:2px; }
.flolio-hud__crosshair span:nth-child(3) { left:0; top:50%; transform:translateY(-50%); width:8px; height:2px; margin-left:2px; }
.flolio-hud__crosshair span:nth-child(4) { right:0; top:50%; transform:translateY(-50%); width:8px; height:2px; margin-right:2px; }
/* Center dot */
.flolio-hud__crosshair span:nth-child(5) {
    top:50%; left:50%; transform:translate(-50%,-50%);
    width:2px; height:2px; border-radius:50%;
    background: rgba(255,255,255,0.3);
}

/* Dot style */
.ch-style-dot span:nth-child(1),
.ch-style-dot span:nth-child(2),
.ch-style-dot span:nth-child(3),
.ch-style-dot span:nth-child(4) { display: none; }
.ch-style-dot span:nth-child(5) { width: 4px; height: 4px; background: var(--fl-accent, #00ff88); }

/* Circle style */
.ch-style-circle span:nth-child(5) {
    width: 18px; height: 18px; border-radius: 50%;
    background: transparent; border: 1.5px solid var(--fl-accent, #00ff88);
}

/* ---- Hit Marker ---- */
.flolio-hud__hitmarker {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 24px; height: 24px;
    z-index: 56;
    opacity: 0;
    pointer-events: none;
    transition: none;
}
.flolio-hud__hitmarker.active { opacity: 1; animation: hitmarkerPop 0.2s ease-out; }
.flolio-hud__hitmarker.headshot span { background: #ff4444 !important; }
.flolio-hud__hitmarker span {
    position: absolute;
    background: #fff;
    width: 2px; height: 10px;
    top: 50%; left: 50%;
}
.flolio-hud__hitmarker span:nth-child(1) { transform: translate(-50%,-50%) rotate(45deg); transform-origin: center; }
.flolio-hud__hitmarker span:nth-child(2) { transform: translate(-50%,-50%) rotate(-45deg); }
.flolio-hud__hitmarker span:nth-child(3) { transform: translate(-50%,-50%) rotate(135deg); }
.flolio-hud__hitmarker span:nth-child(4) { transform: translate(-50%,-50%) rotate(-135deg); }

@keyframes hitmarkerPop {
    0% { transform: translate(-50%,-50%) scale(2); opacity:0.5; }
    50% { transform: translate(-50%,-50%) scale(0.9); opacity:1; }
    100% { transform: translate(-50%,-50%) scale(1); opacity:0; }
}

/* ---- Bottom HUD Bar ---- */
.flolio-hud__bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 16px 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    pointer-events: none;
}

/* Health Section */
.flolio-hud__health {
    display: flex;
    align-items: center;
    gap: 10px;
}
.flolio-hud__health-icon { font-size: 1.4rem; color: #44ff44; }
.flolio-hud__health-bar {
    width: 180px; height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.flolio-hud__health-fill {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, #44ff44, #22cc22);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.flolio-hud__health-fill.mid { background: linear-gradient(90deg, #ffaa44, #cc8833); }
.flolio-hud__health-fill.low { background: linear-gradient(90deg, #ff3344, #cc2233); animation: healthPulse 0.6s infinite; }
.flolio-hud__health-text {
    font-size: 1.6rem; font-weight: 900;
    color: #eee; min-width: 50px;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
}
.flolio-hud__health-text.low { color: #ff3344; animation: textPulse 0.6s infinite; }

@keyframes healthPulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }
@keyframes textPulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

/* Ammo Section */
.flolio-hud__ammo {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.flolio-hud__ammo-counts {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.flolio-hud__ammo-current {
    font-size: 2.2rem; font-weight: 900; color: #eee;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
}
.flolio-hud__ammo-current.low { color: #ffaa44; }
.flolio-hud__ammo-current.empty { color: #ff3344; animation: textPulse 0.4s infinite; }
.flolio-hud__ammo-sep { font-size: 1.2rem; color: rgba(255,255,255,0.3); margin: 0 2px; }
.flolio-hud__ammo-reserve { font-size: 1rem; color: rgba(255,255,255,0.5); }
.flolio-hud__weapon-name {
    font-size: 0.65rem; letter-spacing: 0.15em;
    color: rgba(255,255,255,0.35); text-transform: uppercase;
}

/* ---- Top HUD ---- */
.flolio-hud__top {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 24px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
    pointer-events: none;
}
.flolio-hud__stats {
    display: flex; gap: 24px;
}
.flolio-hud__stat {
    display: flex; flex-direction: column;
    align-items: center; gap: 2px;
}
.flolio-hud__stat-label {
    font-size: 0.55rem; letter-spacing: 0.15em;
    color: rgba(255,255,255,0.35); text-transform: uppercase;
}
.flolio-hud__stat-value {
    font-size: 1rem; font-weight: 700; color: #eee;
}
.flolio-hud__wave-badge {
    background: rgba(0,255,136,0.1);
    border: 1px solid rgba(0,255,136,0.3);
    border-radius: 6px;
    padding: 6px 16px;
    display: flex; align-items: center; gap: 8px;
}
.flolio-hud__wave-badge .flolio-hud__stat-value { color: #00ff88; }

/* ---- Money Display ---- */
.flolio-hud__money {
    position: absolute;
    top: 60px; right: 24px;
    font-size: 1.1rem; font-weight: 700;
    display: flex; align-items: center; gap: 4px;
}
.flolio-hud__money-icon { color: #44cc44; font-weight: 900; font-size: 1.2rem; }
.flolio-hud__money-value { color: #44cc44; }
.flolio-hud__money-value.money-flash { animation: moneyFlash 0.4s ease; }
@keyframes moneyFlash {
    0% { color: #88ff88; transform: scale(1.2); }
    100% { color: #44cc44; transform: scale(1); }
}

/* ---- Armor Display ---- */
.flolio-hud__armor {
    position: absolute;
    bottom: 52px; left: 24px;
    display: flex; align-items: center; gap: 8px;
}
.flolio-hud__armor-icon { font-size: 1.1rem; }
.flolio-hud__armor-fill {
    width: 100px; height: 4px;
    background: #4488cc;
    border-radius: 2px;
    transition: width 0.3s ease;
}
.flolio-hud__armor-text {
    font-size: 0.9rem; font-weight: 700;
    color: #4488cc;
}

/* ---- Headshot Indicator ---- */
.flolio-hud__headshot {
    position: absolute;
    top: 25%; left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem; font-weight: 900;
    color: #ff4444; letter-spacing: 0.1em;
    opacity: 0;
    pointer-events: none;
    text-shadow: 0 0 20px rgba(255,68,68,0.5);
}
.flolio-hud__headshot.active {
    animation: headshotPop 1.2s ease-out forwards;
}
@keyframes headshotPop {
    0% { opacity:0; transform:translateX(-50%) scale(0.5) translateY(20px); }
    15% { opacity:1; transform:translateX(-50%) scale(1.2) translateY(0); }
    30% { transform:translateX(-50%) scale(1); }
    80% { opacity:1; }
    100% { opacity:0; transform:translateX(-50%) translateY(-20px); }
}

/* ---- Damage Direction ---- */
.flolio-hud__damage-dir {
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    pointer-events: none;
}
.flolio-hud__damage-arrow {
    position: absolute;
    width: 40px; height: 80px;
    top: -110px; left: -20px;
    background: linear-gradient(to bottom, rgba(255,50,50,0.0), rgba(255,50,50,0.5));
    clip-path: polygon(50% 0%, 30% 100%, 70% 100%);
    transform-origin: center 130px;
    opacity: 0.7;
    transition: opacity 0.5s ease;
}

/* ---- Damage Overlay ---- */
.flolio-hud__damage-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    z-index: 48;
    background: radial-gradient(ellipse, transparent 50%, rgba(180,0,0,0.3) 100%);
    transition: opacity 0.1s ease;
}
.flolio-hud__damage-overlay.active { opacity: 1; animation: damageFlash 0.5s ease-out; }
@keyframes damageFlash { 0%{opacity:1;} 100%{opacity:0;} }

/* ---- Reload Indicator ---- */
.flolio-hud__reload {
    position: absolute;
    top: 55%; left: 50%;
    transform: translateX(-50%);
    display: none;
}
.flolio-hud__reload svg { transform: rotate(-90deg); width: 48px; height: 48px; }
.flolio-hud__reload-bg { fill: none; stroke: rgba(255,255,255,0.15); stroke-width: 3; }
.flolio-hud__reload-progress { fill: none; stroke: #00ff88; stroke-width: 3; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; stroke-linecap: round; transition: stroke-dashoffset 50ms; }
.flolio-hud__reload-text { font-size: 0.5rem; color: rgba(255,255,255,0.5); text-align: center; margin-top: 4px; letter-spacing: 0.15em; }

/* ---- Killfeed ---- */
.flolio-hud__killfeed {
    position: absolute;
    top: 80px; right: 24px;
    display: flex; flex-direction: column; gap: 6px;
    pointer-events: none;
}
.flolio-hud__killfeed-item {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.8);
    border-left: 3px solid #00ff88;
    animation: killfeedSlide 0.3s ease;
    white-space: nowrap;
}
.flolio-hud__killfeed-item .killer { color: #88ddff; font-weight: 700; }
.flolio-hud__killfeed-item .hs { color: #ff4444; font-weight: 900; font-size: 0.8rem; }
.flolio-hud__killfeed-item .reward { color: #44cc44; font-size: 0.65rem; }
@keyframes killfeedSlide { from { transform: translateX(50px); opacity:0; } to { transform:translateX(0); opacity:1; } }

/* ---- Wave Announcement ---- */
.flolio-hud__wave-announce {
    position: absolute;
    top: 30%; left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    animation: waveIn 0.5s ease;
    transition: opacity 0.5s;
}
.wave-announce-badge {
    font-size: 2.5rem; font-weight: 900;
    color: #00ff88; letter-spacing: 0.1em;
    text-shadow: 0 0 30px rgba(0,255,136,0.5);
    margin-bottom: 10px;
}
.flolio-hud__wave-announce p {
    font-size: 0.8rem; color: rgba(255,255,255,0.6);
    letter-spacing: 0.2em;
}
.wave-boss { color: #ff4444 !important; font-weight: 700; margin-top: 8px; }
@keyframes waveIn { from { transform:translateX(-50%) scale(0.5); opacity:0; } to { transform:translateX(-50%) scale(1); opacity:1; } }

/* ---- Wave Complete ---- */
.flolio-hud__wave-complete {
    position: absolute;
    top: 35%; left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}
.flolio-hud__wave-complete.active { opacity: 1; animation: waveIn 0.5s ease; }
.wave-complete-text { font-size: 1.5rem; font-weight: 900; color: #00ff88; letter-spacing: 0.08em; }
.wave-complete-sub { font-size: 0.75rem; color: #44cc44; margin-top: 8px; letter-spacing: 0.1em; }

/* ---- Buy Menu ---- */
.flolio-hud__buy-menu {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10,10,18,0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 24px;
    width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 100;
    pointer-events: auto;
}
.flolio-hud__buy-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.flolio-hud__buy-header h2 {
    font-size: 1.2rem; font-weight: 800; letter-spacing: 0.12em; color: #eee;
}
.flolio-hud__buy-money { color: #44cc44; font-weight: 700; font-size: 1.1rem; }
.flolio-hud__buy-close {
    background: none; border: none; color: rgba(255,255,255,0.4);
    font-size: 1.2rem; cursor: pointer; transition: color 0.2s;
}
.flolio-hud__buy-close:hover { color: #ff4444; }
.flolio-hud__buy-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.flolio-hud__buy-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.flolio-hud__buy-card:hover:not(.disabled) {
    border-color: #00ff88;
    background: rgba(0,255,136,0.05);
    transform: translateY(-2px);
}
.flolio-hud__buy-card.disabled {
    opacity: 0.3; cursor: not-allowed;
}
.buy-icon { font-size: 1.8rem; }
.buy-name { font-size: 0.7rem; font-weight: 700; color: #eee; letter-spacing: 0.06em; }
.buy-price { font-size: 0.75rem; font-weight: 600; color: #44cc44; }
.buy-stats { font-size: 0.55rem; color: rgba(255,255,255,0.3); }
.flolio-hud__buy-hint { text-align: center; font-size: 0.6rem; color: rgba(255,255,255,0.2); margin-top: 16px; letter-spacing: 0.1em; }
