/* Kompakte Spielübersicht und horizontale Ereignis-Timeline
 * CSP-konform: keine Inline-Styles erforderlich.
 */

.ws-match-overview {
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.ws-match-overview-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(170px, 240px) minmax(0, 1fr);
    align-items: start;
    gap: 1rem;
    padding: 1.15rem 1.5rem .8rem;
}

.ws-match-overview-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
}

.ws-match-overview-logo {
    width: 78px;
    height: 78px;
    object-fit: contain;
    margin-bottom: .4rem;
}

.ws-match-overview-team-name {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.15;
}

.ws-match-overview-center {
    text-align: center;
}

.ws-match-overview-type {
    margin-bottom: .7rem;
    font-size: .9rem;
    font-weight: 600;
}

.ws-match-overview-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 116px;
    padding: .55rem .85rem;
    border-radius: 3px;
    background: #333;
    color: #fff;
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1;
}

.ws-match-overview-score-separator {
    padding: 0 .35rem;
}


.ws-match-overview-halftime {
    display: block;
    width: 116px;
    margin: 0 auto;
    padding: .28rem .5rem;
    border-radius: 0 0 3px 3px;
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
}


.ws-match-event-board {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    padding: .75rem 1.5rem 1.25rem;
}

.ws-match-event-labels {
    position: relative;
    height: 104px;
    padding-right: .5rem;
    font-size: .78rem;
    font-weight: 700;
}

.ws-match-event-label {
    position: absolute;
    left: 0;
    transform: translateY(-50%);
}

.ws-match-event-label-home {
    top: 31px;
}

.ws-match-event-label-guest {
    top: 75px;
}

.ws-match-event-field {
    position: relative;
    height: 104px;
    min-width: 0;
}

.ws-match-event-row {
    position: absolute;
    top: 50%;
    height: 1px;
    transform: translateY(-50%);
    background: #d97a80;
}

/* Optische Unterbrechung an der Halbzeit. */
.ws-match-event-row-first-half {
    left: 0;
    right: auto;
    width: calc(attr(data-halftime-position type(<percentage>), 50%) - 10px);
}

.ws-match-event-row-second-half {
    left: calc(attr(data-halftime-position type(<percentage>), 50%) + 10px);
    right: 0;
}

.ws-match-event-halftime-marker {
    position: absolute;
    z-index: 2;
    top: 18px;
    bottom: 18px;
    left: attr(data-position type(<percentage>), 50%);
    width: 1px;
    transform: translateX(-50%);
    border-left: 1px dashed var(--bs-border-color);
    pointer-events: none;
}

.ws-match-event-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 104px;
}


.ws-match-event {
    position: absolute;
    z-index: 3;
    width: 34px;
    height: 42px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    outline: none;
    cursor: help;
}

.ws-match-event-home {
    top: 14px;
}

.ws-match-event-guest {
    top: 56px;
}

.ws-match-event:hover,
.ws-match-event:focus {
    z-index: 6;
    transform: translateX(-50%) scale(1.12);
}

.ws-match-event-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 25px;
    line-height: 1;
    font-size: 1.2rem;
}

