/**
 * CS2 marketplace layer for the landing page - copied from the deposit
 * reference UI (templates/index.html <style> block) on top of the design system
 * in deposit-main.css / deposit-animations.css.
 *
 * Everything below the "portal additions" divider is new: the reference cards
 * only show a name and a price, while the panel payload also carries trade
 * state, hold days, float and a max price.
 */

/* =============================================
   RESPONSIVE SCALING TOKENS
   ============================================= */
:root {
    --item-card-min-width: clamp(200px, 15vw, 280px);
    --item-card-gap: clamp(1rem, 2vw, 2rem);
    --item-card-padding: clamp(0.75rem, 1.5vw, 1.25rem);
    --item-card-border-radius: clamp(8px, 1vw, 16px);
    /* Compact Buff-like name under large square image; price slightly larger */
    --item-name-size: clamp(0.66rem, 0.9vw, 0.76rem);
    --item-price-size: clamp(0.78rem, 1.05vw, 0.88rem);
    /* Single-line truncated names (Buff-style); keep token for legacy calc refs */
    --item-name-height: 1.35em;

    --glass-card-margin-bottom: clamp(1rem, 2vw, 2rem);
    --typing-text-size: clamp(1.5rem, 4vw, 3.5rem);
    --stat-value-size: clamp(1.5rem, 3vw, 2.5rem);
    --search-input-padding: clamp(0.6rem, 1.5vw, 1rem);
    --filter-select-padding: clamp(0.4rem, 1vw, 0.75rem);
}

@media (min-width: 3840px) {
    :root {
        --item-card-min-width: 320px;
        --item-card-gap: 2.5rem;
        --item-card-padding: 1.5rem;
        --item-name-size: 0.85rem;
        --item-price-size: 1rem;

        --glass-card-margin-bottom: 3rem;
        --typing-text-size: 4rem;
        --stat-value-size: 3rem;
        --search-input-padding: 1.2rem;
        --filter-select-padding: 1rem;
    }
}

@media (min-width: 2560px) and (max-width: 3839px) {
    :root {
        --item-card-min-width: 280px;
        --item-card-gap: 2rem;
        --item-card-padding: 1.25rem;
        --item-name-size: 0.8rem;
        --item-price-size: 0.95rem;

        --glass-card-margin-bottom: 2rem;
        --typing-text-size: 3rem;
        --stat-value-size: 2rem;
        --search-input-padding: 1rem;
        --filter-select-padding: 0.75rem;
    }
}

@media (min-width: 1920px) and (max-width: 2559px) {
    :root {
        --item-card-min-width: 220px;
        --item-card-gap: 1.5rem;
        --item-card-padding: 1rem;
        --item-name-size: 0.74rem;
        --item-price-size: 0.88rem;

        --glass-card-margin-bottom: 1.5rem;
        --typing-text-size: 2.4rem;
        --stat-value-size: 1.8rem;
        --search-input-padding: 0.9rem;
        --filter-select-padding: 0.65rem;
    }
}

@media (min-width: 1366px) and (max-width: 1919px) {
    :root {
        --item-card-min-width: 200px;
        --item-card-gap: 1.25rem;
        --item-card-padding: 0.875rem;
        --item-name-size: 0.7rem;
        --item-price-size: 0.84rem;

        --glass-card-margin-bottom: 1.4rem;
        --typing-text-size: 2.1rem;
        --stat-value-size: 1.6rem;
        --search-input-padding: 0.8rem;
        --filter-select-padding: 0.6rem;
    }
}

@media (min-width: 1024px) and (max-width: 1365px) {
    :root {
        --item-card-min-width: 180px;
        --item-card-gap: 1rem;
        --item-card-padding: 0.75rem;
        --item-name-size: 0.68rem;
        --item-price-size: 0.82rem;

        --glass-card-margin-bottom: 1.3rem;
        --typing-text-size: 1.95rem;
        --stat-value-size: 1.5rem;
        --search-input-padding: 0.75rem;
        --filter-select-padding: 0.55rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    :root {
        --item-card-min-width: 160px;
        --item-card-gap: 0.875rem;
        --item-card-padding: 0.75rem;
        --item-name-size: 0.66rem;
        --item-price-size: 0.8rem;

        --glass-card-margin-bottom: 1.2rem;
        --typing-text-size: 1.8rem;
        --stat-value-size: 1.4rem;
        --search-input-padding: 0.7rem;
        --filter-select-padding: 0.5rem;
    }

    .filters-container {
        gap: 0.5rem;
    }
}

@media (min-width: 481px) and (max-width: 767px) {
    :root {
        --item-card-min-width: 160px;
        --item-card-gap: 0.875rem;
        --item-card-padding: 0.75rem;
        --item-name-size: 0.66rem;
        --item-price-size: 0.8rem;

        --glass-card-margin-bottom: 1rem;
        --typing-text-size: 1.5rem;
        --stat-value-size: 1.25rem;
        --search-input-padding: 0.6rem;
        --filter-select-padding: 0.45rem;
    }

    .items-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 1.5rem;
    }

    .search-container {
        flex-direction: column;
    }

    .search-input {
        min-width: 100%;
    }

    .filters-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .filter-select, .price-filter, .clear-btn, .btn-small {
        width: 100%;
    }

    .filters-container > .ui-select-host--filter {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    :root {
        --item-card-min-width: 150px;
        --item-card-gap: 0.625rem;
        --item-card-padding: 0.625rem;
        --item-name-size: 0.64rem;
        --item-price-size: 0.78rem;
        --item-card-border-radius: 8px;
        --glass-card-margin-bottom: 0.8rem;
        --typing-text-size: 1.2rem;
        --stat-value-size: 1.1rem;
        --search-input-padding: 0.65rem;
        --filter-select-padding: 0.55rem;
    }

    .header {
        margin-bottom: 1.5rem;
    }

    .stats-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .stats-row .stat-label {
        font-size: 0.62rem;
        letter-spacing: 0.5px;
    }

    .items-grid {
        margin-top: 1.25rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-container {
        flex-direction: column;
    }

    .search-input {
        min-width: 100%;
        font-size: 16px;
    }

    .filters-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .filter-select, .price-filter, .clear-btn, .btn-small {
        width: 100%;
        font-size: 16px;
        min-height: 44px;
    }

    .price-filter .price-input {
        flex: 1;
        min-width: 0;
    }

    .clear-btn, .btn-small {
        min-height: 44px;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .pagination-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-width: 44px;
        min-height: 44px;
    }

    .btn {
        min-width: 0;
        width: 100%;
        padding: 0.65rem 1rem;
        font-size: 0.85rem;
        min-height: 44px;
    }

    .view-item {
        font-size: 0.7rem;
        letter-spacing: 0.5px;
    }

    .user-nav {
        max-width: 100%;
        padding: 0 0.25rem;
    }

    .user-avatar-container {
        min-width: 0;
        max-width: 100%;
    }
}

/* =============================================
   ITEM GRID & CARDS
   ============================================= */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--item-card-min-width), 1fr));
    gap: var(--item-card-gap);
    margin-top: 2rem;
    position: relative;
    z-index: 1;
}

@media (min-width: 1100px) {
    .items-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.item-card {
    background: rgba(30, 30, 46, 0.8);
    border-radius: var(--item-card-border-radius);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: block;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    height: auto;
    min-height: fit-content;
    min-width: 0;
}

.item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.25), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.item-card:has(.ui-hint-tip--stable.ui-hint-tip--open) {
    position: relative;
    z-index: 8;
    overflow: visible;
}

.item-image-wrapper:has(.ui-hint-tip--stable.ui-hint-tip--open),
.item-info:has(.ui-hint-tip--stable.ui-hint-tip--open),
.item-card-wear:has(.ui-hint-tip--stable.ui-hint-tip--open) {
    overflow: visible;
}

.ui-hint-tip--abs.ui-hint-tip--stable {
    z-index: 6;
}

.item-image-wrapper {
    position: relative;
    /* Buff-style: large square image plane dominates the card */
    aspect-ratio: 1 / 1;
    padding-top: 0;
    width: 100%;
    background:
        radial-gradient(ellipse 70% 60% at 50% 48%, rgba(88, 70, 140, 0.28) 0%, transparent 68%),
        rgba(18, 16, 32, 0.98);
    overflow: hidden;
}

.item-image {
    position: absolute;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 4%;
    box-sizing: border-box;
    object-fit: contain;
    object-position: center;
    transform: none;
    transition: transform 0.2s ease;
}

.item-card:hover .item-image {
    transform: scale(1.06);
}

