/* Crickerr score viewer — compact iOS-style layer.
   Loaded after the page's own styles; only adjusts type, spacing and surfaces. */
:root {
    --ios-bg: #f2f2f7;
    --ios-card: #ffffff;
    --ios-label: #1c1c1e;
    --ios-label-2: #6e6e73;
    --ios-label-3: #8e8e93;
    --ios-sep: rgba(60, 60, 67, 0.18);
    --ios-fill: rgba(120, 120, 128, 0.12);
    --ios-blue: #007aff;
    --ios-red: #ff3b30;
    --ios-green: #34c759;
}
[data-theme="dark"] {
    --ios-bg: #000000;
    --ios-card: #1c1c1e;
    --ios-label: #f2f2f7;
    --ios-label-2: #aeaeb2;
    --ios-label-3: #8e8e93;
    --ios-sep: rgba(84, 84, 88, 0.6);
    --ios-fill: rgba(118, 118, 128, 0.24);
    --ios-blue: #0a84ff;
    --ios-red: #ff453a;
    --ios-green: #30d158;
}

html body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}
html body:not(.crk-deep), html body.on-detail { background: var(--ios-bg); }

/* ── Top bar ───────────────────────────────────────────── */
html .nav-glass {
    box-shadow: none;
    border-bottom: 0.5px solid var(--ios-sep);
}
html .nav-glass img { max-height: 34px; width: auto; }

/* ── Home: title, search, segmented control, chips ─────── */
html .m3-eyebrow { font-size: 13px; font-weight: 500; color: var(--ios-label-3); }
html .m3-title { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.02em; color: var(--ios-label); }
html #home-view .search-bar {
    height: 36px; border-radius: 10px; padding-left: 34px;
    background: var(--ios-fill); font: 400 15px -apple-system, system-ui, sans-serif;
}
html #search-container > svg { left: 10px; width: 16px; height: 16px; }
html .m3-segmented {
    height: 32px; border: 0; border-radius: 9px; padding: 2px;
    background: var(--ios-fill); gap: 0; margin-bottom: 10px;
}
html .m3-segmented .tab-btn { border-radius: 7px; font: 500 13px -apple-system, system-ui, sans-serif; color: var(--ios-label); }
html .m3-segmented .tab-btn + .tab-btn { border-left: 0; }
html .m3-segmented .tab-btn.active {
    background: var(--ios-card); color: var(--ios-label); font-weight: 600;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
}
html .m3-segmented .tab-btn.active::before { display: none; }
html .m3-chip { height: 28px; padding: 0 12px; border-radius: 14px; border: 0; background: var(--ios-fill); color: var(--ios-label); font: 600 12px -apple-system, system-ui, sans-serif; }
html .m3-chip.on { background: var(--ios-label); color: var(--ios-card); }

/* ── Home: match cards ─────────────────────────────────── */
html #matches-container .section-label.m3-group { margin: 18px 4px 6px; }
html .m3-group-date { font-size: 13px; font-weight: 600; color: var(--ios-label-2); text-transform: uppercase; letter-spacing: 0.01em; }
html .m3-group-venue { font-size: 12px; color: var(--ios-label-3); }
html .match-card-pro.m3-card {
    background: var(--ios-card); border-radius: 14px; padding: 11px 12px; gap: 6px;
    box-shadow: none;
}
html .m3-card .match-card-accent.live,
html .m3-card .match-card-accent.grand-final,
html .m3-card .match-card-accent.grand-final-live { margin: -11px -12px -2px; }
html .m3-meta { font-size: 11px; font-weight: 500; color: var(--ios-label-3); }
html .m3-status, html .m3-tag { font-size: 11px; }
html .m3-team { min-height: 28px; gap: 9px; }
html .m3-card .team-logo-circle { width: 24px; height: 24px; font-size: 10px; }
html .m3-team-name { font-size: 15px; font-weight: 600; color: var(--ios-label); text-transform: capitalize; }
html .m3-card .score-badge { font-size: 15px; font-weight: 600; letter-spacing: 0; }
html .m3-card-foot { padding-top: 7px; border-top: 0.5px solid var(--ios-sep); font-size: 12px; font-weight: 500; color: var(--ios-label-2); }
html .m3-card-foot.is-live { color: var(--ios-red); }
html .m3-series-tab { height: 28px; font-size: 12px; }

