@import url('https://fonts.googleapis.com/css2?family=Audiowide&display=swap');

.team-search-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: #fff;
    border: 1.5px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 6px 24px 0 rgba(0,0,0,0.10);
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
    direction: rtl;
}

/* Flatten search bar bottom corners when dropdown is open */
.search-bar.search-bar--open {
    border-radius: 24px 24px 0 0;
    border-bottom-color: transparent;
}

.team-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    cursor: pointer;
    font-family: 'MosesText', sans-serif;
    font-size: 16px;
    color: #222;
    transition: background 0.15s;
}
.team-search-item.selected,
.team-search-item:hover {
    background: #F5F5F5;
}
.team-search-flag {
    width: 28px;
    height: 20px;
    object-fit: contain;
    border-radius: 3px;
    background: #eee;
    border: 1px solid #e0e0e0;
    margin-inline-start: 2px;
}
.team-search-name {
    flex: 1;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Layout container for sidebar + main content */
.team-content-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    background: linear-gradient(90deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.2) 100%), #03122B
}

.team-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}
/* Sticky about-sidebar */
.about-sidebar {
    position: sticky;
    top: 120px;
    z-index: 10;
}
/* ============================================================
   TeamPage — styles.css
   World Cup 2026 · Team Page
   Design: FIFA WC2026 dark theme
   ============================================================ */

@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-VF.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}

@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Light.otf?v=c4168ce4') format('opentype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Regular.otf?v=9275aca6') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Medium.otf?v=22fa8d06') format('opentype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Bold.otf?v=770b9b85') format('opentype');
    font-weight: 700;
    font-style: normal;
}

/* ── Tokens ─────────────────────────────────────────────── */
:root {
    --bg-dark:      #03122B;
    --bg-darker:    #020916;
    --text-white:   #FFFFFF;
    --text-muted:   #A5ACBB;
    --page-width:   1240px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: #ffffff;
}

body {
    font-family: 'MosesText', -apple-system, sans-serif;
    background-color: #03122B;
    color: var(--text-white);
    direction: rtl;
    min-height: 100vh;
    max-width: var(--page-width);
    margin: 0 auto;
}

/* ── Page Header (same style as GroupStandings) ─────────── */
.page-header {
    user-select: none;
    position: relative;
}

/* Mobile-only sponsor bar */
.header-mobile-sponsor-bar {
    display: none;
    align-items: flex-end;
    justify-content: space-between;
    background: #020916;
    padding: 10px 8px;
    width: 100%;
    box-sizing: border-box;
}
.header-mobile-sponsor-bar__right,
.header-mobile-sponsor-bar__left {
    display: flex;
    align-items: center;
}
.header-mobile-wc-txt  { display: block; height: 20px; width: auto; }
.header-mobile-sponsor-img { display: block; height: 20px; width: auto; border: none; outline: none; }

.header-inner {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    height: 95px;
    overflow: visible;
    background-color: #00182F;
    background-image: url('../assets/images/Teams_bg.png?v=c2059735');
    background-size: cover;
    background-position: center;
    /* clip right overflow (tabs) but allow bottom overflow (trophy hangs below) */
    clip-path: inset(0 0 -200px 0);
}

.header-bg-waves {
    display: none;
}

/* Tab shape — top half (lavender), peeks from right edge */
.header-inner::before {
    content: '';
    position: absolute;
    right: -53px;
    top: 0;
    width: 97px;
    height: 47.5px;
    background: #b4aed5;
    border-radius: 10000px 0 0 0; /* round bottom-left corner */
    pointer-events: none;
    z-index: 2;
}

/* Tab shape — bottom half (purple), peeks from right edge */
.header-inner::after {
    content: '';
    position: absolute;
    right: -53px;
    bottom: 0;
    width: 97px;
    height: 47.5px;
    background: #b089fe;
    border-radius: 10000px 0 0 0; /* round top-left corner */
    pointer-events: none;
    z-index: 2;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 70px 0 130px;
    direction: rtl;
}

