/**
 * FHL Live Match Workspace
 *
 * Structural layout - initial development stage
 */


/* ==========================================================
   WORKSPACE
   ========================================================== */

.fh-live-match-workspace {
    width: 100%;
    box-sizing: border-box;
}


/* ==========================================================
   MAIN TWO-COLUMN LAYOUT
   ========================================================== */

.fh-live-match-layout {
    width: 100%;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        360px;

    gap: 8px;

    align-items: stretch;

    box-sizing: border-box;
}


/* ==========================================================
   LEFT COLUMN
   ========================================================== */

.fh-live-match-main {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 8px;

    box-sizing: border-box;
}


/* ==========================================================
   HEADER
   ========================================================== */

.fh-live-match-header {
    width: 100%;
}

.fh-live-match-event-tracker-strip {
    width: 100%;
    min-width: 0;
}

.fh-live-event-tracker {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #273540;
    border-radius: 7px;
    background: linear-gradient(180deg, #101a22 0%, #0b1117 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 2px 8px rgba(0, 0, 0, 0.18);
    color: #f4f7f9;
    overflow: hidden;
}

.fh-live-event-tracker-strip .fh-live-event-tracker {
    display: grid;
    grid-template-columns: 88px minmax(140px, 220px) minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
    min-height: 54px;
    padding: 8px 12px;
    border-top: 1px solid rgba(242, 195, 0, 0.28);
}

.fh-live-event-tracker-title {
    color: #f2c300;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.22px;
    text-transform: uppercase;
    white-space: nowrap;
}

.fh-live-event-tracker-schematic {
    min-width: 0;
}

.fh-live-event-tracker-pitch {
    position: relative;
    display: block;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    background: #1a6b3c;
    overflow: hidden;
}

.fh-live-event-tracker-half,
.fh-live-event-tracker-midline {
    position: absolute;
    top: 0;
    bottom: 0;
}

.fh-live-event-tracker-half-home {
    left: 0;
    width: 50%;
}

.fh-live-event-tracker-half-away {
    right: 0;
    width: 50%;
}

.fh-live-event-tracker-midline {
    left: 50%;
    width: 1px;
    background: rgba(255, 255, 255, 0.35);
    transform: translateX(-50%);
}

.fh-live-event-tracker-ball {
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: #f2c300;
    box-shadow: 0 0 0 2px rgba(242, 195, 0, 0.25);
    left: 50%;
}

.fh-live-event-tracker-schematic[data-zone="home"] .fh-live-event-tracker-ball {
    left: 22%;
}

.fh-live-event-tracker-schematic[data-zone="away"] .fh-live-event-tracker-ball {
    left: 78%;
}

.fh-live-event-tracker-carrier {
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 7px;
    font-weight: 800;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

.fh-live-event-tracker-schematic[data-zone="home"] .fh-live-event-tracker-carrier {
    left: 22%;
}

.fh-live-event-tracker-schematic[data-zone="away"] .fh-live-event-tracker-carrier {
    left: 78%;
}

.fh-live-event-tracker-meta {
    min-width: 0;
}

.fh-live-event-tracker-headline {
    overflow: hidden;
    color: #e9eef1;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fh-live-event-tracker-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
}

.fh-live-event-tracker-chip {
    display: inline-flex;
    align-items: center;
    min-height: 16px;
    padding: 2px 7px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    color: #c8d0d6;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.12px;
    text-transform: uppercase;
}

.fh-live-event-tracker-chip-phase {
    color: #f2c300;
    border: 1px solid rgba(242, 195, 0, 0.28);
    background: rgba(242, 195, 0, 0.08);
}

.fh-live-event-tracker-chip-last {
    color: #fff;
}

.fh-live-event-tracker-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 0 auto;
    padding: 8px;
}

.fh-live-event-tracker-panel .fh-live-event-tracker-pitch {
    height: 46px;
}

.fh-live-event-tracker-panel .fh-live-event-tracker-headline {
    font-size: 9px;
    white-space: normal;
    line-height: 1.25;
}

.fh-live-event-tracker-recent {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.fh-live-event-tracker-recent-item {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    color: #9aa6ad;
    font-size: 8px;
    font-weight: 700;
}

.fh-live-event-tracker-recent-item span:last-child {
    color: #f2c300;
}


/* ==========================================================
   MATCH HEADER CARD
   ========================================================== */

.fh-live-match-header-card {
    width: 100%;
    box-sizing: border-box;

    background: #111a22;

    border: 1px solid #273540;
    border-radius: 6px;

    overflow: hidden;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.18);

    color: #ffffff;
}


/* ==========================================================
   HEADER CONTEXT
   ========================================================== */

.fh-live-match-header-context {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    padding: 10px 14px;

    box-sizing: border-box;

    border-bottom: 1px solid #273540;

    background: #151f28;
}


.fh-live-match-header-context-main {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 9px;
}


/* ==========================================================
   MATCH STATUS
   ========================================================== */

.fh-live-match-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 22px;

    padding: 3px 9px;

    border-radius: 4px;

    font-size: 9px;
    font-weight: 800;

    letter-spacing: 0.05em;

    white-space: nowrap;

    text-transform: uppercase;
}


