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

:root {
    --hud-accent: #e8c060;
    --hud-accent-dim: rgba(232, 192, 96, 0.2);
    --hud-bg: rgba(8, 10, 16, 0.92);
    --hud-border: rgba(255, 255, 255, 0.08);
    --hud-text: #eef2f8;
    --hud-muted: #7a8499;
    --hud-danger: #ff5c6a;
    --hud-diamond: #7ee8ff;
    --hud-ammo: #6a8eb8;
    --hud-ammo-dim: rgba(106, 142, 184, 0.28);
    --hud-bombs: #4a90e8;
    --hud-bombs-dim: rgba(74, 144, 232, 0.3);
    --hud-lockpick: #a87850;
    --hud-lockpick-dim: rgba(168, 120, 80, 0.28);
    --hud-level: #b8e986;
    --hud-level-dim: rgba(184, 233, 134, 0.22);
    --hud-lives: #ff8a3d;
    --hud-lives-dim: rgba(255, 138, 61, 0.28);
    --hud-score: #f0c850;
    --hud-score-dim: rgba(240, 200, 80, 0.28);
    --hud-exp: #d4a86a;
    --hud-exp-dim: rgba(212, 168, 106, 0.28);
    --menu-bg: #030408;
    --menu-bg-top: #060810;
    --menu-panel-bg: #080a10;
    --menu-inset-bg: #040508;
    --menu-inset-header: #020204;
    --menu-row-alt: #030406;
    --menu-border: rgba(255, 255, 255, 0.07);
    --military-rank-badge-bg: #4a5058;
    --stat-chip-fixed-w: 40px;
    --stat-chip-fixed-h: 20px;
}

body {
    background-color: #050505;
    color: #eee;
    font-family: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 10px;
    user-select: none;
    overflow: hidden;
}

.game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 1188px;
    max-width: 100%;
    --soldier-profile-top: 58px;
    --soldier-profile-column-offset: 100px;
}

.game-hud {
    --hud-height: 48px;
    --hud-stat-body-h: 37px;
    --hud-stat-box-gap: 5px;
    --hud-stat-label-gap: 5px;
    width: 100%;
    box-sizing: border-box;
    container-type: inline-size;
    container-name: hud;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto;
    grid-template-areas: "hud-left hud-right";
    align-items: center;
    gap: 8px;
    min-height: var(--hud-height);
    margin-bottom: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 40%),
        var(--hud-bg);
    border: 1px solid var(--hud-border);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.45) inset,
        0 8px 32px rgba(0, 0, 0, 0.45),
        0 0 24px var(--hud-accent-dim);
    position: relative;
    z-index: 12;
    overflow: visible;
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
}

.game-hud * {
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}

.game-hud .hud-btn,
.game-hud .hud-pause-menu__item {
    cursor: pointer;
}

.game-hud::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--hud-accent), transparent);
    opacity: 0.85;
}

.game-hud::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 120% at 50% -40%, var(--hud-accent-dim), transparent 70%);
    pointer-events: none;
}

.game-hud--bottom {
    margin-top: 6px;
    margin-bottom: 0;
    container-name: hud-bottom;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "hud-left hud-right";
    gap: 8px;
}

.game-hud--bottom::before {
    inset: 0 0 auto 0;
}

.game-hud--bottom::after {
    background: radial-gradient(ellipse 60% 120% at 50% 140%, var(--hud-accent-dim), transparent 70%);
}

.hud-cluster--bottom {
    justify-content: flex-start;
    justify-self: stretch;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    flex-wrap: nowrap;
}

.game-hud--bottom .hud-cluster--right {
    flex-shrink: 0;
    align-self: center;
}

.hud-cluster {
    display: flex;
    align-items: center;
    gap: var(--hud-stat-box-gap);
    position: relative;
    z-index: 1;
}

.hud-cluster--left {
    grid-area: hud-left;
    justify-content: flex-start;
    justify-self: stretch;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    flex-shrink: 1;
    flex-wrap: nowrap;
}

.hud-divider {
    flex: 0 0 auto;
    align-self: center;
    width: 1px;
    height: calc(var(--hud-stat-body-h) - 4px);
    min-height: 26px;
    margin: 0 2px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(255, 255, 255, 0.16) 18%,
        rgba(255, 255, 255, 0.16) 82%,
        transparent 100%
    );
    box-shadow: 1px 0 0 rgba(0, 0, 0, 0.28);
    pointer-events: none;
}

.hud-stat--biome,
.hud-stat--toxicity,
.hud-stat--adventurer,
.hud-stat--level,
.hud-stat--kills,
.hud-stat--executions,
.hud-stat--stuns,
.hud-stat--experience,
.hud-stat--score {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

.hud-stat--stats {
    flex: 0 0 auto;
    min-width: 0;
    max-width: none;
    align-items: flex-start;
}

.hud-stat--biome .hud-stat__body,
.hud-stat--level .hud-stat__body,
.hud-stat--adventurer .hud-stat__body,
.hud-stat--kills .hud-stat__body,
.hud-stat--executions .hud-stat__body,
.hud-stat--stuns .hud-stat__body,
.hud-stat--experience .hud-stat__body,
.hud-stat--score .hud-stat__body {
    flex-shrink: 1;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
}

.hud-stat--stats .hud-stat__body {
    flex-shrink: 0;
    overflow: visible;
    min-width: 0;
    max-width: none;
    gap: 0;
    justify-content: flex-start;
}

.hud-stat--stats .hud-stat__body:has(.stat-chip-grid--peaks) {
    min-height: 0;
    height: auto;
}

.hud-stat--stats .hud-stat__body:has(.stat-chip-grid__empty) {
    min-height: 0;
    height: auto;
}

.hud-cluster--right {
    grid-area: hud-right;
    justify-content: flex-end;
    justify-self: end;
    flex-shrink: 0;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    gap: var(--hud-stat-box-gap);
    z-index: 16;
}

.hud-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 6px;
    min-height: 43px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    flex-shrink: 1;
}

.hud-stat__icon {
    --hud-icon-size: 28px;
    display: grid;
    place-items: center;
    width: var(--hud-icon-size);
    height: var(--hud-icon-size);
    border-radius: 8px;
    font-size: 0;
    line-height: 0;
    color: var(--hud-accent);
    background: var(--hud-accent-dim);
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    overflow: visible;
}

.hud-stat__glyph {
    display: block;
    width: var(--hud-glyph-w, 14px);
    height: var(--hud-glyph-h, 14px);
    line-height: 0;
    flex-shrink: 0;
}

.hud-stat__glyph > svg {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    fill: currentColor;
}

.hud-stat__glyph--diamond {
    --hud-glyph-w: 14px;
    --hud-glyph-h: 14px;
}

.hud-stat--key {
    --hud-accent: #d8a850;
}

.hud-stat__icon--key {
    background: linear-gradient(145deg, rgba(210, 170, 80, 0.34), rgba(90, 65, 20, 0.42));
    border-color: rgba(220, 180, 90, 0.45);
    color: #f0d090;
    box-shadow: 0 0 12px rgba(216, 168, 80, 0.24);
}

.hud-stat__glyph--key {
    --hud-glyph-w: 13px;
    --hud-glyph-h: 16px;
}

.hud-key-assembly {
    position: relative;
    display: flex;
    align-items: center;
    gap: 3px;
    width: auto;
    min-width: calc(3 * 11px + 2 * 3px);
    height: 14px;
    margin-top: 1px;
}

.hud-key__assembly-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
}

.hud-key-slot {
    position: absolute;
    top: 1px;
    width: 10px;
    height: 10px;
    pointer-events: none;
}

.hud-key-slot[data-key-slot="0"] { left: 0; }
.hud-key-slot[data-key-slot="1"] { left: 14px; }
.hud-key-slot[data-key-slot="2"] { left: 28px; }

.hud-stat--key .hud-stat__label {
    letter-spacing: 0.04em;
}

.hud-stat__glyph--man {
    --hud-glyph-w: 12px;
    --hud-glyph-h: 21px;
}

.hud-stat__glyph--ammo {
    --hud-glyph-w: 18px;
    --hud-glyph-h: 12px;
}

.hud-stat__glyph--lockpick {
    --hud-glyph-w: 14px;
    --hud-glyph-h: 14px;
}

.hud-stat__glyph--score {
    --hud-glyph-w: 14px;
    --hud-glyph-h: 14px;
}

.hud-icon-svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: currentColor;
    margin: 0;
}

.hud-icon-svg--fullscreen {
    width: 18px;
    height: 18px;
    fill: none;
}

.hud-stat__icon--diamond {
    background: linear-gradient(145deg, rgba(140, 230, 255, 0.35), rgba(40, 140, 200, 0.22) 55%, rgba(20, 80, 140, 0.35));
    border-color: rgba(126, 232, 255, 0.38);
    box-shadow: 0 0 12px rgba(100, 220, 255, 0.28);
    color: #d8f8ff;
}

.hud-stat__icon--man {
    background: linear-gradient(145deg, rgba(255, 140, 60, 0.34), rgba(180, 75, 25, 0.2));
    border-color: rgba(255, 138, 61, 0.45);
    color: var(--hud-lives);
    box-shadow: 0 0 10px var(--hud-lives-dim);
}

.hud-stat__icon--ammo {
    background: linear-gradient(145deg, rgba(120, 160, 210, 0.34), rgba(45, 65, 100, 0.48));
    border-color: rgba(130, 170, 220, 0.42);
    color: var(--hud-ammo);
    box-shadow: 0 0 12px var(--hud-ammo-dim);
}

.hud-stat__icon--bombs {
    background: linear-gradient(145deg, rgba(90, 150, 230, 0.36), rgba(30, 55, 110, 0.5));
    border-color: rgba(110, 170, 255, 0.45);
    color: var(--hud-bombs);
    box-shadow: 0 0 12px var(--hud-bombs-dim);
}

.hud-stat__icon--lockpick {
    background: linear-gradient(145deg, rgba(168, 118, 78, 0.36), rgba(72, 46, 28, 0.48));
    border-color: rgba(184, 132, 88, 0.45);
    color: var(--hud-lockpick);
    box-shadow: 0 0 12px var(--hud-lockpick-dim);
}

.hud-stat__icon--score {
    background: linear-gradient(145deg, rgba(255, 220, 100, 0.35), rgba(200, 150, 40, 0.22) 55%, rgba(140, 100, 20, 0.35));
    border-color: rgba(245, 200, 66, 0.45);
    box-shadow: 0 0 12px var(--hud-score-dim);
    color: #ffe08a;
}

.hud-stat__icon--experience {
    background: linear-gradient(145deg, rgba(220, 180, 110, 0.36), rgba(150, 105, 45, 0.24) 55%, rgba(95, 65, 20, 0.34));
    border-color: rgba(212, 168, 106, 0.45);
    box-shadow: 0 0 12px var(--hud-exp-dim);
    color: #f0d090;
}

.hud-stat__glyph--experience {
    --hud-glyph-w: 14px;
    --hud-glyph-h: 14px;
}

.hud-stat__icon--biome {
    background: linear-gradient(145deg, var(--hud-accent-dim), rgba(0, 0, 0, 0.18) 55%, var(--hud-accent-dim));
    border-color: color-mix(in srgb, var(--hud-accent) 42%, transparent);
    box-shadow: 0 0 12px var(--hud-accent-dim);
    position: relative;
}