/* ── Match: hero becomes a compact score card ──────────── */
html .match-hero {
    margin: 8px 16px 10px; border-radius: 16px;
    background: var(--ios-card); box-shadow: none;
}
html .match-hero::before, html .match-hero::after { display: none; }
html .match-hero > .relative { padding: 12px 12px 12px; }
html .match-hero #d-series { color: var(--ios-label-3) !important; font-size: 11px !important; font-weight: 600 !important; letter-spacing: 0.02em; }
html .match-hero #d-t1-name, html .match-hero #d-t2-name {
    color: var(--ios-label-2) !important; font-size: 12px !important; font-weight: 600 !important;
    letter-spacing: 0 !important; text-transform: none;
}
html .match-hero #d-t1-score, html .match-hero #d-t2-score {
    color: var(--ios-label) !important; font-size: 24px !important; font-weight: 700 !important; letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
html .match-hero #d-t1-score.inactive-team, html .match-hero #d-t2-score.inactive-team { color: var(--ios-label-3) !important; }
html .match-hero #d-t1-score span, html .match-hero #d-t2-score span { font-size: 13px !important; font-weight: 500 !important; color: var(--ios-label-3) !important; opacity: 1; }
html .match-hero #d-note { color: var(--ios-label-3) !important; }
html .match-hero div[style*="width: 18%"] > div:first-child { color: var(--ios-label-3) !important; font-size: 12px !important; }
html .match-hero-logo { width: 44px; height: 44px; background: var(--ios-fill); box-shadow: none !important; }
html .match-hero-logo::after { display: none; }

/* Status line under the score */
html #d-chase-banner,
html #d-chase-banner.first-innings,
html #d-chase-banner.won {
    background: var(--ios-card) !important; border: 0 !important; box-shadow: none !important;
    border-radius: 12px; padding: 8px 12px; color: var(--ios-label) !important;
}
html #d-chase-banner #d-chase-runs,
html #d-chase-banner.first-innings #d-chase-runs,
html #d-chase-banner.first-innings #d-chase-runs span {
    color: var(--ios-label) !important; text-shadow: none !important;
    font-family: inherit !important; font-size: 14px !important; font-weight: 600 !important;
}
html #d-chase-banner.urgent #d-chase-runs { color: var(--ios-red) !important; text-shadow: none !important; }
html #d-chase-banner.won #d-chase-runs { color: var(--ios-green) !important; }
html #d-chase-prefix { color: var(--ios-label-3) !important; font-size: 11px !important; font-weight: 600 !important; }

/* CRR / Projected / RRR */
html .stat-pill {
    background: var(--ios-card); border: 0; border-radius: 12px; padding: 7px 6px;
    box-shadow: none;
}
html .stat-pill::before { display: none; }
html .stat-pill-label { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ios-label-3); }
html .stat-pill-value { font-family: inherit; font-size: 16px; font-weight: 600; margin-top: 1px; font-variant-numeric: tabular-nums; }
html .stat-pill-value.highlight { color: var(--ios-blue); }

/* Notify / Share buttons */
html .action-btn {
    background: var(--ios-card); border: 0; border-radius: 12px; padding: 9px 8px;
    font-size: 14px; font-weight: 600; color: var(--ios-blue); box-shadow: none;
}
html .action-btn::before { display: none; }
html .action-btn.primary { background: var(--ios-blue); color: #fff; box-shadow: none; }
html .action-btn.primary:active { background: var(--ios-blue); opacity: 0.8; }

/* Scorecard / Ball-by-Ball / Squads tabs → segmented control */
html .detail-tab-bar {
    margin: 0 16px 10px; padding: 2px; gap: 0; border-radius: 9px;
    background: var(--ios-fill); border: 0;
}
html .detail-tab-item {
    flex: 1 0 auto; padding: 6px 12px; font-size: 13px; font-weight: 500; border-radius: 7px;
    background: transparent; color: var(--ios-label); border: 0;
}
html .detail-tab-item.active,
html[data-theme="dark"] .detail-tab-item.active {
    background: var(--ios-card); color: var(--ios-label); font-weight: 600;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
}
html .detail-tab-bar.has-thumb .detail-tab-item.active { background: var(--ios-card); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); }
html .detail-tab-bar .tab-thumb, html .detail-tab-bar [class*="thumb"] { display: none; }

