/* ── Variables ────────────────────────────────────── */
:root {
    --bg:        #0b0c14;
    --surface:   #10111c;
    --surface2:  #14152a;
    --surface3:  #1a1b30;
    --nav-bg:    #0d0e1a;
    --card-bg:   #181929;
    --border:    rgba(255,255,255,0.07);
    --border2:   rgba(255,255,255,0.13);
    --text:      #ffffff;
    --text2:     rgba(255,255,255,0.5);
    --text3:     rgba(255,255,255,0.28);
    --blue:      #6366f1;
    --blue-d:    #4f46e5;
    --price:     #a5b4fc;
    --green:     #22c55e;
    --green-d:   #16a34a;
    --gold:      #fbbf24;
    --red:       #ef4444;
    --radius:    10px;
    --shadow:    0 8px 32px rgba(0,0,0,.65);
    --header-h:  52px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; transition: background .2s; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }
::-webkit-scrollbar-corner { background: transparent; }

/* ── Header ───────────────────────────────────────── */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: var(--header-h);
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo {
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.logo-accent {
    color: var(--blue);
}

.pure-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text2);
}

.pure-chip {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pure-chip img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.pure-label {
    color: var(--text3);
    font-size: 11px;
    margin-right: 2px;
}

.pure-key {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 6px;
    gap: 4px;
}

/* ── Buttons ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
    white-space: nowrap;
    user-select: none;
    font-family: inherit;
}

.btn:active { transform: scale(.97); }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); }

.btn-ghost {
    background: transparent;
    color: var(--text2);
    border-color: var(--border2);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-danger {
    background: transparent;
    color: var(--red);
    border-color: rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.12); }

.btn-steam {
    background: #1b2838;
    color: #c6d4df;
    border-color: #2a475e;
    font-size: 12px;
}
.btn-steam:hover { background: #2a3f5f; color: #fff; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ── Auth / user widget ───────────────────────────── */
.user-widget {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border2);
}

.username {
    font-size: 13px;
    font-weight: 600;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-wrap { position: relative; }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--nav-bg);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 4px;
    min-width: 145px;
    box-shadow: var(--shadow);
    z-index: 300;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 5px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s;
}
.dropdown-menu button:hover { background: var(--surface2); }

/* ── Mobile tabs ──────────────────────────────────── */
.mob-tabs { display: none; }

/* ── Main layout ──────────────────────────────────── */
.layout {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0; bottom: 0;
    display: flex;
    overflow: hidden;
}

/* ── Inventory panel ──────────────────────────────── */
.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    min-width: 0;
    overflow: hidden;
}

.panel-right {
    border-right: none;
    border-left: 1px solid var(--border);
}

.panel-head {
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--nav-bg);
}

.panel-title-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.panel-title-row h2 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.count {
    font-size: 11px;
    color: var(--text3);
}

.panel-controls {
    display: flex;
    gap: 7px;
}

.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text2);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}
.toggle-label input[type="checkbox"] {
    accent-color: var(--blue);
    width: 13px;
    height: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    outline: none;
    font-family: inherit;
}
.search-input:focus { border-color: var(--blue); }
.search-input::placeholder { color: var(--text3); }

.sort-select {
    padding: 7px 28px 7px 10px;
    background: var(--surface2)
        url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234d5f72' stroke-width='2.5'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e")
        no-repeat right 6px center / 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text2);
    font-size: 12px;
    appearance: none;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
    font-family: inherit;
}
.sort-select:focus { border-color: var(--blue); }

/* ── Item grid ────────────────────────────────────── */
.item-grid {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    align-content: start;
    scrollbar-gutter: stable;
}

/* ── Item card ────────────────────────────────────── */
.item-card {
    background: var(--card-bg);
    border: 1.5px solid rgba(99,102,241,0.15);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .18s, transform .18s, box-shadow .18s;
    position: relative;
    display: flex;
    flex-direction: column;
    user-select: none;
}

.item-card:hover {
    border-color: var(--blue);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 14px rgba(99,102,241,0.22), 0 4px 12px rgba(0,0,0,.45);
}

