/* ============================================================
   Studio → Products (js/products-page.js): My products, the AiVirals
   catalog, one product's page, and the reference-sheet maker.
   Cards and dialogs reuse the Profile's (css/profile.css).
   ============================================================ */

.prd-host { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.prd-page {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    box-sizing: border-box;
    width: 100%;
    padding: 32px max(24px, calc((100% - 1120px) / 2)) 48px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
/* The page scrolls; its rows keep their own height (an overflowing flex column would squash them). */
.prd-page > * { flex-shrink: 0; }

/* The title (hidden in Explore: its tabs name the page), then one row: the list
   chips (Catalog · Favorites · Yours) and the paste-or-search field (board Products A). */
.prd-head { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.prd-h1 { margin: 0; }
.prd-toolbar { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.prd-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.prd-list-chip svg { width: 13px; height: 13px; }

.prd-paste {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(400px, 100%);
    box-sizing: border-box;
    padding-right: 4px;
}
.prd-paste-input { flex: 1; min-width: 0; border: none; background: transparent; padding: 0; color: var(--sl-text-1); font: inherit; }
.prd-paste-input:focus { outline: none; box-shadow: none; }
.prd-paste .sl-btn-primary { flex: none; }

.prd-note {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
}
.prd-note-info { color: var(--sl-text-2); }
.prd-note-warn { color: var(--sl-warning); }

/* Add products (js/products-page.js renderAdd): links → the AiVirals catalog, one status line each. */
.prd-add { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--sl-hairline); border-radius: var(--sl-r-10); background: var(--sl-panel); }
.prd-add-head { display: flex; align-items: center; gap: 8px; }
.prd-add-bar { display: flex; align-items: flex-start; gap: 8px; }
.prd-add-input { flex: 1; min-width: 0; height: auto; min-height: 52px; padding: 8px 11px; line-height: 1.45; resize: vertical; font-family: var(--sl-font-mono); font-size: 12px; }
.prd-add-bar .sl-btn-primary { flex: none; min-width: 72px; }
.prd-add-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.prd-add-row { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 12.5px; color: var(--sl-text-2); }
.prd-add-row > svg, .prd-add-row > .pf-spinner { flex: none; }
.prd-add-row.is-ok > svg { color: var(--sl-success); }
.prd-add-row.is-warn > svg { color: var(--sl-warning); }
.prd-add-link { flex: 0 1 auto; min-width: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sl-text-1); font-weight: 600; }
.prd-add-state { flex: 1; min-width: 0; }
.prd-add-row.is-warn .prd-add-state { color: var(--sl-warning); }
.prd-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--sl-text-2); cursor: pointer; }
body.pw-mobile .prd-add-bar { flex-direction: column; align-items: stretch; }
body.pw-mobile .prd-add-link { max-width: 40%; }

.prd-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prd-tabs .sl-seg-btn { gap: 6px; }

/* Category chips: one scrolling row. */
.prd-cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.prd-cats::-webkit-scrollbar { display: none; }
.prd-cat {
    flex: none;
    height: 28px;
    padding: 0 11px;
    border-radius: 14px;
    border: 1px solid var(--sl-hairline);
    background: none;
    color: var(--sl-text-2);
    font: inherit;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}
.prd-cat:hover { color: var(--sl-text-1); border-color: var(--sl-border-strong); }
.prd-cat.is-on { background: var(--sl-accent-tint); border-color: var(--sl-accent-line); color: var(--sl-accent-text); }

