/* ============================================
   TERMINAL CONTROL PANEL - STATS DASHBOARD
   Pure black theme with orange accents
   ============================================ */

/* CSS Variables & Theme System */
:root {
    /* Color Palette - Terminal/Control Panel Theme */
    --primary: #ff6b4a;       /* Orange/coral accent */
    --primary-dark: #e55a3a;
    --success: #ff6b4a;       /* Orange for highlights */
    --warning: #ff6b4a;       /* Orange for all accents */
    --danger: #ff6b4a;        /* Orange for emphasis */

    /* Terminal Dark Theme */
    --bg-main: #000000;       /* Pure black background */
    --bg-card: #0a0a0a;       /* Very dark card background */
    --bg-elevated: #1a1a1a;   /* Elevated elements */
    --bg-hover: #2a2a2a;

    --text-primary: #e8e8e8;
    --text-secondary: #999999;
    --text-muted: #666666;

    --border: #2a2a2a;
    --border-light: #3a3a3a;

    /* Spacing System - Compact */
    --spacing-xs: 4px;
    --spacing-sm: 6px;
    --spacing-md: 12px;
    --spacing-lg: 18px;
    --spacing-xl: 24px;

    /* Typography - Monospace */
    --font-mono: 'Courier New', 'Consolas', 'Monaco', monospace;
    --font-sans: 'Courier New', 'Consolas', 'Monaco', monospace;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-mono);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0.3px;
}

/* Main Container */
.stats-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

/* ============================================
   HEADER & CONTROLS
   ============================================ */

.dashboard-header {
    background: var(--bg-card);
    border-radius: 0;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border);
    position: relative;
}

.dashboard-header::before,
.dashboard-header::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border);
}

.dashboard-header::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.dashboard-header::after {
    top: -1px;
    right: -1px;
    border-left: none;
    border-bottom: none;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.team-identity {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.team-logo {
    width: 32px;
    height: 32px;
    border-radius: 0;
    background: transparent;
    border: 1px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    color: var(--primary);
}

.team-info h1 {
    font-size: 19px;
    font-weight: 500;
    margin-bottom: 2px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.team-record {
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 400;
    text-transform: uppercase;
}

.season-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.control-select {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 0;
    font-size: 15px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.1s;
    text-transform: uppercase;
}

.control-select:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   COMPLETELY REDESIGNED METRICS LAYOUT
   ============================================ */

.metrics-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
    align-items: stretch;
    width: 100%;
}

/* Individual metric cards - auto-sizing based on content */
.primary-metrics {
    display: contents;
}

.secondary-metrics {
    display: contents;
}

/* Grid-based sizing: fill row and prevent overlap */
.record-card,
.run-diff-card,
.offense-card,
.defense-card {
    grid-column: span 3; /* 4 cards across on wide screens */
}

.batting-card,
.pitching-card {
    grid-column: span 6; /* 2 cards across below primary row */
}

.metric-card {
    background: var(--bg-card);
    border-radius: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    transition: all 0.1s;
    cursor: pointer;
    overflow: visible;
}

/* Corner bracket decorations */
.metric-card::before,
.metric-card::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: border-color 0.1s;
}

.metric-card::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.metric-card::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.metric-card:hover {
    border-color: var(--primary);
}

.metric-card:hover::before,
.metric-card:hover::after {
    border-color: var(--primary);
}

.metric-card:active {
    background: var(--bg-elevated);
}

.metric-card.positive::before {
    border-color: var(--primary);
}

.metric-card.negative::before {
    border-color: var(--primary);
}

/* Unified card layout - all cards use same structure */
.metric-card {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: auto;
    min-height: 100px;
    box-sizing: border-box;
    overflow: visible;
    width: 100%;
}

/* Compact primary cards */
.record-card,
.run-diff-card,
.offense-card,
.defense-card {
    text-align: center;
}

.metric-icon {
    font-size: 15px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    margin: 0 auto 6px;
    color: var(--text-muted);
}

.metric-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-width: 0;
    overflow: visible;
}

/* Secondary cards - side-by-side layout */
.batting-card,
.pitching-card {
    padding: 14px 16px;
    overflow: visible;
    min-width: 300px;
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.metric-header .metric-icon {
    margin: 0;
    font-size: 15px;
    width: 24px;
    height: 24px;
}

.metric-header .metric-label {
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

/* Enhanced accessibility */
.metric-card:focus {
    outline: 1px solid var(--primary);
    outline-offset: 2px;
}

.metric-card:hover .metric-value {
    color: var(--primary);
}

.metric-label {
    font-size: 15px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 21px;
    font-weight: 600;
    font-family: var(--font-mono);
    line-height: 1.1;
    margin-bottom: 2px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    width: 100%;
    overflow: visible;
    text-overflow: initial;
}

.metric-vs {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-muted);
    font-family: var(--font-sans);
}

.metric-secondary {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.metric-vs-small {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-muted);
}

.metric-comparison {
    font-size: 15px;
    color: #e8e8e8; /* Changed from var(--text-secondary) for better visibility */
    font-weight: 600; /* Added for bolder appearance */
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    overflow: visible;
    flex-wrap: wrap;
}

.metric-trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 0;
    font-size: 15px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.metric-trend.up {
    background: transparent;
    color: #22c55e; /* Green for positive metrics */
    border-color: #22c55e;
}

.metric-trend.down {
    background: transparent;
    color: #ef4444; /* Red for negative metrics */
    border-color: #ef4444;
}

.metric-trend-small {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px;
    border-radius: 0;
    font-size: 15px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.metric-trend-small.up {
    background: transparent;
    color: #22c55e; /* Green for positive metrics */
    border-color: #22c55e;
}

.metric-trend-small.down {
    background: transparent;
    color: #ef4444; /* Red for negative metrics */
    border-color: #ef4444;
}

/* ============================================
   REDESIGNED STAT ROWS - HORIZONTAL LAYOUT
   ============================================ */

.stat-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    overflow: visible;
    padding: 8px 0;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-radius: 0;
    transition: background 0.1s;
    width: 100%;
    overflow: visible;
    gap: 12px;
}

.stat-row:hover {
    background: var(--bg-elevated);
}

.stat-row.positive .stat-trend.up {
    color: #22c55e; /* Green for positive metrics */
}

.stat-row.negative .stat-trend.down {
    color: #ef4444; /* Red for negative metrics */
}

.stat-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 0;
    overflow: visible;
}

.stat-name {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-primary);
    letter-spacing: 1px;
    min-width: 45px;
    flex-shrink: 0;
}

