:root {
  color-scheme: dark;
  --bg: #13101d; --surface: #1d1830; --surface2: #262040; --line: #352d52;
  --text: #ece8f6; --muted: #a39bbd; --accent: #f5a04a;
  --home: #3b82f6; --away: #e05a6d;
  --ok: #3fb950; --miss: #f0707f; --warn-bg: #3a2f14; --warn-text: #f3dca0;
  font-family: system-ui, sans-serif; color: var(--text);
}
body { margin: 0; background: var(--bg); }
.hero { display: block; width: 100%; height: auto; aspect-ratio: 1376 / 768; border-radius: 12px; margin: 0 0 1rem; border: 1px solid var(--line); }
main { max-width: 860px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
header h1 { margin: 0; font-size: 1.6rem; }
header p, footer { color: var(--muted); font-size: .9rem; }
.filters { display: flex; flex-direction: column; gap: .75rem; margin: 1rem 0; }
.filters .row { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: end; }
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
#search { width: 14rem; max-width: 100%; box-sizing: border-box; }
.combo { position: relative; }
.combo-list { position: absolute; top: calc(100% + 2px); left: 0; z-index: 10; box-sizing: border-box; min-width: 100%; width: max-content; max-width: min(22rem, 90vw); max-height: 16rem; overflow: auto; list-style: none; margin: 0; padding: .25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgb(0 0 0 / 45%); }
.combo-list li { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: 4px; cursor: pointer; font-size: .95rem; }
.combo-list li:hover, .combo-list li[aria-selected=true] { background: var(--surface2); }
.combo-list .logo { width: 20px; height: 20px; flex: none; }
.combo-list span.logo { background: none; }
.help { font-size: .85rem; color: var(--muted); margin: .4rem 0; }
.help a { color: var(--accent); }
select, input[type=search] { font: inherit; padding: .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
select { max-width: 22rem; }
.pickers { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: start; }
.picker { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .75rem; position: relative; }
.picker h2 { margin: 0 0 .5rem; font-size: 1rem; }
.picker[data-side=home] h2 { color: var(--home); }
.picker[data-side=away] h2 { color: var(--away); }
.picker input { width: 100%; box-sizing: border-box; }
.results { list-style: none; margin: .25rem 0 0; padding: 0; max-height: 18rem; overflow: auto; }
.results li { padding: .4rem .5rem; border-radius: 6px; cursor: pointer; }
.results li:hover, .results li:focus { background: var(--surface2); outline: none; }
.results small, .chosen small { display: block; color: var(--muted); }
.chosen { display: flex; justify-content: space-between; gap: .5rem; align-items: start; }
.chosen button { font: inherit; font-size: .8rem; border: 0; background: none; color: var(--accent); cursor: pointer; }
#swap { align-self: center; font-size: 1.3rem; border: 1px solid var(--line); background: var(--surface); border-radius: 50%; width: 2.5rem; height: 2.5rem; cursor: pointer; }
#predict { margin: 1rem 0; font: inherit; font-weight: 600; padding: .7rem 1.5rem; border: 0; border-radius: 8px; background: var(--accent); color: #1b1325; cursor: pointer; }
#predict:disabled { opacity: .4; cursor: default; }
#result { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.bar { display: flex; height: 2.2rem; border-radius: 6px; overflow: hidden; font-weight: 600; color: #fff; margin: .75rem 0; }
.bar div { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); display: flex; align-items: center; padding: 0 .6rem; white-space: nowrap; min-width: 3.5rem; }
.bar .home { background: var(--home); }
.bar .away { background: var(--away); justify-content: end; }
.names { display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; }
.names > span { display: flex; align-items: center; gap: .45rem; }
.names > span:last-child { text-align: right; justify-content: end; }
.logo { width: 28px; height: 28px; object-fit: contain; flex: none; background: #fff; border-radius: 5px; padding: 2px; box-sizing: border-box; }
.results li { display: flex; align-items: center; gap: .5rem; }
.results .logo { width: 24px; height: 24px; }
.chosen .who { display: flex; align-items: center; gap: .5rem; }
.bar .light { box-shadow: inset 0 0 0 1px rgba(34, 34, 51, .25); }
.bar .home.light { border-radius: 6px 0 0 6px; }
.bar .away.light { border-radius: 0 6px 6px 0; }
.badges span { display: inline-block; font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; background: var(--surface2); margin-right: .3rem; }
.note { font-size: .9rem; color: var(--warn-text); background: var(--warn-bg); border-radius: 6px; padding: .5rem; margin: .5rem 0; }
.error { color: var(--miss); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; font-size: .9rem; margin: .75rem 0 0; }
dt { color: var(--muted); }
dd { margin: 0; }
nav { display: flex; gap: 1rem; font-size: .9rem; margin-bottom: .5rem; }
nav a { color: var(--accent); text-decoration: none; }
nav a[aria-current=page] { color: var(--text); font-weight: 600; }
.day > summary, .serie > summary { display: flex; align-items: baseline; gap: .6rem; cursor: pointer; list-style: none; }
.day > summary::-webkit-details-marker, .serie > summary::-webkit-details-marker { display: none; }
.day > summary::before, .serie > summary::before { content: '▸'; color: var(--muted); width: 1rem; }
.day[open] > summary::before, .serie[open] > summary::before { content: '▾'; }
.day > summary { margin: 1.5rem 0 .5rem; }
.day > summary h2 { font-size: 1.1rem; margin: 0; }
.serie { margin: 0 0 .4rem 1rem; }
.serie > summary { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.serie > summary h3 { font-size: .95rem; margin: 0; }
.day summary small { color: var(--muted); }
.filters button { font: inherit; font-size: .85rem; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; }
.game { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem; margin: .5rem 0; }
.game p { margin: .4rem 0; font-size: .9rem; }
.meta { color: var(--muted); display: block; margin-bottom: .3rem; }
.bar.small { height: 1.6rem; margin: .4rem 0 .2rem; font-size: .9rem; }
#skipped { margin: 1rem 0; font-size: .9rem; color: var(--muted); }
@media (max-width: 640px) { .pickers { grid-template-columns: 1fr; } #swap { justify-self: center; } }

.result { margin: .6rem 0; padding: .6rem .8rem; border-radius: 8px; background: var(--surface2); border: 1px solid var(--line); font-size: .9rem; text-align: center; }
.game .result p { margin: .15rem 0; }
.result .score { font-size: 1.5rem; font-weight: 700; }
.result .score small { display: block; font-size: .75rem; font-weight: 400; color: var(--muted); }
.result .score .won { display: inline-block; padding: 0 .35rem; border: 2px solid var(--text); border-radius: 6px; background: var(--bg); }
.result .score .gap { font-size: 1.1rem; font-weight: 600; color: var(--muted); }
.result .verdict strong { font-weight: 800; }
.result.ok { background: rgba(63, 185, 80, .14); border-color: rgba(63, 185, 80, .45); }
.result.ok .verdict strong { color: var(--ok); }
.result.miss { background: rgba(240, 112, 127, .12); border-color: rgba(240, 112, 127, .45); }
.result.miss .verdict strong { color: var(--miss); }
.range { margin: .5rem 0; }
.range p { margin: .3rem 0; font-size: .9rem; }
.axis { margin: .6rem 0 .4rem; }
.axis .track { position: relative; height: 1.2rem; border-bottom: 1px solid var(--line); }
.axis .track span { position: absolute; top: 0; height: 100%; }
.axis .band { background: rgba(163, 155, 189, .25); border-radius: 3px; }
.axis .zero { width: 1px; background: var(--muted); }
.axis .grid { width: 1px; background: var(--line); }
.axis .scale { position: relative; height: .9rem; font-size: .65rem; color: var(--muted); }
.axis .scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.axis .scale span:first-child { transform: none; }
.axis .scale span:last-child { transform: translateX(-100%); }
.axis .predicted { width: 3px; margin-left: -1.5px; background: var(--text); }
.axis .actual { width: .75rem; height: .75rem; top: .2rem; margin-left: -.375rem; border-radius: 50%; background: #e08a00; border: 1px solid var(--bg); }
.axis .ends { display: flex; justify-content: space-between; gap: .5rem; font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.axis .ends { align-items: center; }
.axis .ends .home, .axis .ends .away { padding: .05rem .4rem; border-radius: 4px; font-weight: 600; color: #fff; }
.axis .ends .home { background: var(--home); }
.axis .ends .away { background: var(--away); text-align: right; }
.axis .ends .light { box-shadow: inset 0 0 0 1px rgba(34, 34, 51, .25); }
.axis .key { font-size: .75rem; color: var(--muted); margin: .2rem 0 0; text-align: center; }
.axis .key i { display: inline-block; vertical-align: middle; margin-left: .6rem; }
.k-band { width: 1rem; height: .6rem; background: rgba(163, 155, 189, .25); border-radius: 2px; }
.k-predicted { width: 3px; height: .8rem; background: var(--text); }
.k-actual { width: .6rem; height: .6rem; border-radius: 50%; background: #e08a00; }
.why { margin-top: .75rem; }
.why summary, .glossary summary { cursor: pointer; font-weight: 600; font-size: .95rem; }
.glossary { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem; margin: 1.5rem 0 1rem; }
.glossary dl { grid-template-columns: minmax(8rem, max-content) 1fr; }
.glossary dt { color: var(--text); font-weight: 600; }
@media (max-width: 640px) { dl, .glossary dl { grid-template-columns: 1fr; } dd { margin-bottom: .4rem; } }
.review { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem; margin: 1rem 0; font-size: .95rem; }
.review p { margin: .35rem 0; }
.review small { color: var(--muted); }
.review .correct strong { font-size: 1.3rem; }

/* Explanation page */
.doc section { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .5rem 1.25rem 1rem; margin: 1rem 0; line-height: 1.55; }
.doc h2 { font-size: 1.3rem; margin: .75rem 0 .5rem; }
.doc h3 { font-size: 1.05rem; margin: 1.25rem 0 .4rem; }
.doc .toc { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1.25rem; margin: 1rem 0; }
.doc .toc ol { margin: .4rem 0 0; padding-left: 1.4rem; columns: 2; }
.doc .toc a { color: var(--accent); }
.doc .formula { background: var(--surface2); border-left: 3px solid var(--accent); padding: .5rem .75rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; }
.doc .example { background: var(--warn-bg); border: 1px solid #5a4a20; border-radius: 8px; padding: .6rem .9rem; margin: .75rem 0; }
.doc .example ul { margin: .4rem 0 0; }
.doc .note { color: var(--muted); font-size: .9rem; }
.doc .figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; margin: 1rem 0; }
.doc .figures div { background: var(--surface2); border-radius: 8px; padding: .6rem .8rem; text-align: center; }
.doc .figures b { display: block; font-size: 1.4rem; }
.doc .figures span { color: var(--muted); font-size: .85rem; }
.doc table.data { border-collapse: collapse; margin: .75rem 0; font-size: .9rem; width: 100%; }
.doc table.data caption { text-align: left; font-weight: 600; padding-bottom: .3rem; }
.doc table.data th, .doc table.data td { border-bottom: 1px solid var(--line); padding: .3rem .5rem; text-align: left; vertical-align: top; }
.doc table.data th { background: var(--surface2); }
.doc table.params td:first-child { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.doc table.params td:nth-child(2) { white-space: nowrap; }
.doc #tracking { background: rgba(63, 185, 80, .12); border-radius: 8px; padding: .5rem .75rem; }
@media (max-width: 600px) { .doc .toc ol { columns: 1; } .doc table.data { font-size: .8rem; } }

/* Archives list */
.archives table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: .95rem; }
.archives th, .archives td { border-bottom: 1px solid var(--line); padding: .45rem .75rem; text-align: right; }
.archives th:first-child, .archives td:first-child { text-align: left; }
.archives a { color: var(--accent); }
