/* ====================================================
   Card List CSS - Mobile Optimized
==================================================== */

/* Container for the card list */
#card-list-container {
    margin: -30px;
    font-family: Arial, sans-serif;
}

/* ---------- Filter Section Styling ---------- */
#card-list-filters {
    position: relative;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    background-color: #1e1e1e;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    justify-content: center;
}

#card-list-filters input[type="text"]#card-list-search {
    margin-bottom: 0 !important;
}


/* Container for search row + filter dropdowns (merged top section) */
.card-list-toprow {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* Row 1 (desktop): search + alt-art + sort grouped so they're guaranteed one row */
.card-list-searchbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 100%;
    min-width: 0;
    flex-wrap: nowrap;
}

/* Responsive row-break spacers inside .card-list-toprow (full-width, invisible) */
.frow-break { flex: 0 0 100%; height: 0; margin: 0; padding: 0; }
.frow-break-mobile { display: none; } /* hidden on desktop, shown on mobile */

/* Search "input" — actually a flex container styled like an input binder,
   so chips and the real <input> can sit side-by-side INSIDE the visible
   field (same pattern Discord/Slack use for chip-aware inputs). */
#card-list-filters .card-list-search-field {
    position: relative;
    flex: 2;
    min-width: 200px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 36px;
    padding: 4px 36px 4px 36px;
    background: #1e1e1e;
    border: 2px solid #444;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#card-list-filters .card-list-search-field:focus-within {
    border-color: var(--ps-gold);
}

.card-list-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 1;
}

.card-list-search-field #card-list-search {
    flex: 1;
    min-width: 80px;
    width: auto;
    height: 26px;
    padding: 0;
    font-size: 0.9rem;
    color: #fff;
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 0;
    outline: none;
}

.card-list-search-field #card-list-search:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

.card-list-search-field #card-list-search::placeholder {
    color: #555;
}

#card-list-filters .card-list-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    padding: 0;
    background: #666;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

#card-list-filters .card-list-search-clear:hover {
    background: #ef4444;
    transform: translateY(-50%) scale(1.1);
}

#card-list-filters .card-list-search-clear.visible {
    display: flex;
}

/* Footer row inside the filter binder: result count on the left, Clear Filters
   on the right. flex: 1 1 100% forces it onto its own line within the
   wrapping flex parent (#card-list-filters has flex-wrap: wrap). */
.card-list-filter-footer {
    flex: 1 1 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    min-height: 28px;
}

.card-list-result-count {
    color: #aaa;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-align: left;
}

.card-list-result-count[hidden] {
    display: none;
}

/* Footer layout: count and +/- grouped on the LEFT, Clear Filters on the
   RIGHT. The +/- block gets `margin-right: auto` so Clear stays pinned right
   regardless of whether it's visible. */
.card-list-filter-footer .card-list-result-count {
    text-align: left;
}

.card-list-filter-footer #card-list-column-control {
    margin-right: auto;
}

.card-list-filter-footer .clear-filters-btn {
    margin-left: auto;
}

/* Number between the −/+ buttons */
.card-list-cols-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 24px;
    padding: 0 4px;
    color: #ddd;
    font-size: 13px;
    font-weight: 600;
    user-select: none;
}

/* Sort dropdown styling — dark theme with gold accent on hover/focus.
   Scoped under #card-list-filters for specificity over generic theme rules. */
#card-list-filters #card-list-sort {
    flex: 0 0 160px;
    width: 160px;
    height: 36px;
    padding: 0 28px 0 12px;
    font-size: 14px;
    border: 1px solid #555;
    border-radius: 6px;
    background-color: #2a2a2a;
    color: #ccc !important;
    -webkit-text-fill-color: #ccc !important;
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23aaa' d='M0 0l5 6 5-6z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

#card-list-filters #card-list-sort:hover {
    background-color: #3a3a3a;
    border-color: var(--ps-gold);
}

#card-list-filters #card-list-sort:focus,
#card-list-filters #card-list-sort:focus-visible {
    outline: none;
    border-color: var(--ps-gold);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.25);
}

#card-list-filters #card-list-sort option {
    background: #2a2a2a;
    color: #ccc;
}