.item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(139, 92, 246, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.item-card:hover .item-overlay {
    opacity: 1;
}

.view-item {
    color: white;
    font-weight: 600;
    font-size: clamp(0.75rem, 1vw, 1rem);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.item-info {
    padding: 0.55rem 0.7rem 0.65rem;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.2rem;
}

.item-name {
    font-size: var(--item-name-size);
    font-weight: 600;
    color: #e4e4e7;
    margin: 0;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 0;
    line-height: 1.35;
    max-width: 100%;
    box-sizing: border-box;
}

.item-price {
    font-size: var(--item-price-size);
    font-weight: 700;
    color: #8b5cf6;
    font-family: 'JetBrains Mono', monospace;
    margin: 0;
    line-height: 1.2;
}

/* Compact float wear bar on marketplace cards (detail page uses .detail-wear) */
.item-card-wear {
    margin-top: 0.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.item-card-float {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 500;
    color: #71717a;
    letter-spacing: 0.02em;
    line-height: 1;
}

.item-card-float-muted {
    opacity: 0.7;
}

.item-card-wear .wear-bar {
    /* Cancel detail-page .wear-bar { flex: 1 } so the track keeps height in this column stack. */
    flex: none;
    flex-shrink: 0;
    background: linear-gradient(90deg, #0ea5e9 0%, #22c55e 7%, #a3e635 15%, #eab308 38%, #f59e42 45%, #ef4444 100%);
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 7px;
    min-height: 7px;
    border-radius: 3px;
    position: relative;
    overflow: visible;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
}

.item-card-wear .wear-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.72);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 1;
}

.item-card-wear .wear-marker {
    position: absolute;
    top: -5px;
    color: #fff;
    transform: translateX(-50%);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
    pointer-events: none;
    z-index: 2;
}

.item-card-wear .wear-marker svg {
    width: 6px;
    height: 7px;
    display: block;
}

/* =============================================
   STATS, SEARCH & FILTER BAR
   ============================================= */
.stats-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: clamp(1.25rem, 4vw, 2.5rem);
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    min-width: 5.5rem;
}

.stat-value {
    font-size: var(--stat-value-size);
    font-weight: 700;
    color: #8b5cf6;
    font-family: 'JetBrains Mono', monospace;
    text-shadow: 0 2px 8px rgba(139, 92, 246, 0.5);
}

.stat-label {
    font-size: 0.85rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

.responsive-glass-card {
    padding: var(--glass-card-padding) !important;
    border-radius: var(--glass-card-border-radius) !important;
}

.responsive-title {
    font-size: var(--typing-text-size) !important;
}

/* Hero titles: solid accent like Roblox163 .landing-eyebrow (not gradient clip) */
.typing-text.responsive-title {
    background: none;
    background-clip: unset;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    color: #8b5cf6; /* same as --accent / .landing-eyebrow */
    text-shadow: none;
}

.search-input {
    padding: var(--search-input-padding) !important;
}

.filter-select, .price-input {
    padding: var(--filter-select-padding) !important;
}

.search-container {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filters-container {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
    z-index: 30;
    overflow: visible;
}

/* Filter glass-card must not clip upgraded combobox menus; elevate while open. */
.glass-card:has(.filters-container) {
    overflow: visible;
    position: relative;
    z-index: 6;
}

.glass-card:has(.filters-container .ui-combobox.is-open),
.glass-card.has-open-combobox {
    z-index: 60;
    overflow: visible;
}

.price-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
    padding: 1rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    background: rgba(30, 30, 46, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    color: #e4e4e7;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
}

.pagination-btn:hover:not(.active) {
    background: rgba(139, 92, 246, 0.2);
    border-color: #8b5cf6;
    transform: translateY(-2px);
}

.pagination-btn.active {
    background: #7c3aed;
    border-color: #8b5cf6;
    color: white;
    cursor: default;
}

.pagination-dots {
    color: #94a3b8;
    padding: 0 0.5rem;
}

/* =============================================
   SKELETON LOADING CARDS
   ============================================= */
.skeleton-card {
    background: rgba(30, 30, 46, 0.6) !important;
    border: 1px solid rgba(139, 92, 246, 0.1) !important;
    pointer-events: none;
}

.skeleton-shimmer {
    background: rgba(139, 92, 246, 0.12) !important;
    animation: skeletonShimmer 1.5s infinite;
}

.skeleton-image {
    width: 60%;
    height: 60%;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 8px;
    margin: 20% auto;
}

.skeleton-text {
    background: rgba(139, 92, 246, 0.15);
    border-radius: 4px;
    animation: skeletonShimmer 1.5s infinite;
    background-size: 200% 100%;
}

.skeleton-title {
    height: 1rem;
    margin-bottom: 0.5rem;
    width: 80%;
}

.skeleton-price {
    height: 1.2rem;
    width: 60%;
}

/* The design system already owns @keyframes shimmer (a translate sweep), so the
   skeleton's background-position sweep needs its own name. */
@keyframes skeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* =============================================
   TOP BAR + SITE NAV (landing / item pages)
   ============================================= */
body.landing-with-topbar {
    padding-top: 4.25rem;
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    background: rgba(10, 10, 15, 0.92);
    border-bottom: 1px solid rgba(139, 92, 246, 0.25);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.site-nav-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

/* Strip button UA chrome only. Do not set color/font: inherit here - 
   button.site-nav-link is more specific than .site-nav-link and would
   pull body #e4e4e7 / 16px, making Contact louder than the <a> items. */
button.site-nav-link {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    box-shadow: none;
    margin: 0;
    cursor: pointer;
    font-family: inherit;
    text-align: inherit;
}

.site-nav-link:hover,
.site-nav-link.active,
.site-nav-link:focus-visible,
button.site-nav-link[aria-expanded="true"] {
    color: #e4e4e7;
    background: rgba(139, 92, 246, 0.15);
    outline: none;
}

.nav-contact-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.nav-contact-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1100;
    min-width: 172px;
    padding: 4px;
    border-radius: 10px;
    background: rgba(14, 14, 22, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
}

.nav-contact-panel[hidden] {
    display: none;
}

.nav-contact-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    text-decoration: none;
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    transition: color 0.15s ease, background 0.15s ease;
}

.nav-contact-link:hover {
    color: #e4e4e7;
    background: rgba(139, 92, 246, 0.12);
}

.nav-contact-handle {
    color: #a78bfa;
    font-weight: 600;
}

.nav-contact-link:hover .nav-contact-handle {
    color: #c4b5fd;
}

.site-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    background: rgba(30, 30, 46, 0.6);
    color: #e4e4e7;
    cursor: pointer;
    flex-shrink: 0;
}

.site-nav-toggle:hover {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.15);
}

/* =============================================
   TOP-RIGHT USER NAV
   ============================================= */
.user-nav {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    animation: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/*
 * Header user control - compact deposit-method-tab card (icon + title + subtitle).
 * Primary click navigates to /portal/profile (no dropdown).
 */
.header-user-tab,
a.header-user-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    min-width: 0;
    max-width: 220px;
    border-radius: 12px;
    background: rgba(15, 15, 23, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #e2e8f0;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
    box-sizing: border-box;
}

.header-user-tab:hover,
a.header-user-tab:hover {
    border-color: rgba(139, 92, 246, 0.45);
    background: rgba(139, 92, 246, 0.1);
    color: #f1f5f9;
}

.header-user-tab-icon,
.header-user-tab .deposit-card-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    overflow: hidden;
}

.header-user-tab .deposit-method-tab-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.header-user-tab .deposit-method-tab-title,
.header-user-tab #user-name {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    color: inherit;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-user-tab .deposit-method-tab-sub,
.header-user-tab #user-tab-sub {
    font-size: 0.65rem;
    font-weight: 500;
    color: #64748b;
    line-height: 1.2;
}

.header-user-tab:hover .deposit-method-tab-sub,
.header-user-tab:hover #user-tab-sub {
    color: #94a3b8;
}

.header-user-tab .avatar-placeholder,
.header-user-tab #user-initials.avatar-placeholder {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    max-width: 28px;
    max-height: 28px;
    flex: 0 0 28px;
    border: 2px solid #8b5cf6;
    background: #0a0a0f;
    color: #c4b5fd;
    font-size: 0.62rem;
}

/* Legacy dropdown shells (kept inert if any page still nests them) */
.user-dropdown {
    position: relative;
    background: transparent;
    border-radius: 0;
    border: none;
    backdrop-filter: none;
    box-shadow: none;
    transition: none;
}

.user-dropdown:hover {
    border: none;
    box-shadow: none;
    transform: none;
}

.user-avatar-container {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.25rem 0.35rem;
    cursor: pointer;
    border-radius: 8px;
    border: none;
    background: transparent;
    transition: background 0.2s ease;
    min-width: 0;
    width: auto;
    max-width: none;
    position: relative;
}

.user-avatar-container:hover {
    background: rgba(139, 92, 246, 0.1);
}

/* Legacy wrapper - inert if any page still nests it */
.user-avatar-border {
    display: contents;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    background: none !important;
    background-image: none !important;
    box-shadow: none;
    flex-shrink: 0;
}

.user-avatar-container:hover .user-avatar-border {
    box-shadow: none;
}

/*
 * Roblox163 .header-avatar / .sb-user-avatar:
 * dark fill + solid violet ring - no gradient fill or ring.
 */
.avatar-placeholder,
#user-initials.avatar-placeholder {
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    min-width: 28px;
    max-width: 28px;
    min-height: 28px;
    max-height: 28px;
    aspect-ratio: 1 / 1;
    flex: 0 0 28px;
    border-radius: 50%;
    border: 2px solid #8b5cf6;
    background: #0a0a0f;
    background-image: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    color: #c4b5fd;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: box-shadow 0.2s ease;
    overflow: hidden;
}

.user-avatar-container:hover .avatar-placeholder {
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.user-name,
#user-name.user-name {
    display: block;
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.2;
    flex: 0 1 auto;
    width: auto;
    min-width: 3ch;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 1;
    visibility: visible;
    transition: color 0.2s ease;
    text-shadow: none;
}

.user-avatar-container:hover .user-name {
    color: #f1f5f9;
}

.dropdown-arrow {
    flex: 0 0 auto;
    font-size: 0.55rem;
    line-height: 1;
    color: #94a3b8;
    transition: transform 0.2s ease, color 0.2s ease;
    text-shadow: none;
}

.user-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
    color: #a78bfa;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    width: max(100%, 180px);
    min-width: 180px;
    background: rgba(15, 15, 23, 0.9);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 16px;
    padding: 0.75rem 0;
    backdrop-filter: blur(20px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 6px 20px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-15px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
}

