/* cricket-leagues: tokens and components follow vote-count's and flip-flop's app.css (same look across the projects). */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #17191c;
  --muted: #646b75;
  --border: #e2e5ea;
  --accent: #2459d6;
  --accent-text: #ffffff;
  --bad-bg: #fdecec;  --bad: #a1251f;
  --info-bg: #eaf0fd; --info: #2a4ea8;
  --radius: 10px;
  /* map: places not in the list, then the categories (three hues validated all-pairs for colour-blind reading in
     vote-count, then a grey); selected places get a dark edge */
  --map-0: #e9ebee; --map-sea: #f0f4f9; --map-mark: #eb6834;
  --map-k1: #2a78d6; --map-k2: #eb6834; --map-k3: #1baf7a; --map-k4: #9aa1ab; --map-k5: #5f6670;
  /* season strip: internationals (k1) and leagues (k2), solid for dated, soft for usual windows; text on them */
  --k1-soft: #d3e3f8; --k2-soft: #fbdccf; --on-k1: #ffffff; --on-k2: #17191c;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
/* Night: chosen with the Day/Night toggle (data-theme), or the system setting when no choice is saved. */
:root[data-theme="dark"] {
  --bg: #111317; --surface: #191c21; --text: #e8eaee; --muted: #9aa1ab; --border: #2a2f37;
  --accent: #6d95ff; --accent-text: #0b1020;
  --bad-bg: #3a1716; --bad: #ff9c94; --info-bg: #182540; --info: #9db8ff;
  --map-0: #2c3038; --map-sea: #14171c; --map-mark: #f08a5d;
  --map-k1: #3987e5; --map-k2: #d95926; --map-k3: #199e70; --map-k4: #6b727c; --map-k5: #a3a9b2;
  --k1-soft: #1c3150; --k2-soft: #4a281a; --on-k1: #0b1020; --on-k2: #0b1020;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317; --surface: #191c21; --text: #e8eaee; --muted: #9aa1ab; --border: #2a2f37;
    --accent: #6d95ff; --accent-text: #0b1020;
    --bad-bg: #3a1716; --bad: #ff9c94; --info-bg: #182540; --info: #9db8ff;
    --map-0: #2c3038; --map-sea: #14171c; --map-mark: #f08a5d;
    --map-k1: #3987e5; --map-k2: #d95926; --map-k3: #199e70; --map-k4: #6b727c; --map-k5: #a3a9b2;
    --k1-soft: #1c3150; --k2-soft: #4a281a; --on-k1: #0b1020; --on-k2: #0b1020;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
h1, h2 { margin: 0 0 .6rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; margin: 1rem 0 .3rem; }
a { color: var(--accent); }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .82rem; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 1rem; padding: .7rem 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .01em; flex: 1; }
.brand .muted { font-weight: 400; margin-left: .4rem; }
.theme-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--bg); }
.theme-toggle button { font: inherit; font-size: .82rem; border: 0; background: transparent; color: var(--muted); padding: .25rem .65rem; border-radius: 999px; cursor: pointer; }
.theme-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }

