/* StoryLens static reference, scoped to marketplace only to avoid affecting profile/admin. */
.market-page{--mk-a:#7c5cff;--mk-b:#22d3ee;--mk-muted:#a6b2c7;--mk-border:rgba(255,255,255,.13);max-width:1200px;margin:0 auto;padding:12px 20px 65px;color:#eef2ff;font-family:Inter,system-ui,sans-serif}
.market-page *{box-sizing:border-box}.market-page a{color:inherit;text-decoration:none}.market-brand{height:138px;display:flex;align-items:center}.market-brand img{max-width:370px;width:100%;height:117px;object-fit:contain;object-position:left center}.market-hero{display:flex;justify-content:space-between;align-items:center;gap:20px;min-height:112px;padding:16px 22px;border:1px solid var(--mk-border);border-radius:24px;background:radial-gradient(ellipse at 80% 5%,rgba(34,211,238,.16),transparent 50%),linear-gradient(180deg,rgba(255,255,255,.12),rgba(255,255,255,.06));box-shadow:0 10px 32px rgba(2,6,23,.35)}
.market-hero h1{margin:0 0 4px;font-size:clamp(25px,3.5vw,42px);line-height:1.2;font-weight:800;letter-spacing:-.035em}.market-hero p{margin:0;color:#d1d5db;font-size:14px}.market-actions{display:flex;gap:8px}.market-iconbtn{cursor:pointer;width:52px;height:42px;border-radius:12px;border:1px solid rgba(148,163,184,.25);background:rgba(255,255,255,.06);display:grid;place-items:center;color:#b9c5da}.market-iconbtn svg{width:19px;height:19px}.market-iconbtn.active{background:linear-gradient(105deg,var(--mk-a),var(--mk-b));color:#0b1020;border-color:transparent}.market-iconbtn:disabled{opacity:.55;cursor:not-allowed}.market-categories{display:flex;flex-wrap:wrap;gap:9px;margin:20px 0;justify-content:center}.market-chip{display:inline-flex;align-items:center;gap:7px;padding:7px 13px;border:1px solid #28334e;border-radius:999px;background:#11182a;font-size:12px;white-space:nowrap;font-weight:650}.market-chip:hover{border-color:#6c80c4}.market-chip.selected{color:#071524;background:linear-gradient(90deg,#7c5cff,#22d3ee);border-color:transparent}.market-count{background:rgba(148,163,184,.18);border-radius:999px;padding:1px 8px;font-size:11px}.market-dot{display:inline-block;width:8px;height:8px;background:#35bdee;border-radius:50%}.market-authors{display:flex;gap:18px;align-items:flex-start;overflow-x:auto;padding:6px 1px 14px;margin:0 0 8px;scrollbar-width:thin}.market-author{flex:0 0 88px;display:flex;flex-direction:column;align-items:center;gap:7px;min-width:0;border:0;background:none;color:#cad3e6;font:500 11px Inter,system-ui;cursor:pointer}.market-author>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:95px}.market-avatar{display:grid;place-items:center;width:66px;height:66px;border-radius:50%;border:2px solid #354665;background:linear-gradient(140deg,#1d2a4c,#283b60);color:#bcd6ff;font-weight:800;font-size:18px;box-shadow:0 6px 20px #040918}.market-author.selected .market-avatar{background:linear-gradient(130deg,var(--mk-a),var(--mk-b));border-color:#8d7dff;color:#091323;box-shadow:0 0 0 3px rgba(124,92,255,.20)}.market-avatar-all{font-size:12px}.market-controls{display:grid;grid-template-columns:minmax(180px,1fr) 220px 220px;gap:10px;margin:10px 0 18px}.market-controls input,.market-controls select{height:46px;width:100%;border-radius:12px;background-color:#11192c;border:1px solid #2b395a;color:#e6eeff;padding:0 16px;font:500 13px Inter,system-ui;outline:none}.market-controls select{appearance:none;padding-right:41px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%23b6c7e9' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-position:right 14px center;background-repeat:no-repeat;background-size:14px}.market-controls input:focus,.market-controls select:focus{border-color:#7b9fff;box-shadow:0 0 0 3px rgba(87,139,255,.15)}.market-controls input::placeholder{color:#8c9bb6}
.market-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;align-items:stretch}.market-card{min-width:0;display:flex;flex-direction:column;overflow:hidden;background:linear-gradient(180deg,#1d2436,#141b2d);border:1px solid rgba(162,177,213,.15);border-radius:20px;box-shadow:0 8px 25px rgba(0,0,0,.22)}.market-card[hidden]{display:none!important}.market-card-media{position:relative;display:block;aspect-ratio:16/10;overflow:hidden;background:linear-gradient(135deg,#1a2c48,#304169)}.market-card-media img{width:100%;height:100%;display:block;object-fit:cover;transition:transform .2s}.market-card:hover img{transform:scale(1.035)}.market-category-label{position:absolute;top:10px;right:10px;padding:4px 9px;background:rgba(255,255,255,.91);color:#172039;border-radius:999px;font-size:10px;font-weight:700}.market-card-body{display:flex;flex:1;flex-direction:column;padding:14px;gap:9px}.market-card-body h2{font-size:15px;line-height:1.35;font-weight:800;min-height:2.7em;max-height:2.7em;overflow:hidden;margin:0}.market-card-desc{font-size:12px;line-height:1.5;color:#c7d0e0;min-height:3em;max-height:3em;overflow:hidden;margin:0}.market-meta{display:flex;gap:6px;flex-wrap:wrap;font-size:10px;color:#98a8c8}.market-card-tags{display:flex;gap:5px;flex-wrap:wrap;min-height:26px}.market-card-tags span{font-size:10px;border:1px solid rgba(176,189,218,.15);background:rgba(255,255,255,.07);border-radius:7px;padding:4px 7px}.market-card-footer{margin-top:auto;padding-top:12px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}.market-cta{flex:1;text-align:center;background:linear-gradient(100deg,var(--mk-a),var(--mk-b));padding:11px 12px;border-radius:9px;color:#091427!important;font-size:12px;font-weight:800}.market-edit{font-size:11px;text-decoration:underline!important;color:#b4cbff!important}.market-empty{text-align:center;padding:35px;color:#aebbd4}.market-cards.is-list{grid-template-columns:1fr}.market-cards.is-list .market-card{flex-direction:row;min-height:185px}.market-cards.is-list .market-card-media{flex:0 0 260px;aspect-ratio:auto}.market-cards.is-list .market-card-body h2,.market-cards.is-list .market-card-desc{min-height:0}
@media(max-width:1050px){.market-cards{grid-template-columns:repeat(3,minmax(0,1fr))}.market-controls{grid-template-columns:1fr 170px 170px}}@media(max-width:720px){.market-cards{grid-template-columns:repeat(2,minmax(0,1fr))}.market-hero{align-items:flex-start;flex-direction:column}.market-controls{grid-template-columns:1fr 1fr}.market-controls input{grid-column:1/-1}.market-brand{height:100px}.market-brand img{height:85px;max-width:290px}.market-cards.is-list .market-card-media{flex-basis:150px}}@media(max-width:480px){.market-page{padding:8px 14px 30px}.market-cards{grid-template-columns:1fr}.market-hero h1{font-size:27px}.market-hero{border-radius:18px}.market-cards.is-list .market-card{flex-direction:column}.market-cards.is-list .market-card-media{aspect-ratio:16/10}.market-controls{grid-template-columns:1fr}.market-controls input{grid-column:auto}}

/* Category chips fill the same container width as the hero on desktop. */
.market-page .market-categories {
    display: flex;
    width: 100%;
    flex-wrap: nowrap;
    justify-content: stretch;
    gap: 9px;
}
.market-page .market-categories > .market-chip {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding-inline: 9px;
}
@media (max-width: 920px) {
    .market-page .market-categories {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 7px;
        scrollbar-width: thin;
    }
    .market-page .market-categories > .market-chip {
        flex: 0 0 auto;
        padding-inline: 13px;
    }
}

/* Marketplace article details: match static HTML layout */
.market-authors{display:grid;grid-template-columns:repeat(var(--market-author-count,6),minmax(0,1fr));gap:8px;width:100%;overflow:visible;margin-bottom:14px}
.market-author{width:100%;min-width:0;flex:none;text-align:center;margin:0 auto;justify-self:center}
.market-author>span:last-child{max-width:100%;white-space:normal;line-height:1.3}
.market-card{border-radius:20px;background:linear-gradient(180deg,#262a36,#161a29)}
.market-card-media{aspect-ratio: 16 / 10}
.market-card-body{padding:16px;gap:9px}
.market-card-body h2{font-size:17px;line-height:1.25;min-height:2.5em;max-height:2.5em;letter-spacing:-.025em}
.market-card-desc{font-size:14px;line-height:1.48;min-height:3em;max-height:3em}
.market-meta{font-size:11px;color:#a8b6d2}
.market-card-tags{min-height:32px;align-content:start}
.market-card-tags span{font-size:12px;padding:6px 9px;border-radius:9px}
.market-featured{position:absolute;left:10px;top:10px;padding:6px 10px;border-radius:999px;background:linear-gradient(100deg,#8358f8,#25c2ef);color:#0a1122;font-weight:800;font-size:11px}
.market-price-row{display:flex;justify-content:space-between;align-items:center;gap:10px;min-height:30px;margin-top:4px}
.market-price-row strong{font-size:18px;font-weight:850;color:#f0f4ff}
.market-premium{border-radius:9px;background:linear-gradient(120deg,#fce89d,#e8b74f);box-shadow:0 0 18px rgba(248,194,75,.16);color:#3c2a0a;padding:6px 10px;font-size:11px;font-weight:800}
.market-card-footer{margin-top:auto;padding-top:14px}
.market-cta{min-height:42px;display:flex;align-items:center;justify-content:center;font-size:13px}
.market-admin-flags{display:flex;gap:14px;flex-wrap:wrap;margin:14px 0 20px}
.market-admin-flags label{display:flex;gap:10px;align-items:center;border:1px solid #344363;border-radius:12px;padding:12px 16px;color:#eaf2ff;cursor:pointer}
.market-admin-flags input{accent-color:#7966f9;width:18px;height:18px}
@media(max-width:700px){.market-authors{display:flex;overflow-x:auto;gap:14px}.market-author{flex:0 0 88px}.market-card-body h2{font-size:16px}.market-card-desc{font-size:13px}}

/* Marketplace category filters: use the original static HTML visual design,
   independent of global button styling and support multiple selected chips. */
.market-page .market-categories {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    gap: 12px;
    align-items: stretch;
    justify-content: space-between;
    margin: 20px 0 14px;
}
.market-page .market-categories > button.market-chip {
    box-sizing: border-box;
    display: inline-flex;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    min-height: 40px;
    padding: 7px 12px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid #34405a;
    border-radius: 999px;
    background: linear-gradient(180deg, #202638 0%, #1a2030 100%);
    box-shadow: none;
    color: #f1f5ff;
    font: 600 12px/1.2 Inter, system-ui, sans-serif;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .16s, background .16s, box-shadow .16s;
}
.market-page .market-categories > button.market-chip:hover:not(.selected) {
    border-color: #7689b8;
    background: #252e44;
    color: #fff;
}
.market-page .market-categories > button.market-chip.selected,
.market-page .market-categories > button.market-chip[aria-pressed="true"] {
    border-color: transparent;
    background: linear-gradient(105deg, #7955fa 0%, #23c4e9 100%);
    box-shadow: none;
    color: #071524;
}
.market-page .market-categories > button.market-chip.selected:hover {
    background: linear-gradient(105deg, #8b66ff 0%, #32d4f2 100%);
    color: #071524;
}
.market-page .market-categories > button.market-chip:focus-visible {
    outline: 2px solid #a6c9ff;
    outline-offset: 3px;
}
.market-page .market-categories .market-count {
    display: inline-flex;
    min-width: 23px;
    justify-content: center;
    border-radius: 999px;
    padding: 3px 7px;
    background: rgba(151, 163, 188, .20);
    color: inherit;
    font-size: 11px;
    line-height: 1;
}
.market-page .market-categories .market-dot { flex: 0 0 9px; height: 9px; border-radius: 50%; }
@media (max-width: 960px) {
    .market-page .market-categories {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 7px;
        scrollbar-width: thin;
    }
    .market-page .market-categories > button.market-chip {
        flex: 0 0 auto;
        padding-inline: 16px;
    }
}

/* Keep each color dot inside its own category pill. Distribute according to
   content width rather than forcing equal-width pills that overflow. */
.market-page .market-categories > button.market-chip {
    flex: 1 0 auto;
    min-width: max-content;
    overflow: hidden;
    gap: 8px;
}
.market-page .market-categories > button.market-chip > .market-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    min-width: 9px;
    flex: 0 0 9px;
    margin: 0;
    position: static;
}
.market-page .market-categories > button.market-chip > .market-count {
    flex: 0 0 auto;
}
@media (max-width: 1200px) {
    .market-page .market-categories {
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: thin;
    }
}

/* Stable category pills: dot, icon and label never overlap. */
.market-page .market-categories { display:flex; flex-wrap:nowrap; width:100%; gap:12px; align-items:center; justify-content:space-between; overflow-x:auto; padding:2px 0 5px; }
.market-page .market-categories > button.market-chip { position:relative; flex:1 1 0; min-width:max-content; display:flex; align-items:center; justify-content:center; gap:8px; padding:9px 13px; overflow:visible; text-decoration:none; }
.market-page .market-categories > button.market-chip > .market-dot { position:static!important; display:block!important; flex:0 0 9px!important; width:9px!important; min-width:9px!important; height:9px!important; margin:0!important; border-radius:50%; background-image:none!important; box-shadow:none!important; }
.market-page .market-categories .market-chip-label { display:inline-flex; align-items:center; justify-content:center; gap:4px; min-width:0; white-space:nowrap; }
.market-page .market-categories .market-chip-emoji { display:inline-block; flex-shrink:0; line-height:1; }
.market-page .market-categories .market-count { flex:0 0 auto; }
@media(max-width:1200px){.market-page .market-categories { justify-content:flex-start; }.market-page .market-categories>button.market-chip { flex:1 0 auto; }}


/* Category contrast: strictly scoped to the marketplace, overriding global button styles. */
.market-page .market-categories > button.market-chip:not(.selected):not([aria-pressed="true"]) {
    color: #f4f7ff !important;
    background: linear-gradient(180deg, #202638, #1a2030) !important;
    border-color: #35425f !important;
    opacity: 1 !important;
}
.market-page .market-categories > button.market-chip:not(.selected):not([aria-pressed="true"]):hover {
    background: #263047 !important;
}
.market-page .market-categories > button.market-chip.selected,
.market-page .market-categories > button.market-chip[aria-pressed="true"] {
    color: #071524 !important;
    background: linear-gradient(105deg, #7955fa, #23c4e9) !important;
    border-color: transparent !important;
    opacity: 1 !important;
}
.market-page .market-categories > button.market-chip .market-count {
    color: #eaf2ff;
    background: rgba(151,163,188,.22);
}
.market-page .market-categories > button.market-chip.selected .market-count,
.market-page .market-categories > button.market-chip[aria-pressed="true"] .market-count {
    color: #081426;
    background: rgba(8,20,38,.12);
}
.market-page .market-categories > button.market-chip .market-chip-label,
.market-page .market-categories > button.market-chip .market-chip-emoji {
    color: inherit;
    opacity: 1 !important;
}

/* Symbol-only glow. The PNG is transparent: no rectangular background under the logo. */
.market-page .market-brand > a {
    position: relative;
    display: inline-flex;
    align-items: center;
    isolation: isolate;
    background: transparent !important;
}
.market-page .market-brand > a > img {
    position: relative;
    z-index: 1;
    transform: translateY(-20px);
    background: transparent;
}
.market-page .market-brand > a::before {
    content: "";
    position: absolute;
    z-index: 0;
    left: 5px;
    top: calc(50% - 20px);
    width: 96px;
    height: 96px;
    border-radius: 50%;
    pointer-events: none;
    transform: translateY(-50%);
    background: radial-gradient(circle at 30% 35%,rgba(163,76,255,.52),transparent 64%),
                radial-gradient(circle at 73% 72%,rgba(14,211,239,.52),transparent 64%);
    filter: blur(13px);
    animation: sl-symbol-glow 4.8s ease-in-out infinite;
}
.market-page .market-brand > a:hover::before { filter: blur(15px); opacity: .95; }
@keyframes sl-symbol-glow {
    0%,100% { opacity: .46; transform: translateY(-50%) scale(.96); }
    50% { opacity: .8; transform: translateY(-50%) scale(1.04); }
}
@media(max-width:720px) {
    .market-page .market-brand > a::before { width: 75px; height: 75px; left: 4px; filter: blur(11px); }
}
@media(prefers-reduced-motion:reduce) {
    .market-page .market-brand > a::before { animation: none; opacity: .55; }
}

/* StoryLens responsive marketplace: phones and small tablets.
   Desktop layout/filter logic is intentionally unchanged. */
.market-page { min-width: 0; }
.market-page .market-hero > div:first-child { min-width: 0; }
.market-page .market-card-body, .market-page .market-meta { min-width: 0; }

@media (max-width: 760px) {
    .market-page {
        width: 100%;
        max-width: 100%;
        padding: 0 14px 40px;
        overflow-x: clip;
    }
    .market-page .market-brand {
        height: auto;
        min-height: 105px;
        padding: 8px 0 14px;
        align-items: center;
    }
    .market-page .market-brand > a { max-width: min(100%, 318px); }
    .market-page .market-brand img {
        display: block;
        width: 100%;
        max-width: 318px;
        height: auto;
        max-height: 90px;
        object-fit: contain;
        object-position: left center;
    }
    /* On desktop the mark is pulled up 20px; reset this on a narrow screen. */
    .market-page .market-brand > a > img { transform: none; }
    .market-page .market-brand > a::before {
        top: 50%;
        left: 4px;
        width: 73px;
        height: 73px;
    }
    .market-page .market-hero {
        min-height: 0;
        padding: 20px 20px 18px;
        border-radius: 20px;
        gap: 17px;
        flex-direction: column;
        align-items: stretch;
    }
    .market-page .market-hero h1 {
        font-size: clamp(26px, 7vw, 34px);
        line-height: 1.12;
        overflow-wrap: normal;
    }
    .market-page .market-hero p { line-height: 1.5; font-size: 13px; }
    .market-page .market-actions { justify-content: flex-start; gap: 9px; }
    .market-page .market-iconbtn { width: 48px; min-width: 48px; height: 43px; }

    /* Native horizontal swipe is maintained, but without intrusive scrollbars. */
    .market-page .market-categories {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 9px;
        padding: 15px 1px 9px;
        margin: 0 0 8px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .market-page .market-categories::-webkit-scrollbar { display: none; }
    .market-page .market-categories > button.market-chip {
        flex: 0 0 auto;
        min-width: max-content;
        min-height: 39px;
        padding: 9px 13px;
        gap: 7px;
        font-size: 12px;
        scroll-snap-align: start;
    }
    .market-page .market-categories > button.market-chip > .market-dot {
        position: static !important;
        flex: 0 0 9px !important;
        margin: 0 !important;
    }
    .market-page .market-categories .market-count { flex: 0 0 auto; }

    .market-page .market-authors {
        display: flex;
        width: 100%;
        flex-wrap: nowrap;
        gap: 12px;
        padding: 7px 1px 15px;
        margin: 0 0 10px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }
    .market-page .market-authors::-webkit-scrollbar { display: none; }
    .market-page .market-author {
        flex: 0 0 78px;
        width: 78px;
        min-width: 78px;
        gap: 7px;
        scroll-snap-align: start;
    }
    .market-page .market-avatar { width: 60px; height: 60px; font-size: 16px; }
    .market-page .market-avatar-all { font-size: 12px; }
    .market-page .market-author > span:last-child {
        display: -webkit-box;
        max-width: 78px;
        overflow: hidden;
        white-space: normal;
        text-overflow: ellipsis;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-height: 1.3;
        min-height: 2.6em;
        font-size: 11px;
    }

    .market-page .market-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 10px;
        margin: 0 0 17px;
    }
    .market-page .market-controls input {
        grid-column: 1 / -1;
        min-width: 0;
    }
    .market-page .market-controls select {
        min-width: 0;
        padding: 0 36px 0 12px;
    }
    .market-page .market-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 13px;
    }
    .market-page .market-cards.is-list .market-card-media { flex-basis: 160px; }
}

@media (max-width: 560px) {
    .market-page .market-controls { grid-template-columns: 1fr; }
    .market-page .market-controls input { grid-column: auto; }
    .market-page .market-cards, .market-page .market-cards.is-list { grid-template-columns: 1fr; }
    .market-page .market-card,
    .market-page .market-cards.is-list .market-card { flex-direction: column; }
    .market-page .market-card-media,
    .market-page .market-cards.is-list .market-card-media {
        width: 100%;
        flex-basis: auto;
        aspect-ratio: 16 / 10;
    }
    .market-page .market-card-body { padding: 17px; gap: 10px; }
    .market-page .market-card-body h2 { font-size: 17px; }
    .market-page .market-card-desc { font-size: 14px; }
    .market-page .market-card-footer { margin-top: auto; }
    .market-page .market-cta { min-height: 45px; }
}

@media (max-width: 370px) {
    .market-page { padding-inline: 11px; }
    .market-page .market-hero { padding-inline: 17px; }
    .market-page .market-hero h1 { font-size: 25px; }
    .market-page .market-brand > a { max-width: 270px; }
    .market-page .market-brand > a::before { width: 65px; height: 65px; }
}

/* Author portrait containment: required at ALL viewport widths.
   Profile images must never overflow their circular avatar or the author row. */
.market-page .market-authors .market-avatar {
    position: relative;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 66px;
    height: 66px;
    min-width: 66px;
    min-height: 66px;
    max-width: 66px;
    max-height: 66px;
    border-radius: 50%;
    overflow: hidden;
}
.market-page .market-authors .market-avatar > img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
}
.market-page .market-authors .market-avatar > img[hidden],
.market-page .market-authors .market-avatar-fallback[hidden] {
    display: none !important;
}
.market-page .market-authors .market-avatar-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
}
.market-page .market-authors .market-author {
    overflow: hidden;
}

/* These overrides are strictly mobile-only; desktop sizing remains unchanged. */
@media (max-width: 760px) {
    .market-page .market-authors .market-avatar {
        width: 60px;
        height: 60px;
        min-width: 60px;
        min-height: 60px;
        max-width: 60px;
        max-height: 60px;
    }
}

/* Search and sort only: category selection is handled by the category chips. */
.market-page .market-controls {
    grid-template-columns: minmax(0, 1fr) 220px;
}
.market-page .market-controls > #market-search { min-width: 0; }
.market-page .market-controls > #market-sort { min-width: 0; }
@media (max-width: 720px) {
    .market-page .market-controls { grid-template-columns: minmax(0,1fr); }
    .market-page .market-controls > #market-search,
    .market-page .market-controls > #market-sort { grid-column: auto; width: 100%; }
}

/* Premium badge: match reference image 2 without changing the card layout. */
.market-page .market-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 29px;
    min-width: 76px;
    padding: 7px 13px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.1;
    font-weight: 800;
    white-space: nowrap;
}

/* Expanded list layout: one full-width, vertically stacked article per row.
   The grid view and its responsive breakpoints are deliberately untouched. */
.market-page #market-results.market-cards.is-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}
.market-page #market-results.market-cards.is-list > .market-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    min-height: 0;
}
.market-page #market-results.market-cards.is-list .market-card-media {
    display: block;
    width: 100%;
    flex: none;
    aspect-ratio: 4 / 3;
    min-width: 0;
    overflow: hidden;
}
.market-page #market-results.market-cards.is-list .market-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.market-page #market-results.market-cards.is-list .market-card-body {
    width: 100%;
    min-width: 0;
    padding: 20px 18px 22px;
    gap: 13px;
}
.market-page #market-results.market-cards.is-list .market-card-body h2 {
    min-height: 0;
    max-height: none;
    font-size: clamp(17px, 2vw, 22px);
}
.market-page #market-results.market-cards.is-list .market-card-desc {
    min-height: 0;
    max-height: none;
    font-size: 14px;
}
.market-page #market-results.market-cards.is-list .market-card-tags {
    min-height: 0;
}
.market-page #market-results.market-cards.is-list .market-card-footer {
    width: 100%;
}
.market-page #market-results.market-cards.is-list .market-cta {
    min-height: 46px;
}
@media (max-width: 720px) {
    .market-page #market-results.market-cards.is-list .market-card-media {
        aspect-ratio: 16 / 10;
    }
    .market-page #market-results.market-cards.is-list .market-card-body {
        padding: 16px;
    }
}


.market-card{cursor:pointer;position:relative}
.market-card:focus-visible{outline:2px solid #8bc2ff;outline-offset:4px}
.market-card-body h2 a,.market-card-media,.market-edit{text-decoration:none!important}
.market-cart-button{position:relative;overflow:visible}
.market-cart-button.has-items{background:linear-gradient(105deg,var(--mk-a),var(--mk-b));color:#0b1020;border-color:transparent;box-shadow:0 12px 24px rgba(92,80,255,.22)}
.market-cart-badge{position:absolute;top:-7px;right:-7px;min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:#f8fafc;color:#0f172a;border:2px solid #0f172a;display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:800;box-shadow:0 8px 18px rgba(0,0,0,.32)}
.market-add-to-cart{border:0;cursor:pointer}
.market-add-to-cart.is-added{filter:brightness(1.04)}
.market-fly-ghost{position:fixed;z-index:9999;pointer-events:none;overflow:hidden;border-radius:18px;box-shadow:0 18px 40px rgba(0,0,0,.3),0 0 0 1px rgba(255,255,255,.18) inset;transform-origin:top left}
.market-fly-ghost img{width:100%;height:100%;display:block;object-fit:cover}
.market-cart-bump{animation:market-cart-bump .34s ease}
.market-cart-pop{animation:market-cart-pop .34s ease}
@keyframes market-cart-bump{0%{transform:scale(1)}45%{transform:scale(1.1)}100%{transform:scale(1)}}
@keyframes market-cart-pop{0%{transform:scale(1)}50%{transform:scale(1.18)}100%{transform:scale(1)}}

/* StoryLens custom sort dropdown: colored Featured and Premium items on Windows/Edge. */
.market-controls .market-sort-wrap{position:relative;min-width:0;width:100%}
.market-controls .market-sort-native{position:absolute!important;inset:0!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;padding:0!important;margin:0!important}
.market-controls .market-sort-trigger{width:100%;height:46px;display:flex;align-items:center;justify-content:space-between;text-align:left;gap:12px;padding:0 15px;border-radius:12px;background:#11192c;border:1px solid #2b395a;color:#e6eeff;font:600 13px Inter,system-ui,sans-serif;cursor:pointer}
.market-controls .market-sort-trigger:focus-visible,.market-controls .market-sort-wrap.is-open .market-sort-trigger{outline:2px solid #7baeff;outline-offset:2px;border-color:#749cf8}
.market-controls .market-sort-trigger.is-featured{color:#38bdf8}
.market-controls .market-sort-trigger.is-premium{color:#f7cf72}
.market-sort-chevron{display:block;flex:0 0 10px;width:10px;height:10px;border-right:2px solid #bdc9df;border-bottom:2px solid #bdc9df;transform:translateY(-2px) rotate(45deg);transition:transform .15s}
.market-sort-wrap.is-open .market-sort-chevron{transform:translateY(3px) rotate(225deg)}
.market-controls .market-sort-menu{position:absolute;left:0;right:0;top:calc(100% + 5px);z-index:65;padding:6px;background:#10182a;border:1px solid #374768;border-radius:12px;box-shadow:0 18px 35px rgba(0,0,0,.45);max-height:min(320px,55vh);overflow-y:auto}
.market-controls .market-sort-menu[hidden]{display:none!important}
.market-sort-option{width:100%;display:block;text-align:left;padding:9px 11px;border:0;border-radius:8px;background:transparent;color:#e8eeff;font:600 13px Inter,system-ui,sans-serif;cursor:pointer}
.market-sort-option:hover,.market-sort-option:focus-visible{background:#223150;outline:none}
.market-sort-option[aria-selected="true"]{background:#273958}
.market-sort-option.market-sort-option-featured{color:#38bdf8;font-weight:800}
.market-sort-option.market-sort-option-premium{color:#f7cf72;font-weight:800}

/* Empty carts have no number badge, including when base flex styles apply. */
.market-page #market-cart-badge[hidden]{display:none!important}

/* Single StoryLens brand glow implementation.
   Original wordmark image is 399x116 px. Its circular shutter mark occupies
   the leftmost ~116px, hence the exact proportional size below.
   A 20px desktop image translation is mirrored for the glow.
   Hover and focus MUST NOT change animation or intensity. */
.market-page .market-brand > a {
    --sl-logo-offset-y: -20px;
    position: relative;
    isolation: isolate;
    overflow: visible;
}
.market-page .market-brand > a::before,
.market-page .market-brand > a:hover::before,
.market-page .market-brand > a:focus-visible::before {
    content: "";
    display: block;
    position: absolute;
    left: 0;
    top: calc(50% + var(--sl-logo-offset-y));
    width: 29.0726817%; /* 116 / 399 */
    height: auto;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 34%, rgba(164, 93, 255, .85) 0%, rgba(110, 61, 231, .48) 42%, transparent 75%),
                radial-gradient(circle at 70% 70%, rgba(7, 216, 246, .85) 0%, rgba(34, 175, 235, .45) 43%, transparent 75%);
    filter: blur(14px) !important;
    box-shadow: none !important;
    pointer-events: none;
    opacity: .28;
    z-index: 0;
    transform-origin: center;
    animation: storylens-brand-breath 3.6s ease-in-out infinite !important;
    will-change: opacity, transform;
}
.market-page .market-brand > a::after,
.market-page .market-brand > a:hover::after,
.market-page .market-brand > a:focus-visible::after {
    content: none !important;
    display: none !important;
}
@keyframes storylens-brand-breath {
    0%, 100% { opacity: .25; transform: translateY(-50%) scale(.90); }
    50% { opacity: .77; transform: translateY(-50%) scale(1.15); }
}
@media (max-width: 720px) {
    .market-page .market-brand > a { --sl-logo-offset-y: 0px; }
}

/* Infinite scroll and accessible page navigation */
.market-pagination{padding:18px 0 30px;text-align:center;min-height:80px}
.market-load-state{font-size:13px;color:#b8cae8;min-height:23px}
.market-load-more{margin:12px auto;min-height:42px;padding:0 22px;border:1px solid #3f567e;border-radius:12px;background:#1c2942;color:#e7f0ff;font:700 13px Inter,system-ui;cursor:pointer}
.market-load-more:hover{background:#2a3d5d}
.market-page-links{display:flex;justify-content:center;gap:16px;margin-top:14px}
.market-page-links a{color:#aacaff;font-size:13px;text-decoration:underline;text-underline-offset:3px}
#market-load-sentinel{height:1px}

/* Enhanced infinite scroll uses an unobtrusive ending; standard page links remain for non-JavaScript browsing. */
.market-page.market-infinite-active .market-page-links{display:none}

/* Tags in article cards: always a single line, including narrow screens. */
.market-page .market-card-tags{display:flex;flex-wrap:nowrap!important;align-items:center;gap:5px;min-width:0;max-width:100%;min-height:32px;overflow:hidden;white-space:nowrap}
.market-page .market-card-tags span{display:block;flex:0 1 auto;min-width:0;max-width:calc(100% - 4px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:5px 7px}
.market-page .market-card-tags span:nth-child(n+4){display:none}

/* Mobile-only marketplace layout. Desktop styles stay unchanged. */
@media (max-width: 760px) {
  .market-page {
    box-sizing:border-box;
    width:100%;
    max-width:100%;
    min-width:0;
    margin:0 auto;
    padding:8px 14px 42px;
    overflow-x:clip;
  }
  .market-page .market-brand{display:none;}
  .market-page .market-hero {
    box-sizing:border-box;
    width:100%;
    min-width:0;
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    gap:14px;
    min-height:0;
    padding:20px 18px;
    border-radius:19px;
  }
  .market-page .market-hero h1 {font-size:clamp(24px,6.8vw,33px);line-height:1.16;overflow-wrap:break-word;}
  .market-page .market-hero p {font-size:12px;line-height:1.5;}
  .market-page .market-actions {display:flex;flex-wrap:wrap;gap:8px;}
  .market-page .market-iconbtn {width:46px;height:43px;flex:none;}
  .market-page .market-categories {
    display:flex;
    width:100%;
    min-width:0;
    flex-wrap:nowrap;
    align-items:center;
    justify-content:flex-start;
    gap:8px;
    margin:14px 0 13px;
    padding:2px 0 9px;
    overflow-x:auto;
    overflow-y:hidden;
    overscroll-behavior-inline:contain;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:thin;
  }
  .market-page .market-categories > button.market-chip {
    flex:0 0 auto;
    width:auto;
    min-width:max-content;
    min-height:38px;
    padding:7px 12px;
  }
  .market-page .market-authors {
    display:flex;
    width:100%;
    min-width:0;
    overflow-x:auto;
    overflow-y:hidden;
    gap:12px;
    padding:5px 0 13px;
    margin:0 0 8px;
    scrollbar-width:thin;
    overscroll-behavior-inline:contain;
    -webkit-overflow-scrolling:touch;
  }
  .market-page .market-author {flex:0 0 76px;width:76px;min-width:76px;gap:7px;}
  .market-page .market-avatar {width:58px;height:58px;}
  .market-page .market-author>span:last-child {width:76px;max-width:76px;font-size:10px;line-height:1.3;overflow-wrap:normal;}
  .market-page .market-controls {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:9px;
    margin:8px 0 14px;
  }
  .market-page .market-controls > * {min-width:0;width:100%;grid-column:1/-1;}
  .market-page .market-controls input,
  .market-page .market-controls select,
  .market-page .market-sort-wrap,
  .market-page .market-sort-trigger {box-sizing:border-box;width:100%;min-width:0;max-width:100%;}
  .market-page .market-cards {grid-template-columns:minmax(0,1fr);gap:14px;}
  .market-page .market-card {min-width:0;width:100%;}
  .market-page .market-card-media {aspect-ratio:16/10;}
  .market-page .market-card-body {padding:15px;gap:9px;}
  .market-page .market-card-body h2 {font-size:16px;}
  .market-page .market-card-desc {font-size:13px;}
  .market-page .market-card-tags {flex-wrap:nowrap!important;overflow:hidden;}
  .market-page .market-card-footer {flex-wrap:nowrap;min-width:0;}
  .market-page .market-cta {min-width:0;}
  .market-page .market-cards.is-list {grid-template-columns:minmax(0,1fr);}
  .market-page .market-cards.is-list .market-card {flex-direction:column;}
  .market-page .market-cards.is-list .market-card-media {flex:none;width:100%;aspect-ratio:16/10;}
}
@media (max-width: 380px) {
  .market-page {padding-inline:12px;}
  .market-page .market-hero {padding:17px 15px;}
  .market-page .market-hero h1{font-size:24px;}
  .market-page .market-card-body{padding:13px;}
}

/* Mobile-only: single-column cards need no grid/list switch. Keep cart accessible. */
@media (max-width:760px) {
  .market-page #market-grid-button,
  .market-page #market-list-button { display:none !important; }
  .market-page .market-actions { gap:0; }

  /* Swipe horizontally without browser scrollbar chrome. */
  .market-page .market-categories,
  .market-page .market-authors {
    scrollbar-width:none !important;
    -ms-overflow-style:none;
    scroll-snap-type:x proximity;
    touch-action:pan-x pan-y;
  }
  .market-page .market-categories::-webkit-scrollbar,
  .market-page .market-authors::-webkit-scrollbar {
    display:none !important;
    width:0 !important;
    height:0 !important;
  }
  .market-page .market-categories > .market-chip,
  .market-page .market-authors > .market-author {
    scroll-snap-align:start;
  }
}