.user-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    color: #e2e8f0;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.dropdown-item::before {
    display: none;
}

.dropdown-item:hover {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.logout-item:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

.dropdown-divider {
    height: 1px;
    background: rgba(139, 92, 246, 0.25);
    margin: 0.75rem 0;
    position: relative;
}

.dropdown-divider::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 4px;
    background: #8b5cf6;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

.signin-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: rgba(30, 30, 46, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    color: #e4e4e7;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    justify-content: center;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.9rem;
}

.signin-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: #8b5cf6;
    color: #e4e4e7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

@media (max-width: 768px) {
    body.landing-with-topbar {
        padding-top: 3.75rem;
    }

    .top-bar {
        padding: 0.65rem 1rem;
        flex-wrap: wrap;
    }

    .site-nav-toggle {
        display: flex;
    }

    .top-bar-left {
        position: relative;
        flex: 1 1 auto;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: calc(100% + 0.5rem);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem;
        background: rgba(10, 10, 15, 0.98);
        border: 1px solid rgba(139, 92, 246, 0.25);
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
        z-index: 1001;
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav-link {
        padding: 0.75rem 1rem;
    }

    .nav-contact-wrap {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .nav-contact-panel {
        position: static;
        margin-top: 0.25rem;
        width: 100%;
        min-width: 0;
        box-shadow: none;
    }

    .nav-contact-link {
        justify-content: flex-start;
    }

    .user-nav {
        position: relative;
        top: auto;
        right: auto;
        margin: 0;
        width: auto;
        max-width: none;
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
        flex-shrink: 0;
    }

    .user-dropdown {
        width: 100%;
    }

    .user-avatar-container {
        min-width: 0;
        width: auto;
        max-width: 100%;
        padding: 0.3rem 0.4rem;
        min-height: 0;
    }

    .user-name,
    #user-name.user-name {
        max-width: min(140px, 40vw);
        flex: 0 1 auto;
        font-size: 0.78rem;
        display: block;
        color: #e2e8f0;
        opacity: 1;
        visibility: visible;
    }

    .signin-btn {
        min-width: 0;
        width: auto;
        padding: 0.55rem 1rem;
        font-size: 0.8rem;
        min-height: 40px;
    }

    .dropdown-menu {
        position: fixed;
        top: auto;
        right: 1rem;
        left: 1rem;
        width: auto;
        margin-top: 0.5rem;
    }

    .stats-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.75rem;
        width: 100%;
    }

    .items-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.875rem;
    }

    .filters-container .filter-select,
    .filters-container .price-input,
    .filters-container .clear-btn,
    .filters-container .btn-small {
        min-height: 44px;
    }
}

/* =============================================
   PORTAL ADDITIONS - no equivalent in the reference
   The panel payload carries trade state, hold days, float and a max price;
   the reference card only had a name and a single price.
   ============================================= */
/* Cards are anchors into /portal/item?id=... - the reference markup used a div. */
.item-card {
    color: inherit;
    text-decoration: none;
}

.item-overlay {
    flex-direction: column;
    gap: 0.25rem;
}

.view-item-sub {
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(0.6rem, 0.8vw, 0.8rem);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
}

/* deposit-main.css stretches every input/select to width:100%, which would put
   each filter on its own row inside the flex bar. */
.filters-container .filter-select,
.filters-container .price-input {
    width: auto;
}

/* Mobile: upgraded combobox hosts ignored the native width:100% rules — stretch them. */
@media (max-width: 767px) {
    .filters-container {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: 0.55rem;
        width: 100%;
    }

    .filters-container > .ui-select-host--filter,
    .filters-container > .filter-select {
        width: 100%;
        min-width: 0;
        max-width: none;
        flex: none;
    }

    .filters-container > .ui-select-host--filter .ui-combobox,
    .filters-container > .ui-select-host--filter .ui-combobox-trigger {
        width: 100%;
    }

    .filters-container > .price-filter {
        grid-column: 1 / -1;
        width: 100%;
        display: flex;
        align-items: center;
        gap: 0.45rem;
    }

    .filters-container > .price-filter .price-input {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
    }

    .filters-container > .clear-btn,
    .filters-container > .btn-small {
        width: 100%;
        min-width: 0;
        justify-self: stretch;
    }
}

@media (max-width: 380px) {
    /* Very narrow phones: stack selects one per row for readable labels. */
    .filters-container {
        grid-template-columns: 1fr;
    }

    .filters-container > .clear-btn,
    .filters-container > .btn-small {
        grid-column: 1;
    }
}

.item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.25rem;
}

