
/* ==========================================================================
   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;
    --rating-4: #953228;
    
    --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 {
    display: flex;
}

.main-content {
    flex: 1;
    min-width: 0;
    max-width: 1300px;
    margin: 0 auto;

    h1 {
        font-size: inherit;
        font-weight: 400;
        color: var(--text-700);
    }
}

.header-content-match {
    margin-top: 30px;
    margin-bottom: 40px;
}

.header-content-index {
    margin-top: 42px;
    margin-bottom: 20px;
}

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

.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;
    display: flex;
    align-items: center;
    height: 50px;
    position: relative;
}

/* Branding */
.branding {

    .sidebar & {
        padding: 19px 55px 18px 45px;
        position: sticky;
        top: 0;
        z-index: 50;
        background: #151517;
    }
}

.topbar-branding {
    display: none;
}

.logo-link {
    font-size: 22px;
    font-weight: 700;
    position: relative;
    color: #ffffffb8;
    -webkit-mask-image: 
        repeating-linear-gradient(130deg, rgb(16 16 18 / 37%) 0 2px, rgb(0 0 0 / 44%) 2px 4px), 
        radial-gradient(closest-side at 50% 50%, rgb(16 16 18) 0 76%, rgba(0, 0, 0, 0) 100%);

    &:after {
        content: "";
        position: absolute;
        inset: -6px -10px -6px -10px;
        pointer-events: none;
        background: linear-gradient(180deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .15));
        clip-path: polygon(11% 44%, 0% 80%, 82% 144%, 48% 100%, 38% 110%);
        mix-blend-mode: multiply;
        opacity: .85;
    }

    .white-theme & {
        color: var(--dark-900);
    }

    .white-theme &:after {
        background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .15));
    }
}

.branding-graph {
    color: #ffffffeb;
    margin-left: .25ch;

    &:after {
        content: "";
        position: absolute;
        inset: -6px -10px -6px -10px;
        pointer-events: none;
        background: linear-gradient(180deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .15));
        clip-path: polygon(64% 74%, 100% 40%, 100% 100%, 54% 100%, 58% 78%);
        mix-blend-mode: multiply;
        opacity: .85;
    }

    .white-theme & {
        color: var(--dark-900);
    }

    .white-theme &:after {
        background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .15));
    }
}



/* 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;
    position: relative;
    max-width: 400px;
}

.search-form {
    width: 100%;
}

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

.search-input {
    width: 100%;
    background-color: var(--dark-800);
    border: 2px solid transparent;
    border-radius: 99px;
    padding: 8px 16px 8px 40px;
    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(--dark-600);
}

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

.search-icon-inside {
    position: absolute;
    left: 15px;
    color: var(--text-800);
    font-size: 17px;
    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: 8px;
    margin-top: 10px;
    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;
}

.result-name {

}

.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 {
    background: #151517;
    border-right: 1px solid var(--dark-800);
}

.sidebar-nav {
    padding: 38px 40px;
    font-size: 15px;
}

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

.nav-title {
    color: var(--text-700);
    margin-bottom: 10px;
    font-weight: 400;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.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: 12px;
    gap: 12px;
}

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

.player-info-card:hover {
    opacity: 0.8;
}

/* 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-summary {
    max-width: 860px;
    margin-bottom: 40px;
}

.match-stats-grid {
    max-width: 860px;
}

.match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.match-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: #151517;
    border: 1px solid var(--dark-800);
    border-radius: var(--border-radius);
    padding: 20px 15px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

@media (min-width: 880px) {
    .match-card-container {
        gap: 20px;
    }
}

.match-card:hover {
    transform: translateY(-2px);
}

.match-card-date {
    text-align: center;
    font-size: 16px;
    font-weight: 400;
    padding-bottom: 30px;
    
    & span {
        display: block;
        color: var(--text-700);
    }

    .match-grid & {
        font-size: 14px;
        padding-bottom: 20px;
    }
}

.tournament-name {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;

    img {
        position: relative;
        top: -1px;
    }
}

.match-details {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    gap: 40px;

    .match-grid & {
        gap: 10px;
    }
}


.team-info {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;

    &.home-side {
        justify-content: flex-end;
    }
}

.team-info.home-side .team-badge-container {
    order: 1;
    margin-left: 4px;
}

.team-info.away-side .team-badge-container {
    margin-right: 4px;
}

.team-badge-container {
    position: relative;
}

.team-badge {
    position: relative;
    z-index: 1;
    width: 36px;
    height: 36px;

    .match-grid & {
        width: 24px;
        height: 24px;
    }
}

.team-name {
    line-height: 1.3;
    font-size: 20px;
    font-weight: 700;

    .match-grid & {
        font-size: 16px;
        font-weight: 500;
    }

    .home-side & {
        text-align: right;
    }
}

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

.team-score {
    font-weight: 700;
    color: var(--text-900);
    width: 54px;
    font-size: 28px;
    margin: 0;
    background: #1e1e20;
    border-radius: 4px;
    position: relative;
    isolation: isolate; /* limita el z-index negativo del hijo solo a este padre */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;


    .match-grid & {
        font-size: 16px;
        width: 36px;
        overflow: hidden;
    }
}

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

    .match-grid & {
        gap: 8px;
        margin-top: -3px;
    }
}

