/* Soccer Odds Tracker - shared styles. No external resources. */
:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #f3f2ee;
  --surface-3: #e9e8e2;
  --border: #e1e0d9;
  --border-2: #c9c8c0;
  --fg: #151514;
  --fg-2: #4f4e4a;
  --muted: #76746e;
  --accent: #1f64b8;
  --accent-2: #e6effa;
  --focus: #2a78d6;
  /* green = price shortening / money in, red = price drifting */
  --down: #0b6b18;
  --down-bg: #dcf1dd;
  --down-strong: #17802a;
  --up: #b3261e;
  --up-bg: #fbe3e1;
  --up-strong: #c0392b;
  --amber: #8f5300;
  --amber-bg: #fcefd2;
  --live: #c42b2b;
  /* chart series (validated categorical slots) */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s7: #4a3aa7;
  --book: #9b9a93;
  --grid: #ecebe5;
  --axis: #c3c2b7;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f0f0e;
    --surface: #1a1a19;
    --surface-2: #222220;
    --surface-3: #2b2b29;
    --border: #2f2f2c;
    --border-2: #45453f;
    --fg: #f1f0eb;
    --fg-2: #c3c2b7;
    --muted: #94928b;
    --accent: #6aa6ee;
    --accent-2: #1b2a3c;
    --down: #5cc86a;
    --down-bg: #173219;
    --down-strong: #1f8a33;
    --up: #f27f76;
    --up-bg: #3b1c1a;
    --up-strong: #c2413a;
    --amber: #f0b44c;
    --amber-bg: #35270f;
    --live: #f26b6b;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s7: #9085e9;
    --book: #6f6e68;
    --grid: #272725;
    --axis: #45453f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 20px; margin: 16px 0 4px; font-weight: 650; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 650; }
