
/* ==========================================================================
   1. VARIABLES & RESET
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --dark-900: #101012;
    --dark-800: #1a1a1c;
    --dark-600: #484c52;
    --text-900: #ffffff;
    --text-800: #8a8f98;
    --text-700: #797b81;
    --rating-9: #186a3b;
    --rating-8: #28b463;
    --rating-7: #f4d03f;
    --rating-6: #f39c12;
    --rating-5: #e74c3c;
    
    --font-family: "Google Sans Flex", sans-serif;
    
    --max-width: 1064px;
    --sidebar-width: 220px;
    --gap-layout: 40px;

    --border-radius: 6px;
}

/* ==========================================================================
   2. BASE TYPOGRAPHY & LAYOUT
   ========================================================================== */
body {
    background-color: var(--dark-900);
    color: var(--text-900);
    font-family: var(--font-family);
    font-optical-sizing: auto;
    font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0, "ROND" 0;
    line-height: 1.5;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

h1, h2, h3 {
    font-weight: 700;
    line-height: 1.2;
}

/* Page Scaffolding */
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 40px 20px;
    display: flex;
    gap: 76px;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.section-title {
    margin-bottom: 20px;
    font-size: inherit;
    font-weight: 300;
    color: var(--text-800);
}

.section-header {
    font-weight: 400;
    text-transform: uppercase;
    padding: 0 0 5px 15px;
}

.empty-state, .empty-text {
    padding: 20px;
    text-align: center;
    color: var(--text-800);
    font-size: 13px;
}

/* ==========================================================================
   3. TOPBAR & NAVIGATION
   ========================================================================== */
.topbar {
    width: 100%;
    padding: 10px 0;
    background-color: var(--dark-900);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    position: relative;
}

/* Branding */
.branding {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 22px;
}

.logo-link svg {
    position: relative;
    top: -1px;
}

/* Toggle Buttons */
.mobile-menu-btn,
.mobile-search-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-900);
    font-size: 24px;
    cursor: pointer;
    padding: 8px; /* Consistent touch target */
}

/* Desktop Search */
.search-container {
    flex: 1; 
    display: flex;
    justify-content: center;
    position: relative;
    max-width: 400px;
    margin-left: auto; /* Push to right in available space */
}

.search-form {
    width: 100%;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    background-color: var(--dark-800);
    border: 1px solid transparent;
    border-radius: 99px;
    padding: 8px 16px 8px 36px;
    color: var(--text-900);
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s;
    font-size: 16px;
}

.search-input:focus {
    border-color: var(--text-800);
}

.search-input::placeholder {
    color: var(--text-700);
}

.search-icon-inside {
    position: absolute;
    left: 12px;
    color: var(--text-800);
    font-size: 16px;
    pointer-events: none;
}

/* Desktop Dropdown Styles */
.search-dropdown-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--dark-800);
    border: 1px solid var(--dark-700);
    border-radius: 0 0 6px 6px;
    margin-top: 4px;
    z-index: 60;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-900);
    border-bottom: 1px solid var(--dark-700);
    transition: background 0.15s;
}

.search-result-item:hover {
    background-color: var(--dark-700);
}

.search-result-item:last-child {
    border-bottom: none;
}

.result-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--dark-800);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.result-name {
    font-size: 14px;
    font-weight: 600;
}
.result-sub {
    font-size: 11px;
    color: var(--text-800);
}

.result-type-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--dark-800);
    color: var(--text-800);
    border-radius: 4px;
    text-transform: uppercase;
}

/* Mobile Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--dark-900); 
    z-index: 1000;
    display: none; 
    flex-direction: column;
    padding: 15px;
    padding-right: 5px;
}

.search-overlay.active {
    display: flex;
}

.search-overlay-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    gap: 5px;
}

.search-form-overlay {
    flex-grow: 1;
}

.overlay-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.overlay-search-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border-radius: 6px;
    border: none;
    background: var(--dark-800);
    color: var(--text-900);
    font-size: 16px;
    outline: none;
}

.overlay-search-input:focus {
    border-color: var(--dark-600);
}

.overlay-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-800);
    font-size: 18px;
}

.close-overlay-btn {
    background: none;
    border: none;
    color: var(--text-800);
    font-size: 28px;
    cursor: pointer;
    padding: 4px;
}

.close-overlay-btn:hover {
    color: var(--text-900);
}

.search-overlay-content {
    flex-grow: 1;
    overflow-y: auto;
}

/* Mobile Search Results */
.search-results-mobile {
    padding-right: 10px;
}
.search-results-mobile h4 {
    font-size: 14px;
    color: var(--text-800);
    margin-bottom: 12px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.search-results-mobile ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.search-results-mobile li, .search-results-mobile li a {
    margin-bottom: 2px;
}
.search-results-mobile li a {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--dark-800);
    border-radius: 4px;
    border-bottom: none;
    text-decoration: none;
    color: var(--text-900);
    font-size: 15px;
    transition: background 0.2s;
    border: 1px solid transparent; 
}
.search-results-mobile .result-type {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-700);
}


