.bilis-fmt {
    --fmt-height: 5.35rem;
    --fmt-arrow-width: 1.15rem;
    --fmt-card-width: 11.75rem;
    --fmt-accent-strip: 4px;
    --fmt-card-gap: 0.25rem;

    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    height: var(--fmt-height);
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family:
        "Oxygen",
        system-ui,
        -apple-system,
        sans-serif;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-sizing: border-box;
}

.bilis-fmt::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--fmt-accent-strip);
    background: var(--accent);
    z-index: 5;
}

.bilis-fmt-track-wrap {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding-top: var(--fmt-accent-strip);
}

.bilis-fmt-track {
    display: flex;
    gap: var(--fmt-card-gap);
    height: calc(100% - var(--fmt-accent-strip));
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 0.25rem 0;
}

.bilis-fmt-track::-webkit-scrollbar {
    display: none;
}

.bilis-fmt-card {
    flex: 0 0 var(--fmt-card-width);
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr 1fr;
    row-gap: 0.34rem;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    padding: 0.42rem 0.6rem 0.44rem;
    box-sizing: border-box;
    overflow: hidden;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.bilis-fmt-card:hover {
    background: color-mix(in srgb, var(--accent) 7%, var(--surface-soft));
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.bilis-fmt-card.is-live {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.bilis-fmt-card.is-finished {
    opacity: 0.92;
}

.bilis-fmt-card.is-postponed {
    opacity: 0.75;
}

.bilis-fmt-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    min-height: 0.75rem;
    line-height: 1;
}

.bilis-fmt-league {
    min-width: 0;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bilis-fmt-date {
    color: var(--accent);
    font-family: "Encode Sans Condensed", sans-serif;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.bilis-fmt-team-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.15rem;
    align-items: center;
    gap: 0.45rem;
    min-height: 1.05rem;
    line-height: 1;
}

.bilis-fmt-team {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.4rem;
    color: var(--text);
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1;
}

.bilis-fmt-team img {
    width: 0.88rem;
    height: 0.88rem;
    object-fit: contain;
    flex: 0 0 0.88rem;
}

.bilis-fmt-team span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bilis-fmt-score {
    color: var(--text);
    font-family: "Encode Sans Condensed", sans-serif;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
    min-width: 2.15rem;
    text-align: right;
    white-space: nowrap;
}

.bilis-fmt-card.is-live .bilis-fmt-score,
.bilis-fmt-card.is-live .bilis-fmt-date {
    color: var(--accent);
}

.bilis-fmt-arrow {
    flex: 0 0 var(--fmt-arrow-width);
    width: var(--fmt-arrow-width);
    height: calc(100% - var(--fmt-accent-strip));
    margin-top: var(--fmt-accent-strip);
    border: 0;
    background: var(--bg);
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition:
        background 0.2s ease,
        color 0.2s ease;
    position: relative;
    z-index: 4;
}

.bilis-fmt-arrow:hover {
    background: var(--surface-soft);
    color: var(--accent);
}

.bilis-fmt-message {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    color: var(--muted);
    font-size: 0.85rem;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    box-sizing: border-box;
}

/* Dark mode */
[data-theme="dark"] .bilis-fmt-card {
    background: rgb(255 255 255 / 0.06);
    border-color: rgb(255 255 255 / 0.08);
}

[data-theme="dark"] .bilis-fmt-card:hover {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-color: color-mix(in srgb, var(--accent) 45%, rgb(255 255 255 / 0.08));
}

[data-theme="dark"] .bilis-fmt-arrow {
    background: var(--bg);
    color: var(--muted);
}

[data-theme="dark"] .bilis-fmt-arrow:hover {
    background: rgb(255 255 255 / 0.06);
    color: var(--accent);
}

/* Mobile */
@media (max-width: 768px) {
    .bilis-fmt {
        --fmt-height: 5.15rem;
        --fmt-arrow-width: 1rem;
        --fmt-card-width: 10.25rem;
    }

    .bilis-fmt-card {
        row-gap: 0.32rem;
        padding: 0.4rem 0.5rem 0.42rem;
    }

    .bilis-fmt-league,
    .bilis-fmt-date {
        font-size: 0.56rem;
    }

    .bilis-fmt-team-row {
        grid-template-columns: minmax(0, 1fr) 2rem;
        min-height: 1rem;
    }

    .bilis-fmt-team {
        font-size: 0.68rem;
        gap: 0.34rem;
    }

    .bilis-fmt-team img {
        width: 0.8rem;
        height: 0.8rem;
        flex-basis: 0.8rem;
    }

    .bilis-fmt-score {
        font-size: 0.74rem;
        min-width: 2rem;
    }

    .bilis-fmt-arrow {
        font-size: 0.95rem;
    }
}

@media (max-width: 400px) {
    .bilis-fmt {
        --fmt-card-width: 9.75rem;
    }
}