/* ==========================================================================
   CSS Variables & Reset
   ========================================================================== */
   :root {
    /* Color Palette */
    --bg-color: #0b0c10;
    --bg-gradient: linear-gradient(135deg, #0b0c10 0%, #1f2833 100%);
    --card-bg: rgba(31, 40, 51, 0.4);
    --card-border: rgba(102, 252, 241, 0.2);
    --primary-color: #66fcf1;
    --primary-hover: #45a29e;
    --text-main: #e0e2e4;
    --text-muted: #8b929a;
    --accent-red: #ff4b4b;
    --accent-green: #4ade80;

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body.theme-pokemon {
    --bg-color: #C41214;
    --bg-gradient: #C41214;
    --card-bg: #111;
    --primary-color: #ffde00;
    --primary-hover: #2ecc40;
    --card-border: #4ea8de;
    --lcd-blue: #4ea8de;
    background: #C41214 !important;
}

/* ── Pokédex Header ─────────────────────────────────────── */
body.theme-pokemon header.glass-panel {
    background: #C41214;
    border: none;
    border-bottom: 5px solid #8a0909;
    box-shadow: 0 5px 0 #5a0505, 0 8px 20px rgba(0,0,0,0.5);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    padding: 18px 28px;
    margin-bottom: 0;
    position: relative;
}

/* Blue lens eye */
body.theme-pokemon .logo h1::before {
    content: '';
    display: inline-block;
    width: 46px;
    height: 46px;
    background: radial-gradient(circle at 38% 35%, #cceeff, #4ea8de 45%, #005a9e);
    border: 4px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    margin-right: 14px;
    box-shadow: 0 0 0 4px #222, 0 0 20px #4ea8de, inset 0 0 10px rgba(0,0,0,0.3);
    vertical-align: middle;
    flex-shrink: 0;
}

/* Status indicator dots (red · yellow · green) */
body.theme-pokemon header.glass-panel::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 96px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4444;
    box-shadow: 18px 0 0 #f5c542, 36px 0 0 #2ecc40;
}

body.theme-pokemon .logo h1 {
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

/* ── Screen / Main content area ─────────────────────────── */
body.theme-pokemon main {
    background: #111;
    border-top: 6px solid #555;
    padding: 20px 24px 28px;
    position: relative;
    box-shadow: inset 0 4px 20px rgba(0,0,0,0.7);
    min-height: 60vh;
}

/* Hinge line visual separator */
body.theme-pokemon main::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 18px;
    background: #888;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ── Search panel (screen bezel) ───────────────────────── */
body.theme-pokemon .cm-filters-container {
    background: #1a1a2e;
    border: 3px solid #666;
    border-radius: 6px;
    box-shadow: inset 0 0 24px rgba(0,20,80,0.3);
}

body.theme-pokemon .cm-filter-col label {
    color: #7ec8f0;
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

body.theme-pokemon .cm-input,
body.theme-pokemon .cm-dropdown {
    background: #0d1117;
    border: 1px solid #3a5070;
    color: #a0d8ef;
    font-family: 'Courier New', monospace;
}

body.theme-pokemon .cm-input::placeholder { color: #456; }

body.theme-pokemon .cm-input:focus,
body.theme-pokemon .cm-dropdown:focus {
    border-color: #4ea8de;
    box-shadow: 0 0 0 2px rgba(78,168,222,0.2);
}

/* Green Pokédex SEARCH button */
body.theme-pokemon .cm-btn-search {
    background: #1f8c2e;
    color: #fff;
    border: none;
    border-radius: 5px;
    box-shadow: 0 5px 0 #0f5018, inset 0 1px 0 rgba(255,255,255,0.15);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

body.theme-pokemon .cm-btn-search:hover {
    background: #28a83a;
    box-shadow: 0 3px 0 #0f5018;
    transform: translateY(2px);
}

/* ── Results panel (LCD screen) ────────────────────────── */
body.theme-pokemon .results-section {
    background: #0b0e1a;
    border: 3px solid #4ea8de;
    border-radius: 6px;
    padding: 16px;
    box-shadow: inset 0 0 40px rgba(0,30,80,0.5), 0 0 16px rgba(78,168,222,0.1);
}

body.theme-pokemon .cm-hits {
    color: #7ec8f0;
    font-family: 'Courier New', monospace;
}

body.theme-pokemon .cm-view-btn {
    background: #0d1117;
    border: 1px solid #4ea8de;
    color: #4ea8de;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

body.theme-pokemon .cm-view-btn.active,
body.theme-pokemon .cm-view-btn:hover {
    background: #4ea8de;
    color: #000;
}

/* ── Cards ──────────────────────────────────────────────── */
body.theme-pokemon .cm-card {
    background: #141820;
    border: 1px solid #2a3a50;
    border-radius: 4px;
    box-shadow: 0 0 6px rgba(78,168,222,0.08);
}

body.theme-pokemon .cm-card:hover {
    border-color: #ffde00;
    box-shadow: 0 0 18px rgba(255,222,0,0.35), 0 4px 12px rgba(0,0,0,0.4);
    transform: translateY(-4px);
}

body.theme-pokemon .cm-card-img-wrapper {
    background: #0d0d0d;
}

body.theme-pokemon .cm-card-title {
    color: #a0d8ef;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

body.theme-pokemon .cm-card-price {
    color: #ffde00;
    font-family: 'Courier New', monospace;
}

body.theme-pokemon .cm-card-price strong {
    color: #ffde00;
    text-shadow: 0 0 8px rgba(255,222,0,0.5);
}

/* ── Layout overrides ───────────────────────────────────── */
body.theme-pokemon .app-container {
    padding: 0;
}

body.theme-pokemon .search-section {
    margin-bottom: 0;
    padding: 0;
}

body.theme-pokemon main {
    /* also remove default app-container padding compensation */
}

/* ── Modal overrides ────────────────────────────────────── */
body.theme-pokemon .card-details-grid {
    background: #001219;
    border: 2px solid #333;
    box-shadow: inset 0 0 10px #4ea8de;
}

body.theme-pokemon .detail-value {
    color: #4ea8de;
    font-family: 'Courier New', Courier, monospace;
    text-transform: uppercase;
}

body.theme-pokemon .price-tag {
    background: #000;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    border: 1px solid #333;
}

/* ── Pokémon Modal — Red / Black / Yellow ─────────────── */
body.theme-pokemon .modal-content {
    background: rgba(10, 2, 2, 0.97);
    border: 1px solid rgba(204, 0, 0, 0.45);
    box-shadow: 0 0 50px rgba(204, 0, 0, 0.12), 0 20px 60px rgba(0,0,0,0.9);
}

body.theme-pokemon .modal-right h2 {
    color: #ffde00;
    text-shadow: 0 0 20px rgba(255, 222, 0, 0.35);
    margin-bottom: 0.8rem;
}

body.theme-pokemon .close-btn { color: rgba(255, 222, 0, 0.65); }
body.theme-pokemon .close-btn:hover { color: #ffde00; }

/* Cardmarket — bold Pokémon red */
body.theme-pokemon #modal-card-link {
    background: rgba(204, 0, 0, 0.22);
    border: 1px solid rgba(204, 0, 0, 0.65);
    color: #ff4040;
}
body.theme-pokemon #modal-card-link:hover { background: rgba(204, 0, 0, 0.32); }

/* PriceCharting — electric yellow */
body.theme-pokemon #modal-tcgplayer-link {
    background: rgba(255, 222, 0, 0.1);
    border-color: rgba(255, 222, 0, 0.5);
    color: #ffde00;
}
body.theme-pokemon #modal-tcgplayer-link:hover { background: rgba(255, 222, 0, 0.2); }

/* Details grid */
body.theme-pokemon .card-details-grid {
    background: rgba(25, 3, 3, 0.92);
    border: 1px solid rgba(204, 0, 0, 0.28);
    box-shadow: inset 0 0 12px rgba(204, 0, 0, 0.06);
    gap: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}
body.theme-pokemon .detail-label { color: rgba(255, 120, 120, 0.5); }
body.theme-pokemon .detail-value {
    color: #ffde00;
    font-family: 'Courier New', Courier, monospace;
    text-transform: uppercase;
}
body.theme-pokemon .detail-row { border-bottom-color: rgba(204, 0, 0, 0.15); }

/* Stat boxes */
body.theme-pokemon .stat-box {
    background: rgba(25, 3, 3, 0.92);
    border: 1px solid rgba(204, 0, 0, 0.28);
    box-shadow: inset 0 0 8px rgba(204, 0, 0, 0.05);
    padding: 0.7rem 0.3rem;
    min-width: 0;
}
body.theme-pokemon .stat-label { color: rgba(255, 120, 120, 0.5); font-size: 0.62rem; }
body.theme-pokemon .stat-value {
    color: #ffde00;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
}
body.theme-pokemon .price-stats-grid { margin-bottom: 1rem; gap: 0.5rem; }

/* Chart containers */
body.theme-pokemon .price-chart-container > div:first-child {
    background: rgba(25, 3, 3, 0.7) !important;
    border-color: rgba(204, 0, 0, 0.25) !important;
}
body.theme-pokemon .price-chart-container > div:last-child {
    background: rgba(25, 3, 3, 0.7) !important;
    border-color: rgba(255, 222, 0, 0.2) !important;
}
body.theme-pokemon .price-chart-container > div:first-child > div:first-child {
    color: #ff4040 !important;
}
body.theme-pokemon .price-chart-container > div:last-child > div:first-child {
    color: #ffde00 !important;
}

/* Red scrollbar */
body.theme-pokemon .modal-right {
    scrollbar-color: rgba(204, 0, 0, 0.4) transparent;
}
body.theme-pokemon .modal-right::-webkit-scrollbar { width: 4px; }
body.theme-pokemon .modal-right::-webkit-scrollbar-track { background: transparent; }
body.theme-pokemon .modal-right::-webkit-scrollbar-thumb {
    background: rgba(204, 0, 0, 0.4);
    border-radius: 2px;
}

/* ============================================================
   KAME HOUSE — Dragon Ball Super Theme
   ============================================================ */

/* Blurred background image — only the bg blurs, content stays sharp */
body.theme-dbs {
    --primary-color: #FFD700;
    --text-main: #f0e8d8;
    --text-muted: #c8b898;
    background: #1a0e28 !important;
    position: relative;
}

body.theme-dbs::before {
    content: '';
    position: fixed;
    inset: -30px;
    background: url('../assets/kame-house-bg-opt.jpg') center / cover no-repeat;
    filter: blur(10px);
    transform: scale(1.05);
    z-index: 0;
    will-change: transform;
}

/* Dark overlay to deepen contrast */
body.theme-dbs::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 22, 0.45);
    z-index: 0;
}

body.theme-dbs .app-container {
    padding: 0;
    position: relative;
    z-index: 1;
}

/* ── Header — bold sunset orange like Pokédex red ──────── */
body.theme-dbs header.glass-panel {
    background: #C44820;
    border: none;
    border-bottom: 5px solid #7A2800;
    box-shadow: 0 5px 0 #4A1400, 0 8px 24px rgba(0,0,0,0.55);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    padding: 18px 28px;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

/* Dragon Balls in header background */
body.theme-dbs header.glass-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../assets/dragonballs.svg') right center / auto 180% no-repeat;
    opacity: 0.15;
    pointer-events: none;
}

/* Status dots matching Pokédex style */
body.theme-dbs header.glass-panel::after {
    content: '';
    position: absolute;
    top: 22px;
    left: 98px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FFD700;
    box-shadow: 18px 0 0 #FF8C42, 36px 0 0 #E8A0E0;
}

/* Dragon Ball golden sphere */
body.theme-dbs .logo h1::before {
    content: '★';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    background: radial-gradient(circle at 38% 32%, #FFE066, #F5A623 50%, #C06000);
    border: 4px solid rgba(255,255,255,0.45);
    border-radius: 50%;
    margin-right: 14px;
    color: #7a2800;
    font-size: 1.3rem;
    box-shadow: 0 0 0 4px #7A2800, 0 0 20px rgba(255,210,0,0.7);
    vertical-align: middle;
    text-shadow: none;
    font-style: normal;
    flex-shrink: 0;
}

body.theme-dbs .logo h1 {
    text-transform: uppercase;
    font-style: italic;
    font-weight: 900;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

body.theme-dbs .logo h1 span {
    color: #FFD700;
}

/* ── Hinge / screen divider ────────────────────────────── */
body.theme-dbs main {
    background: rgba(8, 4, 20, 0.72);
    border-top: 6px solid #555;
    padding: 20px 24px 28px;
    position: relative;
    box-shadow: inset 0 4px 24px rgba(0,0,0,0.8);
    min-height: 60vh;
}

body.theme-dbs main::before {
    content: '';
    position: absolute;
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 18px;
    background: #888;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}

body.theme-dbs .search-section {
    margin-bottom: 0;
    padding: 0;
}

/* ── Search panel — dark screen ────────────────────────── */
body.theme-dbs .cm-filters-container {
    background: rgba(15, 8, 35, 0.82);
    border: 2px solid rgba(255,210,0,0.25);
    border-radius: 8px;
    box-shadow: inset 0 0 20px rgba(255,140,0,0.05);
    backdrop-filter: blur(8px);
}

body.theme-dbs .cm-filter-col label {
    color: #FFD700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
}

body.theme-dbs .cm-input,
body.theme-dbs .cm-dropdown {
    background: rgba(5, 3, 15, 0.80);
    border: 1px solid rgba(255,200,50,0.3);
    color: #f0e0c0;
}

body.theme-dbs .cm-input::placeholder { color: rgba(200,160,80,0.5); }

body.theme-dbs .cm-input:focus,
body.theme-dbs .cm-dropdown:focus {
    border-color: #FFD700;
    box-shadow: 0 0 0 2px rgba(255,215,0,0.2);
}

body.theme-dbs .cm-dropdown option {
    background: #1a0e28;
    color: #f0e0c0;
}

/* Energy trail yellow SEARCH button */
body.theme-dbs .cm-btn-search {
    background: #FFD700;
    color: #1a0e00;
    border: none;
    border-radius: 5px;
    font-weight: 900;
    letter-spacing: 1px;
    box-shadow: 0 5px 0 #8B6000, inset 0 1px 0 rgba(255,255,255,0.25);
}

body.theme-dbs .cm-btn-search:hover {
    background: #FFE840;
    box-shadow: 0 3px 0 #8B6000;
    transform: translateY(2px);
}

/* ── Results panel — dark LCD ──────────────────────────── */
body.theme-dbs .results-section {
    background: rgba(10, 5, 25, 0.78);
    border: 2px solid rgba(255,210,0,0.3);
    border-radius: 8px;
    padding: 16px;
    box-shadow: inset 0 0 30px rgba(255,140,0,0.04), 0 0 20px rgba(255,180,0,0.08);
    backdrop-filter: blur(8px);
    margin-top: 16px;
}

body.theme-dbs .cm-hits {
    color: #FFD700;
    font-weight: 700;
}

body.theme-dbs .cm-view-btn {
    background: rgba(10,5,25,0.7);
    border: 1px solid rgba(255,210,0,0.35);
    color: #FFD700;
    font-weight: 700;
}

body.theme-dbs .cm-view-btn.active,
body.theme-dbs .cm-view-btn:hover {
    background: #FFD700;
    border-color: #FFD700;
    color: #1a0e00;
}

/* ── Cards — dark panels with golden glow ──────────────── */
body.theme-dbs .cm-card {
    background: rgba(18, 10, 40, 0.88);
    border: 1px solid rgba(255,200,50,0.25);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.theme-dbs .cm-card:hover {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255,215,0,0.4), 0 8px 24px rgba(0,0,0,0.5);
    transform: translateY(-4px);
}

body.theme-dbs .cm-card-img-wrapper {
    background: rgba(5, 3, 15, 0.6);
    border-radius: 5px 5px 0 0;
}

body.theme-dbs .cm-card-title {
    color: #f0e0c0;
    font-weight: 700;
    font-size: 0.82rem;
}

body.theme-dbs .cm-card-price {
    color: #FFD700;
    font-weight: 700;
}

body.theme-dbs .cm-card-price strong {
    color: #FFE840;
    text-shadow: 0 0 8px rgba(255,215,0,0.4);
}

/* ── Modal overrides ────────────────────────────────────── */
body.theme-dbs .card-details-grid {
    background: rgba(15, 8, 35, 0.95);
    border: 2px solid rgba(255,210,0,0.3);
    box-shadow: inset 0 0 12px rgba(255,150,0,0.08);
}

body.theme-dbs .detail-label { color: #c8a060; }
body.theme-dbs .detail-value { color: #FFD700; font-family: 'Courier New', monospace; }
body.theme-dbs .detail-row { border-bottom-color: rgba(255,200,50,0.15); }

body.theme-dbs .stat-box {
    background: rgba(15, 8, 35, 0.92);
    border: 1px solid rgba(255,210,0,0.25);
}

body.theme-dbs .stat-label { color: #c8a060; }
body.theme-dbs .stat-value { color: #fff; }

body.theme-dbs .price-tag {
    background: #FFD700;
    color: #1a0e00;
    font-weight: 900;
}

/* ── DBS Modal deep-theme ───────────────────────────────── */

/* Narrower left column + tighter gap = more room for 5-stat grid */
body.theme-dbs .modal-body { gap: 1.5rem; }
body.theme-dbs .modal-left { flex: 0 0 240px; }
body.theme-dbs .modal-right { overflow-x: hidden; }

body.theme-dbs .modal-content {
    background: rgba(8, 4, 20, 0.96);
    border: 1px solid rgba(255, 200, 50, 0.22);
    box-shadow: 0 0 60px rgba(255, 150, 0, 0.08), 0 20px 60px rgba(0,0,0,0.8);
    backdrop-filter: blur(24px);
}

body.theme-dbs .modal-right h2 {
    color: #FFD700;
    text-shadow: 0 0 24px rgba(255, 200, 0, 0.35);
    margin-bottom: 0.8rem;
}

body.theme-dbs .card-details-grid {
    gap: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

body.theme-dbs .close-btn { color: rgba(255, 200, 50, 0.6); }
body.theme-dbs .close-btn:hover { color: #FFD700; }

/* Species row not relevant for DBS */
body.theme-dbs .detail-row-species { display: none; }

/* Cardmarket button — gold for DBS */
body.theme-dbs #modal-card-link {
    background: rgba(255, 200, 50, 0.12);
    border: 1px solid rgba(255, 200, 50, 0.5);
    color: #FFD700;
}
body.theme-dbs #modal-card-link:hover {
    background: rgba(255, 200, 50, 0.22);
}

/* PriceCharting button — orange for DBS */
body.theme-dbs #modal-tcgplayer-link {
    background: rgba(245, 166, 35, 0.12);
    border-color: rgba(245, 166, 35, 0.5);
    color: #F5A623;
}
body.theme-dbs #modal-tcgplayer-link:hover {
    background: rgba(245, 166, 35, 0.22);
}

/* Gold scrollbar for DBS modal right column */
body.theme-dbs .modal-right {
    scrollbar-color: rgba(255,200,50,0.35) transparent;
}
body.theme-dbs .modal-right::-webkit-scrollbar { width: 4px; }
body.theme-dbs .modal-right::-webkit-scrollbar-track { background: transparent; }
body.theme-dbs .modal-right::-webkit-scrollbar-thumb {
    background: rgba(255,200,50,0.35);
    border-radius: 2px;
}

/* Price stat values — gold */
body.theme-dbs .stat-value { color: #FFD700; font-size: 1rem; }
body.theme-dbs .stat-box {
    background: rgba(20, 10, 45, 0.9);
    border: 1px solid rgba(255, 200, 50, 0.2);
    padding: 0.7rem 0.3rem;
    min-width: 0;
}
body.theme-dbs .stat-label { font-size: 0.62rem; letter-spacing: 0.5px; }

/* All 5 stats in one row */
body.theme-dbs .price-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Low-price note */
body.theme-dbs .modal-right > div[style*="11px"] {
    color: rgba(200, 160, 90, 0.55);
}

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

/* Touch / mobile polish */
button, a, .cm-card, .close-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: var(--font-body);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==========================================================================
   Utility Classes (Glassmorphism)
   ========================================================================== */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    margin-bottom: 3rem;
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary-color);
}

.game-toggle {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem;
    border-radius: 30px;
}

.game-toggle button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 600;
    padding: 12px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    text-align: center;
}

.game-toggle button img {
    height: 35px !important; /* Force identical height */
    width: auto !important;
    max-width: 90%;
    object-fit: contain;
    filter: grayscale(1) opacity(0.7);
    transition: all 0.3s ease;
}

.game-toggle button.active img {
    filter: grayscale(0) opacity(1);
    transform: scale(1.1);
}

.game-toggle button.active {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 10px rgba(102, 252, 241, 0.4);
}

/* ==========================================================================
   Search Section
   ========================================================================== */
.search-section {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.search-bar {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    padding: 0.5rem;
    border-radius: 50px;
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    color: var(--text-main);
    font-size: 1.1rem;
    font-family: var(--font-body);
    outline: none;
}

.search-bar button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: #000;
    border: none;
    padding: 0 1.5rem;
    border-radius: 40px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-bar button:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

.filters-container {
    max-width: 600px;
    margin: 1.5rem auto 0;
    display: flex;
    justify-content: flex-end;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.filter-group label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.glass-dropdown {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.glass-dropdown:hover {
    border-color: var(--primary-color);
}

.glass-dropdown option {
    background: var(--bg-color);
    color: var(--text-main);
}

.alert {
    max-width: 600px;
    margin: 1.5rem auto 0;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ffc107;
    font-size: 0.9rem;
}

/* ==========================================================================
   Results Grid
   ========================================================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2rem;
}

.card-item {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-item:hover {
    transform: translateY(-10px) scale(1.02);
}

.card-item img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.card-info {
    margin-top: 1rem;
    text-align: center;
}

.card-info h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.price-tag {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.3rem 0.8rem;
    background: rgba(102, 252, 241, 0.1);
    color: var(--primary-color);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Loading state */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin: 3rem auto;
}

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

.no-results {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 3rem;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Start at top for scrolling */
    padding: 20px; /* Space for scrolling */
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
    overflow-y: auto; /* Container scrollable */
    -webkit-overflow-scrolling: touch;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background: #111;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
    /* Inherits background/border glass properties from .glass-panel */
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.8);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.hidden .modal-content {
    transform: scale(0.95);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: #e0e2e4;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #ffffff;
}

.modal-body {
    display: flex;
    gap: 3rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-left {
    flex: 0 0 350px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-left img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.6);
}

.buy-button {
    text-align: center;
    display: block;
    padding: 1rem;
    background: #58a6ff;
    color: #0d1117;
    text-decoration: none;
    font-weight: 700;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.buy-button:hover {
    background: #79c0ff;
    transform: translateY(-2px);
}

.modal-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.modal-right h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    margin-bottom: 0.2rem;
    color: #e0e2e4;
    line-height: 1.2;
}

.card-details-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 2rem;
    background: rgba(13, 17, 23, 0.4);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-pokemon .card-details-grid {
    background: #001219; /* CRT Screen Blue/Black */
    border: 2px solid #333;
    box-shadow: inset 0 0 10px #4ea8de;
}

body.theme-pokemon .detail-value {
    color: #4ea8de;
    font-family: 'Courier New', Courier, monospace;
    text-transform: uppercase;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #30363d;
    padding-bottom: 0.5rem;
}

.detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-label {
    color: #8b929a;
    font-size: 0.9rem;
}

.detail-value {
    color: #e0e2e4;
    font-weight: 600;
}

.price-stats-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.stat-box {
    flex: 1 1 min-content;
    min-width: 90px;
    background: rgba(13, 17, 23, 0.4);
    padding: 1rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    color: #8b929a;
    font-size: 0.70rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: #e0e2e4;
}

.chart-container {
    flex: 1;
    background: rgba(13, 17, 23, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    min-height: 250px;
    position: relative;
}

/* Responsiveness */
/* ── Tablet (≤1100px): narrow modal columns ── */
@media (max-width: 1100px) {
    .modal-left { flex: 0 0 260px; }
    body.theme-dbs .modal-left { flex: 0 0 220px; }
}

/* ── Mobile (≤768px) ── */
@media (max-width: 768px) {
    /* Layout */
    .app-container { padding: 0.75rem; }

    /* Header */
    header.glass-panel {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1.2rem 1rem;
        margin-bottom: 0;
    }
    .logo { display: flex; flex-direction: column; align-items: center; gap: 4px; }
    .logo h1 { font-size: 1.3rem; display: flex; flex-direction: column; align-items: center; }
    .logo h1::before { margin-right: 0 !important; margin-bottom: 6px !important; }

    /* Game toggle */
    .game-toggle { width: 100%; max-width: 340px; }
    .game-toggle button { flex: 1; padding: 0.7rem 0.4rem; font-size: 0.82rem; }
    .game-toggle button img { height: 28px !important; width: auto !important; margin-right: 5px !important; }

    /* Search */
    .cm-filters-container { padding: 1rem; }
    .cm-filters-row { flex-direction: column; align-items: stretch; gap: 0.8rem; }
    .cm-filter-col { width: 100%; }
    .cm-btn-search { width: 100%; height: 44px; }

    /* Results */
    .cm-results-header { flex-direction: column; gap: 0.8rem; align-items: flex-start; }
    .cm-view-toggles { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .cm-view-btn { justify-content: center; }

    /* Cards grid — 2 columns minimum */
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }

    /* Modal — stacks vertically, whole box scrolls */
    .modal { padding: 8px; }
    .modal-content {
        padding: 1.2rem 0.9rem;
        border-radius: 10px;
        max-height: calc(100vh - 16px);
        overflow-y: auto;   /* whole modal scrolls on mobile */
        overflow-x: hidden;
    }
    .modal-body { flex-direction: column; gap: 1rem; overflow: visible; min-height: auto; }
    .modal-left { flex: 0 0 auto; max-width: 180px; margin: 0 auto; }
    .modal-right { overflow-y: visible; overflow-x: hidden; padding-right: 0; min-height: auto; }
    .modal-right h2 { font-size: 1.2rem; text-align: center; }

    /* Close button — larger tap target */
    .close-btn { top: 0.6rem; right: 0.8rem; font-size: 1.8rem; padding: 4px 8px; }

    /* Price stats — 3 cols on mobile */
    .price-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
    body.theme-dbs .price-stats-grid { grid-template-columns: repeat(3, 1fr); }
    .stat-box { min-width: 0; padding: 0.5rem 0.2rem; }
    .stat-label { font-size: 0.58rem; letter-spacing: 0.3px; }
    .stat-value { font-size: 0.82rem; }

    /* Buttons */
    .buy-button { padding: 0.7rem; font-size: 12px; }

    /* Charts — less height on mobile */
    .price-chart-container > div > div { height: 90px !important; }
}

/* ── Small mobile (≤420px) ── */
@media (max-width: 420px) {
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .game-toggle button img { height: 22px !important; }
    .modal-left { max-width: 150px; }
}

/* ==========================================================================
   CM Dark Search Redesign
   ========================================================================== */
.cm-filters-container {
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.cm-filters-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.cm-filter-col {
    display: flex;
    flex-direction: column;
}

.cm-filter-col label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #e0e2e4;
}

.cm-dropdown, .cm-input {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.cm-input::placeholder {
    color: var(--text-muted);
}

.cm-dropdown:focus, .cm-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(102, 252, 241, 0.1);
}

.cm-name-col {
    flex-grow: 1;
}

.cm-filter-checkboxes {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 10px;
}

.cm-filter-checkboxes label {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #e0e2e4;
    cursor: pointer;
}

.cm-btn-search {
    background-color: var(--primary-color);
    color: #000;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    padding: 10px 24px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
}

.cm-btn-search:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.cm-collapsible-bar {
    margin-top: 16px;
    padding: 10px;
    background-color: #131519;
    border: 1px solid #30363d;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #58a6ff;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.cm-collapsible-bar span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cm-advanced-filters {
    margin-top: 16px;
    display: flex;
    gap: 16px;
}

.cm-sort-row {
    margin-top: 24px;
    display: flex;
    justify-content: flex-start;
}

.cm-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.cm-hits {
    font-size: 1rem;
    font-weight: 600;
    color: #e0e2e4;
}

.cm-view-toggles {
    display: flex;
    gap: 8px;
}

.cm-view-btn {
    background: #1e2025;
    border: 1px solid #30363d;
    color: #8b929a;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cm-view-btn.active, .cm-view-btn:hover {
    background: #30363d;
    color: #e0e2e4;
}

.cm-card {
    background: #1e2025;
    border: 1px solid #30363d;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cm-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}
.cm-card-img-wrapper {
    padding: 16px;
    text-align: center;
    background: #131519;
}
.cm-card-img-wrapper img {
    max-width: 100%;
    height: auto;
}
.cm-card-info {
    padding: 16px;
}
.cm-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #e0e2e4;
}
.cm-card-price {
    font-size: 1.1rem;
    color: var(--primary-color);
}
.cm-card-price strong {
    font-size: 1.3rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(248, 91, 26, 0.3);
}

/* List View Overrides */
.cards-grid.list-view-enabled {
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

.cards-grid.list-view-enabled .cm-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 8px 15px;
    height: 80px;
    text-align: left;
    gap: 16px;
    overflow: hidden;
}

.cards-grid.list-view-enabled .cm-card-img-wrapper {
    width: 56px !important;
    height: 64px !important;
    flex: 0 0 56px !important;
    min-height: unset !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent !important;
}

.cards-grid.list-view-enabled .cm-card-img-wrapper img {
    width: 56px !important;
    height: 64px !important;
    object-fit: contain !important;
    border-radius: 4px;
}

.cards-grid.list-view-enabled .cm-card-info {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    padding: 0 !important;
}

.cards-grid.list-view-enabled .cm-card-title {
    font-size: 1rem;
    margin-bottom: 0;
    flex: 1;
}

.cards-grid.list-view-enabled .cm-card-price {
    font-size: 1.1rem;
    margin-top: 0;
    margin-left: 20px;
    white-space: nowrap;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 4px 8px;
    gap: 12px;
    flex-wrap: wrap;
}
.pagination:empty { display: none; }
.pagination-top {
    margin-bottom: 8px;
}

.pagination-info {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    white-space: nowrap;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}
.pagination-btn:hover:not(.disabled):not(.active) {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
}
.pagination-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: 700;
}
.pagination-btn.disabled {
    opacity: 0.25;
    cursor: not-allowed;
}
.pagination-ellipsis {
    color: rgba(255,255,255,0.3);
    font-size: 13px;
    padding: 0 4px;
    user-select: none;
}

/* DBS theme */
body.theme-dbs .pagination-btn {
    background: rgba(255,200,50,0.06);
    border-color: rgba(255,200,50,0.15);
    color: rgba(255,220,100,0.7);
}
body.theme-dbs .pagination-btn:hover:not(.disabled):not(.active) {
    background: rgba(255,200,50,0.15);
    color: #FFD700;
    border-color: rgba(255,200,50,0.4);
}
body.theme-dbs .pagination-btn.active {
    background: #FFD700;
    border-color: #FFD700;
    color: #1a0e00;
}

/* Pokémon theme */
body.theme-pokemon .pagination-btn.active {
    background: #CC0000;
    border-color: #CC0000;
}

/* ==========================================================================
   Disclaimer Banner
   ========================================================================== */
.disclaimer-banner {
    background: #16181d;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 9px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    gap: 12px;
    transition: background 0.4s ease, border-color 0.4s ease;
    position: relative;
    z-index: 1;
}
.disclaimer-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}
.disclaimer-icon {
    flex-shrink: 0;
    opacity: 0.75;
    transition: color 0.4s ease;
}
.disclaimer-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    flex-shrink: 0;
}
.disclaimer-close:hover { color: rgba(255,255,255,0.6); }

/* Pokémon theme */
body.theme-pokemon .disclaimer-banner {
    background: #150303;
    border-bottom-color: rgba(204,0,0,0.2);
}
body.theme-pokemon .disclaimer-icon { color: #cc0000; }
body.theme-pokemon #disclaimer-text strong { color: rgba(255,222,0,0.9); }
body.theme-pokemon #disclaimer-text a { color: rgba(255,222,0,0.6); }

/* DBS theme */
body.theme-dbs .disclaimer-banner {
    background: #0d0510;
    border-bottom-color: rgba(255,200,50,0.15);
}
body.theme-dbs .disclaimer-icon { color: #F5A623; }
body.theme-dbs #disclaimer-text strong { color: rgba(255,200,50,0.9); }
body.theme-dbs #disclaimer-text a { color: rgba(255,200,50,0.6); }

/* ==========================================================================
   Autocomplete Dropdown
   ========================================================================== */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    z-index: 500;
    overflow: hidden;
    display: none;
}
.autocomplete-dropdown.visible { display: block; }

.autocomplete-item {
    padding: 9px 14px;
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.autocomplete-item strong { font-weight: 700; }

/* Pokémon theme */
body.theme-pokemon .autocomplete-dropdown {
    background: #120202;
    border-color: rgba(204,0,0,0.4);
}
body.theme-pokemon .autocomplete-item:hover,
body.theme-pokemon .autocomplete-item.active {
    background: rgba(204,0,0,0.15);
    color: #ffde00;
}
body.theme-pokemon .autocomplete-item strong { color: #ffde00; }

/* DBS theme */
body.theme-dbs .autocomplete-dropdown {
    background: #0d0510;
    border-color: rgba(255,200,50,0.25);
}
body.theme-dbs .autocomplete-item:hover,
body.theme-dbs .autocomplete-item.active {
    background: rgba(255,200,50,0.1);
    color: #FFD700;
}
body.theme-dbs .autocomplete-item strong { color: #FFD700; }