h3 { font-size: 13.5px; margin: 0 0 6px; font-weight: 650; }
p { margin: 6px 0; }
.wrap { max-width: 1480px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- nav */
.topnav { background: var(--surface); border-bottom: 1px solid var(--border); }
.topnav .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 50px; padding-top: 6px; padding-bottom: 6px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--fg); font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 22px; height: 22px; display: block; }
.navlinks { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 auto; }
.navlinks a { padding: 6px 10px; border-radius: 6px; color: var(--fg-2); font-weight: 550; }
.navlinks a:hover { background: var(--surface-2); text-decoration: none; }
.navlinks a[aria-current="page"] { background: var(--accent-2); color: var(--accent); }
.health { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; padding: 4px 6px; border-radius: 6px; }
.health:hover { background: var(--surface-2); text-decoration: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.ok { background: #16a34a; }
.dot.warn { background: #e0a100; }
.dot.bad { background: #dc2626; }

.banner { position: sticky; top: 0; z-index: 40; background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid var(--border-2); font-size: 13px; }
.banner .wrap { display: flex; gap: 10px; align-items: center; padding-top: 7px; padding-bottom: 7px; }
.banner .msg { flex: 1; }
.banner button { font: inherit; background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 6px; padding: 2px 8px; cursor: pointer; }

/* ---------------------------------------------------------------- controls */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.page-head h1 { margin-bottom: 0; }
.controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 12px 0 8px; }
.controls .grow { flex: 1 1 220px; min-width: 0; max-width: 340px; }
input[type="search"], select {
  font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 6px; padding: 5px 8px; min-height: 34px; max-width: 100%;
}
input[type="search"] { width: 100%; }
.toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-2); cursor: pointer; user-select: none; white-space: nowrap; }
.toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.field { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-2); }
.summary { color: var(--fg-2); font-size: 13px; margin: 4px 0 8px; }
.btn { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--border-2); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.link { border: 0; background: none; color: var(--accent); padding: 2px 4px; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; font-size: 12.5px; border: 0; background: var(--surface); color: var(--fg-2); padding: 5px 10px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border-2); }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.card .table-wrap { border-radius: 6px; }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--fg-2); background: var(--surface-2); padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 12px; vertical-align: bottom; }
.tbl th .sub { font-weight: 400; }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tfoot td { border-top: 1px solid var(--border-2); border-bottom: 0; background: var(--surface-2); font-weight: 600; }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .ctr { text-align: center; }
.tbl tbody tr:not(.day):hover td { background: var(--surface-2); }
.tbl tr.day td { background: var(--surface-3); font-weight: 650; color: var(--fg); font-size: 12.5px; padding: 5px 8px; }
.tbl tr.group td { background: var(--surface-2); font-weight: 650; color: var(--fg-2); font-size: 12px; text-transform: none; }
.tbl th button.sort { font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.tbl th button.sort::after { content: " \2195"; color: var(--muted); font-weight: 400; }
.tbl th[aria-sort="ascending"] button.sort::after { content: " \2191"; color: var(--fg); }
.tbl th[aria-sort="descending"] button.sort::after { content: " \2193"; color: var(--fg); }
.tbl td.empty-row { text-align: center; color: var(--fg-2); padding: 22px 12px; }
.sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.tbl .sub { white-space: nowrap; }

/* match table */
#matches td.tick { width: 30px; text-align: center; }
#matches td.tick input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--accent); vertical-align: middle; }
#matches td.ko { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
#matches td.lg { min-width: 150px; max-width: 240px; color: var(--fg-2); font-size: 12.5px; }
#matches td.lg .country { color: var(--fg); font-weight: 550; }
#matches td.mt { min-width: 190px; }
#matches td.mt a { color: var(--fg); font-weight: 600; }
#matches td.mt a:hover { color: var(--accent); }
#matches tr.r-finished td, #matches tr.r-postponed td, #matches tr.r-cancelled td { color: var(--muted); }
#matches tr.r-finished td.mt a { color: var(--fg-2); font-weight: 500; }
#matches tr.r-live td.tick { box-shadow: inset 3px 0 0 var(--live); }
#matches td.fl { min-width: 120px; }
#matches td.tips, #matches td.model { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.px { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.px .p { font-weight: 650; font-size: 13.5px; }
.px .p.mkt { font-weight: 500; color: var(--fg-2); font-style: italic; }
.px .sub { text-align: right; }
td.px.fl-steam { background: color-mix(in srgb, var(--down-bg) 55%, transparent); }
td.px.fl-drift { background: color-mix(in srgb, var(--up-bg) 55%, transparent); }
.more-row { display: flex; justify-content: center; gap: 10px; padding: 12px 0 24px; }
@media (min-width: 1320px) {
  .table-wrap.stick { overflow: visible; }
  .table-wrap.stick thead th { position: sticky; top: 0; z-index: 3; }
}

/* movement + values */
.mv { font-size: 12px; margin-left: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 550; }
.mv.down { color: var(--down); }
.mv.up { color: var(--up); }
.mv.flat { color: var(--muted); font-weight: 400; }
.in { color: var(--down); }
.out { color: var(--up); }
.val-pos { color: var(--accent); font-weight: 650; }
.val-neg { color: var(--fg-2); }
.pos { color: var(--down); font-weight: 600; }
.neg { color: var(--up); font-weight: 600; }

/* countdowns */
.cd { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 550; }
.cd-far { color: var(--fg); }
.cd-amber { color: var(--amber); font-weight: 700; }
.cd-red { color: var(--live); font-weight: 700; }
.cd-live { color: var(--live); font-weight: 700; }
.cd-live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--live); margin-right: 5px; vertical-align: 1px; animation: sot-pulse 1.6s ease-in-out infinite; }
.cd-done { color: var(--muted); }
.cd-off { color: var(--muted); font-style: italic; }
@keyframes sot-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .cd-live::before { animation: none; } }