.stat-value {
    font-size: 19px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.stat-comparison {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    overflow: visible;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    white-space: nowrap;
}

.stat-league {
    color: #e8e8e8; /* Changed from var(--text-secondary) for better visibility */
    font-weight: 700; /* Increased from 600 for bolder appearance */
    font-size: 15px;
    font-family: var(--font-mono);
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 1; /* Changed from 0.9 for better visibility */
}

.stat-row .stat-trend {
    font-size: 15px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 0;
    background: transparent;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================
   LEAGUE POSITION CARDS
   ============================================ */

.league-position-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.position-card {
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0;
    padding: var(--spacing-md);
    position: relative;
}

.position-card::before,
.position-card::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.position-card::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.position-card::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.position-title {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.position-rank {
    font-size: 19px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.position-suffix {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 400;
}

.position-bar {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 0;
    overflow: hidden;
    margin-top: var(--spacing-sm);
}

.position-fill {
    height: 100%;
    border-radius: 0;
    transition: width 0.3s;
}

.position-fill.top-tier {
    background: var(--primary);
}

.position-fill.mid-tier {
    background: #ff6b4a;
}

.position-fill.bottom-tier {
    background: #ff6b4a;
}

/* ============================================
   DATA TABLES - COMPACT DESIGN
   ============================================ */

.stats-tables-container {
    display: grid;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.stats-table-section {
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0;
    overflow: hidden;
    position: relative;
}

.stats-table-section::before,
.stats-table-section::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 1;
}

.stats-table-section::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.stats-table-section::after {
    top: -1px;
    right: -1px;
    border-left: none;
    border-bottom: none;
}

.table-header {
    padding: var(--spacing-md);
    background: transparent;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 15px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.table-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.table-filter {
    padding: 5px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-mono);
    cursor: pointer;
}

.table-search {
    padding: 5px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-mono);
    width: 180px;
}

.table-search:focus {
    outline: none;
    border-color: var(--primary);
}

.compact-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 16px;
}

.compact-table thead {
    background: transparent;
}

.compact-table th {
    padding: 6px 10px;
    text-align: left;
    font-weight: 700; /* Increased from 500 for bolder appearance */
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #f5f5f5; /* Changed from var(--text-muted) to bright white */
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.compact-table th.sortable:hover {
    color: var(--primary);
}

.compact-table th.sorted-asc::after,
.compact-table th.sorted-desc::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

.compact-table th.sorted-asc::after {
    border-bottom: 4px solid var(--primary);
}

.compact-table th.sorted-desc::after {
    border-top: 4px solid var(--primary);
}

.compact-table tbody tr {
    transition: background 0.05s;
}

.compact-table tbody tr:hover {
    background: var(--bg-elevated);
}

.compact-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    color: #e5e7eb;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 16px;
}

.compact-table td:first-child {
    font-weight: 700;
    color: #ffffff;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    position: sticky;
    left: 0;
    background: var(--bg-card);
    z-index: 5;
}

.compact-table tbody tr:hover td:first-child {
    background: var(--bg-elevated);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Stat cell highlights */
.stat-cell {
    font-family: var(--font-mono);
    white-space: nowrap; /* Prevent stat values from wrapping */
}

.stat-cell.highlight-good {
    color: var(--primary);
    font-weight: 500;
}

.stat-cell.highlight-bad {
    color: var(--text-muted);
}

.stat-cell.league-better {
    position: relative;
    color: var(--primary);
    white-space: nowrap; /* Prevent arrow from wrapping */
}

.stat-cell.league-better::after {
    content: '▲';
    color: var(--primary);
    font-size: 15px;
    margin-left: 3px;
    display: inline-block; /* Keep arrow inline with text */
}

.stat-cell.league-worse {
    white-space: nowrap; /* Prevent arrow from wrapping */
}

.stat-cell.league-worse::after {
    content: '▼';
    color: var(--text-muted);
    font-size: 15px;
    margin-left: 3px;
    display: inline-block; /* Keep arrow inline with text */
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
    .record-card,
    .run-diff-card,
    .offense-card,
    .defense-card { grid-column: span 3; }
    .batting-card,
    .pitching-card { grid-column: span 6; }
}

@media (max-width: 992px) {
    .metrics-container {
        grid-template-columns: repeat(12, 1fr);
    }
    .record-card,
    .run-diff-card,
    .offense-card,
    .defense-card { grid-column: span 6; } /* 2 per row */
    .batting-card,
    .pitching-card { grid-column: span 12; } /* full width each */
}

@media (max-width: 768px) {
    .stats-dashboard {
        padding: var(--spacing-sm);
        /* Safe area support for notched devices */
        padding-left: max(var(--spacing-sm), env(safe-area-inset-left));
        padding-right: max(var(--spacing-sm), env(safe-area-inset-right));
        padding-bottom: max(var(--spacing-sm), env(safe-area-inset-bottom));
    }

    .dashboard-header {
        border-radius: 0;
        margin: -8px -8px 16px -8px;
        padding: var(--spacing-md);
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }

    /* Team name truncation for long names */
    .team-info h1 {
        font-size: 19px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        letter-spacing: 0.3px; /* Reduced from 1px */
    }

    .team-record {
        font-size: 15px;
        letter-spacing: 0.3px; /* Reduced from 1px */
    }

    /* Season controls responsive layout */
    .season-controls {
        width: 100%;
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .control-select {
        min-height: 44px; /* Touch target compliance */
        font-size: 15px;
        padding: 8px 12px;
        flex: 1 1 auto;
        min-width: 120px;
    }

    /* Better 2x2 grid instead of full width stacking */
    .metrics-container {
        gap: 12px; /* Increased from 6px */
    }

    .record-card,
    .run-diff-card,
    .offense-card,
    .defense-card {
        grid-column: span 6; /* 2x2 grid */
    }

    .batting-card,
    .pitching-card {
        grid-column: span 12;
    }

    .metric-card {
        padding: 12px 14px; /* Increased padding */
        height: auto;
        min-height: 85px; /* Slightly reduced */
    }

    .metric-value {
        font-size: 19px;
        line-height: 1.3;
    }

    .metric-comparison {
        font-size: 15px;
        line-height: 1.4;
    }

    /* Stat rows better spacing */
    .stat-rows {
        gap: 8px; /* Increased from 6px */
    }

    .stat-row {
        padding: 6px 0; /* Increased from 2px */
    }

    .stat-value {
        font-size: 15px; /* Increased from 14px */
    }

    .stat-name {
        font-size: 15px;
        letter-spacing: 0.5px;
    }

    .stat-league {
        font-size: 15px;
    }

    .league-position-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Mobile table improvements */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    /* Scroll indicator hint */
    .table-wrapper::after {
        content: '← Scroll →';
        position: sticky;
        right: 0;
        bottom: 0;
        background: var(--bg-card);
        padding: 4px 8px;
        font-size: 15px;
        color: var(--text-muted);
        border-top: 1px solid var(--border);
        text-align: center;
        opacity: 0.7;
    }

    .compact-table {
        min-width: 600px;
        font-size: 16px; /* Increased from 12px */
    }

    /* Better touch targets for table headers */
    .compact-table th {
        padding: 12px 8px; /* Increased from 6px */
        min-height: 44px;
        font-size: 15px;
        letter-spacing: 0.5px; /* Reduced from 1px */
    }

    .compact-table td {
        padding: 10px 8px; /* Increased from 5px */
    }

    /* Improved sticky column visibility */
    .compact-table td:first-child {
        box-shadow: 3px 0 6px rgba(0, 0, 0, 0.15);
    }

    /* Alternating rows for better scanning */
    .compact-table tbody tr:nth-child(odd) {
        background: rgba(255, 255, 255, 0.02);
    }

    /* Position cards mobile optimization */
    .league-position-grid {
        gap: 10px;
    }

    .position-card {
        padding: 14px;
        min-height: 90px;
    }

    .position-title {
        font-size: 15px;
        letter-spacing: 0.5px;
    }

    .position-rank {
        font-size: 21px;
    }

    /* Filter and search inputs - touch friendly */
    .table-filter,
    .table-search {
        min-height: 44px; /* Touch target compliance */
        font-size: 15px; /* Increased for better readability */
        padding: 10px 12px; /* Increased padding */
    }

    .table-search {
        width: 100%; /* Full width on mobile */
        max-width: 280px;
    }

    /* Section controls stacking */
    .section-controls {
        flex-wrap: wrap;
        width: 100%;
    }

    .section-controls label {
        font-size: 15px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .filter-checkbox {
        transform: scale(1.3); /* Larger checkbox for touch */
        margin-right: 8px;
    }
}

/* Tablet landscape optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .metrics-container {
        grid-template-columns: repeat(12, 1fr);
    }

    .record-card,
    .run-diff-card,
    .offense-card,
    .defense-card {
        grid-column: span 3; /* 4 per row in landscape */
    }

    .metric-card {
        min-height: 75px;
    }
}

@media (max-width: 480px) {
    .metrics-container {
        gap: 10px; /* Increased from 8px */
    }

    /* Keep 2x2 grid even on small phones */
    .record-card,
    .run-diff-card,
    .offense-card,
    .defense-card {
        grid-column: span 6;
    }

    .batting-card,
    .pitching-card {
        grid-column: span 12;
    }

    .metric-card {
        padding: 10px 12px;
        height: auto;
        min-height: 75px; /* Reduced from 80px */
    }

    .metric-icon {
        font-size: 15px; /* Slightly smaller emoji */
        width: 22px;
        height: 22px;
    }

    .metric-value {
        font-size: 17px;
        line-height: 1.2;
    }

    .metric-label {
        font-size: 15px;
        letter-spacing: 0.5px;
    }

    .stat-value {
        font-size: 15px;
    }

    .stat-name {
        font-size: 15px;
        min-width: 38px;
    }

    .stat-rows {
        gap: 7px;
    }

    .stat-row {
        padding: 5px 0;
    }

    .stat-comparison {
        font-size: 15px;
    }

    .stat-league {
        font-size: 15px;
    }
}

/* Very small phones (iPhone SE, etc) */
@media (max-width: 360px) {
    .stats-dashboard {
        padding: 4px;
    }

    .metrics-container {
        gap: 8px;
    }

    .metric-card {
        padding: 8px 10px;
        min-height: 70px;
    }

    .metric-value {
        font-size: 16px;
    }

    .stat-value {
        font-size: 15px;
    }

    .team-info h1 {
        font-size: 16px;
    }

    .control-select {
        font-size: 15px;
        min-width: 100px;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-skeleton {
    background: var(--bg-elevated);
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 0;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   MODAL STYLES
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-content::before,
.modal-content::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.modal-content::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.modal-content::after {
    top: -1px;
    right: -1px;
    border-left: none;
    border-bottom: none;
}

.modal-header {
    padding: var(--spacing-md);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.modal-subtitle {
    font-size: 15px;
    color: #e5e7eb;
    margin-top: 4px;
    font-weight: 500;
}

.modal-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 19px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 0;
    transition: all 0.1s;
    line-height: 1;
    font-family: var(--font-mono);
}

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

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex: 1;
}

.modal-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.modal-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

/* Rankings Table in Modal */
.rankings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.rankings-table thead {
    background: transparent;
}

.rankings-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 700; /* Increased from 500 for bolder appearance */
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #f5f5f5; /* Changed from var(--text-muted) to bright white */
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
}

.rankings-table th:first-child {
    text-align: center;
    width: 50px;
}

.rankings-table tbody tr {
    transition: background 0.05s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.rankings-table tbody tr:hover {
    background: var(--bg-elevated);
}

.rankings-table tbody tr.current-team {
    background: rgba(255, 107, 74, 0.1);
    border-left: 3px solid var(--primary);
    border-right: 1px solid var(--primary);
}

.rankings-table tbody tr.current-team:hover {
    background: rgba(255, 107, 74, 0.15);
}

.rankings-table tbody tr.current-team td {
    color: var(--text-primary);
    font-weight: 600;
}

.rankings-table tbody tr.current-team .team-name {
    color: var(--primary);
    font-weight: 700;
}

.rankings-table tbody tr.current-team .rank-badge {
    background: var(--primary);
    color: var(--bg-main);
    border-color: var(--primary);
    font-weight: 700;
}

.rankings-table tbody tr.current-team .rank-badge.rank-1,
.rankings-table tbody tr.current-team .rank-badge.rank-2,
.rankings-table tbody tr.current-team .rank-badge.rank-3 {
    background: var(--primary);
    color: var(--bg-main);
    border-color: var(--primary);
    font-weight: 700;
    box-shadow: 0 0 8px rgba(255, 107, 74, 0.3);
}

.rankings-table td {
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 16px;
    font-family: var(--font-mono);
}

.rankings-table td:first-child {
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.rankings-table .team-name {
    font-weight: 500;
    color: var(--text-primary);
}

.rankings-table .stat-value {
    font-family: var(--font-mono);
    font-weight: 500;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 0;
    font-weight: 600;
    font-size: 15px;
    font-family: var(--font-mono);
    border: 1px solid var(--border);
}

.rank-badge.rank-1 {
    background: var(--primary);
    color: var(--bg-main);
    border-color: var(--primary);
}

.rank-badge.rank-2 {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.rank-badge.rank-3 {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.rank-badge.top-tier {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.rank-badge.mid-tier {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.rank-badge.bottom-tier {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

/* Click hint on position cards */
.position-card {
    cursor: pointer;
    transition: all 0.1s;
}

.position-card:hover {
    border-color: var(--primary);
}

.position-card:hover::before,
.position-card:hover::after {
    border-color: var(--primary);
}

.position-card:active {
    background: var(--bg-elevated);
}

/* ============================================
   CUSTOM HIT LOCATION TOOLTIP
   ============================================ */

.hit-tooltip {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 10px 12px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    min-width: 180px;
    max-width: 260px;
    display: none;
}

.hit-tooltip.visible {
    display: block;
    opacity: 1;
}

.hit-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.hit-tooltip-player {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.hit-tooltip-result {
    padding: 2px 5px;
    border-radius: 0;
    font-size: 15px;
    font-weight: 500;
    text-transform: uppercase;
    border: 1px solid var(--border);
    font-family: var(--font-mono);
}

.hit-tooltip-result.hit {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.hit-tooltip-result.home-run {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.hit-tooltip-result.out {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.hit-tooltip-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 15px;
}

.hit-tooltip-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hit-tooltip-detail-label {
    color: var(--text-muted);
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

.hit-tooltip-detail-value {
    color: var(--text-primary);
    font-weight: 500;
    font-family: var(--font-mono);
    font-size: 15px;
}

.hit-tooltip-stats {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 15px;
}

.hit-tooltip-stat {
    text-align: center;
}

.hit-tooltip-stat-value {
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.hit-tooltip-stat-label {
    color: var(--text-muted);
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

/* ============================================
   HIT LOCATION SECTION - SPRAY CHART FIXES
   ============================================ */

/* Make hit markers clickable */
#hit-overlay #hit-markers * {
    pointer-events: auto;
}

/* Removed skeleton loading styles - now using simple spinner overlay */

/* Loading state for main content */
#main-content.loading {
    opacity: 0.3;
    pointer-events: none;
}

/* Empty state styling */
.empty-state {
    /* Mobile responsive adjustments */
}

@media (max-width: 768px) {
    .empty-state {
        padding: 60px 20px !important;
        margin-top: 20px !important;
        max-width: 100% !important;
        margin-left: 20px !important;
        margin-right: 20px !important;
    }

    .empty-state h3 {
        font-size: 21px !important;
    }

    .empty-state p {
        font-size: 15px !important;
    }

    .empty-state > div:first-child {
        font-size: 48px !important;
    }
}

@media (max-width: 480px) {
    .empty-state {
        padding: 40px 15px !important;
        margin-top: 15px !important;
        margin-left: 10px !important;
        margin-right: 10px !important;
    }

    .empty-state h3 {
        font-size: 19px !important;
    }

    .empty-state > div:first-child {
        font-size: 42px !important;
        margin-bottom: 16px !important;
    }
}

/* ============================================
   BOX SCORE MODAL STYLES
   ============================================ */

.boxscore-modal-content {
    max-width: 900px;
    width: 95%;
}

/* ESPN-style Box Score Layout */
.boxscore-team-section {
    margin-bottom: 24px;
}

.boxscore-team-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.boxscore-team-header .team-name {
    font-size: 19px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.boxscore-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
    background: var(--bg-main);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.boxscore-table thead {
    background: var(--bg-elevated);
    border-bottom: 2px solid var(--border);
}

.boxscore-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 700; /* Increased from 600 for bolder appearance */
    color: #f5f5f5; /* Changed from var(--text-primary) to bright white */
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid var(--border);
}

.boxscore-table th:first-child {
    text-align: left;
    padding-left: 16px;
}

.boxscore-table th:last-child {
    border-right: none;
}

.boxscore-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.boxscore-table tbody tr:hover {
    background: rgba(255, 107, 74, 0.05);
}

.boxscore-table .player-row td {
    padding: 10px 8px;
    text-align: center;
    border-right: 1px solid var(--border);
}

.boxscore-table .player-name {
    text-align: left !important;
    padding-left: 16px !important;
    font-weight: 600;
    color: var(--text-primary);
}

.boxscore-table .position {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 15px;
}

.boxscore-table .stat {
    font-weight: 500;
    color: var(--text-primary);
}

.boxscore-table .stat.avg,
.boxscore-table .stat.era {
    font-weight: 600;
    color: var(--primary);
}

.boxscore-table .team-totals {
    background: rgba(255, 107, 74, 0.1);
    border-top: 2px solid var(--primary);
    font-weight: 700;
}

.boxscore-table .team-totals td {
    padding: 12px 8px;
    text-align: center;
    border-right: 1px solid var(--border);
    color: var(--text-primary);
    font-weight: 700;
}

.boxscore-table .totals-label {
    text-align: left !important;
    padding-left: 16px !important;
    color: var(--primary) !important;
    font-weight: 800 !important;
}

.boxscore-table .totals-dash {
    color: var(--text-secondary) !important;
}

.boxscore-table .totals-stat {
    color: var(--text-primary) !important;
    font-weight: 800 !important;
}

.boxscore-table .totals-stat.avg,
.boxscore-table .totals-stat.era {
    color: var(--primary) !important;
}

.boxscore-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.boxscore-header {
    text-align: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-date {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.game-location {
    font-size: 15px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Enhanced Game Score Display */
.game-score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 12px 0;
    font-family: var(--font-mono);
}

.team-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    border-radius: 6px;
    min-width: 120px;
    transition: all 0.2s ease;
}

.team-score.winner {
    background: rgba(34, 197, 94, 0.15);
    border: 2px solid #22c55e;
    color: #22c55e;
}

.team-score.loser {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid #ef4444;
    color: #ef4444;
}

.team-score.tie {
    background: rgba(156, 163, 175, 0.15);
    border: 2px solid #9ca3af;
    color: #9ca3af;
}

.team-score .team-name {
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.team-score .score {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.score-separator {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0 8px;
}

.boxscore-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.boxscore-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.boxscore-table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 0;
}

.boxscore-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
    font-family: var(--font-mono);
}

.boxscore-table thead {
    background: var(--bg-elevated);
}

.boxscore-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 700; /* Increased from 600 for bolder appearance */
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #f5f5f5; /* Changed from var(--text-primary) to bright white */
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.25);
}

.boxscore-table th:first-child {
    text-align: left;
    width: 120px;
}

.boxscore-table th:last-child {
    border-right: none;
}

.boxscore-table tbody tr {
    transition: background 0.1s;
}

.boxscore-table tbody tr:hover {
    background: var(--bg-elevated);
}

.boxscore-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.boxscore-table tbody tr:nth-child(even):hover {
    background: var(--bg-elevated);
}

.boxscore-table td {
    padding: 10px 8px;
    text-align: center;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    border-right: 1px solid rgba(255, 255, 255, 0.25);
    font-weight: 500;
}

.boxscore-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

.boxscore-table td:last-child {
    border-right: none;
}

.boxscore-table .team-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 15px;
}

.boxscore-table .team-header {
    background: var(--bg-elevated);
    border-top: 2px solid var(--border);
}

.boxscore-table .team-header .team-name {
    font-weight: 800;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    padding: 8px 12px;
}

.boxscore-table .team-totals {
    background: rgba(255, 107, 74, 0.1);
    border-top: 1px solid var(--primary);
    font-weight: 600;
}

.boxscore-table .team-totals td {
    color: var(--text-primary);
    font-weight: 700;
}

/* Responsive modals for mobile */
@media (max-width: 768px) {
    /* General modal improvements */
    .modal-content {
        width: 95%;
        max-width: none;
        max-height: 92vh;
        /* Safe area support for notched devices */
        margin-top: max(3%, env(safe-area-inset-top));
        margin-bottom: max(3%, env(safe-area-inset-bottom));
    }

    .modal-header {
        padding: 16px; /* Increased from 12px */
    }

    .modal-title {
        font-size: 17px;
        letter-spacing: 0.5px;
        font-family: var(--tsr-font-label, inherit);
    }

    .modal-close {
        min-width: 44px; /* Touch target compliance */
        min-height: 44px;
        font-size: 21px;
    }

    .modal-body {
        padding: 16px; /* Increased from var(--spacing-lg) */
    }

    /* Box score modal specific */
    .boxscore-modal-content {
        width: 96%;
        max-width: none;
    }

    .boxscore-table {
        font-size: 16px; /* Increased from 11px */
    }

    .boxscore-table th,
    .boxscore-table td {
        padding: 10px 6px; /* Increased from 8px 4px */
    }

    .boxscore-table th:first-child,
    .boxscore-table td:first-child {
        width: 100px; /* Increased from 80px */
        min-width: 100px;
    }

    /* Rankings table in modal */
    .rankings-table {
        font-size: 16px; /* Increased from default */
    }

    .rankings-table th,
    .rankings-table td {
        padding: 12px 8px; /* Increased touch targets */
    }

    .rankings-table td:first-child {
        min-width: 50px;
    }

    .rankings-table td:nth-child(2) {
        min-width: 100px; /* Team name column */
    }

    /* Game score display on mobile */
    .game-score-display {
        gap: 12px;
        flex-wrap: wrap;
    }

    .team-score {
        min-width: 100px;
        padding: 6px 12px;
    }

    .team-score .team-name {
        font-size: 15px;
    }

    .team-score .score {
        font-size: 21px;
    }

    /* Modal loading states */
    .modal-loading {
        padding: 30px 20px; /* Reduced from 40px */
    }

    .modal-loading-spinner {
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   RECENT GAMES SECTION
   ============================================ */

.game-row {
    transition: all 0.2s ease;
    cursor: pointer;
}

.game-row:hover {
    background: var(--bg-elevated) !important;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.game-row:hover td {
    color: var(--text-primary);
}

.table-info {
    font-size: 15px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

.result-indicator {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 15px;
}

.game-won .result-indicator {
    color: var(--primary);
}

.game-lost .result-indicator {
    color: var(--text-muted);
}

.game-tied .result-indicator {
    color: var(--text-secondary);
}

.wl-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: 0;
    font-weight: 600;
    font-size: 15px;
    font-family: var(--font-mono);
}

.wl-badge.wl-win {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}

.wl-badge.wl-loss {
    color: var(--text-muted);
    border-color: var(--border);
    background: transparent;
}

.wl-badge.wl-tie {
    color: var(--text-secondary);
    border-color: var(--border);
    background: transparent;
}

.game-won:hover {
    background: var(--bg-elevated);
}

.game-lost:hover {
    background: var(--bg-elevated);
}

.game-tied:hover {
    background: var(--bg-elevated);
}

/* ============================================
   ACCESSIBILITY & MOBILE POLISH
   ============================================ */

/* Better tap highlight color for mobile */
* {
    -webkit-tap-highlight-color: rgba(255, 107, 74, 0.2);
}

/* Focus states for keyboard navigation */
button:focus-visible,
select:focus-visible,
input:focus-visible,
.metric-card:focus-visible,
.position-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Improved focus for table headers */
.compact-table th:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .metric-card {
        border-width: 3px;
    }

    .metric-value,
    .stat-value,
    .team-info h1 {
        font-weight: 700;
    }

    button,
    .control-select {
        border-width: 2px;
    }
}

/* Dark mode specific enhancements (already dark by default) */
@media (prefers-color-scheme: dark) {
    /* Ensure good contrast in dark mode */
    .metric-card {
        border-color: rgba(255, 255, 255, 0.4);
    }

    .compact-table td:first-child {
        box-shadow: 3px 0 8px rgba(0, 0, 0, 0.3);
    }
}

/* Touch device specific improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for touch-only devices */
    .metric-card {
        min-height: 90px;
    }

    .compact-table th,
    .compact-table td {
        padding: 12px 10px;
    }

    /* Disable hover effects on touch devices */
    .metric-card:hover,
    .position-card:hover,
    .compact-table tbody tr:hover {
        transform: none;
        box-shadow: none;
    }

    /* Add active/pressed state instead */
    .metric-card:active,
    .position-card:active {
        background: var(--bg-elevated);
        transform: scale(0.98);
    }
}

/* Pitcher Modal Styles */
.pitcher-modal-content {
    max-width: 1200px;
    width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

.pitcher-modal-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 24px 0;
    border-bottom: 2px solid var(--border);
    background: var(--bg-elevated);
}

.pitcher-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    bottom: -2px;
}

.pitcher-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.pitcher-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.pitcher-tab-content {
    display: none;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.pitcher-tab-content.active {
    display: block;
}

/* Pitcher Stats Grid */
.pitcher-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.pitcher-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.pitcher-card-full {
    grid-column: 1 / -1;
}

.pitcher-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.pitcher-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 12px;
}

.pitcher-stats-row:last-child {
    margin-bottom: 0;
}

.pitcher-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pitcher-stat-label {
    font-size: 11px;
    color: #D1D5DB !important;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.pitcher-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #FFFFFF !important;
    font-family: var(--font-mono);
}

/* Quick Stats Grid */
.pitcher-quick-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.pitcher-quick-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.pitcher-quick-stat .pitcher-stat-label {
    font-size: 13px;
    color: var(--text-primary) !important;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.pitcher-quick-stat .pitcher-stat-value {
    font-size: 20px;
    color: #FFFFFF !important;
    font-weight: 700;
    margin-top: 2px;
}

/* Game Log Table */
.pitcher-game-log {
    overflow-x: auto;
}

.pitcher-game-log table {
    width: 100%;
}

/* Coming Soon Placeholder */
.pitcher-coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
}

.coming-soon-icon {
    font-size: 80px;
    margin-bottom: 24px;
    opacity: 0.6;
    animation: bounce 2s infinite;
}

.coming-soon-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.coming-soon-message {
    font-size: 16px;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.6;
}

/* Trends Tab */
.pitcher-trends {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pitcher-insights {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pitcher-insight {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.insight-label {
    font-size: 14px;
    color: #D1D5DB !important;
    font-weight: 600;
}

.insight-value {
    font-size: 14px;
    color: #FFFFFF !important;
    font-family: var(--font-mono);
    font-weight: 700;
}

/* Pitcher row hover effect */
.pitcher-row:hover {
    background: var(--bg-elevated) !important;
    cursor: pointer;
}

/* Batter row hover effect */
.batter-row:hover {
    background: var(--bg-elevated) !important;
    cursor: pointer;
}

/* Batter modal uses same styles as pitcher modal */
#batter-modal .pitcher-modal-content {
    /* Inherits from existing pitcher modal styles */
}

.batter-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.batter-tab:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.1);
}

.batter-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.batter-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.batter-tab-content.active {
    display: block;
}

/* Responsive design for pitcher modal */
@media (max-width: 1024px) {
    .pitcher-stats-grid {
        grid-template-columns: 1fr;
    }

    .pitcher-quick-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .pitcher-modal-content {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .pitcher-modal-tabs {
        overflow-x: auto;
        gap: 4px;
        padding: 12px 16px 0;
    }

    .pitcher-tab {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .pitcher-tab-content {
        padding: 16px;
    }

    .pitcher-stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .pitcher-quick-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .pitcher-stat-value {
        font-size: 18px;
        color: #FFFFFF !important;
    }
}

@media (max-width: 480px) {
    .pitcher-stats-row {
        grid-template-columns: 1fr;
    }

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

    .pitcher-game-log table {
        font-size: 12px;
    }

    .pitcher-game-log th,
    .pitcher-game-log td {
        padding: 8px 6px;
    }
}

/* Print styles (bonus) */
@media print {
    .dashboard-header,
    .season-controls,
    .modal-overlay,
    button {
        display: none !important;
    }

    .stats-dashboard {
        padding: 0;
    }

    .metric-card,
    .position-card {
        break-inside: avoid;
    }

    .compact-table {
        font-size: 16px;
    }
}

/* Game Editing Styles */
.game-actions {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.game-row.game-excluded-from-stats {
    opacity: 0.72;
}

.game-row.game-excluded-from-stats td:first-child,
.game-row.game-excluded-from-stats td:nth-child(2) {
    text-decoration: line-through;
}

.stats-exclusion-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.btn-toggle-game-stats,
.btn-edit-game,
.btn-delete-game {
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    transition: all 0.2s ease;
}

.btn-toggle-game-stats {
    color: #7c2d12;
    background: rgba(251, 146, 60, 0.12);
    border-color: rgba(251, 146, 60, 0.4);
}

.btn-toggle-game-stats:hover {
    background: rgba(251, 146, 60, 0.22);
}

.btn-toggle-game-stats.is-excluded {
    color: #14532d;
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.35);
}

.btn-toggle-game-stats.is-excluded:hover {
    background: rgba(34, 197, 94, 0.26);
}

.btn-toggle-game-stats:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-edit-game:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.45);
    color: #1d4ed8;
}

.btn-delete-game:hover {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.4);
    color: #b91c1c;
}

.btn-refresh-games {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: #10b981;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-refresh-games:hover {
    background: #059669;
}

.age-unknown {
    color: #999;
    font-style: italic;
}

.age-up {
    color: #ef4444;
    font-weight: 600;
}

.age-down {
    color: #22c55e;
    font-weight: 600;
}

.age-same {
    color: #64748b;
}

#game-edit-modal.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

#game-edit-modal .modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
}

#game-edit-modal .modal-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#game-edit-modal .modal-title {
    font-size: 1.5em;
    font-weight: 600;
    color: #111827;
}

#game-edit-modal .modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

#game-edit-modal .modal-close:hover {
    color: #111827;
}

#game-edit-modal .modal-body {
    padding: 20px;
    color: #111827;
}

#game-edit-modal label {
    color: #374151;
}

#game-edit-modal input,
#game-edit-modal select {
    color: #111827;
}

#game-edit-modal input:disabled,
#game-edit-modal input[readonly] {
    color: #6b7280;
}

/* Game row highlighting */
#games-table tbody tr[data-game-id]:hover {
    background: #f9fafb !important;
}

#games-table tbody tr[data-game-id]:hover td {
    color: #111827 !important;
}

#games-table tbody tr[data-game-id]:hover .stat-cell {
    color: #111827 !important;
}

/* Toast notification */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    background: #10b981;
    color: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
}

.toast-notification.error {
    background: #ef4444;
}

.toast-notification.info {
    background: #3b82f6;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-notification.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

/* ============================================
   STATS READABILITY REDESIGN
   Scoped to Team Stats page only (#main-content)
   NOTE: hit location section is intentionally untouched.
   ============================================ */
#main-content {
    --tsr-font-label: -apple-system, "SF Pro Text", "Helvetica Neue", "Segoe UI", sans-serif;
    --tsr-font-number: "SF Mono", "Cascadia Mono", "Consolas", "Lucida Console", monospace;
    --tsr-border-soft: rgba(255, 255, 255, 0.15);
    --tsr-surface: #101010;
    --tsr-surface-soft: #161616;
    --tsr-positive-bg: rgba(34, 197, 94, 0.16);
    --tsr-positive-fg: #93f1b7;
    --tsr-negative-bg: rgba(239, 68, 68, 0.16);
    --tsr-negative-fg: #ffb5b5;
    --tsr-neutral-bg: rgba(148, 163, 184, 0.14);
    --tsr-neutral-fg: #cdd5df;
}

#main-content .dashboard-header {
    border: 1px solid var(--tsr-border-soft);
    border-radius: 14px;
    background: var(--tsr-surface);
    margin-bottom: 20px;
}

