/* css/anomalyInstance.css */

:root {
    --anomaly-tooltip-frame-top: url("../assets/ui/livraison/haut_1.png");
    --anomaly-tooltip-frame-middle: url("../assets/ui/livraison/centre_1.png");
    --anomaly-tooltip-frame-bottom: url("../assets/ui/livraison/bas_1.png");
    --anomaly-tooltip-skull-image: var(--delivery-skull-image);
}

/* Les malus d'anomalie sont affichés dans le tracker pendant l'instance. */
#anomalyMalusHud {
    display: none !important;
}

/* Carte d'interaction d'anomalie, basée sur le cadre PNG des livraisons. */
#anomalyInteraction.anomaly-interaction {
    --anomaly-card-w: 700px;
    --anomaly-card-scale: 0.74;
    --anomaly-frame-top-h: 140px;
    --anomaly-frame-bottom-h: 232px;
    --anomaly-pad-x: 88px;
    --anomaly-pad-top: 12px;
    --anomaly-pad-bottom: 0px;
    --anomaly-skull-size: 39px;

    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 9000;
    width: var(--anomaly-card-w);
    pointer-events: none;
    color: rgba(235, 250, 255, 0.96);
    font-family: "Roboto", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    letter-spacing: 0.2px;
    transform: translate(-50%, calc(-100% - 12px)) scale(var(--anomaly-card-scale));
    transform-origin: 50% 100%;
    opacity: 1;
    visibility: visible;
    transition: opacity 150ms ease, transform 150ms ease, visibility 0ms linear 0ms;
}

#anomalyInteraction.anomaly-interaction.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, calc(-100% + 4px)) scale(calc(var(--anomaly-card-scale) * 0.96));
    transition: opacity 120ms ease, transform 120ms ease, visibility 0ms linear 120ms;
}

#anomalyInteraction.anomaly-interaction.visible {
    opacity: 1;
    visibility: visible;
}

#anomalyInteraction.anomaly-interaction.is-place-above {
    transform: translate(-50%, calc(-100% - 18px)) scale(var(--anomaly-card-scale));
    transform-origin: 50% 100%;
}

#anomalyInteraction.anomaly-interaction.hidden.is-place-above {
    transform: translate(-50%, calc(-100% + 4px)) scale(calc(var(--anomaly-card-scale) * 0.96));
}

#anomalyInteraction.anomaly-interaction.is-place-right {
    transform: translate(28px, -50%) scale(var(--anomaly-card-scale));
    transform-origin: 0% 50%;
}

#anomalyInteraction.anomaly-interaction.hidden.is-place-right {
    transform: translate(12px, -50%) scale(calc(var(--anomaly-card-scale) * 0.96));
}

#anomalyInteraction.anomaly-interaction.is-place-left {
    transform: translate(calc(-100% - 28px), -50%) scale(var(--anomaly-card-scale));
    transform-origin: 100% 50%;
}

#anomalyInteraction.anomaly-interaction.hidden.is-place-left {
    transform: translate(calc(-100% - 12px), -50%) scale(calc(var(--anomaly-card-scale) * 0.96));
}

#anomalyInteraction.anomaly-interaction.is-place-below {
    transform: translate(-50%, 22px) scale(var(--anomaly-card-scale));
    transform-origin: 50% 0%;
}

#anomalyInteraction.anomaly-interaction.hidden.is-place-below {
    transform: translate(-50%, 8px) scale(calc(var(--anomaly-card-scale) * 0.96));
}

#anomalyInteraction .anomaly-tooltip__frame {
    width: 100%;
    display: flex;
    flex-direction: column;
    animation: anomalyInteractionFloatY 2.8s ease-in-out infinite;
    will-change: transform;
}

@keyframes anomalyInteractionFloatY {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-9px);
    }
}

@media (prefers-reduced-motion: reduce) {
    #anomalyInteraction .anomaly-tooltip__frame {
        animation: none;
    }
}