/* layout */
.page { max-width: 1200px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.page > * { min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.alert { padding: .7rem .9rem; border-radius: var(--radius); background: var(--info-bg); color: var(--info); }
.alert-bad { background: var(--bad-bg); color: var(--bad); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; align-items: start; }

/* controls */
.chart-controls { display: flex; flex-wrap: wrap; gap: .5rem .75rem; margin-bottom: .9rem; align-items: center; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.filters { font-size: .88rem; gap: .3rem .9rem; }
.filters .sep { color: var(--muted); }
.btn { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: .45rem .9rem; cursor: pointer; }
.btn-small { padding: .2rem .6rem; font-size: .8rem; }
.months { display: flex; flex-wrap: wrap; gap: 4px; align-items: stretch; margin-bottom: .7rem; }
.months .month { font: inherit; font-size: .82rem; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 8px; padding: .2rem .5rem; cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; min-width: 3.1rem; line-height: 1.2; }
.months .month .yr { font-size: .68rem; color: var(--muted); min-height: .8rem; }
.months .month.now { border-color: var(--muted); }
.months .month[aria-pressed="true"] { background: var(--info-bg); color: var(--info); border-color: var(--info); font-weight: 600; }
.months .month[aria-pressed="true"] .yr { color: var(--info); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .4rem .55rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
tr.pick { cursor: pointer; }
tr.pick:hover td { background: var(--bg); }
tr.pick.on td { background: var(--info-bg); }
td .sub, li .sub { display: block; color: var(--muted); font-size: .8rem; }

/* world map (public/worldmap.js) */
.worldmap { position: relative; }
.worldmap svg { display: block; width: 100%; height: auto; background: var(--map-sea); border-radius: 8px; touch-action: auto; cursor: grab; }
.worldmap svg.zoomed { touch-action: none; }
.worldmap svg.dragging { cursor: grabbing; }
.worldmap .unit { stroke: var(--surface); stroke-width: .6; vector-effect: non-scaling-stroke; cursor: pointer; fill-rule: evenodd; }
.worldmap .unit.dot { stroke-width: 1; }
.worldmap .unit:hover, .worldmap .unit:focus { stroke: var(--text); stroke-width: 1.5; outline: none; }
.worldmap .unit.dim { opacity: .3; }
.worldmap .unit.member { stroke: var(--map-mark); stroke-width: 1.2; }
.worldmap .unit.selected { stroke: var(--text); stroke-width: 2.2; }
.map-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; }
.map-zoom button { font: inherit; width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 1rem; line-height: 1; }
.map-zoom button.reset { font-size: .7rem; }
.map-c0 { fill: var(--map-0); background: var(--map-0); }
.map-k1 { fill: var(--map-k1); background: var(--map-k1); }
.map-k2 { fill: var(--map-k2); background: var(--map-k2); }
.map-k3 { fill: var(--map-k3); background: var(--map-k3); }
.map-k4 { fill: var(--map-k4); background: var(--map-k4); }
.map-k5 { fill: var(--map-k5); background: var(--map-k5); }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem .9rem; margin-top: .5rem; font-size: .8rem; color: var(--muted); }
.map-legend .sw { display: inline-block; width: 16px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
.chart-tip { position: absolute; transform: translateX(-50%); pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .4rem .6rem; font-size: .82rem; box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; color: var(--text); z-index: 5; }
.chart-tip .tip-head { font-weight: 600; margin-bottom: .15rem; }

/* season strip (index.js drawStrip): a row per team, bars placed by day over 12 months */
.strip { position: relative; --lab: 150px; }
.srow { display: grid; grid-template-columns: var(--lab) minmax(0, 1fr); align-items: center; border-top: 1px solid var(--border); }
.srow.shead { border-top: 0; }
.srow.on { background: var(--info-bg); }
.sname { font: inherit; font-size: .84rem; text-align: left; background: none; border: 0; color: var(--text); padding: .25rem .5rem .25rem 0; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow.assoc .sname { color: var(--muted); }
.sname:hover, .srow.on .sname { color: var(--accent); }
.sarea { position: relative; cursor: pointer; }
.scols { position: relative; height: 24px; }
.scol { position: absolute; top: 0; height: 22px; font: inherit; font-size: .74rem; color: var(--muted); background: none; border: 0; border-left: 1px solid var(--border); padding: 0 0 0 3px; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; }
.scol.on { color: var(--info); font-weight: 600; }
.bar { position: absolute; height: 16px; min-width: 6px; border-radius: 3px; font-size: .72rem; line-height: 16px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar.lg { background: var(--map-k2); color: var(--on-k2); }
.bar.intl { background: var(--map-k1); color: var(--on-k1); }
.bar.lg.usual { background: var(--k2-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--map-k2); }
.bar.intl.usual { background: var(--k1-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--map-k1); }
.band { position: absolute; height: 5px; border-radius: 2px; background: var(--map-k1); opacity: .75; }
.soverlay { position: absolute; top: 0; bottom: 0; left: var(--lab); right: 0; pointer-events: none; }
.smonth { position: absolute; top: 0; bottom: 0; background: var(--info); opacity: .08; }
.stoday { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--map-mark); }
.strip-key { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .6rem; }
.bar-sw { display: inline-block; width: 18px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
.bar-sw.lg { background: var(--map-k2); }
.bar-sw.lg.usual { background: var(--k2-soft); box-shadow: inset 0 0 0 1px var(--map-k2); }
.bar-sw.intl { background: var(--map-k1); }
.bar-sw.band { height: 5px; vertical-align: 1px; background: var(--map-k1); opacity: .75; }
.bar-sw.today { width: 0; border-left: 2px solid var(--map-mark); border-radius: 0; }

/* details */
.tag { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: var(--info-bg); color: var(--info); font-size: .78rem; font-weight: 600; margin-right: .4rem; }
.sources li { margin-bottom: .4rem; }

@media (max-width: 600px) {
  .brand .muted { display: block; margin-left: 0; }
  .strip { --lab: 92px; }
  .sname { font-size: .76rem; }
  .scol { font-size: .62rem; padding-left: 1px; }
  .bar { font-size: .62rem; padding: 0 2px; }
  .months .month { min-width: 2.6rem; padding: .2rem .3rem; }
}