#main-content .dashboard-header::before,
#main-content .dashboard-header::after {
    display: none;
}

#main-content .team-info h1 {
    font-family: var(--tsr-font-label);
    font-size: 26px;
    letter-spacing: 0.02em;
    text-transform: none;
}

#main-content .team-record {
    font-family: var(--tsr-font-label);
    text-transform: none;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}

#main-content .team-logo {
    border-radius: 10px;
    width: 38px;
    height: 38px;
    font-family: var(--tsr-font-number);
    font-size: 13px;
    background: rgba(255, 107, 74, 0.11);
}

#main-content .metrics-container {
    gap: 14px;
}

#main-content .metric-card {
    background: var(--tsr-surface);
    border: 1px solid var(--tsr-border-soft);
    border-radius: 12px;
    min-height: 94px;
}

#main-content .metric-card::before,
#main-content .metric-card::after {
    display: none;
}

#main-content .metric-card:hover {
    border-color: rgba(255, 107, 74, 0.42);
    transform: translateY(-1px);
}

#main-content .metric-icon {
    border-radius: 8px;
    width: 30px;
    height: 30px;
    font-size: 12px;
    border: 1px solid var(--tsr-border-soft);
    background: var(--tsr-surface-soft);
}

#main-content .metric-label,
#main-content .metric-header .metric-label,
#main-content .metric-comparison,
#main-content .stat-name,
#main-content .stat-league,
#main-content .table-title,
#main-content .position-title,
#main-content .table-info,
#main-content .table-search {
    font-family: var(--tsr-font-label);
    text-transform: none;
    letter-spacing: 0.02em;
}