.fh-live-match-status-live {
    background: #e53935;
    color: #ffffff;
    box-shadow: 0 0 0 1px rgba(229, 57, 53, 0.55), 0 0 10px rgba(229, 57, 53, 0.35);
    animation: fh-live-status-pulse 1.6s ease-in-out infinite;
}

@keyframes fh-live-status-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 1px rgba(229, 57, 53, 0.55), 0 0 8px rgba(229, 57, 53, 0.28);
    }
    50% {
        box-shadow: 0 0 0 1px rgba(229, 57, 53, 0.85), 0 0 14px rgba(229, 57, 53, 0.55);
    }
}


.fh-live-match-status-programmata {
    background: #263542;
    color: #cbd2d7;
}


.fh-live-match-status-terminata {
    background: #263542;
    color: #cbd2d7;
}


/* ==========================================================
   COMPETITION
   ========================================================== */

.fh-live-match-competition {
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: #f3b400;

    font-size: 11px;
    font-weight: 700;
}


.fh-live-match-matchday {
    color: #89959d;

    font-size: 10px;
    font-weight: 600;

    white-space: nowrap;
}


.fh-live-match-date {
    flex: 0 0 auto;

    color: #89959d;

    font-size: 9px;
    font-weight: 600;

    white-space: nowrap;
}


/* ==========================================================
   SCOREBOARD
   ========================================================== */

.fh-live-match-scoreboard {
    width: 100%;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto
        minmax(0, 1fr);

    align-items: center;

    gap: 24px;

    padding: 18px 20px;

    box-sizing: border-box;
}


/* ==========================================================
   SCOREBOARD TEAM
   ========================================================== */

.fh-live-match-scoreboard .fh-live-match-team {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 12px;
}


/* ==========================================================
   HOME TEAM - HEADER ONLY
   ========================================================== */

.fh-live-match-scoreboard .fh-live-match-team-home {
    justify-content: flex-end;
    text-align: right;
}


/* ==========================================================
   AWAY TEAM - HEADER ONLY
   ========================================================== */

.fh-live-match-scoreboard .fh-live-match-team-away {
    justify-content: flex-start;
    text-align: left;
}


/* ==========================================================
   TEAM CONTENT
   ========================================================== */

.fh-live-match-scoreboard .fh-live-match-team-content {
    min-width: 0;
}


.fh-live-match-scoreboard .fh-live-match-team-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: #f1f3f4;

    font-size: 18px;
    font-weight: 700;

    line-height: 1.15;
}


.fh-live-match-scoreboard .fh-live-match-team-manager {
    margin-top: 4px;

    color: #89959d;

    font-size: 9px;
    line-height: 1.2;
}


.fh-live-match-scoreboard .fh-live-match-team-manager-label {
    margin-right: 4px;

    color: #65737d;

    font-size: 8px;
    font-weight: 600;

    text-transform: uppercase;
}


.fh-live-match-scoreboard .fh-live-match-team-manager strong {
    color: #cbd2d7;

    font-weight: 600;
}


/* ==========================================================
   TEAM LOGO
   ========================================================== */

.fh-live-match-scoreboard .fh-live-match-team-logo {
    width: 58px;
    height: 58px;

    flex: 0 0 58px;

    display: flex;
    align-items: center;
    justify-content: center;
}


.fh-live-match-scoreboard .fh-live-match-team-logo img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
}


/* ==========================================================
   SCORE
   ========================================================== */

.fh-live-match-score {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    min-width: 96px;

    color: #ffffff;

    font-size: 32px;
    font-weight: 900;

    line-height: 1;
}


