:root {
  color-scheme: light;
  --page: #f4f4f1; --surface: #fcfcfb; --surface-2: #f0efec; --surface-3: #e7e6e1;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11, 11, 11, 0.10);
  --home: #2a78d6; --away: #eb6834; --draw: #b5b3ab;
  --good: #0ca30c; --good-ink: #006300; --warn: #fab219; --bad: #d03b3b;
  --accent: #2a78d6; --accent-ink: #ffffff;
  --seq-0: #f0efec; --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec;
  --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95; --seq-7: #0d366b;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --surface-3: #2c2c2a;
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --home: #3987e5; --away: #d95926; --draw: #5d5c57; --good-ink: #0ca30c;
    --accent: #3987e5;
    --seq-0: #262624; --seq-1: #0d366b; --seq-2: #104281; --seq-3: #184f95;
    --seq-4: #1c5cab; --seq-5: #2a78d6; --seq-6: #5598e7; --seq-7: #9ec5f4;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --surface-3: #2c2c2a;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
  --home: #3987e5; --away: #d95926; --draw: #5d5c57; --good-ink: #0ca30c;
  --accent: #3987e5;
  --seq-0: #262624; --seq-1: #0d366b; --seq-2: #104281; --seq-3: #184f95;
  --seq-4: #1c5cab; --seq-5: #2a78d6; --seq-6: #5598e7; --seq-7: #9ec5f4;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
h2 { font-size: 17px; margin: 0 0 4px; }
h3 { font-size: 13px; margin: 0 0 10px; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted, .hint { color: var(--muted); font-size: 13px; }
.hint { margin: 8px 2px 16px; }
.num { font-variant-numeric: tabular-nums; }
button, select, input { font: inherit; }

/* header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.brand-mark { background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 3px 7px; font-size: 13px; letter-spacing: .05em; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tab { background: none; border: 0; color: var(--ink-2); padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tab:hover { background: var(--surface-2); }
.tab.active { color: var(--ink); background: var(--surface-2); font-weight: 600; }

.sports { display: flex; gap: 6px; overflow-x: auto; padding: 18px 0 14px; scrollbar-width: thin; }
.sport { display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--surface); padding: 8px 14px;
         border-radius: 999px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.sport:hover { border-color: var(--axis); }
.sport.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.sport .state { font-size: 11px; opacity: .8; }

/* cards & layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.grid { display: grid; gap: 14px; margin-top: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 880px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }

/* form */
.matchup { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.grow { flex: 1 1 220px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
select, .field input { color: var(--ink); background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 10px; width: 100%; min-width: 0; }
.field input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.options { display: flex; gap: 12px; flex-wrap: wrap; }
.options .field { min-width: 140px; }
.swap { height: 40px; width: 40px; flex: 0 0 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); font-size: 18px; cursor: pointer; }
.check { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--ink-2); white-space: nowrap; height: 40px; }
.primary { height: 40px; padding: 0 24px; border: 0; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; }
.primary:hover { filter: brightness(1.08); }
@media (max-width: 640px) {
  .teams-row .grow { flex: 1 1 100%; }
  .teams-row .swap { margin: 0 auto; }
  .teams-row .primary { flex: 1 1 100%; }
}

/* combobox */
.combo-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; margin: 4px 0 0; padding: 4px; list-style: none;
              background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18);
              max-height: 320px; overflow-y: auto; }
