.m3dpl-public, .m3dpl-admin { box-sizing: border-box; }
.m3dpl-public *, .m3dpl-admin * { box-sizing: border-box; }
.m3dpl-public {
    --accent: #ff9900;
    color: #f3f3f3;
    background: #070707;
    padding: 32px 20px 48px;
    font: 16px/1.5 system-ui, sans-serif;
    container-type: inline-size;
}
.m3dpl-inner { max-width: 1100px; margin: auto; }
.m3dpl-public h2, .m3dpl-public h3 { color: inherit; margin: 0; }
.m3dpl-intro { text-align: center; }
.m3dpl-intro h2 { font-size: clamp(25px, 4cqi, 42px); line-height: 1.18; font-weight: 800; }
.m3dpl-count { color: var(--accent); font-variant-numeric: tabular-nums; }
.m3dpl-intro p { white-space: pre-line; color: #ddd; margin: 14px 0 0; }
.m3dpl-search {
    display: flex; gap: 12px; align-items: center; margin: var(--above, 40px) auto var(--below, 28px);
    max-width: 540px; border: 1px solid #3b3b3b; border-radius: 12px; padding: 0 14px; background: #171717;
}
:is(.m3dpl-admin,.m3dpl-public) svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; display: inline-block; vertical-align: middle; }
.m3dpl-search svg, .m3dpl-group h4 svg { color: var(--accent); flex: none; }
.m3dpl-search input[type=search] { width: 100%; min-width: 0; border: 0; padding: 9px 0; color: #fff; background: transparent; font: inherit; box-shadow: none; }
.m3dpl-search input::placeholder { color: #bbb; }
.m3dpl-search:focus-within { outline: 2px solid var(--accent); }
.m3dpl-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid #555; }
.m3dpl-public button { text-transform: none; letter-spacing: normal; font: inherit; cursor: pointer; box-shadow: none; }
.m3dpl-tabs button { padding: 6px 14px; color: inherit; background: transparent; border: 1px solid transparent; border-radius: 7px; }
.m3dpl-tabs button[aria-pressed=true] { color: #121212; background: var(--accent); font-weight: 700; }
.m3dpl-group { padding: 16px 0 24px; border-bottom: 1px solid #555; }
.m3dpl-group h4 { display: flex; align-items: center; gap: 10px; font-size: 23px; margin-bottom: 12px; }
.m3dpl-group h4 svg { width: 25px; height: 25px; }
.m3dpl-grid { display: grid; grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr)); gap: 12px; }
.m3dpl-public .m3dpl-card {
    width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px;
    border: 1px solid #303030; border-radius: 9px; padding: 12px 14px;
    text-align: left; color: #ddd; background: #151515; transition: background .15s, border-color .15s;
}
.m3dpl-card strong { display: block; color: var(--accent); font: 700 1.2em/1.25 ui-monospace, monospace; overflow-wrap: anywhere; }
.m3dpl-desc { display: block; margin-top: 3px; font-size: .84em; white-space: pre-line; overflow-wrap: anywhere; }
.m3dpl-copy { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border: 1px solid #424242; border-radius: 8px; color: #bdbdbd; }
.m3dpl-copy svg { width: 24px; height: 24px; }
@media (hover: hover) {
    .m3dpl-public .m3dpl-card:hover { background: #202020; border-color: #565656; }
    .m3dpl-card:hover .m3dpl-copy { color: #fff; }
}
.m3dpl-public button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.m3dpl-card.m3dpl-copied { animation: m3dpl-pulse .45s ease-out; }
@keyframes m3dpl-pulse { from { background: #353535; border-color: #aaa; } }
.m3dpl-empty { color: #bbb; }
.m3dpl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@container (max-width: 780px) { .m3dpl-grid { grid-template-columns: repeat(min(var(--columns, 3), 2), minmax(0, 1fr)); } }
@container (max-width: 510px) { .m3dpl-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .m3dpl-public .m3dpl-card { transition: none; animation: none; } }

.m3dpl-admin { --border: #d8dce2; --paper: #fff; --orange: #bd4700; color: #15191e; max-width: 1500px; }
.m3dpl-admin h1 { font-weight: 760; font-size: 30px; line-height: 1.2; padding: 0; }
.m3dpl-admin h2 { margin: 0 0 12px; font-size: 17px; }
.m3dpl-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center; margin: 24px 0 12px; }
.m3dpl-head p { margin: 3px 0 0; font-size: 17px; color: #535b64; }
.m3dpl-notice { margin: 0; color: #186236; }
.m3dpl-notice:not(:empty) { margin: 8px 0; padding: 8px 12px; background: #fff; border-left: 3px solid currentColor; }
.m3dpl-notice.is-error { color: #a32622; }
.m3dpl-actions, .m3dpl-bulk { display: flex; gap: 8px; align-items: center; }
.m3dpl-admin button:not(.m3dpl-card):not(.m3dpl-tabs button), .m3dpl-admin .m3dpl-primary {
    border: 1px solid var(--border); border-radius: 7px; padding: 7px 12px; line-height: 1.4;
    color: #20242a; background: #fff; text-decoration: none; font-weight: 650; cursor: pointer;
}
.m3dpl-admin button.m3dpl-primary, .m3dpl-admin a.m3dpl-primary { background: var(--orange) !important; color: white !important; border-color: var(--orange) !important; }
.m3dpl-admin button[aria-pressed=true]:not(.m3dpl-tabs button) { color: #9a3600; border-color: #c4510a; background: #fff2e8; }
.m3dpl-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.m3dpl-panel { background: var(--paper); border: 1px solid var(--border); border-radius: 12px; padding: 18px; min-width: 0; }
.m3dpl-kpis strong { display: block; font-size: 32px; margin-top: 7px; line-height: 1; }
.m3dpl-dashboard, .m3dpl-custom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.m3dpl-custom { grid-template-columns: minmax(270px, .8fr) minmax(0, 1.2fr); align-items: start; }
.m3dpl-stack { display: grid; gap: 14px; align-content: start; }
.m3dpl-scroll { overflow: auto; }
.m3dpl-table { width: 100%; border-collapse: collapse; text-align: left; }
.m3dpl-table th { background: #edf0f3; font-weight: 700; }
.m3dpl-table :is(th,td) { padding: 9px 11px; border-bottom: 1px solid #e4e7eb; }
.m3dpl-dashboard td:last-child, .m3dpl-dashboard th:last-child { text-align: right; }
.m3dpl-meter { height: 14px; border-radius: 8px; overflow: hidden; background: #e4e7eb; }
.m3dpl-meter span { display: block; height: 100%; background: #e56d10; }
.m3dpl-admin-search { width: min(100%, 440px); }
.m3dpl-bulk { flex-wrap: wrap; padding: 10px; background: #fff0e4; border-radius: 8px; margin-bottom: 8px; }
.m3dpl-bulk[hidden] { display: none; }
.m3dpl-edit { min-width: 800px; background: #fff; border: 1px solid var(--border); }
.m3dpl-edit :is(th,td) { border-right: 1px solid #e4e7eb; }
.m3dpl-edit .is-selected { background: #fff0e4; }
.m3dpl-edit td:nth-child(2) { width: 19%; }
.m3dpl-edit td:nth-child(3) { width: 43%; }
.m3dpl-edit :is(textarea,input[type=text],input:not([type]),select) { width: 100%; border: 1px solid transparent; background-color: transparent; }
.m3dpl-edit :is(textarea,input,select):focus { border-color: #ac4f11; background-color: #fff; }
.m3dpl-edit textarea { resize: vertical; }
.m3dpl-prompt-input { display: flex; align-items: center; font-weight: bold; }
.m3dpl-admin .m3dpl-edit button.m3dpl-live { background: #e1f4e5; color: #205c34; border-color: #a7d2af; }
.m3dpl-footer, .m3dpl-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0; }
.m3dpl-custom form label { display: grid; gap: 4px; font-weight: 600; margin-bottom: 10px; }
.m3dpl-custom form textarea { width: 100%; }
.m3dpl-custom form .m3dpl-toggle { display: flex; align-items: center; gap: 8px; }
.m3dpl-custom form p { margin-top: -5px; color: #505a66; }
.m3dpl-preview { margin: auto; max-height: 720px; overflow: auto; border-radius: 10px; background: #070707; }
.m3dpl-preview.is-mobile { max-width: 390px; }
.m3dpl-preview-title { text-align: center; color: white; padding: 15px 10px 0; font-size: 24px; }
@media (max-width: 980px) {
    .m3dpl-dashboard, .m3dpl-custom { grid-template-columns: 1fr; }
    .m3dpl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Let the shortcode fill the page even inside a narrow theme content column. */
.m3dpl-public.m3dpl-page {
    --m3dpl-width: min(1140px, calc(100vw - 24px));
    width: var(--m3dpl-width);
    max-width: none;
    margin-inline: calc((100% - var(--m3dpl-width)) / 2);
    padding-block: clamp(40px, 5vw, 72px) 64px;
    border-image: linear-gradient(#070707, #070707) 0 fill / 0 / 0 100vmax;
    min-height: 380px;
}
body:has(.m3dpl-page) {
    background-color: #070707;
}
.m3dpl-page .m3dpl-intro h2 {
    color: #f3f3f3;
    font: 800 clamp(26px, 4vw, 42px)/1.18 system-ui, sans-serif;
    text-align: center;
}
.m3dpl-page .m3dpl-intro p { color: #ddd; text-align: center; }
.m3dpl-page .m3dpl-empty { text-align: center; margin-block: 24px 0; }

/* Redistribute the desktop gap around the intro on the public page. */
@media (min-width: 1024px) {
    .m3dpl-public.m3dpl-page {
        margin-block-start: calc(-1 * var(--m3dpl-intro-lift, 95px));
    }
    .m3dpl-page .m3dpl-intro {
        padding-block-end: var(--m3dpl-intro-gap, 95px);
    }
}


.m3dpl-preview:not(.is-mobile) .m3dpl-public {
    padding-block-start: calc(152px - var(--m3dpl-intro-lift, 95px));
}
.m3dpl-preview:not(.is-mobile) .m3dpl-intro {
    padding-block-end: var(--m3dpl-intro-gap, 95px);
}

.m3dpl-intro.has-background {
    position: relative;
    isolation: isolate;
    display: flow-root;
    padding-inline: clamp(12px, 3vw, 36px);
    padding-block-start: 30px;
}
.m3dpl-intro-background {
    position: absolute;
    inset: 0 0 var(--m3dpl-background-end, 0px);
    z-index: -1;
    overflow: hidden;
    border-radius: 12px;
    background: #161616;
    pointer-events: none;
}
.m3dpl-intro-background::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 58%);
}
.m3dpl-intro-background :is(img, video) {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
@media (min-width: 1024px) {
    .m3dpl-page .m3dpl-intro {
        --m3dpl-background-end: var(--m3dpl-intro-gap, 95px);
    }
}
.m3dpl-preview:not(.is-mobile) .m3dpl-intro {
    --m3dpl-background-end: var(--m3dpl-intro-gap, 95px);
}

.m3dpl-prompt-section + .m3dpl-prompt-section { margin-top: 32px; }
.m3dpl-public .m3dpl-prompt-section > h3 { margin: 24px 0 0; font-size: 26px; font-weight: 750; }
.m3dpl-public .m3dpl-group h4 { margin-top: 0; color: inherit; }
.m3dpl-card-wrap { position: relative; min-width: 0; }
.m3dpl-card-wrap .m3dpl-card { height: 100%; }
.m3dpl-card-wrap:has(.m3dpl-preview-toggle) .m3dpl-card { padding-inline-end: 56px; }
.m3dpl-public .m3dpl-preview-toggle {
    position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
    color: #ddd; background: #202020; border: 1px solid #4a4a4a; border-radius: 7px;
}
.m3dpl-comparison {
    position: fixed; top: 0; left: 0; z-index: 99999; width: min(460px, calc(100vw - 24px));
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
    pointer-events: none;
    padding: 10px; border: 1px solid #515151; border-radius: 10px;
    background: #181818; box-shadow: 0 12px 25px #0008;
}
.m3dpl-comparison[hidden] { display: none; }
.m3dpl-comparison figure { margin: 0; min-width: 0; }
.m3dpl-comparison img { display: block; width: 100%; max-height: min(38vh, 280px); aspect-ratio: 4 / 3; object-fit: contain; border-radius: 5px; }
.m3dpl-comparison figcaption { padding-top: 4px; text-align: center; font-size: .85em; }
.m3dpl-edit .m3dpl-full-toggle { display: block; margin-bottom: 6px; }
.m3dpl-edit td:nth-child(2) > label:not(.m3dpl-prompt-input) { display: block; margin-bottom: 6px; }
.m3dpl-edit input[type=url] { width: 100%; }

.m3dpl-types { margin-bottom: 10px; border-bottom: 0; }

/* Full-prompt cards: compact three-line preview while preserving full prompt data for copy. */
.m3dpl-card-content { display: block; flex: 1 1 auto; min-width: 0; }
.m3dpl-prompt-preview {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
    overflow: hidden; white-space: pre-line; overflow-wrap: anywhere;
    margin-top: 7px; color: #e2e2e2; font-size: .88em; line-height: 1.45;
}
.m3dpl-card-content .m3dpl-desc { margin-top: 7px; color: #a9a9a9; }
.m3dpl-result-preview {
    position: fixed; top: 0; left: 0; z-index: 99999; width: min(460px, calc(100vw - 24px));
    pointer-events: none; padding: 10px; border: 1px solid #515151; border-radius: 10px;
    background: #181818; box-shadow: 0 12px 25px #0008;
}
.m3dpl-result-preview[hidden] { display: none; }
.m3dpl-result-preview img { display: block; width: 100%; max-height: 320px; object-fit: contain; border-radius: 5px; }
.m3dpl-image-fields[hidden] { display: none !important; }
.m3dpl-image-fields label { display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px; }
.m3dpl-image-fields input[type=url] { flex: 1 1 220px; min-width: 0; }
.m3dpl-footer-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
