html {
    background-image: url("img/deep-space.jpg");
}

@media screen and (max-width: 768px) {
    .control-panel {
        grid-template-columns: 1fr;
        grid-template-areas:
            "panel-1"
            "panel-2";
    }

    .panel-2 {
        margin-left: 0;
        padding-left: 0.75rem;
    }

    main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "rocket-div"
            "time-effect"
            "div-1"
            "div-2";
    }

    .graph-card {
        margin: 0.35rem 0.25rem;
    }

    .explanation-lead-row {
        grid-template-columns: 1fr;
        grid-template-areas:
            "text"
            "sideL"
            "sideR";
        justify-items: stretch;
        row-gap: 0.65rem;
    }

    .explanation-lead-row > .explanation-lead {
        max-width: none;
        width: 100%;
        justify-self: stretch;
    }

    .explanation-side--left,
    .explanation-side--right {
        width: 100%;
        max-width: min(22rem, 100%);
        margin-inline: auto;
        justify-content: center;
    }

    .explanation-figure {
        max-width: min(22rem, 100%);
    }
}
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 1rem;
    box-sizing: border-box;
    background: radial-gradient(ellipse 120% 80% at 50% 40%, rgba(12, 40, 85, 0.45) 0%, transparent 55%),
        rgba(2, 8, 28, 0.72);
    backdrop-filter: blur(2px) saturate(1.1);
    -webkit-backdrop-filter: blur(2px) saturate(1.1);
}

.modal-backdrop[hidden] {
    display: none !important;
}

/* Wispy smoke trails (decorative, behind panel) */
.modal-smoke-trails {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.modal-smoke {
    position: absolute;
    top: -25%;
    width: 14px;
    height: 150%;
    border-radius: 50%;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(255, 255, 255, 0) 8%,
        rgba(255, 255, 255, 0.14) 28%,
        rgba(248, 252, 255, 0.08) 52%,
        rgba(255, 255, 255, 0.04) 78%,
        transparent 100%
    );
    filter: blur(5px);
    opacity: 0.85;
    mix-blend-mode: screen;
    animation: modal-smoke-drift linear infinite;
}

.modal-smoke--1 {
    left: 18%;
    width: 10px;
    animation-duration: 11s;
    animation-delay: 0s;
}

.modal-smoke--2 {
    left: 34%;
    width: 16px;
    filter: blur(7px);
    animation-duration: 14s;
    animation-delay: -3s;
}

.modal-smoke--3 {
    left: 52%;
    width: 11px;
    animation-duration: 9.5s;
    animation-delay: -1.5s;
}

.modal-smoke--4 {
    left: 71%;
    width: 13px;
    filter: blur(6px);
    animation-duration: 12.5s;
    animation-delay: -5s;
}

.modal-smoke--5 {
    left: 86%;
    width: 9px;
    animation-duration: 10s;
    animation-delay: -2s;
}

@keyframes modal-smoke-drift {
    0% {
        transform: translateY(-8%) translateX(0) scaleX(1);
        opacity: 0;
    }
    12% {
        opacity: 0.75;
    }
    50% {
        transform: translateY(42%) translateX(6px) scaleX(1.15);
        opacity: 0.55;
    }
    88% {
        opacity: 0.35;
    }
    100% {
        transform: translateY(95%) translateX(-4px) scaleX(0.9);
        opacity: 0;
    }
}

.modal-panel {
    position: relative;
    z-index: 1;
    max-width: 28rem;
    width: 100%;
    padding: 1.75rem 1.65rem 1.5rem;
    border-radius: 14px;
    background: linear-gradient(165deg, rgba(18, 52, 98, 0.96) 0%, rgba(6, 22, 52, 0.98) 45%, rgba(4, 14, 38, 0.99) 100%);
    color: #e8fcff;
    border: 1px solid rgba(140, 220, 255, 0.45);
    box-shadow: 0 0 0 1px rgba(80, 160, 220, 0.12) inset,
        0 24px 48px rgba(0, 0, 0, 0.45),
        0 0 60px rgba(100, 190, 255, 0.12);
}

.modal-title {
    margin: 0 2.25rem 0.65rem 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #f0fbff;
    text-shadow: 0 0 20px rgba(140, 220, 255, 0.35), 0 1px 0 rgba(0, 0, 0, 0.35);
}

.modal-description {
    margin: 0 0 1.1rem;
    font-size: 1.02rem;
    line-height: 1.55;
    color: rgba(220, 240, 248, 0.92);
}

.modal-close-btn {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    font-size: 1.35rem;
    line-height: 1;
    color: rgba(200, 235, 255, 0.85);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.modal-close-btn:hover {
    color: #fff;
    background: rgba(255, 0, 0, 0.249);
    box-shadow: 0 0 8px rgba(107, 4, 4, 0.25);
}

.modal-close-btn:focus-visible {
    outline: 2px solid rgba(140, 220, 255, 0.85);
    outline-offset: 2px;
}

.modal-kofi-link {
    display: inline-block;
    font-size: 1rem;
    font-weight: 550;
    letter-spacing: 0.03em;
    text-decoration: none;
    color: rgba(255, 200, 120, 0.95);
    background: linear-gradient(135deg, rgba(255, 180, 80, 0.85) 0%, rgba(255, 150, 60, 0.75) 35%, rgba(255, 120, 40, 0.65) 70%, rgba(255, 90, 20, 0.55) 100%);
    padding: 0.4rem 0.15rem;
    padding-right: 0.5rem;
    border-bottom: 1px solid rgba(255, 200, 120, 0.35);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(255, 160, 80, 0.35);
    transition: color 0.15s ease, border-color 0.15s ease, text-shadow 0.15s ease;
}

.modal-kofi-link:hover {
    color: #ffe8c0;
    background: linear-gradient(135deg, rgba(255, 200, 100, 0.95) 0%, rgba(255, 170, 80, 0.85) 35%, rgba(255, 140, 60, 0.75) 70%, rgba(255, 110, 40, 0.65) 100%);
    box-shadow: 0 0 14px rgba(255, 180, 100, 0.45);
}