/* ==========================================================================
   Home Feed — bottom sheet on the galaxy page
   Glass recipe follows social-feed.css. IMPORTANT: no `will-change` here —
   it creates stacking contexts that trap fixed dropdowns behind the canvas.
   ========================================================================== */

:root {
    --hf-width: min(720px, 100vw);
    --hf-glass-bg: rgba(20, 22, 30, 0.45);
    --hf-glass-line: rgba(255, 255, 255, 0.28);
    --hf-text: rgba(255, 255, 255, 0.94);
    --hf-muted: rgba(255, 255, 255, 0.62);
    --hf-accent: rgba(125, 243, 255, 0.86);
    --hf-accent-soft: rgba(125, 243, 255, 0.16);
    --hf-peek-height: 118px;
}

/* ---------- root / backdrop ---------- */

#home-feed-root {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--hf-width);
    height: 100vh;
    height: 100dvh;
    z-index: 10012;
    pointer-events: none;
    direction: ltr;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--hf-text);
}

/* When Imagine Social is open (desktop), it takes the left ~386px and the
   whole nav row re-centers into the space that's left by shifting right by
   --social-feed-center-inset (set by social-feed.js). The sheet centers on
   the full viewport by default, so shift it by the same amount to stay
   aligned with the nav buttons above it. */
/* When Imagine Social is open (desktop only), home-feed.js drives an inline
   `left` on #home-feed-root off the body class so the sheet re-centers into
   the same space the nav row shifts into (a pure-CSS rule wouldn't take here —
   a var()-recalc cascade quirk on this element). It snaps rather than glides:
   transitioning `left` between 50% and calc(50% + Npx) interpolates the calc
   incorrectly and leaves it stuck at the start value. */

/* Invisible click-catcher only — no visual dimming. This used to darken the
   whole viewport (rgba(2,4,10,0.42)) at half/full, which is what actually
   caused the "shadow" reports: uniformly darkening everything except the
   sheet's own lit glass created a hard seam right at the sheet's top edge,
   most visible right next to the bright star — read as a drop-shadow. It
   was never a backdrop-filter/border-radius rendering bug at all. Tapping
   outside the sheet still collapses it back to peek; it just doesn't dim
   the scene anymore. */
.hf-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

#home-feed-root[data-state="half"] .hf-backdrop,
#home-feed-root[data-state="full"] .hf-backdrop {
    pointer-events: auto;
}

/* ---------- sheet ---------- */

.hf-sheet {
    /* Pure positioning box — the drag/snap transform lives here. It carries
       NO border-radius / backdrop-filter / background of its own: Chromium
       has a known bug where an element with backdrop-filter + border-radius
       + a transform on the SAME node lets the blur "bleed" past the rounded
       corners as a dark halo. Splitting the transformed box from the
       glass-styled box (below) avoids it entirely. */
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.hf-sheet-glass {
    /* Liquid glass — matches the page's glass buttons (light white tint,
       crisp white stroke, blur). A light-tint gradient over a thin dark
       underlay keeps text legible; the inset top line is the specular
       highlight. isolation:isolate is extra insurance against the halo. */
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: 26px 26px 0 0;
    border: 1px solid var(--hf-glass-line);
    border-bottom: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04) 120px),
        var(--hf-glass-bg);
    backdrop-filter: blur(22px) saturate(170%);
    -webkit-backdrop-filter: blur(22px) saturate(170%);
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.45);
    isolation: isolate;
    overflow: hidden;
    /* Safari (and some Chromium builds) can still fail to clip backdrop-filter
       to border-radius via overflow:hidden alone. Forcing a mask layer makes
       the compositor respect the rounded-rect boundary reliably. */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

#home-feed-root.hf-booting {
    visibility: hidden;
}

#home-feed-root.hf-animating .hf-sheet {
    transition: transform 320ms cubic-bezier(0.22, 0.9, 0.26, 1);
}

/* ---------- grabber + header ---------- */