/* badges and chips */
.badge { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 700; line-height: 18px; white-space: nowrap; letter-spacing: .01em; }
.b-bigsteam { background: var(--down-strong); color: #fff; }
.b-steam { background: var(--down-bg); color: var(--down); }
.b-drift { background: var(--up-bg); color: var(--up); }
.b-bigdrift { background: var(--up-strong); color: #fff; }
.b-neutral { background: var(--surface-3); color: var(--fg-2); }
.b-live { background: var(--live); color: #fff; }
.b-ok { background: var(--down-bg); color: var(--down); }
.b-bad { background: var(--up-bg); color: var(--up); }
.b-warn { background: var(--amber-bg); color: var(--amber); }
.badges { display: flex; flex-wrap: wrap; gap: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; border: 1px solid var(--border-2); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; background: var(--surface); color: var(--fg); }
.chip .k { color: var(--muted); font-size: 11.5px; }
.chip.good { border-color: var(--down); color: var(--down); background: var(--down-bg); }
.chip.warn { border-color: var(--amber); color: var(--amber); background: var(--amber-bg); }
.chip.dim { color: var(--muted); }

/* ---------------------------------------------------------------- cards and sections */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; min-width: 0; }
.card > h2:first-child { margin-top: 0; }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 8px; }
.sec-head h2 { margin: 0; }
.empty-text { color: var(--fg-2); margin: 4px 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 12px; }
.grid-2 > .card { margin: 12px 0; }
@media (max-width: 420px) { .grid-2 { grid-template-columns: 1fr; } .card { padding: 12px; } }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "\25B8"; color: var(--muted); }
details.card[open] > summary::before { content: "\25BE"; }
details.card > summary h2 { margin: 0; }
details.card[open] > summary { margin-bottom: 10px; }
ul.insights { margin: 0; padding-left: 20px; }
ul.insights li { margin: 3px 0; }