/* The grids. */
.prd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 18px 14px;
    align-items: start;
}
.prd-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    outline: none;
}
.prd-card-photo {
    position: relative;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--sl-r-10);
    background: var(--sl-card);
    color: var(--sl-text-3);
    box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.07);
    transition: box-shadow 0.15s ease;
}
.prd-card-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.prd-card:hover .prd-card-photo { box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.18), var(--sl-shadow-card); }
.prd-card:focus-visible .prd-card-photo { box-shadow: 0 0 0 2px var(--sl-focus); }
/* The card's text under its picture: name, the numbers (mono), what it is. */
.prd-card-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 3px; }
.prd-card-name { padding: 0 2px; font-size: 13px; font-weight: 600; color: var(--sl-text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prd-two-lines { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.prd-card-meta { display: flex; align-items: center; gap: 4px; padding: 0 2px; font-size: 11.5px; color: var(--sl-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prd-ok { color: var(--sl-success); }
.prd-badge {
    position: absolute;
    left: 8px;
    top: 8px;
    padding: 2px 7px;
    border-radius: 6px;
    background: oklch(0.13 0.003 250 / 0.78);
    color: var(--sl-on-media);
    font-size: 10.5px;
}

.prd-card-add {
    aspect-ratio: 1;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    text-align: center;
    border: 1px dashed var(--sl-border-strong);
    border-radius: var(--sl-r-10);
}
.prd-card-add:hover { background: var(--sl-wash); border-color: var(--sl-accent-line); }
.prd-card-add-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--sl-quiet); color: var(--sl-link); }
.prd-card-add-label { font-size: 13px; font-weight: 600; color: var(--sl-text-1); }
.prd-card-add-sub { font-size: 11.5px; color: var(--sl-text-3); }

.prd-empty { margin: 6px 0 0; font-size: 13px; color: var(--sl-text-2); }
.prd-strip > .prd-empty { margin: 0; font-size: 12.5px; color: var(--sl-text-3); }
.prd-hint { margin: 0; font-size: 12px; line-height: 1.45; color: var(--sl-text-3); }
.prd-loading { display: flex; align-items: center; gap: 10px; padding: 18px 0; font-size: 12.5px; color: var(--sl-text-2); }
.prd-more { display: flex; justify-content: center; padding-top: 6px; }
.prd-link { font-size: 12.5px; color: var(--sl-link); text-decoration: none; }
.prd-link:hover { text-decoration: underline; }

/* One product. */
.prd-product { display: flex; flex-direction: column; gap: 22px; }

/* Product page C (board Product C): the back link, then the hero card beside
   "Make a video with it" ("make first"). The header is a .sl-pagehead, so its
   sticky bar copies the picture, the name and the price line. */
/* The section is the padded box and the page only scrolls, so the sticky bar spans the page and sticks at its top. */
.prd-page.is-product { padding: 0; }
.prd-product-c { padding: 20px max(24px, calc((100% - 1120px) / 2)) 48px; }
body.pw-mobile .prd-page.is-product { padding: 0; }
body.pw-mobile .prd-product-c { padding: 16px 14px 32px; }
.prd-c-head { gap: 14px; }
.prd-c-hero { gap: 20px; align-items: stretch; }
.prd-c-card { flex: 1; min-width: 0; display: flex; gap: 20px; padding: 16px; box-sizing: border-box; }
.prd-c-head .sl-pagehead-icon.prd-c-cover {
    width: 200px;
    height: auto;
    aspect-ratio: 4 / 5;
    align-self: flex-start;
    border-radius: var(--sl-r-10);
    border: 1px solid var(--sl-hairline);
    background: var(--sl-control);
    color: var(--sl-text-3);
}
.prd-c-head .sl-pagehead-icon.prd-c-cover svg { width: 26px; height: 26px; }
.prd-c-main { gap: 14px; }
.prd-c-titlerow { display: flex; align-items: flex-start; gap: 10px; }
.prd-c-names { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.prd-c-head .prd-product-name { font-size: 24px; }
.prd-c-sub { display: block; }
.prd-c-sub .prd-link { font-size: inherit; }
.prd-c-barline { display: none; }      /* the sticky bar's line; the big numbers say it here */
.prd-facts.prd-c-big { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 0; }
.prd-c-stat { display: flex; flex-direction: column; gap: 2px; }
.prd-c-stat b { font-family: var(--sl-font-mono); font-size: 20px; font-weight: 600; color: var(--sl-text-1); }
.prd-c-stat span { font-size: 11.5px; color: var(--sl-text-3); }
.prd-c-badges, .prd-c-own { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.prd-c-own .sl-btn-secondary { gap: 6px; }

.prd-c-make { flex: none; width: 340px; display: flex; flex-direction: column; gap: 8px; }
.prd-c-make-title { margin: 0 0 2px; }
.prd-way {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    box-sizing: border-box;
    border-radius: var(--sl-r-10);
    border: 1px solid var(--sl-hairline);
    background: var(--sl-card);
    color: var(--sl-text-1);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.prd-way:hover:not([disabled]) { border-color: var(--sl-accent-line); }
.prd-way:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--sl-focus); }
.prd-way[disabled] { opacity: 0.55; cursor: default; }
.prd-way-ic { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: var(--sl-r-8); background: var(--sl-quiet); color: var(--sl-link); }
.prd-way-label { flex: 1; min-width: 0; }

@media (max-width: 1180px) {
    .prd-c-hero { flex-direction: column; }
    .prd-c-make { width: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .prd-c-make-title { grid-column: 1 / -1; }
}
body.pw-mobile .prd-c-card { flex-direction: column; }
body.pw-mobile .prd-c-head .sl-pagehead-icon.prd-c-cover { width: 100%; aspect-ratio: 16 / 9; }
body.pw-mobile .prd-c-head .prd-product-name { font-size: 20px; }
body.pw-mobile .prd-c-make { grid-template-columns: 1fr; }
body.pw-mobile .prd-facts.prd-c-big { gap: 10px 22px; }
body.pw-mobile .prd-c-stat b { font-size: 17px; }

.prd-back { align-self: flex-start; gap: 4px; margin-left: -6px; }
.prd-product-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.prd-product-cover {
    width: 76px;
    height: 76px;
    flex: none;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--sl-r-10);
    background: var(--sl-card);
    color: var(--sl-text-3);
}
.prd-product-cover img { width: 100%; height: 100%; object-fit: cover; }
.prd-product-text { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.prd-product-name { margin: 0; }
.prd-product-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.prd-product-actions .sl-btn-primary, .prd-product-actions .sl-btn-secondary { gap: 6px; }

.prd-part { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--sl-hairline); }
.prd-part-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prd-part-head .sl-btn-secondary { gap: 6px; }
.prd-part-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--sl-text-1); }

.prd-strip { display: flex; gap: 12px; overflow-x: auto; padding: 6px 2px 4px; }
.prd-tile { position: relative; flex: none; display: flex; flex-direction: column; gap: 5px; width: 112px; }
.prd-tile-wide { width: 220px; }
.prd-tile-img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    overflow: hidden;
    border: none;
    border-radius: var(--sl-r-8);
    background: var(--sl-quiet);
    box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.1);
    cursor: zoom-in;
}
.prd-tile-wide .prd-tile-img { aspect-ratio: 16 / 9; }
.prd-tile-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.prd-tile-wide .prd-tile-img img { object-fit: contain; background: oklch(0.97 0 0); }
.prd-tile-label { font-size: 11.5px; color: var(--sl-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prd-tile-x { top: -6px; right: -6px; }
.prd-tile-img video { display: block; width: 100%; height: 100%; object-fit: cover; }
.prd-tile-img { position: relative; }

/* Stars: on a card (Favorites), on an AI image (keep it first), on a product page. */
.prd-star {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 30px;
    height: 30px;
    padding: 0;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: oklch(0.13 0.003 250 / 0.66);
    color: var(--sl-on-media-2);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease, color 0.12s ease;
}
.prd-card:hover .prd-star, .prd-card:focus-within .prd-star, .prd-star.is-on { opacity: 1; }
.prd-star:hover { color: var(--sl-text-1); }
.prd-star.is-on { color: oklch(0.82 0.15 85); }
.prd-star.is-on svg, .prd-tile-star.is-on svg, .prd-fav-btn.is-on svg { fill: currentColor; }
body.pw-mobile .prd-star { opacity: 1; width: 36px; height: 36px; }

.prd-tile-star {
    position: absolute;
    left: 5px;
    top: 5px;
    width: 22px;
    height: 22px;
    padding: 0;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: oklch(0.13 0.003 250 / 0.7);
    color: var(--sl-on-media-2);
    cursor: pointer;
}
.prd-tile-star.is-on { color: oklch(0.82 0.15 85); }
.prd-tile.is-starred .prd-tile-img { box-shadow: inset 0 0 0 2px oklch(0.82 0.15 85 / 0.8); }
.prd-fav-btn.is-on { color: oklch(0.82 0.15 85); border-color: oklch(0.82 0.15 85 / 0.5); }

.prd-intro { margin: 0 0 12px; font-size: 13px; color: var(--sl-text-2); }
.prd-empty-box { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.prd-card[role="button"] { cursor: pointer; }
.prd-card:focus-visible { outline: none; }

.prd-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 12.5px; }
.prd-facts dt { color: var(--sl-text-3); }
.prd-facts dd { margin: 0; color: var(--sl-text-1); }
.prd-catalog-box { display: flex; flex-direction: column; gap: 12px; }
.prd-videos { display: flex; flex-direction: column; gap: 6px; }
.prd-video {
    position: relative;
    flex: none;
    width: 96px;
    aspect-ratio: 9 / 16;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--sl-r-8);
    background: var(--sl-quiet);
    color: var(--sl-text-3);
}
.prd-video { padding: 0; border: none; cursor: pointer; font: inherit; }
.prd-video img { width: 100%; height: 100%; object-fit: cover; }
.prd-video-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: oklch(0.13 0.003 250 / 0.7);
    color: var(--sl-on-media);
    opacity: 0.85;
    transition: opacity 0.12s ease, transform 0.12s ease;
}
.prd-video:hover .prd-video-play { opacity: 1; transform: scale(1.08); }
.prd-video:focus-visible { box-shadow: 0 0 0 2px var(--sl-focus); }