.ws-match-event-icon {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.ws-match-event-icon-card {
    width: 15px;
    height: 23px;
}

.ws-match-event-double-card {
    position: relative;
    display: block;
    width: 24px;
    height: 24px;
}

.ws-match-event-double-card .ws-match-event-icon:first-child {
    position: absolute;
    left: 0;
    top: 0;
}

.ws-match-event-double-card .ws-match-event-icon:last-child {
    position: absolute;
    right: 0;
    bottom: 0;
}



/* Ereignisposition aus data-position.
 * CSP-konform: keine Inline-Styles und keine 91 Minutenklassen erforderlich.
 * Moderne Browser lesen den Prozentwert direkt aus dem data-Attribut.
 */
.ws-match-event,
.ws-match-event-marker {
    left: attr(data-position type(<percentage>), 0%);
}

@media (max-width: 767.98px) {
    .ws-match-overview {
        overflow-x: auto;
    }

    .ws-match-overview-header {
        grid-template-columns: 210px 180px 210px;
        min-width: 640px;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .ws-match-event-board {
        grid-template-columns: 50px 590px;
        min-width: 640px;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .ws-match-overview-logo {
        width: 62px;
        height: 62px;
    }

    .ws-match-overview-team-name {
        font-size: 1.05rem;
    }
}


/* Legende unter dem Spielverlauf. */
.ws-match-event-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    width: fit-content;
    max-width: calc(100% - 2rem);
    margin: .35rem auto 1rem;
    padding: .7rem 1rem;
    border-radius: var(--bs-border-radius);
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

.ws-match-event-legend-item {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    white-space: nowrap;
    font-size: .9rem;
}

.ws-match-event-legend-icon {
    display: block;
    width: 25px;
    height: 25px;
    object-fit: contain;
}

.ws-match-event-legend-card {
    width: 15px;
    height: 23px;
}

.ws-match-event-legend-substitution {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 25px;
    font-size: 1.35rem;
    line-height: 1;
}

@media (max-width: 767.98px) {
    .ws-match-event-legend {
        min-width: 600px;
        justify-content: center;
    }
}


/* Eigene Hover-Infobox für Timeline-Ereignisse. */
.ws-match-event-tooltip {
    position: absolute;
    z-index: 50;
    left: 50%;
    top: calc(100% + 9px);
    width: 300px;
    max-width: 78vw;
    transform: translateX(-50%);
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    box-shadow: 0 .35rem .9rem rgba(0, 0, 0, .24);
    text-align: left;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease, visibility .12s ease;
}

.ws-match-event-guest .ws-match-event-tooltip {
    top: auto;
    bottom: calc(100% + 9px);
}

.ws-match-event:hover .ws-match-event-tooltip,
.ws-match-event:focus .ws-match-event-tooltip,
.ws-match-event:focus-within .ws-match-event-tooltip {
    visibility: visible;
    opacity: 1;
}

.ws-match-event-tooltip::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -7px;
    width: 12px;
    height: 12px;
    transform: translateX(-50%) rotate(45deg);
    border-top: 1px solid var(--bs-border-color);
    border-left: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.ws-match-event-guest .ws-match-event-tooltip::before {
    top: auto;
    bottom: -7px;
    transform: translateX(-50%) rotate(225deg);
}

.ws-match-event-tooltip-head {
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--bs-border-color);
    font-weight: 700;
    line-height: 1.2;
}

.ws-match-event-tooltip-body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .6rem;
}

.ws-match-event-tooltip-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.ws-match-event-tooltip-text strong {
    margin-bottom: .15rem;
}

.ws-match-event-tooltip-player {
    width: 52px;
    height: 68px;
    flex: 0 0 52px;
    object-fit: cover;
    object-position: top center;
    border-radius: 3px;
    background: var(--bs-secondary-bg);
}

.ws-match-event-tooltip-message {
    padding: 0 .6rem .6rem;
    font-size: .82rem;
    line-height: 1.3;
    color: var(--bs-secondary-color);
}

/* Das Torbild wird ausdrücklich aus img/icons/goal_scorer.png geladen. */
.ws-match-event-icon {
    object-fit: contain;
}

@media (max-width: 767.98px) {
    .ws-match-event-tooltip {
        width: 260px;
    }
}


/* Punktmarker der Ereignis-Timeline.
 * Die Marker sind unabhängig von den Aktions-Icons positioniert und
 * bleiben daher exakt mittig auf der roten Linie.
 */
.ws-match-event-marker {
    position: absolute;
    z-index: 4;
    top: 50%;
    width: 7px;
    height: 7px;
    box-sizing: border-box;
    border: 1px solid #df6f75;
    border-radius: 50%;
    background: var(--bs-body-bg);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Der Halbzeitbereich bleibt optisch frei. */
.ws-match-event-marker.ws-match-minute-45 {
    z-index: 5;
}