body.page-marketplace2-product {
    --m2p-bg: #f5f7f6;
    --m2p-panel: #fff;
    --m2p-panel-soft: #fafafa;
    --m2p-text: #021522;
    --m2p-muted: #64727b;
    --m2p-border: #b9c1c4;
    --m2p-border-soft: #d9dfe1;
    --m2p-accent: #08715e;
    --m2p-accent-hover: #075f50;
    --m2p-accent-soft: rgba(8, 113, 94, .08);
    background: var(--m2p-bg);
    color: var(--m2p-text);
}

body.dark.page-marketplace2-product {
    --m2p-bg: #0b1215;
    --m2p-panel: #111b1f;
    --m2p-panel-soft: #162226;
    --m2p-text: #edf5f3;
    --m2p-muted: #a1b2ae;
    --m2p-border: #40504d;
    --m2p-border-soft: #2d3b38;
    --m2p-accent: #22b79c;
    --m2p-accent-hover: #31c9ac;
    --m2p-accent-soft: rgba(34, 183, 156, .12);
}

.page-marketplace2-product .inner-page {
    padding-top: 0;
    padding-bottom: 70px;
    background: var(--m2p-bg);
}

.m2p-breadcrumbs {
    display: flex;
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
    padding: 20px 0 18px;
    align-items: center;
    gap: 9px;
    color: var(--m2p-muted);
    font: 500 13px/1.2 "Nimbus Sans D OT", Arial, sans-serif;
}

.m2p-breadcrumbs a {
    color: var(--m2p-accent);
    text-decoration: none;
}

.m2p-breadcrumbs a:hover,
.m2p-breadcrumbs a:focus-visible {
    text-decoration: underline;
}