.avg-rating {
    font-weight: 700;
    width: 36px;
    text-align: center;
    position: absolute;
    border-radius: 4px;
    top: -16px;
    font-size: 16px;
    z-index: -1;
    
    .home-rating & {
        left: -29px;
    }

    .away-rating & {
        right: -29px;
    }

    .match-grid & {
        display: none;
    }
}

.rating-bar-container {
    position: absolute;
    bottom: -1px;
    left: 0px;
    right: 0px;
    display: flex;

    .home-rating & {
        justify-content: flex-end;
    }
}

.rating-bar-fill {
    height: 4px;
    transform: skewX(-20deg);
    border-radius: 0px 10px 20px 20px;
    
    .home-rating & {
        transform-origin: left;
        transform: skewX(20deg);
        border-radius: 10px 0px 20px 20px;
    }
}




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

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

/* Unified Heatmap Box */
.heatmap-box {
    width: 54px;
    height: auto;
    min-height: 40px;
    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 */
/* ================================
   Transfer separator (NO GAP)
   ================================ */

.heatmap-box.transfer-separator{
  overflow: hidden;
  background-color: transparent;
}

/* Ahora 2 columnas reales (sin hueco) */
.heatmap-box.transfer-separator .transfer-card{
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;     
      isolation: isolate;
    overflow: hidden;         /* <-- clave */
}

/* Mitades ocupan todo hasta el centro */
.heatmap-box.transfer-separator .team-box{
    position: relative;
    flex: 1 1 50%;
    background-image: var(--team-bg);
    background-repeat: no-repeat;
    background-size: 80% auto;
    z-index: 1;
}


/* Encuadre por lado + el “corte” diagonal llegando al centro */
.heatmap-box.transfer-separator .old-team{
  background-position: 7px 50%;

  &::before {
        content: '‹';
        position: absolute;
        top: 7%;
        left: -1px;
        font-size: 22px;
        color: var(--text-800);
  }
}
.heatmap-box.transfer-separator .new-team{
  background-position: -1px 50%;

    &::before {
        content: '›';
        position: absolute;
        top: 7%;
        right: 0px;
        font-size: 22px;
        color: var(--text-800);
    }
}



/* ==========================================================================
   7. PAGE: MATCH DETAIL
   ========================================================================== */



/* 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;
}

/* Comparison Row (Match Detail: home vs away on same line) */
.comparison-row {
    display: flex;
    align-items: stretch;
    margin-bottom: 12px;
    gap: 12px;
}

.comparison-row .player-info-card {
    min-width: 0;
    position: relative;
    overflow: hidden;
}

.comparison-row .heatmap-box {
    flex-shrink: 0;
}

.heatmap-box-empty {
    background: transparent;
    pointer-events: none;
}

/* Away side: reverse element order via flexbox order */
.comparison-row .home-side .face-col  { order: 3; }
.comparison-row .home-side .club-col  { order: 2; }
.comparison-row .home-side .info-col  { order: 1; }
.comparison-row .home-side .info-col  { flex-direction: row-reverse; }
.comparison-row .home-side .flag      { margin-left: 0; margin-right: 6px; }

/* Empty placeholder when one side has fewer players */
.comparison-row .empty-slot {
    flex: 0 0 calc((100% - 144px) / 2); /* calculamos manualmente el width ya que si no flex no me calcula bien */
    min-width: 0;
    box-sizing: border-box;
}

/* ═══ BARRAS DE RATING (comparison rows) ════*/

.comparison-row .player-info-card:not(.away-side) {
    background: linear-gradient(270deg,
        var(--dark-800) 0%, #29292e var(--bar-pct, 100%),
        var(--dark-800) var(--bar-pct, 100%));
}
.comparison-row .player-info-card.away-side {
    background: linear-gradient(90deg,
        var(--dark-800) 0%, #29292e var(--bar-pct, 100%),
        var(--dark-800) var(--bar-pct, 100%));
}

.played-no {
    opacity: 0.5;
}

a.played-no:hover {
    opacity: 0.4 ;
}



/* ==========================================================================
   8. PAGE: TEAM & TOURNAMENT
   ========================================================================== */

.main-header-team {
    margin: 30px 0 40px;
}

.main-header-tournament {
    margin: 30px 0 40px;    
}

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

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

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

.heatmap-col-header {
    width: 54px; 
    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;
    margin-bottom: 4px;
    padding: 0;
}

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

    &.win {
        color: var(--rating-8);
    }

    &.draw {
        color: var(--rating-7);
    }

    &.loss {
        color: var(--rating-5);
    }
}

