/* ── Quick Shop Popup ──
   T7 "dark & fire" (fire/gold) recolor. Uses the globally-loaded T7 :root
   tokens from t7-theme.css (--fire-red/orange/yellow, --gold-light/dark,
   --glass-bg, --glass-border). CSS-only — markup is JS-generated in
   quick-shop.js, so changes are live on a browser refresh (no restart). */
.qs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.qs-overlay.is-open { display: block; }

/* Elevate bottom nav above overlay so balances stay visible */
.v2-mobile-nav.qs-nav-elevated {
    z-index: 9999;
}

.qs-popup {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
    width: min(96vw, 560px);
    max-height: min(70vh, 520px);
    border-radius: 20px;
    border: 1px solid var(--glass-border, rgba(255,215,0,0.3));
    background: rgba(16,4,3,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.65), 0 0 30px rgba(255,69,0,0.10);
    flex-direction: column;
    overflow: hidden;
}
.qs-popup.is-open { display: flex; }

/* Searching mode — expand the popup to use most of the viewport so the
   results list has real estate. The is-hidden toggle on quicknav/featured
   (PR #482) recovered ~200px but only ~220px remained for results on a
   600px-viewport phone after header (50) + search (60) + status (26) +
   footer (60) chrome. Raising the cap to 90vh / 760px and dropping the
   bottom offset to 64px adds another ~150-200px to the results pane and
   keeps the popup clear of the bottom nav (mobile bottom nav is ~56px). */
.qs-popup.is-searching {
    max-height: min(90vh, 760px);
    bottom: 64px;
}