.item-card.in-cart {
    border-color: var(--green);
    box-shadow: 0 0 10px rgba(34,197,94,.2), 0 0 0 1px rgba(34,197,94,.15);
}

/* Items the bot isn't buying — shown but not interactive */
.item-card.is-no-price {
    opacity: .32;
    cursor: default;
    pointer-events: none;
}

.item-card.is-not-buying {
    opacity: .45;
    cursor: default;
    pointer-events: none;
}

/* Legacy class kept for compatibility */
.item-card.no-price {
    opacity: .38;
    cursor: default;
    pointer-events: none;
}

/* Overstocked — orange tint, still interactive */
.item-card.is-overstocked {
    border-color: rgba(251,146,60,.4);
    background: linear-gradient(160deg, rgba(251,146,60,.07) 0%, var(--card-bg) 60%);
}

.stock-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 5px;
    border-radius: 3px;
    pointer-events: none;
    z-index: 2;
}

.overstocked-badge {
    background: rgba(251,146,60,.85);
    color: #fff;
}

.price-original {
    text-decoration: line-through;
    opacity: .45;
    font-size: 10px;
    margin-right: 3px;
}

.item-card.is-pure {
    border-color: rgba(251,191,36,.35);
    background: linear-gradient(160deg, rgba(251,191,36,.06) 0%, var(--card-bg) 60%);
    cursor: default;
}

.item-card.is-pure:hover {
    transform: none;
    box-shadow: none;
}

/* Image area */
.card-img-wrap {
    width: 100%;
    aspect-ratio: 1;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-img {
    width: 78%;
    height: 78%;
    object-fit: contain;
    transition: transform .2s;
}

.item-card:not(.is-pure):not(.no-price):not(.is-no-price):not(.is-not-buying):hover .card-img {
    transform: scale(1.06);
}

/* Body */
.card-body {
    padding: 6px 7px 7px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.card-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.1px;
    text-align: center;
}

.card-quality-line {
    height: 3px;
    width: 100%;
    border-radius: 2px;
    margin-top: 4px;
    opacity: 0.9;
    transition: opacity .18s, box-shadow .18s;
}

.item-card:hover .card-quality-line { opacity: 1; }

.unusual-effect-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    opacity: 0.55;
    mix-blend-mode: screen;
    border-radius: inherit;
    transition: opacity .18s;
}

.item-card:hover .unusual-effect-bg { opacity: 0.8; }

/* ── Item attribute chips (sheen / killstreaker / spells / strange parts) ── */
.card-attrs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 2px 0 1px;
}
.card-attr {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .02em;
    border-radius: 3px;
    padding: 1px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.4;
}
.attr-sheen  { background: rgba(225,225,15,.14); color: #d4d400; }
.attr-ke     { background: rgba(225,225,15,.09); color: #b8b000; }
.attr-spell  { background: rgba(126,169,209,.14); color: #7ea9d1; }
.attr-parts  { background: rgba(117,107,94,.22);  color: #a89e8e; }

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-top: auto;
    padding-top: 4px;
}

.card-price {
    font-size: 11px;
    font-weight: 700;
    color: var(--price);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-price.no-buy { color: var(--text3); font-weight: 400; }

.card-meta {
    font-size: 11px;
    color: var(--text3);
    font-weight: 600;
    flex-shrink: 0;
}

.is-pure .card-meta {
    font-size: 13px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.2px;
    text-align: center;
}

.is-pure .card-footer {
    justify-content: center;
}

/* Cart badge */
.qty-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: var(--green);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
}

/* ── State placeholders ───────────────────────────── */
.state-msg {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--text3);
    font-size: 13px;
    text-align: center;
    line-height: 1.6;
}

.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border2);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin .65s linear infinite;
}

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

/* ── Cart panel ───────────────────────────────────── */
.cart-panel {
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    background: var(--nav-bg);
    overflow: hidden;
}

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

.cart-half + .cart-half {
    border-top: 1px solid var(--border);
}

.cart-half-label {
    padding: 10px 14px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--text3);
    flex-shrink: 0;
}

.cart-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Cart empty */
.cart-empty {
    color: var(--text3);
    font-size: 12px;
    text-align: center;
    padding: 20px 12px;
    line-height: 1.6;
}