/* Sort wrapper with direction toggle */
#card-list-filters .sort-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    width: auto; /* neutralize leaked .sort-wrapper{width:100%} from deck-builder.css:96 */
}

#card-list-filters .sort-direction-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #999;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

#card-list-filters .sort-direction-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

#card-list-filters .sort-direction-btn.desc {
    color: var(--ps-orange);
    border-color: rgba(255, 166, 0, 0.4);
}

#card-list-filters .sort-direction-btn i {
    font-size: 14px;
    transition: transform 0.2s ease;
}

#card-list-filters .sort-direction-btn.desc i {
    transform: scaleY(-1);
}

/* Multi-select set dropdown */
#card-list-filters .multi-select-dropdown {
    position: relative;
    flex: 0 0 160px;
}

/* Row 2 order: Colors, Type, Element, Sub-Type, Work, Set, Rarity */
.card-list-toprow .card-list-colors-inline { order: 0; }
.card-list-toprow #card-list-type-wrapper    { order: 1; }
.card-list-toprow #card-list-element-wrapper { order: 2; }
.card-list-toprow #card-list-subtype-wrapper { order: 3; }
.card-list-toprow #card-list-work-wrapper    { order: 4; }
.card-list-toprow #card-list-set-wrapper     { order: 5; }
.card-list-toprow #card-list-rarity-wrapper  { order: 6; }

#card-list-filters .multi-select-btn {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    background-color: #2a2a2a;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
    box-sizing: border-box;
}

#card-list-filters .multi-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#card-list-filters .multi-select-btn:hover {
    background-color: #3a3a3a;
    border-color: var(--ps-gold);
}

#card-list-filters .multi-select-btn:focus,
#card-list-filters .multi-select-dropdown.open .multi-select-btn {
    outline: none;
    border-color: var(--ps-gold);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.25);
}

#card-list-filters .multi-select-btn i {
    font-size: 12px;
    color: #aaa;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

#card-list-filters .multi-select-dropdown.open .multi-select-btn i {
    transform: rotate(180deg);
}

#card-list-filters .multi-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    padding: 6px 0;
}

#card-list-filters .multi-select-dropdown.open .multi-select-options {
    display: block;
}

#card-list-filters .multi-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    color: #ddd;
    font-size: 14px;
}

#card-list-filters .multi-select-option:hover {
    background: #3a3a3a;
    color: #fff;
}

#card-list-filters .multi-select-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--ps-gold);
    cursor: pointer;
    flex-shrink: 0;
}

#card-list-filters .multi-select-option span {
    flex: 1;
    user-select: none;
}

#card-list-filters .multi-select-option:has(input:checked) {
    background: rgba(255, 215, 0, 0.08);
    color: var(--ps-gold);
}

#card-list-filters .multi-select-option:has(input:checked):hover {
    background: rgba(255, 215, 0, 0.15);
    color: var(--ps-gold);
}

#card-list-filters .multi-select-label .selected-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ps-gold);
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    margin-left: 6px;
}

/* ---- Inline filter row: colors + range sliders ---- */
#card-list-filters #card-filter-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 12px;
    width: 100%;
}

/* ---- Dropdown row (row 2): Colors + all the multi-selects ---- */
/* (the old #card-list-filter-dropdowns container was merged into .card-list-toprow) */

/* ---- Filter Colors: inline dot swatches (no box) ---- */
.card-list-colors-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.card-list-colors-label {
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #9aa0a6;
    font-weight: 700;
}
#card-filters-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
/* Swatch = dot + white ring only. Kill the dropdown-option box in every state. */
#card-filters-colors .multi-select-option,
#card-filters-colors .multi-select-option:hover,
#card-filters-colors .multi-select-option:has(input:checked) {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    cursor: pointer;
    display: inline-flex;
}
#card-filters-colors input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}
#card-filters-colors .filter-color-dot {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.25);
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
#card-filters-colors .multi-select-option:hover .filter-color-dot {
    transform: scale(1.1);
}
#card-filters-colors input[type="checkbox"]:checked + .filter-color-dot {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255,255,255,.5);
}