.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;
}

/* Month Timeline Bar (Tournament Page) */
.month-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    position: relative; /* Para las etiquetas flotantes */
}

.month-labels {
    position: absolute;
    top: 6px;
    width: calc(54px * 10 + 12px * 9);  /* same total as bar */
}

.month-label {
    position: absolute;
    top: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-800);
    letter-spacing: 0.5px;
    transform: translateX(-50%);
    /* Position using CSS custom property: center of the column */
    left: calc(var(--col-pos) * 66px + 27px);  /* col * (54+12) + 54/2 */
}

.month-bar-container {
    display: flex;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
}

.month-cell {
    width: 66px; /* 54px box + 12px gap */
    flex-shrink: 0;
}

.month-cell:first-child,
.month-cell:last-child {
    width: 60px;
}

.month-cell-solid {
    background-color: var(--dark-800);
}

.month-cell-mixed {
    background: repeating-linear-gradient(90deg, var(--dark-800) 0 3px, transparent 3px 6px);
}

/* Heatmap Legend */
.heatmap-legend {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-800);

    .injured {
        font-weight: 900;
        font-size: 15px;
        line-height: 1;
        position: relative;
        top: 1px;
    }

    .suspended {
        color: var(--rating-5);
    }
}

.heatmap-legend span strong {
    margin-right: 2px;
}