#main-content .metric-value,
#main-content .stat-value,
#main-content .position-rank,
#main-content .compact-table td,
#main-content .rank-badge,
#main-content .rankings-table td,
#main-content .rankings-table .stat-value {
    font-family: var(--tsr-font-number);
}

#main-content .metric-value {
    font-size: 28px;
    font-weight: 700;
}

#main-content .metric-comparison,
#main-content .stat-league,
#main-content .stat-comparison {
    color: var(--text-secondary);
    font-size: 14px;
}

#main-content .stat-name {
    font-size: 15px;
    font-weight: 700;
}

#main-content .stat-row .stat-value {
    font-size: 20px;
    font-weight: 700;
}

#main-content .stat-league {
    font-size: 14px;
    font-weight: 600;
}

#main-content .metric-trend,
#main-content .stat-row .stat-trend {
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 2px 8px;
    font-size: 12px;
    font-family: var(--tsr-font-number);
}

#main-content .metric-trend.up,
#main-content .stat-row.positive .stat-trend.up {
    background: var(--tsr-positive-bg);
    color: var(--tsr-positive-fg);
    border-color: rgba(34, 197, 94, 0.3);
}

#main-content .metric-trend.down,
#main-content .stat-row.negative .stat-trend.down {
    background: var(--tsr-negative-bg);
    color: var(--tsr-negative-fg);
    border-color: rgba(239, 68, 68, 0.3);
}

