.npc-card {
    position: relative;
    box-sizing: border-box;
    background:
            radial-gradient(circle at 96% 11%, rgba(255, 232, 133, 0.34), transparent 8%),
            radial-gradient(circle at 91% 68%, rgba(118, 210, 50, 0.12), transparent 16%),
            linear-gradient(180deg, #171210 0%, #0d0d0f 100%);
    border-top: 1px solid #4b371d;
    border-bottom: 1px solid #070707;
}
.npc-dialog-popup {
    position: fixed; /* меняем с relative на fixed */
    top: auto; /* сбрасываем top */
    bottom: 0; /* прижимаем к низу */
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end; /* выравниваем содержимое внизу */
    justify-content: center;
    box-sizing: border-box;
    opacity: 1;
    transition: opacity 0.22s ease;
}
.npc-dialog-popup--top {
    align-items: flex-start;
}
.npc-dialog-popup--bottom {
    align-items: flex-end;
}
.npc-dialog-popup--no-shade {
    background: transparent;
    pointer-events: none;
}
.npc-dialog-popup--no-shade .npc-dialog-popup__panel {
    pointer-events: auto;
}
.npc-dialog-popup__panel {
    width: 100%;
    max-width: 600px;
    margin: 0 auto; /* центрирование */
    box-sizing: border-box;
    transform: translateY(0);
    transition: transform 0.22s ease;
}
.npc-dialog-popup .npc-card {
    background: transparent;
    border-top: none;
    border-bottom: none;
}
.npc-dialog-popup--closing {
    opacity: 0;
    pointer-events: none;
}
.npc-dialog-popup--closing .npc-dialog-popup__panel {
    transform: translateY(18px);
}
.npc-dialog-popup__close {
    position: absolute;
    top: 4px;
    right: 9px;
    z-index: 5;
    width: 26px;
    height: 26px;
    padding: 0;
    color: #f0cf8f;
    font-size: 22px;
    line-height: 24px;
    text-align: center;
    background: rgba(24, 18, 13, 0.86);
    border: 1px solid rgba(236, 190, 99, 0.64);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    cursor: pointer;
}
.npc-card__frame {
    position: relative;
    display: flex;
    min-height: clamp(96px, 20vw, 120px);
    overflow: visible;
    gap: 20px;
    background:
            linear-gradient(90deg, rgba(13, 12, 13, 0.55) 0%, rgba(13, 12, 13, 0.08) 20%, rgba(13, 12, 13, 0.45) 100%),
            radial-gradient(circle at 94% 22%, rgba(255, 221, 104, 0.18), transparent 18%),
            repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.025) 0, rgba(255, 255, 255, 0.025) 1px, transparent 1px, transparent 5px),
            linear-gradient(180deg, rgba(54, 42, 32, 0.96) 0%, rgba(27, 23, 22, 0.98) 100%);
    border: 2px solid #8b6129;
    border-radius: 4px;
    box-shadow:
            inset 0 3px 0 rgba(255, 226, 145, 0.4),
            inset 0 -3px 0 rgba(89, 58, 25, 0.72),
            inset 0 0 0 1px rgba(250, 211, 125, 0.35),
            inset 0 0 34px rgba(0, 0, 0, 0.64),
            0 2px 0 rgba(0, 0, 0, 0.72);
}
.npc-card__frame::before,
.npc-card__frame::after {
    content: "";
    position: absolute;
    top: 5px;
    width: 38px;
    height: 38px;
    z-index: 3;
    border-top: 3px solid rgba(236, 190, 99, 0.9);
}
.npc-card__frame::before {
    left: 5px;
    border-left: 3px solid rgba(236, 190, 99, 0.9);
    box-shadow: inset 10px 10px 0 -7px rgba(255, 241, 175, 0.52);
}
.npc-card__frame::after {
    right: 5px;
    border-right: 3px solid rgba(236, 190, 99, 0.9);
    box-shadow: inset -10px 10px 0 -7px rgba(255, 241, 175, 0.52);
}
.npc-card__portrait {
    position: relative;
    flex: 0 0 clamp(116px, 29vw, 166px);
}
.npc-card__avatar {
    position: absolute;
    left: -10px;
    bottom: 2px;
    width: clamp(122px, 31vw, 188px);
    height: clamp(132px, 34vw, 194px);
    max-width: none;
    object-fit: contain;
    object-position: left bottom;
    z-index: 1000;
}
.npc-card__content {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(38px, 1fr) auto;
    grid-template-areas:
        "name"
        "text"
        "action";
    align-content: stretch;
    align-items: start;
    text-align: left;
    z-index: 1000;
}
.npc-card__name {
    position: relative;
    grid-area: name;
    margin-bottom: 5px;
    padding-bottom: 5px;
    color: #f0cf8f;
    font-size: clamp(18px, 2vw, 20px);
    font-weight: bold;
    line-height: 1.1;
    text-shadow: 0 2px 3px #000, 0 0 9px rgba(255, 210, 132, 0.22);
}
.npc-card__name::after {
    content: "";
    position: absolute;
    left: 0;
    right: 8%;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, #9b7440 0%, #74552f 68%, rgba(116, 85, 47, 0) 100%);
    box-shadow:
            0 1px 0 rgba(0, 0, 0, 0.72),
            inset 0 1px 0 rgba(255, 223, 144, 0.42);
}
.npc-card .npc-card__text {
    grid-area: text;
    align-self: start;
    margin: 0;
    padding: 0;
    width: 95%;
    min-height: 38px;
    color: #ded8d4;
    font-size: clamp(14px, 1.8vw, 18px);
    line-height: 1.2;
    text-shadow: 0 2px 3px #000;
    overflow-wrap: anywhere;
}
.npc-card__task {
    padding: 6px 8px 1px;
    font-size: small;
}
.npc-card__actions {
    grid-area: action;
    align-self: end;
    justify-content: flex-end;
    padding: 7px 0 2px;
}
.npc-card__actions .btn {
    box-sizing: border-box;
    min-width: 122px;
    height: 38px;
    min-height: 38px;
    margin: 0;
    border-radius: 8px;
    font-size: large;
    line-height: 38px;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.72);
    box-shadow:
            0 0 18px rgba(99, 218, 59, 0.32),
            0 0 14px rgba(255, 228, 73, 0.24),
            inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.npc-card--compact .npc-card__frame {
    min-height: 82px;
}
.npc-card--compact .npc-card__portrait {
    flex-basis: 104px;
    min-height: 82px;
}

.npc-card--compact .npc-card__name {
    font-size: clamp(15px, 1.8vw, 18px);
}
.npc-card--compact .npc-card__text {
    font-size: clamp(13px, 1.8vw, 15px);
}

@media (max-width: 460px) {
    .npc-card__frame {
        gap: 5px;
    }
}