/* CloudHockey — one stylesheet, system fonts, no third-party assets. */
:root {
  --bg: #f3f6fa; --card: #ffffff; --ink: #0f1b2d; --muted: #5a6a80; --line: #d9e1ec; --soft: #e9eef5;
  --home: #1d5fd1; --away: #d97706; --home-ink: #0b3a8c; --away-ink: #8a4a03;
  --ok: #157f3b; --warn-bg: #fff4d6; --warn-ink: #6b4a00; --info-bg: #e6f0ff; --info-ink: #0b3a8c; --danger: #b42318;
  --radius: 12px; --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 4px 14px rgba(15, 27, 45, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1420; --card: #141d2c; --ink: #e8eef7; --muted: #9fb0c6; --line: #263349; --soft: #1b2639;
    --home: #5b93ff; --away: #f5a742; --home-ink: #a9c4ff; --away-ink: #ffd089;
    --ok: #4ccb7a; --warn-bg: #3a2d08; --warn-ink: #ffe29a; --info-bg: #12284d; --info-ink: #bcd2ff; --danger: #ff7a6e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
@media (min-width: 1400px) { html { font-size: 106.25%; } }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.5; font-variant-numeric: tabular-nums; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; word-break: break-all; }
.wrap { max-width: 64rem; margin: 0 auto; padding: 0 1rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); padding: .5rem 1rem; }
.skip:focus { left: 1rem; z-index: 10; }
.small { font-size: .85rem; } .muted { color: var(--muted); } .num { text-align: right; }