.item-tag {
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* Buff-style exterior chip: inset so card border-radius does not clip a corner */
.item-tag-on-image {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    z-index: 3;
    margin: 0;
    border-radius: 4px;
    pointer-events: none;
    line-height: 1.2;
    max-width: calc(100% - 0.9rem);
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-tag-ready {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.35);
    color: #10b981;
}

.item-tag-hold {
    background: rgba(251, 191, 36, 0.14);
    border-color: rgba(251, 191, 36, 0.35);
    color: #fbbf24;
}

.item-tag-locked {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

.item-tag-muted {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

.item-tag-phase {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
}

.item-tag-phase-ruby {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.item-tag-phase-sapphire {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

.item-tag-phase-blackpearl {
    background: rgba(226, 232, 240, 0.1);
    border-color: rgba(226, 232, 240, 0.35);
    color: #e2e8f0;
}

.item-tag-phase-emerald {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.item-badge-hold {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 15, 23, 0.85);
    border: 1px solid rgba(251, 191, 36, 0.45);
    color: #fbbf24;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.item-badge-qty {
    position: absolute;
    top: auto;
    bottom: 0.55rem;
    left: 0.55rem;
    z-index: 4;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 15, 23, 0.85);
    border: 1px solid rgba(139, 92, 246, 0.55);
    color: #c4b5fd;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    pointer-events: auto;
}

.grid-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
}

.grid-message.is-error {
    color: #ef4444;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.section-title h2 {
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: #e4e4e7;
    font-family: 'JetBrains Mono', monospace;
}

.section-note {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* =============================================
   ITEM DETAIL PAGE
   Ported from the deposit reference detail view (templates/detail.html), minus
   its Chinese-market listing table - this catalog exposes a single USD price
   pair per item instead.
   ============================================= */
.detail-card {
    margin: 2rem auto;
    max-width: 1200px;
    padding: 2.2rem 2rem 2.5rem 2rem;
    /* .glass-card uses overflow:hidden; keep wear marker / tooltips visible. */
    overflow: visible;
}

.detail-back {
    display: inline-block;
    margin-bottom: 2rem;
}

.detail-header {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.detail-img {
    position: relative;
    min-width: 220px;
    margin-bottom: 1.5rem;
    background: rgba(22, 18, 40, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.detail-img .item-tag-on-image {
    /* same inset chip as list cards — clears detail image radius */
    border-radius: 4px;
}

.detail-img img {
    max-width: 260px;
    width: 100%;
    border-radius: 12px;
    transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-img img:hover {
    transform: scale(1.05);
}

.detail-info {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.detail-title {
    font-size: clamp(1.15rem, 2.4vw, 1.9rem) !important;
    margin-bottom: 0.3rem;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
    word-break: break-word;
    /* .typing-text gradient clip can hide/clip long multi-line names */
    background: none;
    background-clip: unset;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    color: #8b5cf6;
}

.detail-subtitle {
    color: #a3a3a3;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    line-height: 1.2;
    min-height: 1.2em;
}

.detail-prices {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
    margin-bottom: 0.7rem;
    flex-wrap: wrap;
}

.detail-label {
    font-size: 0.85rem;
    color: #8b5cf6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 700;
    color: #e4e4e7;
    font-family: 'JetBrains Mono', monospace;
    text-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.detail-actions {
    display: flex;
    gap: 0.7rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.detail-wear {
    margin-top: 2.5rem;
    overflow: visible;
}

.detail-wear-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    /* Room for .wear-marker sitting above the track (top: -12px). */
    padding-top: 14px;
    overflow: visible;
}

.detail-wear-value {
    font-family: 'JetBrains Mono', monospace;
    color: #e4e4e7;
    font-weight: 600;
    min-width: 7rem;
    flex: 0 0 auto;
}

.wear-bar {
    background: linear-gradient(90deg, #0ea5e9 0%, #22c55e 7%, #a3e635 15%, #eab308 38%, #f59e42 45%, #ef4444 100%);
    /* flex-basis:auto so height:16px survives column stacks on mobile (flex:1 → 0% collapses). */
    flex: 1 1 auto;
    min-width: 200px;
    max-width: 500px;
    height: 16px;
    min-height: 16px;
    border-radius: 8px;
    position: relative;
    overflow: visible;
    align-self: center;
}

.wear-marker {
    position: absolute;
    top: -12px;
    left: 0;
    color: #fff;
    transform: translateX(-50%);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
    pointer-events: none;
    z-index: 2;
    line-height: 0;
}

.wear-marker svg {
    display: block;
}

.detail-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 2.5rem;
}

.detail-fact {
    background: rgba(30, 30, 46, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
}

.detail-fact-value {
    color: #e4e4e7;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    word-break: break-word;
}

.detail-fact-value a {
    color: #a78bfa;
}

/* Stacked group listings (Youpin/C5-style float rows) */
.detail-stack {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.detail-stack-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 1rem;
}

.stack-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 0.65rem 0.85rem;
    align-items: center;
    padding: 0.65rem 0.85rem;
    background: rgba(30, 30, 46, 0.55);
    border: 1px solid rgba(139, 92, 246, 0.22);
    border-radius: 12px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.stack-row-thumb {
    position: relative;
    flex-shrink: 0;
    width: 96px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(17, 4, 42, 0.65);
    border: 1px solid rgba(139, 92, 246, 0.22);
}

.stack-row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: radial-gradient(ellipse at center, rgba(60, 40, 90, 0.35), transparent 70%);
}

.cm-gift-listings .stack-row {
    gap: 0.4rem 0.55rem;
    padding: 0.4rem 0.55rem;
    border-radius: 9px;
}

.cm-gift-listings .stack-row-thumb {
    width: 72px;
    height: 54px;
    border-radius: 7px;
}

.cm-gift-listings .stack-row-main {
    gap: 0.22rem;
}

.cm-gift-listings .stack-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.35rem;
}

.cm-gift-listings .stack-row-inspect {
    gap: 0.2rem;
    margin-left: 0;
}

.cm-gift-listings .stack-row .item-card-wear {
    max-width: 200px;
}

.cm-gift-listings .stack-row .item-card-wear-head {
    display: flex;
    align-items: center;
    gap: 0.28rem;
    flex-wrap: wrap;
    min-width: 0;
}

.cm-gift-listings .stack-row .item-card-float {
    font-size: 0.72rem;
}

.cm-gift-listings .stack-row .item-card-wear-head .stack-row-inspect {
    gap: 0.16rem;
    margin-left: 0;
    flex-shrink: 0;
}

.cm-gift-listings .stack-row-stickers {
    gap: 2px;
    margin-top: 0.2rem;
}

.cm-gift-listings .stack-row-sticker {
    width: 32px;
    height: 32px;
    border-radius: 5px;
    padding: 1px;
}

.cm-gift-listings .stack-row-sticker.is-text {
    min-width: 32px;
    font-size: 0.55rem;
    padding: 0 0.25rem;
}

.cm-gift-listings .stack-row-price {
    font-size: 0.88rem;
    gap: 0.06rem;
}

.cm-gift-listings .stack-row-price-raw {
    font-size: 0.64rem;
}

.cm-gift-listings .stack-row-thumb .stack-row-source {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    display: block;
    margin: 0;
    padding: 0.1rem 0.28rem;
    font-size: 0.52rem;
    font-weight: 600;
    font-family: Inter, system-ui, sans-serif;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    color: #e2e8f0;
    background: linear-gradient(180deg, rgba(15, 15, 24, 0.88) 0%, rgba(15, 15, 24, 0.55) 100%);
    border: 0;
    border-radius: 0;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-gift-listings .stack-row-buy {
    min-width: 3.4rem;
    padding: 0.32rem 0.65rem;
    font-size: 0.74rem;
}

.cm-gift-listings .stack-row-inspect-btn,
.cm-gift-listings button.stack-row-inspect-btn,
.cm-gift-listings a.stack-row-inspect-btn {
    font-size: 0.52rem;
    padding: 0.04rem 0.22rem;
}

@media (max-width: 640px) {
    .cm-gift-listings .stack-row {
        gap: 0.3rem 0.45rem;
        padding: 0.35rem 0.45rem;
    }

    .cm-gift-listings .stack-row-thumb {
        width: 60px;
        height: 46px;
    }

    .cm-gift-listings .stack-row-sticker {
        width: 28px;
        height: 28px;
    }

    .cm-gift-listings .stack-row-buy {
        padding: 0.28rem 0.5rem;
        font-size: 0.7rem;
    }
}

.stack-row:hover {
    border-color: rgba(139, 92, 246, 0.45);
    background: rgba(30, 30, 46, 0.72);
}

.stack-row.is-selected {
    border-color: rgba(139, 92, 246, 0.75);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.08);
}

.stack-row-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stack-row .item-card-wear {
    max-width: 220px;
    margin-top: 0;
}

.stack-row .item-card-wear-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    min-width: 0;
}

.stack-row .item-card-wear-head .stack-row-inspect {
    flex-shrink: 0;
}

.stack-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.stack-row-meta-link {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: #c4b5fd;
    text-decoration: none;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.1);
}

.stack-row-meta-link:hover {
    color: #ede9fe;
    border-color: rgba(167, 139, 250, 0.55);
}

button.stack-row-meta-link,
button.stack-row-inspect-btn {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

/* Tiny 2D / 3D inspect actions — match item-tag scale, quieter than Gift CTA */
.stack-row-inspect {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.stack-row-inspect-btn,
button.stack-row-inspect-btn,
a.stack-row-inspect-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-family: Inter, system-ui, sans-serif;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    text-decoration: none;
    padding: 0.06rem 0.28rem;
    border-radius: 4px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: transparent;
    line-height: 1.15;
    min-height: 0;
    height: auto;
    margin: 0;
    transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.stack-row-inspect-btn:hover,
button.stack-row-inspect-btn:hover,
a.stack-row-inspect-btn:hover {
    color: #e2e8f0;
    border-color: rgba(167, 139, 250, 0.45);
    background: rgba(139, 92, 246, 0.12);
}

/* Market image lightbox — Roblox163 + fast open (spinner + preload) */
.market-image-lightbox {
    z-index: 1200;
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.market-image-lightbox-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

.market-image-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.market-image-lightbox-close:hover {
    background: rgba(139, 92, 246, 0.55);
}

.market-image-lightbox-stage {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 52px 88px 8px;
}

.market-image-lightbox-spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-top-color: #a78bfa;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
    animation: market-image-lightbox-spin 0.7s linear infinite;
}

.market-image-lightbox-spinner.is-visible {
    opacity: 1;
}

@keyframes market-image-lightbox-spin {
    to { transform: rotate(360deg); }
}

.market-image-lightbox-img {
    max-width: min(96vw, 100%);
    max-height: calc(100vh - 150px);
    max-height: calc(100dvh - 150px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    user-select: none;
    opacity: 1;
    transition: opacity 120ms ease;
}

.market-image-lightbox-img.is-loading {
    opacity: 0.15;
}

.market-image-lightbox-fullsize {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #93c5fd;
    text-decoration: none;
}

.market-image-lightbox-fullsize:hover {
    text-decoration: underline;
    color: #bfdbfe;
}

.market-image-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.market-image-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.28);
}

.market-image-lightbox-nav.prev { left: 20px; }
.market-image-lightbox-nav.next { right: 20px; }

.market-image-lightbox-thumbs {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 10px 16px 18px;
    overflow-x: auto;
    flex-shrink: 0;
}

.market-image-lightbox-thumb {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    padding: 0;
    border-radius: 8px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    overflow: hidden;
}

.market-image-lightbox-thumb.active { border-color: #fff; }

.market-image-lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.market-image-lightbox-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .market-image-lightbox-stage { padding: 48px 16px 8px; }
    .market-image-lightbox-nav { width: 40px; height: 40px; font-size: 1.5rem; }
    .market-image-lightbox-nav.prev { left: 8px; }
    .market-image-lightbox-nav.next { right: 8px; }
    .market-image-lightbox-img {
        max-height: calc(100vh - 130px);
        max-height: calc(100dvh - 130px);
    }
    .market-image-lightbox-thumb { width: 44px; height: 44px; }
}

.stack-row-source {
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
    font-family: Inter, system-ui, sans-serif;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

/* Platform badge over gift listing thumb (not under meta) */
.stack-row-thumb .stack-row-source {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    display: block;
    padding: 0.12rem 0.3rem;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    color: #e2e8f0;
    background: linear-gradient(180deg, rgba(15, 15, 24, 0.88) 0%, rgba(15, 15, 24, 0.55) 100%);
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stack-row-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: #e4e4e7;
    white-space: nowrap;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.12rem;
    line-height: 1.15;
}

.stack-row-price-raw {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: rgba(226, 232, 240, 0.55);
}

.stack-row-buy {
    min-width: 4.5rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .stack-row {
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "thumb main price"
            "thumb main buy";
        gap: 0.45rem 0.65rem;
    }

    .stack-row-thumb {
        grid-area: thumb;
        align-self: start;
    }

    .stack-row-main {
        grid-area: main;
    }

    .stack-row-price {
        grid-area: price;
        text-align: right;
    }

    .stack-row-buy {
        grid-area: buy;
        min-width: 0;
        padding: 0.4rem 0.65rem;
        font-size: 0.78rem;
    }
}

@media (max-width: 768px) {
    .detail-card {
        padding: 1.2rem 0.85rem 1.5rem 0.85rem;
        margin: 1rem auto;
    }

    .detail-header {
        flex-direction: column;
        gap: 1.2rem;
    }

    .detail-img {
        min-width: 0;
        width: 100%;
        padding: 1rem;
    }

    .detail-img img {
        max-width: min(260px, 100%);
    }

    .detail-title {
        word-break: break-word;
    }

    .detail-prices {
        gap: 1rem;
        align-items: flex-start;
    }

    .detail-actions {
        flex-direction: column;
    }

    .detail-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    .detail-wear-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .detail-wear-value {
        min-width: 0;
        width: 100%;
    }

    /* Column stack: cancel flex-grow so the track keeps a real height on phones. */
    .detail-wear .wear-bar,
    .wear-bar {
        flex: none;
        flex-shrink: 0;
        min-width: 0;
        max-width: none;
        width: 100%;
        height: 16px;
        min-height: 16px;
        align-self: stretch;
        overflow: visible;
    }

    .detail-facts {
        grid-template-columns: 1fr;
    }

    .section-title {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 360px) {
    .items-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stats-row .stat-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        padding: 0.5rem 0.75rem;
        background: rgba(30, 30, 46, 0.5);
        border-radius: 8px;
        border: 1px solid rgba(139, 92, 246, 0.15);
    }

    .stats-row .stat-label {
        margin-top: 0;
        order: -1;
    }
}

[hidden] {
    display: none !important;
}

/* =============================================
   CHINESE MARKET (landing shell)
   ============================================= */
.cm-hero .cm-lead {
    margin: 0.75rem auto 0;
    max-width: 720px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.6;
}

.cm-hero .cm-lead code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.12);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.cm-meta {
    font-size: 0.78rem;
    color: #64748b;
}

.cm-search-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
}

.cm-search-input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
}

.cm-price-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-top: 1rem;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(139, 92, 246, 0.18);
    background: rgba(139, 92, 246, 0.06);
    font-size: 0.78rem;
    color: #94a3b8;
    overflow: visible;
    position: relative;
    z-index: 1;
    cursor: help;
    outline: none;
}

/* Fee tooltip escapes glass-card overflow clipping */
.glass-card:has(.cm-price-legend) {
    overflow: visible;
}

.glass-card:has(.cm-price-legend:hover),
.glass-card:has(.cm-price-legend:focus-within) {
    z-index: 40;
}

.cm-legend-label {
    font-weight: 600;
    color: #c4b5fd;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.68rem;
}

.cm-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cm-fee-hint {
    color: #a78bfa;
    font-weight: 600;
}

.cm-tip-bubble {
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    bottom: auto;
    transform: translateX(-50%);
    width: min(300px, 78vw);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    background: #12121a;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    color: #94a3b8;
    font-size: 0.74rem;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    white-space: pre-line;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 200;
}

.cm-tip-bubble::after {
    content: '';
    position: absolute;
    bottom: 100%;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: rgba(139, 92, 246, 0.35);
}

.cm-price-legend:hover .cm-tip-bubble,
.cm-price-legend:focus .cm-tip-bubble,
.cm-price-legend:focus-visible .cm-tip-bubble,
.cm-price-legend:focus-within .cm-tip-bubble {
    opacity: 1;
    visibility: visible;
}

.cm-grid {
    --market-card-min: clamp(160px, 14vw, 220px);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--market-card-min), 1fr));
    gap: var(--item-card-gap);
    margin-top: 0.5rem;
}

@media (min-width: 1100px) {
    .cm-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .cm-grid {
        --market-card-min: clamp(140px, 44vw, 180px);
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.cm-grid-message {
    grid-column: 1 / -1;
    padding: 28px 16px;
    text-align: center;
    color: #94a3b8;
}

.cm-card {
    background: rgba(30, 30, 46, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--item-card-border-radius);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cm-card:hover {
    border-color: rgba(139, 92, 246, 0.45);
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(139, 92, 246, 0.18), 0 4px 12px rgba(0, 0, 0, 0.35);
}

.cm-card .market-card-image {
    position: relative;
    width: 100%;
    /* Buff-style square image dominance (was 3/2 landscape) */
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background:
        radial-gradient(ellipse 70% 60% at 50% 48%, rgba(88, 70, 140, 0.28) 0%, transparent 68%),
        rgba(18, 16, 32, 0.98);
    overflow: hidden;
}

.cm-card .market-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    padding: 4%;
    box-sizing: border-box;
    object-fit: contain;
    object-position: center;
    transition: transform 0.2s ease;
}

.cm-card:hover .market-card-image img {
    transform: scale(1.06);
}

.cm-card .market-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.55rem 0.7rem 0.45rem;
    flex: 0 0 auto;
    min-height: 0;
}

.cm-card .market-card-category {
    margin: 0;
    font-size: 0.62rem;
    color: #c4b5fd;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-card .market-card-name {
    margin: 0;
    font-size: var(--item-name-size);
    font-weight: 600;
    color: #e4e4e7;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 0;
}

.cm-card-prices {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
}

.cm-card-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.76rem;
}

.cm-card-price-label {
    color: #64748b;
    flex-shrink: 0;
}

.cm-card-price-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
    color: #94a3b8;
}

.cm-price-best {
    color: #34d399;
    font-weight: 600;
}

.cm-price-selected {
    color: #c4b5fd;
    font-weight: 700;
}

.cm-card-actions {
    padding: 0 0.7rem 0.65rem;
    margin-top: auto;
}

.cm-card-actions .btn-small {
    width: 100%;
    min-width: 0;
}

.cm-list-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 1rem;
    margin-bottom: var(--glass-card-margin-bottom);
}

