﻿:root {
  --bg: #f4f5f7;
  --row: #fff;
  --fg: #16181d;
  --muted: #5d6470;
  --line: #e3e5e9;
  --accent: #14457a;
  --link: #1557a0;
  --bar: #14457a;
  --bar-fg: #fff;
  --chip: #fff;
  --empty: #a3a9b3;
  --past: #e4e6ea;
  /* alade värvid: valge tekst vähemalt 4.5:1 */
  --jalgpall: #2e7d32;
  --korvpall: #6b7280;
  --jaahoki: #1565c0;
  --vorkpall: #6a1b9a;
  --kasipall: #c2410c;
  --saalihoki: #00796b;
  --saalijalgpall: #8a5a00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --row: #191c22;
    --fg: #e9ebef;
    --muted: #9aa1ac;
    --line: #2a2e36;
    --link: #8ab8f0;
    --bar: #0f3460;
    --chip: #191c22;
    --empty: #5b616b;
    --past: #2a2e36;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); text-decoration: none; }
.wrap { max-width: 42rem; margin: 0 auto; padding: 0 .75rem; }

/* päis */
.bar { background: var(--bar); color: var(--bar-fg); padding: .6rem 0 .5rem; }
.top { display: flex; align-items: baseline; gap: .5rem; position: relative; }
.brand { color: var(--bar-fg); font-weight: 700; font-size: 1.05rem; }

/* linna- ja tasemevalik */
.pick-menu summary {
  list-style: none; cursor: pointer; color: var(--bar-fg); opacity: .9;
  padding: .1rem .5rem; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; font-size: .92rem;
}
.pick-menu summary::-webkit-details-marker { display: none; }
.pick-menu[open] summary { background: rgba(255,255,255,.15); }
.pick-menu ul {
  position: absolute; left: 0; right: 0; top: 2rem; z-index: 10; list-style: none; margin: 0; padding: .3rem;
  background: var(--row); border: 1px solid var(--line); border-radius: .6rem; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  max-width: 22rem; max-height: 70vh; overflow-y: auto;
}
.pick-menu li a { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .6rem; border-radius: .4rem; color: var(--fg); }
.pick-menu li a:hover { background: var(--bg); }
.pick-menu li a[aria-current] { background: var(--bar); color: var(--bar-fg); }
.pick-menu li a.county span:first-child { font-size: .9rem; }
.pick-menu li a.empty { color: var(--empty); }
.pick-menu .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.pick-menu li a[aria-current] .n { color: var(--bar-fg); }
.city li:nth-child(3) { border-bottom: 1px solid var(--line); padding-bottom: .2rem; margin-bottom: .2rem; }
.pick-menu li.cap { padding: .2rem .6rem .35rem; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* sissejuhatus, vananenud andmete teade, info leht */
.intro { margin: .6rem 0 0; font-size: .85rem; color: var(--muted); }
.stale { margin: .6rem 0 0; padding: .5rem .7rem; font-size: .85rem; background: #fff4d6; color: #5c4400; border-radius: .4rem; }
.info { padding-top: .8rem; padding-bottom: 1rem; }
.info h2 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; }
.info table { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--row); }
.info th, .info td { text-align: left; vertical-align: top; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
.info th { font-size: .78rem; color: var(--muted); font-weight: 600; }
.info td:first-child { white-space: nowrap; }
.info ul { padding-left: 1.2rem; }
.info li { margin: .3rem 0; }
.daynav { display: flex; align-items: center; gap: .5rem; margin-top: .2rem; }
.daynav h1 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.daynav h1::first-letter { text-transform: uppercase; }
.daynav a, .daynav .off { color: var(--bar-fg); font-size: .85rem; padding: .35rem .3rem; line-height: 1; }
.daynav .off { opacity: .3; }

/* päevade riba */
.days { background: var(--row); border-bottom: 1px solid var(--line); }
.days ol {
  list-style: none; margin: 0 auto; display: flex; gap: .3rem;
  padding-top: .45rem; padding-bottom: .45rem;
  overflow-x: auto; scrollbar-width: none;
}
.days ol::-webkit-scrollbar { display: none; }
.days a {
  display: flex; flex-direction: column; align-items: center; min-width: 2.6rem;
  padding: .25rem .2rem; border-radius: .5rem; color: var(--fg); line-height: 1.15;
}
.days .wd { font-size: .7rem; text-transform: uppercase; color: var(--muted); }
.days .dn { font-size: 1.05rem; font-weight: 600; }
.days a.empty .dn, .days a.empty .wd { color: var(--empty); font-weight: 400; }
.days a[aria-current] { background: var(--bar); }
.days a[aria-current] .wd, .days a[aria-current] .dn { color: var(--bar-fg); }

/* alafilter */
.filters { display: none; gap: .35rem; flex-wrap: wrap; padding: .6rem 0; }
.js .filters { display: flex; }
.filters button, .filters .ext {
  font: inherit; font-size: .85rem; padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--chip); color: var(--fg); cursor: pointer;
  display: inline-flex; align-items: center; gap: .35rem;
}
.filters button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.filters .ext[aria-pressed="false"], .filters .nogames[aria-pressed="false"] { color: var(--empty); }
.filters .nogames[aria-pressed="false"] .dot { opacity: .35; }
.extnote {
  margin: 0 0 .8rem; padding: .7rem .8rem; font-size: .88rem; color: var(--fg);
  background: var(--row); border: 1px solid var(--line); border-left: 4px solid var(--korvpall); border-radius: 0;
}
.extnote a { display: inline-block; margin-top: .3rem; font-weight: 600; }
.sportnote { font-size: .82rem; color: var(--muted); }
.s-border-jaahoki { border-left-color: var(--jaahoki); }
.s-border-kasipall { border-left-color: var(--kasipall); }
.s-border-jalgpall { border-left-color: var(--jalgpall); }
.s-border-vorkpall { border-left-color: var(--vorkpall); }
.s-border-saalihoki { border-left-color: var(--saalihoki); }
.s-border-saalijalgpall { border-left-color: var(--saalijalgpall); }
.js .extnote { display: none; }       /* JS-iga näidatakse alles nupu vajutamisel */
.js .extnote.show { display: block; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }

/* mängud */
.games { list-style: none; margin: 0 0 .5rem; padding: 0; border-radius: .5rem; overflow: hidden; border: 1px solid var(--line); }
.games li + li { border-top: 1px solid var(--line); }
.games a { display: flex; align-items: stretch; background: var(--row); color: var(--fg); min-height: 3.6rem; }
.games a:hover .match { text-decoration: underline; }
.games time {
  flex: 0 0 4.6rem; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; padding: .3rem 0;
}
.games time b { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.games time small { font-size: .62rem; text-transform: uppercase; letter-spacing: .03em; }
.info { flex: 1; min-width: 0; padding: .45rem .7rem; display: flex; flex-direction: column; justify-content: center; }
.match { font-weight: 650; line-height: 1.25; }
.meta { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.meta em { font-style: normal; color: var(--kasipall); }
.score { margin-left: .35rem; font-variant-numeric: tabular-nums; }
.pastnote { color: var(--muted); }
/* möödunud päevad: hall taust päevade ribal ja hallid mänguread */
.days a.past { background: var(--past); }
.days a.past .wd, .days a.past .dn { color: var(--muted); }
.days a.past[aria-current] { background: var(--bar); }
.days a.past[aria-current] .wd, .days a.past[aria-current] .dn { color: var(--bar-fg); }
.pastday .games a { background: var(--past); }
.pastday .games time { filter: grayscale(.9) brightness(1.05); }
.pastday .match { color: var(--muted); }
.go { align-self: center; padding: 0 .6rem 0 0; color: var(--empty); font-size: .85rem; }

/* jagamine: läbipaistev nupp rea paremas servas (ainult JS-iga), mängu leht /m/<id>/ */
.games li { display: flex; position: relative; background: var(--row); }
.pastday .games li { background: var(--past); }
.games li[hidden] { display: none; }
.games li > a { flex: 1; min-width: 0; }
.share {
  display: none; flex: 0 0 2.5rem; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer; padding: 0; font: inherit;
}
.js .share { display: flex; }
.share:hover, .share:focus-visible { color: var(--link); }
/* kitsal ekraanil asendab jagamisnupp rea lõpu noolt, et tekstil oleks ruumi */
@media (max-width: 34rem) {
  .js .games .go { display: none; }
  .js .games .info { padding-right: .2rem; }
}
.share.copied::after {
  content: "Link kopeeritud"; position: absolute; right: 2.8rem; top: 50%; transform: translateY(-50%); z-index: 2; white-space: nowrap;
  background: var(--fg); color: var(--bg); font-size: .75rem; padding: .25rem .5rem; border-radius: .3rem;
}
.game .card {
  display: flex; align-items: stretch; margin: 1rem 0 .8rem; border: 1px solid var(--line);
  border-radius: .5rem; overflow: hidden; background: var(--row);
}
.game .card time {
  flex: 0 0 5.4rem; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff;
}
.game .card time b { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.game .card time small { font-size: .65rem; text-transform: uppercase; letter-spacing: .03em; }
.game .card .info { padding: .7rem .9rem; }
.game h1.match { font-size: 1.2rem; margin: 0 0 .25rem; }
.game .meta { font-size: .9rem; margin: .1rem 0; }
.game.pastday .card { background: var(--past); }
.game.pastday .card time { filter: grayscale(.9) brightness(1.05); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: .35rem; padding: .55rem .95rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--row); color: var(--fg); font: inherit; font-size: .95rem;
  text-decoration: none; cursor: pointer;
}
.btn.share { flex: none; border-left: 1px solid var(--line); position: relative; }
.btn.share.copied::after { top: -1.2rem; right: 0; transform: none; }

.s-jalgpall { background: var(--jalgpall); }
.s-korvpall { background: var(--korvpall); }
.s-jaahoki { background: var(--jaahoki); }
.s-vorkpall { background: var(--vorkpall); }
.s-kasipall { background: var(--kasipall); }
.s-saalihoki { background: var(--saalihoki); }
.s-saalijalgpall { background: var(--saalijalgpall); }

.none, .empty-filter { padding: 1.5rem .25rem; color: var(--muted); }
.none p { margin: .3rem 0; }

footer { padding-top: 1.5rem; padding-bottom: 2rem; color: var(--muted); font-size: .8rem; }
footer p { margin: .3rem 0; }
