/* Kisure Sports Frontend v617
 * Compact upcoming Match Centre history/form layout.
 * Keeps the football-schedule-* family while making H2H and recent-form cards
 * dense enough to sit side-by-side on desktop/tablet.
 * Also preserves the prediction sidebar dark ad shell from v616.
 */

/* -------------------------------------------------------------------------
   Match history section
   ------------------------------------------------------------------------- */
.football-match-history-v617 {
    --ks-history-accent: var(--primary, #078b92);
    --ks-history-accent-2: #16a3a7;
    --ks-history-card: var(--surface, #fff);
    --ks-history-soft: var(--surface-soft, #f7fafb);
    --ks-history-border: var(--border, #dbe3e8);
    display: grid;
    gap: 1rem;
    min-width: 0;
    overflow: hidden;
}

.football-match-history-v617__heading {
    margin-bottom: 0 !important;
}

.football-match-history-v617__heading h2 {
    margin-bottom: .25rem;
}

.football-match-history-v617__heading p {
    max-width: 920px;
    margin: 0;
    color: var(--text-soft);
    font-size: .9rem;
    line-height: 1.55;
}

/* H2H summary + previous meetings sit side-by-side on wide screens. */
.football-match-history-overview-v617 {
    display: grid;
    grid-template-columns: minmax(300px, .82fr) minmax(0, 1.18fr);
    gap: .9rem;
    align-items: stretch;
    min-width: 0;
}

.football-match-history-h2h-card-v617,
.football-match-history-block-v617 {
    min-width: 0;
    border: 1px solid var(--ks-history-border);
    border-radius: 18px;
    background: var(--ks-history-card);
    box-shadow: 0 8px 24px rgba(15,23,42,.035);
}

.football-match-history-h2h-card-v617 {
    display: grid;
    align-content: start;
    gap: .8rem;
    padding: 1rem;
}

.football-match-history-h2h-card-v617__label {
    color: var(--ks-history-accent);
    font-size: .68rem;
    font-weight: 950;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.football-match-history-h2h-v617 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(88px, 110px) minmax(0, 1fr);
    align-items: center;
    gap: .7rem;
    min-width: 0;
}

.football-match-history-h2h-v617__side {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}

.football-match-history-h2h-v617__side.is-away {
    justify-content: flex-end;
    text-align: right;
}

.football-match-history-h2h-v617__crest {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    border: 1px solid var(--ks-history-border);
    border-radius: 16px;
    background: var(--ks-history-soft);
    overflow: hidden;
}

.football-match-history-h2h-v617__crest img {
    width: 46px;
    height: 46px;
    object-fit: contain;
}

.football-match-history-h2h-v617__crest b {
    font-size: .8rem;
    font-weight: 950;
}

.football-match-history-h2h-v617__copy {
    display: grid;
    min-width: 0;
    line-height: 1;
}

.football-match-history-h2h-v617__copy small {
    max-width: 125px;
    overflow: hidden;
    color: var(--text-soft);
    font-size: .7rem;
    font-weight: 850;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.football-match-history-h2h-v617__copy strong,
.football-match-history-h2h-v617__draws strong {
    margin-top: .22rem;
    color: var(--text);
    font-size: clamp(1.65rem, 2.7vw, 2.35rem);
    font-weight: 950;
    line-height: .95;
}

.football-match-history-h2h-v617__copy em,
.football-match-history-h2h-v617__draws em {
    margin-top: .18rem;
    color: var(--text-soft);
    font-size: .64rem;
    font-style: normal;
    font-weight: 750;
}

.football-match-history-h2h-v617__draws {
    display: grid;
    justify-items: center;
    align-content: center;
    min-height: 82px;
    padding: .45rem;
    border: 1px solid var(--ks-history-border);
    border-radius: 15px;
    background: var(--ks-history-soft);
    text-align: center;
}

.football-match-history-h2h-v617__draws > span {
    color: var(--text-soft);
    font-size: .62rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.football-match-history-h2h-v617__draws strong {
    font-size: 1.7rem;
}

.football-match-history-h2h-card-v617__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .45rem;
    padding-top: .72rem;
    border-top: 1px solid var(--ks-history-border);
    color: var(--text-soft);
    font-size: .65rem;
    font-weight: 800;
    text-align: center;
}

.football-match-history-h2h-card-v617__footer i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--ks-history-accent);
}

.football-match-history-block-v617 {
    display: grid;
    align-content: start;
    gap: .7rem;
    padding: .82rem;
}

.football-match-history-block-v617__head,
.football-match-history-team-v617__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    min-width: 0;
}

.football-match-history-block-v617__head > div,
.football-match-history-team-v617__identity > span {
    display: grid;
    gap: .08rem;
    min-width: 0;
}

.football-match-history-block-v617__head small,
.football-match-history-team-v617__identity small {
    color: var(--ks-history-accent);
    font-size: .62rem;
    font-weight: 950;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.football-match-history-block-v617__head h3,
.football-match-history-team-v617__identity strong {
    margin: 0;
    color: var(--text);
    font-size: .96rem;
    font-weight: 950;
    line-height: 1.15;
}

.football-match-history-block-v617__head > span,
.football-match-history-team-v617__identity em {
    color: var(--text-soft);
    font-size: .65rem;
    font-style: normal;
    font-weight: 750;
}

/* Two club form panels side-by-side on desktop. */
.football-match-history-form-grid-v617 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem;
    min-width: 0;
}

.football-match-history-team-v617__identity {
    display: flex;
    align-items: center;
    gap: .58rem;
    min-width: 0;
}

.football-match-history-team-v617__identity > img,
.football-match-history-team-v617__identity > b {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 1px solid var(--ks-history-border);
    border-radius: 11px;
    background: var(--ks-history-soft);
    object-fit: contain;
    overflow: hidden;
}

.football-match-history-team-v617__record {
    display: flex;
    align-items: center;
    gap: .22rem;
    flex: 0 0 auto;
}

.football-match-history-team-v617__record i,
.football-match-history-result-v617 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 31px;
    min-height: 25px;
    padding: .28rem .42rem;
    border: 1px solid var(--ks-history-border);
    border-radius: 999px;
    font-size: .62rem;
    line-height: 1;
    font-style: normal;
    font-weight: 950;
}

.football-match-history-team-v617__record .is-w,
.football-match-history-result-v617.is-w {
    color: #047857;
    border-color: rgba(16,185,129,.28);
    background: rgba(16,185,129,.10);
}

.football-match-history-team-v617__record .is-d,
.football-match-history-result-v617.is-d {
    color: #805f00;
    border-color: rgba(234,179,8,.32);
    background: rgba(234,179,8,.10);
}

.football-match-history-team-v617__record .is-l,
.football-match-history-result-v617.is-l {
    color: #b42318;
    border-color: rgba(239,68,68,.28);
    background: rgba(239,68,68,.09);
}

/* -------------------------------------------------------------------------
   Compact schedule-family cards used only inside match history.
   ------------------------------------------------------------------------- */
.football-match-history-schedule-v617 {
    display: grid !important;
    gap: .56rem !important;
    min-width: 0;
}

.football-match-history-schedule-v617.is-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.football-match-history-schedule-v617.is-stack {
    grid-template-columns: minmax(0, 1fr);
}

.football-match-history-schedule-v617 .football-schedule-day {
    display: grid !important;
    align-content: start;
    gap: 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid var(--ks-history-border) !important;
    border-radius: 13px !important;
    background: var(--ks-history-card) !important;
    overflow: hidden !important;
    box-shadow: none !important;
}

.football-match-history-schedule-v617 .football-schedule-day > h3 {
    margin: 0 !important;
    padding: .42rem .62rem !important;
    border-bottom: 1px solid var(--ks-history-border);
    background: var(--ks-history-soft);
    color: var(--text-soft) !important;
    font-size: .62rem !important;
    font-weight: 850 !important;
    line-height: 1.15 !important;
}

.football-match-history-schedule-v617 .football-schedule-competition {
    min-width: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

.football-match-history-schedule-v617 .football-schedule-competition__head {
    display: flex !important;
    align-items: center !important;
    min-height: 34px !important;
    padding: .36rem .6rem !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,.16) !important;
    border-radius: 0 !important;
    background: linear-gradient(100deg, #087f8c, #16a3a7) !important;
    color: #fff !important;
}

.football-match-history-schedule-v617 .football-schedule-competition__title {
    display: flex !important;
    align-items: center !important;
    gap: .38rem !important;
    min-width: 0 !important;
    color: #fff !important;
    font-size: .68rem !important;
    font-weight: 900 !important;
}

.football-match-history-schedule-v617 .football-schedule-competition__title img,
.football-match-history-schedule-v617 .football-schedule-competition__title > i {
    width: 21px !important;
    height: 21px !important;
    min-width: 21px !important;
    flex: 0 0 21px !important;
    object-fit: contain !important;
}

.football-match-history-row-v617 {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(72px, 92px) minmax(0, 1fr) !important;
    grid-template-areas:
        "meta meta meta"
        "home middle away"
        "actions actions actions" !important;
    align-items: center !important;
    column-gap: .42rem !important;
    row-gap: .28rem !important;
    min-width: 0 !important;
    min-height: 78px !important;
    margin: 0 !important;
    padding: .48rem .58rem .52rem !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--ks-history-card) !important;
    box-shadow: none !important;
}

.football-match-history-row-v617 .football-schedule-row__meta {
    grid-area: meta !important;
    display: block !important;
    min-width: 0 !important;
    margin: 0 !important;
    color: var(--text-soft) !important;
    font-size: .57rem !important;
    font-weight: 750 !important;
    line-height: 1.1 !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.football-match-history-row-v617 .football-schedule-row__team {
    display: flex !important;
    align-items: center !important;
    gap: .32rem !important;
    min-width: 0 !important;
    color: var(--text) !important;
    text-decoration: none !important;
    font-size: .72rem !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
}

.football-match-history-row-v617 .football-schedule-row__team--home {
    grid-area: home !important;
    justify-content: flex-end !important;
    text-align: right !important;
}

.football-match-history-row-v617 .football-schedule-row__team--away {
    grid-area: away !important;
    justify-content: flex-start !important;
    text-align: left !important;
}

.football-match-history-row-v617 .football-schedule-row__team span {
    display: block !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.football-match-history-row-v617 .football-schedule-row__team img,
.football-match-history-row-v617 .football-schedule-row__team > b {
    display: grid !important;
    place-items: center !important;
    width: 29px !important;
    height: 29px !important;
    min-width: 29px !important;
    flex: 0 0 29px !important;
    margin: 0 !important;
    border-radius: 50% !important;
    object-fit: contain !important;
}

.football-match-history-row-v617 .football-schedule-row__team > b {
    border: 1px solid var(--ks-history-border);
    background: var(--ks-history-soft);
    font-size: .55rem;
}

.football-match-history-row-v617 .football-schedule-row__middle {
    grid-area: middle !important;
    display: grid !important;
    justify-items: center !important;
    gap: .08rem !important;
    min-width: 0 !important;
    color: var(--text) !important;
    text-decoration: none !important;
}

.football-match-history-row-v617 .football-schedule-row__scoreline {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: .24rem !important;
    min-width: 62px !important;
    min-height: 29px !important;
    padding: .23rem .45rem !important;
    border: 1px solid var(--ks-history-border) !important;
    border-radius: 999px !important;
    background: var(--ks-history-soft) !important;
    color: var(--text) !important;
    font-size: .78rem !important;
    font-weight: 950 !important;
    line-height: 1 !important;
}

.football-match-history-row-v617 .football-schedule-row__scoreline b,
.football-match-history-row-v617 .football-schedule-row__scoreline span {
    color: inherit !important;
    font: inherit !important;
}

.football-match-history-row-v617 .football-schedule-row__middle em {
    color: var(--text-soft) !important;
    font-size: .55rem !important;
    font-style: normal !important;
    font-weight: 800 !important;
    line-height: 1 !important;
}

.football-match-history-row-v617__actions {
    grid-area: actions !important;
    display: flex !important;
    justify-content: center !important;
    min-width: 0 !important;
    margin: .04rem 0 0 !important;
    padding: 0 !important;
}

.football-match-history-result-v617 {
    min-width: 48px;
    min-height: 22px;
    padding: .22rem .48rem;
    font-size: .58rem;
}

.football-match-history-empty-v617 {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 74px;
    padding: .8rem;
    border: 1px dashed var(--ks-history-border);
    border-radius: 13px;
    background: var(--ks-history-soft);
    color: var(--text-soft);
}

.football-match-history-empty-v617 > i {
    color: var(--ks-history-accent);
}

.football-match-history-empty-v617 > div {
    display: grid;
    gap: .1rem;
}

.football-match-history-empty-v617 strong {
    color: var(--text);
}

.football-match-history-empty-v617 span {
    font-size: .72rem;
}

.football-match-history-empty-v617.is-compact {
    justify-content: center;
    text-align: center;
}

/* -------------------------------------------------------------------------
   Dark theme for the new history cards.
   ------------------------------------------------------------------------- */
html[data-theme="dark"] .football-match-history-v617 {
    --ks-history-card: #0d1728;
    --ks-history-soft: #111e32;
    --ks-history-border: rgba(148,163,184,.19);
}

html[data-theme="dark"] .football-match-history-v617 .football-match-history-h2h-card-v617,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-block-v617,
html[data-theme="dark"] .football-match-history-v617 .football-schedule-day,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-row-v617 {
    background: var(--ks-history-card) !important;
    border-color: var(--ks-history-border) !important;
}

html[data-theme="dark"] .football-match-history-v617 .football-match-history-h2h-v617__crest,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-h2h-v617__draws,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-team-v617__identity > img,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-team-v617__identity > b,
html[data-theme="dark"] .football-match-history-v617 .football-schedule-day > h3,
html[data-theme="dark"] .football-match-history-v617 .football-schedule-row__scoreline,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-empty-v617 {
    background: var(--ks-history-soft) !important;
    border-color: var(--ks-history-border) !important;
}

html[data-theme="dark"] .football-match-history-v617 .football-match-history-h2h-v617__copy strong,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-h2h-v617__draws strong,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-block-v617__head h3,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-team-v617__identity strong,
html[data-theme="dark"] .football-match-history-v617 .football-schedule-row__team,
html[data-theme="dark"] .football-match-history-v617 .football-schedule-row__scoreline,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-empty-v617 strong {
    color: #f8fafc !important;
}

html[data-theme="dark"] .football-match-history-v617 .football-match-history-h2h-v617__copy small,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-h2h-v617__copy em,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-h2h-v617__draws > span,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-h2h-v617__draws em,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-h2h-card-v617__footer,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-block-v617__head > span,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-team-v617__identity em,
html[data-theme="dark"] .football-match-history-v617 .football-schedule-day > h3,
html[data-theme="dark"] .football-match-history-v617 .football-schedule-row__meta,
html[data-theme="dark"] .football-match-history-v617 .football-schedule-row__middle em,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-empty-v617 {
    color: #9fb0c6 !important;
}

html[data-theme="dark"] .football-match-history-v617 .football-match-history-team-v617__record .is-w,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-result-v617.is-w { color: #86efac; }
html[data-theme="dark"] .football-match-history-v617 .football-match-history-team-v617__record .is-d,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-result-v617.is-d { color: #fde68a; }
html[data-theme="dark"] .football-match-history-v617 .football-match-history-team-v617__record .is-l,
html[data-theme="dark"] .football-match-history-v617 .football-match-history-result-v617.is-l { color: #fca5a5; }

/* -------------------------------------------------------------------------
   Prediction sidebar ad shell: retain v616 dark-mode correction.
   ------------------------------------------------------------------------- */
html[data-theme="dark"] .football-prediction-detail-page .football-sidebar-stack .football-ad-panel,
html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel {
    overflow: hidden !important;
    background: #071321 !important;
    border-color: rgba(94,234,212,.18) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel > .site-kicker {
    color: #2dd4bf !important;
}

html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel .football-sidebar-ad-slot {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: .55rem !important;
    overflow: hidden !important;
    border: 1px solid rgba(148,163,184,.22) !important;
    border-radius: 16px !important;
    background: #08111f !important;
    color: #dce7f5 !important;
    color-scheme: dark !important;
    box-sizing: border-box !important;
}

html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel .kisure-safe-ad-slot,
html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel .kisure-safe-ad-primary,
html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel .script-ad,
html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel ins.adsbygoogle {
    width: 100% !important;
    max-width: 100% !important;
    background-color: #08111f !important;
    border-radius: 12px !important;
}

html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel [id^="aswift_"][id$="_host"] {
    background-color: transparent !important;
}

html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel ins.adsbygoogle[data-ad-status="unfilled"],
html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel ins.adsbygoogle[data-ad-status="unfill-optimized"],
html[data-theme="dark"] .football-prediction-detail-page .football-ad-panel .football-sidebar-ad-slot:empty {
    min-height: 0 !important;
    background: transparent !important;
}

/* -------------------------------------------------------------------------
   Responsive behaviour.
   ------------------------------------------------------------------------- */
@media (max-width: 1050px) {
    .football-match-history-overview-v617 {
        grid-template-columns: 1fr;
    }

    .football-match-history-form-grid-v617 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 820px) {
    .football-match-history-form-grid-v617 {
        grid-template-columns: 1fr;
    }

    .football-match-history-schedule-v617.is-pair {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .football-match-history-v617 {
        gap: .75rem;
    }

    .football-match-history-v617__heading p {
        font-size: .78rem;
    }

    .football-match-history-h2h-card-v617,
    .football-match-history-block-v617 {
        padding: .68rem;
        border-radius: 14px;
    }

    .football-match-history-h2h-v617 {
        grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
        gap: .35rem;
    }

    .football-match-history-h2h-v617__side {
        display: grid;
        justify-items: center;
        justify-content: center;
        gap: .3rem;
        text-align: center;
    }

    .football-match-history-h2h-v617__side.is-away {
        text-align: center;
    }

    .football-match-history-h2h-v617__side.is-away .football-match-history-h2h-v617__crest {
        order: -1;
    }

    .football-match-history-h2h-v617__crest {
        width: 43px;
        height: 43px;
        flex-basis: 43px;
        border-radius: 12px;
    }

    .football-match-history-h2h-v617__crest img {
        width: 35px;
        height: 35px;
    }

    .football-match-history-h2h-v617__copy small {
        max-width: 92px;
        font-size: .6rem;
    }

    .football-match-history-h2h-v617__copy strong,
    .football-match-history-h2h-v617__draws strong {
        font-size: 1.35rem;
    }

    .football-match-history-h2h-v617__draws {
        min-height: 70px;
        padding: .3rem;
    }

    .football-match-history-h2h-v617__draws em {
        font-size: .5rem;
    }

    .football-match-history-h2h-card-v617__footer {
        font-size: .56rem;
    }

    .football-match-history-schedule-v617.is-pair {
        grid-template-columns: 1fr;
    }

    .football-match-history-team-v617__head {
        align-items: flex-start;
    }

    .football-match-history-team-v617__record {
        gap: .12rem;
    }

    .football-match-history-team-v617__record i {
        min-width: 27px;
        min-height: 23px;
        padding: .22rem .3rem;
        font-size: .56rem;
    }

    .football-match-history-row-v617 {
        grid-template-columns: minmax(0, 1fr) 74px minmax(0, 1fr) !important;
        column-gap: .26rem !important;
        padding: .45rem .4rem .5rem !important;
    }

    .football-match-history-row-v617 .football-schedule-row__team {
        gap: .2rem !important;
        font-size: .64rem !important;
    }

    .football-match-history-row-v617 .football-schedule-row__team span {
        white-space: normal !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.08 !important;
    }

    .football-match-history-row-v617 .football-schedule-row__team img,
    .football-match-history-row-v617 .football-schedule-row__team > b {
        width: 25px !important;
        height: 25px !important;
        min-width: 25px !important;
        flex-basis: 25px !important;
    }

    .football-match-history-row-v617 .football-schedule-row__scoreline {
        min-width: 56px !important;
        min-height: 27px !important;
        font-size: .72rem !important;
    }
}