.hud-stat__icon--biome::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--hud-accent);
    box-shadow: 0 0 8px var(--hud-accent-dim);
}

.hud-stat__body {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    min-height: var(--hud-stat-body-h);
    height: auto;
    justify-content: flex-start;
}

.hud-stat--level .hud-stat__label,
.hud-stat--biome .hud-stat__label,
.hud-stat--toxicity .hud-stat__label,
.hud-stat--adventurer .hud-stat__label,
.hud-stat--kills .hud-stat__label,
.hud-stat--executions .hud-stat__label,
.hud-stat--stuns .hud-stat__label,
.hud-stat--diamonds .hud-stat__label,
.hud-stat--key .hud-stat__label,
.hud-stat--lockpick .hud-stat__label,
.hud-stat--ammo .hud-stat__label,
.hud-stat--bombs .hud-stat__label,
.hud-stat--lives .hud-stat__label,
.hud-stat--score .hud-stat__label,
.hud-stat--experience .hud-stat__label,
.hud-stat--stats .hud-stat__label {
    margin-bottom: var(--hud-stat-label-gap);
}

.hud-stat__body--wide {
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
    flex-shrink: 1;
    min-height: var(--hud-stat-body-h);
    height: auto;
    justify-content: flex-start;
    overflow: hidden;
}

.hud-stat__label {
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--hud-muted);
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    white-space: nowrap;
}

.hud-stat__label--toxicity {
    letter-spacing: 0.04em;
}

.hud-stat__value {
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    color: var(--hud-text);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    max-width: 100%;
    flex-shrink: 1;
}

.hud-stat__value--biome {
    font-size: 11px;
    font-weight: 600;
    color: var(--hud-accent);
    white-space: nowrap;
    min-height: 15px;
    display: block;
    max-width: 14em;
}

.hud-stat--toxicity {
    flex: 0 0 auto;
    min-width: 0;
}

.hud-stat--toxicity .hud-stat__body--wide {
    min-width: 118px;
    justify-content: flex-start;
}

.hud-stat__icon--toxicity {
    background: linear-gradient(145deg, rgba(255, 120, 90, 0.34), rgba(120, 40, 30, 0.4) 55%, rgba(60, 20, 16, 0.4));
    border-color: rgba(255, 140, 100, 0.42);
    box-shadow: 0 0 12px rgba(255, 100, 70, 0.22);
    color: #ffb090;
}

.hud-stat__glyph--toxicity {
    --hud-glyph-w: 15px;
    --hud-glyph-h: 15px;
}

.hud-biome-toxicity {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 18px;
}

.hud-toxicity-icon {
    display: inline-flex;
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    transition: color 0.22s ease, filter 0.22s ease, transform 0.22s ease, opacity 0.22s ease;
}

.hud-toxicity-icon__svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

/* Spenti: sempre presenti, appena visibili */
.hud-toxicity-icon--off {
    color: rgba(200, 210, 190, 0.28);
    opacity: 0.9;
    filter: none;
}

/* Accesi: pieni, colorati, leggero glow */
.hud-toxicity-icon--on {
    opacity: 1;
    transform: translateY(-0.5px) scale(1.06);
}

.hud-toxicity-icon--lv1 {
    color: #6ef7a8;
    filter: drop-shadow(0 0 2.5px rgba(110, 247, 168, 0.85));
}

.hud-toxicity-icon--lv2 {
    color: #b4f04a;
    filter: drop-shadow(0 0 2.5px rgba(180, 240, 74, 0.9));
}

.hud-toxicity-icon--lv3 {
    color: #ffe24a;
    filter: drop-shadow(0 0 3px rgba(255, 226, 74, 0.95));
}

.hud-toxicity-icon--lv4 {
    color: #ff9a45;
    filter: drop-shadow(0 0 3px rgba(255, 154, 69, 0.95));
}

.hud-toxicity-icon--lv5 {
    color: #ff5c7e;
    filter: drop-shadow(0 0 3.5px rgba(255, 92, 126, 1));
}

