.character-info-container {
    --hud-art-height: 100px;
    --hud-portrait-clip-top: 8px;
    position: absolute;
    left: 50%;
    bottom: 3px;
    transform: translateX(-50%);
    width: min(calc(100% - 24px), 432px);
    display: none;
    flex-direction: column;
    pointer-events: none;
    z-index: 3;
    font-family: var(--dashboard-font-family);
    color: #f4fbff;
}

.game-container.game-view-slim-x .character-info-container {
    width: 432px;
}

#hudLayer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 300;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease;
}

#hudLayer.is-visible {
    opacity: 1;
    visibility: visible;
}

.hud-art-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--hud-art-height, 100px);
    pointer-events: none;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: 100% 100%;
}

.game-container.game-view-slim-x .hud-art-overlay {
    left: 50%;
    right: auto;
    width: 576px;
    transform: translateX(-50%);
}

.hud-art-overlay--base {
    z-index: 0;
    background-image: url("UIAssets/Character_HUD_2.png");
}

.hud-art-overlay--highlight {
    z-index: 2;
    background: linear-gradient(
        90deg,
        rgba(9, 20, 44, 1) 0%,
        rgba(20, 38, 74, 0.99) 18%,
        rgba(74, 102, 154, 0.96) 56%,
        rgba(228, 239, 255, 1) 100%
    );
    opacity: 0.98;
    -webkit-mask: url("UIAssets/Character_HUD_1.png") no-repeat center bottom / 100% 100%;
    mask: url("UIAssets/Character_HUD_1.png") no-repeat center bottom / 100% 100%;
}

.hud-shell {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-upper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 74px minmax(0, 1fr);
    gap: 6px;
    align-items: end;
    overflow: visible;
}

.hud-inventory-cluster {
    grid-column: 1;
    display: flex;
    align-items: flex-end;
    justify-self: end;
    gap: 4px;
    pointer-events: auto;
    transform: translateY(-3px);
}

.hud-lower {
    display: grid;
    grid-template-columns: 116px 104px 116px;
    justify-content: center;
    gap: 4px;
    position: relative;
    transform: translateY(-6px);
    z-index: 2;
}

.hud-slot-row {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    gap: 2px;
    width: max-content;
}

.hud-slot-row--abilities {
    grid-column: 3;
    justify-self: start;
    transform: translateY(-3px);
}

.hud-slot-card,
.hud-portrait-frame,
.progress-bar {
    box-sizing: border-box;
    background: rgba(10, 18, 34, 0.94);
}