/* Remove old pink stripes from ::before on header-content */
.header-content::before {
    display: none;
}

/* Sponsor column — desktop only, physical left (RTL end) */
.header-sponsor-col {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}
.header-sponsor-link {
    display: flex;
}
.header-sponsor-img {
    display: block;
    height: 20px;
    width: auto;
    border: none;
    outline: none;
}
.header-wc-txt {
    display: block;
    width: auto;
}

.header-title {
    font-size: 3.7rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
    line-height: 1;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.header-trophy {
    position: absolute;
    top: 10px;
    left: 20px;
    width: auto;
    object-fit: contain;
    z-index: 10;
}

.search-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    max-width: 1280px;
    margin: 0 auto;
}

.search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1.5px solid #d1d5db;
    border-radius: 24px;
    padding: 8px 16px;
    max-width: 720px;
    transition: border-color 0.2s;
    position: relative;
}

.search-bar:focus-within {
    border-color: #689ABF;
}

.search-icon {
    color: #A5ACBB;
    flex-shrink: 0;
}

#search-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'MosesText', sans-serif;
    font-size: 15px;
    font-weight: 300;
    color: #333;
    direction: rtl;
    background: transparent;
}

#search-input::placeholder {
    color: #A5ACBB;
}

/* ── Team Hero ───────────────────────────────────────────── */
.team-hero {
    background: linear-gradient(90deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.2) 100%), #03122B;
    display: flex;
    /* RTL: first child (stats) = rightmost, last child (content) = leftmost */
    align-items: center;
    justify-content: space-between;
    padding: 60px 50px;
    gap: 0;
    overflow: hidden;
    min-height: 527px;
}

/* Combined name + ball sub-group (leftmost = last in RTL DOM) */
.team-hero__content {
    display: flex;
    align-items: center;
    flex: 1;
    /* RTL: ball (first child) = right, name (second child) = left */
}

/* Name Area — left edge of hero (RTL end) */
.team-hero__name-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
    /* Pull slightly under the ball to create overlap — matches Figma mr-[-20px] */
    margin-inline-start: -70px;
    position: relative;
    z-index: 0;
}

.team-hero__name {
    font-family: 'MosesText', sans-serif;
    font-weight: 700;
    font-size: clamp(50px, 9vw, 118px);
    color: var(--text-white);
    letter-spacing: 5px;
    text-transform: uppercase;
    line-height: 0.87;
    text-align: right;
}

.team-hero__year {
    font-family: 'Audiowide', monospace;
    font-size: clamp(50px, 8vw, 120px);
    letter-spacing: 5px;
    color: transparent;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.45);
    line-height: 1;
    user-select: none;
    align-self: flex-start;
}

.team-hero__accent-line {
    width: 87px;
    height: 6px;
    align-self: flex-start;
    /* Figma: 30px gap between year and accent line (gap-[15px] inside name+year, gap-[30px] to accent) */
    margin-top: 15px;
}

/* Ball — right side of content group, overlapping the name */
.team-hero__flag-area {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    margin-inline-start: -20px;
}

.team-hero__flag-circle {
    width: 407px;
    height: 407px;
    /* No border-radius / overflow:hidden — let the SVG ball define its own shape */
    background: transparent;
    position: relative;
}

.team-hero__flag-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    /* Spherical depth: darker at edges */
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.55));
}

.team-hero__flag-circle--no-img {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
}

/* Stats Carousel */
.team-hero__stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 47px;
    flex-shrink: 0;
    height: 280px;
}

