.m3d {
    --ink: #15181e;
    --blue: #0c8fff;
    --cyan: #42d7ff;
    --muted: #7b8495;
    background: #ffffff;
    color: var(--ink);
    font-family: Montserrat, Arial, sans-serif;
}
.m3d * { box-sizing: border-box; }

.m3d__viewer {
    position: relative;
    display: grid;
    grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "panel stage";
    height: clamp(620px, 82vh, 940px);
    background: #ffffff;
    overflow: hidden;
}
.m3d__host {
    grid-area: stage;
    width: 100%;
    height: 100%;
}
.m3d__host canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.m3d__loading {
    grid-area: stage;
    position: relative; inset: auto; z-index: 4;
    display: grid; place-items: center;
    color: #687487; background: #ffffff;
    letter-spacing: .08em; font-size: 11px; text-transform: uppercase;
    transition: opacity .35s ease, visibility .35s ease;
}
.m3d__loading.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.m3d__loading.is-error { color: #e06c6c; }

.m3d__caption {
    grid-area: panel;
    align-self: center;
    position: relative; z-index: 2;
    width: auto;
    pointer-events: auto;
    text-align: left;
    padding: clamp(28px, 4vw, 48px) clamp(24px, 3.2vw, 44px);
}
.m3d__eyebrow {
    color: var(--cyan); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.m3d__caption-title {
    font-family: Ubuntu, Arial, sans-serif;
    font-size: clamp(26px, 2.8vw, 40px);
    letter-spacing: -.04em; line-height: 1.04;
    margin: 14px 0 16px;
    max-width: 15ch;
}
.m3d__caption-summary {
    margin: 0; color: #697487; font-size: 15px; font-weight: 500; line-height: 1.55;
    max-width: 38ch;
}

.m3d__nav {
    grid-area: stage;
    align-self: end;
    justify-self: center;
    position: relative; z-index: 3;
    width: min(980px, calc(100% - 40px));
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    gap: clamp(6px, .8vw, 10px);
    padding: 0 0 clamp(18px, 2.5vw, 28px);
}
.m3d__btn {
    position: relative;
    flex: 1 1 0; min-width: 0; min-height: 64px;
    padding: 10px 6px 9px;
    overflow-wrap: break-word;
    border: 1px solid #dce2ea; border-radius: 15px;
    color: #8b94a4; background: rgba(255,255,255,.88);
    box-shadow: inset 1px 1px 0 #ffffffc0, 0 8px 18px #2b3d520e;
    backdrop-filter: blur(12px);
    font-family: inherit; font-size: 11px; font-weight: 600;
    text-align: center; white-space: normal; line-height: 1.15; cursor: pointer;
    transition: color .22s ease, border-color .22s ease, background .22s ease, transform .22s ease, box-shadow .22s ease;
}
.m3d__btn span { display: block; margin-top: 6px; font-size: 11px; }
.m3d__btn-icon { width: 28px; height: 28px; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.m3d__btn.is-active {
    color: var(--ink); border-color: #7edff9; background: #f9fcffe0;
    box-shadow: inset 1px 1px 0 #ffffff, 0 10px 24px #1499d71c;
}
.m3d__btn.is-active span, .m3d__btn.is-active .m3d__btn-icon { color: var(--blue); }
.m3d__btn:hover { color: var(--ink); background: #f4f7fa; transform: translateY(-2px); }

@media (max-width: 900px) {
    .m3d__viewer {
        grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
        height: clamp(540px, 82vh, 900px);
    }
}
@media (max-width: 640px) {
    .m3d__viewer {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(300px, 62vw) auto;
        grid-template-areas:
            "panel"
            "stage"
            "nav";
        height: auto;
    }
    .m3d__caption { align-self: auto; padding: 24px 20px 12px; }
    .m3d__caption-title { font-size: 24px; }
    .m3d__caption-summary { font-size: 13px; }
    .m3d__nav {
        grid-area: nav;
        align-self: auto; justify-self: stretch;
        width: auto;
        display: grid;
        flex-wrap: initial;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 12px 16px 16px;
    }
    .m3d__btn { min-height: 60px; }
}