.combo-list li { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.combo-list li.head { cursor: default; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding-top: 9px; }
.combo-list li.opt:hover, .combo-list li.opt.hl { background: var(--surface-2); }
.combo-list li.empty { color: var(--muted); cursor: default; }

/* hero */
.hero-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; text-align: center; }
.team-name { font-size: 22px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.team-sub { color: var(--muted); font-size: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 1px; flex: 0 0 auto; }
.score-box { min-width: 150px; }
.score-big { font-size: 38px; font-weight: 800; letter-spacing: .02em; line-height: 1.15; }
.score-cap { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.pct-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--ink-2); }
.pct-row b { font-size: 24px; color: var(--ink); display: block; line-height: 1.1; }
.pct-row > div:nth-child(2):not(:last-child) { text-align: center; }
.pct-row > div:last-child { text-align: right; }
.probbar { display: flex; gap: 2px; height: 14px; margin-top: 8px; }
.probbar > div { border-radius: 4px; min-width: 2px; }
.probbar.small { height: 8px; margin-top: 4px; }
.verdict { margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.badge::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.badge.High::before { background: var(--good); }
.badge.Medium::before { background: var(--warn); }
.badge.Low::before { background: var(--bad); }
@media (max-width: 560px) {
  .team-name { font-size: 16px; } .team-sub { font-size: 11px; }
  .score-box { min-width: 0; } .score-big { font-size: 26px; }
  .pct-row b { font-size: 19px; }
}

/* tiles & bars */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.tile .v { font-size: 21px; font-weight: 700; line-height: 1.2; }
.tile .k { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 40%) 1fr 48px; align-items: center; gap: 10px; font-size: 14px; }
.bar-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--seq-4); }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.model-row { margin-bottom: 12px; }
.model-row .lbl { font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }

/* heatmap */
.heat { display: grid; grid-template-columns: 28px repeat(6, minmax(0, 1fr)); gap: 2px; font-size: 12px; }
.heat .ax { color: var(--muted); display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.heat .cell { aspect-ratio: 1.5; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.heat-cap { font-size: 12px; color: var(--muted); margin: 6px 0 0 30px; }

/* comparison */
.compare { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.compare td { padding: 8px 4px; border-bottom: 1px solid var(--grid); overflow-wrap: anywhere; }
.compare td:first-child { text-align: left; font-weight: 600; }
.compare td:nth-child(2) { text-align: center; color: var(--muted); font-size: 13px; width: 42%; }
.compare td:last-child { text-align: right; font-weight: 600; }
.compare tr:last-child td { border-bottom: 0; }
.compare th { font-size: 13px; padding: 0 4px 8px; text-align: left; overflow-wrap: anywhere; }
.compare th:last-child { text-align: right; }

/* form pills */
.form { display: flex; gap: 4px; flex-wrap: wrap; }
.pill { width: 26px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; }
.pill.W { background: #0b8a0b; } .pill.D { background: #7a7974; } .pill.L { background: var(--bad); }
.form-team { margin-bottom: 12px; }
.form-team .nm { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }

/* players */
.players-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 880px) { .players-grid { grid-template-columns: minmax(0, 1fr); } }
.impact { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.chip { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.chip b { font-variant-numeric: tabular-nums; }
.plist { width: 100%; border-collapse: collapse; font-size: 13px; }
.plist th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 4px 6px; border-bottom: 1px solid var(--axis); white-space: nowrap; }
.plist td { padding: 5px 6px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
.plist .r { text-align: right; }
.plist tr.out td { color: var(--muted); }
.plist tr.out td.nm { text-decoration: line-through; }
.plist input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.scroll { max-height: 420px; overflow: auto; }
.status { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--border); }
.status::before { content: "● "; }
.status.injured::before, .status.Out::before { color: var(--bad); }
.status.suspended::before { color: var(--bad); }
.status.doubtful::before, .status.Doubtful::before, .status.Questionable::before { color: var(--warn); }
.xi { font-size: 10px; font-weight: 700; color: var(--accent); margin-left: 4px; }
.loading-players { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--grid); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tables */
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--axis); white-space: nowrap; }
table.list td { padding: 8px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--surface-2); }
table.list .r { text-align: right; }
.tbl-scroll { overflow-x: auto; }
.highlight td { font-weight: 700; }
.fx-meta { color: var(--muted); font-size: 12px; }
.fx-bar { min-width: 150px; }
.fx-pcts { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* charts */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; flex-wrap: wrap; }

.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.15); max-width: 280px; }
.error { border-color: var(--bad); }
.note { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-top: 14px; }
.loading { color: var(--muted); padding: 30px; text-align: center; }
.foot { color: var(--muted); font-size: 12px; padding-top: 30px; padding-bottom: 30px; }
.explain { font-size: 13px; color: var(--ink-2); }
.explain p { margin: 0 0 8px; }
.section-title { margin: 28px 0 0; font-size: 18px; }