/* ==========================================================================
   4. SIDEBAR
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    margin-top: 85px;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-title {
    font-size: 15px;
    color: var(--dark-600);
    margin-bottom: 10px;
    font-weight: 300;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    color: var(--text-800);
    font-weight: 500;
    font-size: 15px;
}

.nav-link > svg {
    margin-right: 4px;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-900);
}

.nav-link.active {
    font-weight: 500;
}

.team-rating-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    font-weight: 700;
    font-size: 15px;
}


/* ==========================================================================
   5. MATCH & PLAYER LISTS (CARDS)
   ========================================================================== */

/* Player Row (Used in Lists) */
.player-row-wrapper {
    display: flex;
    align-items: stretch;
    margin-bottom: 8px;
    gap: 6px;
}

.player-info-card {
    flex: 1;
    background-color: var(--dark-800);
    border-radius: 4px;
    padding: 2px 6px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.player-info-card:hover {
    background-color: var(--dark-900);
}

/* Player Row Columns */
.face-col {
    width: 40px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}
.player-face-img, .player-face-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--dark-800);
}
.player-face-placeholder {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2352525b" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>');
    background-size: 20px;
    background-repeat: no-repeat;
    background-position: center;
}

.club-col, .league-col {
    width: 30px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-800);
}
.club-placeholder-icon, .league-placeholder-icon {
    font-size: 16px;
    opacity: 0.5;
}

.info-col {
    flex: 1;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.player-name {
    font-weight: 500;
    color: var(--text-900);
}

/* Match Grid & Cards */
.match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.match-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.match-card {
    border-radius: 4px;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    background-color: var(--dark-800);
    transition: transform 0.2s, background-color 0.2s;
}

.match-card:hover {
    transform: translateY(-2px);
    background-color: var(--dark-900);
    border-color: var(--dark-700);
}

.match-date {
    font-size: 14px;
    color: var(--text-700);
    font-weight: 400;
    padding-bottom: 10px;
    padding-left: 3px;
}

.match-teams-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.match-team-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-badge {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

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

.team-name.current-team {
    color: var(--text-900);
}

.team-score {
    font-weight: 700;
    color: var(--text-900);
    width: 24px;
    text-align: center;
}

.score-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avg-rating {
    font-weight: 700;
    color: var(484c52);
    width: 36px;
    text-align: center;
}


/* ==========================================================================
   6. HEATMAP COMPONENTS
   ========================================================================== */

.heatmap-container {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: 6px;
}

/* Unified Heatmap Box */
.heatmap-box {
    width: 48px;
    height: auto;
    min-height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-900);
    background-color: var(--dark-800);
    flex-shrink: 0;
    position: relative;
    text-decoration: none;
}


/* Indicators */
.icon-sub {
    font-size: 10px;
    position: absolute;
    bottom: -1px;
    right: 2px;
}
.icon-goal {
    position: absolute;
    top: 5px;
    right: 3px;
    line-height: 0;
    font-size: 20px;
    letter-spacing: -2px;
}

/* Transfer Separator */
.heatmap-box.transfer-separator {
    background-color: transparent;
    min-width: 48px;
    gap: 0;
    cursor: default;
    width: 102px;
}
.transfer-content {
    display: flex;
    align-items: center;
    gap: 4px;
}
.transfer-side {
    display: flex;
    align-items: center;
    gap: 1px;
}
.transfer-arrow {
    color: var(--dark-600);
    font-size: 16px;
}
.transfer-badge {
    width: 20px;
    height: 20px;
    object-fit: contain;
}
.transfer-divider {
    width: 2px;
    height: 12px;
    background-color: var(--dark-600);
    margin: 0 4px;
}

/* ==========================================================================
   7. PAGE: MATCH DETAIL
   ========================================================================== */
.match-summary-card {
    text-align: center;
    margin-bottom: 40px;
}

.match-meta {
    color: var(--text-800);
    text-transform: uppercase;
    font-size: 14px;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.scoreboard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.team-display {
    flex: 1;
    font-size: 32px;
    font-weight: 800;
}
.team-display.right-align { text-align: right; }
.team-display.left-align { text-align: left; }

.score-display {
    display: flex;
    gap: 6px;
    font-size: 32px;
    font-weight: 800;
}
.score-display span {
    background-color: var(--dark-800);
    border-radius: 8px;
    width: 48px;
}

/* Versus Grid Layout */
.match-stats-grid {
    display: flex;
    gap: 6px;
}
.team-column {
    flex-basis: 50%;
    min-width: 0;
}
.team-column-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--dark-800);
}