.fh-live-match-score-separator {
    color: #89959d;

    font-size: 24px;
    font-weight: 600;
}


.fh-live-match-score-home,
.fh-live-match-score-away {
    min-width: 30px;

    text-align: center;
}


/* ==========================================================
   HEADER RESPONSIVE
   STEP 73.55 — MOBILE TEAM STACK
   Ordine mobile: LOGO → NOME SQUADRA → MANAGER
   ========================================================== */

@media (max-width: 700px) {

    /* ------------------------------------------------------
       HEADER CONTEXT
       ------------------------------------------------------ */

    .fh-live-match-header-context {
        align-items: flex-start;
        flex-direction: column;

        gap: 7px;
    }


    .fh-live-match-header-context-main {
        width: 100%;

        flex-wrap: wrap;
    }


    /* ------------------------------------------------------
       SCOREBOARD
       ------------------------------------------------------ */

    .fh-live-match-scoreboard {
        grid-template-columns:
            minmax(0, 1fr)
            68px
            minmax(0, 1fr);

        column-gap: 4px;
        row-gap: 0;

        padding: 16px 8px 18px;

        align-items: start;
    }


    /* ------------------------------------------------------
       TEAM BLOCK
       ------------------------------------------------------ */

    .fh-live-match-scoreboard .fh-live-match-team {
        min-width: 0;
        width: 100%;

        display: flex;
        flex-direction: column;

        align-items: center;
        justify-content: flex-start;

        gap: 0;

        text-align: center;
    }


    .fh-live-match-scoreboard .fh-live-match-team-home,
    .fh-live-match-scoreboard .fh-live-match-team-away {
        justify-content: flex-start;
        align-items: center;

        text-align: center;
    }


    .fh-live-match-scoreboard .fh-live-match-team-home,
    .fh-live-match-scoreboard .fh-live-match-team-away {
        overflow: visible;
    }


    /* ------------------------------------------------------
       LOGO
       ------------------------------------------------------ */

    .fh-live-match-scoreboard .fh-live-match-team-logo {
        order: 1;

        width: 42px;
        height: 50px;

        flex: 0 0 50px;

        display: flex;
        align-items: center;
        justify-content: center;

        margin: 0 auto 5px;
    }


    .fh-live-match-scoreboard .fh-live-match-team-logo img {
        display: block;

        width: 42px;
        height: 50px;

        object-fit: contain;
    }


    /* ------------------------------------------------------
       TEAM CONTENT
       ------------------------------------------------------ */

    .fh-live-match-scoreboard .fh-live-match-team-content {
        order: 2;

        width: auto;
        max-width: 100%;
        min-width: 0;

        display: flex;
        flex-direction: column;

        align-items: center;
        justify-content: flex-start;

        text-align: center;
    }


    /* ------------------------------------------------------
       TEAM NAME
       ------------------------------------------------------ */

    .fh-live-match-scoreboard .fh-live-match-team-name {
        order: 1;

        display: block;

        width: 100%;
        max-width: 100%;
        min-width: 0;

        /*
         * Mobile: il nome deve restare su una sola riga
         * quando entra nello spazio disponibile.
         * Nessuna ellissi e nessun troncamento.
         */
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: nowrap !important;

        overflow-wrap: normal;
        word-break: normal;

        color: #f1f3f4;

        font-size: 10px;
        font-weight: 800;

        line-height: 1.15;

        letter-spacing: -0.15px;

        text-align: center;
    }


    /* ------------------------------------------------------
       MANAGER
       ------------------------------------------------------ */

    .fh-live-match-scoreboard .fh-live-match-team-manager {
        order: 2;

        width: 100%;
        min-width: 0;

        margin-top: 4px;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;

        color: #89959d;

        font-size: 7px;
        line-height: 1.2;

        text-align: center;
    }


    .fh-live-match-scoreboard .fh-live-match-team-manager-label {
        margin-right: 2px;

        color: #65737d;

        font-size: 6px;
        font-weight: 600;

        text-transform: uppercase;
    }


    .fh-live-match-scoreboard .fh-live-match-team-manager strong {
        color: #cbd2d7;

        font-size: 7px;
        font-weight: 600;
    }


    /* ------------------------------------------------------
       SCORE
       ------------------------------------------------------ */

    .fh-live-match-score {
        order: 0;

        min-width: 68px;
        width: 68px;

        display: flex;
        align-items: center;
        justify-content: center;

        gap: 4px;

        margin: 0;

        color: #ffffff;

        font-size: 26px;
        font-weight: 900;

        line-height: 1;
    }


    .fh-live-match-score-separator {
        color: #89959d;

        font-size: 21px;
        font-weight: 600;
    }


    .fh-live-match-score-home,
    .fh-live-match-score-away {
        min-width: 21px;

        text-align: center;
    }


    /* ------------------------------------------------------
       RUNTIME
       ------------------------------------------------------ */

    .fh-live-match-scoreboard .fh-live-match-runtime {
        margin-top: 7px;

        text-align: center;
    }


    .fh-live-match-scoreboard .fh-live-match-runtime-time {
        font-size: 17px;

        line-height: 1;
    }


    .fh-live-match-scoreboard .fh-live-match-runtime-period {
        font-size: 10px;

        line-height: 1.2;
    }

}