.scroll-sentinel {
    width: 100%;
    height: 1px;
    pointer-events: none;
}

.cm-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.cm-card-link:hover .market-card-name {
    color: #c4b5fd;
}

.cm-card-actions .cm-gift-pick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.cm-detail-prices .detail-value-platform {
    font-size: clamp(1.15rem, 2.2vw, 1.65rem);
}

.cm-detail-prices .detail-value.is-price-loading {
    color: transparent;
    position: relative;
    display: inline-block;
    min-width: 5rem;
    min-height: 1.1em;
    border-radius: 6px;
    vertical-align: middle;
}

.cm-detail-prices .detail-value.is-price-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        rgba(148, 163, 184, 0.12) 0%,
        rgba(148, 163, 184, 0.28) 50%,
        rgba(148, 163, 184, 0.12) 100%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

.cm-detail-prices .detail-value.cm-price-stale {
    opacity: 0.72;
}

.cm-detail-prices .detail-value-raw {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: rgba(226, 232, 240, 0.55);
    font-variant-numeric: tabular-nums;
}

.cm-detail-prices .detail-value-raw:empty {
    display: none;
}

.cm-detail-prices .cm-price-best {
    color: #34d399;
    text-shadow: 0 2px 8px rgba(52, 211, 153, 0.35);
}

.cm-detail-prices .cm-price-selected {
    color: #c4b5fd;
    text-shadow: 0 2px 8px rgba(196, 181, 253, 0.35);
}

/* Clickable platform price cells + Roblox163-style hover tips */
.cm-detail-prices .ui-hint-tip--price-cell,
.cm-detail-prices > .ui-hint-tip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
}

.cm-price-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    cursor: default;
    border-radius: 10px;
    padding: 0.15rem 0.35rem 0.15rem 0;
    margin: -0.15rem -0.35rem -0.15rem 0;
    transition: background 150ms ease, transform 150ms ease;
}

.cm-price-cell.is-linked {
    cursor: pointer;
}

.cm-price-cell.is-linked:hover {
    background: rgba(139, 92, 246, 0.08);
}

.cm-price-cell.is-linked:hover .detail-value {
    color: #c4b5fd;
}

.cm-price-cell[aria-disabled="true"] {
    pointer-events: auto;
    cursor: default;
}

.cm-price-cell .detail-label,
.cm-price-cell .detail-value {
    pointer-events: none;
}

/* ui-hint-tip (self-contained for deposit-main pages without style.css / shared-ui) */
.ui-hint-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Tip host adopts absolute slot from wear marker / qty / hold badges */
.ui-hint-tip--abs {
    position: absolute;
    display: inline-flex;
    align-items: center;
    pointer-events: auto;
    z-index: 2;
}

.ui-hint-tip--abs > .wear-marker,
.ui-hint-tip--abs > .item-badge-qty,
.ui-hint-tip--abs > .item-badge-hold {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    transform: none;
    z-index: auto;
    pointer-events: none;
}

.ui-hint-tip--wear {
    top: -12px;
    transform: translateX(-50%);
    color: #fff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
    line-height: 0;
}

.item-card-wear .ui-hint-tip--wear {
    top: -5px;
}

.ui-hint-tip--qty {
    top: auto;
    right: auto;
    bottom: 0.55rem;
    left: 0.55rem;
    z-index: 4;
    transform: none;
}

.ui-hint-tip--hold {
    top: 0.5rem;
    right: 0.5rem;
    bottom: auto;
    left: auto;
    z-index: 4;
    transform: none;
}

.ui-hint-tip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: default;
    transition: color 150ms ease, background 150ms ease;
}

.ui-hint-tip-icon:hover,
.ui-hint-tip:focus-within .ui-hint-tip-icon {
    color: #cbd5e1;
    background: rgba(139, 92, 246, 0.1);
}

.ui-hint-tip-qa,
.ui-hint-tip--qa > .ui-hint-tip-icon {
    width: 17px;
    height: 17px;
    min-width: 17px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.42);
    background: rgba(139, 92, 246, 0.16);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.06);
    color: #a78bfa;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    cursor: help;
    transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.ui-hint-tip-icon.ui-hint-tip-qa:hover,
.ui-hint-tip:focus-within .ui-hint-tip-icon.ui-hint-tip-qa,
.ui-hint-tip--qa:hover > .ui-hint-tip-icon,
.ui-hint-tip--qa:focus-within > .ui-hint-tip-icon {
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.28);
    border-color: rgba(139, 92, 246, 0.62);
}

.ui-hint-tip-heading {
    display: block;
    margin: 0 0 4px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
    color: #e2e8f0;
}

.ui-hint-tip--right .ui-hint-tip-bubble {
    left: calc(100% + 8px);
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
}

.ui-hint-tip--right .ui-hint-tip-bubble::after {
    left: -5px;
    right: auto;
    top: 50%;
    bottom: auto;
    border-right: none;
    border-bottom: none;
    border-left: 1px solid rgba(139, 92, 246, 0.35);
    border-top: 1px solid rgba(139, 92, 246, 0.35);
    transform: translateY(-50%) rotate(-45deg);
}