.hud-slot-card {
    position: relative;
    min-height: 40px;
    border: 1px solid rgba(80, 180, 255, 0.24);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.hud-portrait-frame,
.progress-bar {
    border: 1px solid rgba(80, 180, 255, 0.34);
}

.hud-slot-card.is-empty {
    opacity: 0.38;
}

.hud-slot-card.is-equipped {
    border-color: rgba(255, 210, 109, 0.88);
}

.hud-slot-card.is-locked {
    opacity: 0.58;
}

.hud-slot-card.is-locked .hud-slot-asset {
    filter: grayscale(1) brightness(0.7);
}

.hud-slot-card.is-clickable {
    cursor: pointer;
}

.hud-slot-card--inventory.has-item {
    background: transparent;
    border-color: transparent;
}

.hud-slot-card--inventory.is-empty {
    background: transparent;
    border-color: transparent;
}

.hud-slot-card--ability.has-item {
    background: transparent;
    border-color: transparent;
}

.hud-slot-card--inventory.has-item.is-equipped {
    border-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
    .hud-slot-card.is-clickable:hover {
        border-color: rgba(255, 216, 107, 0.62);
        background: rgba(15, 25, 43, 0.98);
    }

    .hud-slot-card--ability.is-clickable:hover {
        background: transparent;
        border-color: transparent;
    }

    .hud-slot-card--inventory.has-item.is-clickable:hover {
        background: transparent;
        border-color: transparent;
        filter: brightness(1.1);
    }
}

.hud-level-chip {
    position: absolute;
    left: calc(50% - 2px);
    top: -11px;
    bottom: auto;
    transform: translateX(-50%);
    min-width: 0;
    width: max-content;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 4;
}

.hud-slot-asset-wrap {
    width: 100%;
    height: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-slot-card--inventory.has-item .hud-slot-asset-wrap {
    min-height: 34px;
}

.hud-slot-card--inventory.is-empty .hud-slot-asset-wrap {
    min-height: 34px;
}

.hud-slot-card--ability.has-item .hud-slot-asset-wrap {
    min-height: 34px;
}

.hud-slot-asset {
    width: 34px;
    height: 34px;
    object-fit: contain;
    image-rendering: pixelated;
}

.hud-slot-empty-tile {
    width: 34px;
    height: 34px;
    display: block;
    object-fit: contain;
    image-rendering: pixelated;
}

.hud-slot-card--inventory .inventory-selection-frame--hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    opacity: 1;
}

.hud-slot-card--inventory .inventory-selection-frame--hud .inventory-selection-piece {
    position: absolute;
    width: 50%;
    height: 50%;
    overflow: hidden;
}

.hud-slot-card--inventory .inventory-selection-frame--hud .inventory-selection-piece img {
    position: absolute;
    width: 175%;
    height: 175%;
    display: block;
    image-rendering: pixelated;
}

.hud-slot-card--inventory .inventory-selection-frame--hud .inventory-selection-piece.top-left {
    left: -1px;
    top: -1px;
}

.hud-slot-card--inventory .inventory-selection-frame--hud .inventory-selection-piece.top-right {
    right: -1px;
    top: -1px;
}

.hud-slot-card--inventory .inventory-selection-frame--hud .inventory-selection-piece.bottom-left {
    left: -1px;
    bottom: -1px;
}

.hud-slot-card--inventory .inventory-selection-frame--hud .inventory-selection-piece.bottom-right {
    right: -1px;
    bottom: -1px;
}

.hud-slot-card--inventory .inventory-selection-frame--hud .inventory-selection-piece.top-right img {
    left: -75%;
    top: 0;
}

.hud-slot-card--inventory .inventory-selection-frame--hud .inventory-selection-piece.bottom-left img {
    left: 0;
    top: -75%;
}

.hud-slot-card--inventory .inventory-selection-frame--hud .inventory-selection-piece.bottom-right img {
    left: -75%;
    top: -75%;
}

.hud-slot-durability {
    position: absolute;
    left: 50%;
    bottom: 1px;
    transform: translateX(-50%);
    width: 20px;
    height: 0.75px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.15);
    z-index: 5;
}

.hud-slot-durability-fill {
    height: 100%;
    background: #ffffff;
}

.hud-slot-empty-mark {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.22);
    line-height: 1;
}

.hud-portrait-stack {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transform: translateY(10px);
    z-index: 1;
}

.hud-portrait-frame.hud-portrait-underlay {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 1;
    width: 64px;
    height: 64px;
    padding: 0;
    border: none !important;
    border-radius: 0;
    background: none !important;
    box-shadow: none !important;
    outline: none;
    overflow: hidden;
    -webkit-clip-path: inset(var(--hud-portrait-clip-top, 8px) 0 0 0);
    clip-path: inset(var(--hud-portrait-clip-top, 8px) 0 0 0);
}

.hud-portrait-frame.hud-portrait-underlay:focus-visible {
    filter: brightness(1.08);
}

@media (hover: hover) and (pointer: fine) {
    .hud-portrait-frame.hud-portrait-underlay:hover {
        filter: brightness(1.08);
    }
}

.hud-portrait-frame.hud-portrait-underlay img {
    border-radius: 0;
}

