/* Native Discover geometry. Every override is opt-in; Original keeps its layout. */
.ui-media-menu, .ui-media-system-icon { display:none; }
#posts-grid { overflow-anchor:none; }
.discovery-before, .discovery-after { pointer-events:none; }
.discovery-before { scroll-snap-align:start; }
.discovery-after { scroll-snap-align:end; }
html[data-ui-product="media"][data-ui-appearance="system"] {
    --ui-media-header-height:67px;
    --ui-media-chrome-height:67px;
}
html[data-ui-product="media"][data-ui-appearance="system"] .hdr {
    min-height:67px;
    padding:12px;
    gap:5px;
    align-items:center;
    background:linear-gradient(#0005,transparent);
}
html[data-ui-product="media"][data-ui-appearance="system"] .logo-icon { display:block; filter:none; }
html[data-ui-product="media"][data-ui-appearance="system"] .logo h1 { font-size:20px; line-height:28px; letter-spacing:-.5px; }
html[data-ui-product="media"][data-ui-appearance="system"] .hdr-actions { gap:5px; align-items:center; }
html[data-ui-product="media"][data-ui-appearance="system"] .hdr-actions :is(.flt-btn,.ui-media-menu,.sols-bio-header,.sols-network-trigger) {
    width:36px!important;
    min-width:36px!important;
    height:36px!important;
    padding:0!important;
    margin:0!important;
    flex-shrink:0;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:50%;
    border:1px solid var(--ui-border);
    color:var(--ui-text);
    background:rgba(225,211,242,.055);
    box-shadow:inset 0 1px #fff2;
    backdrop-filter:var(--ui-blur);
    -webkit-backdrop-filter:var(--ui-blur);
    cursor:pointer;
    transform:none;
}
html[data-ui-product="media"][data-ui-appearance="system"] .hdr-actions .sols-network-trigger { order:0; }
html[data-ui-product="media"][data-ui-appearance="system"] #flt-bar { display:none; order:1; gap:5px; margin:0; }
html[data-ui-product="media"][data-ui-appearance="system"] .ui-media-menu { order:2; }
html[data-ui-product="media"][data-ui-appearance="system"] .hdr-actions .sols-bio-header { order:3; }
html[data-ui-product="media"][data-ui-appearance="system"] .ui-media-expanded #flt-bar { display:flex; }
html[data-ui-product="media"][data-ui-appearance="system"] .ui-media-expanded .logo h1 { display:none; }
html[data-ui-product="media"][data-ui-appearance="system"] .ui-media-original-icon { display:none; }
html[data-ui-product="media"][data-ui-appearance="system"] .ui-media-system-icon { display:flex; align-items:center; justify-content:center; }
html[data-ui-product="media"][data-ui-appearance="system"] #flt-search-btn { order:2; }
html[data-ui-product="media"][data-ui-appearance="system"] #flt-cats-btn { order:3; }
html[data-ui-product="media"][data-ui-appearance="system"] :is(.flt-btn.open,.flt-btn.on,.ui-media-menu[aria-expanded="true"]) { background:var(--ui-selected); border-color:var(--ui-accent); }
html[data-ui-product="media"][data-ui-appearance="system"] .ui-media-menu { position:relative; }
html[data-ui-product="media"][data-ui-appearance="system"] .ui-media-menu.hot::after { content:''; position:absolute; top:1px; right:1px; width:7px; height:7px; border:2px solid var(--ui-bg); border-radius:50%; background:#ff576b; }
html[data-ui-product="media"][data-ui-appearance="system"] .filters { top:var(--ui-media-header-height); left:50%; transform:translateX(-50%); margin:0; padding:0 12px; }
html[data-ui-product="media"][data-ui-appearance="system"] .flt-panel { margin:0 0 8px; }
html[data-ui-product="media"][data-ui-appearance="system"] :is(#flt-type-row,#flt-scope-row,#flt-search-row) { padding:4px 0; border:0; background:none; }
html[data-ui-product="media"][data-ui-appearance="system"] :is(#flt-type,#flt-scope) { display:flex; flex-wrap:wrap; gap:8px; width:100%; padding:0; border:0; background:none; }
html[data-ui-product="media"][data-ui-appearance="system"] :is(#flt-type,#flt-scope) .sgl { flex:none; min-height:44px; padding:8px 14px; font:500 13px var(--font-sans); color:var(--ui-text); border:1px solid var(--ui-border); border-radius:20px; background:var(--ui-control); white-space:nowrap; }
html[data-ui-product="media"][data-ui-appearance="system"] :is(#flt-type,#flt-scope) .sgl.on { background:var(--ui-selected); border-color:var(--ui-accent); }
html[data-ui-product="media"][data-ui-appearance="system"] #flt-type .sgl[data-ui-label] { font-size:0; }
html[data-ui-product="media"][data-ui-appearance="system"] #flt-type .sgl[data-ui-label]::after { content:attr(data-ui-label); font-size:13px; }
html[data-ui-product="media"][data-ui-skin="glass"] :is(#flt-type,#flt-scope) .sgl { background:#302b37; border-color:transparent; }
html[data-ui-product="media"][data-ui-skin="glass"] :is(#flt-type,#flt-scope) .sgl.on { background:#5e405e; border-color:var(--ui-accent); }
html[data-ui-product="media"][data-ui-appearance="system"] #flt-search { width:100%; min-height:44px; padding:10px 12px; font:400 15px var(--font-sans); background:var(--ui-control); border:1px solid var(--ui-border); color:var(--ui-text); }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pcell:hover { transform:none; box-shadow:none; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid :is(.pc-tl,.pc-counts) { top:calc(var(--ui-media-chrome-height) + 8px); z-index:2; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-tl { left:16px; max-width:calc(100% - 96px); gap:6px; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-counts { right:16px; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-act-g { display:none; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-act { width:44px; padding:0; gap:4px; border-radius:0; background:none; backdrop-filter:none; -webkit-backdrop-filter:none; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .ui-media-rail-icon { width:44px; height:44px; border:1px solid var(--ui-border); border-radius:22px; background:rgba(225,211,242,.035); backdrop-filter:var(--ui-blur); -webkit-backdrop-filter:var(--ui-blur); }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .ui-media-rail-icon .ui-system-icon { width:22px; height:22px; }
html[data-ui-product="media"][data-ui-skin="material"] #posts-grid .ui-media-rail-icon { border-radius:16px; background:var(--ui-control); }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-act.gold { color:#ffd56c; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .ui-media-liked { color:#ff667e; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-counts .pc-pill[data-ui-count] { display:flex; align-items:center; gap:5px; font-size:0; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-counts .pc-pill[data-ui-count]::after { content:attr(data-ui-count); font:500 11px/16px var(--font-sans); }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-counts .ui-system-icon { width:15px; height:15px; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid :is(.pc-pill,.pc-cat) { padding:5px 9px; border-radius:14px; font:500 11px/16px var(--font-sans); letter-spacing:0; text-transform:none; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-info { bottom:calc(174px + env(safe-area-inset-bottom)); gap:8px; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-name { font:600 13px var(--font-sans); }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-meta { font:400 11px var(--font-sans); flex-wrap:wrap; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-body { font:400 14px/1.45 var(--font-sans); }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-av { width:30px; height:30px; }
html[data-ui-product="media"][data-ui-appearance="system"] #posts-grid .pc-flt-empty { margin:calc(var(--ui-media-chrome-height) + 28px) 16px 0; flex-wrap:wrap; }
html[data-ui-product="media"][data-ui-appearance="system"] .act { display:none; }
html[data-ui-product="media"][data-ui-appearance="system"] .media-fab { bottom:calc(86px + max(12px, env(safe-area-inset-bottom))); }
html[data-ui-product="media"][data-ui-skin="material"] .media-fab { bottom:calc(94px + env(safe-area-inset-bottom)); }
html[data-ui-product="media"][data-ui-skin="material"] .hdr-actions :is(.flt-btn,.ui-media-menu,.sols-bio-header) { background:var(--ui-control); border-radius:12px!important; border:0; box-shadow:none; backdrop-filter:none; }
html[data-ui-product="media"][data-ui-skin="material"] :is(#flt-type,#flt-scope) .sgl { border-radius:8px; background:#403348; border-color:transparent; }
html[data-ui-product="media"][data-ui-skin="material"] :is(#flt-type,#flt-scope) .sgl.on { background:#60416e; border-color:var(--ui-accent); }
html[data-ui-product="media"][data-ui-skin="material"] :is(.flt-btn.open,.flt-btn.on,.ui-media-menu[aria-expanded="true"]) { background:var(--ui-selected); }
@media (max-width:389px) {
    html[data-ui-product="media"][data-ui-appearance="system"] .hdr { padding-left:8px; padding-right:8px; gap:2px; }
    html[data-ui-product="media"][data-ui-appearance="system"] :is(.hdr-actions,#flt-bar) { gap:2px; }
}
@media (max-width:349px) {
    html[data-ui-product="media"][data-ui-appearance="system"] .hdr.ui-media-expanded { flex-wrap:wrap; }
    html[data-ui-product="media"][data-ui-appearance="system"] .ui-media-expanded .hdr-actions { display:contents; }
    html[data-ui-product="media"][data-ui-appearance="system"] .ui-media-expanded .logo { margin-right:auto; }
    html[data-ui-product="media"][data-ui-appearance="system"] .ui-media-expanded #flt-bar { order:4; width:100%; justify-content:flex-end; padding-top:4px; }
}

/* Match VideoMedia's native mid-left controls. They sit above the full-media
   pause target; caption and reaction controls keep their own hit targets. */
.pc-media > .reel-toggle {
    position:absolute; inset:0; z-index:1; width:100%; height:100%;
    display:grid; place-items:center; padding:0; margin:0; border:0;
    border-radius:0; color:#fff; background:transparent; cursor:pointer;
    -webkit-tap-highlight-color:transparent; touch-action:pan-y;
}
.pc-media > .reel-toggle:hover, .pc-media > .reel-toggle:active {
    background:transparent; transform:none; box-shadow:none;
}
.reel-play-badge {
    width:64px; height:64px; border-radius:50%; display:grid; place-items:center;
    background:rgba(20,20,24,.42); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px);
    border:1px solid rgba(255,255,255,.22); pointer-events:none;
}
.reel-toggle.is-playing .reel-play-badge { opacity:0; }
.reel-toggle.is-playing .reel-play-symbol, .reel-toggle:not(.is-playing) .reel-pause-symbol { display:none; }
.reel-toggle:focus-visible { outline:2px solid var(--ui-accent,#d69ae8); outline-offset:-3px; }
.reel-toggle:focus-visible .reel-play-badge { opacity:1; }
.pc-media > .reel-controls {
    position:absolute; left:8px; top:50%; transform:translateY(-50%); z-index:6;
    display:flex; align-items:center; gap:16px;
}
.reel-controls .reel-control {
    position:relative; display:grid; place-items:center; flex:none;
    min-width:52px; width:52px; min-height:44px; height:44px; padding:0;
    border-radius:22px; border:1px solid rgba(255,255,255,.35);
    color:#fff; background:rgba(0,0,0,.45); font:700 16px var(--font-sans,sans-serif);
    cursor:pointer; backdrop-filter:blur(16px) saturate(1.5); -webkit-backdrop-filter:blur(16px) saturate(1.5);
}
.reel-controls .reel-control[hidden] { display:none; }
.reel-controls .reel-control.on { background:var(--ui-selected,#7c4dff); border-color:var(--ui-accent,#b991e8); }
.reel-controls .reel-control .ui-system-icon { width:22px; height:22px; }
html[data-ui-appearance="system"] .reel-controls .reel-control {
    border-color:var(--ui-border); background:var(--ui-control); box-shadow:inset 0 1px #fff2;
}
html[data-ui-appearance="system"] .reel-controls .reel-control.on { background:var(--ui-selected); }
html[data-ui-skin="material"] .reel-controls .reel-control {
    border-radius:16px; backdrop-filter:none; -webkit-backdrop-filter:none; box-shadow:none;
}
/* Debug text is available in DevTools, never in the public Media feed. */
html[data-ui-product="media"] #log { display:none!important; }