/* ==========================================================
   LIVE MATCH CORE
   ========================================================== */

.fh-live-match-core {
    width: 100%;
    min-width: 0;
}


/* ==========================================================
   LIVE PITCH COMPOSITE
   ========================================================== */

.fh-live-match-pitch-widget {
    width: 100%;
    min-width: 0;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        180px
        minmax(0, 1fr);

    gap: 8px;

    box-sizing: border-box;
}


/* ==========================================================
   HOME FORMATION
   ========================================================== */

.fh-live-match-pitch-widget .fh-live-match-team-home {
    min-width: 0;
    min-height: 560px;
}


/* ==========================================================
   HOME FORMATION CARD
   ========================================================== */

.fh-live-match-formation-card {
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;

    box-sizing: border-box;

    overflow: hidden;

    background: #111a22;

    border: 1px solid #273540;
    border-radius: 6px;

    color: #ffffff;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.16);
}


/* ==========================================================
   FORMATION HEADER
   ========================================================== */

.fh-live-match-formation-header {
    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    min-height: 42px;

    padding: 9px 12px;

    box-sizing: border-box;

    background: #151f28;

    border-bottom: 1px solid #273540;
}


.fh-live-match-formation-title {
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: #ffffff;

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.02em;

    text-transform: uppercase;
}


.fh-live-match-formation-title::first-line {
    color: #ffffff;
}


.fh-live-match-formation-status {
    flex: 0 0 auto;

    padding: 3px 7px;

    border-radius: 4px;

    background: #263542;

    color: #89959d;

    font-size: 8px;
    font-weight: 700;

    letter-spacing: 0.04em;

    text-transform: uppercase;
}


/* ==========================================================
   LIVE TACTICAL PITCH
   ========================================================== */

.fh-live-match-tactical-pitch {
    position: relative;

    width: 100%;

    flex: 1 1 auto;

    min-height: 0;

    overflow: hidden;

    background: #05080a;

    box-sizing: border-box;
}


.fh-live-match-tactical-pitch-background {
    display: block;

    width: 100%;
    height: auto;

    max-width: 100%;

    position: relative;

    z-index: 1;
}


.fh-live-match-tactical-pitch-players {
    position: absolute;

    inset: 0;

    z-index: 2;

    pointer-events: none;
}


.fh-live-match-pitch-player {
    position: absolute;

    width: 58px;

    transform: translate(-50%, -50%);

    display: flex;

    flex-direction: column;

    align-items: center;

    text-align: center;

    pointer-events: none;

    line-height: 1;
}


.fh-live-match-pitch-player-marker {
    width: 28px;
    height: 28px;

    display: flex;

    align-items: center;
    justify-content: center;

    box-sizing: border-box;

    border: 2px solid #ffffff;

    border-radius: 50%;

    background: #b21f24;

    box-shadow:
        0 2px 5px rgba(0, 0, 0, 0.45);
}


.fh-live-match-pitch-player-marker-role {
    color: #ffffff;

    font-size: 7px;

    font-weight: 800;

    letter-spacing: 0.02em;

    text-transform: uppercase;
}