/* A catalog video, played in the app. */
.prd-player { z-index: 10400; padding: 24px; box-sizing: border-box; }
.prd-player-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(460px, 100%);
    max-height: 100%;
    padding: 12px;
    box-sizing: border-box;
    border-radius: var(--sl-r-14);
    background: var(--sl-raised);
    border: 1px solid var(--sl-border);
    box-shadow: var(--sl-shadow-modal);
}
.prd-player-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prd-player-title { min-width: 0; font-size: 13px; font-weight: 600; color: var(--sl-text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prd-player-x { flex: none; width: 30px; padding: 0; justify-content: center; }
.prd-player video { display: block; width: 100%; max-height: calc(100vh - 150px); border-radius: var(--sl-r-10); background: #000; }
.prd-player-foot { display: flex; gap: 16px; }
.prd-video-views {
    position: absolute;
    left: 5px;
    bottom: 5px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 5px;
    border-radius: 5px;
    background: oklch(0.13 0.003 250 / 0.78);
    color: var(--sl-on-media);
    font-size: 10.5px;
}

/* Dialogs: a catalog product, the sheet maker. */
.prd-dialog { width: min(640px, calc(100vw - 32px)); }
.prd-dialog-body { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.prd-dialog .sl-modal-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prd-title-full { margin: 0; font-size: 13px; line-height: 1.45; color: var(--sl-text-1); }
.prd-add-under { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--sl-text-2); }
.prd-brand-select { width: auto; min-width: 150px; }

.prd-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.prd-pick-item {
    position: relative;
    width: 84px;
    height: 84px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--sl-r-8);
    overflow: hidden;
    background: var(--sl-quiet);
    opacity: 0.55;
    cursor: pointer;
}
.prd-pick-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prd-pick-item.is-on { border-color: var(--sl-accent); opacity: 1; }
.prd-pick-tick {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--sl-accent);
    color: var(--sl-on-accent);
}
.prd-sheet-result { border-radius: var(--sl-r-10); overflow: hidden; background: oklch(0.97 0 0); }
.prd-sheet-result img { display: block; width: 100%; height: auto; }
.prd-spin-sm { width: 12px; height: 12px; border-width: 2px; margin-right: 6px; }

.prd-lightbox { z-index: 10400; cursor: zoom-out; padding: 24px; box-sizing: border-box; }
.prd-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--sl-r-10); background: oklch(0.97 0 0); }