.ui-hint-tip-bubble {
    position: absolute;
    z-index: 80;
    left: auto;
    right: 0;
    bottom: calc(100% + 8px);
    min-width: 11rem;
    max-width: 18rem;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(22, 22, 34, 0.98);
    border: 1px solid rgba(139, 92, 246, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(139, 92, 246, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 0.72rem;
    line-height: 1.45;
    font-weight: 500;
    color: #94a3b8;
    text-align: left;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 150ms ease, visibility 150ms ease, transform 150ms ease;
}

.ui-hint-tip--bottom .ui-hint-tip-bubble {
    bottom: auto;
    top: calc(100% + 8px);
    transform: translateY(-4px);
}

.ui-hint-tip-bubble.ui-hint-tip-bubble--pinned {
    position: fixed !important;
    z-index: 10000;
    transform: none !important;
    right: auto !important;
    bottom: auto !important;
}

.ui-hint-tip-bubble--muted {
    color: #94a3b8;
}

.ui-hint-tip-bubble--info {
    border-color: rgba(96, 165, 250, 0.35);
}

.ui-hint-tip-bubble--warning {
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.4);
}

.ui-hint-tip-bubble--success {
    color: #86efac;
    border-color: rgba(74, 222, 128, 0.35);
}

.ui-hint-tip-bubble::after {
    content: '';
    position: absolute;
    right: 14px;
    left: auto;
    bottom: -5px;
    width: 10px;
    height: 10px;
    background: rgba(22, 22, 34, 0.98);
    border-right: 1px solid rgba(139, 92, 246, 0.35);
    border-bottom: 1px solid rgba(139, 92, 246, 0.35);
    transform: rotate(45deg);
}

.ui-hint-tip--bottom .ui-hint-tip-bubble::after {
    bottom: auto;
    top: -5px;
    border-right: none;
    border-bottom: none;
    border-left: 1px solid rgba(139, 92, 246, 0.35);
    border-top: 1px solid rgba(139, 92, 246, 0.35);
}

.ui-hint-tip--block {
    display: block;
    width: 100%;
}

.ui-hint-tip--icon {
    display: inline-flex;
    vertical-align: middle;
}

.ui-hint-tip--icon > .icon-btn,
.ui-hint-tip--icon > .locale-settings-btn,
.ui-hint-tip--icon > .landing-locale-btn,
.ui-hint-tip--icon > .sb-logout-btn,
.ui-hint-tip--icon > button {
    position: relative;
    z-index: 0;
}

.ui-hint-tip:hover .ui-hint-tip-bubble,
.ui-hint-tip:focus-within .ui-hint-tip-bubble,
.ui-hint-tip--tap-open .ui-hint-tip-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Stable hints ignore generic :hover — JS pins first, then adds --open. */
.ui-hint-tip--stable:not(.ui-hint-tip--open) .ui-hint-tip-bubble,
.ui-hint-tip--stable:not(.ui-hint-tip--open):hover .ui-hint-tip-bubble,
.ui-hint-tip--stable:not(.ui-hint-tip--open):focus-within .ui-hint-tip-bubble {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.ui-hint-tip--txn-status,
.ui-hint-tip--txn-status.ui-hint-tip--stable,
.txn-status-inline .ui-hint-tip--txn-status {
    display: inline-flex;
    align-items: center;
    width: auto !important;
    max-width: none;
    flex: 0 0 auto;
    contain: layout;
}

.ui-hint-tip--txn-status .ui-hint-tip-bubble,
.ui-hint-tip--txn-status .ui-hint-tip-bubble.ui-hint-tip-bubble--pinned,
.ui-hint-tip-bubble--txn-status,
.ui-hint-tip-bubble--txn-status.ui-hint-tip-bubble--pinned {
    position: fixed !important;
    pointer-events: none !important;
}

/* Card titles truncate with ellipsis — pin bubble below name, outside overflow:hidden cards. */
.ui-hint-tip--card-name {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.ui-hint-tip--card-name > .item-name,
.ui-hint-tip--card-name > .market-card-name {
    display: block;
    width: 100%;
    max-width: 100%;
}

.ui-hint-tip--card-name .ui-hint-tip-bubble {
    min-width: 0;
    max-width: min(18rem, calc(100vw - 16px));
}

.ui-hint-tip-bubble.ui-hint-tip-bubble--pinned::after {
    display: none;
}

@media (max-width: 640px) {
    .ui-hint-tip--card-name .ui-hint-tip-bubble {
        font-size: 0.68rem;
        padding: 8px 10px;
        line-height: 1.4;
    }
}

/* Price cells: tip grows from the left of the cell */
.cm-detail-prices .ui-hint-tip-bubble,
.ui-hint-tip--price-cell .ui-hint-tip-bubble {
    left: 0;
    right: auto;
}

.cm-detail-prices .ui-hint-tip-bubble::after,
.ui-hint-tip--price-cell .ui-hint-tip-bubble::after {
    left: 14px;
    right: auto;
}

/* Landing locale globe (Roblox163 landing-locale-btn) */
.user-nav .landing-locale-btn.icon-btn,
.user-nav .landing-locale-btn,
.header-right .landing-locale-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    background: rgba(0, 0, 0, 0.25);
    color: #e4e4e7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.user-nav .landing-locale-btn:hover,
.header-right .landing-locale-btn:hover {
    color: #c4b5fd;
    border-color: rgba(139, 92, 246, 0.55);
    background: rgba(139, 92, 246, 0.12);
}

.locale-settings-overlay:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
}

.locale-settings-modal {
    width: min(22rem, calc(100vw - 2rem));
    border-radius: 16px;
    background: rgba(18, 18, 28, 0.98);
    border: 1px solid rgba(139, 92, 246, 0.35);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    color: #e4e4e7;
}

.locale-settings-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.1rem 0.5rem;
}

.locale-settings-modal .modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.locale-settings-modal .modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.locale-settings-body {
    padding: 0.5rem 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.locale-settings-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    color: #94a3b8;
}

.locale-settings-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0 1.1rem 1.1rem;
}

body.locale-settings-open {
    overflow: hidden;
}

.cm-detail-divider {
    margin: 2.2rem 0;
    border: none;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.cm-detail-gift {
    margin-top: 0.25rem;
}

.cm-gift-panel .section-title {
    margin-bottom: 0.75rem;
}

.cm-gift-hint {
    color: #94a3b8;
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 0 0 1rem;
}

.cm-gift-hint a {
    color: #a78bfa;
}

.cm-gift-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 1rem;
}

.cm-gift-field-full {
    grid-column: 1 / -1;
}

.cm-gift-trade-wrap {
    margin: 0 0 0.85rem;
}

.cm-gift-trade-wrap[hidden] {
    display: none !important;
}

.cm-gift-field-platform {
    min-width: 0;
}

.cm-gift-platform-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cm-gift-platform-row .cm-gift-input {
    flex: 0 1 auto;
    min-width: 140px;
    width: auto;
}

.cm-gift-platform-row .cm-gift-badge {
    flex-shrink: 0;
}

/* Gift platform custom select - Roblox163 ui-combobox look (gift only) */
.cm-gift-platform-row .cm-gift-platform-select {
    position: relative;
    flex: 0 1 auto;
    min-width: 160px;
    width: auto;
    z-index: 4;
}

.cm-gift-platform-row .cm-gift-platform-select.is-open {
    z-index: 20;
}

.cm-gift-platform-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.cm-gift-platform-row .ui-combobox-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 0 1rem 0 1.25rem;
    border-radius: 8px;
    background: rgba(30, 30, 46, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #e4e4e7;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    text-align: left;
}

.cm-gift-platform-row .ui-combobox-trigger:hover {
    border-color: rgba(139, 92, 246, 0.45);
}

.cm-gift-platform-row .ui-combobox.is-open .ui-combobox-trigger,
.cm-gift-platform-row .ui-combobox-trigger:focus-visible {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    outline: none;
}

.cm-gift-platform-row .ui-combobox-value {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.cm-gift-platform-row .ui-combobox-chevron {
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform 0.2s ease, color 0.2s ease;
}

.cm-gift-platform-row .ui-combobox.is-open .ui-combobox-chevron {
    transform: rotate(180deg);
    color: #e4e4e7;
}

.cm-gift-platform-row .ui-combobox-menu {
    position: absolute;
    z-index: 50;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 6px;
    list-style: none;
    border-radius: 8px;
    background: rgba(22, 22, 34, 0.98);
    border: 1px solid rgba(139, 92, 246, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(139, 92, 246, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    max-height: 240px;
    overflow-y: auto;
}

.cm-gift-platform-row .ui-combobox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 4px;
    color: #a1a1aa;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.cm-gift-platform-row .ui-combobox-option:hover {
    background: rgba(139, 92, 246, 0.12);
    color: #e4e4e7;
}

.cm-gift-platform-row .ui-combobox-option.is-selected {
    background: rgba(139, 92, 246, 0.18);
    color: #e4e4e7;
}

.cm-gift-platform-row .ui-combobox-option.is-disabled,
.cm-gift-platform-row .ui-combobox-option[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    color: #71717a;
}

.cm-gift-platform-row .ui-combobox-option.is-disabled:hover,
.cm-gift-platform-row .ui-combobox-option[aria-disabled="true"]:hover {
    background: transparent;
    color: #71717a;
}

.cm-gift-platform-row .ui-combobox-option.is-disabled .ui-combobox-option-hint,
.cm-gift-platform-row .ui-combobox-option[aria-disabled="true"] .ui-combobox-option-hint {
    color: #a1a1aa;
}

.cm-gift-platform-row .ui-combobox-option-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.cm-gift-platform-row .ui-combobox-option-hint {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0.02em;
}

.cm-gift-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #c4b5fd;
    margin-bottom: 6px;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    line-height: 1.35;
}

/* Checkbox rows: keep box + text on one line (not stacked full-width inputs) */
.cm-gift-label:has(input[type="checkbox"]),
.cm-gift-label:has(input[type="radio"]) {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    text-transform: none;
    letter-spacing: 0.01em;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0;
    cursor: pointer;
}

.cm-gift-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.cm-gift-field {
    min-width: 0;
}

.cm-gift-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.cm-gift-actions .btn {
    min-width: 120px;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    line-height: 1.3;
}

/* Admin Treasury: wider fields so labels don't mid-word wrap */
#admin-treasury-form.cm-gift-form {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-items: start;
}