.fh-live-match-pitch-player-name {
    max-width: 70px;

    margin-top: 3px;

    padding: 2px 4px;

    box-sizing: border-box;

    border-radius: 3px;

    background: rgba(0, 0, 0, 0.72);

    color: #ffffff;

    font-size: 8px;

    font-weight: 700;

    line-height: 1.1;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


.fh-live-match-formation-module {
    flex: 0 0 auto;

    color: #cbd2d7;

    font-size: 10px;

    font-weight: 700;

    white-space: nowrap;
}


/* ==========================================================
   FORMATION PLAYERS
   ========================================================== */

.fh-live-match-formation-players {
    flex: 1 1 auto;

    min-height: 0;

    display: flex;
    flex-direction: column;

    gap: 4px;

    padding: 8px;

    box-sizing: border-box;

    overflow-y: auto;

    scrollbar-width: thin;
    scrollbar-color: #354653 transparent;
}


.fh-live-match-formation-players::-webkit-scrollbar {
    width: 5px;
}


.fh-live-match-formation-players::-webkit-scrollbar-track {
    background: transparent;
}


.fh-live-match-formation-players::-webkit-scrollbar-thumb {
    background: #354653;
    border-radius: 4px;
}


/* ==========================================================
   FORMATION PLAYER ROW
   ========================================================== */

.fh-live-match-formation-player {
    flex: 0 0 auto;

    display: flex;
    align-items: center;

    min-height: 36px;

    padding: 5px 7px;

    box-sizing: border-box;

    background: #0d161e;

    border: 1px solid #202f3a;
    border-radius: 4px;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}


.fh-live-match-formation-player:hover {
    background: #151f28;

    border-color: #354653;
}


/* ==========================================================
   PLAYER NUMBER / ORDER
   ========================================================== */

.fh-live-match-formation-player-number {
    width: 23px;
    height: 23px;

    flex: 0 0 23px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-right: 8px;

    border-radius: 50%;

    background: #1c2a34;

    color: #f3b400;

    font-size: 9px;
    font-weight: 800;
}


/* ==========================================================
   PLAYER INFO
   ========================================================== */

.fh-live-match-formation-player-info {
    min-width: 0;

    flex: 1 1 auto;
}


.fh-live-match-formation-player-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: #f1f3f4;

    font-size: 10px;
    font-weight: 700;

    line-height: 1.2;
}


.fh-live-match-formation-player-position {
    margin-top: 2px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: #74838d;

    font-size: 8px;
    font-weight: 600;

    line-height: 1.2;

    text-transform: uppercase;
}


.fh-live-match-formation-player-position span {
    color: #65737d;
}


/* ==========================================================
   EMPTY FORMATION
   ========================================================== */

.fh-live-match-formation-empty {
    flex: 1 1 auto;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    color: #65737d;

    font-size: 10px;
    font-weight: 600;

    text-align: center;
}


/* ==========================================================
   LIVE STATS
   ========================================================== */

.fh-live-match-pitch-widget .fh-live-match-stats {
    min-width: 0;
    min-height: 560px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fh-live-match-pitch-widget .fh-live-match-stats .fh-live-match-live-stats {
    flex: 1 1 auto;
    min-height: 0;
}


/* ==========================================================
   AWAY FORMATION
   ========================================================== */

.fh-live-match-pitch-widget .fh-live-match-team-away {
    min-width: 0;
    min-height: 560px;
}


/* ==========================================================
   LOWER PANELS
   ========================================================== */

.fh-live-match-lower-panels {
    width: 100%;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1.45fr)
        minmax(0, 1.45fr)
        minmax(0, 1fr);

    gap: 8px;

    box-sizing: border-box;
}


.fh-live-match-lower-panels > div {
    min-width: 0;
    height: 150px;
}


/* ==========================================================
   RIGHT COLUMN
   ========================================================== */

.fh-live-match-sidebar {
    min-width: 0;

    display: grid;

    /*
     * La sidebar parte dall'alto insieme al Match Header.
     * La cronaca occupa la maggior parte dello spazio.
     */
    grid-template-rows:
        minmax(0, 1fr)
        125px
        90px;

    gap: 8px;

    box-sizing: border-box;
}


/* ==========================================================
   LIVE COMMENTARY
   ========================================================== */

.fh-live-match-commentary {
    width: 100%;
    min-height: 0;
}


/* ==========================================================
   DETAILED STATS
   ========================================================== */

.fh-live-match-detailed-stats {
    width: 100%;
    min-height: 0;
}


/* ==========================================================
   MATCH INFO
   ========================================================== */

.fh-live-match-info {
    width: 100%;
    min-height: 0;
}


/* ==========================================================
   GENERIC WIDGET CARD SAFETY
   ========================================================== */