/* Places: room sheets are wide. */
.pf-photo.pf-sheet { width: 136px; }
.pf-photo.pf-sheet a { display: block; width: 100%; height: 100%; border-radius: inherit; overflow: hidden; }
.pf-sheets-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.pf-sheets-wrap .sl-btn-secondary { gap: 6px; }

/* ============================================================
   Explore → Trending videos (js/trending-page.js): the AiVirals feed.
   Boards Trending A (the grid) + B (the side panel); on a phone the
   panel is a bottom sheet. Shares the page and card text styles above.
   ============================================================ */
.mk-section > .trd-layout, .trd-layout { flex: 1; min-height: 0; display: flex; }
.trd-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* Which videos (segmented), the order menu, then the search: one row of 34 px controls that wraps. */
.trd-bar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.trd-search { width: 300px; max-width: 100%; height: 34px; }
.trd-search-input { flex: 1; min-width: 0; }
/* Row 2 (AiVirals' feed): labeled fields — Sort, Tool, Content type, Category or Niche, Revenue. */
.trd-filters { display: flex; align-items: flex-end; gap: 10px 12px; flex-wrap: wrap; }
.trd-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.trd-select { height: 34px; min-width: 150px; max-width: 240px; padding-right: 8px; cursor: pointer; font-weight: 600; }
.trd-select:hover { border-color: var(--sl-border-strong, var(--sl-border)); }
.trd-sort { position: relative; }
.trd-sort-btn {
    display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px 0 11px; box-sizing: border-box;
    background: var(--sl-panel); border: 1px solid var(--sl-hairline); border-radius: 9px; cursor: pointer;
    color: var(--sl-text-1); font-family: var(--sl-font-ui); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.trd-sort-btn:hover, .trd-sort-btn[aria-expanded="true"] { border-color: var(--sl-border); background: var(--sl-quiet-hover); }
.trd-sort-btn > svg { flex: none; color: var(--sl-text-3); }
.trd-sort-range { color: var(--sl-text-3); font-weight: 500; }
.trd-sort-range::before { content: "·"; margin-right: 7px; }
.trd-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: max(100%, 200px); display: flex; flex-direction: column; }
.trd-menu-item:focus-visible { outline: none; background: color-mix(in oklab, var(--sl-ink) 8%, transparent); }
.trd-menu-item.is-current { font-weight: 600; }
.trd-menu-check { flex: none; width: 14px; display: flex; color: var(--sl-accent-text); }
.trd-menu-item { white-space: nowrap; }
.trd-menu-grow { flex: 1; }
.trd-menu-hint { color: var(--sl-text-3); font-weight: 500; }
/* Most viewed's time ranges come out of the menu as one panel: the same top edge, one line
   between them (the shared border), square corners where they join, the first range level
   with Most viewed, and Most viewed's highlight running on to that line. */
