/* ==================== CSS Variables (ygbuff dark theme) ==================== */
:root {
    --bg-dark: #111827;
    --bg-light: #1f2937;
    --card-bg: #1e293b;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-purple: #9b59b6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(59, 130, 246, 0.1);
}

/* ==================== Global Styles ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ENABLE TEXT SELECTION */
*,
*::before,
*::after {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

/* ==================== Header ==================== */
.header {
    text-align: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.header h1 i {
    color: var(--accent-blue);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ==================== Filters Section ==================== */
.filters-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select,
.filter-input {
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

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

.filter-select[multiple] {
    min-height: 120px;
}

/* Side toggle radio buttons */
.side-toggle-group {
    width: 100%;
}

.radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    transition: all 0.2s ease;
}

.radio-label:hover {
    background: var(--hover-bg);
    border-color: var(--accent-blue);
}

.radio-label input[type="radio"] {
    cursor: pointer;
    accent-color: var(--accent-blue);
}

/* Advanced Filters Toggle */
.advanced-filters-toggle {
    margin: 1rem 0;
}

.toggle-btn {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-btn.active .toggle-icon {
    transform: rotate(180deg);
}

/* Active Filter Badges (always visible outside the collapsible panel) */
.active-filter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0;
}

.active-filter-badges:empty {
    margin: 0;
}

.active-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 20px;
    padding: 3px 6px 3px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.active-filter-badge .badge-type {
    color: #60a5fa;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.active-filter-badge .badge-label {
    color: #e5e7eb;
}

.active-filter-badge .badge-remove {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0 2px;
    display: flex;
    align-items: center;
    font-size: 15px;
    line-height: 1;
    transition: color 0.15s;
    margin-left: 2px;
}

.active-filter-badge .badge-remove:hover {
    color: #ef4444;
}

.toggle-btn .filter-count-badge {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 12px;
    padding: 1px 7px;
    font-size: 12px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.advanced-filters {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.advanced-filters h4 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 1rem 0 0.5rem 0;
}

/* ==================== Loading & Error States ==================== */
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.loading .spin {
    animation: spin 1s linear infinite;
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--danger-color);
    margin-bottom: 1rem;
    flex-shrink: 0;
}

/* ==================== Summary Stats ==================== */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.25rem 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
}

/* Teams Win Rate card */
.stat-card-teams {
    text-align: left;
    min-width: 200px;
    align-items: flex-start;
}

.stat-card-teams .stat-value {
    font-size: 0.85rem;
    color: var(--text-primary);
}


.teams-wr-row {
    margin-bottom: 0.2rem;
    white-space: nowrap;
}

.teams-wr-name {
    color: #e0e0e0;
}

.teams-wr-games {
    color: #808080;
}

/* Combined stat card styling */
.stat-card-combined .stat-value-combined {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.combined-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.stat-separator {
    color: var(--text-secondary);
    font-weight: normal;
    opacity: 0.5;
}

.combined-row > span:not(.stat-separator) {
    color: var(--accent-blue);
}

/* Conditional formatting for win rates - using existing classes */
.stat-value .wr-high,
.combined-row .wr-high {
    color: #22c55e; /* Green for >=65% or higher in pair */
    font-weight: 600;
}

.stat-value .wr-mid,
.combined-row .wr-mid {
    color: #facc15; /* Yellow for 30-65% */
    font-weight: 600;
}

.stat-value .wr-low,
.combined-row .wr-low {
    color: #ef4444; /* Red for <30% */
    font-weight: 600;
}

.stat-value .wr-neutral,
.combined-row .wr-neutral {
    color: #6b7280; /* Grey for lower in pair */
    font-weight: 600;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================== Draft Cards ==================== */
.draft-container {
    /* Removed - moved to .left-pane */
}

.draft-card {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    overflow: visible;
    cursor: pointer;
}

.draft-card:last-child {
    border-bottom: none;
}

.draft-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: flex-start;
    gap: 1.5rem;
}

.tour-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 4px;
    gap: 8px;
    min-width: 120px;
    max-width: 150px;
}

.pill {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.pill-link {
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    max-width: 150px;
    display: block;
    min-width: 0;
}

.pill-link:hover {
    text-decoration-color: var(--accent-blue);
}

.pill-link:hover .pill {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.4);
    color: var(--accent-blue);
}

.meta-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.meta-row-id {
    gap: 6px;
}

.kill-score {
    font-size: 20px;
    font-weight: bold;
    color: var(--danger-color);
    text-shadow: 0 0 4px rgba(231, 76, 60, 0.3);
}

.team-kills {
    font-size: 16px;
    font-weight: bold;
    color: var(--danger-color);
    text-shadow: 0 0 4px rgba(231, 76, 60, 0.3);
    margin-left: 8px;
}

.game-duration {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-blue);
}

.match-date {
    font-size: 14px;
    font-weight: 500;
    color: #95a5a6;
}

.match-id {
    font-size: 12px;
    font-weight: 400;
    color: #7f8c8d;
}

.match-id-link {
    text-decoration: none;
}

.match-id-link:hover .match-id {
    color: #3498db;
    text-decoration: underline;
    cursor: pointer;
}

/* ==================== Draft Grid ==================== */
.draft-grid {
    display: grid;
    grid-template-columns: max-content max-content;
    gap: 1rem;
    justify-content: flex-start;
}

.team-box {
    border: none;
    border-radius: 10px;
    padding: 1rem;
    background: transparent;
    width: max-content;
}

.team-box.win {
    background: rgba(46, 204, 113, 0.10);
    border-color: rgba(46, 204, 113, 0.40);
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.25) inset;
}

