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

        :root {
            --bg-primary: #f8f9fc;
            --bg-secondary: #ffffff;
            --bg-card: #ffffff;
            --bg-card-hover: #f4f6fb;
            --border: #e2e6f0;
            --border-strong: #c8d0e4;
            --text-primary: #0f1724;
            --text-secondary: #4a5578;
            --text-muted: #8892b0;
            --green: #059669;
            --green-bg: rgba(5, 150, 105, 0.08);
            --green-border: rgba(5, 150, 105, 0.25);
            --red: #dc2626;
            --red-bg: rgba(220, 38, 38, 0.07);
            --red-border: rgba(220, 38, 38, 0.25);
            --gold: #d97706;
            --gold-bg: rgba(217, 119, 6, 0.07);
            --gold-border: rgba(217, 119, 6, 0.25);
            --blue: #2563eb;
            --blue-bg: rgba(37, 99, 235, 0.07);
            --blue-border: rgba(37, 99, 235, 0.25);
            --shadow-sm: 0 1px 3px rgba(15,23,42,0.07);
            --shadow-md: 0 4px 12px rgba(15,23,42,0.09);
            --shadow-lg: 0 10px 28px rgba(15,23,42,0.11);
            --radius: 6px;
            --radius-lg: 8px;
        }

        body {
            font-family: 'Inter', -apple-system, sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            line-height: 1.6;
            min-height: 100vh;
        }

        /* ===== HEADER ===== */
        header {
            position: sticky; top: 0; z-index: 100;
            background: rgba(248, 249, 252, 0.88);
            backdrop-filter: blur(18px);
            border-bottom: 1px solid var(--border);
            padding: 0 24px; height: 60px;
            display: flex; align-items: center; justify-content: space-between;
        }
        .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-primary); }
        .logo-wordmark { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.03em; }
        .logo-wordmark span { color: var(--green); }
        .logo-sub { font-size: 0.6rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }
        .logo img { width: 28px; height: 28px; }
        nav { display: flex; gap: 4px; }
        nav a { font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); text-decoration: none; padding: 6px 12px; border-radius: var(--radius); transition: all 0.15s; }
        nav a:hover { color: var(--text-primary); background: rgba(0,0,0,0.04); }
        nav a.active { color: var(--green); font-weight: 600; }

        /* ===== CONTROLS BAR ===== */
        .controls {
            position: sticky; top: 60px; z-index: 90;
            background: rgba(248, 249, 252, 0.92);
            backdrop-filter: blur(12px);
            border-bottom: 1px solid var(--border);
            padding: 14px 24px;
        }
        .search-row { display: flex; gap: 10px; margin-bottom: 10px; }
        .search-input {
            flex: 1; font-family: inherit; font-size: 0.88rem;
            padding: 9px 14px; border: 1px solid var(--border);
            border-radius: var(--radius); background: var(--bg-secondary);
            color: var(--text-primary); outline: none; transition: border 0.15s;
        }
        .search-input:focus { border-color: var(--green); }
        .search-input::placeholder { color: var(--text-muted); }
        .filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
        .filter-select {
            font-family: inherit; font-size: 0.78rem; font-weight: 500;
            padding: 6px 28px 6px 10px; border: 1px solid var(--border);
            border-radius: var(--radius); background: var(--bg-secondary);
            color: var(--text-primary); cursor: pointer; outline: none;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%234a5578'%3E%3Cpath d='M5 7L1 3h8z'/%3E%3C/svg%3E");
            background-repeat: no-repeat; background-position: right 10px center;
        }
        .filter-select:focus { border-color: var(--green); }
        .price-range { display: flex; align-items: center; gap: 4px; }
        .price-input {
            width: 80px; font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
            padding: 6px 8px; border: 1px solid var(--border);
            border-radius: var(--radius); background: var(--bg-secondary);
            color: var(--text-primary); outline: none; text-align: right;
        }
        .price-input:focus { border-color: var(--green); }
        .results-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
        .results-count { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
        .watchlist-toggle {
            font-size: 0.78rem; font-weight: 600; padding: 5px 12px;
            border: 1px solid var(--border); border-radius: var(--radius);
            background: var(--bg-secondary); color: var(--text-secondary);
            cursor: pointer; transition: all 0.15s;
        }
        .watchlist-toggle.active { background: var(--gold-bg); color: var(--gold); border-color: var(--gold-border); }

        /* ===== MAIN CONTENT ===== */
        .container { max-width: 1200px; margin: 0 auto; padding: 24px; }

        /* ===== CARD GRID ===== */
        .card-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 16px; margin-bottom: 24px;
        }
        .card-tile {
            background: var(--bg-card); border: 1px solid var(--border);
            border-radius: var(--radius-lg); overflow: hidden;
            cursor: pointer; transition: all 0.2s;
            box-shadow: var(--shadow-sm);
        }
        .card-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
        .card-tile-img {
            position: relative; background: #f0f2f8;
            display: flex; align-items: center; justify-content: center;
            height: 200px; overflow: hidden;
        }
        .card-tile-img img { max-height: 190px; max-width: 100%; object-fit: contain; }
        .trend-badge {
            position: absolute; top: 6px; right: 6px;
            font-size: 0.6rem; font-weight: 700;
            padding: 2px 7px; border-radius: 4px;
            text-transform: uppercase; letter-spacing: 0.04em;
        }
        .trend-badge.breakout { background: var(--gold-bg); color: var(--gold); border: 1px solid var(--gold-border); }
        .trend-badge.trending-up { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
        .trend-badge.stable { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-border); }
        .trend-badge.declining { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
        .trend-badge.falling { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
        .watchlist-star {
            position: absolute; top: 6px; left: 6px;
            font-size: 1rem; cursor: pointer; opacity: 0.3; transition: opacity 0.15s;
        }
        .watchlist-star.active { opacity: 1; }
        .card-tile-info { padding: 10px 12px; }
        .card-tile-name { font-size: 0.82rem; font-weight: 700; line-height: 1.3; margin-bottom: 2px; }
        .card-tile-set { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 2px; }
        .card-tile-rarity { font-size: 0.65rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
        .card-tile-price-row { display: flex; justify-content: space-between; align-items: baseline; }
        .card-tile-price { font-family: 'JetBrains Mono', monospace; font-size: 0.88rem; font-weight: 700; }
        .card-tile-change { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; font-weight: 600; }
        .positive { color: var(--green); }
        .negative { color: var(--red); }
        .score-bar-wrap { margin-top: 6px; display: flex; align-items: center; gap: 6px; }
        .score-bar { height: 4px; border-radius: 2px; background: #e5e7eb; flex: 1; overflow: hidden; }
        .score-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
        .score-val { font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; font-weight: 600; color: var(--text-muted); min-width: 20px; }

        /* ===== PAGINATION ===== */
        .pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 24px 0; }
        .page-btn {
            font-family: inherit; font-size: 0.8rem; font-weight: 600;
            padding: 8px 16px; border: 1px solid var(--border);
            border-radius: var(--radius); background: var(--bg-secondary);
            color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
        }
        .page-btn:hover { border-color: var(--green); color: var(--green); }
        .page-btn:disabled { opacity: 0.4; cursor: default; }
        .page-info { font-size: 0.78rem; color: var(--text-muted); }

        /* ===== SET DASHBOARD ===== */
        .set-section { margin-top: 40px; }
        .set-section h2 { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 16px; }
        .set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
        .set-card {
            background: var(--bg-card); border: 1px solid var(--border);
            border-radius: var(--radius-lg); padding: 14px 16px;
            cursor: pointer; transition: all 0.15s;
        }
        .set-card:hover { border-color: var(--green); box-shadow: var(--shadow-sm); }
        .set-card-name { font-size: 0.88rem; font-weight: 700; margin-bottom: 4px; }
        .set-card-stats { font-size: 0.72rem; color: var(--text-muted); display: flex; gap: 12px; margin-bottom: 4px; }
        .set-card-top { font-size: 0.7rem; color: var(--text-secondary); }

        /* ===== CARD DETAIL MODAL ===== */
        .modal-overlay {
            display: none; position: fixed; inset: 0; z-index: 200;
            background: rgba(15,23,36,0.5); backdrop-filter: blur(4px);
            align-items: center; justify-content: center;
        }
        .modal-overlay.open { display: flex; }
        .modal-inner {
            background: var(--bg-secondary); border-radius: 12px;
            max-width: 800px; width: 95%; max-height: 90vh; overflow-y: auto;
            box-shadow: var(--shadow-lg); padding: 28px;
        }
        .modal-close {
            float: right; font-size: 1.2rem; background: none; border: none;
            color: var(--text-muted); cursor: pointer; padding: 4px 8px;
        }
        .modal-close:hover { color: var(--text-primary); }
        .modal-layout { display: flex; gap: 24px; }
        .modal-img { flex-shrink: 0; }
        .modal-img img { width: 220px; border-radius: var(--radius-lg); }
        .modal-stats { flex: 1; min-width: 0; }
        .modal-stats h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 2px; }
        .modal-set { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 4px; }
        .modal-rarity { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 12px; }
        .stat-grid {
            display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px;
        }
        .stat-box {
            background: var(--bg-primary); border: 1px solid var(--border);
            border-radius: var(--radius); padding: 8px 10px; text-align: center;
        }
        .stat-label { font-size: 0.62rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
        .stat-value { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; font-weight: 700; }
        .chart-container { width: 100%; height: 160px; margin-bottom: 16px; background: var(--bg-primary); border-radius: var(--radius); border: 1px solid var(--border); }
        .modal-links { display: flex; gap: 8px; flex-wrap: wrap; }
        .modal-link {
            font-size: 0.75rem; font-weight: 600; padding: 6px 14px;
            border: 1px solid var(--border); border-radius: var(--radius);
            text-decoration: none; color: var(--text-secondary); transition: all 0.15s;
        }
        .modal-link:hover { border-color: var(--green); color: var(--green); }
        .modal-link.watchlist-btn { cursor: pointer; }
        .modal-link.watchlist-btn.active { background: var(--gold-bg); color: var(--gold); border-color: var(--gold-border); }

        /* ===== EMPTY STATE ===== */
        .empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
        .empty-state-icon { font-size: 2.5rem; margin-bottom: 8px; }
        .empty-state-text { font-size: 0.9rem; }

        /* ===== LOADING ===== */
        .loading { text-align: center; padding: 40px; color: var(--text-muted); }
        .spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; }
        @keyframes spin { to { transform: rotate(360deg); } }

        /* ===== FOOTER ===== */
        footer {
            text-align: center; padding: 32px 24px; border-top: 1px solid var(--border);
            font-size: 0.75rem; color: var(--text-muted);
        }

        /* ===== RESPONSIVE ===== */
        @media (max-width: 768px) {
            .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
            .card-tile-img { height: 160px; }
            .modal-layout { flex-direction: column; }
            .modal-img img { width: 100%; max-width: 200px; margin: 0 auto; display: block; }
            .stat-grid { grid-template-columns: repeat(2, 1fr); }
            nav { display: none; }
            .filter-row { overflow-x: auto; flex-wrap: nowrap; }
        }