/* ---- Range sliders: Cost, Power, Strike (dual-handle) ---- */
#card-filters-cost.cost-range-slider,
#card-filters-power.cost-range-slider,
#card-filters-strike.cost-range-slider {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 280px; /* grow to share the row evenly; no max so they use big-screen width */
    min-width: 220px;
    padding: 2px 8px;
    box-sizing: border-box;
}

.cost-range-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    line-height: 1.2;
}
.cost-range-title {
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #d8d8d8;
}
.cost-range-value {
    font-weight: 600;
    color: var(--ps-amber);
}

.cost-range-track-wrap {
    position: relative;
    height: 16px;
    margin: 4px 0 2px;
}
.cost-range-rail,
.cost-range-fill {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 5px;
    border-radius: 4px;
    pointer-events: none;
}
.cost-range-rail {
    left: 0;
    right: 0;
    background: #3a3a3a;
}
.cost-range-fill {
    left: 0;
    width: 100%;
    background: var(--ps-amber);
}

/* Two range inputs stacked over the rail; only the thumbs are interactive */
.cost-range-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 16px;
    margin: 0;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}
.cost-range-input::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    background: none;
    border: none;
    height: 16px;
}
.cost-range-input::-moz-range-track {
    background: none;
    border: none;
    height: 16px;
}
.cost-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ps-amber-light);
    border: 2px solid #1a1a1a;
    box-shadow: 0 0 0 1px var(--ps-amber);
    cursor: grab;
}
.cost-range-input::-webkit-slider-thumb:active { cursor: grabbing; }
.cost-range-input::-moz-range-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border: 2px solid #1a1a1a;
    border-radius: 50%;
    background: var(--ps-amber-light);
    box-shadow: 0 0 0 1px var(--ps-amber);
    cursor: grab;
    -moz-appearance: none;
}

.cost-range-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #9aa0a6;
    padding: 0 1px;
}

/* ---------- Active slash-filter chips (inline-input model) ---------- */
/* Sits INSIDE the search input wrapper, alongside the text <input>. */
.card-list-search-chips {
    display: contents; /* let chips be direct flex children of the wrapper */
}

.card-list-search-chips[hidden] {
    display: none;
}

.card-list-search-chip {
    display: inline-flex;
    align-items: stretch;
    height: 26px;
    background: #2a2a2a;
    border: 1px solid rgba(255, 215, 0, 0.45);
    border-radius: 4px;
    overflow: hidden;
    font-size: 12px;
    font-weight: 600;
    line-height: 24px;
    flex-shrink: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-list-search-chip:focus-within {
    border-color: var(--ps-gold);
    box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.30);
}

.card-list-search-chip-key {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    background: rgba(255, 215, 0, 0.15);
    color: var(--ps-gold);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

.card-list-search-chip-sep {
    display: inline-flex;
    align-items: center;
    padding: 0 4px 0 4px;
    color: #888;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* Operator selector — clickable but visually minimal: just the symbol
   centered in a small slot. Hover/focus highlights it gold to signal
   it's interactive (native dropdown opens on click).
   Native <select> ignores flex child alignment for its internal text,
   so we make the select itself a flex container to vertically center. */
.card-list-search-chip .card-list-search-chip-op {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    box-sizing: border-box;
    width: 22px;
    height: 100%;
    padding: 0;
    margin: 0;
    background: transparent;
    color: #aaa;
    border: none;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    text-align: center;
    text-align-last: center;
    text-indent: 0;
    vertical-align: middle;
}

.card-list-search-chip .card-list-search-chip-op:hover {
    color: var(--ps-gold);
    background-color: rgba(255, 215, 0, 0.10);
}

.card-list-search-chip .card-list-search-chip-op:focus {
    color: var(--ps-gold);
    background-color: rgba(255, 215, 0, 0.15);
}

/* Style the dropdown popup options when the operator is opened */
.card-list-search-chip-op option {
    background: #2a2a2a;
    color: #ddd;
    font-weight: 600;
}

/* Chip's value input — auto-sized to content via chipFitInputWidth().
   Higher specificity (`.card-list-search-chip .card-list-search-chip-input`)
   to win over any theme/global input rules. Asymmetric padding: small gap
   on the left so the value clears the separator/operator, zero on the
   right so the × button sits flush against the value. */
.card-list-search-chip .card-list-search-chip-input {
    align-self: stretch;
    box-sizing: content-box;
    min-width: 14px;
    width: 14px; /* JS overwrites this on every input event */
    height: auto;
    padding: 0 0 0 6px;
    margin: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    box-shadow: none;
}

.card-list-search-chip .card-list-search-chip-input:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

.card-list-search-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(255, 215, 0, 0.20);
    color: #aaa;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.card-list-search-chip-remove:hover {
    background: rgba(244, 67, 54, 0.30);
    color: #fff;
}

/* ---------- Slash-command suggestion dropdown (minimal style) ----------
   Quiet, low-visual-weight container. Commands are just gold monospace text
   (no badges/pills/borders). Rows highlight only on hover/keyboard nav. */
.card-list-search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    z-index: 1100;
    max-height: 320px;
    overflow-y: auto;
    padding: 6px 0;
}

