.mag-section {
    --mag-stop-count: 7;
    position: relative;
    z-index: 2;
    padding: 0 0 132px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background:
        radial-gradient(900px 540px at 14% 12%, rgba(110, 231, 183, 0.08), transparent 54%),
        radial-gradient(860px 560px at 84% 24%, rgba(129, 140, 248, 0.08), transparent 56%),
        linear-gradient(180deg, rgba(4, 7, 17, 0.94) 0%, rgba(6, 10, 20, 0.98) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    scroll-margin-top: 110px;
}

.mag-intro {
    width: min(1180px, calc(100vw - 56px));
    margin: 0 auto;
    padding-bottom: 30px;
}

.mag-intro-copy {
    max-width: 42rem;
    display: grid;
    gap: 14px;
}

.mag-kicker {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #7dd3fc;
}

.mag-title {
    font-family: Fraunces, ui-serif, Georgia, "Times New Roman", serif;
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
    text-wrap: balance;
}

.mag-lead {
    max-width: 38rem;
    color: rgba(226, 232, 240, 0.78);
    font-size: clamp(1rem, 1.28vw, 1.14rem);
    line-height: 1.72;
    text-wrap: pretty;
}

.mag-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mag-tags span {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0.72rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(125, 211, 252, 0.22);
    background: rgba(10, 18, 30, 0.72);
    color: #d9f9ff;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.mag-driver {
    position: relative;
    height: 652svh;
    min-height: 616svh;
}

.mag-shell {
    position: sticky;
    top: 0;
    height: 100svh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 28px;
    padding: 108px 0 20px;
}

.mag-stage {
    min-height: 0;
    padding: 0 20px 20px;
}

.mag-frame {
    position: relative;
    width: min(1380px, 100%);
    height: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 30px;
    border: 1px solid rgba(125, 211, 252, 0.12);
    background:
        radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.03), transparent 42%),
        linear-gradient(180deg, rgba(5, 9, 18, 0.94) 0%, rgba(4, 7, 16, 0.98) 100%);
    box-shadow:
        0 36px 88px rgba(2, 6, 23, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mag-canvas,
.mag-grid,
.mag-hud {
    position: absolute;
    inset: 0;
}

.mag-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.mag-grid {
    pointer-events: none;
    opacity: 0.56;
}

.mag-grid::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(243, 239, 227, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(243, 239, 227, 0.03) 1px, transparent 1px);
    background-size: 76px 76px;
    mask-image: radial-gradient(ellipse at center, black 42%, transparent 92%);
}

.mag-corner {
    position: absolute;
    width: 26px;
    height: 26px;
    border-color: rgba(243, 239, 227, 0.38);
    z-index: 3;
}

.mag-corner--tl { top: 22px; left: 22px; border-top: 1px solid; border-left: 1px solid; }
.mag-corner--tr { top: 22px; right: 22px; border-top: 1px solid; border-right: 1px solid; }
.mag-corner--bl { bottom: 22px; left: 22px; border-bottom: 1px solid; border-left: 1px solid; }
.mag-corner--br { bottom: 22px; right: 22px; border-bottom: 1px solid; border-right: 1px solid; }

.mag-hud {
    pointer-events: none;
    z-index: 2;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    color: rgba(243, 239, 227, 0.78);
}

.mag-topbar {
    position: absolute;
    top: 32px;
    left: 58px;
    right: 58px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
}

.mag-titleblock {
    max-width: 34rem;
    display: grid;
    gap: 8px;
}

.mag-figure-label {
    font-size: 0.64rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(243, 239, 227, 0.52);
}