.hf-grabber {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding-top: 8px;
    cursor: grab;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.hf-grabber::before {
    content: '';
    width: 52px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: background 200ms ease, width 200ms ease;
}

.hf-grabber:hover::before,
#home-feed-root.hf-dragging .hf-grabber::before {
    background: var(--hf-accent);
    width: 64px;
}

.hf-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 18px 12px;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.hf-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.hf-title svg {
    opacity: 0.85;
}

/* the single button of the panel */
.hf-plus-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--hf-text);
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    cursor: pointer;
    transition: background 200ms ease, border-color 200ms ease, transform 160ms ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.hf-plus-btn:hover {
    background: var(--hf-accent-soft);
    border-color: rgba(125, 243, 255, 0.44);
    transform: translateY(-1px);
}

.hf-plus-btn:active {
    transform: scale(0.94);
}

/* ---------- scrollable content ---------- */

.hf-content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 0 18px calc(30px + env(safe-area-inset-bottom, 0px));
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.hf-content .hf-section:first-child {
    margin-top: 4px;
}

.hf-content::-webkit-scrollbar {
    width: 6px;
}

.hf-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
}

/* content is visible (and loading) at peek, but inert until >= half */
#home-feed-root[data-state="peek"] .hf-content,
#home-feed-root.hf-dragging .hf-content {
    pointer-events: none;
}

/* ---------- sections ---------- */

.hf-section {
    margin-top: 18px;
}

.hf-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.hf-section-head h3 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hf-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.hf-section-head h3 svg {
    opacity: 0.7;
}

.hf-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--hf-muted);
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.hf-expand-btn:hover {
    color: var(--hf-text);
    background: var(--hf-accent-soft);
    border-color: rgba(125, 243, 255, 0.4);
}

.hf-expand-btn svg {
    transition: transform 220ms ease;
}

.hf-section.is-expanded .hf-expand-btn svg {
    transform: rotate(180deg);
}

/* horizontal scroller; becomes a wrapped grid when expanded */
.hf-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 10px;
    scroll-snap-type: x proximity;
    touch-action: pan-x;
    scrollbar-width: none;
}

.hf-row::-webkit-scrollbar {
    display: none;
}

/* Expanded: a full-width grid instead of a flex row, so cards spread evenly
   across the whole sheet instead of left-aligning fixed-width cards with a
   dead gap on the right. Column min differs per card type (each section
   renders exactly one card class, so :has() picks the right track size);
   1fr lets them stretch to fill the row. */
.hf-section.is-expanded .hf-row {
    display: grid;
    gap: 12px;
    overflow: visible;
    scroll-snap-type: none;
    touch-action: auto;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.hf-section.is-expanded .hf-row:has(.hf-card-user) {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}

.hf-section.is-expanded .hf-row:has(.hf-card-snippet) {
    grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
}

/* let the grid cell size each card instead of its fixed card width */
.hf-section.is-expanded .hf-card {
    width: auto;
}

.hf-empty,
.hf-loading {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 64px;
    padding: 0 6px;
    color: var(--hf-muted);
    font-size: 12.5px;
    white-space: nowrap;
}

.hf-loading svg {
    animation: hf-spin 1.1s linear infinite;
}

@keyframes hf-spin {
    to { transform: rotate(360deg); }
}

/* ---------- cards ---------- */

.hf-card {
    flex: 0 0 auto;
    scroll-snap-align: start;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.055);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: border-color 180ms ease, background 180ms ease, transform 160ms ease;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}

.hf-card:hover {
    border-color: rgba(125, 243, 255, 0.42);
    background: rgba(125, 243, 255, 0.08);
    transform: translateY(-2px);
}

/* star / world cards */
.hf-card-tile {
    width: 148px;
}