/* match header */
.mhead { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; align-items: center; }
.mhead h1 { font-size: 24px; margin: 4px 0 2px; line-height: 1.2; overflow-wrap: anywhere; }
.mhead h1 .v { color: var(--muted); font-weight: 400; }
.mhead .meta { color: var(--fg-2); }
.mhead .back { font-size: 13px; }
.mhead-side { text-align: right; }
.big-cd { font-size: 30px; font-weight: 700; line-height: 1.1; display: block; }
.mhead .stage { margin-top: 4px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.mhead .score { font-size: 20px; font-weight: 700; }
@media (max-width: 640px) { .mhead { grid-template-columns: 1fr; } .mhead-side { text-align: left; } .mhead .stage { justify-content: flex-start; } }

/* market tabs */
.tabs { display: flex; gap: 6px; position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 8px 0; overflow-x: auto; border-bottom: 1px solid var(--border); }
.tab { font: inherit; border: 1px solid var(--border-2); background: var(--surface); color: var(--fg-2); padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.tab:hover { background: var(--surface-2); }
.tab[aria-selected="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab .short { display: none; }
@media (max-width: 560px) {
  .tab { padding: 6px 11px; }
  .tab .long { display: none; }
  .tab .short { display: inline; }
}

/* selection cards */
.sel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin: 12px 0; }
.sel-grid .card { margin: 0; }
.selcard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.selcard .name { font-weight: 700; }
.selcard .team { color: var(--fg-2); overflow-wrap: anywhere; }
.selcard .bigline { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 2px; flex-wrap: wrap; }
.selcard .bigpx { font-size: 32px; font-weight: 700; line-height: 1.1; }
.selcard .bigsrc { color: var(--muted); font-size: 12px; }
.selcard .bigline .mv { font-size: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; margin: 10px 0 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv .sep { grid-column: 1 / -1; border-top: 1px solid var(--border); margin: 2px 0; }

/* charts */
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; margin: 6px 0 4px; align-items: center; }
.legend label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; color: var(--fg-2); white-space: nowrap; }
.legend input { margin: 0; accent-color: var(--accent); }
.legend .grp { color: var(--muted); font-size: 11.5px; margin-right: -6px; }
.sw { display: inline-block; width: 16px; height: 0; border-top: 3px solid var(--book); border-radius: 2px; vertical-align: middle; }
.sw.dash { border-top-style: dashed; border-top-width: 2px; }
.sw.thin { border-top-width: 2px; }
.chart-wrap { margin: 10px 0 16px; }
.chart-wrap h3 { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.chart-wrap h3 .sub { display: inline; }
.chart-box { position: relative; min-height: 40px; }
.chart-box svg { display: block; width: 100%; height: auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart-box svg text { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-box .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart-box .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart-box .series { fill: none; stroke-linejoin: round; stroke-linecap: round; transition: opacity .12s; }
.chart-box.has-hl .series { opacity: .25; }
.chart-box.has-hl .series.hl { opacity: 1; stroke: var(--fg) !important; stroke-width: 2.5px !important; }
.chart-box .cross { stroke: var(--border-2); stroke-width: 1; }
.chart-box .ko-line { stroke: var(--live); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-box .tip { position: absolute; top: 0; left: 0; pointer-events: none; background: var(--surface); border: 1px solid var(--border-2); box-shadow: 0 6px 18px rgba(0,0,0,.14); border-radius: 6px; padding: 6px 8px; font-size: 12px; z-index: 6; white-space: nowrap; }
.chart-box .tip .t { font-weight: 650; margin-bottom: 3px; }
.chart-box .tip .r { display: flex; align-items: center; gap: 6px; }
.chart-box .tip .r .n { flex: 1; color: var(--fg-2); padding-right: 10px; }
.chart-box .tip .r .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-empty { color: var(--muted); font-size: 13px; padding: 16px 0; border: 1px dashed var(--border-2); border-radius: 6px; text-align: center; }

/* share bar in the money table */
.share { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.share .bar { width: 60px; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; display: inline-block; }
.share .bar i { display: block; height: 100%; background: var(--s1); border-radius: 3px; }

/* second opinions, money, status */
.op-line { margin: 0 0 10px; }
.tab .badge { margin-left: 6px; vertical-align: 1px; }
.money-src + .money-src { margin-top: 20px; }
.money-src .chart-box { margin-top: 10px; }
.hb { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hb .dot { width: 14px; height: 14px; }
.hb .big { font-size: 20px; font-weight: 700; }
.tbl td.info { color: var(--fg-2); font-size: 12px; min-width: 180px; max-width: 420px; overflow-wrap: anywhere; }
.tbl .sub.err { color: var(--up); white-space: normal; min-width: 220px; max-width: 340px; overflow-wrap: anywhere; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.card .tile { background: var(--surface-2); border-color: transparent; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 20px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.tile .s { font-size: 12px; color: var(--fg-2); }

/* prose (help, records explanations) */
.prose { max-width: 860px; }
.prose h2 { margin-top: 22px; font-size: 17px; }
.prose dl { margin: 8px 0; }
.prose dt { font-weight: 650; margin-top: 10px; }
.prose dd { margin: 2px 0 0 0; color: var(--fg-2); }
.prose code { background: var(--surface-3); padding: 0 4px; border-radius: 4px; font-size: 12.5px; }
.prose ul { padding-left: 20px; }
.prose li { margin: 3px 0; }
footer.foot { color: var(--muted); font-size: 12px; padding: 20px 0 30px; }

@media (max-width: 560px) {
  body { font-size: 13.5px; }
  .health .health-text { display: none; }
  .navlinks a { padding: 5px 7px; }
  .controls { gap: 8px 10px; }
  .controls .grow { flex-basis: 100%; max-width: none; }
  h1 { font-size: 18px; }
  .mhead h1 { font-size: 20px; }
  .big-cd { font-size: 26px; }
}