/* ==========================================================================
   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 dashed var(--dark-600);
}
.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: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 12px;
}
.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-low       { background-color: var(--rating-4); 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); }
.text-rating-low  { color: var(--rating-4); }

.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); }

.tooltip-content .match-date {
    font-size: 12px;
    margin-bottom: 4px;
}

.tooltip-content .match-result-row {
    font-size: 12px;
    font-weight: 500;
}

.tooltip-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 5px;
}

/* CORRECTO: Apuntamos a la caja generada por Tippy */
.tippy-box[data-theme~='fg-theme'] {
    top: 15px !important; /* Ajusta según sea necesario */
    background-color: var(--dark-800); /* O el color que quieras (red) */
    color: #ffffff;            /* O el color que quieras (green) */
    
    /* Opcional: Para que se vea más moderno */
    border-radius: 4px;
    font-size: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* IMPORTANTE: Tienes que colorear la flechita también para que coincida con el fondo */
.tippy-box[data-theme~='fg-theme'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: var(--dark-800); /* Mismo color que el background-color de arriba */
}
.tippy-box[data-theme~='fg-theme'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: var(--dark-800);
}
.tippy-box[data-theme~='fg-theme'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: var(--dark-800);
}
.tippy-box[data-theme~='fg-theme'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: var(--dark-800);
}
.tippy-box[data-theme~='fg-theme'] > .tippy-arrow::before {
  transform: scale(.7);
}

/* ==========================================================================
   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;
        justify-content: space-between; /* Center logo */
    }
    .nav-link {
        font-size: 16px; 
        padding: 6px 0;
    }

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

    .main-content {
        margin: 0;
    }

    /* Topbar Elements */
    .desktop-search { display: none; }
    .mobile-menu-btn { 
        display: block; 
    }
    .mobile-search-btn { 
        display: block; 
    }

    .sidebar .sidebar-branding {
        padding: 0 10px 20px;
    }

    .topbar .topbar-branding {
        display: block;
    }

    .sidebar-nav {
        padding: 0 10px;
    }
    
    .player-row-wrapper {
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .player-info-card {
        padding: 6px 4px;
    }

    .face-col {
        width: 24px;
    }

    .player-face-img {
        width: 24px;
        height: 24px;
    }

    /* Info Col Adjustments */
    .info-col {
        padding: 0 0 0 6px;
        display: block; 
    }
    
    /* Heatmap on Mobile */
    .heatmap-container {
        flex: 0 0 auto;
        overflow: hidden; 
        justify-content: flex-end; 
        overflow: visible; 
        gap: 8px;
    }
    
    .heatmap-box {
        flex-shrink: 0;
        min-height: 36px;
    }

    .header-content {
        margin-top: 0;
        margin-bottom: 20px;
    }

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

    .layout-home-versus .info-col {
        flex-direction: row;
        justify-content: flex-start;
    }

    /* Heatmap Headers */
    .heatmap-header-container {
        align-self: flex-end;
        justify-content: flex-end;
        overflow: hidden;
        gap: 8px;
    }
    .heatmap-col-header-empty {
         display: none;
    }

    /* Month Bar */
    .month-cell {
        width: 62px; /* 54px box + 8px gap */
    }
    .month-cell:last-child {
        width: 54px;
    }
    .month-labels {
        width: calc(54px * 10 + 8px * 9);
    }
    .month-label {
        left: calc(var(--col-pos) * 62px + 27px);
    }
}

/* 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;
    }
    /* Player Row Compact */
    .rank-col, 
    .club-col, 
    .league-col,
    .current-rating,
    .info-col .flag {
        display: none !important;
    }
}

/* Small Mobile (480px) */
@media (max-width: 480px) {
    .heatmap-container .heatmap-box:nth-child(n+5),
    .heatmap-header-container .heatmap-col-header:nth-child(n+5) {
        display: none;
    }
    .heatmap-box, .heatmap-col-header {
        width: 42px;
    }
    .heatmap-flex-grid {
        grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
        gap: 8px;
    }

    /* Month Bar */
    .month-bar-wrapper {
        display: none;
    }
}

/* Very Small Mobile (360px) */
@media (max-width: 360px) {
    .heatmap-container .heatmap-box:nth-child(n+4),
    .heatmap-header-container .heatmap-col-header:nth-child(n+4) {
        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%; }


/* Mini Match Info (Player Card) */
.rating-day-wrapper {
    margin-left: 12px;
}

.card-mini-match {
    font-weight: 700;
    font-size: 10px;
    color: var(--text-900);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

/* ==========================================================================
   Player Cards (Home Highlight)
   ========================================================================== */
.player-card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
    margin-bottom: 60px;
}

.player-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--dark-800);
    border-radius: var(--border-radius);
    padding: 35px 23px 25px 20px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;

    &.matchday {
        background: 
            radial-gradient(900px circle at 18% 12%, rgb(24 106 59 / 14%), transparent 60%), 
            radial-gradient(800px circle at 88% 88%, rgb(158 108 182 / 10%), transparent 58%), 
            linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.22) 100%), 
            rgb(26, 26, 28)

    }

    &.month {
        background: 
            radial-gradient(900px circle at 18% 12%, rgb(24 106 59 / 14%), transparent 60%), 
            radial-gradient(800px circle at 88% 88%, rgb(108 159 182 / 10%), transparent 58%), 
            linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.22) 100%), 
            rgb(26, 26, 28)
    }
}

/* 5 columnas cuando quepan */
@media (min-width: 880px) { /* 160*5 + 20*4 = 880 */
  .player-card-container {
    gap: 20px;
  }
}

