        /* Stats Grid */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 16px;
            margin: 20px 0;
        }

        .stat-item {
            background: var(--bg);
            border: 1px solid var(--border);
            padding: 16px;
            border-radius: 6px;
            text-align: center;
        }

        .stat-label {
            font-size: 16px;
            font-weight: 600;
            color: var(--text-light);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 12px;
        }

        .stat-value {
            font-size: 36px;
            font-weight: 700;
            color: var(--accent);
        }

        .stat-secondary {
            font-size: 16px;
            color: var(--text-light);
            margin-top: 8px;
        }

        /* Tables */
        table {
            width: 100%;
            border-collapse: collapse;
        }

        thead {
            border-bottom: 2px solid var(--border);
        }

        th {
            padding: 22px 20px;
            text-align: left;
            font-weight: 600;
            font-size: 18px;
            color: var(--text);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        td {
            padding: 22px 20px;
            font-size: 20px;
        }

        tbody tr:hover {
            background: var(--bg);
        }

        /* Fix table borders when cells contain flex containers */
        tbody tr {
            border-bottom: 1px solid var(--border);
            min-height: 70px;
        }

        tbody td {
            vertical-align: middle;
        }

        .rank-badge {
            background: var(--accent);
            color: var(--bg);
            width: 28px;
            height: 28px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            font-size: 12px;
        }

        .player-cell {
            cursor: pointer;
            color: var(--text);
            font-weight: 600;
            transition: all 0.2s;
        }

        .player-cell:hover {
            color: var(--accent-light);
            text-decoration: underline;
        }

        /* Percentile Bar */
        .percentile-bar {
            margin: 16px 0;
        }

        .percentile-label {
            display: flex;
            justify-content: space-between;
            margin-bottom: 6px;
            font-size: 13px;
        }

        .percentile-track {
            background: var(--border);
            height: 6px;
            border-radius: 3px;
            overflow: hidden;
        }

        .percentile-fill {
            background: linear-gradient(90deg, var(--accent), var(--accent-light));
            height: 100%;
            border-radius: 3px;
            transition: width 0.3s ease;
        }

        /* Stat Row (FotMob style) */
        .stat-row {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 20px;
            padding: 16px 20px;
            border-bottom: 1px solid var(--border);
        }

        .stat-label {
            font-size: 19px;
            color: var(--text);
            font-weight: 700;
            text-transform: none;
            width: 210px;
            flex-shrink: 0;
        }

        .stat-data {
            display: flex;
            flex-direction: row;
            align-items: center;
            width: 215px;
            flex-shrink: 0;
            gap: 0;
        }

        .stat-data .value {
            font-size: 20px;
            font-weight: 700;
            color: var(--text);
            line-height: 1.2;
            text-align: right;
            padding-right: 12px;
            flex: 1;
        }

        .stat-data .per90 {
            font-size: 20px;
            color: var(--text-light);
            line-height: 1.2;
            font-weight: 500;
            width: 110px;
            text-align: left;
            padding-left: 12px;
        }

        .stat-divider {
            color: var(--text-light);
            font-size: 16px;
            opacity: 0.5;
            width: 10px;
            text-align: center;
            flex-shrink: 0;
        }

        .stat-value-missing {
            font-size: 16px;
            color: var(--text-light);
            font-style: italic;
        }

        .percentile-bar-track {
            width: 100%;
            height: 16px;
            background: var(--border);
            border-radius: 8px;
            overflow: hidden;
        }

        .percentile-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent-light), var(--accent));
            border-radius: 8px;
            transition: width 0.3s ease;
        }

        .percentile-badge {
            font-size: 16px;
            color: var(--text);
            font-weight: 600;
            width: 50px;
            text-align: right;
        }

        /* Per-90 Section */
        .per90-section {
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 28px;
            margin: 28px 0;
        }

        .per90-title {
            font-size: 18px;
            font-weight: 600;
            text-transform: uppercase;
            color: var(--text-light);
            margin-bottom: 24px;
            letter-spacing: 0.5px;
        }

        .per90-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 16px;
        }

        .per90-item {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            padding: 20px;
            border-radius: 6px;
            text-align: center;
        }

        .per90-stat {
            font-size: 28px;
            font-weight: 700;
            color: var(--accent);
            margin: 12px 0;
        }

        .per90-rank {
            font-size: 14px;
            color: var(--text-light);
            font-weight: 500;
        }

        /* Player Detail */
        .player-header {
            display: flex;
            gap: 20px;
            margin-bottom: 24px;
            align-items: flex-start;
            border-bottom: 2px solid var(--border);
            padding-bottom: 20px;
        }

        .player-info h2 {
            font-size: 40px;
            font-weight: 700;
            margin-bottom: 8px;
        }

        .player-team {
            font-size: 18px;
            color: var(--text-light);
        }

        /* Error Message */
        .error {
            background: #fee2e2;
            color: #991b1b;
            padding: 16px;
            border-radius: 6px;
            border-left: 4px solid #dc2626;
        }

        html.dark-mode .error {
            background: rgba(239, 68, 68, 0.1);
            color: #fca5a5;
            border-left-color: #ef4444;
        }

        /* Loading */
        .loading {
            text-align: center;
            padding: 40px;
            color: var(--text-light);
        }

        /* Modal */
        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.4);
            animation: fadeIn 0.3s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .modal-content {
            background: var(--bg);
            margin: 5% auto;
            padding: 30px;
            border-radius: 8px;
            width: 90%;
            max-width: 500px;
            max-height: 85vh;
            overflow-y: auto;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
            animation: slideIn 0.3s ease;
        }

        @keyframes slideIn {
            from { transform: translateY(-50px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 16px;
            border-bottom: 2px solid var(--border);
        }

        .modal-header h2 {
            margin: 0;
            font-size: 20px;
            font-weight: 600;
        }

        .close-modal {
            background: none;
            border: none;
            font-size: 28px;
            cursor: pointer;
            color: var(--text-light);
            padding: 0;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }

        .close-modal:hover {
            color: var(--text);
        }

        .search-input {
            width: 100%;
            padding: 12px;
            border: 1px solid var(--border);
            border-radius: 6px;
            font-size: 14px;
            background: var(--bg);
            color: var(--text);
            margin-bottom: 16px;
        }

        .search-input:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .player-list {
            max-height: 400px;
            overflow-y: auto;
            border: 1px solid var(--border);
            border-radius: 6px;
            margin-bottom: 16px;
        }

        .player-option {
            padding: 12px;
            border-bottom: 1px solid var(--border);
            cursor: pointer;
            transition: all 0.2s;
        }

        .player-option:last-child {
            border-bottom: none;
        }

        .player-option:hover {
            background: var(--bg-secondary);
        }

        .player-option-name {
            font-weight: 600;
            color: var(--text);
        }

        .player-option-team {
            font-size: 12px;
            color: var(--text-light);
            margin-top: 2px;
        }

        .stat-checkbox {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 0;
            margin: 8px 0;
        }

        .stat-checkbox input[type="checkbox"] {
            width: 18px;
            height: 18px;
            cursor: pointer;
            accent-color: var(--accent);
        }

        .stat-checkbox label {
            cursor: pointer;
            font-size: 18px;
            margin: 0;
        }

        .stat-checkboxes {
            display: flex;
            flex-direction: column;
            gap: 16px;
            margin-bottom: 20px;
            width: 100%;
        }

        .stat-dropdowns {
            margin-bottom: 20px;
            padding: 16px;
            background: var(--bg-secondary);
            border-radius: 6px;
        }

        .stat-category {
            margin-bottom: 16px;
        }

        .stat-category-toggle {
            padding: 12px 16px;
            border: none;
            background: var(--bg-secondary);
            color: var(--text);
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            transition: all 0.2s;
            width: 100%;
            text-align: left;
        }

        .stat-category-toggle:hover {
            background: var(--border);
        }

        .stat-category-toggle-icon {
            display: inline-block;
            transition: transform 0.3s;
            font-size: 18px;
            line-height: 1;
            margin-left: 12px;
        }

        .stat-category-toggle.collapsed .stat-category-toggle-icon {
            transform: rotate(-90deg);
        }

        .stat-category-content {
            display: none;
            padding: 12px 16px;
            background: var(--bg-secondary);
            border-radius: 6px;
            margin-top: 4px;
            grid-template-columns: 1fr;
            gap: 12px;
        }

        .stat-category-content.visible {
            display: grid;
        }

        .stat-count-display {
            font-size: 14px;
            color: var(--text-light);
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border);
            font-weight: 500;
        }

        .stat-count-display.limit-reached {
            color: var(--danger);
        }

        .position-toggle-btn {
            transition: all 0.2s;
        }

        .position-toggle-btn:hover {
            border-color: var(--accent) !important;
            background: var(--bg-secondary) !important;
        }

        .position-toggle-btn.active {
            background: var(--accent) !important;
            color: var(--bg) !important;
            border-color: var(--accent) !important;
        }

        select, input[type="number"] {
            padding: 12px 16px;
            border: 1px solid var(--border);
            border-radius: 4px;
            background: var(--bg-secondary);
            color: var(--text);
            font-size: 16px;
            font-family: inherit;
        }

        select:focus, input[type="number"]:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
        }

        label {
            font-size: 16px;
            color: var(--text-light);
            display: block;
            margin-bottom: 8px;
        }

        .player-tab-btn {
            padding: 12px 20px;
            border: none;
            border-bottom: 3px solid transparent;
            background: transparent;
            color: var(--text-light);
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .player-tab-btn:hover {
            color: var(--text);
        }

        .player-tab-btn.active {
            color: var(--accent);
            border-bottom-color: var(--accent);
        }

        .modal-buttons {
            display: flex;
            gap: 12px;
            justify-content: flex-end;
        }

        .modal-btn {
            padding: 10px 20px;
            border-radius: 6px;
            border: none;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.2s;
        }

        .modal-btn-primary {
            background: var(--accent);
            color: var(--bg);
        }

        .modal-btn-primary:hover {
            background: var(--accent-light);
        }

        .modal-btn-secondary {
            background: var(--bg-secondary);
            color: var(--text);
            border: 1px solid var(--border);
        }

        .modal-btn-secondary:hover {
            background: var(--border);
        }

        /* Comparison View */
        .comparison-header {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px solid var(--border);
        }

        .comparison-player {
            text-align: center;
        }

        .comparison-player h3 {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 8px;
        }

        .comparison-player-team {
            font-size: 16px;
            color: var(--text-light);
        }

        .comparison-chart-container {
            position: relative;
            height: 500px;
            margin: 30px 0;
        }

        .compare-btn {
            background: var(--accent);
            color: var(--bg);
            border: none;
            padding: 12px 24px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            transition: all 0.2s;
            margin-left: 12px;
        }

        .compare-btn:hover {
            background: var(--accent-light);
        }

        .stat-mode-btn {
            padding: 12px 24px;
            border: 1px solid var(--border);
            border-radius: 6px;
            background: var(--bg);
            color: var(--text);
            cursor: pointer;
            font-size: 18px;
            font-weight: 600;
            transition: all 0.2s;
        }

        .stat-mode-btn.active {
            background: var(--accent);
            color: #1a1a1a;
            border-color: var(--accent);
        }

        .stat-mode-btn:hover {
            border-color: var(--accent);
        }

        /* Pagination & Search */
        .search-bar {
            display: flex;
            gap: 12px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .search-input-field {
            flex: 1;
            min-width: 250px;
            padding: 14px 18px;
            border: 1px solid var(--border);
            border-radius: 6px;
            font-size: 16px;
            background: var(--bg);
            color: var(--text);
        }

        .search-input-field:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .pagination {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
            margin-top: 24px;
            flex-wrap: wrap;
        }

        .pagination-btn {
            padding: 8px 12px;
            border: 1px solid var(--border);
            border-radius: 6px;
            background: var(--bg);
            color: var(--text);
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.2s;
        }

        .pagination-btn:hover:not(:disabled) {
            background: var(--bg-secondary);
            border-color: var(--accent);
        }

        .pagination-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .pagination-btn.active {
            background: var(--accent);
            color: var(--bg);
            border-color: var(--accent);
        }

        .pagination-info {
            font-size: 14px;
            color: var(--text-light);
            margin: 0 8px;
        }

