.mpL-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: block;
}

.mpL-modal[aria-hidden="true"] {
    display: none;
}

.mpL-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(6px);
}

.mpL-dialog {
    position: relative;
    width: min(980px, 92vw);
    height: min(760px, 92vh);
    margin: 4vh auto;
    border-radius: 22px;
    background: var(--theme-bg);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
    overflow: hidden;
    display: grid;
    place-items: center;
    padding: 24px;
}

.mpL-dialog,
.mpL-dialog * {
    box-sizing: border-box;
}

/* Variables SOLO dentro del modal */
.mpL-dialog {
    --color-primary: #FAB1AA;
    --color-secondary: #E26698;
    --color-accent: #FDCEDF;
    --color-sheet: #FCFFE7;
    --color-text: #c35782;
    --silver: #AAAAAA;
    --white: #FFFFFF;
}

.mpL-letter {
    width: min(620px, 100%);
    display: grid;
    place-items: center;
    gap: 18px;
    animation: mpL-letter-lift 3s ease-in-out infinite;
}

.mpL-envelope {
    position: relative;
    display: flex;
    cursor: pointer;
    justify-content: center;

    width: min(560px, 72vw);
    aspect-ratio: 5/3;
    background-color: var(--color-primary);
}

.mpL-envelope::after {
    content: "";
    position: absolute;
    bottom: 0;
    border-left: min(560px, 72vw) solid var(--color-accent);
    border-top: calc(calc(min(560px, 72vw) * 3) / 5) solid transparent;
    pointer-events: none;
    z-index: 4;
}

.mpL-envelope::before {
    content: "";
    pointer-events: none;
    position: absolute;
    bottom: 0;
    border-right: min(560px, 72vw) solid var(--color-text);
    border-top: calc(calc(min(560px, 72vw) * 3) / 5) solid transparent;
    transform: perspective(400px);
    z-index: 3;
}

.mpL-envelopeHeader {
    bottom: 0;
    left: 0;
    padding: 5%;
    list-style: none;
    position: absolute;
    color: var(--color-text);
    z-index: 5;
    margin: 0;
}

.mpL-envelopeHeader li {
    display: flex;
    font-size: 14px;
    text-transform: capitalize;
    gap: 0.4rem;
}

.mpL-envelopeHeader li p {
    margin: 0;
}

.mpL-envelopeHeader li p:last-child {
    color: var(--color-secondary);
}

.mpL-letterSheet {
    display: flex;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
    transition: 1s ease-in-out;
    width: 90%;
    padding: 5%;
    gap: 14px;
    height: 100%;
    background-color: var(--color-sheet);
    position: relative;
    z-index: 1;
}

.mpL-letterSheet__title {
    width: 90%;
    color: var(--color-primary);
    font-size: 24px;
    margin: 0;
}

.mpL-letterSheet__text {
    color: var(--color-text);
    font-size: 16px;
    margin: 0;
    line-height: 1.35;
    overflow-y: auto;
}

.mpL-letterSheet__text::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../images/arrow-bottom.png") no-repeat right bottom;
    background-size: 40px;
    opacity: 0.2;
    /* aquí controlas la transparencia */
    pointer-events: none;
}

.mpL-cover {
    position: absolute;
    width: 100%;
    height: 100%;
    fill: var(--color-secondary);
    z-index: 5;
    transform-origin: top;
}

.mpL-shadowLetter {
    width: min(360px, 50%);
    height: 10px;
    opacity: 0.3;
    background-color: var(--silver);
    animation: mpL-shadow-lift 3s ease-in-out infinite;
    border-radius: 999px;
}

/* Estados del ejemplo (renombrados) */
.mpL-open {
    fill: var(--color-primary);
    animation: mpL-open-letter 2s ease-in-out forwards;
}

.mpL-zoomIn {
    animation: mpL-zoom-sheet-up 2s ease forwards;
    text-rendering: optimizeLegibility;
}

/* Click hint */
.mpL-clickHere {
    position: absolute;
    pointer-events: none;
    top: 34%;
    left: 50%;
    width: min(220px, 30vw);
    opacity: 0.3;
    aspect-ratio: 1/1;
    border-radius: 50%;
    animation: mpL-tap 4s ease infinite forwards;
    z-index: 10;
    transform: translateX(-50%);
}

.mpL-clickHere path {
    stroke: var(--silver);
}

/* Botón */
.mpL-openBtn {
    margin-top: 8px;
    align-self: flex-start;
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    font-weight: 800;
    cursor: pointer;
    background: var(--color-primary);
    color: var(--white);

    opacity: 0;
    transform: translateY(8px);
    transition: opacity 300ms ease, transform 300ms ease;
    pointer-events: none;
    text-transform: uppercase;
}

.mpL-openBtn.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

@keyframes mpL-zoom-sheet-up {
    0% {
        transform: translate(0%, -10%);
    }

    30% {
        transform: translate(0%, -100%);
    }

    100% {
        transform: translate(0%, -30%);
        z-index: 10;
    }
}

@keyframes mpL-tap {

    0%,
    20%,
    40%,
    100% {
        opacity: 0;
    }

    10%,
    30% {
        opacity: 0.5;
    }
}

@keyframes mpL-open-letter {
    0% {
        transform: rotateX(0deg);
        fill: var(--color-secondary);
    }

    49% {
        fill: var(--color-secondary);
    }

    50% {
        z-index: 2;
        fill: var(--color-primary);
    }

    100% {
        transform: translateY(1px) rotateX(180deg);
        fill: var(--color-primary);
        z-index: 2;
    }
}

@keyframes mpL-letter-lift {

    0%,
    100% {
        transform: translateY(0);
    }

    60% {
        transform: translateY(-2%);
    }
}

@keyframes mpL-shadow-lift {

    0%,
    100% {
        transform: scale(1.1);
    }

    60% {
        transform: scale(1);
    }
}

@media (orientation: landscape) {
    .mpL-letter {
        width: min(720px, 100%);
    }

    .mpL-letterSheet__title {
        font-size: 26px;
    }

    .mpL-letterSheet__text {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .mpL-letterSheet__title {
        font-size: 20px;
    }

    .mpL-letterSheet__text {
        font-size: 14px;
        line-height: 1.4;
    }
}