/* Scorecard */
html .scorecard-panel,
html[data-theme="dark"] .scorecard-panel {
    background: var(--ios-card); border: 0; border-radius: 14px; box-shadow: none;
}
html .innings-header,
html .innings-header.i2,
html[data-theme="dark"] .innings-header,
html[data-theme="dark"] .innings-header.i2 {
    background: transparent; border-bottom: 0.5px solid var(--ios-sep); padding: 12px 14px;
}
html .scorecard-panel .innings-total-pill,
html[data-theme="dark"] .scorecard-panel .innings-total-pill {
    font-family: inherit; font-size: 17px; font-weight: 700; padding: 0; background: transparent; box-shadow: none;
    color: var(--ios-label) !important;
}
html .sc-section-title { font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: var(--ios-label-3); padding: 12px 14px 4px; }
html .sc-section-title::after { display: none; }
html .batter-name, html .bowler-name { font-size: 14px; font-weight: 600; }
html .batter-row.is-out .batter-name, html .batter-row.is-not-out .batter-name { color: var(--ios-label); }
html .dismissal-text { font-size: 11px; font-weight: 400; color: var(--ios-label-3); }
html .sc-num.runs-val { font-size: 14px; font-weight: 600; }
html .total-row .total-value { font-family: inherit; font-size: 17px; font-weight: 700; color: var(--ios-label); }
html .sc-num,
html .inn-summary .value,
html .stat-pill-value { font-family: inherit !important; font-variant-numeric: tabular-nums; }
html .sc-num { font-size: 13px; }
html .inn-summary .label { font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ios-label-3); }
html .inn-summary .value { font-size: 15px; font-weight: 600; }
html .match-hero [style*="letter-spacing:0.15em"] {
    background: none !important; -webkit-text-fill-color: var(--ios-label-3) !important;
    font-size: 11px !important; font-weight: 600 !important; letter-spacing: 0.04em !important;
}
html .nav-glass > div { padding-bottom: 6px; }
html .nav-glass img { max-height: 28px; }
html[data-theme="dark"] .action-btn.primary { background: var(--ios-blue); box-shadow: none; }
html[data-theme="dark"] .action-btn { box-shadow: none; }
html[data-theme="dark"] .stat-pill { box-shadow: none; }
html .batter-row td, html .bowler-row td { padding-top: 7px; padding-bottom: 7px; }