.fh-live-match-commentary,
.fh-live-match-detailed-stats,
.fh-live-match-info,
.fh-live-match-lower-panels > div {
    min-width: 0;
    box-sizing: border-box;
}


/* ==========================================================
   GENERIC PLACEHOLDER
   ========================================================== */

.fh-live-match-widget-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;

    padding: 16px;

    border: 1px dashed #3a4954;
    border-radius: 5px;

    background: #111a22;

    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;

    color: #89959d;
}


/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 1100px) {

    .fh-live-match-layout {
        grid-template-columns: 1fr;
    }


    .fh-live-match-sidebar {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr)
            minmax(0, 1fr);

        grid-template-rows: 180px;

        gap: 8px;
    }

}


@media (max-width: 800px) {

    .fh-live-match-pitch-widget {
        grid-template-columns: 1fr;
    }


    .fh-live-match-pitch-widget .fh-live-match-team-home,
    .fh-live-match-pitch-widget .fh-live-match-stats,
    .fh-live-match-pitch-widget .fh-live-match-team-away {
        min-height: 480px;
        height: auto;
    }


    .fh-live-match-lower-panels {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr);
    }


    .fh-live-match-lower-panels > div {
        height: 140px;
    }


    .fh-live-match-sidebar {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr);
    }

}


@media (max-width: 500px) {

    .fh-live-match-pitch-widget {
        grid-template-columns: 1fr;
    }


    .fh-live-match-pitch-widget .fh-live-match-team-home,
    .fh-live-match-pitch-widget .fh-live-match-stats,
    .fh-live-match-pitch-widget .fh-live-match-team-away {
        min-height: 400px;
        height: auto;
    }


    .fh-live-match-lower-panels {
        grid-template-columns: 1fr;
    }


    .fh-live-match-lower-panels > div {
        height: 120px;
    }


    .fh-live-match-sidebar {
        grid-template-columns: 1fr;
        grid-template-rows: 180px 120px 100px;
    }


    .fh-live-match-formation-header {
        min-height: 38px;

        padding: 8px 10px;
    }


    .fh-live-match-formation-title {
        font-size: 10px;
    }


    .fh-live-match-pitch-player {
        width: 52px;
    }


    .fh-live-match-pitch-player-marker {
        width: 25px;
        height: 25px;
    }


    .fh-live-match-pitch-player-name {
        max-width: 64px;
        font-size: 7px;
    }


    .fh-live-match-formation-player {
        min-height: 34px;

        padding: 4px 6px;
    }


    .fh-live-match-formation-player-number {
        width: 21px;
        height: 21px;

        flex-basis: 21px;

        margin-right: 6px;
    }


    .fh-live-match-formation-player-name {
        font-size: 9px;
    }

}

/* ==========================================================
   PLAYER MARKER + PLAYER NAME — FINAL ADJUSTMENT
   ========================================================== */

.fh-live-match-pitch-player {
    width: 72px;
}

.fh-live-match-pitch-player-marker {
    width: 24px;
    height: 24px;
}

.fh-live-match-pitch-player-marker-role {
    font-size: 9px;
}

.fh-live-match-pitch-player-name {
    max-width: 86px;
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.1;
}


/* ==========================================================
   MOBILE — KEEP THE SAME VISUAL PROPORTION
   ========================================================== */

@media (max-width: 500px) {

    .fh-live-match-pitch-player {
        width: 64px;
    }

    .fh-live-match-pitch-player-marker {
        width: 22px;
        height: 22px;
    }

    .fh-live-match-pitch-player-marker-role {
        font-size: 8px;
    }

    .fh-live-match-pitch-player-name {
        max-width: 78px;
        font-size: 10px;
    }
}


/* ==========================================================
   FHL LIVE PLAYERS — HEIGHT V2
   STEP 68.1 — ONLY LIVE PLAYER WIDGET CONTAINERS
   ========================================================== */

/*
 * The two LIVE PLAYER widgets are wrapped by:
 * .fh-live-match-unavailable-home
 * .fh-live-match-unavailable-away
 *
 * The original lower-panel rule fixes every grid child at 150px.
 * Therefore the height must be applied to these two specific
 * widget containers as well as to their internal widget root.
 *
 * No other lower-panel, sidebar, commentary or widget selector
 * is changed here.
 */

