/* --- Browse Series Landing --- */
.cards-grid.browse-mode {
    display: block;
    padding: 2rem;
}

.browse-heading {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.series-card {
    border-radius: 12px;
    padding: 1.5rem;
    min-height: 110px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.series-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    pointer-events: none;
}

.series-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.series-card-logo {
    max-height: 45px;
    max-width: 80%;
    object-fit: contain;
    filter: brightness(1.1);
    flex: 1;
    align-self: center;
    object-position: center;
}

.series-card-logo.large-logo {
    max-height: 80px;
    max-width: 95%;
}

img.series-card-logo[alt*="Black" i],
img.series-card-logo[alt*="Diamond" i],
img.series-card-logo[alt*="Mega" i] {
    transform: scale(1.3);
}

img.series-card-logo[alt="Base" i],
img.series-card-logo[alt*="E-Card" i],
img.series-card-logo[alt="EX" i],
img.series-card-logo[alt="Gym" i],
img.series-card-logo[alt="Neo" i],
img.series-card-logo[alt="NP" i],
img.series-card-logo[alt="Other" i],
img.series-card-logo[alt="Promo" i],
img.series-card-logo[alt="XY" i],
img.series-card-logo[alt*="Scarlet" i] {
    transform: translateY(10px);
}

img.series-card-logo[alt*="Pop" i] {
    max-height: 62px;
    max-width: 95%;
    transform: translateY(10px) scale(1.45);
}

.series-card-name {
    font-weight: 800;
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    flex: 1;
    display: flex;
    align-items: center;
}

.series-owned-count {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 700;
    background: transparent;
    padding: 2px 0;
    border-radius: 0;
    z-index: 2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.series-card-count {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 10px;
    border-radius: 10px;
    z-index: 2;
    margin-top: auto;
}

.placeholder-msg {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
    font-size: 1.1rem;
}

/* --- Back Button --- */
.back-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    color: var(--accent);
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255,255,255,0.12);
}

/* --- Series Sets Header --- */
.series-sets-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-panel);
    border-radius: 12px;
    border-left: 4px solid;
}

.series-sets-logo {
    max-height: 40px;
    object-fit: contain;
}

.series-sets-name {
    font-weight: 800;
    font-size: 1.5rem;
    text-transform: uppercase;
}

.series-sets-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- Sets Grid --- */
.sets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.set-card {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    min-height: 120px;
}

.set-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-hover);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    background: var(--bg-panel-hover);
}

.set-card-logo {
    max-height: 50px;
    max-width: 90%;
    object-fit: contain;
}

.set-card-fallback {
    display: none;
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
    color: var(--accent);
}

.set-card-fallback.visible {
    display: block;
}

.set-card-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.set-card-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.set-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-item {
    position: relative;
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid transparent;
}

.card-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-hover);
}

.card-image {
    position: relative;
    z-index: 1;
    width: 100%;
    aspect-ratio: 2.5 / 3.5;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.card-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-variant {
    font-size: 0.8rem;
    color: var(--accent);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.card-set-context {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

.owned-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 2;
}

.variant-border-1st { border-color: #ef4444 !important; }
.variant-border-reverse { border-color: #ec4899 !important; }
.variant-border-holo { border-color: #eab308 !important; }

/* Unowned cards keep their color, but sit behind a muted sleeve overlay. */
.card-item.unowned .card-image {
    filter: none;
    opacity: 0.54;
    transition: opacity 0.3s;
}

.card-item.unowned::before {
    content: "";
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    aspect-ratio: 2.5 / 3.5;
    border-radius: 8px;
    z-index: 2;
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 28%),
        linear-gradient(180deg, rgba(30, 55, 48, 0.28), rgba(88, 112, 72, 0.2));
    box-shadow:
        inset 0 0 0 999px rgba(42, 72, 58, 0.13),
        inset 0 0 26px rgba(0, 0, 0, 0.16);
}

.card-item.unowned:hover .card-image {
    filter: none;
    opacity: 0.64;
}