.stats-carousel__arrow {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.stats-carousel__arrow:hover {
    opacity: 1;
}

.stats-carousel__viewport {
    height: 89px;
    overflow: hidden;
    width: 180px;
    flex-shrink: 0;
}

.stats-carousel__track {
    display: flex;
    flex-direction: column;
    transition: transform 0.4s ease;
}

.stats-carousel__item {
    height: 89px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.stats-carousel__label {
    padding: 3px 8px;
    font-family: 'MosesText', sans-serif;
    font-weight: 300;
    font-size: 14px;
    color: var(--text-white);
    text-align: center;
    white-space: nowrap;
}

.stats-carousel__value {
    font-family: 'MosesText', sans-serif;
    font-weight: 500;
    font-size: 24px;
    color: var(--text-white);
    text-align: center;
    line-height: 1;
}

.stats-carousel__value--debut {
    font-size: 16px;
    line-height: 1.2;
}

.stats-carousel__value--market {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.2em;
    direction: rtl;
    flex-direction: row;
    white-space: nowrap;
    unicode-bidi: isolate;
}

.stats-carousel__value--market .market-value-number {
    direction: ltr;
    unicode-bidi: isolate;
}

.stats-carousel__value--market .market-value-unit {
    direction: rtl;
    unicode-bidi: isolate;
}

/* ── About (Team Photo + Sidebar) ────────────────────────── */
.about-wrapper {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    background: var(--bg-dark);
}

/* Left sidebar strip (93px wide, dark) */
.about-sidebar {
    width: 93px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px 0;
    flex-shrink: 0;
    position: sticky;
    top: 120px;
    z-index: 10;
}

.about-sidebar__label {
    font-family: 'MosesText', sans-serif;
    font-weight: 670;
    font-size: 55px;
    color: var(--text-white);
    text-transform: uppercase;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    letter-spacing: 2px;
}

.about-sidebar__arrow {
    width: 50px;
    height: 40px;
    flex-shrink: 0;
}

/* Team photo */
.about-photo {
    flex: 1;
    height: 710px;
    overflow: hidden;
    border-radius: 0 8px 8px 0;
    background-color: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.about-photo__credit {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-weight: 500;
    font-size: 12px;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.about-photo--placeholder {
    background: linear-gradient(135deg, #0d2a4f 0%, #03122b 100%);
}

.about-photo__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

/* ── Players Section ─────────────────────────────────────── */
.players-main {
    background: linear-gradient(90deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.2) 100%), #03122B;
    padding: 100px 0 50px;
    display: flex;
    flex-direction: column;
    gap: 150px;
}

.position-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 0 129px 0 40px;
    position: relative;
}

/* Position title badge */
.position-group__header {
    width: 100%;
    height: 108px;
    position: relative;
    margin-bottom: -24px;
    flex-shrink: 0;
}

.position-group__title {
    position: absolute;
    right: -33px; /* slight overflow past the container's right edge */
    top: 30px;
    padding: 0 15px;
    font-family: 'MosesText', sans-serif;
    font-weight: 700;
    font-size: 60px;
    color: var(--text-white);
    text-transform: uppercase;
    line-height: 1.2;
    white-space: nowrap;
    user-select: none;
}

/* Players grid */
.players-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
}

/* Player Card */
.player-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.player-card__img-wrap {
    width: 226px;
    height: 300px;
    position: relative;
    overflow: hidden;
}

.player-card__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom center;
    display: block;
}

.player-card__gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(2, 9, 22, 0) 65%, #030F24 100%);
    pointer-events: none;
}

.player-card__info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    width: 226px;
}

.player-card__number {
    font-family: 'Audiowide', monospace;
    font-size: 30px;
    color: var(--text-muted);
    line-height: 24px;
}

.player-card__name {
    font-family: 'MosesText', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--text-white);
    line-height: 24px;
}

/* ── Coach Section ───────────────────────────────────────── */
.coach-section {
    background: linear-gradient(90deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.2) 100%), #03122B;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 25px;
    padding: 25px 90px 0 130px;
    min-height: 382px;
    overflow: hidden;
}

/* Coach info */
.coach-section__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
    padding-bottom: 40px;
    direction: rtl;
}