#admin-treasury-form .cm-gift-label:not(:has(input[type="checkbox"])) {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: keep-all;
}

#treasury-stats.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem 1rem;
    justify-content: stretch;
    margin-top: 0;
}

#treasury-stats .stat-value {
    display: block;
    word-break: normal;
    overflow-wrap: anywhere;
    font-size: clamp(0.95rem, 1.6vw, 1.25rem);
    line-height: 1.25;
}

.cm-gift-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.12);
    color: #c4b5fd;
}

.cm-gift-badge.badge-green,
.cm-gift-badge.ok {
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.3);
}

.cm-gift-badge.badge-red,
.cm-gift-badge.fail {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.3);
}

.cm-gift-badge.converted {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.35);
}

.cm-gift-badge.standby {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.3);
}

.cm-gift-quote {
    margin: 0.75rem 0 0;
    color: #94a3b8;
    font-size: 0.88rem;
    line-height: 1.5;
}

.cm-gift-result {
    margin-top: 12px;
    max-height: 220px;
    overflow: auto;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    background: rgba(15, 15, 23, 0.6);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #94a3b8;
    white-space: pre-wrap;
    word-break: break-word;
}

.cm-gift-listings {
    margin: 0.5rem 0 0.25rem;
    padding: 0.65rem 0 0;
    border-top: 1px solid rgba(139, 92, 246, 0.22);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    background: transparent;
}

.cm-gift-listings.detail-stack {
    margin-top: 0.5rem;
    padding-top: 0.65rem;
}

.cm-gift-listings-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 0.85rem;
    margin: 0.75rem 0 0.55rem;
    position: relative;
    z-index: 20;
    overflow: visible;
}

.cm-gift-source-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.cm-gift-source-chip {
    appearance: none;
    border: 1px solid rgba(139, 92, 246, 0.28);
    background: rgba(30, 30, 46, 0.65);
    color: #cbd5e1;
    border-radius: 999px;
    padding: 0.28rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.cm-gift-source-chip:hover:not(:disabled) {
    border-color: rgba(167, 139, 250, 0.5);
    color: #e2e8f0;
}

.cm-gift-source-chip.is-active {
    border-color: rgba(139, 92, 246, 0.7);
    background: rgba(139, 92, 246, 0.18);
    color: #ede9fe;
}

.cm-gift-source-chip:disabled,
.cm-gift-source-chip.is-soon,
.cm-gift-source-chip.is-maintenance {
    opacity: 0.55;
    cursor: not-allowed;
}

.cm-card-price-val.cm-price-maintenance {
    color: #fbbf24;
    font-weight: 600;
}

.cm-gift-listings .stack-row-thumb .stack-row-source[data-platform="youpin"],
.cm-gift-listings .stack-row-thumb .stack-row-source[data-platform="c5"],
.cm-gift-listings .stack-row-thumb .stack-row-source[data-platform="ecos"] {
    font-size: 0.52rem;
    font-weight: 600;
    font-family: Inter, system-ui, sans-serif;
    letter-spacing: 0.04em;
}
.cm-gift-listings .stack-row-thumb .stack-row-source[data-platform="youpin"] { color: #ddd6fe; }
.cm-gift-listings .stack-row-thumb .stack-row-source[data-platform="c5"] { color: #bae6fd; }
.cm-gift-listings .stack-row-thumb .stack-row-source[data-platform="ecos"] { color: #cbd5e1; }

.cm-gift-float-filter {
    display: none;
}

.cm-gift-toolbar-selects {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
    margin-left: auto;
    position: relative;
    z-index: 1;
    overflow: visible;
    min-width: 0;
}

.cm-gift-float-range {
    min-width: 10.5rem;
}

.cm-gift-toolbar-selects .cm-gift-sort-label + .cm-gift-sort-label {
    margin-left: 0.15rem;
}

.cm-gift-float-modal-lead {
    margin: 0 0 0.85rem;
    color: #94a3b8;
    font-size: 0.86rem;
    line-height: 1.4;
}

.cm-gift-float-modal-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.55rem;
}

.cm-gift-float-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
    font-size: 0.72rem;
    color: #94a3b8;
}

.cm-gift-float-input.price-input,
.cm-gift-float-modal .price-input {
    width: 6.5rem;
    min-width: 6.5rem;
    font-variant-numeric: tabular-nums;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.cm-gift-float-sep {
    color: #8b5cf6;
    margin: 0 0 0.55rem;
    align-self: flex-end;
}

#gift-float-custom-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1100;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#gift-float-custom-overlay.active {
    display: flex;
}

.cm-gift-float-modal {
    max-width: 420px;
}

.stack-row-stickers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 0.45rem;
}

.stack-row-sticker {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 8px;
    overflow: hidden;
    background: #232336;
    padding: 2px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.13);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease;
}

.stack-row-sticker:hover {
    transform: scale(1.1);
    z-index: 2;
}

.stack-row-sticker img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.stack-row-sticker.is-text {
    width: auto;
    min-width: 54px;
    padding: 0 0.4rem;
    font-size: 0.65rem;
    font-weight: 650;
    color: #a7f3d0;
    letter-spacing: 0.02em;
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(16, 185, 129, 0.06));
}

.cm-gift-sort-label {
    margin: 0;
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    max-width: 100%;
    min-width: 0;
}

/* Open Float/Price menu must sit above the sibling control (same stacking context). */
.cm-gift-sort-label:has(.ui-combobox.is-open),
.cm-gift-sort-label:has(.ui-select-host.is-open) {
    z-index: 90;
}

.cm-gift-sort-label .ui-select-host {
    min-width: 13.5rem;
    width: max-content;
    max-width: min(100%, 18rem);
}

.cm-gift-sort-label .ui-select-host.is-open,
.cm-gift-sort-label .ui-combobox.is-open {
    z-index: 90;
}

.cm-gift-sort-label .ui-combobox,
.cm-gift-sort-label .ui-combobox-compact {
    width: 100%;
    min-width: 13.5rem;
    max-width: none;
}

.cm-gift-sort-label .ui-combobox-trigger {
    min-height: 2.15rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    white-space: nowrap;
}

.cm-gift-sort-label .ui-combobox-value,
.cm-gift-sort-label .ui-combobox-option-text {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.cm-gift-sort-label .ui-combobox-menu {
    z-index: 100;
    min-width: 100%;
    width: max-content;
    max-width: min(90vw, 20rem);
}

.cm-gift-sort-label .ui-combobox-option {
    white-space: nowrap;
}

/* Hide native select even if shared-ui.css load order races */
.cm-gift-sort-label select.ui-select-native,
.cm-gift-sort-label select.cm-gift-sort.ui-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    border: 0 !important;
    z-index: -1 !important;
}

select.cm-gift-sort:not(.ui-select-native) {
    appearance: none;
    background: rgba(30, 30, 46, 0.9);
    color: #e2e8f0;
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-radius: 8px;
    padding: 0.35rem 1.75rem 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
}

.cm-gift-listings .detail-stack-list {
    max-height: min(520px, 58vh);
    overflow: auto;
    margin-top: 0.3rem;
    gap: 0.4rem;
}

.cm-gift-listings-empty {
    margin: 0.55rem 0 0;
    font-size: 0.82rem;
    color: #94a3b8;
}

@media (max-width: 640px) {
    .cm-gift-listings-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .cm-gift-toolbar-selects {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
        margin-left: 0;
        width: 100%;
    }

    .cm-gift-toolbar-selects .cm-gift-sort-label + .cm-gift-sort-label {
        margin-left: 0;
    }

    .cm-gift-sort-label {
        display: flex;
        width: 100%;
        flex: none;
    }

    .cm-gift-sort-label .ui-select-host,
    .cm-gift-sort-label .ui-combobox,
    .cm-gift-sort-label .ui-combobox-compact {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .cm-gift-sort-label .ui-combobox-menu {
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
    }
}

.cm-gift-result code {
    font-family: inherit;
}

.landing-site-footer {
    margin: 2rem auto 1.5rem;
    padding: 0 1rem;
    max-width: 1200px;
    text-align: center;
}

.landing-site-footer p {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.85);
}

.landing-site-footer-link {
    color: #a78bfa;
    text-decoration: none;
}

.landing-site-footer-link:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

.footer-contact-wrap {
    position: relative;
    display: inline-flex;
}

.footer-contact-panel {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(18, 18, 28, 0.96);
    border: 1px solid rgba(139, 92, 246, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.footer-contact-panel[hidden] {
    display: none;
}

.footer-contact-title {
    margin: 0 0 4px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(148, 163, 184, 0.85);
}

.footer-contact-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(139, 92, 246, 0.25);
    background: rgba(139, 92, 246, 0.08);
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.footer-contact-item:hover {
    border-color: rgba(167, 139, 250, 0.55);
    background: rgba(139, 92, 246, 0.16);
}

.footer-contact-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(148, 163, 184, 0.85);
}

.footer-contact-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: #a78bfa;
    font-family: 'Inter', sans-serif;
}