.trd-menu.has-sub { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.trd-menu-parent { position: relative; }
.trd-menu-parent.is-open { background: color-mix(in oklab, var(--sl-ink) 8%, var(--sl-raised)); border-radius: var(--sl-r-6) 0 0 var(--sl-r-6); }
.trd-menu-parent.is-open::after { content: ""; position: absolute; top: 0; bottom: 0; left: 100%; width: 5px; background: inherit; }
.trd-submenu { position: absolute; left: 100%; top: -1px; min-width: 170px; display: flex; flex-direction: column; }
/* No corner and no shadow on the side that joins the menu. */
.trd-menu .trd-submenu { border-top-left-radius: 0; clip-path: inset(-48px -48px -48px 0); }
.trd-submenu[hidden] { display: none; }
/* On a phone: under Most viewed, inside the menu. */
.trd-menu.is-inline .trd-submenu { position: static; margin: 0 0 2px; padding: 0 0 0 14px; min-width: 0; border: none; box-shadow: none; background: transparent; }
.trd-menu.is-inline.has-sub { border-radius: var(--sl-r-10); }
.trd-menu.is-inline .trd-sub-label { display: none; }
.trd-menu.is-inline .trd-submenu { clip-path: none; }
.trd-menu.is-inline .trd-menu-parent.is-open { border-radius: var(--sl-r-6); }
.trd-menu.is-inline .trd-menu-parent.is-open::after { content: none; }
.trd-menu.is-inline .trd-menu-parent.is-open > svg:last-child { transform: rotate(180deg); }

/* After the chosen kind of videos ends: a rule, "Everything else", then the rest of the feed. */
.trd-rest { display: flex; flex-direction: column; gap: 16px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--sl-hairline); }
.trd-rest[hidden] { display: none; }
.trd-tail:empty { display: none; }
.trd-end { margin: 0; padding: 22px 0 4px; text-align: center; }

.trd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; align-items: start; }
.trd-card { display: flex; flex-direction: column; gap: 7px; min-width: 0; cursor: pointer; outline: none; }
.trd-thumb {
    position: relative;
    aspect-ratio: 9 / 16;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--sl-r-10);
    background: var(--sl-control);
    color: var(--sl-text-3);
    box-shadow: inset 0 0 0 1px var(--sl-hairline);
    transition: box-shadow 0.15s ease;
}
.trd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trd-card:hover .trd-thumb { box-shadow: inset 0 0 0 1px var(--sl-border-strong), var(--sl-shadow-card); }
.trd-card:focus-visible .trd-thumb { box-shadow: 0 0 0 2px var(--sl-focus); }
.trd-card.is-sel .trd-thumb { box-shadow: 0 0 0 2px var(--sl-accent); }
.trd-shop { position: absolute; left: 6px; top: 6px; }
.trd-views { position: absolute; left: 6px; bottom: 6px; }
.trd-age { position: absolute; right: 6px; bottom: 6px; }
/* Save a video (kept on AiVirals, under the shared account): a bookmark on the card and in the open video. */
.trd-save { right: 6px; top: 6px; }
.trd-card:hover .trd-save, .trd-card:focus-within .trd-save { opacity: 1; }
.trd-save-btn { gap: 6px; flex: none; }
.trd-save-btn.is-on { color: oklch(0.82 0.15 85); border-color: oklch(0.82 0.15 85 / 0.5); }
.trd-save-btn.is-on svg { fill: currentColor; }
.trd-saved-chip { flex: none; }
.trd-card .prd-card-name { padding: 0; font-size: 12.5px; }
.trd-card .prd-card-meta { padding: 0; }