/* Cart row */
.cart-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px;
    border-radius: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.cart-row:hover { border-color: var(--border2); background: var(--surface2); }

.cart-row.synth {
    background: rgba(245,158,11,.05);
    border-color: rgba(245,158,11,.18);
    cursor: default;
    opacity: .85;
}
.cart-row.synth:hover { background: rgba(245,158,11,.05); border-color: rgba(245,158,11,.18); }

.cart-thumb {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

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

.cart-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.cart-sub {
    font-size: 11px;
    color: var(--text2);
}

.cart-qty {
    background: var(--blue);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 99px;
    flex-shrink: 0;
    white-space: nowrap;
}

.cart-qty.pure { background: var(--gold); color: #000; }

.cart-rm {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text3);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .12s, color .12s, border-color .12s;
    padding: 0;
    line-height: 1;
    font-family: inherit;
}
.cart-rm:hover { background: rgba(239,68,68,.15); color: var(--red); border-color: var(--red); }

/* Cart totals */
.cart-total {
    padding: 5px 14px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--price);
    text-align: right;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.cart-total:empty { display: none; }

/* Cart footer */
.cart-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.text-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    outline: none;
    font-family: inherit;
}
.text-input:focus { border-color: var(--blue); }
.text-input::placeholder { color: var(--text3); }

.trade-result {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
}
.trade-result.success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.25); color: #86efac; }
.trade-result.success a { color: #86efac; text-decoration: underline; font-weight: 600; }
.trade-result.success a:hover { color: #fff; }
.trade-result.error   a { color: #fca5a5; text-decoration: underline; font-weight: 600; }
.trade-result.pending a { color: #93c5fd; text-decoration: underline; font-weight: 600; }
.trade-result.error   { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25); color: #fca5a5; }
.trade-result.pending { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.25); color: #93c5fd; }

.item-card.is-locked {
    opacity: 0.35;
    pointer-events: none;
    filter: grayscale(0.4);
}

/* ── Overlay & modals ─────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

/* Qty modal */
.qty-modal {
    background: var(--nav-bg);
    border: 1px solid var(--border2);
    border-radius: 14px;
    padding: 24px;
    width: 440px;
    max-width: 95vw;
    box-shadow: var(--shadow);
    position: relative;
    animation: pop .18s ease-out;
}

@keyframes pop {
    from { opacity: 0; transform: scale(.94); }
    to   { opacity: 1; transform: scale(1); }
}

.qty-modal-inner {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.qty-img-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    flex-shrink: 0;
    background: var(--surface2);
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.qty-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qty-effect {
    position: absolute;
    inset: -10%;
    width: 120%;
    height: 120%;
    object-fit: cover;
    opacity: .55;
    pointer-events: none;
    z-index: 0;
}

.qty-img { z-index: 1; }

.qty-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.qty-name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

.qty-sku {
    font-size: 11px;
    color: var(--text3);
    font-family: monospace;
}

.qty-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--price);
    margin-top: 4px;
    letter-spacing: -.3px;
}

.qty-quality {
    font-size: 12px;
    font-weight: 600;
    margin-top: 1px;
}

.qty-avail {
    font-size: 12px;
    color: var(--text2);
}

.qty-attrs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
}

.qty-attr-row {
    font-size: 11px;
    color: var(--text);
    line-height: 1.5;
}

.qty-attr-key {
    color: var(--text3);
    margin-right: 3px;
}

.qty-spell { color: #7ea9d1; }
.qty-part  { color: #c9a87a; }

.qty-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.qty-step-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    color: var(--text);
    font-size: 20px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s;
    padding: 0;
    flex-shrink: 0;
    font-family: inherit;
}
.qty-step-btn:hover { background: var(--surface3); }

.qty-input {
    width: 72px;
    text-align: center;
    padding: 6px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 9px;
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    outline: none;
    -moz-appearance: textfield;
    font-family: inherit;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty-input:focus { border-color: var(--blue); }

.qty-actions {
    display: flex;
    gap: 7px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.qty-actions .btn { flex: 1; min-width: 80px; }

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text2);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s;
    padding: 0;
    line-height: 1;
    font-family: inherit;
}
.close-btn:hover { background: var(--surface2); color: var(--text); }

/* Trade URL modal */
.url-modal {
    background: var(--nav-bg);
    border: 1px solid var(--border2);
    border-radius: 14px;
    padding: 28px;
    width: 480px;
    max-width: 95vw;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: pop .18s ease-out;
}

.url-modal h3 { font-size: 16px; font-weight: 700; }

.modal-hint {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.6;
}

.modal-actions { display: flex; gap: 8px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }

/* ── Lock badge (partially-in-trade items) ────────── */
.lock-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(245,158,11,.88);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .02em;
    border-radius: 3px;
    padding: 2px 5px;
    pointer-events: none;
    z-index: 2;
}

.lock-badge.lock-badge-full {
    background: rgba(239,68,68,.9);
    font-size: 10px;
    letter-spacing: .03em;
}

.item-card.has-partial-lock {
    border-color: rgba(245,158,11,.45) !important;
}

/* ── Tooltip ──────────────────────────────────────── */
.tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 999;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 10px;
    padding: 10px;
    font-size: 12px;
    width: 230px;
    box-shadow: 0 10px 32px rgba(0,0,0,.85);
    display: none;
    line-height: 1.4;
}

.tip-row {
    display: flex;
    gap: 9px;
    align-items: flex-start;
}

.tip-img-wrap {
    position: relative;
    width: 62px;
    height: 62px;
    background: rgba(0,0,0,.35);
    border-radius: 6px;
    border: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
}

.tip-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
}