/* chat */
.tab-ask { color: var(--accent); font-weight: 600; }
.chat { display: flex; flex-direction: column; gap: 12px; }
.chat-head { margin-bottom: 0; }
.chat-log { display: flex; flex-direction: column; gap: 12px; min-height: 260px; max-height: 62vh; overflow-y: auto; padding: 4px 2px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.bot p { margin: 0 0 8px; } .msg.bot p:last-child { margin-bottom: 0; }
.msg.bot ul { margin: 4px 0 8px; padding-left: 20px; } .msg.bot li { margin: 2px 0; }
.msg .steps { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.msg .step { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.msg .step::before { content: "✓"; color: var(--good-ink); font-weight: 700; }
.msg .step.run::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--grid); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 6px; }
.msg.err { background: transparent; border: 1px solid var(--bad); }
.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--muted); }
@keyframes blink { 50% { opacity: 0; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); color: var(--ink); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; max-height: 160px; min-height: 42px; }
.chat-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.chat-form .primary { height: 42px; }

/* icons */
.ico { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -3px; }
.ico.lg { width: 28px; height: 28px; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; }
.sport .ico { width: 17px; height: 17px; }

/* account area in the header */
.topbar-inner { flex-wrap: wrap; }
.account { display: flex; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border);
       background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--axis); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.mpesa { background: #2e9b3a; border-color: #2e9b3a; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .6; cursor: default; }
.credits { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); color: var(--ink); }
.credits.plan { color: var(--good-ink); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { position: relative; width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; padding: 24px 20px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: 92vh; overflow: auto; }
.modal-close { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }
.modal h2 { margin-bottom: 6px; }
.form-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.form-stack .field input { padding: 10px 12px; }
.switch { font-size: 13px; color: var(--ink-2); margin-top: 12px; text-align: center; }
.switch a, .link { color: var(--accent); cursor: pointer; text-decoration: underline; }
.form-error { color: var(--bad); font-size: 13px; min-height: 18px; }
.pay-status { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 10px 0; }
.pay-status .big { font-size: 34px; font-weight: 800; }
.ok-ico { color: var(--good-ink); } .bad-ico { color: var(--bad); }

/* plans */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 12px; }
.plan-card { display: flex; flex-direction: column; gap: 8px; }
.plan-card.featured { border: 2px solid var(--accent); }
.plan-card .price { font-size: 30px; font-weight: 800; line-height: 1.1; }
.plan-card .price small { font-size: 14px; color: var(--muted); font-weight: 600; }
.plan-card ul { margin: 4px 0 8px; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.plan-card .btn { margin-top: auto; justify-content: center; }
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.pack { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; color: var(--ink); }
.pack:hover { border-color: var(--accent); }
.pack .g { font-size: 22px; font-weight: 800; }
.pack .p { font-weight: 700; color: var(--good-ink); }
.pack .each { font-size: 12px; color: var(--muted); }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }

/* paywall */
.paywall { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 26px 18px; }
.paywall .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.paywall .match { font-size: 22px; font-weight: 700; }
.locked-cell { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
#sports[hidden] ~ .view { margin-top: 20px; }

/* about & FAQ (visible text for visitors and search engines) */
.about { margin-top: 36px; color: var(--ink-2); font-size: 14px; }
.about h2 { color: var(--ink); font-size: 18px; margin-bottom: 8px; }
.faq { display: grid; gap: 8px; margin-top: 12px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.faq p { margin: 8px 0 2px; }
a.brand { color: inherit; text-decoration: none; }