.hf-card-tile .hf-thumb {
    position: relative;
    width: 100%;
    height: 96px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hf-card-tile .hf-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hf-thumb .hf-thumb-fallback {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 0 24px currentColor;
    opacity: 0.85;
}

.hf-thumb-badge {
    position: absolute;
    right: 7px;
    bottom: 7px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--hf-text);
    background: rgba(5, 8, 14, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hf-card-tile .hf-card-body {
    padding: 9px 11px 11px;
}

.hf-card-name {
    font-size: 12.5px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hf-card-sub {
    margin-top: 3px;
    font-size: 11px;
    color: var(--hf-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* user chips */
.hf-card-user {
    width: 92px;
    padding: 12px 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    text-align: center;
}

.hf-avatar {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--hf-text);
    background: linear-gradient(140deg, rgba(125, 243, 255, 0.35), rgba(255, 118, 235, 0.30));
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.hf-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hf-card-user .hf-card-name {
    max-width: 100%;
    font-size: 11.5px;
}

.hf-card-user .hf-card-sub {
    justify-content: center;
    font-size: 10px;
    margin-top: 0;
}

/* asset cards — square interactive 3D preview */
.hf-card-asset {
    width: 148px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

/* was missing entirely: .hf-card-body only got padding when nested in
   .hf-card-tile, so asset cards had text/button flush against the edges. */
.hf-card-asset .hf-card-body {
    padding: 10px 11px 11px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hf-model-box {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: radial-gradient(80% 80% at 50% 42%, rgba(125, 243, 255, 0.10), rgba(255, 255, 255, 0.03));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hf-model-box canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;      /* drag rotates the model, not the row */
    cursor: grab;
}

.hf-model-box canvas:active {
    cursor: grabbing;
}

.hf-model-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hf-model-box .hf-model-fallback {
    color: rgba(255, 255, 255, 0.4);
}

.hf-model-box .hf-model-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(125, 243, 255, 0.7);
}

.hf-model-box .hf-model-spinner svg {
    animation: hf-spin 1.1s linear infinite;
}

.hf-card-asset .hf-collect-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 650;
    border-radius: 999px;
    color: var(--hf-text);
    border: 1px solid rgba(125, 243, 255, 0.4);
    background: var(--hf-accent-soft);
    cursor: pointer;
    transition: background 180ms ease, transform 140ms ease;
    touch-action: manipulation;
}

.hf-card-asset .hf-collect-btn:hover {
    background: rgba(125, 243, 255, 0.28);
}

.hf-card-asset .hf-collect-btn:active {
    transform: scale(0.95);
}

.hf-card-asset .hf-collect-btn[disabled] {
    opacity: 0.55;
    cursor: default;
}

/* snippet cards */
.hf-card-snippet {
    width: 252px;
    cursor: default;
    display: flex;
    flex-direction: column;
}

.hf-snippet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px 6px;
}

.hf-snippet-title {
    font-size: 12.5px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hf-lang-chip {
    flex: 0 0 auto;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2.5px 7px;
    border-radius: 999px;
    color: var(--hf-accent);
    border: 1px solid rgba(125, 243, 255, 0.35);
    background: rgba(125, 243, 255, 0.10);
}

.hf-card-snippet pre {
    margin: 0 10px;
    padding: 9px 10px;
    max-height: 108px;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(3, 5, 10, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.hf-card-snippet pre::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 34px;
    background: linear-gradient(transparent, rgba(3, 5, 10, 0.9));
}

.hf-card-snippet code {
    font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
    font-size: 10.5px;
    line-height: 1.5;
    color: rgba(214, 236, 255, 0.92);
    white-space: pre;
    display: block;
}

.hf-snippet-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 11px;
}

.hf-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    font-size: 11px;
    font-weight: 650;
    border-radius: 999px;
    color: var(--hf-text);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 180ms ease, border-color 180ms ease;
    touch-action: manipulation;
}

.hf-copy-btn:hover {
    background: var(--hf-accent-soft);
    border-color: rgba(125, 243, 255, 0.4);
}

.hf-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    color: var(--hf-muted);
}

/* ---------- "+" publish menu ---------- */

.hf-menu-layer {
    position: absolute;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    pointer-events: auto;
    z-index: 5;
}

.hf-menu-layer.is-open {
    display: flex;
}

/* Invisible click-catcher only — same fix as .hf-backdrop: a flat dark
   scrim over everything except the menu's own lit glass created a hard
   seam that read as a shadow. Outside-tap still closes the menu. */
.hf-menu-backdrop {
    position: absolute;
    inset: 0;
    background: transparent;
}

.hf-menu {
    position: relative;
    width: min(560px, calc(100% - 24px));
    max-height: min(78vh, 640px);
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    border: 1px solid var(--hf-glass-line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04) 90px),
        rgba(20, 22, 30, 0.72);
    backdrop-filter: blur(22px) saturate(170%);
    -webkit-backdrop-filter: blur(22px) saturate(170%);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), inset 0 1.5px 0 rgba(255, 255, 255, 0.4);
    overflow: hidden;
    animation: hf-menu-in 260ms cubic-bezier(0.22, 0.9, 0.26, 1);
}

@keyframes hf-menu-in {
    from { transform: translateY(26px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.hf-menu-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 16px 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.hf-menu-head h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    flex: 1;
}

.hf-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--hf-text);
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
    transition: background 180ms ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.hf-icon-btn:hover {
    background: var(--hf-accent-soft);
}

.hf-menu-body {
    /* flex:1 + min-height:0 is required for overflow-y:auto to actually
       constrain content inside a flex column with a max-height parent —
       without it the box just grows past the parent's max-height instead
       of scrolling (classic flexbox scrolling gotcha). */
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 16px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ---------- full-content viewer (code snippet / 3D asset) ---------- */

.hf-viewer-layer {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    pointer-events: auto;
    z-index: 7;
}

.hf-viewer-layer.is-open {
    display: flex;
}

/* invisible click-catcher only — same reasoning as .hf-backdrop/.hf-menu-backdrop */
.hf-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: transparent;
}

.hf-viewer {
    position: relative;
    width: min(520px, 100%);
    max-height: min(80vh, 620px);
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    border: 1px solid var(--hf-glass-line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04) 90px),
        rgba(20, 22, 30, 0.72);
    backdrop-filter: blur(22px) saturate(170%);
    -webkit-backdrop-filter: blur(22px) saturate(170%);
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.4);
    isolation: isolate;
    overflow: hidden;
    animation: hf-menu-in 220ms cubic-bezier(0.22, 0.9, 0.26, 1);
}