#main-content .league-position-grid {
    gap: 12px;
    margin-bottom: 18px;
}

#main-content .position-card {
    background: var(--tsr-surface);
    border: 1px solid var(--tsr-border-soft);
    border-radius: 12px;
}

#main-content .position-card::before,
#main-content .position-card::after {
    display: none;
}

#main-content .position-title {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

#main-content .position-rank {
    font-size: 28px;
}

#main-content .position-suffix {
    color: var(--text-secondary);
}

#main-content .position-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

#main-content .position-fill {
    border-radius: 999px;
}

#main-content .stats-glance-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

#main-content .stats-glance-card {
    border: 1px solid var(--tsr-border-soft);
    border-radius: 12px;
    background: var(--tsr-surface-soft);
    padding: 11px 13px;
    min-height: 84px;
}

#main-content .stats-glance-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-family: var(--tsr-font-label);
    font-weight: 600;
}

#main-content .stats-glance-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 3px;
    font-family: var(--tsr-font-number);
}

#main-content .stats-glance-detail {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
    font-family: var(--tsr-font-number);
}

#main-content .stats-legend-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

#main-content .stats-legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--tsr-border-soft);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    font-family: var(--tsr-font-label);
}

#main-content .stats-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

#main-content .stats-legend-dot-positive {
    background: #22c55e;
}

#main-content .stats-legend-dot-negative {
    background: #ef4444;
}

#main-content .stats-tables-container {
    gap: 14px;
}

#main-content .stats-table-section {
    border: 1px solid var(--tsr-border-soft);
    border-radius: 12px;
    background: var(--tsr-surface);
}

#main-content .stats-table-section::before,
#main-content .stats-table-section::after {
    display: none;
}

#main-content .table-header {
    border-bottom: 1px solid var(--tsr-border-soft);
    padding: 12px 14px;
}

#main-content .table-title {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 700;
}

#main-content .table-search {
    border-radius: 999px;
    border: 1px solid var(--tsr-border-soft);
    background: var(--tsr-surface-soft);
    width: 220px;
    font-size: 13px;
}

#main-content .table-wrapper {
    overflow: auto;
    max-height: 66vh;
}

#main-content .compact-table {
    border-collapse: separate;
    border-spacing: 0;
}

#main-content .compact-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #1a1a1a;
    border-bottom: 1px solid var(--tsr-border-soft);
}

#main-content .compact-table th {
    font-size: 14px;
    letter-spacing: 0.03em;
    text-transform: none;
    color: #f1f1f1;
    padding: 12px 10px;
    font-family: var(--tsr-font-label);
    font-weight: 700;
}

#main-content .compact-table td {
    font-size: 15px;
    font-weight: 600;
    color: #eaeaea;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 10px;
}

#main-content .compact-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

#main-content .compact-table tbody tr:hover {
    background: rgba(255, 107, 74, 0.09);
}

#main-content .compact-table th abbr,
#main-content .compact-table td abbr {
    text-decoration: none;
    cursor: help;
}

#main-content #batting-stats-table th:nth-child(1),
#main-content #batting-stats-table td:nth-child(1),
#main-content #pitching-stats-table th:nth-child(1),
#main-content #pitching-stats-table td:nth-child(1),
#main-content #games-table th:nth-child(1),
#main-content #games-table td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 6;
    background: #121212;
}