/* A video: a modal over the page. The video as tall as the screen allows (9:16), its
   breakdown beside it with its own scroll; ‹ › outside the modal step through the list. */
.trd-scrim { z-index: 10300; gap: 12px; padding: 24px 12px; box-sizing: border-box; }
.trd-modal {
    --trd-h: min(860px, calc(100vh - 48px));
    display: flex;
    height: var(--trd-h);
    max-width: calc(100vw - 136px);
    min-width: 0;
    background: var(--sl-raised);
    border: 1px solid var(--sl-border);
    border-radius: var(--sl-r-14);
    box-shadow: var(--sl-shadow-modal);
    overflow: hidden;
}
.trd-stage { flex: none; height: 100%; background: #000; display: flex; align-items: center; justify-content: center; }
.trd-side {
    flex: none;
    width: clamp(340px, 30vw, 440px);
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--sl-hairline);
}
.trd-nav {
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid oklch(1 0 0 / 0.16);
    background: oklch(0.2 0.004 250 / 0.75);
    color: #fff;
    cursor: pointer;
}
.trd-nav:hover:not(:disabled) { background: oklch(0.3 0.004 250 / 0.9); }
.trd-nav:disabled { opacity: 0.3; cursor: default; }
.trd-nav:focus-visible { outline: 2px solid var(--sl-focus); outline-offset: 2px; }
.trd-side-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--sl-hairline); }
.trd-side-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trd-title { font-family: var(--sl-font-ui); font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--sl-text-1); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.trd-byline { font-family: var(--sl-font-ui); font-size: 12.5px; color: var(--sl-text-2); }
.trd-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
/* The video: 9:16 at the modal's height, narrower when the window is (the side keeps its width). */
.trd-media {
    position: relative;
    height: 100%;
    aspect-ratio: 9 / 16;
    max-width: calc(100vw - 136px - clamp(340px, 30vw, 440px));
    background: #000;
}
.trd-media video, .trd-media img { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.trd-fs {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    border: none;
    border-radius: var(--sl-r-8);
    background: oklch(0 0 0 / 0.55);
    color: #fff;
    cursor: pointer;
    opacity: 0.85;
}
.trd-fs:hover { background: oklch(0 0 0 / 0.75); opacity: 1; }
.trd-dl { margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.trd-part dd { margin: 3px 0 0; }
.trd-text { line-height: 1.5; color: var(--sl-text-1); }
/* Readable labels (the 9.5 px mono kicker was too faint here): sans, 11 px, bold, the second text color. */
.trd-label { font-family: var(--sl-font-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sl-text-2); }

/* AiVirals' colors (VideoTagInsights.js, globals.css .signal-*): amber = attention / heat,
   green = healthy, indigo = text hook and format, teal = visual style, gray = flat. */
.trd-modal {
    --trd-amber: oklch(0.78 0.15 70);
    --trd-green: oklch(0.76 0.15 155);
    --trd-indigo: oklch(0.72 0.13 275);
    --trd-teal: oklch(0.75 0.1 195);
}
:root[data-pw-theme="light"] .trd-modal {
    --trd-amber: oklch(0.6 0.15 65);
    --trd-green: oklch(0.55 0.14 155);
    --trd-indigo: oklch(0.5 0.15 275);
    --trd-teal: oklch(0.52 0.09 195);
}
.trd-stats { display: grid; gap: 8px; }
.trd-stat {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid var(--sl-hairline);
    border-left: 3px solid var(--sl-border-strong, var(--sl-border));
    border-radius: var(--sl-r-8);
    background: var(--sl-panel);
}
.trd-stat-k { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sl-text-3); }
.trd-stat-v { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--sl-text-3); }
.trd-stat.is-hot { border-left-color: var(--trd-amber); }
.trd-stat.is-hot .trd-stat-v { color: var(--trd-amber); }
.trd-stat.is-good { border-left-color: var(--trd-green); }
.trd-stat.is-good .trd-stat-v { color: var(--trd-green); }
.trd-stat.is-lead { background: linear-gradient(90deg, color-mix(in oklab, var(--trd-amber) 16%, var(--sl-panel)), var(--sl-panel) 70%); }