.mag-stage-title {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    color: #ffffff;
    font-size: clamp(1.08rem, 1.5vw, 1.34rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.mag-stage-subtitle {
    max-width: 32rem;
    color: rgba(243, 239, 227, 0.54);
    font-size: 0.74rem;
    line-height: 1.65;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.mag-meta {
    display: grid;
    gap: 6px;
    justify-items: end;
    text-align: right;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(243, 239, 227, 0.46);
}

.mag-meta span {
    color: #ffffff;
}

.mag-legend {
    position: absolute;
    left: 58px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    gap: 2px;
    pointer-events: auto;
}

.mag-legend button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: rgba(243, 239, 227, 0.26);
    font: inherit;
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.22s ease;
}

.mag-legend button:hover {
    color: rgba(243, 239, 227, 0.7);
}

.mag-legend button.is-active {
    color: #ffffff;
}

.mag-legend-index {
    color: rgba(243, 239, 227, 0.5);
}

.mag-legend button.is-active .mag-legend-index {
    color: #7ee7c8;
}

.mag-legend-tick {
    width: 18px;
    height: 1px;
    background: rgba(243, 239, 227, 0.18);
    transition: width 0.22s ease, background 0.22s ease;
}

.mag-legend button.is-active .mag-legend-tick {
    width: 30px;
    background: #7ee7c8;
}

.mag-callout {
    position: absolute;
    right: 66px;
    top: 50%;
    transform: translateY(-50%);
    width: min(280px, 24vw);
    padding-left: 16px;
    border-left: 1px solid rgba(243, 239, 227, 0.28);
}

.mag-callout-kicker {
    margin-bottom: 10px;
    color: #7ee7c8;
    font-size: 0.66rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.mag-callout-name {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    font-size: clamp(1.36rem, 2vw, 1.82rem);
    line-height: 1.04;
    letter-spacing: -0.03em;
    color: #ffffff;
    font-weight: 600;
    text-wrap: balance;
}

.mag-callout-latin {
    margin-top: 8px;
    color: rgba(243, 239, 227, 0.54);
    font-family: Inter, system-ui, -apple-system, sans-serif;
    font-style: italic;
    font-size: 0.88rem;
    line-height: 1.45;
    text-wrap: pretty;
}

.mag-callout-readout {
    margin-top: 14px;
    color: rgba(243, 239, 227, 0.7);
    font-size: 0.72rem;
    line-height: 1.6;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mag-callout-readout span {
    color: #7ee7c8;
}

.mag-crosshair {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 78px;
    height: 78px;
    transform: translate(-50%, -50%);
    opacity: 0.55;
}

.mag-crosshair::before,
.mag-crosshair::after {
    content: "";
    position: absolute;
    background: rgba(243, 239, 227, 0.24);
}

.mag-crosshair::before {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    transform: translateX(-50%);
}

.mag-crosshair::after {
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    transform: translateY(-50%);
}

.mag-crosshair-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 7px;
    height: 7px;
    transform: translate(-50%, -50%);
    border: 1px solid #7ee7c8;
    border-radius: 999px;
}

.mag-scalebar {
    position: absolute;
    left: 58px;
    right: 58px;
    bottom: 52px;
    height: 56px;
}

.mag-scalebar svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.mag-progress {
    position: absolute;
    right: 58px;
    bottom: 112px;
    color: rgba(243, 239, 227, 0.78);
    font-size: 0.76rem;
    letter-spacing: 0.12em;
}

.mag-progress strong {
    color: #7ee7c8;
}

.mag-hint {
    position: absolute;
    right: 58px;
    bottom: 142px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: rgba(243, 239, 227, 0.54);
    font-size: 0.64rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: opacity 0.28s ease;
}

.mag-hint-arrow {
    display: inline-block;
    animation: magBob 1.3s ease-in-out infinite;
}

@keyframes magBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

@media (max-width: 1100px) {
    .mag-intro {
        width: min(1120px, calc(100vw - 36px));
    }
    .mag-callout {
        width: min(250px, 28vw);
    }
    .mag-stage {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (max-width: 920px) {
    .mag-section {
        padding-bottom: 112px;
    }
    .mag-driver {
        height: 700svh;
        min-height: 652svh;
    }
    .mag-shell {
        gap: 24px;
        padding: 92px 0 12px;
    }
    .mag-stage {
        padding: 0 12px 12px;
    }
    .mag-frame {
        border-radius: 24px;
    }
    .mag-topbar {
        left: 26px;
        right: 26px;
        top: 22px;
        gap: 16px;
        grid-template-columns: 1fr;
        display: grid;
    }
    .mag-meta {
        justify-items: start;
        text-align: left;
    }
    .mag-legend {
        left: 26px;
        right: 26px;
        top: auto;
        bottom: 188px;
        transform: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 14px;
    }
    .mag-callout {
        left: 26px;
        right: 26px;
        top: auto;
        bottom: 96px;
        transform: none;
        width: auto;
        padding-left: 0;
        border-left: 0;
        border-top: 1px solid rgba(243, 239, 227, 0.2);
        padding-top: 16px;
    }
    .mag-hint {
        left: 26px;
        right: auto;
        bottom: 76px;
    }
    .mag-progress {
        right: 26px;
        bottom: 76px;
    }
    .mag-scalebar {
        left: 26px;
        right: 26px;
        bottom: 18px;
    }
}

@media (max-width: 640px) {
    .mag-intro {
        width: calc(100vw - 24px);
    }
    .mag-driver {
        height: 772svh;
        min-height: 724svh;
    }
    .mag-shell {
        gap: 18px;
        padding: 84px 0 8px;
    }
    .mag-stage {
        padding: 0 8px 8px;
    }
    .mag-frame {
        border-radius: 20px;
    }
    .mag-topbar,
    .mag-legend,
    .mag-callout,
    .mag-hint,
    .mag-progress,
    .mag-scalebar {
        left: 18px;
        right: 18px;
    }
    .mag-stage-subtitle {
        max-width: none;
        font-size: 0.64rem;
        letter-spacing: 0.12em;
    }
    .mag-legend {
        grid-template-columns: 1fr;
        bottom: 210px;
    }
    .mag-callout {
        bottom: 106px;
    }
    .mag-hint,
    .mag-progress {
        bottom: 84px;
    }
    .mag-progress {
        right: 18px;
        left: auto;
    }
    .mag-crosshair {
        width: 58px;
        height: 58px;
    }
}