/* ── Share / alert buttons on cards ────────────────────── */
html .crk-card-tools { margin-left: auto; display: inline-flex; gap: 6px; flex-shrink: 0; }
html .crk-icon-btn {
    width: 28px; height: 28px; border-radius: 14px; border: 0; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(0, 122, 255, 0.1); color: var(--ios-blue); cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
html .crk-icon-btn svg { width: 15px; height: 15px; }
html .crk-icon-btn:active { opacity: 0.6; }
html .crk-tourn-share { position: absolute; top: 10px; right: 10px; z-index: 5; }

/* ── Alerts sheet ──────────────────────────────────────── */
.crk-sheet-wrap {
    position: fixed; inset: 0; z-index: 99999; background: rgba(0, 0, 0, 0.35);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    animation: crkFade 0.2s ease;
}
.crk-sheet {
    width: 100%; max-width: 420px; background: var(--ios-card); color: var(--ios-label);
    border-radius: 16px; overflow: hidden; font-family: -apple-system, system-ui, sans-serif;
    animation: crkUp 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.crk-sheet-head { padding: 14px 16px 12px; text-align: center; border-bottom: 0.5px solid var(--ios-sep); }
.crk-sheet-head b { display: block; font-size: 15px; font-weight: 600; }
.crk-sheet-head span { display: block; font-size: 12px; color: var(--ios-label-3); margin-top: 3px; }
.crk-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 16px; font-size: 15px; border-bottom: 0.5px solid var(--ios-sep); cursor: pointer;
}
.crk-row input { position: absolute; opacity: 0; pointer-events: none; }
.crk-row i {
    width: 46px; height: 28px; border-radius: 14px; background: var(--ios-fill); position: relative;
    transition: background 0.2s; flex-shrink: 0;
}
.crk-row i::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 12px;
    background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 0.2s;
}
.crk-row input:checked + i { background: var(--ios-green); }
.crk-row input:checked + i::after { transform: translateX(18px); }
.crk-sheet-done, .crk-sheet-off {
    display: block; width: 100%; border: 0; background: none; padding: 14px; cursor: pointer;
    font: 600 17px -apple-system, system-ui, sans-serif; color: var(--ios-blue);
}
.crk-sheet-off { font-weight: 400; color: var(--ios-red); border-top: 0.5px solid var(--ios-sep); }
.crk-steps { margin: 0; padding: 12px 16px 4px 36px; font-size: 14px; line-height: 1.5; }
.crk-steps li { margin-bottom: 8px; }
.crk-inline-icon { display: inline-flex; width: 16px; height: 16px; vertical-align: -3px; color: var(--ios-blue); }
.crk-inline-icon svg { width: 16px; height: 16px; }
@keyframes crkFade { from { opacity: 0; } }
@keyframes crkUp { from { transform: translateY(40px); opacity: 0; } }

/* ── Match header: teams + match-info band (replaces the hero layout) ── */
html .match-hero.crk-has-head { padding: 0; overflow: hidden; }
html .match-hero.crk-has-head > :not(.crk-head) { display: none !important; }
.crk-head { padding: 12px 12px 0; color: var(--ios-label); }
.crk-head-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.crk-head-status { font-size: 10px; font-weight: 700; letter-spacing: 0.02em; border-radius: 10px; padding: 3px 8px; }
.crk-head-status.live { color: var(--ios-red); background: rgba(255, 59, 48, 0.1); }
.crk-head-status.final { color: var(--ios-label-2); background: var(--ios-fill); }
.crk-head-status.soon { color: var(--ios-blue); background: rgba(0, 122, 255, 0.1); }
.crk-head-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.crk-head-logo {
    width: 30px; height: 30px; border-radius: 15px; flex-shrink: 0; object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--ios-fill); color: var(--ios-label-2); font-size: 12px; font-weight: 800;
}
.crk-head-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crk-head-score { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.crk-head-score small { font-size: 12px; font-weight: 500; color: var(--ios-label-3); letter-spacing: 0; }
.crk-head-row.is-batting .crk-head-name::after { content: " •"; color: var(--ios-red); }
.crk-head-band {
    margin: 6px -12px 0; padding: 10px 4px 12px;
    background: linear-gradient(120deg, #1e40af, #4f46e5 55%, #7c3aed);
    display: grid; grid-template-columns: repeat(4, 1fr);
}
.crk-head-band > div:not(.crk-head-progress) {
    text-align: center; font-size: 10.5px; font-weight: 600; color: rgba(255, 255, 255, 0.75);
    border-left: 1px solid rgba(255, 255, 255, 0.18); padding: 0 3px; min-width: 0;
}
.crk-head-band > div:first-child { border-left: 0; }
.crk-head-band b { display: block; margin-top: 2px; font-size: 13.5px; font-weight: 700; color: #fff; line-height: 1.15; overflow-wrap: break-word; }
.crk-head-band b.crk-long { font-size: 11.5px; }
.crk-head-progress { grid-column: 1 / -1; height: 4px; margin: 10px 10px 0; border-radius: 2px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.crk-head-progress i { display: block; height: 100%; background: #fff; border-radius: 2px; transition: width 0.4s ease; }
[data-theme="dark"] .crk-head-band { background: linear-gradient(120deg, #1e3a8a, #3730a3 55%, #5b21b6); }