.card-list-search-suggestions[hidden] {
    display: none;
}

.card-list-search-suggestion {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 9px 18px;
    cursor: pointer;
    transition: background 0.12s ease;
    position: relative;
}

.card-list-search-suggestion:hover,
.card-list-search-suggestion.is-highlighted {
    background: rgba(255, 215, 0, 0.06);
}

/* Subtle gold accent line on the active/highlighted row */
.card-list-search-suggestion.is-highlighted::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--ps-gold);
    border-radius: 0 2px 2px 0;
}

.card-list-search-suggestion[hidden] {
    display: none;
}

.card-list-search-suggestion-cmd {
    display: inline-block;
    min-width: 64px;
    padding: 0;
    background: transparent;
    color: var(--ps-gold);
    border: none;
    border-radius: 0;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

.card-list-search-suggestion-desc {
    color: #999;
    font-size: 13px;
    line-height: 1.3;
}

.card-list-search-suggestion-empty {
    padding: 14px 18px;
    color: #777;
    font-size: 13px;
    font-style: italic;
}

.card-list-search-suggestion-empty[hidden] {
    display: none;
}

.card-list-search-suggestion-hint {
    padding: 10px 18px;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: #666;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-list-search-suggestion-hint kbd {
    display: inline-block;
    min-width: 16px;
    padding: 1px 5px;
    background: rgba(255, 255, 255, 0.06);
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 3px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 10px;
    text-align: center;
}

/* ---------- Column +/- Control ---------- */
#card-list-column-control {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

#card-list-column-control .card-list-col-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #555;
    background: #2a2a2a;
    color: #aaa;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

#card-list-column-control .card-list-col-btn:hover {
    background: #3a3a3a;
    color: #fff;
    border-color: var(--ps-gold);
}

#card-list-column-control .card-list-col-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ---------- Card List Grid Styling ---------- */
.card-list-grid {
    display: grid;
    --card-list-cols: 6;
    grid-template-columns: repeat(var(--card-list-cols), 1fr);
    gap: 1px;
	transition: opacity 0.15s ease;
}
.card-list-grid.filtering {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/* Alt-art visibility: CSS-driven instead of JS .each() loop */
.card-list-grid.hide-alt-art .card-item.is-alt-art {
    display: none;
}

.card-item {
    padding: 5px;
    text-align: center;
    transition: transform 0.2s ease;
    cursor: pointer;
}

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

.card-list-image {
    width: 100%;
    height: auto;
    display: block;
}

.clear-filters-btn {
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(244, 67, 54, 0.10);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.4);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    /* Default state: invisible but still occupies layout space so the
       footer row doesn't shift when filters become active. */
    visibility: hidden;
    pointer-events: none;
}

.clear-filters-btn.is-active {
    visibility: visible;
    pointer-events: auto;
}

.clear-filters-btn:hover {
    background: rgba(244, 67, 54, 0.20);
    color: #ff5a4d;
    border-color: rgba(244, 67, 54, 0.7);
}

/* Alt-Art toggle button - matches dark dropdown style */
#card-list-filters .alt-art-toggle {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