/* masthead */
.masthead { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; flex-wrap: wrap; padding-block: .4rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand .logo { width: 1.75rem; height: 1.75rem; color: var(--home); }
.brand .name { font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.brand .tag { color: var(--muted); font-size: .85rem; border-left: 1px solid var(--line); padding-left: .6rem; }
.masthead nav { display: flex; gap: .25rem; }
.masthead nav a { text-decoration: none; padding: .45rem .8rem; border-radius: 999px; font-weight: 600; color: var(--muted); }
.masthead nav a[aria-current="page"], .masthead nav a:hover { background: var(--soft); color: var(--ink); }
.statusline { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); padding-block: .6rem .2rem; }
.notice { border-radius: var(--radius); padding: .7rem 1rem; margin: .6rem 0; background: var(--info-bg); color: var(--info-ink); }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.small { padding: .4rem .7rem; }

/* hero */
.hero { padding: 1.6rem 0 .8rem; }
.hero.compact { padding: 1.2rem 0 .4rem; }
.hero h1 { font-size: clamp(1.6rem, 2.6vw + 1rem, 2.4rem); line-height: 1.15; margin: 0 0 .4rem; letter-spacing: -.02em; }
.lede { font-size: 1.05rem; color: var(--muted); max-width: 46rem; margin: 0; }

/* filters */
.filters { display: flex; flex-direction: column; gap: .7rem; margin: .8rem 0 1.2rem; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: thin; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.chip.selected { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .count { font-weight: 500; font-size: .8rem; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 0 .45rem; }
.chip.selected .count { background: rgba(255,255,255,.2); color: inherit; }
.chip.empty { opacity: .6; }
.teamfilter { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.teamfilter label { font-weight: 600; font-size: .9rem; }
select, input[type="password"], input[type="text"] { font: inherit; padding: .45rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); max-width: 100%; }
.btn { font: inherit; font-weight: 600; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--home); background: var(--home); color: #fff; cursor: pointer; }
.btn.small { padding: .4rem .7rem; font-size: .9rem; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: default; }
.js .teamfilter .btn { display: none; }

/* day groups and game rows */
.day h2 { font-size: 1.1rem; margin: 1.3rem 0 .5rem; display: flex; align-items: baseline; gap: .6rem; }
.games { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.game { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.game-link { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) minmax(12rem, 18rem); gap: .8rem 1rem; align-items: center; padding: .8rem 1rem; text-decoration: none; }
.game .when { display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; }
.game .when time { font-weight: 700; font-size: 1rem; }
.status { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; }
.status.live { color: var(--danger); } .status.final { color: var(--ok); } .status.ppd, .status.cncl { color: var(--warn-ink); }
.pulse { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }
.pill { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .1rem .45rem; border-radius: 999px; background: var(--soft); color: var(--muted); width: max-content; }
.matchup { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; align-items: center; min-width: 0; }
.team { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.team.home { justify-content: flex-end; text-align: right; }
.team .abbr { font-weight: 800; font-size: 1.05rem; }
.team .full { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team .score { font-weight: 800; font-size: 1.2rem; margin-left: .3rem; }
.team.won .abbr, .team.won .score { color: var(--ok); }
.team.home .score { order: -1; margin: 0 .3rem 0 0; }
.at { color: var(--muted); font-size: .8rem; text-transform: uppercase; }
.prob { min-width: 0; }
.prob-labels { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); }
.prob-labels .fav { color: var(--ink); }
.prob-labels b { font-size: 1rem; }
.prob-labels .away.fav b { color: var(--away-ink); } .prob-labels .home.fav b { color: var(--home-ink); }
.probbar { display: block; width: 100%; height: .55rem; border-radius: 999px; overflow: hidden; background: var(--soft); margin: .25rem 0; }
.probbar .away { fill: var(--away); } .probbar .home { fill: var(--home); }
.prob-meta { margin-top: .1rem; }
.results .game-link { grid-template-columns: 8.5rem minmax(0, 1fr) minmax(12rem, 18rem); }
.empty-state { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.2rem; color: var(--muted); }
.tzline { margin: 1.2rem 0; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .6rem; margin: .8rem 0 1.2rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; }
.stat .num { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; text-align: left; }
.stat .lbl { font-weight: 600; }
.stat .sub { color: var(--muted); font-size: .85rem; }

/* game page */
.crumbs { font-size: .9rem; color: var(--muted); margin: 1rem 0 .4rem; }
.gamehead { margin-bottom: 1rem; }
.gamehead .when { display: flex; flex-wrap: wrap; gap: .5rem .7rem; align-items: center; font-size: .95rem; }
.gamehead h1 { font-size: clamp(1.4rem, 2vw + 1rem, 2.2rem); line-height: 1.2; margin: .4rem 0; letter-spacing: -.02em; }
.gamehead .at { font-size: 1rem; font-weight: 400; margin: 0 .3rem; }
.gamehead .t.won { text-decoration: underline; text-decoration-color: var(--ok); text-underline-offset: .2em; }
.finalscore { font-size: 1.3rem; margin: .3rem 0; }
.finalscore .lbl { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: .5rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin: .9rem 0; }
.card h2 { font-size: 1.15rem; margin: 0 0 .7rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; }
.card h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.card .prob .prob-labels b { font-size: 1.5rem; }
.card .probbar { height: .9rem; }
.explain { max-width: 60rem; }
.inputs, .kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .5rem 1rem; margin: 0; }
.inputs dt, .kv dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.inputs dd, .kv dd { margin: 0; font-weight: 600; }
.kv { grid-template-columns: 1fr; gap: .6rem; }
.context { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.ctx h3 { margin-top: 0; }
.last5 { list-style: none; padding: 0; margin: .3rem 0 0; display: grid; gap: .25rem; }
.last5 a { text-decoration: none; display: flex; gap: .5rem; align-items: baseline; }
.last5 .r-w b { color: var(--ok); } .last5 .r-l b { color: var(--danger); } .last5 .r-otl b { color: var(--away-ink); }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
table.jobs { min-width: 54rem; } table.history { min-width: 30rem; } table.ratings { min-width: 22rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sources { padding-left: 1.1rem; } .sources li { margin-bottom: .5rem; }
.toc { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 1rem; }
.toc a { text-decoration: none; font-size: .9rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }

/* admin */
.login { max-width: 26rem; margin: 2rem auto; }
.login form { display: grid; gap: .6rem; }
.adminhead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: .9rem; }
.admin-grid .card { margin: 0; }
.inline { display: inline-flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .6rem; }
.big { font-size: 1.1rem; }
.err { color: var(--danger); }
.job-error td { background: var(--warn-bg); }

/* footer */
.site-foot { margin-top: 2.5rem; border-top: 1px solid var(--line); padding: 1.4rem 0 2rem; color: var(--muted); font-size: .85rem; }
.site-foot p { margin: .4rem 0; max-width: 60rem; }

/* narrow screens */
@media (max-width: 760px) {
  .brand .tag { display: none; }
  .game-link, .results .game-link { grid-template-columns: 1fr; gap: .5rem; padding: .75rem .9rem; }
  .game .when { flex-direction: row; align-items: center; gap: .6rem; flex-wrap: wrap; }
  .matchup { grid-template-columns: 1fr; gap: .2rem; }
  .team.home { justify-content: flex-start; text-align: left; }
  .team.home .score { order: 0; margin: 0 0 0 .3rem; }
  .matchup .at { display: none; }
  .matchup .team.home::before { content: "at"; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; margin-right: .1rem; }
  .team .full { white-space: normal; }
}
@media print {
  .masthead nav, .filters, .site-foot script { display: none; }
  .game { break-inside: avoid; box-shadow: none; }
}