#anomalyInteraction .anomaly-tooltip__frameTop {
    height: var(--anomaly-frame-top-h);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--anomaly-pad-x);
    background-color: transparent;
    background-image: var(--anomaly-tooltip-frame-top);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%;
}

#anomalyInteraction .anomaly-tooltip__frameMid {
    padding: var(--anomaly-pad-top) var(--anomaly-pad-x) var(--anomaly-pad-bottom);
    background-color: transparent;
    background-image: var(--anomaly-tooltip-frame-middle);
    background-repeat: repeat-y;
    background-position: top center;
    background-size: 100% auto;
}

#anomalyInteraction .anomaly-tooltip__frameBottom {
    height: var(--anomaly-frame-bottom-h);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--anomaly-pad-x);
    background-color: transparent;
    background-image: var(--anomaly-tooltip-frame-bottom);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%;
}

#anomalyInteraction .anomaly-tooltip__title {
    margin: 70px 0 0 0;
    color: rgba(235, 250, 255, 0.98);
    font-size: 39px;
    font-weight: 950;
    line-height: 1;
    text-align: center;
    text-shadow:
        0 2px 0 rgba(0, 0, 0, 0.42),
        0 0 22px rgba(160, 220, 255, 0.18);
    white-space: nowrap;
}

#anomalyInteraction .anomaly-tooltip__grid {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 30px;
    row-gap: 13px;
    align-items: center;
    font-size: 27px;
}

#anomalyInteraction .anomaly-tooltip__label {
    color: rgba(200, 230, 255, 0.84);
    font-weight: 800;
}

#anomalyInteraction .anomaly-tooltip__value {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 50px;
    color: rgba(235, 250, 255, 0.98);
    text-align: right;
    font-weight: 900;
}

#anomalyInteraction .anomaly-tooltip__skulls {
    gap: 14px;
}

#anomalyInteraction .anomaly-tooltip__skull {
    display: inline-block;
    width: var(--anomaly-skull-size);
    height: var(--anomaly-skull-size);
    background-image: var(--anomaly-tooltip-skull-image);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.18;
    position: relative;
    isolation: isolate;
}

#anomalyInteraction .anomaly-tooltip__skull.is-active {
    opacity: 1;
    filter:
        drop-shadow(0 0 10px rgba(37, 49, 106, 0.42))
        drop-shadow(0 0 18px rgba(0, 0, 0, 0.58));
}

#anomalyInteraction .anomaly-tooltip__lootIcon {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background:
        radial-gradient(circle at 50% 45%, rgba(150, 225, 255, 0.22), rgba(150, 225, 255, 0.03) 62%),
        rgba(255, 255, 255, 0.06);
    box-shadow:
        inset 0 0 0 1px rgba(200, 245, 255, 0.22),
        0 0 18px rgba(100, 205, 255, 0.14);
}

#anomalyInteraction .anomaly-tooltip__lootIcon.hidden {
    display: none;
}

#anomalyInteraction .anomaly-tooltip__lootIcon img {
    display: block;
    width: 52px;
    height: 52px;
    object-fit: contain;
}

#anomalyInteraction .anomaly-tooltip__bottomContent {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: -24px 0 44px;
}

#anomalyInteraction .anomaly-tooltip__hint {
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding-top: 10px;
    position: relative;
    color: rgba(235, 250, 255, 0.88);
    font-size: 28px;
    font-weight: 950;
    letter-spacing: 0.3px;
    text-align: center;
}

#anomalyInteraction .anomaly-tooltip__hint::before {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    top: 0;
    height: 1px;
    background: rgba(160, 220, 255, 0.18);
}