/* Roster Divider */
.match-roster-divider {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-800);
    margin: 24px 0 12px 0;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-align: center;
    border-top: 1px solid var(--dark-800);
    padding-top: 12px;
}

/* Versus Row Layouts */
.layout-home-versus .flag {
    margin-right: 0;
    margin-left: 6px; /* Consistency */
}

.layout-away-versus {
    flex-direction: row-reverse; 
    justify-content: flex-end; 
}
.layout-away-versus .player-info-card {
    flex-direction: row-reverse;
}
.layout-away-versus .info-col {
    flex-direction: row-reverse;
}
.layout-away-versus .flag {
    margin-left: 0 !important;
    margin-right: 6px;
}


/* ==========================================================================
   8. PAGE: TEAM & TOURNAMENT
   ========================================================================== */
.entity-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.player-list-section {
    margin-bottom: 80px;
}

.section-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-right: 0;
}

.heatmap-header-container {
    display: flex;
    gap: 6px;
    padding-right: 0; 
}

.heatmap-col-header {
    width: 48px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
    padding-top: 4px;
}

.heatmap-col-header .match-date {
    font-size: 12px;
    color: var(--text-700);
    margin-bottom: 4px;
    padding: 0;
}

.match-result-block {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 4px;
}

.match-result-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 500;
}

.team-rating-val {
    font-size: 1rem;
    font-weight: 800;
    padding-bottom: 4px;
}

.heatmap-col-header-empty {
    width: 32px; 
    flex-shrink: 0;
}

/* ==========================================================================
   9. PAGE: PLAYER DETAIL
   ========================================================================== */
/* Header */
.player-header-container {
    display: flex;
    align-items: center;
    gap: 20px;
}
.player-header-photo img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--dark-800);
}
.player-header-info h1 {
    margin: 0;
    font-size: 28px;
}
.player-header-team {
    color: var(--text-800);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

/* Steam Reviews */
.steam-reviews-container {
    margin-top: 20px;
}
.steam-review-row {
    margin-bottom: 2px;
}
.review-label {
    color: var(--text-800);
    font-weight: 300;
}
.review-verdict {
    margin-left: 5px;
    margin-right: 6px;
}
.review-verdict.no-data {
    color: var(484c52);
    font-weight: 300;
}
.review-verdict:hover {
    text-decoration: underline;
    cursor: default;
}

/* Rating Distribution */
.rating-distribution-container {
    margin: 30px 0 40px 0;
    width: 100%;
}
.distribution-guides {
    display: flex;
    width: 100%;
    margin-bottom: 6px;
    align-items: flex-end;
}
.guide-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}
.guide-text {
    font-size: 12px;
    line-height: 1;
    margin-bottom: 8px;
    font-weight: 600;
    position: relative;
}
.guide-text:after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 5px;
    background-color: var(484c52);
}
.guide-brace {
    width: calc(100% - 20px);
    border-top: 1px solid var(484c52);
}
.distribution-row.reference {
    opacity: 0.3;
}
.distribution-bar {
    display: flex;
    width: 100%;
    height: 16px;
    border-radius: 4px;
    overflow: hidden;
}
.segment { 
    height: 100%; 
    transition: width 0.4s ease; 
    background-color: var(--dark-800);
    color: var(--text-800);
    font-size: 11px;
    text-align: center;
    font-weight: 700;
}