.m2p-breadcrumbs strong {
    font-family: inherit;
    font-size: inherit;
    font-weight: 700;
    letter-spacing: inherit;
    max-width: 260px;
    overflow: hidden;
    color: var(--m2p-text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.m2p-shell {
    display: grid;
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
    grid-template-columns: minmax(0, 1.08fr) minmax(330px, .9fr) 300px;
    grid-template-areas:
        "gallery summary sidebar"
        "content content sidebar";
    align-items: start;
    gap: 24px 28px;
}

.m2p-gallery { grid-area: gallery; min-width: 0; }
.m2p-summary { grid-area: summary; min-width: 0; padding-top: 4px; }
.m2p-sidebar { display: grid; grid-area: sidebar; gap: 14px; }
.m2p-content { grid-area: content; min-width: 0; }

.m2p-gallery__main {
    display: grid;
    min-height: 430px;
    padding: 24px;
    overflow: hidden;
    place-items: center;
    border: 1px solid var(--m2p-border);
    border-radius: 10px;
    background:
        linear-gradient(rgba(8, 113, 94, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(8, 113, 94, .035) 1px, transparent 1px),
        #eef8f5;
    background-size: 18px 18px, 18px 18px, auto;
}

body.dark .m2p-gallery__main {
    background:
        linear-gradient(rgba(34, 183, 156, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 183, 156, .04) 1px, transparent 1px),
        #13201d;
    background-size: 18px 18px, 18px 18px, auto;
}

.m2p-gallery__main > img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    filter: drop-shadow(0 16px 22px rgba(2, 21, 34, .16));
}

.m2p-gallery__fallback {
    display: grid;
    min-height: 380px;
    place-items: center;
}

.m2p-gallery__fallback img { width: 110px; height: 110px; object-fit: contain; }
.m2p-gallery__fallback span { color: var(--m2p-accent); font: 700 96px/1 Arial, sans-serif; }

.m2p-gallery__thumbs,
.m2p-screenshots {
    display: flex;
    padding: 12px 0 2px;
    overflow-x: auto;
    gap: 12px;
}

.m2p-gallery__thumbs button,
.m2p-screenshots button {
    width: 104px;
    height: 74px;
    padding: 4px;
    flex: 0 0 auto;
    cursor: pointer;
    border: 1px solid var(--m2p-border);
    border-radius: 7px;
    background: var(--m2p-panel);
}

.m2p-gallery__thumbs button.is-active {
    border-color: var(--m2p-accent);
    box-shadow: 0 0 0 2px var(--m2p-accent-soft);
}

.m2p-gallery__thumbs img,
.m2p-screenshots img { width: 100%; height: 100%; object-fit: contain; }

.m2p-title { display: flex; align-items: flex-start; gap: 14px; }
.m2p-title > img { width: 48px; height: 48px; flex: 0 0 48px; object-fit: contain; border-radius: 9px; }
/* Match Marketplace: same catalog SVG mask + database color, larger presentation. */
.m2p-title__widget-icon {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    overflow: hidden;
    place-items: center;
    color: #f8f8f8;
    border-radius: 9px;
    background: #092f37;
}
.m2p-title__widget-icon > img { width: 32px; height: 32px; object-fit: contain; }
.m2p-title__widget-icon > i { font-size: 24px; }
.m2p-title__catalog-icon {
    display: block;
    width: 32px;
    height: 32px;
    background: var(--m2p-icon-color, #00a98f);
    -webkit-mask: var(--m2p-icon) center / contain no-repeat;
    mask: var(--m2p-icon) center / contain no-repeat;
}

.m2p-title h1 {
    margin: 0 0 6px;
    color: var(--m2p-text);
    font: 700 38px/1.05 "Nimbus Sans D OT", Arial, sans-serif;
    letter-spacing: -.03em;
}

.m2p-title p { margin: 0; color: var(--m2p-muted); font: 400 15px/1.4 "Nimbus Sans D OT", Arial, sans-serif; }

.m2p-tags { display: flex; margin: 14px 0 18px; flex-wrap: wrap; gap: 7px; }
/* Product tags use the same kind palette as the main Marketplace cards.
   class = violet, genre = blue, general = dark ink. */
.m2p-tags a {
    --m2p-tag-ink: #021522;
    --m2p-tag-tint: rgba(2, 21, 34, .06);
    --m2p-tag-shadow: rgba(2, 21, 34, .12);
    display: inline-flex;
    min-height: 29px;
    padding: 5px 9px;
    align-items: center;
    gap: 6px;
    color: var(--m2p-tag-ink);
    font: 700 11px/1 "Nimbus Sans D OT", Arial, sans-serif;
    text-decoration: none;
    border: 1px solid var(--m2p-tag-ink);
    border-radius: 5px;
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--m2p-tag-shadow);
    transition: background-color .15s ease;
}

.m2p-tags a.m2p-tag--class {
    --m2p-tag-ink: #9A39FF;
    --m2p-tag-tint: rgba(154, 57, 255, .08);
    --m2p-tag-shadow: rgba(154, 57, 255, .18);
}

.m2p-tags a.m2p-tag--genre {
    --m2p-tag-ink: #2836E0;
    --m2p-tag-tint: rgba(40, 54, 224, .08);
    --m2p-tag-shadow: rgba(40, 54, 224, .18);
}

.m2p-tags a i {
    color: var(--m2p-tag-ink);
    font-size: 13px;
}

.m2p-tags a:hover,
.m2p-tags a:focus-visible {
    border-color: var(--m2p-tag-ink);
    color: var(--m2p-tag-ink);
    background: var(--m2p-tag-tint);
}

.m2p-tags a:hover i,
.m2p-tags a:focus-visible i {
    color: var(--m2p-tag-ink);
}

/* Keep neutral badges legible on dark backgrounds. */
body.dark.page-marketplace2-product .m2p-tags a.m2p-tag--general {
    --m2p-tag-ink: #e2eeec;
    --m2p-tag-tint: rgba(226, 238, 236, .08);
    --m2p-tag-shadow: rgba(226, 238, 236, .15);
}

.m2p-facts {
    display: grid;
    margin: 18px 0 22px;
    color: var(--m2p-muted);
    font: 400 14px/1.35 "Nimbus Sans D OT", Arial, sans-serif;
    gap: 10px;
}
.m2p-facts > div { display: flex; align-items: center; gap: 10px; }
.m2p-facts strong { color: var(--m2p-text); }

.m2p-fact-icon {
    display: grid;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    place-items: center;
    color: var(--m2p-accent);
    border: 1px solid rgba(8, 113, 94, .22);
    border-radius: 6px;
    background: var(--m2p-accent-soft);
}

.m2p-purchase {
    margin-top: 22px;
    padding: 14px;
    border: 1px solid var(--m2p-border);
    border-radius: 10px;
    background: var(--m2p-panel);
}

.m2p-price { display: flex; margin-bottom: 12px; align-items: baseline; flex-wrap: wrap; gap: 12px; }
.m2p-price strong { color: var(--m2p-text); font: 800 31px/1 "Nimbus Sans D OT", Arial, sans-serif; }
.m2p-price span { color: var(--m2p-muted); font: 400 12px/1.2 "Nimbus Sans D OT", Arial, sans-serif; }
.m2p-cart { display: grid; gap: 8px; }

.m2p-cart select {
    width: 100%;
    min-height: 42px;
    padding: 0 10px;
    color: var(--m2p-text);
    border: 1px solid var(--m2p-border);
    border-radius: 6px;
    background: var(--m2p-panel);
}

.m2p-cart button,
.m2p-primary-button {
    display: inline-flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font: 800 13px/1 "Nimbus Sans D OT", Arial, sans-serif;
    text-decoration: none;
    border: 1px solid var(--m2p-accent);
    border-radius: 6px;
    background: var(--m2p-accent);
    gap: 8px;
}

.m2p-cart button:hover,
.m2p-cart button:focus-visible,
.m2p-primary-button:hover,
.m2p-primary-button:focus-visible {
    color: #fff;
    border-color: var(--m2p-accent-hover);
    background: var(--m2p-accent-hover);
}

.m2p-access-note { margin: 10px 0 0; color: var(--m2p-muted); font: 400 11px/1.4 "Nimbus Sans D OT", Arial, sans-serif; }

.m2p-card,
.m2p-content-card {
    border: 1px solid var(--m2p-border);
    border-radius: 10px;
    background: var(--m2p-panel);
}

.m2p-card { padding: 17px 18px; }
.m2p-card h2,
.m2p-content-card h2 { margin: 0 0 14px; color: var(--m2p-text); font: 800 17px/1.2 "Nimbus Sans D OT", Arial, sans-serif; }

.m2p-glance { margin: 0; }
.m2p-glance > div {
    display: grid;
    padding: 10px 0;
    grid-template-columns: minmax(94px, 43%) minmax(0, 1fr);
    align-items: center;
    border-bottom: 1px solid var(--m2p-border-soft);
    gap: 12px;
}
.m2p-glance > div:last-child { border-bottom: 0; }
.m2p-glance dt { min-width: 0; color: var(--m2p-muted); font: 500 12px/1.3 "Nimbus Sans D OT", Arial, sans-serif; overflow-wrap: normal; word-break: normal; }
.m2p-glance dd { min-width: 0; max-width: 100%; margin: 0; color: var(--m2p-text); font: 700 12px/1.3 "Nimbus Sans D OT", Arial, sans-serif; text-align: right; overflow-wrap: break-word; word-break: normal; }

.m2p-glance-value { display: flex; min-width: 0; max-width: 100%; justify-self: stretch; justify-content: flex-end; align-items: center; gap: 7px; }
.m2p-glance-value > span:last-child { min-width: 0; max-width: 100%; overflow-wrap: break-word; word-break: normal; }
.m2p-meta-icon {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    place-items: center;
    overflow: hidden;
    color: var(--m2p-accent);
    border: 1px solid var(--m2p-border-soft);
    border-radius: 5px;
    background: var(--m2p-panel-soft);
}
.m2p-meta-icon img { width: 20px; height: 20px; object-fit: contain; }

.m2p-check-list,
.m2p-requirements { display: grid; margin: 0; padding: 0; list-style: none; gap: 10px; }

.m2p-check-list li,
.m2p-requirements li { position: relative; color: var(--m2p-muted); font: 400 12px/1.42 "Nimbus Sans D OT", Arial, sans-serif; }
.m2p-check-list li { padding-left: 19px; }
.m2p-check-list li::before { position: absolute; left: 0; content: "✓"; color: var(--m2p-accent); font-weight: 800; }

.m2p-requirements > li:not(.m2p-version-requirement) { padding-left: 18px; }
.m2p-requirements > li:not(.m2p-version-requirement)::before {
    position: absolute;
    top: 5px;
    left: 1px;
    width: 7px;
    height: 7px;
    content: "";
    border-radius: 50%;
    background: var(--m2p-accent);
}

/* Versions must never dictate the width of the right-hand card. */
.m2p-shell > *,
.m2p-sidebar,
.m2p-sidebar > *,
.m2p-requirements,
.m2p-requirements > li {
    min-width: 0;
    max-width: 100%;
}

.m2p-sidebar {
    width: 100%;
}

.m2p-card {
    min-width: 0;
    overflow-wrap: anywhere;
}

.m2p-version-requirement {
    display: grid;
    min-width: 0;
    gap: 7px;
}

.m2p-versions__preview {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 6px;
}

.m2p-versions {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.m2p-versions > summary {
    display: flex;
    min-width: 0;
    padding: 7px 9px;
    align-items: center;
    gap: 7px;
    color: var(--m2p-accent);
    font: 700 12px/1.3 "Nimbus Sans D OT", Arial, sans-serif;
    cursor: pointer;
    list-style: none;
    border: 1px solid var(--m2p-border-soft);
    border-radius: 6px;
    background: var(--m2p-accent-soft);
}

.m2p-versions > summary::-webkit-details-marker {
    display: none;
}

/* Keep the disclosure label meaningful after expanding. */
.m2p-versions__hide,
.m2p-versions[open] .m2p-versions__show {
    display: none;
}

.m2p-versions[open] .m2p-versions__hide {
    display: inline;
}

.m2p-versions > summary span {
    min-width: 0;
    flex: 1 1 auto;
}

.m2p-versions > summary:hover,
.m2p-versions > summary:focus-visible {
    border-color: var(--m2p-accent);
    outline-offset: 2px;
}

.m2p-versions__chevron {
    flex: 0 0 auto;
    transition: transform .18s ease;
}

.m2p-versions[open] .m2p-versions__chevron {
    transform: rotate(180deg);
}

.m2p-versions__list {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    max-height: 240px;
    margin-top: 7px;
    padding: 9px;
    overflow-y: auto;
    overflow-x: hidden;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    border: 1px solid var(--m2p-border-soft);
    border-radius: 6px;
    background: var(--m2p-panel-soft);
}

.m2p-versions__item {
    display: inline-block;
    max-width: 100%;
    padding: 4px 6px;
    color: var(--m2p-text);
    font: 600 11px/1.3 "Nimbus Sans D OT", Arial, sans-serif;
    overflow-wrap: anywhere;
    border: 1px solid var(--m2p-border-soft);
    border-radius: 4px;
    background: var(--m2p-panel);
}

.m2p-author { display: flex; align-items: center; gap: 10px; }
.m2p-author__logo {
    display: grid;
    width: 38px;
    height: 38px;
    overflow: hidden;
    place-items: center;
    border: 1px solid var(--m2p-border-soft);
    border-radius: 8px;
    background: #061319;
}
.m2p-author__logo img { width: 31px; height: 31px; object-fit: contain; }
.m2p-author strong { color: var(--m2p-text); font: 700 13px/1.2 "Nimbus Sans D OT", Arial, sans-serif; }

.m2p-content-card { padding: 20px; }
.m2p-description { color: var(--m2p-muted); font: 400 14px/1.55 "Nimbus Sans D OT", Arial, sans-serif; }
.m2p-description p { margin: 0 0 10px; }
.m2p-content-card hr { margin: 22px 0; border: 0; border-top: 1px solid var(--m2p-border-soft); }

.m2p-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.m2p-step { position: relative; min-width: 0; text-align: center; }
.m2p-step:not(:last-child)::after {
    position: absolute;
    top: 37px;
    right: -19px;
    width: 14px;
    color: var(--m2p-accent);
    content: "→";
    font: 800 22px/1 Arial, sans-serif;
}
.m2p-step__number {
    position: absolute;
    top: -3px;
    left: calc(50% + 22px);
    z-index: 2;
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
    color: #fff;
    font: 800 11px/1 Arial, sans-serif;
    border: 2px solid var(--m2p-panel);
    border-radius: 50%;
    background: var(--m2p-accent);
}
.m2p-step__icon {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    place-items: center;
    overflow: hidden;
    color: var(--m2p-accent);
    font-size: 24px;
    border: 1px solid rgba(8, 113, 94, .24);
    border-radius: 50%;
    background: var(--m2p-accent-soft);
}
.m2p-step__icon img { width: 38px; height: 38px; object-fit: contain; }
.m2p-step strong { display: block; color: var(--m2p-text); font: 800 12px/1.3 "Nimbus Sans D OT", Arial, sans-serif; }
.m2p-step p { margin: 6px 0 0; color: var(--m2p-muted); font: 400 11px/1.4 "Nimbus Sans D OT", Arial, sans-serif; }

.m2p-screenshots button { width: 220px; height: 160px; }
.m2p-controls { display: flex; flex-wrap: wrap; gap: 7px; }
.m2p-controls span {
    padding: 7px 10px;
    color: var(--m2p-text);
    font: 600 11px/1 "Nimbus Sans D OT", Arial, sans-serif;
    border: 1px solid var(--m2p-border);
    border-radius: 5px;
    background: var(--m2p-panel-soft);
}

@media (max-width: 1180px) {
    .m2p-shell {
        grid-template-columns: minmax(0, 1fr) minmax(330px, .8fr);
        grid-template-areas:
            "gallery summary"
            "sidebar sidebar"
            "content content";
    }
    .m2p-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .m2p-breadcrumbs,
    .m2p-shell { width: calc(100% - 24px); }
    .m2p-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "gallery"
            "summary"
            "sidebar"
            "content";
        gap: 18px;
    }
    .m2p-sidebar { grid-template-columns: 1fr; }
    .m2p-gallery__main { min-height: 300px; padding: 14px; }
    .m2p-title h1 { font-size: 30px; }
    .m2p-glance > div { grid-template-columns: minmax(94px, 43%) minmax(0, 1fr); }
    .m2p-steps { grid-template-columns: 1fr; gap: 18px; }
    .m2p-step:not(:last-child)::after {
        top: auto;
        right: 50%;
        bottom: -17px;
        width: auto;
        content: "↓";
        transform: translateX(50%);
    }
}

/* #10118: App metadata lives in the right panel; keep its icon and value together. */
.page-marketplace2-product .m2p-glance-value {
    display: inline-flex;
    width: 100%;
    max-width: 100%;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    text-align: right;
}
.page-marketplace2-product .m2p-glance-value > span:last-child,
.page-marketplace2-product .m2p-glance-value__link {
    min-width: 0;
    overflow-wrap: anywhere;
}
.page-marketplace2-product .m2p-glance-value__link {
    color: inherit;
    font: inherit;
    text-decoration: none;
}
.page-marketplace2-product .m2p-glance-value__link:hover,
.page-marketplace2-product .m2p-glance-value__link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.page-marketplace2-product .m2p-glance-value--class .m2p-meta-icon { color: #9a39ff; }
.page-marketplace2-product .m2p-glance-value--genre .m2p-meta-icon { color: #2836e0; }

/* The complete version list is a single-column, scrollable popover.
   It floats above following cards instead of changing the page/column height. */
.page-marketplace2-product .m2p-versions {
    position: relative;
}
.page-marketplace2-product .m2p-card:has(.m2p-versions[open]) {
    position: relative;
    z-index: 5;
}
.page-marketplace2-product .m2p-versions__list {
    position: absolute;
    z-index: 6;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    display: grid;
    width: 100%;
    max-width: 100%;
    max-height: min(320px, 50svh);
    margin: 0;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    overflow-y: auto;
    overflow-x: hidden;
    flex-wrap: nowrap;
    gap: 4px;
    border-color: var(--m2p-border);
    background: var(--m2p-panel);
    box-shadow: 0 14px 32px rgba(2, 21, 34, .15);
    overscroll-behavior: contain;
}
.page-marketplace2-product .m2p-versions__item {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
}

/* Keep the application icon and name on one line when the desktop sidebar is narrow. */
.page-marketplace2-product .m2p-glance > div {
    grid-template-columns: minmax(86px, 37%) minmax(0, 1fr);
    gap: 8px;
}