/* 6 columnas cuando quepan */
@media (min-width: 1100px) { /* 160*6 + 20*5 = 1100 */
  .player-card {
    flex-basis: calc((100% - 100px) / 6);
  }
}

.player-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border-color: var(--text-700);
}

/* Photo Column */
.card-photo-col {
    position: relative;
    align-self: center;
}

.card-player-img {
    width: 68px;
    height: 68px;
    position: relative;
    z-index: 1;
    border-radius: 50%;
    object-fit: cover;
    background: #252526;
    mask-image: radial-gradient(circle at 106% 11%, transparent 19px, black 19px);
    border: 4px solid #252526;
}

.card-team-logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: #252526;
    padding: 5px;
    position: absolute;
    top: -10px;
    left: 56px;
    z-index: 1;
}

/* Info Column */
.card-info-col {
    flex: 1;
    text-align: center;
    margin-top: 8px;
}

.card-player-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-900);
    line-height: 1.3;
}

.card-team-name {
    display: block;
    color: var(--text-700);
    margin-top: 4px;
    font-size: 15px;
    line-height: 1.2;
}




.card-label {
    font-size: 10px;
    text-transform: uppercase;
    line-height: 1.3;
    text-align: center;
    letter-spacing: -0.5px;
    font-weight: 700;
    padding: 3px;
    
    &.gold {
        color: transparent;
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.22), rgba(0,0,0,0)),
            linear-gradient(135deg, #fff3bf 0%, #f2d06b 22%, #b88f32 55%, #ffe08a 78%, #7a5a16 100%);
        -webkit-background-clip: text;
        background-clip: text;
        text-shadow: 0 1px 0 rgba(255,255,255,.12);
        /* color: #382c0a; */
        /* background: linear-gradient(160deg, #eee09d 0%, #b88f32 100%); */
    }

    &.bronze {
        /* color: #3d1f14; */
        /* background: linear-gradient(160deg, #f5dcc7 0%, #bf7e58 100%); */
    }

    &.platinum {
        /* color: #0b2233; */
        /* background: linear-gradient(160deg, #e6f6ff 0%, #6bb7d8 55%, #2c6d8a 100%); */
    }

    &.silver {
        color: transparent;
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.22), rgba(0,0,0,0)),
            linear-gradient(135deg, #f5fcff 0%, #c6e2f0 25%, #7fb7cd 55%, #eaf6ff 78%, #3f6a7c 100%);
        -webkit-background-clip: text;
        background-clip: text;
        text-shadow: 0 1px 0 rgba(255,255,255,.10);
        /* color: #12212a; */
        /* background: linear-gradient(160deg, #f2fbff 0%, #b9d7e6 55%, #6c9fb6 100%); */
    }
}

.card-match-context {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-700);
    display: flex;
}

/* Rating Column */
.card-rating-col {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 20px;
}

/* Response */
@media (max-width: 600px) {
    .player-card { 
        min-height: auto; 
    }
    .card-photo-col { 

    }
    .card-player-name { 
        font-size: 1.2rem; 
    }
}



/* ---------- Banner base ---------- */
.fg-banner{
    position:relative;
    overflow:hidden;
    border-radius:12px;
    padding:25px;
    background:
        radial-gradient(1200px 260px at 20% -40%, rgba(0,0,0,.10), transparent 60%),
        radial-gradient(900px 260px at 110% 120%, rgba(0,0,0,.08), transparent 55%),
        linear-gradient(180deg, rgba(0,0,0,.05), rgba(255,255,255,.02)),
        #101012;
    background: #151517;
    -webkit-mask-image: 
        radial-gradient(closest-side at 50% 50%, rgb(16 16 18) 0 100%, rgba(0, 0, 0, 0) 180%);
}