.coach-section__name {
    font-family: 'MosesText', sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: var(--text-white);
    text-transform: uppercase;
    text-align: right;
    line-height: 42px;
}

.coach-section__stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
    width: 472px;
}

/* Stat row: value + label chip */
.coach-stat {
    display: flex;
    flex-direction: row-reverse;
    gap: 12px;
    align-items: flex-end;
    justify-content: flex-end;
    width: 100%;
}

.coach-stat__value {
    font-family: 'MosesText', sans-serif;
    font-weight: 500;
    font-size: 18px;
    color: var(--text-white);
    line-height: 24px;
}

.coach-stat__label {
    padding: 4px;
    font-family: 'MosesText', sans-serif;
    font-weight: 300;
    font-size: 20px;
    color: var(--text-white);
    text-align: center;
    white-space: nowrap;
    line-height: 1;
}

/* Bio row — label inline, text wraps after it */
.coach-stat--bio {
    display: block;
    align-items: unset;
    justify-content: unset;
}

.coach-stat--bio .coach-stat__label {
    display: inline;
    margin-bottom: 0;
    vertical-align: middle;
    margin-left: 6px;
}

.coach-stat__bio-text {
    font-family: 'MosesText', sans-serif;
    font-weight: 500;
    font-size: 18px;
    color: var(--text-white);
    line-height: 27px;
}

.coach-section__photo-area {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap:15px;
    position: relative;
    flex-shrink: 0;
    padding-bottom: 15px;
}

.coach-section__title-badge {
    padding: 0 15px;
    font-weight: 700;
    font-size: 60px;
    color: var(--text-white);
    text-transform: uppercase;
    line-height: 1.2;
    position: relative;
    white-space: nowrap;
}

.coach-card {
    flex-shrink: 0;
}

.coach-card__img-wrap {
    width: 226px;
    height: 300px;
    position: relative;
    overflow: hidden;
}

.coach-card__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.coach-card__gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(2, 9, 22, 0) 65%, #020916 100%);
    pointer-events: none;
}