.team-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 1rem;
}

.team-name {
    font-weight: 700;
    font-size: 1rem;
}

.badges {
    display: flex;
    gap: 6px;
}

.badges span {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.badge-rad {
    background: rgba(39, 174, 96, 0.12);
    color: #2ecc71;
}

.badge-dire {
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
}

.badge-fp {
    background: rgba(52, 152, 219, 0.12);
    color: #3498db;
}

.badge-sp {
    background: rgba(155, 89, 182, 0.12);
    color: #9b59b6;
}

/* ==================== Hero Slots ==================== */
.row-heroes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.slot {
    position: relative;
    display: inline-block;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: var(--bg-dark);
}

.slot.pick {
    width: 58px;
    height: 32px;
}

.slot.ban {
    width: 43px;
    height: 32px;
}

.slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slot.ban img {
    filter: grayscale(70%) brightness(1.2);
    opacity: 1;
}

.slot .num {
    position: absolute;
    left: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    padding: 1px 4px;
    border-top-right-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    z-index: 2;
}

.slot.pick .num {
    color: #7eff8f;
}

.slot.ban .num {
    color: #ff7e7e;
}

/* ==================== Side-by-Side Layout ==================== */
.side-by-side-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.left-pane,
.right-pane {
    height: 100%;
    overflow-y: auto;
    padding-right: 4px;
}

.left-pane {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Series container - groups related BO3 matches */
.draft-series {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid rgba(251, 146, 60, 0.4);
}

.draft-series:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* ==================== Badge/Tag System ==================== */
.dl-tags-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.dl-export-btn,
.dl-draft-btn {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 5px;
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1;
    padding: 3px 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.dl-export-btn:hover { background: #1b6ca8; color: #fff; border-color: #1b6ca8; }
.dl-draft-btn:hover  { background: #7c3aed; color: #fff; border-color: #7c3aed; }

.match-tag-edit-btn {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1;
    padding: 4px 10px;
    cursor: pointer;
}

.match-tag-edit-btn:hover {
    border-color: rgba(59, 130, 246, 0.7);
    color: #fff;
}

.match-badges-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.match-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #2563eb;
    color: #dbeafe;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.match-tag-pill.clickable { cursor: pointer; }

.match-tag-remove-btn {
    background: transparent;
    color: #dbeafe;
    border: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    padding: 0;
    line-height: 1;
}

.match-tag-remove-btn:hover { color: #fff; }

.match-badge-picker {
    position: fixed;
    z-index: 10000;
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    background: linear-gradient(135deg, #0b1020, #0d1b44);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    padding: 12px;
}

.match-badge-picker-title {
    color: #93c5fd;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 10px;
    font-size: 13px;
}

.match-badge-choice-list {
    max-height: 160px;
    overflow: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.match-badge-choice-btn {
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
}

.match-badge-choice-btn:hover {
    border-color: rgba(59, 130, 246, 0.75);
    color: #fff;
}

.match-badge-choice-btn.editable {
    border-color: rgba(234, 179, 8, 0.5);
    background: rgba(234, 179, 8, 0.08);
}

.match-badge-choice-btn.editable:hover {
    border-color: rgba(234, 179, 8, 0.9);
    background: rgba(234, 179, 8, 0.18);
}

.match-badge-choice-btn.deletable {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.08);
}

.match-badge-choice-btn.deletable:hover {
    border-color: rgba(239, 68, 68, 0.9);
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
}

.match-badge-picker-empty {
    color: #94a3b8;
    font-size: 13px;
}

.match-badge-picker-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.match-badge-picker-btn {
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
}

.match-badge-picker-btn:hover {
    border-color: rgba(59, 130, 246, 0.75);
    color: #fff;
}

.match-badge-picker-btn.active {
    border-color: rgba(59, 130, 246, 0.8);
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

#dlBadgePickerDel.active,
#matchBadgePickerDel.active {
    border-color: rgba(239, 68, 68, 0.8);
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}


/* ==================== Stats Tables ==================== */
.stats-container h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Horizontal scrolling container for tables */
.tables-scroll-container {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
}

.tables-scroll-container::-webkit-scrollbar {
    height: 8px;
}

.tables-scroll-container::-webkit-scrollbar-track {
    background: var(--bg-lighter);
    border-radius: 4px;
}

.tables-scroll-container::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 4px;
}

.tables-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-table-wrapper {
    min-width: 100%;
    scroll-snap-align: start;
}

.stats-table-wrapper h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-table {
    background: var(--card-bg);
    border-radius: 8px;
    max-height: 420px;
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) rgba(59, 130, 246, 0.1);
}

/* Custom scrollbar for stats tables */
.stats-table::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.stats-table::-webkit-scrollbar-track {
    background: rgba(59, 130, 246, 0.05);
    border-radius: 4px;
}

.stats-table::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.4);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.stats-table::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
    background-clip: padding-box;
}

.stats-table table {
    width: 100%;
    min-width: max-content;
    /* Allow table to expand for many columns */
    border-collapse: collapse;
    font-size: 0.85rem;
}

.stats-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

.stats-table th.sortable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.stats-table th.sortable:hover {
    background: var(--hover-bg);
    color: var(--accent-blue);
}

.stats-table th.sorted {
    color: var(--accent-blue);
    font-weight: 700;
}

.stats-table td {
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.stats-table tr:hover {
    background: rgba(59, 130, 246, 0.1);
}

.stats-table .hero-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-table .hero-img {
    width: 48px;
    height: 27px;
    object-fit: cover;
    border-radius: 3px;
}

.stats-table .wr-high {
    color: #22c55e;
    font-weight: 600;
}

.stats-table .wr-mid {
    color: #facc15;
    font-weight: 600;
}

.stats-table .wr-low {
    color: #ef4444;
    font-weight: 600;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* ==================== Combo Tables ==================== */
.combo-tables-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 1.5rem;
}

.combo-table-wrapper h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.combo-table {
    background: var(--card-bg);
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
}

.combo-table table {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.combo-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    padding: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.combo-table td {
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.combo-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.combo-table .hero-combo-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.combo-table .hero-combo-img {
    width: 40px;
    height: 22px;
    object-fit: cover;
    border-radius: 2px;
}

.combo-table .combo-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

/* ==================== Response Tables (8th -> 9th) ==================== */
.response-table {
    background: var(--card-bg);
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
}

.response-table-content {
    width: auto;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.response-table-content th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    padding: 0.25rem 0.3rem;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.response-table-content td {
    padding: 0.25rem 0.3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.response-table-content tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.response-table-content .hero-response-img {
    width: 34px;
    height: 19px;
    object-fit: cover;
    border-radius: 3px;
    vertical-align: middle;
}

.response-table-content .wr-high {
    color: #22c55e;
    font-weight: 600;
}

.response-table-content .wr-mid {
    color: #facc15;
    font-weight: 600;
}

.response-table-content .wr-low {
    color: #ef4444;
    font-weight: 600;
}

/* ==================== Responsive Design ==================== */
.mobile-view-toggle { display: none; }

@media (max-width: 1200px) {
    .side-by-side-container {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    .draft-row {
        grid-template-columns: 1fr;
    }

    .tour-cell {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        min-width: unset;
        max-width: unset;
        padding-top: 0;
    }

    .pill {
        font-size: 11px;
        padding: 3px 8px;
        max-width: 200px;
    }

    .game-duration {
        font-size: 13px;
    }

    .match-date {
        font-size: 12px;
    }

    .dl-tags-row {
        width: 100%;
    }

    .draft-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .draft-card {
        padding: 8px;
    }

    .slot.pick {
        width: 52px;
        height: 28px;
    }

    .slot.ban {
        width: 40px;
        height: 28px;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 2rem;
    }

    /* Mobile view toggle — visible only on mobile */
    .mobile-view-toggle {
        display: flex;
        gap: 0;
        margin-bottom: 0;
        border-radius: 8px;
        overflow: hidden;
        border: 1px solid rgba(255, 255, 255, 0.12);
    }

    .mobile-toggle-btn {
        flex: 1;
        padding: 10px 0;
        background: rgba(255, 255, 255, 0.04);
        border: none;
        color: var(--text-secondary);
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: background 0.2s, color 0.2s;
    }

    .mobile-toggle-btn.active {
        background: rgba(59, 130, 246, 0.2);
        color: #60a5fa;
    }

    /* Draft mode: hide filters, show both panes */
    body.mobile-draft-view .filters-section { display: none; }
    body.mobile-draft-view .right-pane { display: none; }

    /* Filters mode: hide draftboard and stats */
    body.mobile-filters-view .side-by-side-container,
    body.mobile-filters-view #summary-stats { display: none !important; }

    /* Stats mode: hide filters and draft cards, show stats pane only */
    body.mobile-stats-view .filters-section { display: none; }
    body.mobile-stats-view #summary-stats { display: none !important; }
    body.mobile-stats-view .left-pane { display: none; }
    body.mobile-stats-view .right-pane { display: block; height: auto; overflow-y: visible; }

    /* Draft grid stacks teams vertically on mobile; allow full width */
    .team-box {
        width: 100%;
    }

    /* Mobile: switch from sticky split-pane to natural page scroll */
    .side-by-side-container {
        position: static;
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .left-pane,
    .right-pane {
        height: auto;
        overflow-y: visible;
        padding-right: 0;
    }

}

/* ==================== Opening Picks (Phase 1) ==================== */
.opening-picks-section {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.opening-picks-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.opening-picks-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.opening-picks-column {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
}

.opening-picks-subtitle {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.opening-picks-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) rgba(59, 130, 246, 0.1);
}

.opening-picks-list::-webkit-scrollbar { width: 6px; }
.opening-picks-list::-webkit-scrollbar-track { background: rgba(59, 130, 246, 0.05); }
.opening-picks-list::-webkit-scrollbar-thumb { background: rgba(59, 130, 246, 0.4); border-radius: 3px; }

.opening-picks-fp1-block {
    margin-bottom: 0;
}

.opening-picks-fp1-headers {
    margin-bottom: 0.35rem;
}

.opening-picks-fp1-headers .opening-picks-subtitle {
    margin-bottom: 0;
}

.opening-picks-combined-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 0.75rem;
    padding-right: 0.25rem;
}

.opening-picks-combined-grid::-webkit-scrollbar { width: 4px; }
.opening-picks-combined-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }
.opening-picks-combined-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 2px; }

.opening-pick-item--empty {
    visibility: hidden;
    pointer-events: none;
}

.opening-picks-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin: 0.75rem 0;
}

/* Compact response table inside opening picks */
#opening-sp-response {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    font-size: 12px;
}

#opening-sp-response::-webkit-scrollbar { width: 4px; }
#opening-sp-response::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }
#opening-sp-response::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 2px; }

/* Custom scrollbar styling for Most Picks/Bans, Opening Picks, etc. */
#most-picks-list,
#most-bans-list,
#opening-fp1-combined,
#opening-sp-p1,
#synergy-pairs-list {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) rgba(255, 255, 255, 0.05);
}

#most-picks-list::-webkit-scrollbar,
#most-bans-list::-webkit-scrollbar,
#opening-fp1-combined::-webkit-scrollbar,
#opening-sp-p1::-webkit-scrollbar,
#synergy-pairs-list::-webkit-scrollbar {
    width: 6px;
}

#most-picks-list::-webkit-scrollbar-track,
#most-bans-list::-webkit-scrollbar-track,
#opening-fp1-combined::-webkit-scrollbar-track,
#opening-sp-p1::-webkit-scrollbar-track,
#synergy-pairs-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#most-picks-list::-webkit-scrollbar-thumb,
#most-bans-list::-webkit-scrollbar-thumb,
#opening-fp1-combined::-webkit-scrollbar-thumb,
#opening-sp-p1::-webkit-scrollbar-thumb,
#synergy-pairs-list::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.4);
    border-radius: 3px;
}

.opening-pick-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    transition: background 0.2s ease;
}

.opening-pick-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.opening-pick-hero-img {
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.opening-pick-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.opening-pick-games {
    color: var(--text-primary);
    font-weight: 600;
}

.opening-pick-wr {
    font-weight: 600;
}

.opening-pick-wr.high {
    color: #22c55e;
}

.opening-pick-wr.mid {
    color: #f59e0b;
}

.opening-pick-wr.low {
    color: #ef4444;
}

.stats-perspective-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.05);
}