.hud-portrait-frame {
    appearance: none;
    width: 64px;
    height: 64px;
    padding: 1px;
    border: 1px solid transparent;
    border-radius: 2px;
    background:
        linear-gradient(180deg, rgba(19, 33, 58, 0.98), rgba(10, 21, 41, 0.98)) padding-box,
        linear-gradient(
            90deg,
            rgba(118, 146, 194, 0.92) 0%,
            rgba(70, 96, 141, 0.9) 58%,
            rgba(9, 22, 47, 0.98) 100%
        ) border-box;
    box-shadow:
        0 0 8px rgba(70, 96, 141, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
    .hud-portrait-frame:hover {
        filter: brightness(1.12);
    }
}

.hud-portrait-frame:focus-visible {
    outline: 2px solid rgba(255, 216, 107, 0.88);
    outline-offset: 2px;
}

.hud-portrait-frame.is-off {
    opacity: 0.78;
}

.hud-portrait-frame img {
    width: 100%;
    height: 100%;
    display: block;
    margin: 0;
    object-fit: cover;
    object-position: center center;
    image-rendering: pixelated;
    border-radius: 1px;
}

.buff-icons {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.buff-icons--hud {
    position: absolute;
    top: calc(100% - 70px);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 12;
    pointer-events: auto;
}

.buff-icons--hud.buff-icons--right {
    left: calc(50% + 26px);
    align-items: flex-start;
}

.buff-icons--hud.buff-icons--right.is-three {
    top: calc(100% - 64px);
}

.buff-icons--hud.buff-icons--left {
    right: calc(50% + 26px);
    align-items: flex-end;
}

.buff-icons img {
    width: 12px;
    height: 12px;
    image-rendering: pixelated;
    pointer-events: auto;
}

.hud-resource {
    min-width: 0;
}

.progress-bar,
.progress-bar-fill {
    box-shadow: none !important;
    filter: none !important;
}

.progress-bar::before,
.progress-bar::after,
.progress-bar-fill::before,
.progress-bar-fill::after {
    content: none !important;
}

.progress-bar {
    --hud-bar-inner-top: rgba(19, 33, 58, 0.98);
    --hud-bar-inner-bottom: rgba(10, 21, 41, 0.98);
    --hud-bar-border-gradient: linear-gradient(
        90deg,
        rgba(118, 146, 194, 0.92) 0%,
        rgba(70, 96, 141, 0.9) 58%,
        rgba(9, 22, 47, 0.98) 100%
    );
    --hud-bar-glow: rgba(70, 96, 141, 0.2);
    position: relative;
    height: 11px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 3px;
    background:
        linear-gradient(180deg, var(--hud-bar-inner-top), var(--hud-bar-inner-bottom)) padding-box,
        var(--hud-bar-border-gradient) border-box;
    box-shadow:
        0 0 10px var(--hud-bar-glow);
    pointer-events: auto;
}

.progress-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    transition: width 900ms ease;
    border-radius: 1px;
}

.health-bar .progress-bar-fill {
    background: linear-gradient(90deg, rgba(191, 61, 82, 0.96), rgba(236, 88, 120, 0.92));
}

body.low-health-active .health-bar .progress-bar-fill {
    background: linear-gradient(90deg, rgba(255, 112, 112, 0.99), rgba(188, 27, 49, 0.99));
    animation: lowHealthBarPulse 900ms ease-in-out infinite;
}

body.low-health-active .hud-resource--health {
    animation: lowHealthHudShellPulse 900ms ease-in-out infinite;
}

.xp-bar .progress-bar-fill {
    background: linear-gradient(90deg, rgba(186, 132, 36, 0.96), rgba(228, 182, 74, 0.92));
}

.aura-bar .progress-bar-fill {
    background: linear-gradient(90deg, rgba(46, 118, 208, 0.96), rgba(92, 181, 255, 0.92));
}

@keyframes lowHealthBarPulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.72;
    }
}

@keyframes lowHealthHudShellPulse {
    0%,
    100% {
        transform: translateZ(0);
    }
    50% {
        transform: translateY(-1px);
    }
}

.health-bar {
    --hud-bar-border-gradient: linear-gradient(
        90deg,
        rgba(255, 98, 132, 0.96) 0%,
        rgba(255, 98, 132, 0.72) 34%,
        rgba(25, 47, 92, 0.98) 100%
    );
    --hud-bar-glow: rgba(255, 83, 114, 0.22);
}

.xp-bar {
    --hud-bar-border-gradient: linear-gradient(
        90deg,
        rgba(255, 198, 92, 0.95) 0%,
        rgba(201, 145, 45, 0.72) 34%,
        rgba(25, 47, 92, 0.98) 100%
    );
    --hud-bar-glow: rgba(226, 173, 58, 0.18);
}