.coach-card__credit {
    position: absolute;
    bottom: 6px;
    right: 0;
    font-weight: 500;
    font-size: 12px;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* ── Responsive (Mobile) ────────────────────────────────── */
@media (max-width: 900px) {
    .team-content-container {
        flex-direction: column;
        align-items: stretch;
    }
    .about-wrapper {
        flex-direction: column;
    }
    .about-sidebar {
        display: none;
    }
    .about-photo {
        height: 220px;
        border-radius: 0 0 8px 8px;
    }
    .players-main {
        padding: 40px 0 30px;
        gap: 60px;
    }
    .position-group {
        padding: 0 20px;
    }
    .position-group__header {
        height: 60px;
        margin-bottom: -10px;
    }
    .position-group__title {
        font-size: 32px;
        right: -10px;
        top: 10px;
    }
    .players-grid {
        gap: 10px;
    }
    .player-card__img-wrap,
    .coach-card__img-wrap {
        width: 120px;
        height: 160px;
    }
    .player-card__info {
        width: 120px;
    }
    .player-card__name {
        font-size: 15px;
    }
    .player-card__number {
        font-size: 18px;
    }
    .coach-section {
        flex-direction: column-reverse;
        align-items: center;
        gap: 12px;
        padding: 20px 16px 0;
        min-height: unset;
    }
    .coach-section__photo-area {
        align-items: center;
        padding-bottom: 0;
        width: 100%;
    }
    .coach-section__title-badge {
        display: flex;
        align-self: flex-start;
        font-size: 36px;
    }
    .coach-card__img-wrap {
        width: 160px;
        height: 210px;
    }
    .coach-section__info {
        width: 100%;
        padding-bottom: 0;
        gap: 14px;
        text-align: center;
    }
    .coach-section__name {
        font-size: 2rem;
        text-align: center;
        line-height: 1.3;
        margin-bottom: 8px;
    }
    .coach-section__stats {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        align-items: flex-start;
        column-gap: 8px;
        row-gap: 16px;
    }
    .coach-stat {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 4px;
        flex: 1;
    }
    .coach-stat--bio {
        flex-basis: 100%;
        flex-direction: column;
        align-items: center;
        margin-top: 12px;
    }
    .coach-stat__bio-text {
        text-align: right;
        font-size: 18px;
        line-height: 27px;
    }
}

@media (max-width: 600px) {
    :root {
        --page-width: 100vw;
    }

    .header-mobile-sponsor-bar { display: flex; }

    .header-inner {
        height: 80px;
        padding: 0 10px;
        background-position: right center;
    }
    .header-inner::before,
    .header-inner::after {
        height: 40px !important;
        right: -65px !important;
    }
    .header-content {
        padding: 0 40px;
    }
    .header-title {
        font-size: clamp(16px, 8.5vw, 38px);
        font-weight: 700;
        line-height: 1.1;
        letter-spacing: 0.5px;
        text-align: right;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80vw;
        margin: 0;
        padding: 0;
    }
    .header-trophy {
        height: 65px;
        left: 5px;
        top: 50%;
        bottom: unset;
        transform: translateY(-50%);
    }
    .search-bar-wrapper {
        padding: 28px 8px;
    }
    .search-bar {
        max-width: 100%;
        padding: 6px 8px;
        font-size: 13px;
        height: 50px;
    }

    #search-input {
        font-size: 16px;
    }
    .team-hero {
        flex-direction: column-reverse;
        align-items: stretch;
        padding: 0 0 24px;
        min-height: 0;
        gap: 24px;
        overflow: hidden;
    }
    .team-hero__content {
        position: relative;
        display: flex;
        flex-direction: column;
        min-height: 240px;
        gap: 0;
        overflow: hidden;
    }
    .team-hero__name-area {
        position: relative;
        z-index: 1;
        margin-inline-start: 0;
        gap: 0;
        margin-top: 75px;
    }
    .team-hero__name {
        font-size: clamp(48px, 18vw, 82px);
        letter-spacing: 1px;
        line-height: 0.9;
        text-align: right;
    }
    .team-hero__year {
        font-size: clamp(48px, 18vw, 82px);
        letter-spacing: 3px;
        -webkit-text-stroke: 1.5px rgba(255,255,255,0.45);
    }
    .team-hero__accent-line {
        width: 58px;
        height: 4px;
    }
    .team-hero__flag-area {
        position: absolute;
        top: -20px;
        right: -15px;
        z-index: 0;
        opacity: 0.8;
    }
    .team-hero__flag-circle {
        width: 210px;
        height: 210px;
    }
    .team-hero__flag-img {
        width: 140%;
        height: 140%;
        margin-right: -90px;
    }
    .team-hero__stats {
        flex-direction: row;
        gap: 0;
        height: 70px;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 0 8px;
    }
    .stats-carousel__arrow {
        flex-shrink: 0;
        width: 28px;
        height: 70px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .stats-carousel__arrow svg {
        transform: rotate(90deg);
    }
    .stats-carousel__viewport {
        flex: 1;
        height: 70px;
        width: auto;
        overflow: hidden;
        display: flex;
        align-items: center;
        direction: ltr;
    }
    .stats-carousel__track {
        display: flex;
        flex-direction: row !important;
        width: auto;
        height: 100%;
        transition: transform 0.4s ease;
        will-change: transform;
    }
    .stats-carousel__item {
        flex-shrink: 0;
        height: 70px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    .stats-carousel__label {
        font-size: 20px;
        padding: 2px 8px;
    }
    .stats-carousel__value {
        font-size: 30px;
    }
    .stats-carousel__value--market {
        direction: rtl;
        flex-direction: row;
        white-space: nowrap;
    }
    .about-photo {
        height: 120px;
    }
    .players-main {
        padding: 20px 0 10px;
        gap: 30px;
    }
    .position-group {
        padding: 0 5px;
    }
    .position-group__header {
        margin-bottom: 20px;
    }
    .position-group__title {
        font-size: 36px;
        right: 0;
        top: 0;
    }
    .players-grid {
        display: flex;
        flex-direction: column;
        gap: 24px;
        align-items: center;
        width: 100%;
    }
    .player-card {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        width: 100%;
        max-width: 351px;
        padding: 0 0 24px;
    }
    .player-card__img-wrap {
        width: 100%;
        aspect-ratio: 226 / 300;
        height: auto;
        overflow: hidden;
        position: relative;
        flex-shrink: 0;
    }
    .player-card__img-wrap img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: bottom center;
        max-width: none;
    }
    .player-card__info {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        width: 100%;
        text-align: center;
    }
    .player-card__number {
        font-size: 30px;
        color: #E4E8F0;
        line-height: 24px;
    }
    .player-card__name {
        font-size: 2rem;
        line-height: 1.5rem;
    }
    .coach-card__img-wrap {
        width: 100%;
        max-width: 351px;
        aspect-ratio: 226 / 300;
        height: auto;
        min-height: 300px;
    }

}

/* ── Player Lightbox ─────────────────────────────────────── */
/* position:absolute so the modal anchors near the card — required for iframe embeds
   where position:fixed renders relative to the iframe top, not the visible scroll position */
.player-lightbox {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    z-index: 1000;
}

.player-lightbox--open {
    display: block;
}

.player-lightbox__overlay {
    position: fixed;   /* covers the visible viewport within the iframe */
    inset: 0;
    background: rgba(2, 9, 22, 0.85);
    cursor: pointer;
}

.player-lightbox__modal {
    position: absolute;  /* positioned via JS using visualViewport for correct iframe centering */
    z-index: 1001;
    background: linear-gradient(90deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.2) 100%), #03122B;
    border: 5px solid #fff;
    width: 700px;
    max-width: calc(100% - 16px);
    max-height: 90vh;
    overflow-y: auto;
    direction: rtl;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header */
.player-lightbox__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
}