.stats-perspective-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.stats-perspective-buttons {
    display: flex;
    gap: 0.5rem;
}

.stats-perspective-btn {
    border: 1px solid #4b5563;
    background: #374151;
    color: #d1d5db;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
}

.stats-perspective-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.stats-perspective-btn:hover {
    filter: brightness(1.08);
}

@media (max-width: 768px) {
    .stats-perspective-toggle {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-perspective-buttons {
        width: 100%;
    }

    .stats-perspective-btn {
        flex: 1;
    }

    .opening-picks-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== Multi-Select Dropdown Styles ==================== */
.hero-filter-group {
    position: relative;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    /* bottom-align the toggle with sibling label+select groups so it doesn't
       ride above the filter row when the grid cell stretches */
    justify-content: flex-end;
}

.hero-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    box-sizing: border-box;
}

.hero-filter-header:hover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

.hero-filter-header label {
    margin: 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.hero-filter-header i {
    transition: transform 0.2s;
    color: var(--text-muted);
}

.multi-select-dropdown.show + .hero-filter-header i,
.hero-filter-header.active i {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 300px;
    max-height: 400px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 4px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.multi-select-dropdown.show {
    display: flex;
}

.dropdown-search {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-search input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.dropdown-search input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.multi-select-options {
    overflow-y: auto;
    max-height: 300px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.multi-select-option:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.multi-select-option.selected {
    background-color: rgba(59, 130, 246, 0.25);
}

.multi-select-option img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.multi-select-option span {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.dropdown-actions {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-top: 1px solid var(--border-color);
}

.dropdown-actions button {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.select-all-btn {
    background: var(--accent-blue);
    color: white;
}

.select-all-btn:hover {
    background: #2563eb;
}

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

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

/* Scrollbar for dropdown */
.multi-select-options::-webkit-scrollbar {
    width: 6px;
}

.multi-select-options::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 3px;
}

.multi-select-options::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.multi-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .multi-select-dropdown {
        width: 100%;
        max-width: 300px;
    }

    .multi-select-option {
        padding: 12px;
        min-height: 44px;
    }

    .multi-select-option img {
        width: 28px;
        height: 28px;
    }
}