/* Heatmap View Switcher */
.view-switcher-dropdown {
    position: relative;
    display: inline-block;
}
.switcher-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--dark-800);
    border: 1px solid var(--text-800);
    color: var(--text-900);
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.switcher-btn:hover { background: var(--dark-800); }
.switcher-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    background: var(--dark-800);
    border-radius: var(--border-radius);
    min-width: 140px;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    overflow: hidden;
}
.switcher-option {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-800);
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}
.switcher-option:hover {
    background: var(--dark-800);
    color: var(--text-900);
}
.switcher-option.active {
    color: var(--text-900);
    font-weight: 600;
    background: var(--dark-800);
}

/* Full Grid View */
.heatmap-flex-grid {
    display: flex;
    flex-wrap: wrap; 
    gap: 6px;
}
.history-rating {
    cursor: pointer;
    transition: transform 0.1s;
}
.history-rating:hover {
    transform: scale(1.05);
}

/* History List (Cards Implementation) */
.match-history-list {
    margin-top: 1rem;
}
.history-cards-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-history-card {
    display: flex;
    background-color: var(--dark-800);
    border-radius: 4px;
    padding: 12px 16px;
    align-items: center;
    transition: background-color 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
    color: inherit;
}
.match-history-card:hover {
    transform: translateY(-1px);
}

.match-info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.match-date-mini {
    font-size: 11px;
    color: var(--text-800);
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 8px;
}

/* Reuse structure from match grid but simpler */
.match-history-card .match-teams-list {
    display: flex;
    flex-direction: column;
    gap: 4px; 
}

.player-stat-section {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-left: 20px;
    margin-left: 20px;
    border-left: 1px solid var(--text-800);
    justify-content: flex-end;
    min-width: 200px; 
}

.player-stat-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    line-height: 1.2;
}
.stat-status {
    font-size: 13px;
    color: var(--text-800);
    font-weight: 500;
}
.stat-mins {
    font-size: 11px;
    color: var(--text-800);
}


/* ==========================================================================
   10. UTILITIES & COLORS
   ========================================================================== */