.aura-bar {
    --hud-bar-border-gradient: linear-gradient(
        90deg,
        rgba(69, 167, 255, 0.96) 0%,
        rgba(69, 167, 255, 0.72) 34%,
        rgba(25, 47, 92, 0.98) 100%
    );
    --hud-bar-glow: rgba(56, 171, 255, 0.22);
}

.health-bar,
.aura-bar {
    overflow: visible;
}

.hud-resource-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 0 5px;
    box-sizing: border-box;
}

.xp-bar .hud-resource-content {
    justify-content: center;
}

.hud-resource-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 12px;
    flex-shrink: 0;
}

.hud-resource-tag img {
    width: 8px;
    height: 8px;
    object-fit: contain;
}

.health-bar .hud-resource-tag,
.aura-bar .hud-resource-tag {
    min-width: 12px;
    position: relative;
    z-index: 2;
    overflow: visible;
}

.health-bar .hud-resource-tag img,
.aura-bar .hud-resource-tag img {
    width: 14px;
    height: 14px;
    max-width: none;
    flex: 0 0 14px;
    position: relative;
    z-index: 3;
    image-rendering: pixelated;
}

.hud-resource-level,
#HUDlevelDisplay {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    color: #f4fbff;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.hud-level-text {
    display: block;
    width: 100%;
    text-align: center;
}

.hud-resource-value {
    color: #f4fbff;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    text-shadow: none;
}

@media (max-width: 640px) {
    .character-info-container {
        width: min(calc(100% - 16px), 404px);
        bottom: 3px;
    }

    .hud-upper {
        grid-template-columns: minmax(0, 1fr) 68px minmax(0, 1fr);
        gap: 5px;
    }

    .hud-inventory-cluster {
        gap: 3px;
    }

    .hud-lower {
        grid-template-columns: 108px 98px 108px;
        gap: 3px;
    }

    .hud-portrait-frame.hud-portrait-underlay {
        width: 46px;
        height: 46px;
        bottom: 15px;
    }

    .hud-portrait-stack {
        transform: translateY(8px);
    }

    .hud-slot-card,
    .hud-slot-asset-wrap {
        min-height: 38px;
    }

    .hud-slot-asset {
        width: 31px;
        height: 31px;
    }

    .hud-portrait-frame {
        width: 68px;
        height: 68px;
    }

    .progress-bar {
        height: 10px;
    }

    .hud-resource-level,
    .hud-resource-value {
        font-size: 8px;
    }

    .hud-level-chip {
        top: -11px;
        bottom: auto;
        min-width: 0;
        padding: 0;
    }
}

html.phone-optimised .game-container.game-view-phone-extended-x,
body.phone-optimised .game-container.game-view-phone-extended-x {
    --phone-hud-scale: 1.32;
}

html.phone-optimised .game-container.game-view-phone-extended-x #hudLayer,
body.phone-optimised .game-container.game-view-phone-extended-x #hudLayer {
    position: absolute;
    inset: auto;
    left: 32px;
    top: 36px;
    width: var(--game-view-width, 576px);
    height: var(--game-view-height, 576px);
    overflow: visible;
    z-index: 320;
}

html.phone-optimised .game-container.game-view-phone-extended-x .character-info-container,
body.phone-optimised .game-container.game-view-phone-extended-x .character-info-container {
    bottom: -20px;
    transform: translateX(-50%) scale(var(--phone-hud-scale, 1));
    transform-origin: center bottom;
}

html.phone-optimised .game-container.game-view-phone-extended-x .hud-art-overlay,
body.phone-optimised .game-container.game-view-phone-extended-x .hud-art-overlay {
    bottom: -22px;
    transform-origin: center bottom;
}

html.phone-optimised .game-container.game-view-phone-extended-x.game-view-slim-x .hud-art-overlay,
body.phone-optimised .game-container.game-view-phone-extended-x.game-view-slim-x .hud-art-overlay {
    transform: translateX(-50%) scale(var(--phone-hud-scale, 1));
}

html.phone-optimised .game-container.game-view-phone-extended-x .hud-portrait-frame.hud-portrait-underlay,
body.phone-optimised .game-container.game-view-phone-extended-x .hud-portrait-frame.hud-portrait-underlay {
    bottom: -8px;
    transform: translateX(-50%) scale(var(--phone-hud-scale, 1));
    transform-origin: center bottom;
}