/* header */
.qs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255,215,0,0.14);
    gap: 8px;
    flex-shrink: 0;
}
.qs-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--fire-yellow, #ffd700);
    text-shadow: 0 0 12px rgba(255,69,0,0.4);
    white-space: nowrap;
}
.qs-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 10px;
    background: rgba(255,140,0,0.10);
    color: rgba(255,225,190,0.75);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s, color 0.12s;
}
.qs-close:hover { color: var(--fire-yellow, #ffd700); }
.qs-close:active { background: rgba(255,69,0,0.22); }

/* search */
.qs-search-wrap {
    padding: 10px 16px;
    flex-shrink: 0;
}
.qs-search {
    width: 100%;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,215,0,0.16);
    background: rgba(255,140,0,0.06);
    color: #fff3e6;
    font-size: 0.84rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.qs-search::placeholder { color: rgba(255,225,190,0.42); }
.qs-search:focus {
    border-color: rgba(255,140,0,0.6);
    box-shadow: 0 0 0 3px rgba(255,69,0,0.12);
}

/* results area */
.qs-results {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 4px 16px 10px;
    min-height: 60px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,140,0,0.4) transparent;
}
.qs-results::-webkit-scrollbar { width: 6px; }
.qs-results::-webkit-scrollbar-thumb { background: rgba(255,140,0,0.35); border-radius: 4px; }
.qs-empty {
    text-align: center;
    color: rgba(255,225,190,0.5);
    font-size: 0.78rem;
    padding: 18px 0;
}

/* result item card */
.qs-item {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,215,0,0.08);
    min-width: 0;
}
.qs-item:last-child { border-bottom: 0; }
.qs-item-thumb {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255,140,0,0.06);
    border: 1px solid rgba(255,180,80,0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.qs-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.qs-item-thumb-placeholder {
    color: var(--fire-yellow, #ffd700);
    font-size: 1rem;
    font-weight: 800;
    background:
        radial-gradient(circle at top, rgba(255,69,0,0.4), transparent 65%),
        rgba(255,140,0,0.06);
}
.qs-item-info {
    flex: 1 1 auto;
    min-width: 0;
}
.qs-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff3e6;
    display: block;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
}
.qs-sale-tag {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: linear-gradient(135deg, var(--fire-orange, #ff4500), var(--fire-red, #ff0000));
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}
.qs-item-meta {
    font-size: 0.72rem;
    color: rgba(255,225,190,0.55);
    display: block;
    line-height: 1.25;
    margin-top: 3px;
    white-space: normal;
    overflow-wrap: anywhere;
}
/* Origin server of a player-market hit. Markets are isolated per server, so a
   listing is only buyable on the server it came from — this must always be
   visible on the row, never inferred. Clamped so a long server name cannot
   widen the popup. */
.qs-item-server {
    display: inline-block;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(125,211,252,0.95);
    background: rgba(56,189,248,0.14);
    border: 1px solid rgba(56,189,248,0.22);
    border-radius: 999px;
    padding: 0 6px;
    margin-left: 4px;
}
.qs-item-price {
    flex-shrink: 0;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--gold-light, #ffdf00);
    white-space: nowrap;
    align-self: center;
    justify-self: end;
    text-align: right;
}
.qs-item-price.is-premium { color: var(--fire-orange, #ff8c1a); }

.qs-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-self: center;
}

.qs-btn {
    border: 0;
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s, opacity 0.12s, box-shadow 0.12s;
}
.qs-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}
.qs-btn-buy {
    background: linear-gradient(135deg, var(--fire-orange, #ff4500), var(--fire-red, #ff0000));
    color: #fff;
    box-shadow: 0 0 12px rgba(255,69,0,0.35);
}
.qs-btn-buy:active { background: #cc2a00; }
.qs-btn-cart {
    background: rgba(255,215,0,0.12);
    color: var(--fire-yellow, #ffd700);
    border: 1px solid rgba(255,215,0,0.2);
}
.qs-btn-cart:active { background: rgba(255,215,0,0.22); }

/* footer actions */
.qs-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 14px;
    border-top: 1px solid rgba(255,215,0,0.14);
    flex-shrink: 0;
}
.qs-footer-btn {
    flex: 1;
    border: 0;
    border-radius: 12px;
    padding: 10px 8px;
    font-size: 0.76rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qs-footer-goto {
    background: rgba(255,140,0,0.10);
    color: #fff3e6;
    border: 1px solid rgba(255,180,80,0.18);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.qs-footer-goto:active { background: rgba(255,140,0,0.2); }
.qs-footer-viewcart {
    background: rgba(255,215,0,0.14);
    color: var(--gold-light, #ffdf00);
    position: relative;
}
.qs-footer-viewcart:active { background: rgba(255,215,0,0.24); }
.qs-cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--fire-yellow, #ffd700);
    color: #1a0500;
    font-size: 0.62rem;
    font-weight: 800;
    margin-left: 4px;
    padding: 0 4px;
}
.qs-cart-badge:empty { display: none; }
.qs-footer-checkout {
    background: linear-gradient(135deg, var(--fire-orange, #ff4500), var(--fire-red, #ff0000));
    color: #fff;
    box-shadow: 0 0 12px rgba(255,69,0,0.35);
}
.qs-footer-checkout:active { background: #cc2a00; }
.qs-footer-checkout:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* status message */
.qs-status {
    text-align: center;
    font-size: 0.72rem;
    color: rgba(255,225,190,0.6);
    padding: 0 16px 6px;
    min-height: 20px;
    flex-shrink: 0;
}
/* qs-status is for cart/checkout messages; while searching it's always
   blank so its 26px just shrinks the results pane. Hide it during search. */
.qs-popup.is-searching .qs-status { display: none; }

/* ── Cart popup ── */
.qs-cart-popup {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
    width: min(94vw, 360px);
    max-height: min(55vh, 400px);
    border-radius: 20px;
    border: 1px solid var(--glass-border, rgba(255,215,0,0.3));
    background: rgba(16,4,3,0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.65), 0 0 30px rgba(255,69,0,0.10);
    flex-direction: column;
    overflow: hidden;
}
.qs-cart-popup.is-open { display: flex; }

.qs-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255,215,0,0.14);
    flex-shrink: 0;
}
.qs-cart-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--fire-yellow, #ffd700);
    text-shadow: 0 0 12px rgba(255,69,0,0.4);
}

.qs-cart-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,140,0,0.4) transparent;
}
.qs-cart-list::-webkit-scrollbar { width: 6px; }
.qs-cart-list::-webkit-scrollbar-thumb { background: rgba(255,140,0,0.35); border-radius: 4px; }
.qs-cart-empty {
    text-align: center;
    color: rgba(255,225,190,0.5);
    font-size: 0.78rem;
    padding: 24px 0;
}

.qs-cart-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,215,0,0.08);
    min-width: 0;
}
.qs-cart-row:last-child { border-bottom: 0; }
.qs-cart-row-info {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}
.qs-cart-row-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff3e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qs-cart-row-price {
    font-size: 0.68rem;
    color: rgba(255,225,190,0.55);
}
.qs-cart-row-qty {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.qs-cart-qty-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: rgba(255,140,0,0.10);
    color: var(--fire-yellow, #ffd700);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.qs-cart-qty-btn:active { background: rgba(255,140,0,0.22); }
.qs-cart-qty-num {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff3e6;
    min-width: 16px;
    text-align: center;
}
.qs-cart-row-remove {
    border: 0;
    background: none;
    color: rgba(255,100,100,0.7);
    font-size: 0.92rem;
    cursor: pointer;
    padding: 4px;
    -webkit-tap-highlight-color: transparent;
}
.qs-cart-row-remove:active { color: #ff6464; }

.qs-cart-totals {
    padding: 10px 16px;
    border-top: 1px solid rgba(255,215,0,0.14);
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
.qs-cart-totals.is-hidden {
    display: none;
}
.qs-cart-total-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    color: rgba(255,225,190,0.7);
}
.qs-cart-total-line strong {
    color: #fff3e6;
    font-weight: 700;
}
.qs-cart-total-dc { color: var(--gold-light, #ffdf00); }
.qs-cart-total-pp { color: var(--fire-orange, #ff8c1a); }

/* search loading shimmer */
.qs-loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    border: 2px solid rgba(255,140,0,0.3);
    border-top-color: var(--fire-orange, #ff4500);
    border-radius: 50%;
    animation: qsSpin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes qsSpin {
    to { transform: rotate(360deg); }
}

/* keyboard navigation focus highlight */
.qs-item-focused {
    background: rgba(255, 140, 0, 0.12);
    border-radius: 10px;
    margin: 0 -6px;
    padding-left: 6px;
    padding-right: 6px;
}

@media (max-width: 640px) {
    .qs-popup {
        width: min(96vw, 440px);
    }

    .qs-item {
        grid-template-columns: 44px minmax(0, 1fr);
        align-items: start;
    }

    .qs-item-thumb {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .qs-item-price {
        grid-column: 2;
        justify-self: start;
        margin-top: -2px;
        text-align: left;
    }

    .qs-item-actions {
        grid-column: 2;
        flex-wrap: wrap;
    }

    .qs-btn {
        padding: 7px 10px;
    }
}

/* ── Player Market section ── */
.qs-section-divider {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gold-light, #ffdf00);
    padding: 10px 0 4px;
    border-top: 1px solid rgba(255, 215, 0, 0.18);
    margin-top: 4px;
}
.qs-item-market .qs-item-thumb {
    border-color: rgba(255, 140, 0, 0.28);
}
.qs-btn-market {
    background: rgba(255, 140, 0, 0.14);
    color: var(--fire-yellow, #ffd700);
    border: 1px solid rgba(255, 180, 80, 0.24);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.qs-btn-market:active { background: rgba(255, 140, 0, 0.26); }

.qs-cart-footer {
    display: flex;
    gap: 8px;
    padding: 8px 16px 14px;
    flex-shrink: 0;
}

/* ── Quick Nav (5 square 1:1 buttons above Featured Sales) ── */
.qs-quicknav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 10px 16px 4px;
    flex-shrink: 0;
    min-width: 0;
}
.qs-quicknav.is-hidden { display: none; }
.qs-quicknav-btn {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 140, 0, 0.25);
    background: linear-gradient(160deg, rgba(45, 14, 6, 0.92), rgba(22, 6, 4, 0.86));
    color: #fff3e6;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
    min-width: 0;
    transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.qs-quicknav-btn:hover,
.qs-quicknav-btn:focus-visible {
    border-color: rgba(255, 140, 0, 0.65);
    transform: translateY(-1px);
    box-shadow: 0 0 14px rgba(255, 69, 0, 0.25);
    outline: none;
}
.qs-quicknav-thumb {
    width: 38%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fire-yellow, #ffd700);
    font-size: 1.05rem;
    line-height: 1;
}
.qs-quicknav-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.qs-quicknav-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff3e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    min-width: 0;
}
.qs-quicknav-sublabel {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gold-light, #ffdf00);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    min-width: 0;
}
.qs-quicknav-btn.qs-quicknav-sub {
    border-color: rgba(255, 215, 0, 0.35);
    background: linear-gradient(160deg, rgba(184, 134, 11, 0.28), rgba(22, 6, 4, 0.86));
}
.qs-quicknav-btn.qs-quicknav-sub .qs-quicknav-thumb { color: var(--gold-light, #ffd700); }
@media (max-width: 400px) {
    .qs-quicknav { gap: 5px; padding: 8px 12px 4px; }
    .qs-quicknav-btn { padding: 4px 2px; gap: 2px; border-radius: 9px; }
    .qs-quicknav-thumb { width: 32%; font-size: 0.88rem; }
    .qs-quicknav-label { font-size: 0.58rem; letter-spacing: 0; }
    .qs-quicknav-sublabel { font-size: 0.46rem; letter-spacing: 0.02em; }
}

/* ── Featured Sales (compact promo strip above search input) ── */
.qs-featured {
    padding: 10px 16px 6px;
    flex-shrink: 0;
}
.qs-featured.is-hidden { display: none; }
.qs-featured-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gold-light, #ffdf00);
    margin-bottom: 6px;
}
.qs-featured-head > i { color: var(--fire-orange, #ff4500); font-size: 0.75rem; }
.qs-featured-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 140, 0, 0.4) transparent;
}
.qs-featured-list::-webkit-scrollbar { height: 4px; }
.qs-featured-list::-webkit-scrollbar-thumb { background: rgba(255, 140, 0, 0.4); border-radius: 4px; }
.qs-feat-card {
    flex: 0 0 132px;
    min-width: 0;
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(255, 140, 0, 0.25);
    border-radius: 10px;
    background: linear-gradient(160deg, rgba(45, 14, 6, 0.92), rgba(22, 6, 4, 0.86));
    color: #fff3e6;
    cursor: pointer;
    text-align: left;
    position: relative;
    scroll-snap-align: start;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.qs-feat-card:hover,
.qs-feat-card:focus-visible {
    border-color: rgba(255, 140, 0, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 0 14px rgba(255, 69, 0, 0.25);
    outline: none;
}
.qs-feat-thumb {
    width: 100%;
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.qs-feat-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.qs-feat-thumb-placeholder { color: rgba(255, 140, 0, 0.75); font-size: 1.25rem; }
.qs-feat-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: linear-gradient(135deg, var(--fire-yellow, #ffd700) 0%, var(--fire-orange, #fb923c) 100%);
    color: #2a0a00;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 999px;
}
.qs-feat-name {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.qs-feat-pricing {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.qs-feat-original {
    font-size: 0.6rem;
    color: rgba(255, 200, 160, 0.55);
    text-decoration: line-through;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qs-feat-price {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--fire-yellow, #ffd700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