.trd-hook { position: relative; padding: 9px 12px 10px 14px; border-radius: var(--sl-r-8); overflow: hidden; }
.trd-hook::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.trd-hook-label { font-family: var(--sl-font-ui); font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.trd-hook.is-text { background: color-mix(in oklab, var(--trd-indigo) 13%, transparent); }
.trd-hook.is-text::before { background: var(--trd-indigo); }
.trd-hook.is-text .trd-hook-label { color: var(--trd-indigo); }
.trd-hook.is-vocal { background: color-mix(in oklab, var(--trd-green) 12%, transparent); }
.trd-hook.is-vocal::before { background: var(--trd-green); }
.trd-hook.is-vocal .trd-hook-label { color: var(--trd-green); }
.trd-hook.is-visual { background: color-mix(in oklab, var(--trd-amber) 12%, transparent); }
.trd-hook.is-visual::before { background: var(--trd-amber); }
.trd-hook.is-visual .trd-hook-label { color: var(--trd-amber); }

.trd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.trd-chip {
    --c: var(--sl-text-2);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 9px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--c);
    background: color-mix(in oklab, var(--c) 12%, transparent);
    border: 1px solid color-mix(in oklab, var(--c) 28%, transparent);
}
.trd-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.trd-chip.is-format { --c: var(--trd-indigo); }
.trd-chip.is-tone { --c: var(--trd-amber); }
.trd-chip.is-style { --c: var(--trd-teal); }
.trd-product { display: flex; align-items: center; gap: 10px; padding: 10px; }
.trd-product img, .trd-product-ph { width: 44px; height: 44px; flex: none; border-radius: var(--sl-r-8); object-fit: cover; display: grid; place-items: center; background: var(--sl-control); color: var(--sl-text-3); }
.trd-product-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trd-product-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trd-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; border-top: 1px solid var(--sl-hairline); }
.trd-actions .prd-link { white-space: nowrap; }
.trd-actions .sl-btn-primary { gap: 6px; }

/* A phone: the modal fills the screen — the video on top, the details scroll under it,
   the actions stay on screen; ‹ › sit on the video's sides. */
body.pw-mobile .trd-scrim { padding: 0; gap: 0; }
body.pw-mobile .trd-modal {
    position: fixed;
    inset: 0;
    height: auto;
    max-width: none;
    flex-direction: column;
    border: none;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
body.pw-mobile .trd-stage { height: 52vh; height: 52dvh; }
body.pw-mobile .trd-media { max-width: 100vw; }
body.pw-mobile .trd-side { flex: 1; width: auto; min-height: 0; border-left: none; border-top: 1px solid var(--sl-hairline); }
body.pw-mobile .trd-nav { position: fixed; top: calc(26vh - 20px); top: calc(26dvh - 20px); z-index: 10302; width: 40px; height: 40px; }
body.pw-mobile .trd-nav.is-prev { left: 6px; }
body.pw-mobile .trd-nav.is-next { right: 6px; }
body.pw-mobile .trd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.pw-mobile .trd-cats { width: 100%; }
body.pw-mobile .trd-cats .sl-seg-btn { flex: 1; height: 32px; }
body.pw-mobile .trd-bar .pf-flex { display: none; }
body.pw-mobile .trd-sort-btn, body.pw-mobile .trd-search { height: 40px; }
body.pw-mobile .trd-search { flex: 1; width: auto; min-width: 140px; }
body.pw-mobile .trd-cats { overflow-x: auto; }
body.pw-mobile .trd-cats .sl-seg-btn { padding: 0 8px; }
body.pw-mobile .trd-field { flex: 1 1 140px; }
body.pw-mobile .trd-select { width: 100%; max-width: none; height: 40px; }
body.pw-mobile .trd-menu { min-width: 250px; }
body.pw-mobile .trd-menu .sl-menu-item { height: 40px; font-size: 13px; }

body.pw-mobile .prd-page { padding: 20px 14px 32px; }
body.pw-mobile .prd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.pw-mobile .prd-cat { height: 34px; }