.landing-footer-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    font-size: inherit;
    color: inherit;
}


/* =============================================
   HEADER USER CARD (Roblox163 sidebar-user-card)
   ============================================= */
.header-user-card.sidebar-user-card {
    position: relative;
    padding: 6px 8px;
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 6px 10px;
    align-items: center;
    min-width: 0;
    max-width: 240px;
    border-radius: 12px;
    transition: background 0.15s ease;
}

.header-user-card.sidebar-user-card:hover,
.header-user-card.sidebar-user-card.is-menu-open {
    background: rgba(139, 92, 246, 0.08);
}

.header-user-card .sb-user-avatar,
.header-user-card .sb-user-avatar-fallback {
    grid-column: 1;
    width: 36px;
    height: 36px;
    min-width: 36px;
    max-width: 36px;
    min-height: 36px;
    max-height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    background-color: #0a0a0f;
    background-image:
        linear-gradient(#0a0a0f, #0a0a0f),
        linear-gradient(135deg, #8b5cf6, #a78bfa);
    background-origin: border-box;
    background-clip: content-box, border-box;
    cursor: pointer;
}

.header-user-card .sb-user-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #c4b5fd;
}

.header-user-card .sb-user-info {
    grid-column: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header-user-card .sb-user-profile-hit {
    cursor: pointer;
}

.header-user-card .sb-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-user-card .sb-user-balance {
    font-size: 0.75rem;
    font-weight: 700;
    color: #34d399;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-user-card .sb-user-menu {
    grid-column: 1 / -1;
    grid-row: 1;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: auto;
    min-width: 100%;
    width: max-content;
    max-width: min(220px, 80vw);
    padding: 6px;
    margin: 0;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.28);
    background: rgba(18, 18, 28, 0.96);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
}

.header-user-card .sb-user-menu[hidden] {
    display: none !important;
}

.header-user-card .sb-user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.75rem;
    border-radius: 7px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 0.12s ease, color 0.12s ease;
}

.header-user-card .sb-user-menu-item > svg {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    overflow: visible;
    color: #a78bfa;
    transition: color 0.12s ease;
}

.header-user-card .sb-user-menu-label {
    flex: 1;
    min-width: 0;
}

.header-user-card .sb-user-menu-item:hover > svg,
.header-user-card .sb-user-menu-item:focus-visible > svg,
.header-user-card .sb-user-menu-item.active > svg,
.header-user-card .sb-user-menu-item[aria-current="page"] > svg {
    color: #c4b5fd;
}

.header-user-card .sb-user-menu-item--danger > svg {
    color: #f87171;
}

.header-user-card .sb-user-menu-item--danger:hover > svg,
.header-user-card .sb-user-menu-item--danger:focus-visible > svg {
    color: #fca5a5;
}

.header-user-card .sb-user-menu-item:hover,
.header-user-card .sb-user-menu-item:focus-visible {
    background: rgba(139, 92, 246, 0.18);
    color: #fff;
    outline: none;
}

.header-user-card .sb-user-menu-item.active,
.header-user-card .sb-user-menu-item[aria-current="page"] {
    background: rgba(139, 92, 246, 0.28);
    color: #fff;
}

.header-user-card .sb-user-menu-item--danger {
    margin-top: 4px;
    border: none;
    border-top: 1px solid rgba(139, 92, 246, 0.18);
    border-radius: 0 0 7px 7px;
    color: #fca5a5;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.header-user-card .sb-user-menu-item--danger:hover,
.header-user-card .sb-user-menu-item--danger:focus-visible {
    background: rgba(239, 68, 68, 0.14);
    color: #fecaca;
}

.header-user-card .sb-user-menu-item.active,
.header-user-card .sb-user-menu-item[aria-current="page"] {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

@media (max-width: 640px) {
    .header-user-card.sidebar-user-card {
        max-width: 180px;
        gap: 4px 8px;
        padding: 4px 6px;
    }
    .header-user-card .sb-user-name {
        max-width: 110px;
    }
}

/* Profile page */
.profile-page-wrap {
    max-width: 720px;
    margin: 0 auto;
}

.profile-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    text-align: left;
}

.profile-card-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-avatar-picker {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 50%;
    line-height: 0;
}

.profile-avatar-picker:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 3px;
}

.profile-avatar-preview,
.profile-avatar-fallback {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(139, 92, 246, 0.35);
    background: #1a1a24;
}

.profile-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #c4b5fd;
}

.profile-avatar-picker-badge {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #8b5cf6;
    color: #fff;
    border: 2px solid #0a0a0f;
    pointer-events: none;
}

.profile-identity-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.profile-identity-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #f1f5f9;
}

.profile-identity-sub {
    font-size: 0.85rem;
    color: #94a3b8;
}

.profile-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem 1rem;
}

.profile-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(148, 163, 184, 0.85);
    margin-bottom: 0.35rem;
}

.profile-field input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.25);
    background: rgba(15, 15, 23, 0.65);
    color: #e2e8f0;
    font-size: 0.9rem;
}

.profile-field input:disabled {
    opacity: 0.85;
    cursor: default;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.profile-status {
    min-height: 1.25rem;
    font-size: 0.85rem;
    color: #94a3b8;
}

.profile-status.is-ok { color: #34d399; }
.profile-status.is-err { color: #f87171; }

@media (max-width: 640px) {
    .profile-fields-grid { grid-template-columns: 1fr; }
}

/* ── Confirm / alert dialog (ported from Roblox163 dialog.js) ── */
.modal-overlay.app-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 10250;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.app-dialog-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.app-dialog-overlay .modal.app-dialog {
    background: rgba(15, 15, 23, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 16px;
    padding: 24px;
    max-width: 440px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s ease;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    color: #e4e4e7;
    font-family: inherit;
}

.app-dialog-overlay.active .modal.app-dialog {
    transform: scale(1) translateY(0);
}

.app-dialog-overlay .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.app-dialog-overlay .modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.app-dialog-overlay .modal-close {
    padding: 4px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-dialog-overlay .modal-close:hover {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}

.app-dialog-overlay .modal-body.app-dialog-body {
    color: #a1a1aa;
    font-size: 0.88rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.app-dialog-overlay .app-dialog-body-mono {
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    padding: 12px 14px;
    max-height: 240px;
    overflow-y: auto;
}

.app-dialog-overlay .modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.app-dialog-overlay .modal-footer .btn {
    min-width: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.85rem;
    padding: 0.55rem 1.1rem;
}

.app-dialog-overlay .btn-primary {
    background: rgba(139, 92, 246, 0.2);
    border-color: #8b5cf6;
    color: #e4e4e7;
}

.app-dialog-overlay .btn-primary:hover {
    background: rgba(139, 92, 246, 0.35);
}

.app-dialog-overlay .btn-secondary {
    background: rgba(30, 30, 46, 0.6);
    border-color: rgba(139, 92, 246, 0.25);
    color: #e4e4e7;
}

.app-dialog-overlay .btn-secondary:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.45);
}

.app-dialog-overlay .btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}

.app-dialog-overlay .btn-danger:hover {
    background: rgba(239, 68, 68, 0.28);
}

.app-dialog--error .modal-title { color: #fca5a5; }
.app-dialog--warning .modal-title { color: #fcd34d; }
.app-dialog--success .modal-title { color: #6ee7b7; }

/* ── Toast notifications (ported from Roblox163 showToast) ── */
#app-toast-container {
    position: fixed;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    top: calc(var(--header-height, 4.25rem) + 12px);
    right: 20px;
    left: auto;
    bottom: auto;
    max-width: 360px;
}

.app-toast {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background: rgba(30, 30, 46, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.25);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: auto;
    word-break: break-word;
}

.app-toast.show {
    opacity: 1;
}

.app-toast-success,
.app-toast-info { background: #166534; border-color: #22c55e; }
.app-toast-error { background: #7f1d1d; border-color: #ef4444; }
.app-toast-warning { background: #713f12; border-color: #f59e0b; }
.app-toast-processing {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #0f3d4c;
    border-color: #2dd4bf;
}
.app-toast-busy {
    display: flex;
    align-items: center;
    gap: 10px;
}
.app-toast-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-top-color: #fff;
    border-radius: 50%;
    flex-shrink: 0;
    animation: app-toast-spin 0.7s linear infinite;
}
@keyframes app-toast-spin {
    to { transform: rotate(360deg); }
}
.app-toast-clickable {
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.app-toast-clickable:hover {
    filter: brightness(1.12);
}
.app-toast-clickable::after {
    content: ' →';
    opacity: 0.75;
}

@media (min-width: 1025px) {
    #app-toast-container {
        top: calc(var(--header-height, 4.25rem) + 12px);
        right: 20px;
        left: auto;
        bottom: auto;
        max-width: 360px;
    }

    .app-toast {
        transform: translateX(40px);
    }

    .app-toast.show {
        transform: translateX(0);
    }
}

@media (max-width: 1024px) {
    #app-toast-container {
        top: calc(var(--header-height, 4.25rem) + 10px + env(safe-area-inset-top, 0px));
        left: 12px;
        right: 12px;
        bottom: auto;
        max-width: none;
        align-items: stretch;
    }

    .app-toast {
        padding: 8px 12px;
        font-size: 0.75rem;
        line-height: 1.35;
        border-radius: 10px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
        transform: translateY(-8px);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .app-toast.show {
        transform: translateY(0);
    }
}

