/* Interface fixe en haut de l'écran : infos | mode | barres */
.hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;  /* Sous les écrans superposés (1000) */
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 16px;
    padding: 12px 16px;
    pointer-events: none;
}

/* Panneaux du HUD : même style que les menus */
.hud-info,
.bars-container {
    background: rgba(20, 20, 40, 0.85);
    border: 2px solid #ff6b35;
    border-radius: 10px;
    color: #fff;
    padding: 8px 14px;
}

.hud-info {
    justify-self: start;
    text-align: center;
}

.level-label {
    font-size: 13px;
    color: #ffb38a;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.level-label:empty {
    display: none;
}

.clock {
    font-size: 26px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;  /* Chiffres de même largeur */
}

.bars-container {
    justify-self: end;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-bar label {
    width: 90px;
    font-size: 14px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 4px;
}

.bar-bg {
    width: clamp(110px, 16vw, 260px);
    height: 14px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}

.work-bar-fill,
.heat-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.work-bar-fill {
    width: 100%;
    background: hsl(130, 70%, 45%);  /* Avant le premier updateBars() */
}

.heat-bar-fill {
    width: 0%;
}

/* Traits des seuils : salaire réduit (Travail) et surchauffe (Chaleur), position définie par le niveau */
.work-threshold,
.heat-threshold {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Salaire du jour et total de la partie */
.day-pay {
    margin-top: 4px;
    font-size: 16px;
    font-weight: bold;
    color: #ffd84a;
    font-variant-numeric: tabular-nums;
    border-radius: 4px;
}

.total-money {
    font-size: 12px;
    color: #ccc;
}

.day-pay:empty,
.total-money:empty {
    display: none;
}

/* Le salaire vient de baisser : flash rouge */
.day-pay.pay-loss {
    animation: pay-loss 0.4s ease-out;
}

@keyframes pay-loss {
    30% { color: #fff; background: #ff3b3b; transform: scale(1.1); }
}

/* Indicateur de mode, au centre du HUD : couleur selon le mode actif */
#workModeIndicator {
    color: #fff;
    padding: 8px 28px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease;
}

#workModeIndicator[data-mode='idle'] {
    background: rgba(0, 100, 255, 0.7);
}

#workModeIndicator[data-mode='work'] {
    background: rgba(255, 0, 0, 0.7);
}

#workModeIndicator[data-mode='cool'] {
    background: rgba(0, 150, 0, 0.7);
}

/* Rappel de l'alternance des flèches en mode ventilation */
#alternateIndicator {
    display: none;
    font-size: 150%;
    color: #fff;
}

#alternateIndicator.active {
    display: block;
}

#alternateIndicator.left {
    color: #00ffff;
}

#alternateIndicator.right {
    color: #ffff00;
}

/* Objets achetés en boutique */
.hud-items {
    font-size: 16px;
    letter-spacing: 2px;
}

.hud-items:empty {
    display: none;
}

/* Téléphone en portrait : HUD compact pour que les trois panneaux tiennent sur la largeur */
@media (max-width: 600px) {
    .hud {
        gap: 6px;
        padding: 8px;
    }

    .hud-info,
    .bars-container {
        padding: 6px 8px;
    }

    .clock {
        font-size: 20px;
    }

    .day-pay {
        font-size: 13px;
    }

    #workModeIndicator {
        padding: 6px 10px;
        font-size: 13px;
    }

    .stat-bar {
        gap: 6px;
    }

    .stat-bar label {
        width: auto;
        font-size: 11px;
        white-space: nowrap;
    }

    #alternateIndicator {
        font-size: 115%;
    }

    .bar-bg {
        width: clamp(48px, 18vw, 110px);
        margin-left: auto;
    }
}