#anomalyInteraction .anomaly-tooltip__keycap {
    display: grid;
    place-items: center;
    min-width: 50px;
    height: 50px;
    padding: 0 16px;
    border-radius: 15px;
    color: rgba(245, 255, 255, 0.98);
    background:
        linear-gradient(180deg, rgba(215, 240, 255, 0.18), rgba(90, 130, 180, 0.08)),
        rgba(0, 0, 0, 0.18);
    box-shadow:
        inset 0 0 0 1px rgba(230, 250, 255, 0.38),
        0 0 18px rgba(105, 190, 255, 0.18);
    font-size: 23px;
    font-weight: 1000;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
}

#anomalyInteraction .anomaly-interaction-maluses {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    max-height: 150px;
    margin-top: 16px;
    overflow: hidden;
}

#anomalyInteraction .anomaly-interaction-maluses.hidden {
    display: none;
}

#anomalyInteraction .anomaly-interaction-malus {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 9px 12px 9px 9px;
    border: 1px solid rgba(255, 135, 105, 0.32);
    border-radius: 15px;
    background: rgba(255, 85, 70, 0.10);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

#anomalyInteraction .anomaly-interaction-malus__icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 11px;
    color: rgba(255, 230, 210, 0.98);
    background: rgba(255, 120, 95, 0.14);
    overflow: hidden;
    font-size: 22px;
    font-weight: 950;
}

#anomalyInteraction .anomaly-interaction-malus__icon img {
    display: block;
    width: 39px;
    height: 39px;
    object-fit: contain;
}

#anomalyInteraction .anomaly-interaction-malus__copy {
    overflow: visible;
    color: rgba(255, 218, 192, 0.96);
    font-size: 20px;
    font-weight: 900;
    line-height: 1.18;
    text-overflow: initial;
    white-space: normal;
}

#anomalyInteraction[data-kind="exit"] .anomaly-tooltip__loot,
#anomalyInteraction[data-kind="exit"] .anomaly-tooltip__skulls {
    opacity: 0.42;
}

@media (max-width: 900px) {
    #anomalyInteraction.anomaly-interaction {
        --anomaly-card-w: 660px;
        --anomaly-card-scale: 0.60;
    }
}

@media (max-width: 640px) {
    #anomalyInteraction.anomaly-interaction {
        --anomaly-card-w: 620px;
        --anomaly-card-scale: 0.48;
    }
}

/* HUD des malus actifs pendant une anomalie */
#anomalyMalusHud.anomaly-malus-hud {
    position: fixed;
    left: 50%;
    top: 112px;
    z-index: 45;
    width: min(560px, calc(100vw - 34px));
    pointer-events: none;
    transform: translateX(-50%);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    transition: opacity 150ms ease, transform 150ms ease;
}

#anomalyMalusHud.anomaly-malus-hud.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px) scale(0.98);
}

#anomalyMalusHud.anomaly-malus-hud.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

#anomalyMalusHud .anomaly-malus-hud__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 24px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 115, 115, 0.55);
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    background:
        radial-gradient(circle at 14% 0%, rgba(255, 95, 95, 0.28), rgba(255, 95, 95, 0) 46%),
        linear-gradient(135deg, rgba(42, 8, 14, 0.84), rgba(10, 13, 24, 0.78));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(7px);
}

#anomalyMalusHud .anomaly-malus-hud__title {
    color: rgba(255, 235, 235, 0.98);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

#anomalyMalusHud .anomaly-malus-hud__difficulty {
    color: rgba(255, 190, 150, 0.92);
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

#anomalyMalusHud .anomaly-malus-hud__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 7px;
    padding: 9px;
    border: 1px solid rgba(255, 115, 115, 0.42);
    border-radius: 0 0 16px 16px;
    background:
        radial-gradient(circle at 82% 100%, rgba(255, 170, 70, 0.11), rgba(255, 170, 70, 0) 42%),
        linear-gradient(135deg, rgba(8, 13, 28, 0.72), rgba(5, 9, 18, 0.68));
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(7px);
}