/* Flags */
.flag {
    background: url(https://cdn.football-graph.com/static/images_flags_responsive_custom.png) no-repeat;
    background-size: 100%;
    width: 18px;
    height: 12px;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    border-radius: 2px;
}

/* Rating Color Classes */
.rating-9       { background-color: var(--rating-9); color: var(--text-900); }
.rating-8       { background-color: var(--rating-8); color: var(--dark-900); }
.rating-7       { background-color: var(--rating-7); color: var(--dark-900); }
.rating-6       { background-color: var(--rating-6); color: var(--dark-900); }
.rating-5       { background-color: var(--rating-5); color: var(--dark-900); }
.rating-none    { background-color: var(--dark-800); color: var(--text-800); }

.heatmap-box.rating-injured { 
    background-color: var(--dark-800);
    color: var(--text-800);
    font-size: 18px;
    font-weight: 900;
}

.heatmap-box.rating-bench,
.heatmap-box.rating-suspended,
.heatmap-box.rating-none {
    background-color: var(--dark-800);
    color: var(--text-800);
    font-size: 12px;
}
.heatmap-box.rating-suspended {
    color: var(--rating-5);
}

.text-rating-9  { color: var(--rating-9); }
.text-rating-8  { color: var(--rating-8); }
.text-rating-7  { color: var(--rating-7); }
.text-rating-6  { color: var(--rating-6); }
.text-rating-5  { color: var(--rating-5); }

.segment.r9     { background-color: var(--rating-9); }
.segment.r8     { background-color: var(--rating-8); }
.segment.r7     { background-color: var(--rating-7); }
.segment.r6     { background-color: var(--rating-6); }
.segment.r5     { background-color: var(--rating-5); }

.segment.injured        { border-left: 2px solid var(--dark-900); }
.segment.suspended      { border-left: 2px solid var(--dark-900); color: var(--rating-5); font-size: 10px; }
.segment.bench          { border-left: 2px solid var(--dark-900); }
.segment.not_in_squad   { border-left: 2px solid var(--dark-900); }



/* ==========================================================================
   11. MEDIA QUERIES
   ========================================================================== */

/* Tablet & Mobile (Max 768px) */
@media (max-width: 768px) {
    /* Scaffolding */
    .app-container {
        flex-direction: column;
        gap: 20px;
        padding: 0 10px 40px 10px;
    }
    .topbar-inner {
        padding: 0 10px;
        justify-content: center; /* Center logo */
    }
    .nav-link {
        font-size: 16px; 
        padding: 6px 0;
    }

    /* Sidebar Drawer */
    .sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        background-color: var(--dark-900);
        z-index: 2000;
        margin-top: 0;
        padding-top: 20px;
        padding-left: 20px;
        padding-right: 20px;
        border-right: 1px solid var(--text-700);
        overflow-y: auto;
        box-shadow: 4px 0 15px rgba(0,0,0,0.5);
    }
    .sidebar.open {
        display: block;
        animation: slideInSidebar 0.2s ease-out;
    }

    /* Topbar Elements */
    .desktop-search { display: none; }
    .mobile-menu-btn { 
        display: block; 
        position: absolute; left: 10px;
    }
    .mobile-search-btn { 
        display: block; 
        position: absolute; right: 10px;
    }
    .branding {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    /* Player Row Compact */
    .rank-col, 
    .club-col, 
    .league-col,
    .current-rating,
    .face-col,
    .info-col .flag {
        display: none !important;
    }
    
    .player-row-wrapper {
        gap: 4px;
    }
    
    .player-info-card {
        padding: 2px 4px;
    }

    /* Info Col Adjustments */
    .info-col {
        padding: 0 4px;
        display: block; 
    }
    
    /* Heatmap on Mobile */
    .heatmap-container {
        flex: 0 0 auto;
        max-width: 50%; 
        overflow: hidden; 
        justify-content: flex-end; 
        overflow: visible; 
    }
    
    .heatmap-box {
        flex-shrink: 0;
    }

    /* Scoreboard */
    .scoreboard { gap: 10px; }
    .team-display { font-size: 16px; }
    .score-display { font-size: 24px; padding: 5px 15px; }

    /* Match Detail Versus specific override */
    .layout-home-versus .info-col .flag,
    .layout-away-versus .info-col .flag {
        display: inline-block !important; 
    }
    .layout-home-versus .info-col {
        flex-direction: row;
        justify-content: flex-start;
    }

    /* Heatmap Headers */
    .heatmap-header-container {
        align-self: flex-end;
        max-width: 50%;
        justify-content: flex-end;
        overflow: hidden;
    }
    .heatmap-col-header-empty {
         display: none;
    }
}

/* Max 600px (History Cards) */
@media (max-width: 600px) {
    .match-history-card {
        flex-direction: column;
        align-items: stretch;
    }
    .player-stat-section {
        border-left: none;
        border-top: 1px solid var(--text-700);
        padding-left: 0;
        margin-left: 0;
        margin-top: 12px;
        padding-top: 12px;
        justify-content: space-between;
    }
    .player-stat-info {
        align-items: flex-start;
        text-align: left;
        flex-direction: row;
        gap: 8px;
        align-items: center;
    }
}

/* Small Mobile (480px) */
@media (max-width: 480px) {
    .heatmap-container .heatmap-box:not(:nth-last-child(-n+4)),
    .heatmap-header-container .heatmap-col-header:not(:nth-last-child(-n+4)) {
        display: none;
    }
    .heatmap-box, .heatmap-col-header {
        width: 42px;
    }
}

/* Very Small Mobile (360px) */
@media (max-width: 360px) {
    .heatmap-container .heatmap-box:not(:nth-last-child(-n+3)),
    .heatmap-header-container .heatmap-col-header:not(:nth-last-child(-n+3)) {
        display: none;
    }
}

@keyframes slideInSidebar {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* FLAG POSITIONS */
.flag-ad { background-position: 0 0.406504%; }
.flag-ae { background-position: 0 0.813008%; }
.flag-af { background-position: 0 1.219512%; }
.flag-ag { background-position: 0 1.626016%; }
.flag-ai { background-position: 0 2.03252%; }
.flag-al { background-position: 0 2.439024%; }
.flag-am { background-position: 0 2.845528%; }
.flag-an { background-position: 0 3.252032%; }
.flag-ao { background-position: 0 3.658536%; }
.flag-aq { background-position: 0 4.06504%; }
.flag-ar { background-position: 0 4.471544%; }
.flag-as { background-position: 0 4.878048%; }
.flag-at { background-position: 0 5.284552%; }
.flag-au { background-position: 0 5.691056%; }
.flag-aw { background-position: 0 6.09756%; }
.flag-az { background-position: 0 6.504064%; }
.flag-ba { background-position: 0 6.910568%; }
.flag-bb { background-position: 0 7.317072%; }
.flag-bd { background-position: 0 7.723576%; }
.flag-be { background-position: 0 8.13008%; }
.flag-bf { background-position: 0 8.536584%; }
.flag-bg { background-position: 0 8.943088%; }
.flag-bh { background-position: 0 9.349592%; }
.flag-bi { background-position: 0 9.756096%; }
.flag-bj { background-position: 0 10.1626%; }
.flag-bm { background-position: 0 10.569104%; }
.flag-bn { background-position: 0 10.975608%; }
.flag-bo { background-position: 0 11.382112%; }
.flag-br { background-position: 0 11.788616%; }
.flag-bs { background-position: 0 12.19512%; }
.flag-bt { background-position: 0 12.601624%; }
.flag-bv { background-position: 0 13.008128%; }
.flag-bw { background-position: 0 13.414632%; }
.flag-by { background-position: 0 13.821136%; }
.flag-bz { background-position: 0 14.22764%; }
.flag-ca { background-position: 0 14.634144%; }
.flag-cc { background-position: 0 15.040648%; }
.flag-cd { background-position: 0 15.447152%; }
.flag-cf { background-position: 0 15.853656%; }
.flag-cg { background-position: 0 16.26016%; }
.flag-ch { background-position: 0 16.666664%; }
.flag-ci { background-position: 0 17.073168%; }
.flag-ck { background-position: 0 17.479672%; }
.flag-cl { background-position: 0 17.886176%; }
.flag-cm { background-position: 0 18.29268%; }
.flag-cn { background-position: 0 18.699184%; }
.flag-co { background-position: 0 19.105688%; }
.flag-cr { background-position: 0 19.512192%; }
.flag-cu { background-position: 0 19.918696%; }
.flag-cv { background-position: 0 20.3252%; }
.flag-cx { background-position: 0 20.731704%; }
.flag-cy { background-position: 0 21.138208%; }
.flag-cz { background-position: 0 21.544712%; }
.flag-de { background-position: 0 21.951216%; }
.flag-dj { background-position: 0 22.35772%; }
.flag-dk { background-position: 0 22.764224%; }
.flag-dm { background-position: 0 23.170728%; }
.flag-do { background-position: 0 23.577232%; }
.flag-dz { background-position: 0 23.983736%; }
.flag-ec { background-position: 0 24.39024%; }
.flag-ee { background-position: 0 24.796744%; }
.flag-eg { background-position: 0 25.203248%; }
.flag-eh { background-position: 0 25.609752%; }
.flag-er { background-position: 0 26.016256%; }
.flag-es { background-position: 0 26.42276%; }
.flag-et { background-position: 0 26.829264%; }
.flag-fi { background-position: 0 27.235768%; }
.flag-fj { background-position: 0 27.642272%; }
.flag-fk { background-position: 0 28.048776%; }
.flag-fm { background-position: 0 28.45528%; }
.flag-fo { background-position: 0 28.861784%; }
.flag-fr { background-position: 0 29.268288%; }
.flag-ga { background-position: 0 29.674792%; }
.flag-gd { background-position: 0 30.081296%; }
.flag-ge { background-position: 0 30.4878%; }
.flag-gf { background-position: 0 30.894304%; }
.flag-gh { background-position: 0 31.300808%; }
.flag-gi { background-position: 0 31.707312%; }
.flag-gl { background-position: 0 32.113816%; }
.flag-gm { background-position: 0 32.52032%; }
.flag-gn { background-position: 0 32.926824%; }
.flag-gp { background-position: 0 33.333328%; }
.flag-gq { background-position: 0 33.739832%; }
.flag-gr { background-position: 0 34.146336%; }
.flag-gs { background-position: 0 34.55284%; }
.flag-gt { background-position: 0 34.959344%; }
.flag-gu { background-position: 0 35.365848%; }
.flag-gw { background-position: 0 35.772352%; }
.flag-gy { background-position: 0 36.178856%; }
.flag-hk { background-position: 0 36.58536%; }
.flag-hm { background-position: 0 36.991864%; }
.flag-hn { background-position: 0 37.398368%; }
.flag-hr { background-position: 0 37.804872%; }
.flag-ht { background-position: 0 38.211376%; }
.flag-hu { background-position: 0 38.61788%; }
.flag-id { background-position: 0 39.024384%; }
.flag-ie { background-position: 0 39.430888%; }
.flag-il { background-position: 0 39.837392%; }
.flag-in { background-position: 0 40.243896%; }
.flag-io { background-position: 0 40.6504%; }
.flag-iq { background-position: 0 41.056904%; }
.flag-ir { background-position: 0 41.463408%; }
.flag-is { background-position: 0 41.869912%; }
.flag-it { background-position: 0 42.276416%; }
.flag-jm { background-position: 0 42.68292%; }
.flag-jo { background-position: 0 43.089424%; }
.flag-jp { background-position: 0 43.495928%; }
.flag-ke { background-position: 0 43.902432%; }
.flag-kg { background-position: 0 44.308936%; }
.flag-kh { background-position: 0 44.71544%; }
.flag-ki { background-position: 0 45.121944%; }
.flag-km { background-position: 0 45.528448%; }
.flag-kn { background-position: 0 45.934952%; }
.flag-kp { background-position: 0 46.341456%; }
.flag-kr { background-position: 0 46.74796%; }
.flag-kw { background-position: 0 47.154464%; }
.flag-ky { background-position: 0 47.560968%; }
.flag-kz { background-position: 0 47.967472%; }
.flag-la { background-position: 0 48.373976%; }
.flag-lb { background-position: 0 48.78048%; }
.flag-lc { background-position: 0 49.186984%; }
.flag-li { background-position: 0 49.593488%; }
.flag-lk { background-position: 0 49.999992%; }
.flag-lr { background-position: 0 50.406496%; }
.flag-ls { background-position: 0 50.813%; }
.flag-lt { background-position: 0 51.219504%; }
.flag-lu { background-position: 0 51.626008%; }
.flag-lv { background-position: 0 52.032512%; }
.flag-ly { background-position: 0 52.439016%; }
.flag-ma { background-position: 0 52.84552%; }
.flag-mc { background-position: 0 53.252024%; }
.flag-md { background-position: 0 53.658528%; }
.flag-me { background-position: 0 54.065032%; }
.flag-mg { background-position: 0 54.471536%; }
.flag-mh { background-position: 0 54.87804%; }
.flag-mk { background-position: 0 55.284544%; }
.flag-ml { background-position: 0 55.691048%; }
.flag-mm { background-position: 0 56.097552%; }
.flag-mn { background-position: 0 56.504056%; }
.flag-mo { background-position: 0 56.91056%; }
.flag-mp { background-position: 0 57.317064%; }
.flag-mq { background-position: 0 57.723568%; }
.flag-mr { background-position: 0 58.130072%; }
.flag-ms { background-position: 0 58.536576%; }
.flag-mt { background-position: 0 58.94308%; }
.flag-mu { background-position: 0 59.349584%; }
.flag-mv { background-position: 0 59.756088%; }
.flag-mw { background-position: 0 60.162592%; }
.flag-mx { background-position: 0 60.569096%; }
.flag-my { background-position: 0 60.9756%; }
.flag-mz { background-position: 0 61.382104%; }
.flag-na { background-position: 0 61.788608%; }
.flag-nc { background-position: 0 62.195112%; }
.flag-ne { background-position: 0 62.601616%; }
.flag-nf { background-position: 0 63.00812%; }
.flag-ng { background-position: 0 63.414624%; }
.flag-ni { background-position: 0 63.821128%; }
.flag-nl { background-position: 0 64.227632%; }
.flag-no { background-position: 0 64.634136%; }
.flag-np { background-position: 0 65.04064%; }
.flag-nr { background-position: 0 65.447144%; }
.flag-nu { background-position: 0 65.853648%; }
.flag-nz { background-position: 0 66.260152%; }
.flag-om { background-position: 0 66.666656%; }
.flag-pa { background-position: 0 67.07316%; }
.flag-pe { background-position: 0 67.479664%; }
.flag-pf { background-position: 0 67.886168%; }
.flag-pg { background-position: 0 68.292672%; }
.flag-ph { background-position: 0 68.699176%; }
.flag-pk { background-position: 0 69.10568%; }
.flag-pl { background-position: 0 69.512184%; }
.flag-pm { background-position: 0 69.918688%; }
.flag-pn { background-position: 0 70.325192%; }
.flag-pr { background-position: 0 70.731696%; }
.flag-pt { background-position: 0 71.1382%; }
.flag-pw { background-position: 0 71.544704%; }
.flag-py { background-position: 0 71.951208%; }
.flag-qa { background-position: 0 72.357712%; }
.flag-re { background-position: 0 72.764216%; }
.flag-ro { background-position: 0 73.17072%; }
.flag-rs { background-position: 0 73.577224%; }
.flag-ru { background-position: 0 73.983728%; }
.flag-rw { background-position: 0 74.390232%; }
.flag-sa { background-position: 0 74.796736%; }
.flag-sb { background-position: 0 75.20324%; }
.flag-sc { background-position: 0 75.609744%; }
.flag-sd { background-position: 0 76.016248%; }
.flag-se { background-position: 0 76.422752%; }
.flag-sg { background-position: 0 76.829256%; }
.flag-sh { background-position: 0 77.23576%; }
.flag-si { background-position: 0 77.642264%; }
.flag-sj { background-position: 0 78.048768%; }
.flag-sk { background-position: 0 78.455272%; }
.flag-sl { background-position: 0 78.861776%; }
.flag-sm { background-position: 0 79.26828%; }
.flag-sn { background-position: 0 79.674784%; }
.flag-so { background-position: 0 80.081288%; }
.flag-sr { background-position: 0 80.487792%; }
.flag-ss { background-position: 0 80.894296%; }
.flag-st { background-position: 0 81.3008%; }
.flag-sv { background-position: 0 81.707304%; }
.flag-sy { background-position: 0 82.113808%; }
.flag-sz { background-position: 0 82.520312%; }
.flag-tc { background-position: 0 82.926816%; }
.flag-td { background-position: 0 83.33332%; }
.flag-tf { background-position: 0 83.739824%; }
.flag-tg { background-position: 0 84.146328%; }
.flag-th { background-position: 0 84.552832%; }
.flag-tj { background-position: 0 84.959336%; }
.flag-tk { background-position: 0 85.36584%; }
.flag-tl { background-position: 0 85.772344%; }
.flag-tm { background-position: 0 86.178848%; }
.flag-tn { background-position: 0 86.585352%; }
.flag-to { background-position: 0 86.991856%; }
.flag-tp { background-position: 0 87.39836%; }
.flag-tr { background-position: 0 87.804864%; }
.flag-tt { background-position: 0 88.211368%; }
.flag-tv { background-position: 0 88.617872%; }
.flag-tw { background-position: 0 89.024376%; }
.flag-ty { background-position: 0 89.43088%; }
.flag-tz { background-position: 0 89.837384%; }
.flag-ua { background-position: 0 90.243888%; }
.flag-ug { background-position: 0 90.650392%; }
.flag-gb, .flag-uk { background-position: 0 91.056896%; }
.flag-um { background-position: 0 91.4634%; }
.flag-us { background-position: 0 91.869904%; }
.flag-uy { background-position: 0 92.276408%; }
.flag-uz { background-position: 0 92.682912%; }
.flag-va { background-position: 0 93.089416%; }
.flag-vc { background-position: 0 93.49592%; }
.flag-ve { background-position: 0 93.902424%; }
.flag-vg { background-position: 0 94.308928%; }
.flag-vi { background-position: 0 94.715432%; }
.flag-vn { background-position: 0 95.121936%; }
.flag-vu { background-position: 0 95.52844%; }
.flag-wf { background-position: 0 95.934944%; }
.flag-ws { background-position: 0 96.341448%; }
.flag-ye { background-position: 0 96.747952%; }
.flag-za { background-position: 0 97.154456%; }
.flag-zm { background-position: 0 97.56096%; }
.flag-zr { background-position: 0 97.967464%; }
.flag-zw { background-position: 0 98.373968%; }
.flag-nir { background-position: 0 98.780472%; }
.flag-eng, .flag-en { background-position: 0 99.186976%; }
.flag-wal { background-position: 0 99.59348%; }
.flag-sco { background-position: 0 100.0%; }