#main-content #batting-stats-table th:nth-child(2),
#main-content #batting-stats-table td:nth-child(2),
#main-content #pitching-stats-table th:nth-child(2),
#main-content #pitching-stats-table td:nth-child(2),
#main-content #games-table th:nth-child(2),
#main-content #games-table td:nth-child(2) {
    position: sticky;
    left: 200px;
    z-index: 6;
    background: #121212;
}

#main-content #batting-stats-table thead th:nth-child(1),
#main-content #batting-stats-table thead th:nth-child(2),
#main-content #pitching-stats-table thead th:nth-child(1),
#main-content #pitching-stats-table thead th:nth-child(2),
#main-content #games-table thead th:nth-child(1),
#main-content #games-table thead th:nth-child(2) {
    z-index: 9;
    background: #191919;
}

#main-content #batting-stats-table th:nth-child(1),
#main-content #batting-stats-table td:nth-child(1),
#main-content #pitching-stats-table th:nth-child(1),
#main-content #pitching-stats-table td:nth-child(1) {
    min-width: 200px;
}

#main-content #batting-stats-table th:nth-child(2),
#main-content #batting-stats-table td:nth-child(2),
#main-content #pitching-stats-table th:nth-child(2),
#main-content #pitching-stats-table td:nth-child(2) {
    min-width: 54px;
    text-align: center;
}

#main-content #games-table th:nth-child(1),
#main-content #games-table td:nth-child(1) {
    min-width: 132px;
}

#main-content #games-table th:nth-child(2),
#main-content #games-table td:nth-child(2) {
    min-width: 170px;
    left: 132px;
}

#main-content .stat-cell.highlight-good,
#main-content .stat-cell.league-better,
#main-content .stat-cell.league-worse {
    font-weight: 700;
}

#main-content .stat-cell.highlight-good,
#main-content .stat-cell.league-better {
    background: var(--tsr-positive-bg);
    color: var(--tsr-positive-fg);
}

#main-content .stat-cell.league-worse {
    background: var(--tsr-negative-bg);
    color: var(--tsr-negative-fg);
}

#main-content .stat-cell.league-better::after,
#main-content .stat-cell.league-worse::after {
    content: '';
    margin: 0;
    display: none;
}

#main-content .btn-refresh-games {
    border-radius: 999px;
    border: 1px solid var(--tsr-border-soft);
    background: var(--tsr-surface-soft);
    color: var(--text-primary);
    font-family: var(--tsr-font-label);
    font-size: 12px;
    padding: 6px 12px;
}

#main-content .btn-refresh-games:hover {
    border-color: rgba(255, 107, 74, 0.5);
    color: #ffd4ca;
}

#main-content .rankings-table {
    border-collapse: separate;
    border-spacing: 0;
}

#main-content .rankings-table th {
    text-transform: none;
    letter-spacing: 0.02em;
    font-size: 14px;
    border-bottom: 1px solid var(--tsr-border-soft);
    font-family: var(--tsr-font-label);
    font-weight: 700;
}

#main-content .rankings-table td {
    font-size: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#main-content .rankings-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

#main-content .rankings-table tbody tr.current-team {
    border-left: none;
    border-right: none;
    background: rgba(255, 107, 74, 0.14);
}

#main-content .rank-badge {
    border-radius: 999px;
    width: 26px;
    height: 26px;
    font-size: 11px;
}

#main-content #games-table tbody tr[data-game-id]:hover,
#main-content #games-table tbody tr[data-game-id]:hover td,
#main-content #games-table tbody tr[data-game-id]:hover .stat-cell {
    background: rgba(255, 107, 74, 0.09) !important;
    color: #f1f1f1 !important;
}

@media (max-width: 1000px) {
    #main-content .stats-glance-strip {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #main-content .metric-value {
        font-size: 26px;
    }

    #main-content .stat-row .stat-value {
        font-size: 18px;
    }

    #main-content .stat-name {
        font-size: 14px;
    }

    #main-content .stat-league {
        font-size: 13px;
    }

    #main-content .compact-table th {
        font-size: 13px;
        padding: 12px 8px;
        min-height: 44px;
    }

    #main-content .compact-table td {
        font-size: 14px;
        padding: 12px 8px;
    }

    #main-content .position-rank {
        font-size: 26px;
    }

    #main-content .table-title {
        font-size: 16px;
    }

    #main-content .stats-glance-value {
        font-size: 18px;
    }

    #main-content .stats-glance-detail {
        font-size: 13px;
    }

    #main-content .table-search {
        width: 100%;
        max-width: 240px;
    }

    #main-content #batting-stats-table th:nth-child(3),
    #main-content #batting-stats-table td:nth-child(3),
    #main-content #batting-stats-table th:nth-child(6),
    #main-content #batting-stats-table td:nth-child(6),
    #main-content #batting-stats-table th:nth-child(9),
    #main-content #batting-stats-table td:nth-child(9),
    #main-content #batting-stats-table th:nth-child(10),
    #main-content #batting-stats-table td:nth-child(10),
    #main-content #batting-stats-table th:nth-child(13),
    #main-content #batting-stats-table td:nth-child(13),
    #main-content #batting-stats-table th:nth-child(14),
    #main-content #batting-stats-table td:nth-child(14),
    #main-content #batting-stats-table th:nth-child(15),
    #main-content #batting-stats-table td:nth-child(15),
    #main-content #batting-stats-table th:nth-child(16),
    #main-content #batting-stats-table td:nth-child(16),
    #main-content #pitching-stats-table th:nth-child(6),
    #main-content #pitching-stats-table td:nth-child(6),
    #main-content #pitching-stats-table th:nth-child(7),
    #main-content #pitching-stats-table td:nth-child(7),
    #main-content #pitching-stats-table th:nth-child(8),
    #main-content #pitching-stats-table td:nth-child(8),
    #main-content #pitching-stats-table th:nth-child(10),
    #main-content #pitching-stats-table td:nth-child(10),
    #main-content #pitching-stats-table th:nth-child(11),
    #main-content #pitching-stats-table td:nth-child(11),
    #main-content #pitching-stats-table th:nth-child(12),
    #main-content #pitching-stats-table td:nth-child(12),
    #main-content #pitching-stats-table th:nth-child(15),
    #main-content #pitching-stats-table td:nth-child(15),
    #main-content #games-table th:nth-child(3),
    #main-content #games-table td:nth-child(3),
    #main-content #games-table th:nth-child(6),
    #main-content #games-table td:nth-child(6),
    #main-content #games-table th:nth-child(7),
    #main-content #games-table td:nth-child(7),
    #main-content #games-table th:nth-child(8),
    #main-content #games-table td:nth-child(8) {
        display: none;
    }

    #main-content #batting-stats-table th:nth-child(1),
    #main-content #batting-stats-table td:nth-child(1),
    #main-content #pitching-stats-table th:nth-child(1),
    #main-content #pitching-stats-table td:nth-child(1) {
        min-width: 140px;
        font-size: 14px;
        font-family: var(--tsr-font-label);
    }

    #main-content #games-table th:nth-child(2),
    #main-content #games-table td:nth-child(2) {
        left: 132px;
        min-width: 140px;
    }

    #main-content #batting-stats-table th:nth-child(2),
    #main-content #batting-stats-table td:nth-child(2),
    #main-content #pitching-stats-table th:nth-child(2),
    #main-content #pitching-stats-table td:nth-child(2) {
        position: sticky;
        left: 140px;
        z-index: 7;
        min-width: 50px;
        text-align: center;
        background: #121212;
    }

    #main-content #batting-stats-table thead th:nth-child(2),
    #main-content #pitching-stats-table thead th:nth-child(2) {
        z-index: 10;
        background: #191919;
    }
}

/* ============================================
   TOP ROW REDESIGN + METRIC DENSITY TUNE
   Scoped to Team Stats page only (#main-content)
   NOTE: hit location section is intentionally untouched.
   ============================================ */
#main-content .header-top {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(480px, 1.6fr);
    gap: 14px;
    align-items: stretch;
    margin-bottom: 16px;
}

#main-content .team-identity {
    border: 1px solid var(--tsr-border-soft);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 107, 74, 0.22) 0%, rgba(255, 107, 74, 0.07) 34%, rgba(255, 255, 255, 0.02) 100%);
    padding: 12px 14px;
    min-height: 90px;
    gap: 12px;
}

#main-content .team-info {
    min-width: 0;
}

#main-content .team-info h1 {
    margin-bottom: 4px;
    font-size: clamp(22px, 2vw, 30px);
    line-height: 1.12;
}

#main-content .team-record {
    font-size: 14px;
    letter-spacing: 0.03em;
}

#main-content .stats-control-board {
    border: 1px solid var(--tsr-border-soft);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#main-content .filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

#main-content .control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

#main-content .control-label {
    font-family: var(--tsr-font-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    padding-left: 2px;
}

#main-content .stats-control-board .control-select {
    width: 100%;
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: #141414;
    color: #f2f2f2;
    font-family: var(--tsr-font-label);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: none;
    padding: 10px 12px;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

#main-content .stats-control-board .control-select:hover {
    border-color: rgba(255, 107, 74, 0.65);
    background: #1a1a1a;
    color: #ffffff;
}

#main-content .stats-control-board .control-select:focus-visible {
    outline: 2px solid rgba(255, 107, 74, 0.45);
    outline-offset: 2px;
}