#anomalyMalusHud .anomaly-malus-hud__item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 6px 8px 6px 6px;
    border: 1px solid rgba(255, 160, 120, 0.24);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.055);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#anomalyMalusHud .anomaly-malus-hud__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 145, 110, 0.42);
    border-radius: 10px;
    color: rgba(255, 220, 180, 0.98);
    background:
        radial-gradient(circle, rgba(255, 95, 95, 0.22), rgba(255, 95, 95, 0.04));
    font-size: 23px;
    font-weight: 950;
    overflow: hidden;
}

#anomalyMalusHud .anomaly-malus-hud__icon img {
    display: block;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

#anomalyMalusHud .anomaly-malus-hud__copy {
    min-width: 0;
}

#anomalyMalusHud .anomaly-malus-hud__name {
    overflow: hidden;
    color: rgba(255, 245, 238, 0.98);
    font-size: 12px;
    font-weight: 950;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
}

#anomalyMalusHud .anomaly-malus-hud__text,
#anomalyMalusHud .anomaly-malus-hud__empty {
    margin-top: 2px;
    overflow: hidden;
    color: rgba(255, 205, 178, 0.88);
    font-size: 10.5px;
    font-weight: 750;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#anomalyMalusHud .anomaly-malus-hud__empty {
    padding: 5px 8px;
    text-align: center;
}

@media (max-width: 640px) {
    #anomalyMalusHud.anomaly-malus-hud {
        top: 102px;
        width: min(430px, calc(100vw - 24px));
    }

    #anomalyMalusHud .anomaly-malus-hud__list {
        grid-template-columns: 1fr;
    }
}

/* Carte temporaire d'anomalie dans le tracker des quêtes */
#questTrackerHUD .qt-item.qt-item-anomaly {
    border-color: rgba(255, 125, 100, 0.44);
    background:
        radial-gradient(circle at 12% 0%, rgba(255, 95, 95, 0.18), rgba(255, 95, 95, 0) 44%),
        rgba(255, 255, 255, 0.055);
}

#questTrackerHUD .qt-item-anomaly .qt-item-title {
    color: rgba(255, 238, 228, 0.98);
}

#questTrackerHUD .qt-item-anomaly .qt-item-pill {
    color: rgba(255, 218, 180, 0.98);
    border-color: rgba(255, 150, 110, 0.38);
    background: rgba(255, 120, 90, 0.12);
}

#questTrackerHUD .qt-item-anomaly-meta {
    color: rgba(255, 212, 178, 0.94);
    font-weight: 850;
}

#questTrackerHUD .qt-item-anomaly-malus {
    margin-top: 4px;
    padding: 5px 7px;
    border: 1px solid rgba(255, 130, 105, 0.22);
    border-radius: 9px;
    color: rgba(255, 218, 196, 0.96);
    background: rgba(255, 80, 70, 0.075);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.22;
}

#questTrackerHUD .qt-item-anomaly-malus {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 110, 110, 0.34);
    background: rgba(255, 60, 60, 0.11);
    color: rgba(255, 232, 220, 0.96);
    font-size: 0.84rem;
    line-height: 1.22;
}

#questTrackerHUD .qt-item-anomaly-malus__icon {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.24);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

#questTrackerHUD .qt-item-anomaly-malus__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

#questTrackerHUD .qt-item-anomaly-malus__icon-fallback {
    font-weight: 1000;
    color: rgba(255, 180, 150, 0.98);
    transform: translateY(-1px);
}

#questTrackerHUD .qt-item-anomaly-malus__copy {
    min-width: 0;
}

#questTrackerHUD .qt-item-anomaly-malus__name {
    color: rgba(255, 244, 232, 0.98);
    font-weight: 950;
    line-height: 1.05;
}

#questTrackerHUD .qt-item-anomaly-malus__text {
    margin-top: 2px;
    color: rgba(255, 220, 205, 0.94);
    font-weight: 800;
}