.hf-viewer-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 16px 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.hf-viewer-title {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hf-viewer-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 16px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.hf-viewer-snippet-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.hf-viewer-snippet-meta .hf-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.hf-viewer-code {
    margin: 0 0 14px;
    padding: 12px 14px;
    max-height: 340px;
    overflow: auto;
    border-radius: 12px;
    background: rgba(3, 5, 10, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.hf-viewer-code code {
    font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.6;
    color: rgba(214, 236, 255, 0.94);
    white-space: pre;
    display: block;
}

.hf-viewer-asset {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hf-model-box-lg {
    width: min(260px, 100%);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.13);
}

.hf-viewer-asset-meta {
    margin-top: 12px;
}

.hf-viewer-asset-meta .hf-card-sub {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    white-space: normal;
}

/* fixed footer — outside the scrollable body, so Copy/Collect stays
   reachable without scrolling past a long code block or a tall model. */
.hf-viewer-foot {
    flex: 0 0 auto;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.hf-viewer-foot:empty {
    display: none;
}

.hf-viewer-collect-btn,
.hf-viewer-copy-btn {
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
}

/* main menu options — the "rich SVG" rows */
.hf-menu-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    margin-bottom: 10px;
    text-align: left;
    border-radius: 16px;
    color: var(--hf-text);
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: border-color 180ms ease, background 180ms ease, transform 150ms ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.hf-menu-option:hover {
    border-color: rgba(125, 243, 255, 0.42);
    background: rgba(125, 243, 255, 0.08);
    transform: translateX(3px);
}

.hf-menu-option .hf-option-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hf-accent);
    background: rgba(125, 243, 255, 0.10);
    border: 1px solid rgba(125, 243, 255, 0.28);
}

.hf-menu-option .hf-option-text b {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
}

.hf-menu-option .hf-option-text span {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--hf-muted);
}

/* publish sub-views */
.hf-form label {
    display: block;
    margin: 12px 0 6px;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: 0.04em;
    color: var(--hf-muted);
    text-transform: uppercase;
}

.hf-form input[type="text"],
.hf-form select,
.hf-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--hf-text);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(3, 5, 10, 0.5);
    outline: none;
    transition: border-color 180ms ease;
}

