/* Bottom HUD bar */
.hud-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--hud-height);
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--panel-border);
    display: none;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    z-index: var(--z-hud);
}

.hud-bar.active {
    display: flex;
}

/* Bars section */
.hud-bars {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.hud-bar-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hud-bar-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 24px;
    text-align: right;
}

.hud-bar-track {
    width: 120px;
    height: 16px;
    background: var(--bar-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.hud-bar-fill {
    height: 100%;
    transition: width 0.15s linear;
    border-radius: 8px;
}

.hud-bar-fill.hp {
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 40%), var(--bar-hp);
}

.hud-bar-fill.hunger {
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 40%), var(--bar-hunger);
}

.hud-bar-fill.stamina {
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 40%), var(--bar-stamina);
}

/* Low bar flash */
@keyframes bar-flash-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.hud-bar-fill.low {
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 40%), #e04040 !important;
    animation: bar-flash-red 0.8s ease-in-out infinite;
}

.hud-bar-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Icon buttons */
.hud-buttons {
    display: flex;
    gap: 8px;
}

.hud-icon-btn {
    width: 40px;
    height: 40px;
    background: var(--btn-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: var(--btn-text);
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-family: var(--font-main);
}

.hud-icon-btn:hover {
    background: var(--btn-hover);
}

.hud-icon-btn:active {
    transform: scale(0.95);
}

.hud-icon-btn.active {
    background: var(--btn-active);
    border-color: var(--text-title);
}

/* Camera control buttons (right side of HUD) */
.hud-camera-buttons {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

/* Responsive: mobile HUD */
@media (max-width: 600px) {
    .hud-bar {
        padding: 0 8px;
        gap: 8px;
    }

    .hud-bar-track {
        width: 80px;
    }

    .hud-icon-btn {
        width: 42px;
        height: 42px;
    }

    .hud-camera-buttons {
        display: none;
    }
}

/* ─── Player name labels ─── */
.player-name-label {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-main);
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 6px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    will-change: transform;
}