.player-lightbox__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-white);
    opacity: 0.8;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    transition: opacity 0.2s;
}

.player-lightbox__close:hover {
    opacity: 1;
}

.player-lightbox__team {
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    direction: rtl;
}

.player-lightbox__team-flag {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.player-lightbox__team-name {
    font-family: 'MosesText', sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Body */
.player-lightbox__body {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "photo info"
        "photo stats";
    column-gap: 31px;
    row-gap: 20px;
    align-items: start;
}

.player-lightbox__photo-wrap {
    grid-area: photo;
}

.player-lightbox__info {
    grid-area: info;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    min-width: 0;
}

.player-lightbox__stats {
    grid-area: stats;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
    width: 100%;
}

.player-lightbox__number {
    font-family: 'Audiowide', monospace;
    font-size: 35px;
    color: var(--text-muted);
    line-height: 1;
}

.player-lightbox__name {
    font-family: 'MosesText', sans-serif;
    font-weight: 700;
    font-size: 44px;
    color: var(--text-white);
    line-height: 1.2;
    text-align: right;
    margin: 0;
}

.player-lightbox__stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
    width: 100%;
}

.player-lightbox__stat-row {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: flex-end;
    justify-content: flex-end;
}

.player-lightbox__stat {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: flex-end;
    justify-content: flex-end;
}

.player-lightbox__stat-value {
    font-family: 'MosesText', sans-serif;
    font-weight: 500;
    font-size: 18px;
    color: var(--text-white);
    line-height: 24px;
    text-align: right;
}

.player-lightbox__stat-label {
    font-family: 'MosesText', sans-serif;
    font-weight: 300;
    font-size: 16px;
    color: var(--text-white);
    padding: 4px 6px;
    white-space: nowrap;
    line-height: 1;
}

.player-lightbox__photo-wrap {
    width: 286px;
    height: 379px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.player-lightbox__photo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: top center;
    display: block;
}

.player-lightbox__photo-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(12,16,26,0) 65%, #0c101a 100%);
    pointer-events: none;
}