.hf-form select option {
    background: #0b0e16;
    color: #fff;
}

.hf-form textarea {
    min-height: 150px;
    resize: vertical;
    font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.5;
}

.hf-form input:focus,
.hf-form select:focus,
.hf-form textarea:focus {
    border-color: rgba(125, 243, 255, 0.55);
}

.hf-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 11px 22px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 999px;
    color: #06121a;
    border: 1px solid rgba(125, 243, 255, 0.6);
    background: linear-gradient(135deg, rgba(125, 243, 255, 0.95), rgba(96, 190, 255, 0.9));
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 180ms ease;
    touch-action: manipulation;
}

.hf-primary-btn:hover {
    box-shadow: 0 8px 26px rgba(125, 243, 255, 0.3);
    transform: translateY(-1px);
}

.hf-primary-btn[disabled] {
    opacity: 0.5;
    cursor: default;
    transform: none;
    box-shadow: none;
}

/* publish list rows (my assets / my stars) */
.hf-publish-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.hf-publish-row:last-child {
    border-bottom: none;
}

.hf-publish-thumb {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 11px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hf-muted);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.hf-publish-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hf-publish-info {
    flex: 1;
    min-width: 0;
}

.hf-publish-info b {
    display: block;
    font-size: 12.5px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hf-publish-info span {
    display: block;
    font-size: 10.5px;
    color: var(--hf-muted);
    margin-top: 2px;
}

/* glass switch (public / private) */
.hf-switch {
    flex: 0 0 auto;
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 200ms ease, border-color 200ms ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.hf-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 200ms cubic-bezier(0.22, 0.9, 0.26, 1), background 200ms ease;
}

.hf-switch[aria-checked="true"] {
    background: rgba(125, 243, 255, 0.35);
    border-color: rgba(125, 243, 255, 0.6);
}

.hf-switch[aria-checked="true"]::after {
    transform: translateX(20px);
    background: #eafcff;
}

.hf-switch[disabled] {
    opacity: 0.5;
    cursor: default;
}

/* ---------- toast ---------- */

.hf-toast {
    position: absolute;
    left: 50%;
    bottom: 26px;
    transform: translate(-50%, 14px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 12.5px;
    font-weight: 650;
    border-radius: 999px;
    color: var(--hf-text);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(9, 10, 14, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease;
    z-index: 8;
    white-space: nowrap;
}

.hf-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.hf-toast svg {
    color: var(--hf-accent);
}

/* ---------- star-popup favorite button (next to the close X) ---------- */

#info-panel #favorite-object-btn {
    position: absolute;
    top: 12px;
    right: 68px;   /* close btn is 48px wide at right:12px */
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: rgba(10, 12, 18, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    z-index: 8;
    transition: background 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

#info-panel #favorite-object-btn:hover {
    background: rgba(125, 243, 255, 0.16);
    border-color: rgba(125, 243, 255, 0.44);
}

#info-panel #favorite-object-btn[aria-pressed="true"] svg {
    fill: var(--hf-accent);
    stroke: var(--hf-accent);
    filter: drop-shadow(0 0 6px rgba(125, 243, 255, 0.5));
}

/* ---------- nav coexistence (galaxy bottom nav floats above the peek) ---------- */

body.home-feed-peek #solar-system-nav {
    bottom: calc(var(--hf-peek-height) + 14px) !important;
    transition: bottom 300ms cubic-bezier(0.22, 0.9, 0.26, 1), opacity 240ms ease;
}

body.home-feed-expanded #solar-system-nav {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ---------- mobile ---------- */

@media (max-width: 700px) {
    :root {
        --hf-width: 100vw;
    }

    .hf-sheet-glass {
        border-radius: 22px 22px 0 0;
        border-left: none;
        border-right: none;
    }

    .hf-card-tile,
    .hf-card-asset {
        width: 132px;
    }

    .hf-card-snippet {
        width: 232px;
    }

    .hf-content {
        padding-left: 14px;
        padding-right: 14px;
    }
}