#main-content .team-search-wrap {
    position: relative;
}

#main-content .team-search-input {
    width: 100%;
}

#main-content .team-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    display: none;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: #101010;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

#main-content .team-search-results.active {
    display: block;
}

#main-content .team-search-option {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: #f2f2f2;
    text-align: left;
    font-family: var(--tsr-font-label);
    font-size: 13px;
    cursor: pointer;
}

#main-content .team-search-option:hover,
#main-content .team-search-option:focus-visible {
    background: rgba(255, 107, 74, 0.12);
    color: #ffffff;
    outline: none;
}

#main-content .team-search-empty {
    padding: 10px 12px;
    color: var(--text-secondary);
    font-family: var(--tsr-font-label);
    font-size: 12px;
}

#main-content .team-search-meta {
    margin-top: 5px;
    min-height: 16px;
    color: var(--text-secondary);
    font-family: var(--tsr-font-label);
    font-size: 11px;
    letter-spacing: 0.03em;
}

.modal-team-search-wrap {
    position: relative;
}

.modal-team-search-input {
    width: 100%;
    min-height: 42px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 14px;
}

.modal-team-search-input:focus-visible {
    outline: 2px solid rgba(255, 107, 74, 0.45);
    outline-offset: 2px;
}

.modal-team-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 40;
    display: none;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: #101010;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.modal-team-search-results.active {
    display: block;
}

.modal-team-search-option {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: #f2f2f2;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
}

.modal-team-search-option:hover,
.modal-team-search-option:focus-visible {
    background: rgba(255, 107, 74, 0.12);
    color: #ffffff;
    outline: none;
}

.modal-team-search-empty {
    padding: 10px 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
}

.modal-team-search-meta {
    margin-top: 6px;
    min-height: 16px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.03em;
}

.scout-sample-panel {
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(73, 167, 255, 0.16) 0%, rgba(73, 167, 255, 0.04) 40%, rgba(0, 0, 0, 0) 100%),
        linear-gradient(160deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
    padding: 12px 14px;
}

.scout-sample-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.scout-sample-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.scout-sample-toggle input {
    width: 16px;
    height: 16px;
    accent-color: #49a7ff;
}

.scout-sample-summary {
    font-size: 11px;
    color: #d5e8ff;
    letter-spacing: 0.02em;
}

.scout-sample-controls {
    margin-top: 10px;
}

.scout-sample-thresholds {
    margin-bottom: 10px;
    font-size: 11px;
    color: #e4efff;
    letter-spacing: 0.02em;
}

.scout-sample-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.scout-sample-card {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 9px;
    background: rgba(8, 14, 25, 0.6);
    padding: 10px;
}

.scout-sample-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #f3f7ff;
}

.scout-sample-inline-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #bcdcff;
    cursor: pointer;
}

.scout-sample-inline-toggle input {
    width: 14px;
    height: 14px;
    accent-color: #49a7ff;
}

.scout-sample-list {
    display: grid;
    gap: 6px;
    max-height: 165px;
    overflow-y: auto;
    padding-right: 2px;
}

.scout-sample-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.scout-sample-check {
    width: 14px;
    height: 14px;
    accent-color: #49a7ff;
}

.scout-sample-player-name {
    font-size: 12px;
    font-weight: 600;
    color: #f2f6ff;
}

.scout-sample-player-metric {
    font-size: 11px;
    font-weight: 700;
    color: #8dc7ff;
    white-space: nowrap;
}

.scout-sample-empty {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 8px 4px;
}

@media (max-width: 900px) {
    .scout-sample-grid {
        grid-template-columns: 1fr;
    }
}

#main-content .action-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

#main-content .action-btn {
    border: none;
    color: #ffffff;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

#main-content .action-btn:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32), 0 8px 18px rgba(0, 0, 0, 0.25);
}

#main-content .action-btn-analyze {
    background: linear-gradient(135deg, #ff5f42, #ff8a52);
}

#main-content .action-btn-scout {
    background: linear-gradient(135deg, #3182f6, #49a7ff);
}

#main-content .action-btn-lineups {
    background: linear-gradient(135deg, #23955e, #34b56f);
}

#main-content .metrics-container {
    gap: 10px;
}

#main-content .primary-metrics .metric-card {
    text-align: left;
    min-height: 82px;
    padding: 10px 14px;
}

#main-content .metric-card .metric-icon {
    display: none;
}

#main-content .metric-content {
    justify-content: flex-start;
    gap: 2px;
}

#main-content .metric-label {
    margin-bottom: 0;
    font-size: 13px;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: var(--text-secondary);
}

#main-content .metric-value {
    margin-bottom: 0;
    line-height: 1.08;
}

#main-content .metric-comparison {
    margin-top: 2px;
    line-height: 1.3;
    font-size: 13px;
}

#main-content .metric-header {
    justify-content: flex-start;
    margin-bottom: 6px;
}

#main-content .metric-header .metric-label {
    margin-bottom: 0;
    font-size: 16px;
    letter-spacing: 0.03em;
    font-weight: 700;
}

@media (max-width: 1220px) {
    #main-content .header-top {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    #main-content .team-identity {
        min-height: 72px;
        padding: 10px 12px;
    }

    #main-content .action-controls {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }
}

@media (max-width: 640px) {
    #main-content .filter-controls,
    #main-content .action-controls {
        grid-template-columns: 1fr;
    }

    #main-content .stats-control-board .control-select {
        min-height: 40px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #main-content .dashboard-header {
        margin: 0 0 16px 0;
        border-radius: 10px;
    }

    #main-content .stats-control-board {
        padding: 10px;
        gap: 8px;
    }

    #main-content .action-controls {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    #main-content .action-btn {
        font-size: 12px;
        padding: 8px 10px;
        min-height: 40px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #main-content .action-btn-analyze {
        grid-column: 1 / -1;
    }

    #main-content .team-info h1 {
        font-size: 20px;
    }

    #main-content .filter-controls {
        gap: 8px;
    }
}

/* ============================================
   GAMES UX + CONTRAST REFRESH
   ============================================ */
#main-content .table-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    color: #e6ebf2;
    font-weight: 700;
}

#main-content .games-help-text {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    line-height: 1.35;
    color: #dbe4ef;
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 999px;
    padding: 4px 10px;
    letter-spacing: 0.01em;
}

#main-content .active-league-coverage {
    margin: 10px 0 0;
    padding: 10px 12px;
    border: 1px solid rgba(59, 130, 246, 0.36);
    background: rgba(30, 64, 175, 0.14);
    border-radius: 10px;
}

#main-content .active-league-coverage-main {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
}

#main-content .active-league-coverage-title {
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#main-content .active-league-coverage-count {
    color: #f8fafc;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

#main-content .active-league-coverage-meta,
#main-content .active-league-coverage-empty {
    color: #dbeafe;
    font-size: 12px;
    line-height: 1.35;
}

#main-content .active-league-coverage-teams {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

#main-content .active-league-team-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(96, 165, 250, 0.5);
    background: rgba(59, 130, 246, 0.18);
    color: #dbeafe;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

#main-content .active-league-team-pill-overflow {
    border-style: dashed;
    color: #c7d2fe;
}

#main-content .active-league-opponent-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(52, 211, 153, 0.6);
    background: rgba(16, 185, 129, 0.18);
    color: #a7f3d0;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
}

#main-content .game-links-cell {
    min-width: 220px;
}

#main-content .game-link-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

#main-content .game-link-pill {
    --pill-border: rgba(148, 163, 184, 0.4);
    --pill-surface: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.92));
    --pill-chip-bg: rgba(148, 163, 184, 0.12);
    --pill-chip-color: #e2e8f0;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-height: 34px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    border: 1px solid var(--pill-border);
    background: var(--pill-surface);
    color: #f8fafc;
    font-family: inherit;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 20px rgba(2, 6, 23, 0.2);
    transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
    cursor: pointer;
}

#main-content .game-link-pill:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 14px 26px rgba(2, 6, 23, 0.26);
}

#main-content .game-link-pill-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--pill-chip-bg);
    color: var(--pill-chip-color);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#main-content .game-link-pill-label {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

#main-content .game-link-pill-boxscore {
    --pill-border: rgba(251, 191, 36, 0.55);
    --pill-surface: linear-gradient(135deg, rgba(255, 224, 138, 0.96), rgba(251, 146, 60, 0.94));
    --pill-chip-bg: rgba(255, 248, 220, 0.92);
    --pill-chip-color: #7c2d12;
    color: #311407;
}

#main-content .game-link-pill-boxscore:hover {
    filter: brightness(1.03);
}

#main-content .game-link-pill-opponent {
    --pill-border: rgba(103, 232, 249, 0.5);
    --pill-surface: linear-gradient(135deg, rgba(8, 145, 178, 0.34), rgba(14, 116, 144, 0.5));
    --pill-chip-bg: rgba(236, 254, 255, 0.14);
    --pill-chip-color: #a5f3fc;
    color: #ecfeff;
}

#main-content .game-link-pill-opponent:hover {
    color: #ecfeff;
    filter: brightness(1.06);
}