.fg-banner__bg{
  position:absolute;
  inset:-40px -70px -40px -70px;
  background-image: var(--bg-badge-url);
  background-repeat:no-repeat;
  background-size:520px auto;
  background-position: 58% 45%;
  opacity:.1;
  filter: grayscale(1) contrast(1.25) brightness(1.05);
  transform: rotate(-10deg) scale(1.15);
  will-change: transform;

  -webkit-mask-image:
    repeating-linear-gradient(
      115deg,
      rgba(0,0,0,.95) 0 2px,
      rgba(0,0,0,0) 2px 4px
    ),
    
    radial-gradient(
      closest-side at 55% 50%,
      rgba(0,0,0,.95) 0 66%,
      rgba(0,0,0,0) 74%
    );
  /* -webkit-mask-composite: source-in; */
  -webkit-mask-repeat: repeat, no-repeat;
  -webkit-mask-size: auto, 100% 100%;

  /* fallback si no hay mask */
  clip-path: polygon(
    8% 12%, 28% 8%, 44% 18%, 58% 8%, 82% 14%,
    92% 34%, 80% 52%, 90% 70%, 70% 88%,
    48% 78%, 32% 92%, 16% 76%, 10% 54%, 18% 36%
  );

  .main-header-tournament & {
    transform: none;
    background-size: 266px auto;
    background-position: 25% 2%;
  }
}
 

/* ---------- Contenido ---------- */
.fg-banner__content{
    position:relative;
    z-index:1;
    display:flex;
    gap:15px;

    .main-header-tournament & {
        align-items: center;
        justify-content: center;
    }
}

.fg-banner h1{
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .2px;
    margin: 0 0 2px 0;
}

.fg-banner__badge{
  width:32px;
  height:32px;
}


.fg-banner__rank{
  font-size:14px;
  color: var(--text-700);
  display:flex;
  align-items:center;
  gap:3px;
}

.fg-banner__ranknum{
  letter-spacing:.3px;
}

.fg-banner__trendicon{
    width: 16px;
    height: 16px;
    fill: var(--rating-5);
}

.fg-banner__trendicon--up{
    fill: var(--rating-8);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
    padding: 50px 0 30px;
    margin-top: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--text-800);
    font-size: 14px;
    font-weight: 300;
}

.footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-800);
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text-900);
    opacity: 1;
}

/* ==========================================================================
   LEGAL PAGES
   ========================================================================== */
.legal-body {
    background-color: #f4f4f5;
    color: #18181b;
}

.legal-page-header {
    background: #ffffff;
}

.legal-page-header-inner {
    max-width: 780px;
    margin: 0 auto;
    padding: 16px 24px;
}

.legal-container {
    max-width: 780px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.legal-container h1 {
    margin-bottom: 6px;
    line-height: 1.25;
}

.legal-updated {
    color: #71717a;
    font-size: 14px;
    display: block;
    margin-bottom: 40px;
}

.legal-section {
    background: #ffffff;
    border-radius: 8px;
    padding: 24px 28px;
    margin-bottom: 16px;
}

.legal-section h2 {
    font-size: 14px;
    font-weight: 700;
    color: #18181b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}

.legal-section p {
    font-size: 14px;
    line-height: 1.75;
    color: #3f3f46;
    margin-bottom: 10px;
}

.legal-section ul {
    list-style: disc;
    padding-left: 20px;
    margin-top: 6px;
    margin-bottom: 10px;
}

.legal-section li {
    font-size: 14px;
    line-height: 1.75;
    color: #3f3f46;
    margin-bottom: 4px;
}

.legal-section a {
    color: #16a34a;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-section a:hover {
    color: #15803d;
    opacity: 1;
}

.legal-table-wrapper {
    overflow-x: auto;
    margin: 10px 0;
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.legal-table th {
    text-align: left;
    padding: 8px 12px;
    background: #f4f4f5;
    color: #52525b;
    font-weight: 600;
    border-bottom: 1px solid #e4e4e7;
}

.legal-table td {
    padding: 8px 12px;
    color: #3f3f46;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.legal-table tr:last-child td {
    border-bottom: none;
}

.legal-page-footer {
    background: #ffffff;
    padding: 20px 0;
}

.legal-page-footer-inner {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #71717a;
}

.legal-page-footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.legal-page-footer-links a {
    color: #71717a;
    font-size: 12px;
}

.legal-page-footer-links a:hover {
    color: #18181b;
    opacity: 1;
}

@media (max-width: 600px) {
    .site-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .legal-page-footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .legal-page-footer-links {
        gap: 12px;
    }
    .legal-container {
        padding: 32px 16px 60px;
    }
    .legal-section {
        padding: 18px 16px;
    }
}
