.badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgb(255 255 255 / 18%);
    color: white;
    font-family: sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 3px;
}

.live-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #ef4444;
    color: white;
    font-family: sans-serif;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 3px;
}

.live-badge span {
    display: block;
    text-box: trim-both cap alphabetic;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
    animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.7);
    }
}

.thwkiel-live-match {
    --gutter: clamp(1.6rem, 5vw, 6.4rem);

    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), 1fr)
        [content-start] min(88rem, 100% - 2 * var(--gutter)) [content-end]
        minmax(var(--gutter), 1fr) [full-end];
}

.thwkiel-live-match > * {
    grid-column: content;
}

.thwkiel-live-match > nav,
.thwkiel-live-match > header {
    grid-column: full;
}

/* Header */
header.live-match {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(2rem, 6vh, 4rem);
    min-height: clamp(24rem, 45vh, 34rem);
    padding-inline: var(--gutter);

    position: relative;
    isolation: isolate;
    background-color: #111827;
    color: #fff;
}

/* Separate layer so the image can be dimmed without dimming the text on top of it. */
header.live-match::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;

    background-image: url("../../static/matchcenter-top-background.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: brightness(0.4);
}

header.live-match p {
    margin-bottom: unset;
    font-size: 1.6rem;
}

header.live-match .match-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

header.live-match .match-scores {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: clamp(1.6rem, 8vw, 8rem);
}

header.live-match .match-scores > .team {
    min-width: 0;
}

header.live-match .match-scores > .team:first-child {
    justify-self: end;
}

header.live-match .match-scores > .team:last-child {
    justify-self: start;
}

header.live-match .team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

header.live-match .team img {
    height: clamp(4.8rem, 10vw, 8rem);
    object-fit: contain;
}

header.live-match .team p {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
}

header.live-match #matchScore {
    font-size: clamp(3rem, 9vw, 4rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

header.live-match .match-info,
header.live-match .match-meta {
    color: #d1d5db;
}

header.live-match .match-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

/* Navigation > Tabs are shown and hidden based on the URL fragment */
.thwkiel-live-match nav {
    display: flex;
}

.thwkiel-live-match nav > a {
    flex: 1;
    padding: 14px 8px;
    text-align: center;
    text-decoration: none;
    font-size: 24px;
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    color: #000000;
    border-bottom: 3px solid transparent;
}

.thwkiel-live-match:not(:has(#match-statistics:target)) .live-tab--timeline,
.thwkiel-live-match:has(#match-statistics:target) .live-tab--statistics {
    border-bottom-color: currentColor;
}

#match-statistics {
    display: none;
}

.thwkiel-live-match:has(#match-statistics:target) #match-timeline {
    display: none;
}

#match-statistics:target {
    display: block;
}

/* Match statistics */
.stats-panel {
    padding: 2rem 0;
}

.stats-header,
.stat-labels {
    display: grid;
    grid-template-columns: 1fr minmax(6rem, 20rem) 1fr;
    align-items: center;
    gap: 0.8rem;
}

.stats-header {
    margin-bottom: 2rem;
}

.stats-team {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.stats-team.away {
    justify-content: flex-end;
}

.stats-team-label {
    font-weight: 700;
    text-transform: uppercase;
}

/* Yellow and red cards are rendered as cards instead of bars. */
.stat-cards {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Mirrored for the away team, so the red cards stay closest to the team name. */
.stats-team.away .stat-cards {
    flex-direction: row-reverse;
}

.stat-card {
    width: 1rem;
    height: 1.4rem;
    border-radius: 2px;
}

.stat-card-yellow {
    background: #eab308;
}

.stat-card-red {
    background: #dc2626;
}

.stats-center-label,
.stat-name {
    text-align: center;
    text-transform: uppercase;
    color: #6b7280;
}

.stat-row {
    margin-bottom: 1.6rem;
}

.stat-val {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.stat-val.away {
    text-align: right;
}

.stat-bar-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    height: 0.6rem;
    margin-top: 0.6rem;
}

.stat-bar-track {
    overflow: hidden;
}

.stat-bar-track.home {
    display: flex;
    justify-content: flex-end;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 3px;
}

.stat-bar-fill.own {
    background: #1f2937;
}

.stat-bar-fill.opponent {
    background: #9ca3af;
}

.stats-empty {
    text-align: center;
    color: #6b7280;
}

/* Timeline entries */
#match-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 2rem 0;
}

.timeline-empty {
    text-align: center;
    color: #6b7280;
}

.thwkiel-live-match .timeline-entry {
    box-sizing: border-box;
    width: 100%;
    min-height: 5rem;
    padding: 0.8rem 1.6rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 6%);

    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 5rem 40px minmax(0, 1fr);
    align-items: center;
    gap: clamp(0.8rem, 4vw, 4rem);
}

.thwkiel-live-match .timeline-entry.timeline-entry-match-event {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: unset;
    padding: 0.8rem;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    color: #6b7280;
    font-weight: 400;
}

.thwkiel-live-match .timeline-entry-description,
.thwkiel-live-match .timeline-entry-logo,
.thwkiel-live-match .timeline-entry-score,
.thwkiel-live-match .timeline-entry-clock {
    grid-row: 1;
}

.thwkiel-live-match .timeline-entry-score,
.thwkiel-live-match .timeline-entry-clock {
    grid-column: 3;
    text-align: center;
    white-space: nowrap;
}

.thwkiel-live-match .timeline-entry-score-change .timeline-entry-score {
    font-weight: 500;
}

.thwkiel-live-match .timeline-entry-home .timeline-entry-description {
    grid-column: 1;
    text-align: right;
}

.thwkiel-live-match .timeline-entry-home .timeline-entry-logo {
    grid-column: 2;
}

.thwkiel-live-match .timeline-entry-away .timeline-entry-logo {
    grid-column: 4;
}

.thwkiel-live-match .timeline-entry-logo img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.thwkiel-live-match .timeline-entry-away .timeline-entry-description {
    grid-column: 5;
}

.thwkiel-live-match .timeline-entry-home .timeline-entry-clock,
.thwkiel-live-match .timeline-entry-away .timeline-entry-clock {
    color: #6b7280;
}

@media (max-width: 575px) {
    .thwkiel-live-match > #match-timeline {
        grid-column: full;
        padding: 1rem 0.8rem;
    }

    .thwkiel-live-match .timeline-entry {
        min-height: 4rem;
        padding: 0.6rem 0.8rem;
        grid-template-columns: minmax(0, 1fr) 5rem minmax(0, 1fr);
    }

    .thwkiel-live-match .timeline-entry-logo {
        display: none;
    }

    .thwkiel-live-match .timeline-entry-score,
    .thwkiel-live-match .timeline-entry-clock {
        grid-column: 2;
    }

    .thwkiel-live-match .timeline-entry-away .timeline-entry-description {
        grid-column: 3;
    }
}