/* Live match page — reproduces the redesigned Play-Cricket scorecard look
   (see page_download/page.html mock-up). Club colours: maroon / amber / blue. */

/* Font faces are declared in fonts.css (load it alongside this file). */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* :host as well as :root, so the same variables resolve when the component is
   embedded in a shadow root (the WordPress plugin). */
:root,
:host {
    --maroon: #872734;
    --amber: #e8a22b;
    --blue: #0b4169;
    --banner-bg: #2d65ad;      /* mid blue banner */
    --banner-dark: #08192f;    /* dark navy — left of the banner fade */
    --banner-fade: linear-gradient(90deg, #08192f 0%, #2d65ad 100%);
    --banner-panel: rgba(8, 139, 237, 0.10);
    --muted: #b0b3b9;          /* grey labels on the banner */
    --page-bg: #f4f5f7;
    --surface: #ffffff;
    --text: #23303c;
    --text-soft: #6b7280;
    --border: #e6e8eb;
    --row-alt: #f7f9fb;
    --live: #12a150;
    --maxw: 1200px;
}

body {
    font-family: 'Barlow Condensed', 'Arial Narrow', -apple-system, BlinkMacSystemFont,
        'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--page-bg);
    /* A faint navy halo up top plus a soft grey fade give the page some depth
       instead of a flat fill. */
    background-image:
        radial-gradient(1000px 440px at 50% -170px, rgba(45, 101, 173, 0.09), rgba(45, 101, 173, 0) 72%),
        linear-gradient(180deg, #e8eaee 0%, rgba(244, 245, 247, 0) 360px);
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Embedded (shadow root) host: the typography body carries on the full page,
   without the page background — the host site keeps its own. */
:host {
    display: block;
    font-family: 'Barlow Condensed', 'Arial Narrow', -apple-system, BlinkMacSystemFont,
        'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

/* --- Top colour bars --- */
.colorbar {
    display: flex;
    height: 8px;
}
.colorbar span:nth-child(1) { flex: 0 0 40%; background: var(--maroon); }
.colorbar span:nth-child(2) { flex: 0 0 18%; background: var(--amber); }
.colorbar span:nth-child(3) { flex: 1;       background: var(--blue); }

/* --- Club / competition header --- */
.club-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.club-header .inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.club-header .title {
    font-weight: 800;
    letter-spacing: 0.02em;
    font-size: 18px;
    text-transform: uppercase;
}
.club-header .comp {
    font-size: 16px;
    color: var(--text-soft);
    text-align: right;
}
.club-header .comp a { color: var(--blue); text-decoration: none; }
.club-header .comp a:hover { text-decoration: underline; }

/* --- Main match banner --- */
.banner-wrap {
    max-width: var(--maxw);
    margin: 22px auto 0;
    padding: 0 20px;
}
.banner {
    background: var(--banner-fade);
    color: #fff;
    border-radius: 14px 14px 0 0;
    padding: 26px 24px 22px;
    position: relative;
}

/* Mini scoreboard at the foot of the banner — not-out batters on the left,
   the current bowlers on the right (live innings only). */
.mini-board {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px 24px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.mb-side { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mb-mid { text-align: center; }
.mb-mid .mb-row { justify-content: center; }
/* Status cell only exists in the phone layout (desktop keeps the centre column) */
.mb-status { display: none; }
.mb-head {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 1px;
}
.mb-row { display: flex; align-items: baseline; gap: 10px; font-size: 16px; }
.mb-right { text-align: right; }
.mb-right .mb-row { justify-content: flex-end; }
.mb-name { font-weight: 700; color: #fff; white-space: nowrap; }
.mb-fig { font-weight: 800; color: #ffe08a; white-space: nowrap; }
.mb-sub { color: var(--muted); font-size: 14px; white-space: nowrap; }
.mb-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--live);
    margin-left: 7px;
    vertical-align: middle;
}
/* Most recent dismissal, dimmed beneath the live batters. */
.mb-lastwkt { margin-top: 2px; }
.mb-lastwkt .mb-name { color: #c8d2de; font-weight: 600; }
.mb-lastwkt .mb-fig { color: #c8d2de; }

/* Auto-refresh countdown: a thin bar along the bottom of the banner that fills
   over the poll interval, resetting each time the page reloads. */
.refresh-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.14);
    overflow: hidden;
}
.refresh-progress-fill {
    display: block;
    height: 100%;
    width: 0;
    background: rgba(255, 255, 255, 0.65);
}
@keyframes refreshFill {
    from { width: 0; }
    to { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .refresh-progress-fill { animation: none !important; width: 0; }
}
.live-dot {
    display: inline-block;
    vertical-align: middle;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--live);
    box-shadow: 0 0 0 0 rgba(18, 161, 80, 0.7);
    animation: pulse 1.6s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(18, 161, 80, 0.6); }
    70%  { box-shadow: 0 0 0 12px rgba(18, 161, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(18, 161, 80, 0); }
}

/* Teams line — three equal columns: home | center | away */
.teams-line {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: start;   /* line the two badges up along the top of the banner */
    gap: 16px;
}
.team { text-align: center; }
.team .badge {
    width: 72px;
    height: 72px;
    line-height: 72px;
    border-radius: 50%;
    border: 3px solid #fff;
    margin: 0 auto 8px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.team .badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #fff;
}
/* Coloured monogram fallback when a club has no crest. */
.team .badge.badge-mono {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
    box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.18),
                inset 0 8px 14px rgba(255, 255, 255, 0.14);
}
.team .name {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    min-height: 44px;
}
/* Split name: club in bold, the team label below it in normal weight. */
.team .name .club-name { display: block; font-weight: 700; }
.team .name .team-label {
    display: block;
    font-weight: 400;
    font-size: 16px;
    margin-top: 1px;
    color: #e7ebf1;
}
.team .score {
    font-size: 52px;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 6px;
}
.team .score .small { font-size: 30px; font-weight: 600; }
/* "Yet to bat" is a note, not a score — size it like the team name above. */
.team .score.na { font-size: 18px; font-weight: 600; margin-top: 12px; }
/* Breathing room on both sides of the slash between score and wickets. */
.team .score .score-sep { margin: 0 0.12em; }
.team .overs { font-size: 16px; color: var(--muted); margin-top: 2px; }
/* Innings picker: pills on desktop, a dropdown on phones once there are more
   than two innings (a multi-day match's four tabs otherwise fill the screen). */
.inns-select {
    display: none;
    width: 100%;
    font: inherit;
    font-size: 15px;
    padding: 9px 12px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.bb-tabs-wrap .inns-select { margin: 10px 18px 12px; width: calc(100% - 36px); }

/* Multi-day: the completed first innings above the current one ("312 & 180/3"). */
.team .inns-first {
    font-size: 20px;
    font-weight: 700;
    color: #cfd8e3;
    line-height: 1.1;
    margin-bottom: 2px;
}
.team .inns-amp { color: #93a3b5; font-weight: 500; margin-left: 2px; }
/* Which innings a tab refers to when a side bats twice. */
.innings-tab .tab-inns {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 1px;
}

/* All out / Declared pill under the score (all-out drops the /10 count). */
.team .all-out-line { margin-top: 5px; }
.team .all-out-line .ao-badge { font-size: 14px; padding: 3px 12px; }
.team.batting .score { color: #ffe08a; }

/* Center column: status, V, then stacked stats */
.center-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: center;   /* teams sit top-aligned; keep the V/status block centred */
    gap: 6px;
    min-width: 128px;
    text-align: center;
}
.center-col .status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.25;
    max-width: 260px;
    text-align: center;
}
/* Play-Cricket status silhouette — white PNG, sits above the status label. */
.center-col .status .status-icon {
    height: 46px;
    width: auto;
    display: block;
}
/* Finished match — Play-Cricket win style: the winning team's name on top, then
   the icon to the LEFT of the result with a green accent dot, and a white
   underline beneath the whole block. */
.center-col .status.status-result {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 340px;
    padding-bottom: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.92);
}
.result-winner {
    font-weight: 400;
    font-size: 24px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.15;
}
.result-line {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    font-size: 24px;
}
.center-col .status.status-result .status-icon { height: 58px; }
.result-line .status-label { text-align: left; }
.result-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--live);
    margin-left: 8px;
    vertical-align: baseline;
}
/* The score is only highlighted yellow while a game is in play (the batting
   side, see .team.batting). When the game is finished it returns to white. */
.center-col .vs-mark {
    font-size: 16px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.center-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 2px;
}
.cstat { display: flex; flex-direction: column; line-height: 1.05; }
.cstat .clabel {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}
.cstat .cval { font-size: 36px; font-weight: 800; color: #fff; }
.cstat .cval small { font-size: 16px; font-weight: 600; color: var(--muted); }

/* Need headline — large, matching the team score (52 / 30). */
.cstat-need .cval { font-size: 52px; }
.cstat-need .cval small { font-size: 30px; }

/* Two smaller stats side by side (e.g. current + required run rate under Need) */
.cstat-pair { display: flex; gap: 22px; justify-content: center; }
.cstat-pair .cstat { align-items: center; }
.cstat-pair .cval { font-size: 24px; }

/* All-out state (innings complete) shown in place of the projection */
.ao-note { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 2px; }
.ao-badge {
    display: inline-block;
    background: var(--amber);
    color: #23303c;
    font-weight: 800;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 14px;
    border-radius: 999px;
}
.ao-sub { font-size: 16px; color: var(--muted); }
.team .toss-note {
    font-size: 16px;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.3;
    padding: 0 6px;
}

/* --- Chase card (from the mock-up) --- */
.chase-card {
    width: 90%;
    max-width: 360px;
    margin: 18px auto 2px;
    text-align: left;
    color: #fff;
}
.chase-card-top {
    padding: 0 4px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.chase-card-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 16px;
    color: var(--muted);
    margin-bottom: 4px;
}
.chase-card-headline { font-size: 19px; color: var(--muted); font-weight: 400; line-height: 1.15; }
.chase-card-headline .cc-big { font-size: 32px; color: #fff; font-weight: 800; }
.chase-card-bottom { display: flex; padding-top: 10px; }
.chase-card-col { flex: 1; padding: 2px 4px; }
.chase-card-col + .chase-card-col {
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    padding-left: 16px;
}
.chase-card-label { font-size: 16px; color: var(--muted); margin-bottom: 1px; }
.chase-card-rate { font-size: 28px; color: #fff; font-weight: 800; line-height: 1.15; }

/* First-innings progress (run rate / projected total) */
.prog-card {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 16px auto 2px;
    color: #fff;
}
.prog-col { text-align: center; }
.prog-label {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 2px;
}
.prog-val { font-size: 30px; font-weight: 800; line-height: 1.1; }

/* Live overs-per-innings control on the banner (projection basis) */
.overs-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px auto 2px;
    color: var(--muted);
    font-size: 16px;
}
.overs-control label { text-transform: uppercase; letter-spacing: 0.04em; }
.overs-control input {
    width: 56px;
    padding: 3px 6px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
}
.overs-control input:focus { outline: none; border-color: #fff; background: rgba(255, 255, 255, 0.2); }
.overs-control .overs-hint { font-size: 16px; opacity: 0.75; }

/* --- Ball-by-ball strip (single scrollable line, most recent first) --- */
/* The over dot-strip — lives inside the Ball-by-Ball card's top row. */
.ball-strip {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    flex: 1 1 auto;
    min-width: 0;
    padding: 12px 4px 12px 16px;
    scrollbar-width: thin;
}
.ball-strip::-webkit-scrollbar { height: 8px; }
.ball-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.over { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.over-no {
    font-size: 16px;
    color: var(--text-soft);
    min-width: 14px;
    text-align: right;
    margin-right: 2px;
}
.over-sep { color: var(--border); font-weight: 700; padding: 0 3px; user-select: none; flex: 0 0 auto; }
/* Bowler of the over, shown after the over number. */
.over-bowler {
    font-size: 13px;
    color: var(--text-soft);
    white-space: nowrap;
    flex: 0 0 auto;
    margin-right: 3px;
}
.over-total {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-soft);
    margin-left: 3px;
    flex: 0 0 auto;
}

.ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: #cfd4da;
    cursor: help;
    flex: 0 0 auto;
}
.ball-dot   { background: #dfe3e8; }
.ball-dot::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6b7784;   /* centred dot inside the dot-ball circle */
}
.ball-run   { background: #7a8794; }
.ball-four  { background: #1e63c4; }   /* blue */
.ball-six   { background: #12a150; }   /* green */
.ball-wicket{ background: #c3271f; }   /* red */
.ball-wide,
.ball-noball,
.ball-bye   { background: #e8a22b; font-size: 16px; }  /* amber extras */

/* --- Ball-by-ball block: dot-strip + collapsible detail in one card --- */
.bb-wrap { padding-top: 18px; padding-bottom: 16px; }
.bb-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(16, 32, 52, 0.04), 0 4px 12px rgba(16, 32, 52, 0.04);
    overflow: hidden;
}
/* Top row: the scrollable strip with the collapse chevron pinned at the right. */
.bb-top {
    display: flex;
    align-items: center;
    gap: 4px;
}
.bb-toggle {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-right: 8px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}
.bb-toggle:hover { background: var(--row-alt); }
.bb-title {
    flex: 1;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
    font-weight: 700;
    padding: 14px 18px;
}
.bb-body { border-top: 1px solid var(--border); }
.bb-chevron {
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--text-soft);
    border-bottom: 2px solid var(--text-soft);
    transform: rotate(45deg);       /* pointing down (closed) */
    transition: transform 0.15s;
    margin-top: -4px;
}
.bb-chevron.open { transform: rotate(225deg); margin-top: 4px; }
.bb-tabs { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.bb-tab {
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.bb-tab.active {
    border-color: var(--blue);
    background: rgba(11, 65, 105, 0.06);
    color: var(--blue);
}
.bb-list {
    max-height: 430px;
    overflow-y: auto;
}
.bb-over-head {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 18px;
    background: var(--row-alt);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    font-weight: 700;
}
.bb-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
}
.bb-row .ball { cursor: default; }
.bb-row.bb-wkt { background: rgba(17, 20, 24, 0.04); }
.bb-text { flex: 1; color: var(--text); min-width: 0; }
.bb-score { color: var(--text-soft); font-weight: 600; white-space: nowrap; }

/* --- Key moments feed --- */
/* Header reads exactly like the scorecard section titles ("… — BOWLING"):
   plain uppercase label with only a chevron at the right to expand. */
.km-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
}
.km-head:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.km-title {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
    font-weight: 700;
}
.km-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
}
.km-badge {
    flex: 0 0 auto;
    min-width: 34px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
}
.km-w    { background: #c3271f; }   /* red, matching the wicket ball */
.km-50   { background: var(--amber); color: #23303c; }
.km-100  { background: var(--maroon); }
.km-team { background: var(--blue); }
.km-big  { background: #12a150; }
.km-text { flex: 1; color: var(--text); min-width: 0; }
.km-meta { color: var(--text-soft); font-size: 14px; white-space: nowrap; }

/* Note shown when a source scorecard doesn't reconcile with its own total. */
.card-gap {
    padding: 10px 18px 4px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-soft);
}

/* --- Fall of wickets --- */
.fow-line {
    padding: 12px 18px;
    font-size: 15px;
    color: var(--text-soft);
    line-height: 1.6;
}
.fow-label {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.04em;
    margin-right: 6px;
    color: var(--text);
}

/* --- Worm chase pace line --- */
.worm-pace { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 7 6; opacity: 0.9; }
.worm-pace-label { fill: #b07d18; font-size: 14px; font-weight: 700; text-anchor: end; }

/* --- Player hover card --- */
#playerCard {
    position: absolute;
    z-index: 250;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 280px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(8, 25, 47, 0.18);
    padding: 12px 14px;
}
.plc-photo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--row-alt);
    flex: 0 0 auto;
}
.plc-body { min-width: 0; }
.plc-name { font-size: 16px; font-weight: 700; color: var(--text); }
.plc-alias { font-size: 13px; color: var(--text-soft); margin-top: 1px; }
.plc-stats { display: flex; gap: 14px; margin-top: 4px; font-size: 14px; color: var(--text-soft); }
.plc-stats b { color: var(--text); }
.plc-link { margin-top: 4px; font-size: 13px; color: var(--text-soft); }

/* --- Totals-only feed (no ball/card data) --- */
.so-panel { padding: 18px 22px; }
.so-list { display: flex; flex-direction: column; gap: 4px; }
.so-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
}
.so-row:last-child { border-bottom: none; }
.so-team { font-size: 17px; font-weight: 700; color: var(--text); }
.so-score { font-size: 20px; font-weight: 800; color: var(--text); white-space: nowrap; }
.so-ov { font-size: 14px; font-weight: 500; color: var(--text-soft); }
.so-note {
    margin: 12px 4px 0;
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.5;
}

/* --- Innings tabs --- */
.card {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 20px 40px;
}
.innings-tabs {
    display: flex;
    flex-wrap: wrap;
    /* Square bottom so the tabs sit flush against the block below them. */
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}
.innings-tab {
    flex: 1;
    min-width: 160px;
    background: var(--page-bg);
    color: var(--text);
    padding: 12px 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
    /* Every tab reserves a 1px border on all sides (transparent by default) so
       the boxes stay aligned; each state then colours only the sides it needs.
       An unselected tab shows just its bottom edge — the panel's top line runs
       under it — with nothing on the top or sides. */
    border: 1px solid transparent;
    border-bottom-color: var(--border);
}
.innings-tab:hover { background: #eceef1; }
/* The selected tab's outline wraps up the left, over the top and down the
   right, then opens at the bottom so it joins the panel below — the border
   runs around the tab and back around the scorecard as one continuous line. */
.innings-tab.active {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
    border-bottom-color: transparent;
}
.innings-tab .tab-score { display: block; font-size: 16px; font-weight: 500; color: var(--text-soft); }

/* --- Scorecard tables --- */
/* Transparent container; each section is its own white block, so the gaps
   between them reveal the grey page background as a separator. */
.scorecard {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sc-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 0 12px;
}
/* When innings tabs are present the first block joins directly onto the active
   tab: no rounded top, no top border, no gap — so the tab and its content read
   as one connected panel. */
.scorecard.has-tabs .sc-block:first-child {
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.sc-section-title {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
    font-weight: 700;
    padding: 16px 18px 6px;
}
/* Tables scroll horizontally rather than crush their columns on narrow screens. */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.sc {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    font-size: 16px;
}
table.sc th {
    text-align: right;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    font-weight: 600;
    padding: 6px 10px;
    border-bottom: 2px solid var(--border);
}
table.sc th.left { text-align: left; padding-left: 18px; }
table.sc td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}
table.sc td.left { text-align: left; padding-left: 18px; white-space: normal; }
table.sc tbody tr:nth-child(even) { background: var(--row-alt); }
table.sc td.name { font-weight: 600; }
a.pc-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted #b7bdc4;
}
a.pc-link:hover { color: var(--blue); border-bottom-color: var(--blue); }
.on-strike {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--live);
    margin-left: 7px;
    vertical-align: middle;
}
table.sc td.name .order {
    display: inline-block;
    color: #9aa1a9;
    font-size: 16px;
    font-weight: 400;
    margin-right: 8px;
}
table.sc td.howout-cell {
    text-align: left;
    font-weight: 400;
    font-size: 16px;
    color: var(--text-soft);
    white-space: normal;
}
.pill-notout {
    display: inline-block;
    background: #6b7784;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
/* Captain (C) / wicket-keeper (WK) markers next to a player's name */
.role-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 5px;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0.02em;
    color: #fff;
}
.role-badge + .role-badge { margin-left: 3px; }
.role-c { background: var(--maroon); }
.role-wk { background: var(--blue); }
.dnb-row .role-c { background: #b08790; }
.dnb-row .role-wk { background: #8aa3b8; }

td.strong { font-weight: 800; }
.na { color: #c4c9cf; }
.extras-row td, .total-row td { font-weight: 700; border-top: 2px solid var(--border); }
.total-row td { font-size: 16px; }
.dnb-row td { color: var(--text-soft); }
.dnb-row td.name a.pc-link { color: var(--text-soft); }
.dnb-row .howout-cell { font-style: italic; }

/* --- Worm graph --- */
.worm-card { padding: 8px 0 10px; }
.worm-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding-right: 18px;
}
.worm-legend { display: flex; gap: 16px; flex-wrap: wrap; }
.worm-leg {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 16px;
    color: var(--text);
}
.worm-leg i {
    width: 16px;
    height: 4px;
    border-radius: 2px;
    display: inline-block;
}
.worm-leg.sq i { width: 12px; height: 12px; }
.mbar { transition: opacity 0.1s; }
.mbar:hover { opacity: 0.82; }
.worm-chart { padding: 4px 6px 0; position: relative; }
.worm-chart svg { width: 100%; height: auto; display: block; }
.worm-hit { cursor: crosshair; }
.worm-cross { stroke: #9aa1a9; stroke-width: 1; stroke-dasharray: 4 3; pointer-events: none; }
.worm-marker { pointer-events: none; }
.worm-tip {
    position: absolute;
    top: 8px;
    background: rgba(35, 48, 60, 0.95);
    color: #fff;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 16px;
    line-height: 1.5;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    z-index: 5;
}
.worm-tip .wt-over { font-weight: 700; margin-bottom: 3px; color: #cfd6dd; }
.worm-tip .wt-row { display: flex; align-items: center; gap: 6px; }
.worm-tip .wt-row i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.worm-tip .wt-row b { margin-left: auto; padding-left: 12px; }
.worm-grid { stroke: #eef1f4; stroke-width: 1; }
.worm-axis { stroke: #d3d8de; stroke-width: 1; }
.worm-ylabel { fill: var(--text-soft); font-size: 16px; text-anchor: end; }
.worm-xlabel { fill: var(--text-soft); font-size: 16px; text-anchor: middle; }
.worm-axis-title {
    fill: var(--text-soft);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-anchor: middle;
}

/* --- Win predictor (WinViz) --- */
.winviz-card { padding: 6px 0 14px; }
.winviz-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding-right: 18px;
}
.winviz-note { font-size: 16px; color: var(--text-soft); }
/* Tighten the space between the "Win predictor" title and the bar below it. */
.winviz-head .sc-section-title { padding-bottom: 0; }
.winviz-body { padding: 0 18px 0; }
.winviz-labels {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 2px 0 8px;
}
.wv-team {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-size: 16px;
    color: var(--text-soft);
    min-width: 0;
    flex: 0 1 auto;
    max-width: 49%;
}
.wv-team b { font-size: 20px; font-weight: 800; color: var(--text); }
.wv-team .wv-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.winviz-bar {
    display: flex;
    height: 22px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--border);
}
.wv-seg { height: 100%; transition: width 0.5s ease; }
/* 2px surface divider between segments (box-sizing:border-box keeps widths exact) */
.wv-seg + .wv-seg { border-left: 2px solid var(--surface); }
.winviz-labels-3 .wv-team { max-width: 33%; }
.wv-team.wv-draw { color: var(--text-soft); }
.wv-team.wv-draw b { color: #64748b; }
.winviz-draw-note {
    font-size: 14px;
    color: var(--text-soft);
    padding: 9px 0 2px;
    text-align: center;
}
.winviz-draw-note b { color: var(--text); font-weight: 700; }

/* --- Partnership bars --- */
.pnr-block { padding-bottom: 14px; }
.pnr-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 2px 0 12px;
}
.pnr-key {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 16px;
    color: var(--text-soft);
}
.pnr-sw { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.pnr-others { background: #2f6fd6; }   /* singles / other runs */
.pnr-fours  { background: #e0392b; }   /* 4s */
.pnr-sixes  { background: var(--maroon); }  /* 6s */

.pnr-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pnr-chart { position: relative; min-width: 540px; padding: 0 14px; }
/* Continuous dashed centre line the bars diverge from. */
.pnr-axis {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    border-left: 1px dashed #b6bbc2;
    transform: translateX(-0.5px);
}
.pnr-row {
    display: grid;
    grid-template-columns: 1fr 240px 1fr;
    align-items: center;
    column-gap: 10px;
    padding: 6px 0;
}
.pnr-name { font-size: 16px; white-space: nowrap; color: var(--text); }
.pnr-name b { font-weight: 700; }
/* Batter's share of the partnership's off-the-bat runs */
.pnr-pct {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
    background: var(--row-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 7px;
    line-height: 1.6;
    vertical-align: 1px;
}
.pnr-name-left { text-align: right; }
.pnr-name-right { text-align: left; }
.pnr-mid { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pnr-total { font-size: 16px; font-weight: 700; position: relative; }
.pnr-bars { display: flex; width: 100%; }
/* 1px gap so adjacent colour segments stay legible. */
.pnr-half { flex: 1; display: flex; gap: 1px; }
.pnr-half-left { justify-content: flex-end; }
.pnr-half-right { justify-content: flex-start; }
.pnr-seg { height: 13px; display: inline-block; }

/* --- Header nav controls (Match Feed link + recent-matches dropdown) --- */
.hdr-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hdr-controls { display: flex; align-items: center; gap: 14px; }
.hdr-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
}
.hdr-link:hover { text-decoration: underline; }
.hdr-recent {
    font-size: 16px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    max-width: 240px;
    cursor: pointer;
}
.hdr-btn {
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    color: var(--blue);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    white-space: nowrap;
}
.hdr-btn:hover { text-decoration: underline; }

/* --- Settings modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 25, 47, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
}
.modal-overlay[hidden] { display: none; }
body.modal-open { overflow: hidden; }
.modal {
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(8, 25, 47, 0.35);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 19px; font-weight: 800; margin: 0; }
.modal-close {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--text-soft);
    cursor: pointer;
    padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 22px; }
.mfield { margin-bottom: 16px; }
.mfield:last-child { margin-bottom: 0; }
.mlabel {
    display: block;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-soft);
    font-weight: 600;
    margin-bottom: 6px;
}
.modal input[type="number"] {
    width: 100%;
    font-size: 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}
.modal input[type="number"]:focus { outline: none; border-color: var(--blue); }
.modal select.mselect {
    width: 100%;
    font-size: 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.modal select.mselect:focus { outline: none; border-color: var(--blue); }
.mfield-sep {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.seg { display: flex; gap: 8px; }
.seg-opt {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.seg-opt:has(input:checked) {
    border-color: var(--blue);
    background: rgba(11, 65, 105, 0.06);
    color: var(--blue);
}
.seg-opt input { accent-color: var(--blue); }
.mrow { display: flex; gap: 12px; }
.mrow .mfield { flex: 1; margin-bottom: 0; }
.fmt-fields[hidden] { display: none; }
.fmt-fields { margin-top: 4px; }
.modal-note { margin-top: 12px; font-size: 14px; color: var(--text-soft); line-height: 1.45; }
.modal-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    border-top: 1px solid var(--border);
}
.modal-msg { flex: 1; font-size: 15px; color: var(--text-soft); }
.modal-msg.err { color: var(--maroon); }
.btn-primary, .btn-secondary {
    font-size: 16px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #0a3a5f; }
.btn-primary:disabled { opacity: 0.55; cursor: default; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--row-alt); }

/* --- Match feed / results page --- */
.mf-wrap { max-width: var(--maxw); margin: 22px auto 40px; padding: 0 20px; }

/* Admin unlock + track-a-match forms */
.mf-auth, .mf-add { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.mf-auth[hidden], .mf-add[hidden], .mf-signed[hidden] { display: none; }
.mf-auth .mf-input { flex: 1 1 180px; }
.mf-signed {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    color: var(--text-soft);
    margin-bottom: 12px;
}
.mf-signed strong { color: var(--text); font-weight: 600; }
.mf-linkbtn {
    background: none;
    border: none;
    padding: 0;
    font-size: 16px;
    color: var(--blue);
    cursor: pointer;
    text-decoration: underline;
}
.mf-linkbtn:hover { color: var(--maroon); }
.mf-input, .mf-overs {
    font-size: 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}
.mf-input { flex: 1 1 320px; min-width: 0; }
.mf-overs { flex: 0 0 90px; width: 90px; }
.mf-input:focus, .mf-overs:focus { outline: none; border-color: var(--blue); }
.mf-btn {
    flex: 0 0 auto;
    font-size: 16px;
    font-weight: 700;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}
.mf-btn:hover { background: #0a3a5f; }
.mf-btn:disabled { opacity: 0.55; cursor: default; }
.mf-add-msg { font-size: 16px; min-height: 1.25em; margin-bottom: 16px; color: var(--text-soft); }
.mf-add-msg.err { color: var(--maroon); }
.mf-add-msg.ok { color: var(--live); }

.mf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}
/* Date grouping: a day-name heading above each day's matches. */
.mf-daygroup { margin-bottom: 26px; }
.mf-dayhead {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--maroon);
}
.mf-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(16, 32, 52, 0.04), 0 4px 12px rgba(16, 32, 52, 0.04);
    transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
.mf-card:hover {
    border-color: #cdd2d8;
    box-shadow: 0 4px 14px rgba(8, 25, 47, 0.08);
    transform: translateY(-1px);
}
.mf-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mf-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #fff;
    background: #6b7280;
}
.mf-badge.mf-live { background: var(--live); }
.mf-badge.mf-upcoming { background: #2563eb; }
.mf-badge.mf-complete { background: #6b7280; }
.mf-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
.mf-grade { font-size: 16px; color: var(--text-soft); }
.mf-teams { display: flex; flex-direction: column; gap: 6px; }
.mf-team { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mf-name { font-size: 18px; font-weight: 700; line-height: 1.2; }
.mf-score { font-size: 18px; font-weight: 800; white-space: nowrap; }
.mf-score .mf-wkts { font-weight: 600; }
.mf-score .mf-ov { font-size: 16px; font-weight: 500; color: var(--text-soft); }
.mf-score .mf-yet { font-size: 16px; font-weight: 500; color: var(--text-soft); }
.mf-foot {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 16px;
    color: var(--text-soft);
    min-height: 1.2em;
}
.mf-foot .mf-err { color: var(--maroon); }

/* --- Competition (grade) page + in-match competition sections --- */
.cmp-wrap { max-width: var(--maxw); margin: 22px auto 40px; padding: 0 20px; }
.cmp-section { margin-bottom: 26px; }
.cmp-h {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--maroon);
}
.cmp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}
.cmp-match {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 13px 15px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(16, 32, 52, 0.04), 0 4px 12px rgba(16, 32, 52, 0.04);
}
.cmp-match.is-link { transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s; }
.cmp-match.is-link:hover {
    border-color: #cdd2d8;
    box-shadow: 0 4px 14px rgba(8, 25, 47, 0.08);
    transform: translateY(-1px);
}
.cmp-match-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cmp-when { font-size: 14px; color: var(--text-soft); }
.cmp-teams { display: flex; flex-direction: column; gap: 4px; }
.cmp-team { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cmp-name { font-size: 16px; color: var(--text); }
.cmp-team.winner .cmp-name { font-weight: 700; }
.cmp-score { font-size: 16px; font-weight: 600; color: var(--text); white-space: nowrap; }
.cmp-foot {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid var(--border);
    font-size: 15px;
    color: var(--text-soft);
    min-height: 1.1em;
}

.cmp-table-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.cmp-table th, .cmp-table td {
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.cmp-table thead th {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-soft);
    font-weight: 600;
}
.cmp-table th.cmp-tname, .cmp-table td.cmp-tname { text-align: left; white-space: normal; }
.cmp-table th.cmp-pos, .cmp-table td.cmp-pos { color: var(--text-soft); width: 2em; }
.cmp-table tbody tr:last-child td { border-bottom: none; }
.cmp-table tbody tr:hover td { background: var(--row-alt); }
.cmp-table-panel { padding: 8px 12px; }

/* Official-table link + admin editor beneath the standings. */
.cmp-table-note {
    margin: 8px 6px 2px;
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.5;
}
.cmp-official-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 6px 6px 4px;
}
.cmp-official {
    font-size: 14px;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
}
.cmp-official:hover { text-decoration: underline; }
.cmp-link-edit {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 13px;
    color: var(--text-soft);
    text-decoration: underline;
    cursor: pointer;
}
.cmp-link-edit:hover { color: var(--text); }

/* Reusable surface panel + its centred layout wrapper. */
.mc-sec {
    max-width: var(--maxw);
    margin: 16px auto 0;
    padding: 0 20px;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 32, 52, 0.04), 0 8px 22px rgba(16, 32, 52, 0.05);
    padding: 20px 22px;
}

/* Upcoming banner is a standalone hero (nothing sits flush below it). */
.banner-wrap-standalone .banner {
    border-radius: 14px;
    box-shadow: 0 2px 4px rgba(8, 25, 47, 0.10), 0 14px 34px rgba(8, 25, 47, 0.14);
}

/* Card heading used by the panels */
.card-h {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 14px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--border);
}

/* Scheduled-match detail panel */
.sched-grid { display: flex; flex-direction: column; gap: 10px; }
.sched-row { display: flex; gap: 14px; align-items: baseline; }
.sched-label {
    flex: 0 0 108px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-soft);
    font-weight: 600;
}
.sched-val { font-size: 16px; color: var(--text); }
.sched-val a { color: var(--blue); text-decoration: none; }
.sched-val a:hover { text-decoration: underline; }

/* Recent form */
.form-wrap { display: flex; flex-direction: column; gap: 14px; }
.form-team { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.form-tname { font-size: 16px; font-weight: 600; color: var(--text); }
.form-pills { display: flex; gap: 6px; align-items: center; }
.form-link { text-decoration: none; }
.form-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}
.form-w { background: var(--live); }
.form-l { background: var(--maroon); }
.form-t { background: #94a3b8; }
.form-none { font-size: 15px; color: var(--text-soft); }
.form-note { margin-top: 12px; font-size: 14px; color: var(--text-soft); }

/* In this competition */
.ic-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}
.ic-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-soft);
    font-weight: 600;
    margin-bottom: 6px;
}
.ic-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}
.ic-row:last-child { border-bottom: none; }
a.ic-row.is-link:hover .ic-teams { color: var(--blue); }
.ic-teams { font-size: 15px; }
.ic-meta { font-size: 14px; color: var(--text-soft); white-space: nowrap; text-align: right; }
.ic-all {
    display: inline-block;
    margin-top: 14px;
    font-size: 15px;
    color: var(--blue);
    text-decoration: none;
    font-weight: 600;
}
.ic-all:hover { text-decoration: underline; }

/* --- Footer / refresh status --- */
.refresh-bar {
    max-width: var(--maxw);
    margin: 14px auto 40px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 16px;
    color: var(--text-soft);
    flex-wrap: wrap;
}
.refresh-bar .live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--live);
    font-weight: 700;
}
.refresh-bar button {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 16px;
    cursor: pointer;
}
.refresh-bar button:hover { background: var(--row-alt); }
.refresh-bar button:disabled { opacity: 0.5; cursor: default; }

.state-msg {
    max-width: var(--maxw);
    margin: 60px auto;
    padding: 0 20px;
    text-align: center;
    color: var(--text-soft);
}
.state-msg.error { color: var(--maroon); }

/* ---------- Mobile / small screens ---------- */
@media (max-width: 680px) {
    /* Swap the innings pills for the dropdown when there are several. */
    .has-inns-select .bb-tabs,
    .has-inns-select .innings-tabs { display: none; }
    .has-inns-select .inns-select { display: block; }
    .innings-tabs-wrap .inns-select { margin: 0 0 12px; }

    /* Compact header: everything shrinks so the title, recent-matches
       dropdown, Settings and Match Feed all fit a phone width. */
    .club-header .inner { padding: 8px 12px; gap: 6px 10px; }
    .club-header .title { font-size: 14px; line-height: 1.25; }
    .club-header .comp { font-size: 13px; }
    .hdr-right { gap: 4px; }
    .hdr-controls { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
    .hdr-recent { max-width: 42vw; font-size: 13px; padding: 3px 5px; }
    .hdr-btn, .hdr-link { font-size: 13px; }

    .banner-wrap { padding: 0 10px; }
    .card { padding: 0 10px 30px; }
    .banner { padding: 18px 12px 16px; border-radius: 12px 12px 0 0; }

    /* Phones: the two teams sit side by side and the centre column (status +
       run-rate / chase figures) drops below them, full width, so nothing is
       squeezed into a skinny middle track. */
    .teams-line { grid-template-columns: 1fr 1fr; gap: 10px; }
    .team .badge { width: 52px; height: 52px; line-height: 52px; font-size: 17px; margin-bottom: 6px; }
    .team .name { font-size: 16px; min-height: 31px; line-height: 1.15; }
    .team .score { font-size: 26px; margin-top: 4px; }
    .team .score.na { font-size: 16px; margin-top: 8px; }
    .team .score .small { font-size: 17px; }
    .team .overs { font-size: 16px; }
    .team .toss-note { font-size: 16px; margin-top: 5px; padding: 0 2px; }

    .center-col {
        grid-column: 1 / -1;   /* full width, on its own row below the teams */
        grid-row: 2;
        min-width: 0;
        gap: 6px;
        margin-top: 14px;
        padding-top: 14px;
        border-top: 1px solid rgba(255, 255, 255, 0.16);
    }
    .center-col .vs-mark { display: none; }   /* meaningless once it's not between the teams */
    .center-col .status { font-size: 16px; max-width: none; gap: 6px; }
    .center-col .status .status-icon { height: 34px; }
    .center-col .status.status-result { gap: 8px; max-width: none; padding-bottom: 8px; }
    .center-col .status.status-result .status-icon { height: 40px; }
    .result-winner { font-size: 20px; }
    .result-line { font-size: 20px; }
    /* Plenty of width now: stats sit in a row instead of a cramped stack. */
    .center-stats { flex-direction: row; justify-content: center; align-items: flex-end; gap: 24px; }
    .cstat { align-items: center; }
    .cstat .clabel { font-size: 16px; }
    .cstat .cval { font-size: 26px; }
    .cstat .cval small { font-size: 16px; }
    .cstat-pair { gap: 24px; }
    .cstat-pair .cval { font-size: 26px; }
    .cstat-need .cval { font-size: 34px; }
    .cstat-need .cval small { font-size: 18px; }

    /* Mini scoreboard, phone layout: the in-progress status moves into the
       board (left) with the projection beside it (right); batting and bowling
       sit on the row below. The banner's own centre column hides. */
    .banner.board-live .center-col { display: none; }
    .mini-board {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "status mid"
            "bat    bowl";
        gap: 12px 16px;
        margin-top: 14px;
        padding-top: 12px;
    }
    .mb-status {
        grid-area: status;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 6px;
    }
    .mb-status .status-icon { height: 34px; width: auto; }
    .mb-status-label {
        font-size: 16px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }
    .mb-bat { grid-area: bat; }
    .mb-right { grid-area: bowl; }
    .mb-mid {
        grid-area: mid;
        text-align: right;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }
    .mb-mid .mb-row { justify-content: flex-end; }
    .mb-bat, .mb-right {
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }
    .mb-row { font-size: 15px; gap: 8px; }
    .mb-sub { font-size: 13px; }
    .ao-badge { font-size: 16px; padding: 3px 10px; }
    .overs-control { font-size: 16px; gap: 6px; flex-wrap: wrap; }
    .overs-control input { width: 48px; }

    /* Scorecard: tables already scroll (min-width); tighten the surrounding chrome. */
    .sc-section-title { padding: 12px 12px 6px; font-size: 16px; }
    table.sc { font-size: 16px; }
    table.sc th.left, table.sc td.left { padding-left: 12px; }
    .innings-tab { min-width: 120px; font-size: 16px; padding: 10px 8px; }
    .innings-tab .tab-score { font-size: 16px; }

    /* Charts scroll rather than shrink their labels into illegibility. */
    .worm-chart { overflow-x: auto; padding: 4px 0 0; }
    .worm-chart svg { min-width: 560px; }
    .worm-head { padding-right: 12px; }
    .worm-legend { gap: 10px; }
    .worm-leg { font-size: 16px; }

    .winviz-note { display: none; }
    .winviz-head, .winviz-body { padding-left: 12px; padding-right: 12px; }
    .winviz-body { padding-left: 12px; padding-right: 12px; }
    .wv-team { font-size: 16px; }
    .wv-team b { font-size: 16px; }
}

@media (max-width: 380px) {
    .team .name { font-size: 16px; }
    .team .score { font-size: 19px; }
    .center-col .status { font-size: 16px; }
    .cstat .cval { font-size: 19px; }
}

/* Settings modal: where the game format came from. */
.fmt-source { margin: 0 0 14px; padding: 8px 10px; border-radius: 6px; background: var(--row-alt); color: var(--text-soft); }
.fmt-source[hidden] { display: none; }
