#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

#hud-top-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#hud-top-left span {
    background: var(--hud-bg, rgba(10, 10, 26, 0.85));
    border: 1px solid var(--border, rgba(0, 255, 242, 0.15));
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--text, #e0e0ff);
}

#coin-count {
    color: #ffd700;
}

#coin-count::before {
    content: '\00A4 ';
}

#hud-top-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#player-list {
    background: var(--hud-bg, rgba(10, 10, 26, 0.85));
    border: 1px solid var(--border, rgba(0, 255, 242, 0.15));
    border-radius: 4px;
    padding: 8px 12px;
    min-width: 200px;
}

.player-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.player-row.dead {
    opacity: 0.35;
}

.player-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.player-name {
    flex: 1;
    color: var(--text, #e0e0ff);
    font-weight: 700;
}

.player-crown {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-crown::before {
    content: '\265B';
    color: #ffd700;
    font-size: 15px;
    line-height: 1;
    position: relative;
    top: -3px;
}

.player-coins {
    color: #ffd700;
    font-size: 10px;
    min-width: 20px;
    text-align: right;
}

.player-coins::before {
    content: '\00A4 ';
}

.player-kills {
    color: var(--primary, #00fff2);
    font-size: 10px;
    min-width: 45px;
    text-align: right;
}

.player-territory {
    color: var(--text-dim, #8888aa);
    font-size: 10px;
    min-width: 40px;
    text-align: right;
}

#minimap-container {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    width: 150px;
    height: 150px;
    border: 1px solid var(--border, rgba(0, 255, 242, 0.15));
    border-radius: 4px;
    overflow: hidden;
    background: var(--hud-bg, rgba(10, 10, 26, 0.85));
}

.minimap-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#stamina-bar {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border, rgba(0, 255, 242, 0.15));
    border-radius: 3px;
    z-index: 10;
    overflow: hidden;
}

#stamina-fill {
    height: 100%;
    width: 100%;
    background: var(--primary, #00fff2);
    border-radius: 2px;
    transition: width 0.1s linear;
}

#stamina-fill.boosting {
    background: var(--accent, #ff00ff);
}

@keyframes stamina-flash {
    0%   { background: #ff2222; box-shadow: 0 0 8px #ff2222; }
    100% { background: var(--primary, #00fff2); box-shadow: none; }
}

#stamina-fill.flash {
    animation: stamina-flash 0.4s ease-out;
}

@media (max-width: 600px) {
    #hud {
        padding: 4px;
    }

    #hud-top-left {
        gap: 3px;
    }

    #hud-top-left span {
        font-size: 7px;
        padding: 3px 7px;
        letter-spacing: 0.5px;
    }

    #player-list {
        min-width: 100px;
        padding: 3px 5px;
    }

    .player-row {
        font-size: 6px;
        gap: 4px;
        padding: 2px 0;
    }

    .player-color {
        width: 6px;
        height: 6px;
    }

    .player-crown {
        width: 6px;
        height: 6px;
    }

    .player-crown::before {
        font-size: 6px;
    }

    .player-coins,
    .player-kills,
    .player-territory {
        font-size: 6px;
        min-width: 20px;
    }

    #stamina-bar {
        width: 120px;
        height: 4px;
    }

    #minimap-container {
        width: 100px;
        height: 100px;
        bottom: 100px;
    }
}

/* Mobile touch: minimap to top-center, smaller */
@media (pointer: coarse), (hover: none) {
    #minimap-container {
        top: 10px;
        bottom: auto;
        left: 50%;
        transform: translateX(-50%);
        width: 90px;
        height: 90px;
        opacity: 0.75;
    }

    #stamina-bar {
        bottom: 20px;
    }
}