.fh-live-match-lower-panels > .fh-live-match-unavailable-home,
.fh-live-match-lower-panels > .fh-live-match-unavailable-away {
    height: 640px;
    min-height: 640px;
    max-height: 640px;
    overflow: visible;
    align-self: start;
}

.fh-live-match-unavailable-home .fh-live-match-player-status-home,
.fh-live-match-unavailable-away .fh-live-match-player-status-away {
    width: 100%;
    height: 640px;
    min-height: 640px;
    max-height: 640px;
    overflow: hidden;
    box-sizing: border-box;
}

.fh-live-match-unavailable-home .fh-unavailable-content,
.fh-live-match-unavailable-away .fh-unavailable-content {
    overflow: hidden;
    min-height: 0;
}

.fh-live-match-unavailable-home .fh-live-player-list,
.fh-live-match-unavailable-away .fh-live-player-list {
    overflow: hidden;
}

.fh-live-match-unavailable-home .fh-live-player,
.fh-live-match-unavailable-away .fh-live-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px 32px;
    column-gap: 6px;
    align-items: center;
    height: 31px;
    min-height: 31px;
    padding: 3px 6px;
    box-sizing: border-box;
}

.fh-live-match-unavailable-home .fh-live-player-avatar,
.fh-live-match-unavailable-away .fh-live-player-avatar {
    flex: 0 0 23px;
    width: 23px;
    height: 23px;
}


/* ==========================================================
   STEP 73.61 — MOBILE LOWER PANELS / BENCH CORRECTION
   ==========================================================
   The bench widgets are rendered inside:
       .fh-live-match-lower-panels
   and NOT inside:
       .fh-live-match-sidebar
   ========================================================== */

@media (max-width: 500px) {

    /*
     * The mobile base CSS assigns fixed heights to every
     * lower-panel wrapper. That is the direct cause of the
     * bench cards being clipped/overlapped by the next widget.
     *
     * On mobile the lower panels must stack vertically and
     * each wrapper must take the real height of its content.
     */
    .fh-live-match-lower-panels {
        display: grid !important;

        grid-template-columns: minmax(0, 1fr) !important;

        grid-template-rows: none !important;

        grid-auto-rows: max-content !important;

        gap: 8px !important;

        width: 100%;

        height: auto !important;

        min-height: 0 !important;

        align-items: start !important;
    }


    /*
     * Neutralize the existing:
     *
     * .fh-live-match-lower-panels > div {
     *     height: 120px;
     * }
     *
     * so the bench wrappers are allowed to grow to the
     * complete height of their 14-player content.
     */
    .fh-live-match-lower-panels > div {
        width: 100% !important;

        height: auto !important;

        min-height: 0 !important;

        max-height: none !important;

        align-self: start !important;

        box-sizing: border-box !important;

        overflow: visible !important;
    }


    /*
     * The PHP bench templates contain an inline:
     *
     *     height:640px;
     *
     * The mobile presentation must not inherit that fixed
     * desktop height.
     */
    .fh-live-match-lower-panels
    .fh-live-match-bench-widget {
        width: 100% !important;

        height: auto !important;

        min-height: 0 !important;

        max-height: none !important;

        overflow: visible !important;

        box-sizing: border-box !important;
    }


    .fh-live-match-lower-panels
    .fh-live-match-bench-card {
        width: 100% !important;

        height: auto !important;

        min-height: 0 !important;

        max-height: none !important;

        overflow: visible !important;

        box-sizing: border-box !important;
    }


    /*
     * The players grid must determine its own height:
     *
     * 14 players × 38px + gaps
     *
     * instead of being squeezed into the parent's fixed row.
     */
    .fh-live-match-lower-panels
    .fh-live-match-bench-players {
        display: grid !important;

        grid-template-columns: minmax(0, 1fr) !important;

        grid-template-rows: none !important;

        grid-auto-rows: 38px !important;

        gap: 3px !important;

        width: 100% !important;

        height: auto !important;

        min-height: 0 !important;

        max-height: none !important;

        flex: 0 0 auto !important;

        overflow: visible !important;

        box-sizing: border-box !important;
    }


    /*
     * Every bench player gets a real, independent row.
     */
    .fh-live-match-lower-panels
    .fh-live-match-bench-player {
        width: 100% !important;

        height: 38px !important;

        min-height: 38px !important;

        max-height: 38px !important;

        min-width: 0 !important;

        box-sizing: border-box !important;
    }

}