#main-content .game-link-pill-disabled {
    --pill-border: rgba(100, 116, 139, 0.45);
    --pill-surface: linear-gradient(135deg, rgba(51, 65, 85, 0.72), rgba(30, 41, 59, 0.7));
    --pill-chip-bg: rgba(148, 163, 184, 0.12);
    --pill-chip-color: #cbd5e1;
    color: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
}

#main-content .game-link-pill-disabled:hover {
    transform: none;
    box-shadow: none;
    filter: none;
}

#main-content #refresh-games-btn {
    margin-left: 0 !important;
}

#main-content #games-table td {
    color: #f2f5fb;
}

#main-content #games-table .result-indicator {
    font-weight: 800;
    letter-spacing: 0.02em;
}

#main-content #games-table .game-won .result-indicator {
    color: #86efac;
}

#main-content #games-table .game-lost .result-indicator {
    color: #fca5a5;
}

#main-content #games-table .game-tied .result-indicator {
    color: #fde68a;
}

#main-content #games-table .wl-badge {
    border-radius: 999px;
    width: 28px;
    height: 28px;
    font-size: 12px;
    font-weight: 800;
}

#main-content #games-table .wl-badge.wl-win {
    color: #06210f;
    border-color: #86efac;
    background: #86efac;
}

#main-content #games-table .wl-badge.wl-loss {
    color: #3f0c0c;
    border-color: #fca5a5;
    background: #fca5a5;
}

#main-content #games-table .wl-badge.wl-tie {
    color: #3f2a03;
    border-color: #fde68a;
    background: #fde68a;
}

#main-content .game-row {
    border-left: 3px solid transparent;
}

#main-content .game-row:hover {
    transform: none;
    box-shadow: none;
    border-left-color: #ff6b4a;
    background: rgba(255, 107, 74, 0.14) !important;
}

#main-content .game-row.game-excluded-from-stats {
    opacity: 1;
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.09);
}

#main-content .game-row.game-excluded-from-stats td:first-child,
#main-content .game-row.game-excluded-from-stats td:nth-child(2) {
    text-decoration: none;
}

#main-content .game-actions {
    display: grid;
    grid-template-columns: minmax(118px, 1fr) 84px 92px;
    align-items: center;
    justify-content: end;
    gap: 6px;
    min-width: 310px;
}

#main-content .game-actions .stats-exclusion-badge {
    grid-column: 1 / -1;
    justify-self: end;
    color: #1f2937;
    background: #fcd34d;
    border-color: #fde68a;
    font-weight: 800;
}

#main-content .btn-toggle-game-stats,
#main-content .btn-edit-game,
#main-content .btn-delete-game {
    min-height: 32px;
    border-radius: 8px;
    border-width: 1px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

#main-content .btn-toggle-game-stats {
    color: #141414;
    background: #fb923c;
    border-color: #fdba74;
}

#main-content .btn-toggle-game-stats:hover {
    background: #fdba74;
}

#main-content .btn-toggle-game-stats.is-excluded {
    color: #072013;
    background: #4ade80;
    border-color: #86efac;
}

#main-content .btn-toggle-game-stats.is-excluded:hover {
    background: #86efac;
}

#main-content .btn-edit-game {
    color: #172554;
    background: #dbeafe;
    border-color: #93c5fd;
}

#main-content .btn-edit-game:hover {
    color: #172554;
    background: #bfdbfe;
}

#main-content .btn-delete-game {
    color: #7f1d1d;
    background: #fee2e2;
    border-color: #fca5a5;
}

#main-content .btn-delete-game:hover {
    color: #7f1d1d;
    background: #fecaca;
}

#main-content .btn-toggle-game-stats:focus-visible,
#main-content .btn-edit-game:focus-visible,
#main-content .btn-delete-game:focus-visible,
#main-content .game-link-pill:focus-visible {
    outline: 2px solid #f8fafc;
    outline-offset: 2px;
}

.toast-notification {
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
    border-radius: 10px;
    box-shadow: 0 14px 28px rgba(2, 6, 23, 0.45);
}

.toast-notification .toast-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
}

.toast-notification.error {
    background: #3f1117;
    color: #ffe4e6;
    border-color: #fb7185;
}

.toast-notification.error .toast-label {
    background: rgba(251, 113, 133, 0.22);
    color: #ffe4e6;
}

.toast-notification.info {
    background: #10233f;
    color: #e0efff;
    border-color: #60a5fa;
}

.toast-notification.info .toast-label {
    background: rgba(96, 165, 250, 0.22);
    color: #e0efff;
}

.toast-notification.success .toast-label {
    background: rgba(74, 222, 128, 0.25);
    color: #dcfce7;
}

@media (max-width: 768px) {
    #main-content #games-table th:nth-child(8),
    #main-content #games-table td:nth-child(8) {
        display: table-cell;
    }

    #main-content .active-league-coverage {
        padding: 9px 10px;
    }

    #main-content .active-league-coverage-main {
        gap: 4px 8px;
    }

    #main-content .active-league-opponent-badge {
        margin-left: 6px;
        font-size: 9px;
        padding: 2px 6px;
    }

    #main-content .games-help-text {
        width: 100%;
        border-radius: 10px;
    }

    #main-content .game-links-cell {
        min-width: 190px;
    }

    #main-content .game-link-pills {
        justify-content: flex-start;
    }

    #main-content .game-link-pill {
        width: 100%;
    }

    #main-content .game-actions {
        grid-template-columns: 1fr;
        min-width: 150px;
    }

    #main-content .game-actions .stats-exclusion-badge {
        justify-self: start;
    }

    #main-content .btn-toggle-game-stats,
    #main-content .btn-edit-game,
    #main-content .btn-delete-game {
        width: 100%;
    }
}

/* ============================================
   BULK SCOUTING MODAL
   ============================================ */

#main-content .action-btn-bulk-scout {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

.bulk-scout-modal-content {
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
}

.bulk-scout-section {
    margin-bottom: 18px;
}

.bulk-scout-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    letter-spacing: 0.02em;
}

.bulk-scout-input-readonly {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13px;
    box-sizing: border-box;
}

.bulk-scout-team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.bulk-scout-team-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.bulk-scout-chip-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}

.bulk-scout-chip-btn:hover {
    background: var(--bg-base);
    border-color: var(--text-secondary);
}

.bulk-scout-count-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.bulk-scout-count-active {
    color: #a78bfa;
    border-color: rgba(124, 58, 237, 0.35);
    background: rgba(124, 58, 237, 0.1);
}

.bulk-scout-checklist {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elevated);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bulk-scout-checklist::-webkit-scrollbar {
    width: 6px;
}

.bulk-scout-checklist::-webkit-scrollbar-track {
    background: transparent;
}

.bulk-scout-checklist::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.bulk-scout-team-row {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px 6px;
    border-radius: 4px;
    transition: background 0.12s;
    gap: 8px;
}

.bulk-scout-team-row:hover {
    background: var(--bg-base);
}

.bulk-scout-team-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #7c3aed;
    flex-shrink: 0;
}

.bulk-scout-team-name {
    font-size: 13px;
    color: var(--text-primary);
}

.bulk-scout-avail-panel {
    padding: 14px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.bulk-scout-avail-note {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding: 6px 10px;
    background: rgba(124, 58, 237, 0.06);
    border-left: 3px solid #7c3aed;
    border-radius: 0 4px 4px 0;
    line-height: 1.4;
}

.bulk-scout-mode-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.bulk-scout-mode-toggle {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-elevated);
}

.bulk-scout-mode-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    transition: background 0.15s;
}

.bulk-scout-mode-option:hover {
    background: var(--bg-base);
}

.bulk-scout-mode-option input[type="radio"] {
    accent-color: #7c3aed;
}

.bulk-scout-limits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.bulk-scout-limit-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 11px;
}

.bulk-scout-limit-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13px;
    box-sizing: border-box;
}

.bulk-scout-limit-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.bulk-scout-day-limits {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.bulk-scout-day-limit-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bulk-scout-day-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 44px;
}

.bulk-scout-progress {
    margin-bottom: 16px;
}

.bulk-scout-progress-bar-bg {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.bulk-scout-progress-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 2px;
    animation: bulkScoutPulse 1.5s ease-in-out infinite;
}

@keyframes bulkScoutPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.bulk-scout-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.bulk-scout-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.bulk-scout-btn-cancel {
    padding: 9px 18px;
    border: 1px solid var(--border);
    background: var(--bg-base);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
}

.bulk-scout-btn-cancel:hover {
    background: var(--bg-elevated);
}

.bulk-scout-btn-generate {
    padding: 9px 22px;
    border: none;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: opacity 0.15s, transform 0.1s;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

.bulk-scout-btn-generate:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.bulk-scout-btn-generate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 600px) {
    .bulk-scout-modal-content {
        max-width: 95vw;
        margin: 10px;
    }

    .bulk-scout-team-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .bulk-scout-mode-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .bulk-scout-limits-grid {
        grid-template-columns: 1fr;
    }

    .bulk-scout-actions {
        flex-direction: column;
    }

    .bulk-scout-btn-cancel,
    .bulk-scout-btn-generate {
        width: 100%;
        text-align: center;
    }
}