#card-list-filters .alt-art-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

#card-list-filters .alt-art-segment:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

#card-list-filters .alt-art-segment.active {
    color: var(--ps-orange);
    border-color: rgba(255, 166, 0, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

/* Tooltip on hover */
#card-list-filters .alt-art-segment::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 9999;
    border: 1px solid #444;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#card-list-filters .alt-art-segment:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ---------- Mobile Responsive Settings ---------- */

@media (max-width: 900px) {
    #card-list-filters {
        gap: 4px;
        padding: 12px 6px;
    }

    /* Dissolve the search-bar group so Sort drops alongside Colors; activate mobile breaks */
    .card-list-searchbar { display: contents; }
    .frow-break-mobile { display: block; }

    /* Row 1: search shrinks so the alt-art button always stays on its line */
    #card-list-filters .card-list-search-field {
        flex: 1 1 0;
        min-width: 140px;
    }

    /* Row 2: sort (dir + select) sits alongside the Colors band */
    #card-list-filters .sort-wrapper {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }
    #card-list-filters #card-list-sort {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }
    .card-list-colors-inline {
        flex: 1 1 auto;
        justify-content: center;
    }
    /* Drop the "COLORS" label on mobile so the dots have room to fit */
    .card-list-colors-label {
        display: none;
    }

    /* Filter dropdowns: 2 per row, uniform width (order handled globally) */
    #card-list-filters .multi-select-dropdown {
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 0 !important;
    }

    /* Smaller controls on mobile */
    #card-list-filters .multi-select-btn {
        height: 32px !important;
        padding: 0 8px !important;
        font-size: 14px !important;
    }

    #card-list-sort {
        height: 32px !important;
        padding: 0 8px !important;
        font-size: 14px !important;
    }

    #card-list-filters .sort-direction-btn {
        width: 32px;
        height: 32px;
    }

    #card-list-filters .alt-art-segment {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    /* Range sliders: each on its own full-width row on mobile.
       MUST use the .cost-range-slider class so this matches the desktop rule's
       (id+class) specificity and wins by source order — with id-only selectors
       the desktop `flex: 1 1 280px` outranks this and they stay 2-per-row. */
    #card-filters-cost.cost-range-slider,
    #card-filters-power.cost-range-slider,
    #card-filters-strike.cost-range-slider {
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
    }

    .clear-filters-btn {
        position: static;
    }
}

@media (max-width: 500px) {
    #card-list-filters .card-list-search-field {
        flex: 1 1 0;
        min-width: 110px;
    }
    .card-list-search-field #card-list-search {
        font-size: 14px;
    }

    /* Alt art tooltip off on mobile */
    #card-list-filters .alt-art-segment::after {
        display: none;
    }

    #card-filters-cost.cost-range-slider {
        gap: 4px;
    }
}

@media (max-width: 768px) {
    .card-list-grid {
        --card-list-cols: 3;
    }
}

/* Infinite Scroll */
.infinite-scroll-end {
    text-align: center;
    padding: 30px 20px;
    color: #888;
    font-size: 14px;
    border-top: 1px solid #333;
    margin-top: 20px;
}

#card-list-loading {
    display: none;
    justify-content: center;
    padding: 30px 0;
}

#card-list-loading::before {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #333;
    border-top-color: #007cba;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Banned card indicator ── */
.card-item.card-banned {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.card-item.card-banned .card-list-image {
  filter: grayscale(60%);
}

.card-item.card-banned:hover .card-list-image {
  filter: grayscale(30%);
}

.card-item.card-banned .banned-badge {
  position: absolute;
  top: 2%;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  text-align: center;
  z-index: 5;
  background: linear-gradient(90deg, transparent, rgba(180, 30, 30, 0.92) 15%, rgba(200, 40, 40, 0.95) 50%, rgba(180, 30, 30, 0.92) 85%, transparent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 4px 0;
  pointer-events: none;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* No Results */
.card-list-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #888;
}

.card-list-no-results i {
  display: block;
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.card-list-no-results p {
  font-size: 1.1rem;
  margin: 0;
  color: #aaa;
}