/* =====================================================
   TOPLYGA FANTASY
   DASHBOARD / TEAM BUILDER
   Clean dark desktop layout
   ===================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #101214;
    color: #ffffff;
    overflow: hidden;
}

button,
input,
select {
    font: inherit;
}

button,
select,
input {
    outline: none;
}

/* =====================================================
   HEADER
   ===================================================== */

.top-header {
    --fantasy-header-height: 72px;
    width: 100%;
    min-height: var(--fantasy-header-height);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 72px;
    grid-template-areas: "brand nav";
    align-items: center;
    column-gap: 20px;
    padding: 0 24px;
    background: #171a1e;
    border-bottom: 1px solid #292d32;
    flex-shrink: 0;
}

.brand {
    grid-area: brand;
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    gap: 7px;
    color: #ffffff;
    text-decoration: none;
}

.brand-main {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
}

.brand-sub {
    font-size: 12px;
    font-weight: 700;
    color: #89929b;
}

.app-nav {
    grid-area: nav;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 1 auto;
}

.app-nav a {
    padding: 9px 11px;
    border-radius: 7px;
    color: #9aa3ac;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.app-nav a:hover { background: #20252a; color: #fff; }
.app-nav a.active { background: #fff; color: #111; }

body[data-mode="lineup"].has-team .team-name-box { display: none !important; }
body[data-mode="lineup"].has-team .player-modal-actions { display: flex; }
body[data-mode="lineup"].has-team .player-modal-actions .sell-button { display: none; }
body[data-mode="lineup"] .pitch-header { display: none; }
body[data-mode="lineup"] .position-badge { display: none; }
body[data-mode="transfers"].has-team .captain-section,
body[data-mode="transfers"].has-team .swap-button { display: none; }

body[data-mode="lineup"] .players-panel { display: none; }
body[data-mode="lineup"] .fantasy-layout { grid-template-columns: 420px minmax(0, 1fr); }
.lineup-sidebar {
    min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column;
    gap: 12px; padding: 16px; overflow: auto; background: #14171a; border-right: 1px solid #292d32;
}
.lineup-sidebar .lineup-identity-card { min-height: 128px; flex: 0 0 auto; }
.lineup-sidebar .lineup-fixtures-card { min-height: 180px; flex: 1 1 auto; }
.lineup-sidebar .lineup-fixtures-heading { align-items: flex-start; flex-direction: column; }
.lineup-sidebar .lineup-fixtures-heading > div { align-items: flex-start; flex-direction: column; gap: 4px; }
.lineup-sidebar .lineup-fixtures-list { flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.lineup-sidebar .lineup-fixture { min-width: 0; min-height: 48px; flex: 0 0 auto; }
.lineup-sidebar .fixture-club strong { max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: normal; line-height: 1.15; }
.lineup-leagues-card { position: relative; min-height: 110px; padding: 13px; border: 1px solid #2d343b; border-radius: 10px; background: #171a1e; flex: 0 0 auto; }
.lineup-section-heading { display: flex; flex-direction: column; gap: 5px; }
.lineup-section-heading strong { color: #f1f3f5; font-size: 13px; }
.lineup-leagues-card p { margin-top: 10px; max-width: 210px; color: #929ba4; font-size: 10px; line-height: 1.45; }
.coming-soon-pill { position: absolute; top: 12px; right: 12px; padding: 4px 7px; border-radius: 20px; background: #292e34; color: #a6afb7; font-size: 8px; font-weight: 800; letter-spacing: .05em; }

.lineup-identity-card,
.lineup-fixtures-card {
    min-width: 0;
    border: 1px solid #2d343b;
    border-radius: 10px;
    background: linear-gradient(135deg, #17221f, #171a1e 62%);
}
.lineup-identity-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-areas:
        "badge copy"
        "status status"
        "deadline deadline";
    grid-template-rows: auto auto auto;
    align-items: center;
    column-gap: 11px;
    row-gap: 9px;
    padding: 11px;
}
.round-number-badge { grid-area: badge; width: 48px; height: 48px; display: grid; place-items: center; border: 2px solid #8bd8a8; border-radius: 14px; background: linear-gradient(145deg, #1f6a4b, #193a39); color: #f4fff8; font-size: 15px; font-weight: 900; box-shadow: inset 0 0 0 3px rgba(255,255,255,.06); }
.fantasy-team-badge {
    width: 42px;
    height: 48px;
    display: grid;
    place-items: center;
    grid-row: 1;
    border: 2px solid #8bd8a8;
    border-radius: 12px 12px 16px 16px;
    background: linear-gradient(145deg, #1f6a4b, #193a39);
    color: #f4fff8;
    font-size: 15px;
    font-weight: 900;
    box-shadow: inset 0 0 0 3px rgba(255,255,255,.06);
}
.lineup-identity-copy { grid-area: copy; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lineup-context-label { color: #929da6; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.lineup-identity-copy strong { overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.lineup-identity-copy small { color: #8d979f; font-size: 9px; line-height: 1.3; }
.transfer-deadline-countdown { display: block; color: #8de2aa; font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; }
.transfer-deadline-countdown.is-urgent { color: #ffd479; }
.transfer-deadline-countdown.is-closed { color: #ff9999; }
.lineup-identity-card .lineup-round-status { grid-area: status; justify-self: start; max-width: 100%; white-space: normal; text-align: center; }
.lineup-identity-card .transfer-deadline-countdown { grid-area: deadline; justify-self: stretch; min-width: 0; padding-top: 8px; border-top: 1px solid #2d3933; line-height: 1.4; text-align: left; overflow-wrap: anywhere; }
.favorite-club-control { min-width: 0; grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.favorite-club-control span { color: #a8b0b7; font-size: 10px; white-space: nowrap; }
.favorite-club-control img { width: 20px; height: 20px; flex: 0 0 20px; object-fit: contain; }
.favorite-club-control select { min-width: 0; width: 132px; height: 27px; padding: 0 7px; border: 1px solid #343d43; border-radius: 6px; background: #111719; color: #eaf2ed; font-size: 10px; }
.lineup-fixtures-card { display: flex; flex-direction: column; gap: 8px; padding: 10px 11px; overflow: hidden; }
.lineup-fixtures-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lineup-fixtures-heading > div { display: flex; align-items: baseline; gap: 8px; }
.lineup-fixtures-heading strong { font-size: 13px; }
.lineup-round-status { padding: 4px 7px; border-radius: 20px; background: #193e2d; color: #8de2aa; font-size: 8px; font-weight: 800; letter-spacing: .05em; white-space: nowrap; }
.lineup-fixtures-list { min-width: 0; min-height: 0; display: flex; gap: 7px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #46524b transparent; }
.lineup-fixture { min-width: 137px; min-height: 64px; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 6px 8px; border: 1px solid #2b3530; border-radius: 7px; background: rgba(10,18,14,.56); }
.fixture-teams { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); align-items: center; gap: 4px; }
.fixture-club { min-width: 0; display: flex; align-items: center; gap: 5px; }
.fixture-club:first-child { justify-content: flex-start; }
.fixture-club:last-child { justify-content: flex-end; }
.fixture-club img, .fixture-club > span { width: 18px; height: 18px; flex: 0 0 18px; object-fit: contain; }
.fixture-club > span { display: grid; place-items: center; border-radius: 50%; background: #303941; color: #fff; font-size: 7px; font-weight: 800; }
.fixture-club strong { min-width: 0; max-width: none; min-height: 2.3em; display: -webkit-box; flex: 1 1 auto; overflow: hidden; color: #edf1ee; font-size: 9px; line-height: 1.15; text-overflow: ellipsis; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.fixture-club:first-child strong { text-align: right; }
.fixture-club:last-child strong { text-align: left; }
.fixture-vs { color: #768079; font-size: 10px; text-align: center; }
.lineup-fixture time { color: #9ba69e; font-size: 9px; text-align: center; white-space: nowrap; }
.lineup-fixture-postponed { min-height: 16px; align-self: center; padding: 3px 6px; border-radius: 10px; background: #3a3020; color: #f2d28d; font-size: 8px; font-weight: 800; line-height: 1.2; text-align: center; white-space: nowrap; }
.lineup-fixture-postponed.is-empty { visibility: hidden; }
.lineup-fixtures-empty { align-self: center; padding: 4px; color: #9ba69e; font-size: 10px; }
.wildcard-banner { min-height: 72px; display: flex; align-items: center; gap: 18px; margin-bottom: 10px; padding: 10px 13px; border: 1px solid #30383f; border-radius: 10px; background: linear-gradient(100deg, #211a2b, #1a1d23 55%, #172a25); flex: 0 0 auto; }
body[data-mode="lineup"] .wildcard-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; }
body[data-mode="lineup"] .wildcard-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lineup-save-button { min-height: 40px; padding: 0 14px; white-space: nowrap; }
.pitch-formation-badge { position: absolute; top: 9px; right: 10px; z-index: 10; min-width: 42px; padding: 4px 8px; border: 1px solid rgba(255,255,255,.52); border-radius: 999px; background: rgba(10,45,27,.82); color: #fff; font-size: 10px; font-weight: 850; line-height: 1; text-align: center; pointer-events: none; }
.pitch-formation-badge #formationText { color: #fff; font-size: inherit; }
.wildcard-banner-copy { min-width: 105px; display: flex; flex-direction: column; gap: 5px; }
.wildcard-banner-copy strong { font-size: 14px; }
.wildcard-options { min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; flex: 1; }
.wildcard-option { min-width: 0; min-height: 43px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 5px 7px; border: 1px solid #41414a; border-radius: 7px; background: rgba(8,9,14,.34); color: inherit; font: inherit; cursor: pointer; }
.wildcard-option:disabled { opacity: .48; cursor: not-allowed; }
.wildcard-option.is-active { border-color: #43865c; background: #173224; box-shadow: inset 0 0 0 1px #2f7048; }
.wildcard-option.is-used { opacity: .48; }
.wildcard-option b { overflow: hidden; max-width: 100%; color: #e9e7f0; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.wildcard-option span { color: #c39aff; font-size: 7px; font-weight: 900; letter-spacing: .08em; }
.chip-help { position: relative; z-index: 2; display: inline-grid; width: 13px; height: 13px; place-items: center; margin-left: 2px; border: 1px solid currentColor; border-radius: 50%; color: #b7c1c9; font: inherit; font-size: 9px; font-style: normal; line-height: 1; vertical-align: 1px; cursor: help; }
.chip-help:hover, .chip-help:focus-visible { color: #fff; outline: 2px solid #83d9a2; outline-offset: 2px; }
.transfer-chip strong .chip-help { font-size: 9px; }

.page-instruction {
    margin-top: 5px;
    color: #929ba4;
    font-size: 11px;
    line-height: 1.4;
}

.roster-role {
    flex: 0 0 auto;
    color: #88d7a6;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-align: right;
}

.team-info {
    grid-area: info;
    min-width: 0;
    min-height: 53px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 22px;
    border-top: 1px solid #292d32;
}

.team-info > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}

.info-label {
    font-size: 9px;
    line-height: 1;
    color: #7d858e;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.team-info strong {
    font-size: 14px;
    line-height: 1.1;
    white-space: nowrap;
}

.team-name-box {
    gap: 4px !important;
}

.team-name-input {
    width: 175px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #3b4249;
    border-radius: 6px;
    background: #111417;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
}

.team-name-input::placeholder {
    color: #69727c;
}

.team-name-input:focus {
    border-color: #737d87;
}

.team-name-input[readonly] {
    border-color: #30383f;
    background: #1b2024;
    color: #aeb8c0;
    cursor: default;
}

.save-button {
    height: 38px;
    padding: 0 18px;
    border: 0;
    border-radius: 7px;
    background: #ffffff;
    color: #111111;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, transform .1s ease, opacity .15s ease;
}

.save-button:hover:not(:disabled) {
    background: #e8eaec;
}

.save-button:active:not(:disabled) {
    transform: translateY(1px);
}

.save-button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* =====================================================
   MAIN LAYOUT
   ===================================================== */

.fantasy-layout {
    width: 100%;
    height: calc(100vh - var(--fantasy-header-height, 72px));
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(360px, 42fr) minmax(520px, 58fr);
    overflow: hidden;
}

/* =====================================================
   PLAYERS PANEL
   ===================================================== */

.players-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px 16px 14px;
    background: #14171a;
    border-right: 1px solid #292d32;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 18px;
    line-height: 1.1;
}

.panel-header span {
    color: #7f8790;
    font-size: 11px;
    white-space: nowrap;
}

.squad-requirements {
    flex: 0 0 auto;
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid #2d4939;
    border-radius: 9px;
    background: linear-gradient(110deg, #17251d, #191d21 70%);
}

.squad-requirements-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 9px;
}

.squad-requirements-heading strong { font-size: 13px; }
.squad-requirements-heading span { color: #929ca4; font-size: 10px; }
.squad-requirement-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.squad-requirement {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid #30373d;
    border-radius: 7px;
    background: #171b1f;
    color: #a3adb5;
    font-size: 10px;
}
.squad-requirement strong { color: #edf1f3; font-size: 12px; white-space: nowrap; }
.squad-requirement.complete { border-color: #36734d; background: #17281f; }
.squad-requirement.complete strong { color: #83d9a1; }
.squad-requirement.over-limit { border-color: #9e4b4b; background: #2b1b1b; }
.squad-requirement.over-limit strong { color: #ff9b9b; }

body.team-creation-required[data-mode="transfers"] .save-button {
    min-width: 190px;
    height: 48px;
    padding: 0 22px;
    background: #80d6a0;
    color: #102016;
    font-size: 15px;
    box-shadow: 0 0 0 3px rgb(128 214 160 / 14%);
}
body.team-creation-required[data-mode="transfers"] .save-button:disabled { opacity: .68; }
body.team-creation-required[data-mode="transfers"] .brand { pointer-events: none; }
body[data-mode="transfers"]:not(.has-team) .transfer-toolbar { grid-template-columns: minmax(0, 1fr); }
body[data-mode="transfers"]:not(.has-team) .transfer-chip-panel,
body[data-mode="transfers"]:not(.has-team) .transfer-undo-button { display: none; }
body[data-mode="transfers"]:not(.has-team) .transfer-toolbar-heading { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
body[data-mode="transfers"]:not(.has-team) .transfer-settings-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
}
body[data-mode="transfers"]:not(.has-team) .transfer-settings-grid .transfer-chip { display: none; }
body[data-mode="transfers"]:not(.has-team) .transfer-settings-grid .transfer-cost-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-self: start;
    width: min(100%, 220px);
    min-height: 48px;
    padding: 7px 12px;
}
body[data-mode="transfers"]:not(.has-team) .transfer-settings-grid .transfer-cost-panel > div:not(:first-child) { display: none; }
body[data-mode="transfers"]:not(.has-team) .transfer-settings-grid .transfer-cost-panel > div:first-child { padding: 0; }
body[data-mode="transfers"]:not(.has-team) .transfer-settings-grid .transfer-cost-panel span { font-size: 9px; }
body[data-mode="transfers"]:not(.has-team) .transfer-settings-grid .transfer-cost-panel strong { font-size: 16px; }
body[data-mode="transfers"]:not(.has-team) .transfer-settings-grid .transfer-toolbar-footer {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(170px, auto);
    gap: 10px;
}
body[data-mode="transfers"]:not(.has-team) .transfer-toolbar-footer .team-name-input {
    min-width: 0;
    min-height: 48px;
    padding: 0 14px;
    font-size: 15px;
}
body[data-mode="transfers"]:not(.has-team) .transfer-toolbar-footer .save-button {
    min-height: 48px;
    padding: 0 18px;
    font-size: 14px;
}

.search-box {
    flex-shrink: 0;
    margin-bottom: 8px;
}

.search-box input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #30353b;
    border-radius: 7px;
    background: #1c2024;
    color: #ffffff;
    font-size: 13px;
}

.search-box input::placeholder {
    color: #69727c;
}

.search-box input:focus {
    border-color: #68727d;
}

.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.filters select {
    width: 100%;
    height: 36px;
    padding: 0 8px;
    border: 1px solid #30353b;
    border-radius: 6px;
    background: #1c2024;
    color: #ffffff;
    font-size: 12px;
    cursor: pointer;
}

.filters select:focus {
    border-color: #68727d;
}

.players-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

.players-list::-webkit-scrollbar,
.player-modal-content::-webkit-scrollbar {
    width: 6px;
}

.players-list::-webkit-scrollbar-track,
.player-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.players-list::-webkit-scrollbar-thumb,
.player-modal-content::-webkit-scrollbar-thumb {
    background: #363d44;
    border-radius: 10px;
}

/* =====================================================
   PLAYER CARDS
   ===================================================== */

.player-card {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    margin-bottom: 5px;
    background: #1b1f23;
    border: 1px solid #292e34;
    border-radius: 7px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.player-card:hover {
    background: #23282d;
    border-color: #394149;
}

.player-card.selected {
    background: #1a2b22;
    border-color: #2d664c;
}

.player-info {
    min-width: 0;
    flex: 1 1 auto;
}

.player-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    margin-right: 10px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid #343b43;
    border-radius: 50%;
    background: #232a31;
    color: #cbd4dc;
    font-size: 12px;
    font-weight: 800;
}

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

.player-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.player-name .player-condition-markers {
    display: inline-flex;
    margin-left: 4px;
    vertical-align: middle;
}

.player-condition-markers {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 14px;
    margin-top: 2px;
}

.player-condition-badge {
    width: 15px;
    height: 15px;
    display: inline-grid;
    flex: 0 0 15px;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.player-condition-badge.injured { color: #ffb547; background: #4a3214; }
.player-condition-badge.suspended { color: #ff7777; background: #492124; }
.player-condition-badge.inactive { color: #c0c6ce; background: #343a42; }

.pitch-player > .player-condition-overlay {
    position: absolute;
    top: calc(var(--u) * 1.7);
    left: calc(var(--u) * 2.0);
    z-index: 4;
    min-height: calc(var(--u) * 2.5);
    margin: 0;
    justify-content: flex-start;
    gap: calc(var(--u) * .25);
}

.pitch-player > .player-condition-overlay .player-condition-badge {
    width: calc(var(--u) * 2.1);
    height: calc(var(--u) * 2.1);
    flex-basis: calc(var(--u) * 2.1);
    border-width: calc(var(--u) * .28);
    font-size: calc(var(--u) * 1.1);
}

.bench-info > .player-condition-markers {
    justify-content: flex-start;
}

.player-club {
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #7f8790;
    font-size: 10px;
    line-height: 1.1;
}

.player-meta-line { min-width: 0; display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.player-meta-line .player-club { min-width: 0; margin-top: 0; }
.player-position-tag { flex: 0 0 auto; color: #9ea8b1; font-size: 9px; font-weight: 800; text-transform: lowercase; }
.player-total-points { flex: 0 0 37px; color: #dce4e9; font-size: 11px; font-weight: 800; text-align: center; white-space: nowrap; }
.player-total-points small { display: block; margin-top: 1px; color: #8f9aa4; font-size: 8px; font-weight: 600; }

.player-position {
    flex: 0 0 38px;
    color: #929aa3;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

.player-price {
    flex: 0 0 52px;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.add-player-button {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    margin-left: 1px;
    border: 1px solid #3b4249;
    border-radius: 50%;
    background: #252a2f;
    color: #ffffff;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.add-player-button:hover:not(:disabled) {
    background: #ffffff;
    color: #111111;
    border-color: #ffffff;
}

.add-player-button:disabled {
    opacity: .3;
    cursor: not-allowed;
}

/* =====================================================
   PITCH PANEL
   ===================================================== */

.pitch-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 14px 18px 12px;
    background: #101214;
    overflow: hidden;
}

.pitch-header {
    height: 42px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 7px;
    flex-shrink: 0;
}

.transfer-toolbar {
    min-height: 90px;
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    margin-bottom: 9px;
    padding: 9px 12px;
    border: 1px solid #2d353c;
    border-radius: 10px;
    background: linear-gradient(105deg, #19221e, #191d22 55%, #1b2024);
    flex: 0 0 auto;
}
.transfer-toolbar-heading { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.transfer-toolbar-heading h2 { margin: 0; font-size: 17px; line-height: 1.15; }
.transfer-lineup-counts { color: #929ba4; font-size: 9px; white-space: nowrap; }
.transfer-lineup-counts strong { color: #e9edf0; }
.transfer-settings-grid { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, .55fr) minmax(0, .55fr) minmax(0, 1.9fr); grid-template-rows: repeat(2, minmax(48px, auto)); align-items: stretch; gap: 6px; }
.transfer-chip { min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 5px 5px; border: 1px solid #394149; border-radius: 8px; background: #171b20; color: #e4e8eb; }
.transfer-chip:disabled { opacity: .72; cursor: not-allowed; }
.transfer-chip.is-active { border-color: #43865c; background: #173224; box-shadow: inset 0 0 0 1px #2f7048; }
.transfer-chip.is-active small { color: #83d9a1; }
.transfer-chip.is-used { opacity: .46; }
.transfer-chip strong { font-size: 10px; }
.transfer-chip small { color: #83c99b; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.transfer-cost-panel { min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; padding: 6px 5px; border: 1px solid #30383f; border-radius: 9px; background: linear-gradient(135deg, rgba(15,19,22,.82), rgba(24,29,32,.68)); }
.transfer-cost-panel > div { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 5px; padding: 0 clamp(4px, .7vw, 11px); }
.transfer-cost-panel > div + div { border-left: 1px solid #30383f; }
.transfer-cost-panel span { color: #8f99a2; font-size: 8px; font-weight: 750; letter-spacing: .025em; line-height: 1.1; text-transform: uppercase; overflow-wrap: anywhere; }
.transfer-cost-panel strong { color: #f2f5f6; font-size: 13px; line-height: 1; white-space: nowrap; }
.transfer-toolbar-footer { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, auto); align-items: center; gap: 7px; }
.transfer-toolbar-footer .team-name-input { width: 100%; min-width: 0; height: 38px; }
.transfer-toolbar-footer .save-button { min-width: 0; min-height: 38px; padding: 0 8px; font-size: 10px; }
.transfer-undo-button { grid-column: 1 / -1; justify-self: end; padding: 8px 12px; border: 1px solid #86565a; border-radius: 7px; background: #2a1c20; color: #f0c1c4; font-size: 10px; font-weight: 750; cursor: pointer; }
.transfer-undo-button:hover { background: #3a2328; }
.transfer-undo-button:disabled { opacity: .55; cursor: wait; }

.pitch-header h2 {
    font-size: 18px;
    line-height: 1.1;
}

.pitch-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #89929b;
    font-size: 11px;
    white-space: nowrap;
}

.pitch-stats strong {
    color: #ffffff;
    font-size: 12px;
}

/* =====================================================
   FOOTBALL PITCH
   ===================================================== */

/*
   Aikštė identiška "Mano komanda" puslapio aikštei (team.css):
   ryški žalia su vertikaliais dryžiais, balta linija ir baudos
   aikštelėmis viršuje ir apačioje. Matmenys procentais, kad
   tinka ir mažesnei aikštei.
*/

.football-pitch {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: url("assets/aikstele.png") center / 100% 100% no-repeat;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

/* The custom pitch artwork already contains the grass, markings and logo. */
.football-pitch::before,
.football-pitch::after,
.football-pitch .pitch-lines,
.football-pitch .pitch-center-logo { display: none !important; }

body[data-mode="lineup"] .football-pitch { flex: 1 1 0; min-height: 260px; }
body[data-mode="lineup"] .bench { position: relative; z-index: 6; flex: 0 0 76px; }

/* Išorinė linija */

.football-pitch::before {
    content: "";
    position: absolute;
    inset: 17px;
    z-index: 1;
    border: 2px solid rgba(255,255,255,.72);
    border-radius: 3px;
    pointer-events: none;
}

/* Vidurio linija */

.football-pitch::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    top: 50%;
    z-index: 1;
    height: 2px;
    background: rgba(255,255,255,.7);
    pointer-events: none;
}

.pitch-center-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 4;
    width: min(16%, 150px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    object-fit: contain;
    pointer-events: none;
}

.pitch-lines {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.center-circle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12%;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255,255,255,.7);
    border-radius: 50%;
}

.center-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 7px;
    height: 7px;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 50%;
}

/* Baudos aikštelė ir vartininko zona (viršuje) */

.penalty-area {
    position: absolute;
    left: 50%;
    top: 17px;
    width: 24%;
    height: 17%;
    transform: translateX(-50%);
    border: 2px solid rgba(255,255,255,.68);
    border-top: 0;
}

.goal-area {
    position: absolute;
    left: 50%;
    top: 17px;
    width: 10.5%;
    height: 7.5%;
    transform: translateX(-50%);
    border: 2px solid rgba(255,255,255,.68);
    border-top: 0;
}

/* Tos pačios zonos apačioje */

.pitch-lines::before,
.pitch-lines::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 17px;
    transform: translateX(-50%);
    border: 2px solid rgba(255,255,255,.68);
    border-bottom: 0;
}

.pitch-lines::before {
    width: 24%;
    height: 17%;
}

.pitch-lines::after {
    width: 10.5%;
    height: 7.5%;
}

/* =====================================================
   PITCH PLAYERS
   ===================================================== */

/*
   Žaidėjų kortelės (dizainas iš "Mano komanda" puslapio).

   Visi kortelės matmenys skaičiuojami iš --u, kuris priklauso
   nuo ekrano aukščio ir pločio, todėl kortelės visada telpa
   į aikštę.
*/

.pitch-players {
    --u: clamp(6px, min(1.3vh, 1.75vw), 13px);

    position: absolute;
    inset: 0;
    z-index: 5;
}

.empty-pitch-message {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255,255,255,.85);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.pitch-line {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-evenly;
    align-items: flex-start;
    transform: translateY(-50%);
}

.pitch-gk  { top: 12%; }
.pitch-def { top: 34%; }
.pitch-mid { top: 58%; }
.pitch-att { top: 82%; }


/* ---------- kortelė ---------- */

.pitch-player {
    position: absolute;
    width: clamp(calc(var(--u) * 9.6), calc(var(--u) * 11), 148px);
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: calc(var(--u) * .6) calc(var(--u) * .45) calc(var(--u) * .55);
    border-radius: calc(var(--u) * 1.1);
    background: #ffffff;
    color: #172033;
    font-size: var(--u);
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.22);
    cursor: pointer;
    user-select: none;
    transition: transform .15s ease, box-shadow .15s ease;
}

.pitch-line .pitch-player {
    position: relative;
    transform: none;
}

.pitch-line .pitch-player:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0,0,0,.28);
}


/* ---------- avataras ---------- */

.pitch-player-avatar {
    width: calc(var(--u) * 3.6);
    height: calc(var(--u) * 3.6);
    margin-bottom: calc(var(--u) * .35);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #8b949c;
    color: #ffffff;
    font-size: calc(var(--u) * 1.25);
    font-weight: 800;
    overflow: hidden;
}

.pitch-player-avatar img,
.bench-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 16%;
}

.pitch-player-avatar.GK  { background: #16a66a; }
.pitch-player-avatar.DEF { background: #3478df; }
.pitch-player-avatar.MID { background: #2565c7; }
.pitch-player-avatar.ATT { background: #e34b42; }


/* ---------- tekstas ---------- */

.pitch-player-name {
    width: 100%;
    min-height: 2.25em;
    display: -webkit-box;
    overflow: hidden;
    color: #152033;
    font-size: calc(var(--u) * 1.02);
    font-weight: 800;
    text-align: center;
    white-space: normal;
    text-overflow: ellipsis;
    line-height: 1.12;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.pitch-player-club {
    max-width: 100%;
    margin-top: calc(var(--u) * .15);
    overflow: hidden;
    color: #7b8594;
    font-size: calc(var(--u) * .9);
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pitch-player-price {
    min-width: calc(var(--u) * 5.8);
    margin-top: calc(var(--u) * .5);
    padding: calc(var(--u) * .4) calc(var(--u) * .75);
    border-radius: 20px;
    background: #17263d;
    color: #ffffff;
    font-size: calc(var(--u) * .95);
    font-weight: 800;
    text-align: center;
}


/* =====================================================
   POSITION / CAPTAIN / VICE BADGES
   ===================================================== */

.position-badge {
    position: absolute;
    top: calc(var(--u) * -.6);
    right: calc(var(--u) * -.6);
    width: calc(var(--u) * 2.3);
    height: calc(var(--u) * 2.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border: calc(var(--u) * .28) solid #ffffff;
    border-radius: 50%;
    background: #8b949c;
    color: #ffffff;
    font-size: calc(var(--u) * .85);
    font-weight: 900;
}

.position-badge.GK  { background: #19a86b; }
.position-badge.DEF { background: #3175db; }
.position-badge.MID { background: #235fc3; }
.position-badge.ATT { background: #e0443b; }
.position-badge { display: none !important; }

.captain-badge,
.vice-captain-badge {
    position: absolute;
    top: calc(var(--u) * 1.7);
    left: calc(var(--u) * -.95);
    z-index: 3;
    width: calc(var(--u) * 2.5);
    height: calc(var(--u) * 2.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border: calc(var(--u) * .28) solid #ffffff;
    border-radius: 50%;
    font-size: calc(var(--u) * 1);
    font-weight: 900;
}

.captain-badge {
    background: #f2bd32;
    color: #1f1f1f;
}

.vice-captain-badge {
    background: #7857e8;
    color: #ffffff;
}


/* =====================================================
   SWAP STATES
   ===================================================== */

.pitch-player.swap-selected {
    box-shadow: 0 0 0 3px #4da3ff, 0 4px 12px rgba(0,0,0,.22);
}

.pitch-player.swap-target {
    outline: 3px solid #56d68b;
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(86, 214, 139, .65), 0 4px 12px rgba(0,0,0,.22);
}

.bench-player.swap-selected {
    outline: 2px solid #4da3ff;
    outline-offset: -2px;
}

.bench-player.swap-target {
    outline: 3px solid #56d68b;
    outline-offset: 2px;
    box-shadow: 0 0 18px rgba(86, 214, 139, .55);
}

.pitch-player.swap-blocked,
.bench-player.swap-blocked {
    opacity: .35;
    cursor: not-allowed;
}

body[data-mode="lineup"].has-team .pitch-player,
body[data-mode="lineup"].has-team .bench-player { cursor: grab; }
body[data-mode="lineup"].has-team .pitch-player:active,
body[data-mode="lineup"].has-team .bench-player:active { cursor: grabbing; }
.pitch-player.is-dragging,
.bench-player.is-dragging { opacity: .4; }
.pitch-player.drop-target,
.bench-player.drop-target {
    outline: 3px solid #56d68b;
    outline-offset: 2px;
    box-shadow: 0 0 18px rgba(86, 214, 139, .45);
}


/* =====================================================
   BENCH
   ===================================================== */

.bench {
    height: 76px;
    min-height: 76px;
    margin-top: 8px;
    padding: 6px 8px;
    flex-shrink: 0;
    background: #171a1e;
    border: 1px solid #292d32;
    border-radius: 7px;
}

.bench-title {
    margin-bottom: 5px;
    color: #7f8790;
    font-size: 9px;
    line-height: 1;
    text-transform: uppercase;
}

.bench-players {
    height: 42px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.bench-player {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 9px;
    overflow: hidden;
    border: 1px solid #e4e8ed;
    border-radius: 9px;
    background: #f5f7fa;
    color: #172033;
    cursor: pointer;
}

.bench-player:hover {
    background: #ffffff;
}

.bench-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #8b949c;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    overflow: hidden;
}

.bench-avatar.GK  { background: #19a86b; }
.bench-avatar.DEF { background: #3175db; }
.bench-avatar.MID { background: #235fc3; }
.bench-avatar.ATT { background: #e0443b; }

.bench-info {
    min-width: 0;
    flex: 1;
}

.bench-name {
    overflow: hidden;
    color: #172033;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.bench-position {
    margin-top: 2px;
    overflow: hidden;
    color: #7b8594;
    font-size: 9px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.empty-bench {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #626b74;
    font-size: 11px;
}

/* =====================================================
   MESSAGES
   ===================================================== */

.loading,
.empty-message {
    padding: 25px;
    color: #747d86;
    font-size: 12px;
    text-align: center;
}

/* =====================================================
   PLAYER MODAL
   ===================================================== */

.player-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.player-modal.active {
    display: flex;
}

.player-modal-content {
    position: relative;
    width: min(680px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px;
    border: 1px solid #30353b;
    border-radius: 16px;
    background: #171a1e;
    color: #ffffff;
    box-shadow: 0 24px 70px rgba(0,0,0,.55);
}

.player-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #8d969f;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.player-modal-close:hover {
    background: #252a2f;
    color: #ffffff;
}

.player-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 132px;
    margin: -22px -22px 16px;
    padding: 20px 58px 20px 22px;
    border-radius: 15px 15px 10px 10px;
    background: linear-gradient(115deg, #1f5a3c 0%, #194831 48%, #17221d 100%);
}
.player-modal-role { margin-bottom: 5px; color: rgba(255,255,255,.78); font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.player-modal-header h2 { margin: 0 0 4px; font-size: 27px; }
.player-modal-header .player-modal-club { color: rgba(255,255,255,.85); font-size: 14px; }

.player-modal-avatar {
    flex: 0 0 auto;
    width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #363d44;
    border-radius: 50%;
    background: #22272c;
    color: #ffffff;
    font-size: 28px;
}
.player-modal-avatar { width: 82px; height: 82px; border: 2px solid rgba(255,255,255,.65); background: rgba(255,255,255,.16); overflow: hidden; }
.player-modal-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

.player-modal-header h2 {
    margin-bottom: 5px;
    color: #ffffff;
    font-size: 23px;
}

.player-modal-club {
    color: #89929b;
    font-size: 13px;
}

.player-modal-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.player-modal-info > div {
    padding: 12px 14px;
    border: 1px solid #30363d;
    border-radius: 9px;
    background: #20252a;
}

.player-modal-info { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.player-summary-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: -5px 0 15px; }
.player-summary-stats > div { display: flex; min-height: 58px; flex-direction: column; justify-content: center; gap: 5px; padding: 9px; border: 1px solid #30363d; border-radius: 9px; background: #20252a; text-align: center; }
.player-summary-stats span { color: #929ba4; font-size: 10px; }
.player-summary-stats strong { color: #fff; font-size: 16px; }
.modal-detail-card { margin-top: 7px; padding: 10px; border: 1px solid #343b42; border-radius: 8px; background: #191e23; }
.modal-detail-card:first-child { margin-top: 0; }
.modal-detail-card strong, .modal-detail-card small, .modal-detail-card b { display: block; }
.modal-detail-card strong { font-size: 12px; }
.modal-detail-card small { margin-top: 4px; color: #8e99a2; font-size: 10px; }
.modal-detail-card p { margin: 7px 0; color: #c5ccd2; font-size: 11px; line-height: 1.5; }
.modal-detail-card b { color: #8bd8a8; font-size: 11px; }
.modal-form-chip { display: inline-flex; min-width: 62px; flex-direction: column; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 7px; border-radius: 7px; background: #2a3036; }
.modal-form-chip small { color: #9ca6ae; font-size: 9px; }
.modal-form-chip strong { color: #fff; font-size: 11px; }
.modal-history-list { display: flex; flex-direction: column; gap: 6px; }
.modal-history-list > div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid #30363d; font-size: 11px; }
.modal-history-list > div:last-child { border-bottom: 0; }
.modal-history-list span { color: #b6bec5; }
.modal-history-list strong { color: #fff; text-align: right; }
.modal-fixture-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(82px, 1fr)); gap: 7px; }
.modal-fixture-card { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 5px; padding: 9px 5px; border: 1px solid #30363d; border-radius: 9px; background: #20252a; text-align: center; }
.modal-fixture-card img, .modal-fixture-mark { width: 30px; height: 30px; object-fit: contain; }
.modal-fixture-mark { display: grid; place-items: center; border-radius: 50%; background: #2d343b; color: #fff; font-size: 10px; font-weight: 800; }
.modal-fixture-card small, .modal-fixture-card em { color: #929ba4; font-size: 9px; font-style: normal; }
.modal-fixture-card strong { max-width: 100%; overflow: hidden; color: #fff; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.player-modal-trends { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.player-modal-trends .player-modal-section { min-width: 0; }
.player-modal-trends .player-modal-section h3 { margin-bottom: 10px; }
.player-trend-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.player-trend-item { display: flex; min-width: 0; min-height: 128px; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; padding: 9px 5px 0; border: 1px solid #30363d; border-radius: 9px; background: #20252a; text-align: center; }
.player-trend-item > small { color: #9ca6ae; font-size: 10px; }
.player-trend-item > img, .player-trend-mark { width: 36px; height: 36px; object-fit: contain; }
.player-trend-mark { display: grid; place-items: center; border-radius: 50%; background: #2d343b; color: #fff; font-size: 10px; font-weight: 800; }
.player-trend-item > strong { width: 100%; overflow: hidden; color: #aeb6bd; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.player-trend-item > span { color: #aeb6bd; font-size: 11px; font-weight: 700; }
.player-trend-item > b { display: block; width: calc(100% + 10px); margin: auto -5px 0; padding: 5px 2px; border-radius: 0 0 8px 8px; background: linear-gradient(135deg, #1f6a4b, #194b34); color: #effff4; font-size: 13px; }
.fixture-trend-item > b { background: #293039; color: #d9e0e5; font-size: 10px; }
.player-trend-empty { grid-column: 1 / -1; margin: 0; padding: 13px 8px; color: #9ca6ae; font-size: 12px; line-height: 1.5; }

.player-modal-info span {
    display: block;
    margin-bottom: 4px;
    color: #7f8790;
    font-size: 12px;
}

.player-modal-info strong {
    color: #ffffff;
    font-size: 16px;
}

.player-modal-section {
    margin-top: 18px;
    padding-top: 17px;
    border-top: 1px solid #2b3036;
}

.player-modal-section h3 {
    margin-bottom: 12px;
    color: #ffffff;
    font-size: 16px;
}

.player-form-placeholder,
.player-history-placeholder,
.player-fixtures-placeholder {
    padding: 13px 14px;
    border: 1px solid #30363d;
    border-radius: 9px;
    background: #20252a;
    color: #d9dde1;
    font-size: 13px;
    line-height: 1.6;
}
.player-modal-section { margin-top: 13px; padding-top: 13px; }
.player-modal-section h3 { margin-bottom: 8px; font-size: 14px; }

.captain-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.captain-section h3 {
    margin-bottom: 4px;
}

.captain-option {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid #30363d;
    border-radius: 8px;
    background: #20252a;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
}

.captain-option:hover {
    background: #262c32;
    border-color: #414950;
}

.captain-option input {
    width: 18px;
    height: 18px;
    accent-color: #ffffff;
    cursor: pointer;
}

.player-modal-actions {
    display: flex;
    gap: 9px;
    margin-top: 22px;
}

.modal-action-button {
    flex: 1;
    min-height: 42px;
    border: 1px solid #363d44;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.modal-action-button:active {
    transform: translateY(1px);
}

.swap-button {
    border-color: #ffffff;
    background: #ffffff;
    color: #111111;
}

.swap-button:hover {
    background: #e9ecef;
}

.sell-button {
    border-color: #3b4249;
    background: #252a2f;
    color: #ffffff;
}

.sell-button:hover {
    background: #30363d;
}

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

@media (max-width: 1280px) {
    .transfer-toolbar { grid-template-columns: minmax(0, .55fr) minmax(0, 1.45fr); }
    .transfer-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; }
    .transfer-settings-grid .transfer-cost-panel,
    .transfer-settings-grid .transfer-toolbar-footer { grid-column: 1 / -1; }
}

@media (max-width: 1100px) {
    .top-header {
        padding: 0 16px;
        column-gap: 10px;
    }

    .team-info {
        gap: 13px;
    }

    .team-name-input {
        width: 145px;
    }

    .app-nav { gap: 1px; }
    .app-nav a { padding: 8px 7px; font-size: 11px; }

    .fantasy-layout {
        grid-template-columns: minmax(330px, 44fr) minmax(450px, 56fr);
    }

    body[data-mode="lineup"] .fantasy-layout {
        grid-template-columns: 340px minmax(0, 1fr);
    }

    .transfer-toolbar { grid-template-columns: minmax(0, 1fr); }
    .transfer-toolbar-heading { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
    .transfer-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; }
    .transfer-cost-panel, .transfer-toolbar-footer { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    .top-header {
        height: auto;
        min-height: 0;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        grid-template-areas: "brand" "nav";
        align-items: start;
        row-gap: 9px;
        padding: 12px 15px;
    }

    .app-nav {
        width: 100%;
        overflow-x: auto;
    }

    .team-info {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        padding-top: 9px;
    }

    body[data-mode="lineup"] .wildcard-banner { grid-template-columns: minmax(0, 1fr) auto; }
    body[data-mode="lineup"] .wildcard-banner-copy { grid-column: 1; }
    body[data-mode="lineup"] .wildcard-options { grid-column: 1 / -1; grid-row: 2; }
    body[data-mode="lineup"] .lineup-save-button { grid-column: 2; grid-row: 1; }

    .fantasy-layout {
        height: auto;
        display: flex;
        flex-direction: column;
        overflow: visible;
    }

    .players-panel {
        height: 500px;
        border-right: 0;
        border-bottom: 1px solid #292d32;
    }

    .pitch-panel {
        min-height: 650px;
        height: 650px;
    }
}

@media (max-width: 560px) {
    .transfer-toolbar { grid-template-columns: 1fr; gap: 9px; }
    .transfer-toolbar-heading { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .transfer-cost-panel { grid-column: auto; }
    .transfer-cost-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .transfer-cost-panel > div { align-items: center; padding: 0 5px; }
    .transfer-cost-panel span { font-size: 7px; letter-spacing: 0; }
    .player-total-points { flex-basis: 30px; font-size: 10px; }
    .player-price { flex-basis: 46px; font-size: 11px; }
    .transfer-toolbar-footer { grid-template-columns: 1fr; align-items: stretch; }
    body[data-mode="transfers"]:not(.has-team) .transfer-settings-grid .transfer-toolbar-footer { grid-template-columns: 1fr; }
    .transfer-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .transfer-settings-grid .transfer-cost-panel, .transfer-settings-grid .transfer-toolbar-footer { grid-column: 1 / -1; }
    .transfer-team-name .team-name-input { width: 100%; }
    .transfer-toolbar-footer .save-button { width: 100%; }
}

@media (max-width: 600px) {
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .brand-main {
        font-size: 21px;
    }

    .app-nav a { padding: 8px 10px; font-size: 12px; }

    .team-info {
        gap: 10px;
    }

    .team-name-input {
        width: 140px;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .squad-requirement-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .squad-requirements-heading { align-items: flex-start; flex-direction: column; gap: 3px; }

    .pitch-panel {
        padding: 12px;
    }

    .bench-players {
        gap: 4px;
    }

    /* Siaurame ekrane suole lieka tik avatarai (vardas - paspaudus) */

    .bench-player {
        justify-content: center;
        padding: 0 4px;
    }

    .bench-info {
        display: none;
    }

    .player-modal {
        padding: 10px;
    }

    .player-modal-content {
        max-height: 94vh;
        padding: 22px;
    }

    .player-modal-actions {
        flex-direction: column;
    }

    .player-modal-trends { grid-template-columns: 1fr; }
}


/* Keitimų puslapyje žaidėjo informacija paliekama trumpa ir orientuota į pasirinkimą. */
body[data-mode="transfers"] .player-current-stats-section,
body[data-mode="transfers"] .player-points-history-section { display: none !important; }
.player-modal-avatar { width: 72px; height: 72px; }
.player-modal-avatar > span { display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 50%; }
.player-modal-avatar img { object-fit: cover; object-position: center top; transform: scale(1.55); transform-origin: center 8%; }

/* Give the transfers workspace more breathing room on desktop. */
@media (min-width: 1281px) {
    body[data-mode="transfers"] .fantasy-layout {
        grid-template-columns: minmax(360px, 38fr) minmax(620px, 62fr);
    }
    body[data-mode="transfers"] .transfer-toolbar {
        grid-template-columns: minmax(205px, .36fr) minmax(0, 1fr);
        gap: 14px;
        padding: 12px 15px;
    }
    body[data-mode="transfers"] .transfer-settings-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(54px, auto));
        gap: 9px;
    }
    body[data-mode="transfers"] .transfer-settings-grid .transfer-cost-panel {
        grid-column: 3 / 5;
        grid-row: 1;
        padding: 8px;
    }
    body[data-mode="transfers"] .transfer-settings-grid .transfer-toolbar-footer {
        grid-column: 3 / 5;
        grid-row: 2;
        gap: 9px;
    }
    body[data-mode="transfers"] .transfer-chip {
        min-height: 54px;
        padding: 7px 9px;
    }
    body[data-mode="transfers"] .transfer-chip strong { font-size: 11px; }
    body[data-mode="transfers"] .transfer-chip small { font-size: 9px; }
    body[data-mode="transfers"] .transfer-cost-panel span { font-size: 9px; }
    body[data-mode="transfers"] .transfer-cost-panel strong { font-size: 15px; }
    body[data-mode="transfers"] .transfer-toolbar-footer .team-name-input,
    body[data-mode="transfers"] .transfer-toolbar-footer .save-button {
        height: 44px;
        min-height: 44px;
    }
    body[data-mode="transfers"] .transfer-toolbar-footer .save-button {
        padding: 0 12px;
        font-size: 12px;
    }
}


/* Keep the undo action with the player controls instead of using a full toolbar row. */
body[data-mode="transfers"] .panel-header .transfer-undo-button {
    grid-column: auto;
    justify-self: auto;
    flex: 0 0 auto;
    margin-left: auto;
    padding: 7px 9px;
    font-size: 9px;
    white-space: nowrap;
}

/* On narrow screens the transfer view stacks above the pitch. Keep the pitch
   portrait-oriented and scale shirts/cards to five across without collisions. */
@media (max-width: 600px) {
    html,
    body {
        height: auto;
        min-height: 100%;
    }

    body[data-mode="transfers"] .fantasy-layout {
        height: auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: visible;
    }

    body[data-mode="transfers"] .players-panel {
        height: clamp(340px, 48vh, 420px);
        min-height: 340px;
        flex: 0 0 auto;
        padding: 10px 12px;
    }

    body[data-mode="transfers"] .filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 8px;
    }

    body[data-mode="transfers"] .filters select {
        min-width: 0;
        height: 34px;
        padding: 0 6px;
        font-size: 11px;
    }

    body[data-mode="transfers"] .players-list {
        min-height: 100px;
        padding-right: 2px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    body[data-mode="transfers"] .pitch-panel {
        height: auto;
        min-height: 0;
        flex: 0 0 auto;
        gap: 10px;
        padding: 10px 12px 14px;
        overflow: visible;
    }

    body[data-mode="transfers"] .football-pitch {
        width: 100%;
        min-height: 390px;
        max-height: 540px;
        flex: 0 0 auto;
        aspect-ratio: .82 / 1;
    }

    body[data-mode="transfers"] .pitch-players {
        --u: clamp(6px, 1.7vw, 7px);
    }

    body[data-mode="transfers"] .pitch-gk { top: 10%; }
    body[data-mode="transfers"] .pitch-def { top: 30%; }
    body[data-mode="transfers"] .pitch-mid { top: 52%; }
    body[data-mode="transfers"] .pitch-att { top: 75%; }

    body[data-mode="transfers"] .pitch-player {
        width: clamp(56px, 16.5vw, 70px);
        padding: 0;
    }

    body[data-mode="transfers"] .pitch-player-avatar.is-kit {
        height: clamp(46px, 13vw, 56px);
    }

    body[data-mode="transfers"] .pitch-player.shirt-kit-player .pitch-player-name {
        min-height: 1.8em;
        margin-top: -5px;
        padding: 2px 3px;
        font-size: 8px;
    }

    body[data-mode="transfers"] .pitch-player.shirt-kit-player .pitch-player-fixture {
        padding: 2px 3px;
        font-size: 7px;
    }

    body[data-mode="transfers"] .bench {
        flex: 0 0 auto;
    }

    body[data-mode="lineup"] .lineup-sidebar {
        height: auto;
        max-height: none;
        padding: 10px 12px;
        overflow: visible;
    }

    body[data-mode="lineup"] .lineup-sidebar .lineup-fixtures-card {
        min-height: 150px;
        max-height: 220px;
        flex: 0 1 auto;
    }

    body[data-mode="lineup"] .lineup-sidebar .lineup-fixtures-list {
        min-height: 0;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }

    body[data-mode="lineup"] .lineup-sidebar .lineup-fixture {
        min-width: 160px;
    }

    body[data-mode="lineup"] .pitch-panel,
    body[data-mode="team"] .pitch-panel {
        height: auto;
        min-height: 0;
        flex: 0 0 auto;
        gap: 10px;
        padding: 10px 12px 14px;
        overflow: visible;
    }

    body[data-mode="lineup"] .football-pitch,
    body[data-mode="team"] .football-pitch {
        width: 100%;
        min-height: 390px;
        max-height: 540px;
        flex: 0 0 auto;
        aspect-ratio: .82 / 1;
    }

    body[data-mode="lineup"] .pitch-players,
    body[data-mode="team"] .pitch-players {
        --u: clamp(6px, 1.7vw, 7px);
    }

    body[data-mode="lineup"] .pitch-gk,
    body[data-mode="team"] .pitch-gk { top: 10%; }
    body[data-mode="lineup"] .pitch-def,
    body[data-mode="team"] .pitch-def { top: 30%; }
    body[data-mode="lineup"] .pitch-mid,
    body[data-mode="team"] .pitch-mid { top: 52%; }
    body[data-mode="lineup"] .pitch-att,
    body[data-mode="team"] .pitch-att { top: 75%; }

    body[data-mode="lineup"] .pitch-player,
    body[data-mode="team"] .pitch-player {
        width: clamp(56px, 16.5vw, 70px);
        padding: 0;
    }

    body[data-mode="lineup"] .pitch-player-avatar.is-kit,
    body[data-mode="team"] .pitch-player-avatar.is-kit {
        height: clamp(46px, 13vw, 56px);
    }

    body[data-mode="lineup"] .pitch-player.shirt-kit-player .pitch-player-name,
    body[data-mode="team"] .pitch-player.shirt-kit-player .pitch-player-name {
        min-height: 1.8em;
        margin-top: -5px;
        padding: 2px 3px;
        font-size: 8px;
    }

    body[data-mode="lineup"] .pitch-player.shirt-kit-player .pitch-player-fixture,
    body[data-mode="team"] .pitch-player.shirt-kit-player .pitch-player-fixture {
        padding: 2px 3px;
        font-size: 7px;
    }

    body[data-mode="team"] .team-side {
        max-height: none;
        padding: 10px 12px;
    }
}

/* Reorder content on phones while keeping the desktop layout untouched. */
@media (max-width: 600px) {
    body[data-mode="transfers"] .pitch-panel {
        display: contents;
    }

    body[data-mode="transfers"] .transfer-toolbar {
        order: 1;
        margin: 10px 12px;
    }

    body[data-mode="transfers"] .players-panel {
        order: 2;
        width: auto;
        margin: 0 12px 10px;
    }

    body[data-mode="transfers"] .football-pitch {
        order: 3;
        width: calc(100% - 24px);
        max-width: none;
        box-sizing: border-box;
        margin: 0 12px 10px;
        align-self: stretch;
    }

    body[data-mode="transfers"] .bench {
        order: 4;
        margin: 0 12px 14px;
    }

    body[data-mode="team"] .fantasy-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    body[data-mode="team"] .team-side {
        display: contents;
    }

    body[data-mode="team"] .gw-summary {
        order: 1;
        margin: 10px 12px 0;
    }

    body[data-mode="team"] .pitch-panel {
        order: 2;
        width: 100%;
    }

    body[data-mode="team"] .side-duo {
        order: 3;
        margin: 0 12px;
    }

    body[data-mode="team"] .team-results-card {
        order: 4;
        margin: 0 12px;
    }

    body[data-mode="team"] .team-league-card {
        order: 5;
        margin: 0 12px 14px;
    }
}

/* Keep the custom 1600×1000 field artwork proportional at every viewport. */
body[data-mode="transfers"] .football-pitch,
body[data-mode="lineup"] .football-pitch,
body[data-mode="team"] .football-pitch {
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    max-width: none;
    flex: 0 0 auto !important;
    align-self: stretch;
    aspect-ratio: 8 / 5 !important;
    background-size: 100% 100%;
}

@media (max-width: 900px) {
    body[data-mode="transfers"] .football-pitch,
    body[data-mode="lineup"] .football-pitch,
    body[data-mode="team"] .football-pitch {
        width: 100%;
        max-width: none;
        flex: 0 0 auto !important;
    }
}

@media (max-width: 600px) {
    body[data-mode="transfers"] .football-pitch {
        width: calc(100% - 24px);
        margin: 0 12px 10px;
        align-self: stretch;
    }

    body[data-mode="transfers"] .pitch-gk,
    body[data-mode="lineup"] .pitch-gk,
    body[data-mode="team"] .pitch-gk { top: 11%; }
    body[data-mode="transfers"] .pitch-def,
    body[data-mode="lineup"] .pitch-def,
    body[data-mode="team"] .pitch-def { top: 35%; }
    body[data-mode="transfers"] .pitch-mid,
    body[data-mode="lineup"] .pitch-mid,
    body[data-mode="team"] .pitch-mid { top: 62%; }
    body[data-mode="transfers"] .pitch-att,
    body[data-mode="lineup"] .pitch-att,
    body[data-mode="team"] .pitch-att { top: 86%; }
    body[data-mode="transfers"] .pitch-player-avatar.is-kit,
    body[data-mode="lineup"] .pitch-player-avatar.is-kit,
    body[data-mode="team"] .pitch-player-avatar.is-kit { height: clamp(26px, 8.2vw, 34px); }
}


/* Keep transfers scrollable so the complete pitch and bench stay reachable. */
@media (min-width: 901px) {
    body[data-mode="transfers"] {
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
    }
    body[data-mode="transfers"] .fantasy-layout {
        height: auto;
        min-height: calc(100vh - var(--fantasy-header-height, 72px));
        align-items: start;
        overflow: visible;
    }
    body[data-mode="transfers"] .players-panel {
        height: calc(100vh - var(--fantasy-header-height, 72px));
        align-self: start;
    }
    body[data-mode="transfers"] .pitch-panel {
        height: auto;
        min-height: calc(100vh - var(--fantasy-header-height, 72px));
        overflow: visible;
    }
}


/* Let the lineup page scroll so the pitch and bench are never clipped. */
@media (min-width: 901px) {
    body[data-mode="lineup"] {
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
    }
    body[data-mode="lineup"] .fantasy-layout {
        height: auto;
        min-height: calc(100vh - var(--fantasy-header-height, 72px));
        align-items: start;
        overflow: visible;
    }
    body[data-mode="lineup"] .lineup-sidebar {
        height: calc(100vh - var(--fantasy-header-height, 72px));
        align-self: start;
    }
    body[data-mode="lineup"] .pitch-panel {
        height: auto;
        min-height: calc(100vh - var(--fantasy-header-height, 72px));
        overflow: visible;
    }
}