.hud-stat__value--adventurer {
    font-size: 11px;
    font-weight: 600;
    color: var(--hud-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 9em;
    min-height: 15px;
    display: block;
}

.hud-shield-pips {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 3px;
    min-height: 6px;
    transform: translateY(-1px);
}

.hud-shield-pip {
    width: 10px;
    height: 5px;
    border-radius: 1px;
    box-sizing: border-box;
    flex: 0 0 auto;
}

.hud-shield-pip--filled {
    background: #5ef0ff;
    box-shadow: 0 0 4px rgba(94, 240, 255, 0.55);
}

.hud-shield-pip--empty {
    background: rgba(94, 240, 255, 0.12);
    border: 1px solid rgba(94, 240, 255, 0.45);
}

.hud-shield-pip--locked {
    background: rgba(40, 52, 64, 0.55);
    border: 1px solid rgba(80, 96, 112, 0.35);
}

.hud-stat__sub--hp {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: #ff8a8a;
    letter-spacing: 0.02em;
    margin-top: 1px;
    white-space: nowrap;
}

.hud-stats-recap {
    display: grid;
    grid-template-columns: repeat(6, 28px);
    gap: 2px 2px;
    min-width: 178px;
    max-width: 178px;
    margin-top: 1px;
    flex: 1 1 auto;
    align-content: start;
    min-height: 0;
}

.hud-bombs {
    display: flex;
    align-items: center;
    min-height: 12px;
}

.hud-bombs__row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.bomb-slot {
    width: 11px;
    height: 11px;
    display: inline-flex;
    color: rgba(100, 140, 200, 0.28);
}

.bomb-slot.filled {
    color: #5aa8ff;
    filter: drop-shadow(0 0 2px rgba(90, 168, 255, 0.7));
}

.bomb-slot__svg {
    width: 100%;
    height: 100%;
    display: block;
}

.hud-stat--ammo .hud-ammo {
    flex: 1 1 auto;
    min-height: 0;
}

.hud-stat--lockpick .hud-lockpicks {
    --lockpick-slot-size: 10px;
    --lockpick-icon-size: 8px;
    --lockpick-slot-gap: 3px;
    flex: 1 1 auto;
    min-height: 0;
    min-width: calc(5 * var(--lockpick-slot-size) + 4 * var(--lockpick-slot-gap));
    position: relative;
    z-index: 3;
    gap: var(--lockpick-slot-gap);
}

.hud-stat--lockpick .hud-lockpicks__row {
    display: flex;
    gap: var(--lockpick-slot-gap);
    align-items: center;
    justify-content: flex-start;
}

.hud-stat--lockpick .lockpick-slot {
    width: var(--lockpick-slot-size);
    height: var(--lockpick-slot-size);
}

.hud-stat--lockpick .lockpick-slot__svg {
    width: var(--lockpick-icon-size);
    height: var(--lockpick-icon-size);
}

.hud-stat--lockpick .hud-lockpicks__row .lockpick-slot:nth-child(odd) {
    transform: none;
}

.hud-ammo .ammo-bullet {
    height: 11px;
    width: 6px;
}

.hud-stats-recap__chip {
    display: grid;
    grid-template-columns: 17px 9px;
    column-gap: 1px;
    align-items: baseline;
    white-space: nowrap;
    line-height: 1.1;
    min-width: 0;
}

.hud-stats-recap__label {
    font-size: 6.5px;
    font-weight: 700;
    letter-spacing: 0;
    color: rgba(158, 200, 232, 0.72);
    width: 17px;
    overflow: hidden;
}

.hud-stats-recap__value {
    font-size: 9px;
    font-weight: 800;
    color: var(--stat-color, #c8e8ff);
    font-variant-numeric: tabular-nums;
    width: 9px;
    text-align: left;
}

.hud-stats-recap__empty {
    font-size: 9px;
    color: var(--hud-muted);
}

.hud-stats-recap--icons {
    display: block;
    min-width: 0;
    max-width: 178px;
    width: max-content;
    margin-top: 0;
    overflow: visible;
}

.hud-stats-recap--icons .stat-chip-grid--hud {
    min-height: 27px;
}

.hud-stats-recap--icons .stat-chip-grid--hud.stat-chip-grid--peaks {
    min-height: 18px;
}

.stat-chip-grid--hud.stat-chip-grid--peaks {
    --stat-hud-chip-icon: 10px;
    --stat-hud-chip-w: var(--stat-chip-fixed-w);
    --stat-hud-chip-h: 18px;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    width: max-content;
    max-width: none;
}

.stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud,
.stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud.stat-chip--labels-only {
    display: inline-grid;
    grid-template-columns: var(--stat-hud-chip-icon) 1fr;
    align-items: center;
    align-content: center;
    column-gap: 2px;
    width: var(--stat-hud-chip-w);
    min-width: var(--stat-hud-chip-w);
    max-width: var(--stat-hud-chip-w);
    height: var(--stat-hud-chip-h);
    min-height: var(--stat-hud-chip-h);
    padding: 0 2px;
    box-sizing: border-box;
}

.stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud .stat-chip__icon {
    width: var(--stat-hud-chip-icon);
    height: var(--stat-hud-chip-icon);
    flex: 0 0 auto;
    justify-self: center;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud .stat-chip__icon svg {
    display: block;
    width: var(--stat-hud-chip-icon);
    height: var(--stat-hud-chip-icon);
}

.stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud .stat-chip__label {
    font-size: 8px;
    font-weight: 800;
    line-height: 1;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-align: center;
    padding: 0;
    margin: 0;
    transform: none;
}

.hud-stat--stats .hud-stat__label {
    transform: translateY(-3px);
}

.hud-stat__label--specialita {
    text-transform: none;
    letter-spacing: 0.06em;
}

.hud-stats-recap--icons:has(.stat-chip-grid--peaks) {
    max-width: none;
    transform: translateY(-1px);
}

.stat-chip-grid {
    display: grid;
    grid-template-columns: repeat(6, max-content);
    gap: 2px 3px;
    min-width: 0;
}

.stat-chip-grid__empty {
    font-size: 9px;
    color: var(--hud-muted);
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 3px 1px 2px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--stat-color, #9ec8ff) 14%, rgba(255, 255, 255, 0.04));
    border: 1px solid color-mix(in srgb, var(--stat-color, #9ec8ff) 62%, transparent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--stat-color, #9ec8ff) 22%, transparent);
    white-space: nowrap;
    line-height: 1;
}

.stat-chip--chest-boost {
    border: 1.5px solid var(--stat-color, #9ec8ff);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--stat-color, #9ec8ff) 35%, transparent),
        0 0 10px color-mix(in srgb, var(--stat-color, #9ec8ff) 55%, transparent);
    background: color-mix(in srgb, var(--stat-color, #9ec8ff) 24%, rgba(255, 255, 255, 0.06));
}

.stat-chip--pregio {
    --stat-color: #4da6ff;
    border-color: color-mix(in srgb, #4da6ff 88%, white);
    background: color-mix(in srgb, #4da6ff 24%, rgba(255, 255, 255, 0.06));
    box-shadow:
        0 0 0 1px color-mix(in srgb, #4da6ff 40%, transparent),
        0 0 12px color-mix(in srgb, #4da6ff 48%, transparent);
}

.stat-chip--difetto {
    --stat-color: #ff4055;
    border-color: color-mix(in srgb, #ff4055 88%, white);
    background: color-mix(in srgb, #ff4055 22%, rgba(255, 255, 255, 0.05));
    box-shadow:
        0 0 0 1px color-mix(in srgb, #ff4055 40%, transparent),
        0 0 12px color-mix(in srgb, #ff4055 45%, transparent);
}

.stat-chip--pregio .stat-chip__label,
.stat-chip--pregio .stat-chip__value,
.stat-chip--pregio .stat-chip__icon {
    color: #4da6ff !important;
}

.stat-chip--difetto .stat-chip__label,
.stat-chip--difetto .stat-chip__value,
.stat-chip--difetto .stat-chip__icon {
    color: #ff4055 !important;
}

.hud-stats-recap__chip--pregio .hud-stats-recap__value {
    --stat-color: #4da6ff;
    color: #4da6ff;
    text-shadow: 0 0 8px color-mix(in srgb, #4da6ff 55%, transparent);
}

.hud-stats-recap__chip--difetto .hud-stats-recap__value {
    --stat-color: #ff4055;
    color: #ff4055;
    text-shadow: 0 0 8px color-mix(in srgb, #ff4055 55%, transparent);
}

.stat-chip__icon {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    display: block;
    color: var(--stat-color, #9ec8ff);
}

.stat-chip__label {
    font-size: 6px;
    font-weight: 700;
    letter-spacing: 0;
    color: color-mix(in srgb, var(--stat-color, #9ec8ff) 55%, rgba(200, 220, 240, 0.82));
}

.stat-chip__value {
    font-size: 8px;
    font-weight: 800;
    color: var(--stat-color, #c8e8ff);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 6px color-mix(in srgb, var(--stat-color, #c8e8ff) 45%, transparent);
}

.stat-chip--icons-only {
    padding: 2px;
    gap: 0;
    justify-content: center;
    background: color-mix(in srgb, var(--stat-color, #9ec8ff) 32%, rgba(6, 10, 20, 0.92));
    border: 1px solid color-mix(in srgb, var(--stat-color, #9ec8ff) 78%, white);
    box-shadow:
        0 0 8px color-mix(in srgb, var(--stat-color, #9ec8ff) 38%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.stat-chip--labels-only {
    background: color-mix(in srgb, var(--stat-color, #9ec8ff) 22%, rgba(6, 10, 20, 0.9));
    border: 1px solid color-mix(in srgb, var(--stat-color, #9ec8ff) 72%, white);
    box-shadow:
        0 0 6px color-mix(in srgb, var(--stat-color, #9ec8ff) 30%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.stat-chip--icons-only .stat-chip__icon,
.stat-chip--labels-only .stat-chip__icon {
    filter: drop-shadow(0 0 2px color-mix(in srgb, var(--stat-color, #9ec8ff) 55%, transparent));
}

.stat-chip--labels-only .stat-chip__label {
    color: color-mix(in srgb, var(--stat-color, #9ec8ff) 82%, white);
    text-shadow: 0 0 4px color-mix(in srgb, var(--stat-color, #9ec8ff) 35%, transparent);
}

.stat-chip-grid--menu {
    --lb-stat-chip-w: 36px;
    --lb-stat-chip-h: 14px;
    grid-template-columns: repeat(6, var(--lb-stat-chip-w));
    gap: 4px 3px;
    justify-items: stretch;
    width: max-content;
}

.stat-chip--menu.stat-chip--labels-only {
    display: inline-grid;
    grid-template-columns: 10px 1fr;
    align-items: center;
    align-content: center;
    justify-content: center;
    width: var(--lb-stat-chip-w);
    height: var(--lb-stat-chip-h);
    min-width: var(--lb-stat-chip-w);
    max-width: var(--lb-stat-chip-w);
    min-height: var(--lb-stat-chip-h);
    padding: 0 2px;
    column-gap: 2px;
    box-sizing: border-box;
}

.stat-chip--menu.stat-chip--labels-only .stat-chip__icon {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    justify-self: center;
}

.stat-chip--menu.stat-chip--labels-only .stat-chip__icon svg {
    display: block;
    width: 10px;
    height: 10px;
}

.stat-chip--menu.stat-chip--labels-only .stat-chip__label {
    font-size: 6.5px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-align: center;
    padding: 0;
    margin: 0;
}

.stat-chip--menu {
    padding: 1px 3px 1px 2px;
    border-radius: 4px;
}

.stat-chip--menu.stat-chip--icons-only {
    padding: 2px 3px;
}

.stat-chip--menu .stat-chip__icon {
    width: 10px;
    height: 10px;
}

.stat-chip--menu.stat-chip--icons-only .stat-chip__icon {
    width: 12px;
    height: 12px;
}

.stat-chip--menu .stat-chip__label {
    font-size: 6.5px;
}

.stat-chip--menu .stat-chip__value {
    font-size: 8px;
}

.stat-chip-grid--menu-specialty {
    --lb-stat-chip-w: var(--stat-chip-fixed-w);
    --lb-stat-chip-h: var(--stat-chip-fixed-h);
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    width: max-content;
    max-width: 100%;
    justify-content: flex-start;
}

.stat-chip-grid--menu-specialty.stat-chip-grid--peaks .stat-chip--menu-specialty,
.stat-chip-grid--menu-specialty.stat-chip-grid--peaks .stat-chip--menu-specialty.stat-chip--labels-only {
    display: inline-grid;
    grid-template-columns: 14px 1fr;
    align-items: center;
    align-content: center;
    justify-content: center;
    width: var(--lb-stat-chip-w);
    height: var(--lb-stat-chip-h);
    min-width: var(--lb-stat-chip-w);
    max-width: var(--lb-stat-chip-w);
    min-height: var(--lb-stat-chip-h);
    padding: 0 2px;
    column-gap: 2px;
    box-sizing: border-box;
    border-radius: 5px;
}

.stat-chip-grid--menu-specialty .stat-chip--menu-specialty.stat-chip--labels-only .stat-chip__icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-chip-grid--menu-specialty .stat-chip--menu-specialty.stat-chip--labels-only .stat-chip__icon svg {
    display: block;
    width: 14px;
    height: 14px;
}

.stat-chip-grid--menu-specialty .stat-chip--menu-specialty.stat-chip--labels-only .stat-chip__label {
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-align: center;
    padding: 0;
    margin: 0;
}

.stat-chip-grid--hud {
    --stat-hud-col-w: 26px;
    --stat-hud-chip-icon: 7px;
    grid-template-columns: repeat(6, var(--stat-hud-col-w));
    gap: 1px 2px;
    align-items: center;
    justify-items: stretch;
    width: max-content;
    max-width: 178px;
}

.stat-chip--hud {
    display: grid;
    grid-template-columns: 8px 13px;
    align-items: center;
    align-content: center;
    column-gap: 1px;
    width: 100%;
    min-height: 11px;
    padding: 0 1px;
    box-sizing: border-box;
    border-radius: 3px;
}

.stat-chip--hud.stat-chip--labels-only {
    display: inline-grid;
    grid-template-columns: var(--stat-hud-chip-icon) 1fr;
    align-items: center;
    align-content: center;
    column-gap: 2px;
    width: 100%;
    min-width: 0;
    max-width: var(--stat-hud-col-w);
    padding: 0 2px;
    box-sizing: border-box;
}

.stat-chip-grid--hud .stat-chip--hud .stat-chip__icon {
    width: var(--stat-hud-chip-icon);
    height: var(--stat-hud-chip-icon);
    flex: 0 0 auto;
    justify-self: center;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-chip-grid--hud .stat-chip--hud .stat-chip__icon svg {
    display: block;
    width: var(--stat-hud-chip-icon);
    height: var(--stat-hud-chip-icon);
}

.stat-chip-grid--hud .stat-chip--hud .stat-chip__label {
    font-size: 6px;
    font-weight: 700;
    line-height: 1;
    height: var(--stat-hud-chip-icon);
    flex: 0 0 auto;
    align-self: center;
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
    text-align: center;
    min-width: 0;
    padding: 0;
    margin: 0;
}

.stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud .stat-chip__label {
    font-size: 8px;
    font-weight: 800;
}

.stat-chip-grid--sheet {
    --stat-sheet-col-w: 124px;
    --stat-sheet-row-gap: 10px;
    --stat-sheet-col-gap: 14px;
    grid-template-columns: repeat(4, var(--stat-sheet-col-w));
    gap: var(--stat-sheet-row-gap) var(--stat-sheet-col-gap);
    align-items: center;
    justify-items: stretch;
}

.stat-chip--sheet {
    display: grid;
    grid-template-columns: 22px 38px minmax(0, 1fr);
    align-items: center;
    column-gap: 6px;
    width: 100%;
    min-height: 36px;
    padding: 6px 8px;
    box-sizing: border-box;
    border-radius: 8px;
}

.stat-chip--sheet .stat-chip__icon {
    grid-column: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    justify-self: center;
}

.stat-chip--sheet .stat-chip__icon svg {
    display: block;
    width: 20px;
    height: 20px;
}

.stat-chip--sheet .stat-chip__label {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    align-self: center;
    font-size: 16px;
    min-width: 0;
    width: auto;
    line-height: 1;
    padding: 0;
    margin: 0;
    transform: translateY(2px);
}

.stat-chip--sheet .stat-chip__value {
    grid-column: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    align-self: center;
    justify-self: end;
    font-size: 22px;
    min-width: 20px;
    width: auto;
    line-height: 1;
    padding: 0;
    margin: 0;
    transform: translateY(2px);
    text-align: right;
    text-shadow: 0 0 14px color-mix(in srgb, var(--stat-color, #c8e8ff) 38%, transparent);
}

.stat-chip--sheet.stat-chip--chest-boost {
    border: 2.5px solid rgba(255, 255, 255, 0.94);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.42),
        0 0 16px rgba(255, 255, 255, 0.2),
        inset 0 0 10px rgba(255, 255, 255, 0.08);
    background: color-mix(in srgb, var(--stat-color, #9ec8ff) 20%, rgba(255, 255, 255, 0.1));
    animation: chest-boost-sheet-pulse 2.6s ease-in-out infinite;
}

.stat-chip--sheet.stat-chip--chest-boost .stat-chip__value {
    text-shadow: 0 0 18px color-mix(in srgb, var(--stat-color, #c8e8ff) 55%, transparent);
}

.stat-chip--sheet.stat-chip--pregio,
.stat-chip--sheet.stat-chip--difetto {
    border-width: 2px;
}

.stat-chip--sheet.stat-chip--pregio .stat-chip__value {
    text-shadow: 0 0 18px color-mix(in srgb, #4da6ff 62%, transparent);
}

.stat-chip--sheet.stat-chip--difetto .stat-chip__value {
    text-shadow: 0 0 18px color-mix(in srgb, #ff4055 58%, transparent);
}

@keyframes chest-boost-sheet-pulse {
    0%, 100% {
        border-color: rgba(255, 255, 255, 0.82);
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.3),
            0 0 12px rgba(255, 255, 255, 0.12),
            inset 0 0 8px rgba(255, 255, 255, 0.05);
        background: color-mix(in srgb, var(--stat-color, #9ec8ff) 16%, rgba(255, 255, 255, 0.06));
    }
    50% {
        border-color: rgba(255, 255, 255, 1);
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.55),
            0 0 22px rgba(255, 255, 255, 0.28),
            inset 0 0 14px rgba(255, 255, 255, 0.14);
        background: color-mix(in srgb, var(--stat-color, #9ec8ff) 24%, rgba(255, 255, 255, 0.14));
    }
}

.hud-stat__icon--stats {
    --hp-badge-color: #4da6ff;
    background: color-mix(in srgb, var(--hp-badge-color) 42%, rgba(8, 12, 20, 0.9));
    border-color: color-mix(in srgb, var(--hp-badge-color) 58%, white);
    box-shadow: 0 0 10px color-mix(in srgb, var(--hp-badge-color) 24%, transparent);
    color: #fff;
}

.hud-stat__icon--stats .hud-stat__glyph--stats {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    width: 100%;
    height: 100%;
}

.hud-stat__icon--stats .hud-stat__glyph--stats > svg.hud-hp-badge__heart {
    position: absolute;
    top: -5px;
    left: -5px;
    z-index: 1;
    display: block;
    width: 11px;
    height: 11px;
    min-width: 11px;
    min-height: 11px;
    max-width: 11px;
    max-height: 11px;
    fill: #e83838;
    color: #e83838;
    pointer-events: none;
}

.hud-hp-badge__value {
    position: relative;
    z-index: 2;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hud-stat__icon--stats-critical {
    animation: hud-hp-critical-blink 0.85s ease-in-out infinite;
}

.hud-stat__icon--stats-dead {
    --hp-badge-color: #8a8a8a;
    opacity: 0.82;
}

@keyframes hud-hp-critical-blink {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px color-mix(in srgb, var(--hp-badge-color) 24%, transparent);
    }
    50% {
        opacity: 0.42;
        box-shadow: 0 0 16px color-mix(in srgb, var(--hp-badge-color) 55%, transparent);
    }
}

.hud-adventurer-portrait--dead {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(24, 12, 16, 0.92);
    border-color: rgba(180, 80, 80, 0.45);
    color: #e8e0dc;
}

.hud-adventurer-skull {
    width: 18px;
    height: 18px;
    display: block;
}

.hud-stat__icon--executions {
    background: rgba(255, 100, 100, 0.14);
    border-color: rgba(255, 112, 112, 0.32);
    color: #ff7070;
    box-shadow: 0 0 10px rgba(255, 112, 112, 0.15);
}

.hud-stat__glyph--executions {
    --hud-glyph-w: 14px;
    --hud-glyph-h: 14px;
}

.hud-stat__value--executions {
    font-size: 17px;
    font-weight: 700;
    color: #ff7070;
    line-height: 1;
    flex-shrink: 0;
    overflow: visible;
}

.hud-stat__value--kills {
    font-size: 17px;
    font-weight: 700;
    color: #e8a060;
    line-height: 1;
    flex-shrink: 0;
    overflow: visible;
}

.hud-stat__value--stuns {
    font-size: 17px;
    font-weight: 700;
    color: #ffd166;
    line-height: 1;
    flex-shrink: 0;
    overflow: visible;
}

.hud-stat--adventurer {
    position: relative;
    overflow: visible;
}

.hud-adventurer-identity {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.hud-stat--adventurer .supersoldier-star {
    top: 4px;
    right: 6px;
    left: auto;
    font-size: 9px;
}

.hud-stat--adventurer .hud-stat__icon--rank {
    --hud-icon-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    font-size: 0;
    line-height: 0;
    color: inherit;
    background: var(--military-rank-badge-bg);
    border: none;
    box-shadow: none;
    border-radius: 6px;
}

.hud-stat--adventurer .hud-stat__icon--rank .military-rank-badge__canvas {
    display: block;
    width: 22px;
    height: 22px;
    margin: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.hud-stat__icon--level {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    color: var(--hud-level);
    background: var(--hud-level-dim);
    border-color: rgba(184, 233, 134, 0.35);
    box-shadow: 0 0 10px rgba(184, 233, 134, 0.15);
}

.hud-stat__icon--adventurer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    background: rgba(8, 16, 28, 0.94);
    border-color: rgba(160, 200, 240, 0.32);
    color: #b8d4f0;
}

.hud-stat__icon--adventurer .adventurer-portrait__canvas {
    display: block;
    width: 24px;
    height: 24px;
    margin: 0 auto;
    border: none;
    box-shadow: none;
    border-radius: inherit;
    background: transparent;
    visibility: visible;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.hud-stat__icon--kills {
    background: rgba(220, 120, 80, 0.14);
    border-color: rgba(240, 150, 100, 0.28);
    color: #e8a060;
}

.hud-stat__glyph--kills {
    --hud-glyph-w: 14px;
    --hud-glyph-h: 14px;
}

.hud-stat__icon--stuns {
    background: rgba(255, 210, 90, 0.12);
    border-color: rgba(255, 220, 120, 0.28);
    box-shadow: 0 0 10px rgba(255, 210, 90, 0.18);
    color: #ffd166;
}

.hud-stat__glyph--stuns {
    --hud-glyph-w: 14px;
    --hud-glyph-h: 14px;
}

.hud-stat--level .hud-stat__value {
    min-height: 15px;
    display: flex;
    align-items: center;
    font-size: 16px;
    color: var(--hud-level);
    flex-shrink: 0;
    overflow: visible;
}

.hud-stat__value--score {
    font-size: 15px;
    color: var(--hud-score);
    white-space: nowrap;
    flex-shrink: 0;
    overflow: visible;
}

.hud-stat__value--experience {
    font-size: 15px;
    font-weight: 800;
    color: var(--hud-exp);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    white-space: nowrap;
    flex-shrink: 0;
    overflow: visible;
    min-width: 6.5ch;
    text-align: left;
}

/* HUD adattivo: evita sovrapposizioni in base alla larghezza reale della barra */
@container hud (max-width: 1180px) {
    .game-hud {
        gap: 6px;
        padding: 4px 8px;
    }

    .hud-cluster {
        gap: var(--hud-stat-box-gap);
    }

    .hud-stat {
        padding: 3px 6px;
        gap: 5px;
    }

    .hud-stat__value--biome {
        max-width: 9em;
    }

    .hud-stat__value--adventurer {
        max-width: 7em;
    }
}

@container hud (max-width: 1040px) {
    .game-hud {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "hud-left hud-right";
        grid-template-rows: auto;
        gap: 4px 8px;
        --hud-height: auto;
        align-items: stretch;
    }

    .hud-cluster--left {
        flex-wrap: wrap;
        row-gap: 4px;
        align-content: flex-start;
    }
}

@container hud (max-width: 880px) {
    .hud-stat__label {
        display: none;
    }

    .hud-stat {
        min-height: 34px;
    }

    .hud-stat__value--biome {
        max-width: 6em;
        font-size: 10px;
    }

    .hud-stat__value--adventurer {
        max-width: 5em;
        font-size: 10px;
    }
}

@container hud (max-width: 720px) {
    .hud-stat__icon {
        --hud-icon-size: 24px;
    }

    .hud-cluster {
        gap: 4px;
    }

    .hud-stat {
        padding: 2px 4px;
        gap: 4px;
    }

    .hud-stat__value {
        font-size: 15px;
    }

    .hud-ammo {
        min-width: 64px;
    }

    .hud-lockpicks {
        min-width: calc(5 * 10px + 4 * 3px);
    }

    .ammo-bullet {
        width: 6px;
        height: 12px;
    }

    .lockpick-slot {
        width: 7px;
        height: 7px;
    }
}

/* Fallback JS quando il contenuto supera ancora la larghezza disponibile */
.game-hud.hud-layout--stacked {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "hud-left hud-right";
    grid-template-rows: auto;
    gap: 4px 8px;
    --hud-height: auto;
    align-items: stretch;
}

.game-hud.hud-layout--stacked .hud-cluster--left {
    flex-wrap: wrap;
    row-gap: 4px;
    align-content: flex-start;
}

.game-hud.hud-layout--minimal .hud-stat__label {
    display: none;
}

.game-hud.hud-layout--minimal .hud-stat {
    min-height: 34px;
}

.hud-progress__text--diamond,
.hud-progress__text {
    font-size: 12px;
    font-weight: 700;
    color: var(--hud-diamond);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    flex: 0 0 auto;
}

.hud-progress__text--diamond {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    min-width: 5.5ch;
    width: 5.5ch;
}

.hud-progress__digit {
    display: inline-block;
    min-width: 2ch;
    text-align: center;
}

.hud-progress__sep {
    display: inline-block;
    width: 1ch;
    text-align: center;
}

.hud-stat--diamonds .hud-progress__track {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    max-width: 40px;
}

.hud-diamond-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--hud-diamond);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    line-height: 1;
    min-width: 2ch;
    text-align: left;
}

.hud-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.hud-progress__track {
    flex: 1 1 auto;
    height: 5px;
    border-radius: 99px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    min-width: 32px;
    max-width: 52px;
}

.hud-progress__fill--diamond,
.hud-progress__fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2a8cb8, var(--hud-diamond), #e8fcff);
    box-shadow: 0 0 10px rgba(100, 220, 255, 0.45);
    transition: width 0.25s ease;
}

.hud-lives {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    min-height: 19px;
    flex: 0 0 auto;
}

.life-man {
    display: inline-flex;
    width: 9px;
    height: 19px;
    flex-shrink: 0;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.life-man svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    display: block;
}

.life-man.alive {
    color: var(--hud-lives);
    opacity: 1;
    filter: drop-shadow(0 0 4px var(--hud-lives-dim));
}

.life-man.empty {
    color: rgba(180, 188, 204, 0.45);
    opacity: 0.28;
}

.hud-ammo {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    min-width: 76px;
    flex: 0 0 auto;
}

.hud-ammo__row {
    display: flex;
    gap: 2px;
    align-items: flex-end;
}

.ammo-bullet {
    display: inline-flex;
    width: 7px;
    height: 14px;
    flex-shrink: 0;
    line-height: 0;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.ammo-bullet__svg {
    display: block;
    width: 100%;
    height: 100%;
}

.ammo-bullet .ammo-bullet__tip {
    fill: rgba(130, 145, 170, 0.28);
}

.ammo-bullet .ammo-bullet__body {
    fill: rgba(110, 125, 150, 0.22);
}

.ammo-bullet .ammo-bullet__casing {
    fill: rgba(90, 100, 120, 0.2);
}

.ammo-bullet.filled {
    filter: drop-shadow(0 0 1.5px rgba(255, 210, 90, 0.5));
}

.ammo-bullet.filled .ammo-bullet__tip {
    fill: #fff6c8;
}

.ammo-bullet.filled .ammo-bullet__body {
    fill: #e8bc38;
}

.ammo-bullet.filled .ammo-bullet__casing {
    fill: #8a6218;
}

.hud-ammo__row .ammo-bullet:nth-child(odd) {
    transform: translateY(-0.5px);
}

.hud-stat--bombs .hud-stat__body--wide,
.hud-stat--ammo .hud-stat__body--wide {
    min-height: var(--hud-stat-body-h);
    justify-content: flex-start;
}

.hud-lockpicks {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    min-width: 0;
    flex: 0 0 auto;
}

.hud-lockpicks__row {
    display: flex;
    gap: 2px;
    align-items: flex-end;
}

.lockpick-slot {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 8px;
    height: 7px;
    flex-shrink: 0;
    line-height: 0;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.lockpick-slot__svg {
    position: relative;
    display: block;
    width: 6px;
    height: 6px;
}

.lockpick-slot .grimaldello__pick-handle {
    fill: rgba(110, 125, 150, 0.22);
}

.lockpick-slot .grimaldello__wrench,
.lockpick-slot .grimaldello__wrench-leg,
.lockpick-slot .grimaldello__pick-shaft,
.lockpick-slot .grimaldello__pick-hook {
    stroke: rgba(130, 145, 170, 0.28);
}

.lockpick-slot.filled {
    filter: drop-shadow(0 0 2px rgba(184, 132, 88, 0.55));
}

.lockpick-slot.filled .grimaldello__pick-handle {
    fill: #d8b898;
}

.lockpick-slot.filled .grimaldello__wrench,
.lockpick-slot.filled .grimaldello__wrench-leg,
.lockpick-slot.filled .grimaldello__pick-shaft,
.lockpick-slot.filled .grimaldello__pick-hook {
    stroke: #e8ccb0;
}

.hud-lockpicks__row .lockpick-slot:nth-child(odd) {
    transform: translateY(-0.5px);
}

.hud-stat--lockpick .hud-stat__icon {
    position: relative;
    z-index: 1;
}

.hud-stat--lockpick .hud-stat__label {
    letter-spacing: 0.04em;
}

.hud-stat--lockpick .hud-stat__body--wide {
    position: relative;
    z-index: 2;
    min-height: var(--hud-stat-body-h);
    min-width: 0;
    width: max-content;
    max-width: 100%;
    justify-content: flex-start;
}

.hud-stat--lives .hud-stat__body {
    min-width: 88px;
}

.hud-pause-wrap {
    position: relative;
}

.hud-pause-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 168px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    border-radius: 10px;
    background: rgba(8, 10, 16, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55), 0 0 20px var(--hud-accent-dim);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 30;
    pointer-events: none;
}

.hud-pause-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.hud-pause-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--hud-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.hud-pause-menu__item .hud-icon-svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.hud-pause-menu__item .hud-icon-svg--door {
    width: 13px;
    height: 15px;
}

.hud-pause-menu__item:hover {
    background: var(--hud-accent-dim);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--hud-accent);
}

.hud-pause-menu__item--danger:hover {
    background: rgba(255, 92, 106, 0.12);
    border-color: rgba(255, 92, 106, 0.35);
    color: #ff8a96;
}

.hud-pause-backdrop {
    position: absolute;
    inset: 0;
    z-index: 11;
    background: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(1px);
}

.hud-pause-backdrop.is-hidden {
    display: none;
    pointer-events: none;
}

.hud-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--hud-text);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    flex-shrink: 0;
    overflow: visible;
}

.hud-btn--fps {
    width: auto;
    min-width: 34px;
    padding: 0 9px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.hud-btn .hud-icon-svg--fullscreen {
    flex-shrink: 0;
}

.hud-icon-svg--pause {
    width: 14px;
    height: 14px;
}

.hud-icon-svg--door {
    width: 13px;
    height: 15px;
}

.hud-btn--menu:hover {
    border-color: rgba(255, 200, 120, 0.55);
    color: #ffd080;
    background: rgba(255, 200, 120, 0.1);
}

.hud-icon-svg--pause-menu {
    width: 18px;
    height: 18px;
}

.hud-btn--pause-menu.is-active {
    background: rgba(0, 255, 255, 0.12);
    border-color: rgba(0, 255, 255, 0.45);
    color: #00ffff;
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
}

.hud-fps__label {
    line-height: 1;
    white-space: nowrap;
}

.hud-btn--fps.is-active {
    min-width: 40px;
}

.hud-btn--fps.is-active.fps-calibrating {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.38);
    color: #f5f7fb;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.hud-btn--fps.is-active.fps-alert--green {
    background: rgba(120, 220, 140, 0.12);
    border-color: rgba(120, 220, 140, 0.45);
    color: #78dc8c;
    box-shadow: 0 0 12px rgba(120, 220, 140, 0.18);
}

.hud-btn--fps.is-active.fps-alert--yellow {
    background: rgba(255, 220, 80, 0.14);
    border-color: rgba(255, 210, 60, 0.55);
    color: #ffe066;
    box-shadow: 0 0 12px rgba(255, 210, 60, 0.22);
}

.hud-btn--fps.is-active.fps-alert--orange {
    background: rgba(255, 150, 50, 0.16);
    border-color: rgba(255, 140, 40, 0.58);
    color: #ffb040;
    box-shadow: 0 0 14px rgba(255, 130, 30, 0.28);
}

.hud-btn--fps.is-active.fps-alert--red {
    background: rgba(255, 70, 70, 0.18);
    border-color: rgba(255, 60, 60, 0.62);
    color: #ff7070;
    box-shadow: 0 0 14px rgba(255, 50, 50, 0.32);
}

.hud-btn:hover {
    background: var(--hud-accent-dim);
    border-color: var(--hud-accent);
    color: var(--hud-accent);
}

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

.game-hud.hud-paused {
    border-color: rgba(0, 255, 255, 0.25);
    box-shadow: 0 0 28px rgba(0, 255, 255, 0.12);
}

.game-hud.hud-paused::before {
    background: linear-gradient(90deg, transparent, #00ffff, transparent);
}

.game-hud.hud-gameover {
    border-color: rgba(255, 68, 68, 0.35);
    box-shadow: 0 0 28px rgba(255, 68, 68, 0.15);
    opacity: 0.65;
}


.game-container.stats-review-active .game-hud,
.game-container.adventurer-sheet-active .game-hud {
    z-index: 18;
}

.game-container.stats-review-active .game-hud .hud-stat,
.game-container.stats-review-active .hud-cluster--right,
.game-container.stats-review-active .hud-divider,
.game-container.adventurer-sheet-active .game-hud .hud-stat,
.game-container.adventurer-sheet-active .hud-cluster--right,
.game-container.adventurer-sheet-active .hud-divider {
    opacity: 0.18;
    filter: saturate(0.35) brightness(0.7);
    pointer-events: none;
}

.stats-review-stage,
.adventurer-sheet-stage {
    position: absolute;
    top: var(--soldier-profile-top);
    left: 0;
    width: 100%;
    height: 612px;
    z-index: 100;
    pointer-events: none;
}

.stats-review-stage.is-hidden,
.adventurer-sheet-stage.is-hidden {
    display: none;
    pointer-events: none;
    opacity: 0;
}

.stats-review-stage.is-dismissing {
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#adventurerSheetContent {
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

.stats-review-stage {
    --soldier-profile-column-offset: 24px;
}

.stats-review-stage .stats-review-name {
    margin: -6px 0 10px;
}

.stats-review-stage .stats-review-hint {
    margin: 14px 0 0;
}

.stats-review-stage .stats-review-radar-slot {
    margin-top: 13px;
}

.stats-review-layout {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

.stats-review-column {
    position: absolute;
    left: 50%;
    top: calc(50% + var(--soldier-profile-column-offset));
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1188px;
}

.stats-review-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max-content;
    max-width: min(92%, 760px);
    z-index: 1;
}

.stats-review-radar-slot {
    align-self: center;
    margin-top: 55px;
    pointer-events: auto;
}

.stats-review-radar-slot .stat-radar-panel {
    padding: 8px 10px;
}

.stats-review-name {
    margin: 10px 0 14px;
    font-size: clamp(28px, 4.2vw, 40px);
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #e8f4ff;
    text-align: center;
    line-height: 1.15;
    text-shadow:
        0 0 28px rgba(120, 200, 255, 0.4),
        0 4px 14px rgba(0, 0, 0, 0.55);
}

.stats-review-panel {
    flex: 0 0 auto;
    pointer-events: auto;
    margin-top: 0;
}

.stat-radar-panel {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 18px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 42%),
        rgba(10, 22, 38, 0.97);
    border: 1px solid rgba(140, 200, 240, 0.42);
    box-shadow:
        0 0 0 1px rgba(140, 200, 240, 0.16) inset,
        0 0 48px rgba(100, 180, 255, 0.22),
        0 18px 56px rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.stat-radar-panel .stat-radar-host {
    margin: 0;
    width: auto;
}

.stats-review-panel__card {
    --portrait-size: 112px;
    position: relative;
    display: grid;
    grid-template-columns: var(--portrait-size) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 18px;
    row-gap: 8px;
    align-items: start;
    padding: 16px 20px 18px;
    min-height: 120px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 42%),
        rgba(10, 22, 38, 0.97);
    border: 1px solid rgba(140, 200, 240, 0.42);
    box-shadow:
        0 0 0 1px rgba(140, 200, 240, 0.16) inset,
        0 0 48px rgba(100, 180, 255, 0.22),
        0 18px 56px rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(10px);
}

.stats-review-panel__rank {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 34px;
}

.stats-review-panel__portrait {
    --portrait-size: 112px;
    grid-column: 1;
    grid-row: 2;
    position: relative;
    width: var(--portrait-size);
    height: var(--portrait-size);
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(140, 200, 240, 0.42);
    box-shadow:
        0 0 24px rgba(100, 180, 255, 0.22),
        0 0 0 1px rgba(140, 200, 240, 0.16) inset;
    background: rgba(8, 16, 28, 0.94);
}

.stats-review-panel__portrait canvas,
.adventurer-portrait__canvas {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    box-shadow: none;
    border-radius: inherit;
    background: transparent;
    flex: unset;
    visibility: visible;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.stats-review-panel__body {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    align-self: stretch;
    padding-top: 6px;
}

.stats-review-panel__rank-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: var(--military-rank-badge-bg);
    box-shadow: none;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.stats-review-panel__rank-badge .military-rank-badge__canvas {
    display: block;
    width: 30px;
    height: 30px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.stats-review-panel__rank-label.is-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.stats-review-panel__icon {
    --hud-icon-size: 84px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: var(--hud-icon-size);
    height: var(--hud-icon-size);
    border-radius: 16px;
    background: rgba(255, 100, 100, 0.16);
    border: 1px solid color-mix(in srgb, var(--stat-color, #ff7070) 55%, transparent);
    box-shadow: 0 0 24px color-mix(in srgb, var(--stat-color, #ff7070) 28%, transparent);
    flex-shrink: 0;
}

.stats-review-panel__hp-label {
    display: block;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: color-mix(in srgb, var(--stat-color, #ff9a9a) 82%, white);
    line-height: 1;
    text-align: center;
}

.stats-review-panel__hp-value {
    display: block;
    margin-top: 4px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--stat-color, #ffb0b0);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-align: center;
    text-shadow: 0 0 16px color-mix(in srgb, var(--stat-color, #ff7070) 45%, transparent);
}

.stats-review-panel__title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hud-muted);
    line-height: 1.15;
    width: 100%;
    margin: 0;
}

.stats-review-panel__title--sheet {
    text-align: left;
    text-transform: none;
    letter-spacing: 0.04em;
    font-size: 17px;
    padding-top: 2px;
}

.stats-review-panel__grid {
    display: none;
}

.stats-review-panel__chip,
.stats-review-panel__chip-label,
.stats-review-panel__chip-value {
    display: none;
}

.stats-review-panel__body .stat-chip-grid--sheet {
    width: 100%;
}

.stat-radar-host {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.stat-radar {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px;
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(100, 180, 255, 0.08) 0%, transparent 48%),
        rgba(6, 14, 26, 0.35);
    box-shadow:
        0 0 0 1px rgba(140, 200, 240, 0.22) inset,
        0 0 20px rgba(80, 160, 255, 0.14);
}

.stat-radar__canvas {
    display: block;
    width: 380px;
    height: 380px;
    border: none;
    border-radius: 12px;
    box-shadow: none;
    background: transparent;
    image-rendering: auto;
    flex: unset;
    visibility: visible;
}

.stats-review-radar-slot .stat-radar__canvas {
    width: 380px;
    height: 380px;
}

.stats-review-panel__body .stat-chip-grid--sheet {
    min-width: calc(4 * var(--stat-sheet-col-w, 124px) + 3 * var(--stat-sheet-col-gap, 14px));
}

.stats-review-hint {
    position: static;
    transform: none;
    flex: 0 0 auto;
    margin: 20px 0 0;
    padding: 14px 32px;
    border-radius: 999px;
    border: 1px solid rgba(140, 200, 240, 0.45);
    background: rgba(8, 16, 28, 0.94);
    color: #d8f0ff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
    animation: stats-review-hint-pulse 1.8s ease-in-out infinite;
}

.game-container.stats-review-active canvas {
    cursor: pointer;
}

.game-container.adventurer-sheet-active canvas {
    cursor: default;
}

@keyframes stats-review-hint-pulse {
    0%, 100% { opacity: 0.82; }
    50% { opacity: 1; }
}

#gameCanvas {
    position: relative;
    z-index: 1;
    border: 4px solid #2a2e38;
    border-radius: 4px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 12px 40px rgba(0, 0, 0, 0.55);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background-color: #000;
    width: 1188px;
    height: 612px;
    display: block;
    flex: 0 0 auto;
}

.game-hud canvas {
    border: none;
    box-shadow: none;
    border-radius: 0;
    image-rendering: auto;
    background: transparent;
    width: 100%;
    height: 100%;
    position: static;
    z-index: auto;
    flex: none;
}

.game-hud.is-hidden {
    display: none;
}

/* ── Menu principale ── */

body.menu-open {
    padding: 0;
    margin: 0;
    overflow: hidden;
    background: var(--menu-bg);
    align-items: stretch;
}

body.menu-open .game-container {
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    background: var(--menu-bg);
}

body.menu-open #gameCanvas {
    visibility: hidden;
}

.main-menu:not(.is-hidden) {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    box-sizing: border-box;
    background-color: var(--menu-bg);
    background-image:
        radial-gradient(ellipse 90% 55% at 50% 0%, rgba(232, 192, 96, 0.04), transparent 58%),
        linear-gradient(180deg, var(--menu-bg-top) 0%, var(--menu-bg) 100%);
    overflow: hidden;
}

.menu-overlay:not(.is-hidden) {
    position: fixed;
    inset: 0;
    z-index: 210;
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    box-sizing: border-box;
}

.main-menu.is-hidden {
    display: none;
}

.main-menu__build {
    position: absolute;
    right: 14px;
    bottom: 10px;
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    color: rgba(255, 220, 120, 0.82);
    letter-spacing: 0.04em;
    pointer-events: none;
    user-select: none;
}

.main-menu__inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: clamp(14px, 2.2vh, 28px) clamp(18px, 3.5vw, 56px) clamp(12px, 1.8vh, 24px);
    box-sizing: border-box;
    background: transparent;
}

.cheat-mode-banner {
    display: none;
    margin: 0 0 clamp(8px, 1.2vh, 14px);
    padding: 8px 12px;
    text-align: center;
    font-size: clamp(11px, 1.5vh, 13px);
    font-weight: 600;
    color: #ffe8a0;
    background: rgba(80, 50, 0, 0.55);
    border: 1px solid rgba(255, 200, 80, 0.45);
    border-radius: 6px;
}

.cheat-mode-banner.is-visible {
    display: block;
}

.main-menu__title {
    margin: 0;
    text-align: center;
    font-size: clamp(26px, 4.2vh, 44px);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--hud-accent);
    text-transform: none;
    text-shadow: 0 0 24px var(--hud-accent-dim);
    flex-shrink: 0;
}

.main-menu__subtitle {
    margin: clamp(2px, 0.4vh, 6px) 0 clamp(8px, 1.4vh, 18px);
    text-align: center;
    font-size: clamp(11px, 1.6vh, 15px);
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--hud-muted);
    flex-shrink: 0;
}

.main-menu__content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, max-content) minmax(0, 1fr);
    gap: clamp(10px, 1.5vw, 20px);
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    padding-bottom: 6px;
    box-sizing: border-box;
}

.main-menu__content > .main-menu__panel--leaderboard:first-child {
    justify-self: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.main-menu__content > .main-menu__panel--leaderboard:nth-child(2) {
    justify-self: center;
    width: max-content;
    max-width: min(100%, calc(100vw - 40px));
    min-width: 0;
}

.main-menu__content > .main-menu__panel--levels {
    justify-self: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.main-menu__panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    padding: clamp(10px, 1.5vh, 16px) clamp(10px, 1.4vw, 16px) clamp(12px, 1.8vh, 18px);
    border-radius: 10px;
    background: var(--menu-panel-bg);
    border: 1px solid var(--menu-border);
    box-shadow:
        0 8px 28px rgba(0, 0, 0, 0.65),
        inset 0 1px 0 rgba(255, 255, 255, 0.02);
    overflow: hidden;
    box-sizing: border-box;
}

.main-menu__panel-title {
    margin: 0 0 clamp(6px, 1vh, 10px);
    font-size: clamp(9px, 1.15vh, 11px);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--hud-muted);
    flex-shrink: 0;
    line-height: 1.25;
}

.main-menu__panel--leaderboard,
.main-menu__panel--levels {
    padding: clamp(8px, 1.2vh, 14px) clamp(8px, 1vw, 12px) clamp(10px, 1.5vh, 14px);
}

.leaderboard-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    background: var(--menu-inset-bg);
    border: 1px solid var(--menu-border);
    border-radius: 8px;
    box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.65);
}

.leaderboard-grid {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    font-variant-numeric: tabular-nums;
    background: var(--menu-inset-bg);
}

.leaderboard-grid--score {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 58px;
    grid-template-rows: auto minmax(0, 1fr);
}

.leaderboard-grid--score .leaderboard-grid__header,
.leaderboard-grid--score .leaderboard-grid__body,
.leaderboard-grid--score .leaderboard-grid__row {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
}

.leaderboard-grid--score .leaderboard-grid__header,
.leaderboard-grid--score .leaderboard-grid__row {
    column-gap: 4px;
}

.leaderboard-grid--score .leaderboard-grid__body {
    grid-auto-rows: minmax(0, 1fr);
    min-height: 0;
}

.leaderboard-grid--kills {
    display: grid;
    grid-template-columns: 24px minmax(120px, 1fr) calc(var(--stat-chip-fixed-w) * 5 + 16px + 40px) 54px 60px 64px;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: min(100%, 560px);
}

.leaderboard-grid--kills .leaderboard-grid__header,
.leaderboard-grid--kills .leaderboard-grid__row {
    column-gap: 10px;
}

.leaderboard-grid--kills .leaderboard-grid__header,
.leaderboard-grid--kills .leaderboard-grid__body,
.leaderboard-grid--kills .leaderboard-grid__row {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
}

.leaderboard-grid--kills .leaderboard-grid__body {
    grid-auto-rows: minmax(0, 1fr);
    min-height: 0;
}

.leaderboard-grid__header,
.leaderboard-grid__row {
    align-items: center;
    column-gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
    box-sizing: border-box;
}

.leaderboard-grid__header {
    flex-shrink: 0;
    min-height: 34px;
    padding-top: 6px;
    padding-bottom: 6px;
    background: var(--menu-inset-header);
    border-bottom: 1px solid var(--menu-border);
}

.leaderboard-grid--kills .leaderboard-grid__header {
    min-height: 40px;
    padding-top: 5px;
    padding-bottom: 5px;
}

.leaderboard-grid__header .lb-cell {
    font-size: clamp(9px, 1.15vh, 11px);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hud-muted);
    line-height: 1.15;
}

.leaderboard-grid__header .lb-cell--stat {
    text-align: center;
    font-size: clamp(8px, 1vh, 10px);
    letter-spacing: 0.05em;
    overflow: visible;
}

.leaderboard-grid--kills .lb-stat-head:not(.lb-stat-head--row) {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
}

.leaderboard-grid--kills .lb-stat-head:not(.lb-stat-head--row) .lb-stat-head__icon {
    width: 13px;
    height: 13px;
}

.leaderboard-grid--kills .lb-stat-head:not(.lb-stat-head--row) .lb-stat-head__label {
    font-size: clamp(7px, 0.92vh, 9px);
    letter-spacing: 0.03em;
    text-align: center;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.leaderboard-grid--kills .lb-cell--stat {
    min-width: 0;
    overflow: visible;
}

.lb-stat-head--row {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    width: 100%;
}

.lb-stat-head--row .lb-stat-head__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.lb-stat-head--row .lb-stat-head__label {
    font-size: clamp(8px, 1vh, 10px);
    letter-spacing: 0.04em;
    text-align: left;
    line-height: 1;
    padding-top: 1px;
}

.leaderboard-grid--score .lb-stat-head {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    width: 100%;
}

.leaderboard-grid--score .lb-stat-head__label {
    padding-top: 1px;
}

.lb-stat-head {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    max-width: 100%;
}

.lb-stat-head__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.lb-stat-head__icon--star {
    fill: #ffd166;
    color: #ffd166;
    filter: drop-shadow(0 0 4px rgba(255, 209, 102, 0.45));
}

.lb-stat-head__icon--kills {
    color: #e8a060;
}

.lb-stat-head__icon--exec {
    color: #ff7070;
}

.lb-stat-head__icon--stun {
    color: #9ec8ff;
    fill: #9ec8ff;
}

.lb-stat-head__icon--abilities {
    color: #7ec8ff;
}

.leaderboard-grid--kills .lb-cell--soldier-stats-head {
    justify-self: stretch;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    text-align: left;
    min-width: 0;
    padding-left: 20px;
    padding-right: 20px;
}

.leaderboard-grid--kills .lb-cell--soldier-stats-head .lb-stat-head {
    justify-content: flex-start;
}

.leaderboard-grid--kills .lb-cell--soldier-stats-head .lb-stat-head__label {
    padding-top: 2px;
}

.lb-stat-head__label {
    font-size: clamp(8px, 1vh, 10px);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hud-muted);
    line-height: 1.1;
    white-space: nowrap;
}

.leaderboard-grid__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.leaderboard-grid--score .leaderboard-grid__body,
.leaderboard-grid--kills .leaderboard-grid__body {
    display: grid;
    flex: unset;
}

.leaderboard-grid__row {
    flex: 1 1 0;
    min-height: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: var(--menu-inset-bg);
}

.leaderboard-grid__row:last-child {
    border-bottom: none;
}

.leaderboard-grid__row:nth-child(even) {
    background: var(--menu-row-alt);
}

.lb-cell {
    min-width: 0;
    line-height: 1.2;
}

.lb-cell--rank {
    text-align: center;
}

.lb-cell--portrait {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
}

.lb-cell--portrait canvas {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.lb-cell--portrait-empty {
    visibility: hidden;
}

.lb-cell--name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--hud-text);
}

.lb-cell--stat {
    text-align: center;
    padding-right: 0;
}

.leaderboard-grid--kills .lb-cell--stat.lb-score {
    text-align: center;
    display: block;
    width: 100%;
}

.lb-rank {
    color: var(--hud-muted);
    font-weight: 600;
    font-size: clamp(11px, 1.4vh, 14px);
}

.lb-score {
    color: var(--hud-accent);
    font-weight: 700;
    font-size: clamp(11px, 1.5vh, 15px);
}

.leaderboard-grid--score .lb-cell--stat.lb-score {
    text-align: right;
}

.lb-row--player {
    background: rgba(255, 92, 106, 0.12);
    border-top: 1px dashed rgba(255, 92, 106, 0.35);
}

.lb-name--player {
    font-weight: 700;
}

.lb-soldier-name {
    color: #d8ecff;
    -webkit-text-stroke: 0.55px rgba(120, 195, 255, 0.95);
    paint-order: stroke fill;
    text-shadow:
        0 0 8px rgba(120, 195, 255, 0.22),
        0 0 1px rgba(160, 220, 255, 0.35);
}

.lb-soldier-name--npc {
    color: #b8d4ec;
    -webkit-text-stroke: 0.45px rgba(100, 170, 220, 0.75);
    text-shadow: 0 0 6px rgba(100, 170, 220, 0.16);
}

.lb-soldier-identity {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.lb-soldier-identity .lb-soldier-row__portrait {
    margin-right: 5px;
}

.lb-soldier-identity .lb-military-rank {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    margin-right: 5px;
    overflow: hidden;
    border: none;
    background: var(--military-rank-badge-bg);
    box-shadow: none;
    border-radius: 5px;
}

.lb-soldier-identity .lb-military-rank .military-rank-badge__canvas {
    display: block;
    width: 28px;
    height: 28px;
    margin: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.lb-soldier-portrait-stack {
    position: relative;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}

.lb-soldier-portrait-stack .lb-military-rank {
    position: absolute;
    right: -3px;
    bottom: -3px;
}

.lb-cell--soldier-out {
    grid-column: 2 / 4;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--hud-text);
}

.lb-cell--soldier-identity {
    min-width: 0;
}

.lb-cell--soldier-stats {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    justify-self: stretch;
    min-width: 0;
    width: auto;
    max-width: 100%;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}

.lb-soldier-row__portrait {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(140, 200, 240, 0.35);
    background: rgba(8, 16, 28, 0.94);
    box-shadow: 0 0 10px rgba(100, 180, 255, 0.12);
}

.lb-soldier-row__portrait canvas,
.lb-soldier-row__portrait .adventurer-portrait__canvas {
    display: block;
    width: 34px;
    height: 34px;
    border: none;
    box-shadow: none;
    border-radius: inherit;
    background: transparent;
    visibility: visible;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.lb-military-rank {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(160, 200, 240, 0.32);
    background: rgba(6, 12, 22, 0.96);
    box-shadow: 0 0 8px rgba(80, 140, 200, 0.18);
    z-index: 3;
}

.lb-military-rank .military-rank-badge__canvas {
    display: block;
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.leaderboard-grid--score .lb-cell--name {
    display: block;
    min-width: 0;
}

.lb-soldier-row__portrait--empty {
    visibility: hidden;
}

.supersoldier-star {
    position: absolute;
    top: 1px;
    left: 2px;
    z-index: 3;
    font-size: 9px;
    line-height: 1;
    color: #ffd95a;
    text-shadow:
        0 0 5px rgba(255, 210, 70, 0.85),
        0 1px 0 rgba(70, 45, 0, 0.55);
    pointer-events: none;
    user-select: none;
}

.stats-review-panel__card .supersoldier-star {
    top: 10px;
    right: 14px;
    left: auto;
    font-size: 28px;
    text-shadow:
        0 0 10px rgba(255, 210, 70, 0.9),
        0 0 18px rgba(255, 210, 70, 0.45),
        0 1px 0 rgba(70, 45, 0, 0.55);
}

.lb-soldier-row__portrait .supersoldier-star {
    top: 1px;
    left: 2px;
    font-size: 10px;
}

.lb-soldier-row__name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    align-self: center;
    font-size: clamp(10px, 1.25vh, 13px);
}

.lb-soldier-stats {
    display: block;
    margin-top: 2px;
    font-size: clamp(7px, 0.95vh, 9px);
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #8eb8d8;
    line-height: 1.25;
    white-space: normal;
}

.lb-rank--out {
    color: var(--hud-danger);
}

.lb-tag {
    display: inline;
    font-size: clamp(8px, 1.05vh, 10px);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hud-danger);
    margin-left: 4px;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(10, minmax(0, 1fr));
    gap: clamp(3px, 0.55vh, 6px);
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    width: 100%;
    padding: clamp(6px, 0.9vh, 10px);
    box-sizing: border-box;
    background: var(--menu-inset-bg);
    border: 1px solid var(--menu-border);
    border-radius: 8px;
    box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.65);
}

.main-menu__panel--levels .level-tile {
    font-size: clamp(10px, 1.35vh, 13px);
    border-radius: clamp(4px, 0.55vh, 6px);
    background: rgba(255, 255, 255, 0.025);
    border-color: var(--menu-border);
}

.level-tile {
    aspect-ratio: 1;
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    justify-self: center;
    align-self: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: clamp(5px, 0.8vh, 8px);
    background: rgba(255, 255, 255, 0.04);
    color: var(--hud-text);
    font-family: inherit;
    font-size: clamp(12px, 1.9vh, 17px);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.level-tile:hover:not(:disabled) {
    background: var(--hud-accent-dim);
    border-color: var(--hud-accent);
    color: var(--hud-accent);
}

.level-tile.is-selected {
    background: rgba(232, 192, 96, 0.22);
    border-color: var(--hud-accent);
    color: var(--hud-accent);
    box-shadow: 0 0 16px var(--hud-accent-dim);
}

.level-tile.is-locked {
    opacity: 0.35;
    cursor: not-allowed;
}

.level-tile:active:not(:disabled) {
    transform: scale(0.94);
}

.main-menu__divider {
    border: none;
    border-top: 1px solid var(--hud-border);
    margin: clamp(8px, 1.2vh, 16px) 0;
    flex-shrink: 0;
}

.main-menu__actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(10px, 2vw, 20px);
    flex-shrink: 0;
    padding-bottom: clamp(0px, 0.5vh, 6px);
}

.main-menu__actions .menu-btn {
    min-width: clamp(120px, 14vw, 180px);
    padding: clamp(10px, 1.4vh, 14px) clamp(18px, 2.5vw, 28px);
    font-size: clamp(13px, 1.8vh, 16px);
}

.menu-btn {
    position: relative;
    overflow: hidden;
    min-width: 130px;
    padding: 10px 22px;
    border: 1px solid var(--menu-border);
    border-radius: 10px;
    background: var(--menu-panel-bg);
    color: var(--hud-text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.menu-btn:hover {
    background: var(--hud-accent-dim);
    border-color: var(--hud-accent);
    color: var(--hud-accent);
}

.menu-btn:active {
    transform: scale(0.96);
}

.menu-btn--primary {
    background: rgba(232, 192, 96, 0.15);
    border-color: rgba(232, 192, 96, 0.45);
    color: var(--hud-accent);
}

.menu-btn--primary:hover {
    background: rgba(232, 192, 96, 0.28);
}

.menu-btn--danger {
    width: 100%;
    border-color: rgba(255, 92, 106, 0.35);
    color: var(--hud-danger);
}

.menu-btn--danger:hover {
    background: rgba(255, 92, 106, 0.12);
    border-color: var(--hud-danger);
    color: var(--hud-danger);
}

.menu-btn--warning {
    width: 100%;
    border-color: rgba(232, 176, 72, 0.42);
    color: #e8c060;
}

.menu-btn--warning:hover {
    background: rgba(232, 176, 72, 0.14);
    border-color: #e8c060;
    color: #f0d080;
}

.menu-btn--hold .menu-btn__fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: rgba(255, 92, 106, 0.35);
    transition: none;
    pointer-events: none;
}

.menu-btn--warning.menu-btn--hold .menu-btn__fill {
    background: rgba(232, 176, 72, 0.38);
}

.menu-btn--hold .menu-btn__text {
    position: relative;
    z-index: 1;
}

.menu-btn--hold:disabled,
.menu-btn--hold.is-disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
}

.settings-group.is-disabled .settings-hint--delete,
.settings-group.is-disabled .settings-hint--regenerate {
    color: var(--hud-muted);
    font-style: italic;
}

.menu-btn--back {
    margin-top: 8px;
    width: 100%;
}

/* ── Overlay impostazioni / aiuto ── */

.menu-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 6, 12, 0.94);
    backdrop-filter: blur(6px);
}

.menu-overlay.is-hidden {
    display: none;
}

.menu-overlay__panel {
    width: min(480px, 92%);
    max-height: 88%;
    overflow-y: auto;
    padding: 22px 24px;
    border-radius: 14px;
    background: var(--hud-bg);
    border: 1px solid var(--hud-border);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.menu-overlay__panel--help {
    width: min(620px, 94%);
}

.menu-overlay__panel--stats {
    width: min(680px, 94%);
}

.stats-help-content {
    max-height: min(58vh, 520px);
}

.menu-overlay__title {
    margin: 0 0 18px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hud-accent);
    text-align: center;
}

.settings-group {
    margin-bottom: 20px;
}

.settings-group__label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hud-muted);
}

.settings-hint {
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--hud-muted);
}

.fps-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fps-option {
    flex: 1;
    min-width: 72px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--hud-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.fps-option.is-active {
    background: rgba(120, 220, 140, 0.15);
    border-color: rgba(120, 220, 140, 0.5);
    color: #78dc8c;
}

.fps-option:hover {
    border-color: var(--hud-accent);
    color: var(--hud-accent);
}

.help-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
}

.help-section__title {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8ec8ff;
}

.help-section__list {
    margin: 0;
    padding-left: 18px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--hud-text);
}

.help-section__list li {
    margin-bottom: 4px;
}

@media (max-width: 1100px) {
    .main-menu__content {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .main-menu__content > .main-menu__panel--leaderboard:first-child,
    .main-menu__content > .main-menu__panel--leaderboard:nth-child(2),
    .main-menu__content > .main-menu__panel--levels {
        justify-self: stretch;
        width: auto;
        max-width: 100%;
    }

    .leaderboard-grid--kills {
        min-width: 0;
        grid-template-columns: 24px minmax(0, 1fr) auto 54px 60px 64px;
    }

    .main-menu__panel--levels {
        grid-column: 1 / -1;
        max-height: min(42vh, 320px);
    }

    .main-menu__panel--levels .level-grid {
        grid-template-columns: repeat(10, 1fr);
        grid-template-rows: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .main-menu__content {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .main-menu__content > .main-menu__panel--leaderboard:first-child,
    .main-menu__content > .main-menu__panel--leaderboard:nth-child(2),
    .main-menu__content > .main-menu__panel--levels {
        justify-self: stretch;
        width: auto;
        max-width: 100%;
    }

    .leaderboard-grid--kills {
        min-width: 0;
    }

    .main-menu__panel--levels {
        grid-column: auto;
        max-height: none;
    }

    .main-menu__panel--levels .level-grid {
        grid-template-columns: repeat(10, 1fr);
        grid-template-rows: repeat(5, minmax(0, 1fr));
    }

    .main-menu__inner {
        min-height: auto;
        padding: 12px;
    }

    .main-menu__actions {
        flex-wrap: wrap;
    }

    .menu-btn {
        min-width: 100px;
        flex: 1;
    }
}


strong { color: #fff; }

/* Fullscreen: container + HUD compatto in cima */
body.game-is-fullscreen {
    padding: 0;
    align-items: stretch;
}

.game-container:fullscreen,
.game-container.is-fullscreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100vw;
    height: 100vh;
    max-width: none;
    background: #050505;
}

.game-container:fullscreen .game-hud,
.game-container.is-fullscreen .game-hud {
    --hud-height: 40px;
    --hud-stat-body-h: 33px;
    --hud-stat-box-gap: 4px;
    align-self: stretch;
    width: 100%;
    flex: 0 0 auto;
    margin: 0 0 var(--fullscreen-hud-gap, 12px);
    padding: 4px 10px;
    gap: 6px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto;
    grid-template-areas: "hud-left hud-right";
    align-items: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.game-container:fullscreen .game-hud--bottom,
.game-container.is-fullscreen .game-hud--bottom {
    margin: var(--fullscreen-hud-gap, 12px) 0 0;
    border-bottom: none;
    border-top: 1px solid var(--hud-border);
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "hud-left hud-right";
    gap: 6px;
}

.game-container:fullscreen .hud-cluster--bottom,
.game-container.is-fullscreen .hud-cluster--bottom {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow: hidden;
}

.game-container:fullscreen .game-hud--bottom .hud-cluster--right,
.game-container.is-fullscreen .game-hud--bottom .hud-cluster--right {
    grid-area: hud-right;
    justify-content: flex-end;
    justify-self: end;
}

.game-container:fullscreen .hud-pause-wrap,
.game-container.is-fullscreen .hud-pause-wrap {
    position: relative;
    z-index: 40;
}

.game-container:fullscreen .hud-pause-menu,
.game-container.is-fullscreen .hud-pause-menu {
    z-index: 50;
}

.game-container:fullscreen .hud-pause-backdrop,
.game-container.is-fullscreen .hud-pause-backdrop {
    z-index: 11;
}

.game-container:fullscreen .hud-cluster--left,
.game-container.is-fullscreen .hud-cluster--left {
    grid-area: hud-left;
    justify-content: flex-start;
    justify-self: start;
    min-width: 0;
    max-width: 100%;
    flex-shrink: 1;
    overflow: hidden;
}

.game-container:fullscreen .hud-cluster--right,
.game-container.is-fullscreen .hud-cluster--right {
    grid-area: hud-right;
    justify-content: flex-end;
    justify-self: end;
}

.game-container:fullscreen .hud-ammo,
.game-container.is-fullscreen .hud-ammo {
    min-width: 68px;
}

.game-container:fullscreen .ammo-bullet,
.game-container.is-fullscreen .ammo-bullet {
    width: 6px;
    height: 12px;
}

.game-container:fullscreen .hud-stat--lockpick .hud-lockpicks,
.game-container.is-fullscreen .hud-stat--lockpick .hud-lockpicks {
    --lockpick-slot-size: 11px;
    --lockpick-icon-size: 9px;
    --lockpick-slot-gap: 3px;
}

.game-container:fullscreen .hud-lockpicks,
.game-container.is-fullscreen .hud-lockpicks {
    min-width: calc(5 * var(--lockpick-slot-size, 11px) + 4 * var(--lockpick-slot-gap, 3px));
}

.game-container:fullscreen .hud-cluster,
.game-container.is-fullscreen .hud-cluster {
    gap: var(--hud-stat-box-gap);
}

.game-container:fullscreen .hud-stat,
.game-container.is-fullscreen .hud-stat {
    padding: 3px 6px;
    gap: 5px;
    border-radius: 7px;
    min-height: 39px;
}

.game-container:fullscreen .stat-chip-grid--hud.stat-chip-grid--peaks,
.game-container.is-fullscreen .stat-chip-grid--hud.stat-chip-grid--peaks {
    --stat-hud-chip-icon: 11px;
    gap: 5px;
}

.game-container:fullscreen .stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud,
.game-container.is-fullscreen .stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud,
.game-container:fullscreen .stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud.stat-chip--labels-only,
.game-container.is-fullscreen .stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud.stat-chip--labels-only {
    width: var(--stat-hud-chip-w);
    min-width: var(--stat-hud-chip-w);
    max-width: var(--stat-hud-chip-w);
    min-height: 17px;
    padding: 0 2px;
    column-gap: 2px;
}

.game-container:fullscreen .stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud .stat-chip__label,
.game-container.is-fullscreen .stat-chip-grid--hud.stat-chip-grid--peaks .stat-chip--hud .stat-chip__label {
    font-size: 8.5px;
}

.game-container:fullscreen .hud-stat--stats,
.game-container.is-fullscreen .hud-stat--stats {
    align-items: flex-start;
}

.game-container:fullscreen .hud-stat--stats .hud-stat__body,
.game-container.is-fullscreen .hud-stat--stats .hud-stat__body {
    min-height: 0;
    height: auto;
}

.game-container:fullscreen .hud-stat__label,
.game-container.is-fullscreen .hud-stat__label {
    font-size: 7.5px;
    letter-spacing: 0.07em;
}

.game-container:fullscreen .hud-stat__label--toxicity,
.game-container.is-fullscreen .hud-stat__label--toxicity {
    letter-spacing: 0.03em;
}

.game-container:fullscreen .hud-toxicity-icon,
.game-container.is-fullscreen .hud-toxicity-icon {
    width: 15px;
    height: 15px;
}

.game-container:fullscreen .hud-stat__icon,
.game-container.is-fullscreen .hud-stat__icon {
    --hud-icon-size: 24px;
    border-radius: 6px;
}

.game-container:fullscreen .hud-hp-badge__value,
.game-container.is-fullscreen .hud-hp-badge__value {
    font-size: 11px;
}

.game-container:fullscreen .hud-stat__icon--stats .hud-stat__glyph--stats > svg.hud-hp-badge__heart,
.game-container.is-fullscreen .hud-stat__icon--stats .hud-stat__glyph--stats > svg.hud-hp-badge__heart {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    max-width: 10px;
    max-height: 10px;
    top: -6px;
    left: -6px;
}

.game-container:fullscreen .hud-stat__glyph--diamond,
.game-container.is-fullscreen .hud-stat__glyph--diamond,
.game-container:fullscreen .hud-stat__glyph--score,
.game-container.is-fullscreen .hud-stat__glyph--score,
.game-container:fullscreen .hud-stat__glyph--experience,
.game-container.is-fullscreen .hud-stat__glyph--experience {
    --hud-glyph-w: 12px;
    --hud-glyph-h: 12px;
}

.game-container:fullscreen .hud-stat__glyph--man,
.game-container.is-fullscreen .hud-stat__glyph--man {
    --hud-glyph-w: 10px;
    --hud-glyph-h: 18px;
}

.game-container:fullscreen .hud-stat__glyph--ammo,
.game-container.is-fullscreen .hud-stat__glyph--ammo {
    --hud-glyph-w: 16px;
    --hud-glyph-h: 10px;
}

.game-container:fullscreen .hud-stat__glyph--lockpick,
.game-container.is-fullscreen .hud-stat__glyph--lockpick {
    --hud-glyph-w: 13px;
    --hud-glyph-h: 13px;
}

.game-container:fullscreen .hud-stat__value,
.game-container.is-fullscreen .hud-stat__value {
    font-size: 16px;
}

.game-container:fullscreen .hud-stat__value--biome,
.game-container.is-fullscreen .hud-stat__value--biome {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 9em;
}

.game-container:fullscreen .hud-stat__value--adventurer,
.game-container.is-fullscreen .hud-stat__value--adventurer {
    font-size: 12px;
    max-width: 8em;
}

.game-container:fullscreen .hud-stat__value--kills,
.game-container.is-fullscreen .hud-stat__value--kills,
.game-container:fullscreen .hud-stat__value--stuns,
.game-container.is-fullscreen .hud-stat__value--stuns {
    font-size: 16px;
}

.game-container:fullscreen .hud-stat__value--score,
.game-container.is-fullscreen .hud-stat__value--score {
    font-size: 15px;
}

.game-container:fullscreen .hud-stat__value--experience,
.game-container.is-fullscreen .hud-stat__value--experience {
    font-size: 15px;
    min-width: 6ch;
}

.game-container:fullscreen .hud-stat__body--wide,
.game-container.is-fullscreen .hud-stat__body--wide {
    min-width: 0;
}

.game-container:fullscreen .hud-stat--diamonds .hud-progress__track,
.game-container.is-fullscreen .hud-stat--diamonds .hud-progress__track {
    flex: 0 0 48px;
    width: 48px;
    min-width: 48px;
    max-width: 48px;
}

.game-container:fullscreen .hud-progress__track,
.game-container.is-fullscreen .hud-progress__track {
    min-width: 48px;
}

.game-container:fullscreen .hud-progress__text,
.game-container.is-fullscreen .hud-progress__text {
    font-size: 12px;
}

.game-container:fullscreen .life-man,
.game-container.is-fullscreen .life-man {
    width: 8px;
    height: 17px;
}

.game-container:fullscreen .hud-lives,
.game-container.is-fullscreen .hud-lives {
    gap: 1px;
    min-height: 17px;
}

.game-container:fullscreen .hud-stat--ammo .hud-stat__body--wide,
.game-container.is-fullscreen .hud-stat--ammo .hud-stat__body--wide,
.game-container:fullscreen .hud-stat--lockpick .hud-stat__body--wide,
.game-container.is-fullscreen .hud-stat--lockpick .hud-stat__body--wide {
    min-height: 28px;
}

.game-container:fullscreen .hud-btn,
.game-container.is-fullscreen .hud-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
}

.game-container:fullscreen .hud-btn--fps,
.game-container.is-fullscreen .hud-btn--fps {
    width: auto;
    min-width: 30px;
    padding: 0 7px;
    font-size: 10px;
}

.game-container:fullscreen canvas,
.game-container.is-fullscreen canvas {
    flex: 0 0 auto;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

@media (max-width: 1220px) {
    .game-container:not([data-screen-scale]) {
        width: 100%;
    }
}

#perfHud {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 200;
    max-width: min(420px, 92vw);
    padding: 8px 10px;
    font: 11px/1.45 'Courier New', monospace;
    color: #b8ff80;
    background: rgba(0, 12, 8, 0.88);
    border: 1px solid rgba(120, 255, 120, 0.45);
    border-radius: 6px;
    white-space: pre-wrap;
    pointer-events: none;
    box-shadow: 0 0 12px rgba(0, 255, 120, 0.15);
}

#debugCaptureHud {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 201;
    padding: 6px 10px;
    font: 11px/1.35 'Courier New', monospace;
    color: #ffd080;
    background: rgba(24, 12, 0, 0.88);
    border: 1px solid rgba(255, 180, 80, 0.5);
    border-radius: 6px;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.12);
}

#debugCaptureFlash {
    position: absolute;
    left: 50%;
    top: 72px;
    transform: translateX(-50%);
    z-index: 500;
    max-width: min(520px, 92vw);
    padding: 12px 16px;
    font: 13px/1.4 system-ui, sans-serif;
    color: #fff;
    background: rgba(20, 20, 30, 0.94);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#debugCaptureFlash.is-visible {
    opacity: 1;
}

#debugCaptureFlash.is-ok {
    border-color: rgba(120, 255, 120, 0.55);
    color: #d8ffd0;
}

#debugCaptureFlash.is-err {
    border-color: rgba(255, 160, 80, 0.55);
    color: #ffe0c0;
}