.tip-effect {
    position: absolute;
    inset: -10%;
    width: 120%;
    height: 120%;
    object-fit: cover;
    opacity: .5;
    pointer-events: none;
    z-index: 0;
}

.tip-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tip-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.tip-quality {
    font-size: 10px;
    font-weight: 600;
    margin-top: 1px;
}

.tip-price {
    font-size: 13px;
    font-weight: 800;
    color: var(--price);
    margin-top: 3px;
}

.tip-detail {
    font-size: 11px;
    color: var(--text2);
    margin-top: 1px;
}

.tip-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 7px 0 5px;
}

.tip-attr {
    display: flex;
    gap: 5px;
    font-size: 11px;
    color: var(--text);
    line-height: 1.5;
}

.tip-attr-key {
    color: var(--text3);
    flex-shrink: 0;
}

.tip-spell { font-size: 11px; color: #7ea9d1; line-height: 1.5; }
.tip-part  { font-size: 11px; color: #c9a87a; line-height: 1.5; }

/* ── Hidden ───────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 1100px) {
    .cart-panel { flex-basis: 300px; }
}

@media (max-width: 860px) {
    /* Tab bar */
    .mob-tabs {
        position: fixed;
        top: var(--header-h);
        left: 0; right: 0;
        height: 42px;
        display: flex;
        background: var(--nav-bg);
        border-bottom: 1px solid var(--border);
        z-index: 99;
    }

    .mob-tab {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        background: none;
        border: none;
        border-bottom: 2px solid transparent;
        color: var(--text2);
        font-size: 13px;
        font-weight: 600;
        font-family: inherit;
        cursor: pointer;
        transition: color .15s, border-color .15s;
        padding: 0 8px;
    }

    .mob-tab.is-active {
        color: var(--blue);
        border-bottom-color: var(--blue);
    }

    .mob-tab-count {
        font-size: 11px;
        font-weight: 400;
        color: var(--text3);
    }

    /* Layout pushes below tabs */
    .layout { top: calc(var(--header-h) + 42px); }

    /* All panels hidden by default; only .mob-active shows */
    .panel, .panel-right, .cart-panel {
        display: none;
        flex: 0 0 100%;
        border: none;
    }

    .panel.mob-active, .panel-right.mob-active, .cart-panel.mob-active {
        display: flex;
    }

    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (max-width: 500px) {
    .header { padding: 0 12px; }
    .logo { font-size: 14px; }
    .pure-bar { display: none; }
    .username { display: none; }

    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 6px;
        padding: 8px;
    }
}