.player-lightbox__photo-credit {
    position: absolute;
    bottom: 8px;
    left: 0;
    font-family: 'MosesText', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.75);
    pointer-events: none;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-width: calc(100% - 16px);
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    direction: ltr;
    line-height: 1.4;
}

/* Footer */
.player-lightbox__footer {
    border-top: 1px solid rgba(228,232,240,0.2);
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-lightbox__footer-header {
    display: flex;
    flex-direction: column;
    gap:5px;
}

.player-lightbox__section-title {
    font-family: 'MosesText', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--text-white);
    text-align: right;
}

.player-lightbox__section-source {
    font-family: 'MosesText', sans-serif;
    font-weight: 400;
    font-size: 13px;
    color: var(--text-muted);
}

.player-lightbox__wc-stats {
    display: flex;
    gap: 20px;
    justify-content: flex-start;
}

.player-lightbox__wc-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 50px;
}

.player-lightbox__wc-value {
    font-family: 'MosesText', sans-serif;
    font-weight: 500;
    font-size: 30px;
    color: var(--text-white);
    line-height: 1;
}

.player-lightbox__wc-lbl {
    font-family: 'MosesText', sans-serif;
    font-weight: 300;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

/* Mobile lightbox */
@media (max-width: 600px) {
    .player-lightbox__overlay {
        position: absolute;
        inset: 0;
        pointer-events: none;
    }

    .player-lightbox__team {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }

    .player-lightbox__modal {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        max-height: 680px;
        height: auto;
        padding: 16px 12px;
        gap: 14px;
    }

    .player-lightbox__body {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "info photo"
            "stats stats";
        column-gap: 12px;
        row-gap: 12px;
    }

    .player-lightbox__photo-wrap {
        width: 150px;
        height: 200px;
        flex-shrink: 0;
        align-self: center;
    }

    .player-lightbox__info {
        justify-content: center;
        align-self: center;
        gap: 8px;
    }

    .player-lightbox__number {
        font-size: 1.5rem;
    }

    .player-lightbox__name {
        font-size: 2rem;
        text-align: right;
    }    

    .player-lightbox__stat {
        justify-content: flex-end;
    }

    .player-lightbox__wc-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px 8px;
        width: 100%;
    }
}

@media (max-width: 400px) {
    .header-inner::before,
    .header-inner::after {
        height: 40px !important;
        right: -65px !important;
    }
    .header-trophy {
        height: 65px;
        left: 5px;
        top: 50%;
        bottom: unset;
        transform: translateY(-50%);
    }
    .header-title {
        font-size: 2.3rem;
    }
}

@media (min-width: 601px) {
    .header-sponsor-col { display: flex; }
}

/* ── Dark mode ──────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
    html {
        background-color: var(--bg-darker);
    }

    .search-bar-wrapper {
        background-color: #020d1f;
    }

    .search-bar {
        background: #0d1e35;
        border-color: #1e3050;
    }

    .search-bar:focus-within {
        border-color: #526BDB;
    }

    #search-input {
        color: #ffffff;
    }

    #search-input::placeholder {
        color: #6b7a99;
    }

    .search-icon {
        color: #6b7a99;
    }

    .team-search-dropdown {
        background: #0d1e35;
        border-color: #1e3050;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    }

    .search-bar--open {
        border-bottom-color: transparent;
    }

    .team-search-item {
        color: #e4e8f0;
        border-bottom-color: rgba(255, 255, 255, 0.06);
    }

    .team-search-item.selected,
    .team-search-item:hover {
        background: rgba(82, 107, 219, 0.15);
    }

    .team-search-flag {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.12);
    }
}
