:root {
  --fg: #1c1e21; --muted: #6b7280; --bg: #fff; --line: #e5e7eb; --link: #1d4ed8; --head: #f3f4f6; --day: #e8edf3;
}
@media (prefers-color-scheme: dark) {
  :root { --fg: #e5e7eb; --muted: #9ca3af; --bg: #111827; --line: #2d3748; --link: #93c5fd; --head: #1f2937; --day: #1e293b; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 13px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--fg); background: var(--bg); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

header { display: flex; align-items: center; gap: 16px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--head); }
header .brand { font-weight: 700; color: var(--fg); }
header nav { display: flex; gap: 14px; flex: 1; }
header .logout { margin: 0; display: flex; align-items: center; gap: 8px; }
main { padding: 8px 12px 24px; max-width: 1280px; margin: 0 auto; }
h1 { font-size: 16px; margin: 4px 0 8px; }
h2 { font-size: 14px; margin: 16px 0 6px; }
input, button { font: inherit; padding: 5px 8px; }
button { cursor: pointer; }

/* Week navigation */
.weekbar { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; }
.weektitle { font-size: 15px; white-space: nowrap; }
.spacer { flex: 1; }
.button { display: inline-block; min-width: 32px; text-align: center; padding: 3px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--head); color: var(--fg); font-weight: 600; }
.button.disabled { opacity: 0.3; }

/* Small labels */
.tag { display: inline-block; font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: 3px; background: var(--line); color: var(--fg); white-space: nowrap; }
.tag.now, .tag.new, .tag.reappeared { background: #bbf7d0; color: #14532d; }
.tag.warn, .tag.moved { background: #fde68a; color: #78350f; }
.tag.changed { background: #bfdbfe; color: #1e3a8a; }
.tag.gone { background: #fecaca; color: #7f1d1d; }
.tag.time, .tag.rink, .tag.teams, .tag.changed { background: #bfdbfe; color: #1e3a8a; }
.tag.referee { background: #e0e7ff; color: #3730a3; }
.tag.first-seen { background: var(--line); color: var(--muted); }
.tag.trial { background: #e9d5ff; color: #581c87; }

/* Tables */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 3px 6px; vertical-align: top; }
table.games thead th { font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
table.games tr.dayrow th { background: var(--day); padding: 4px 6px; font-weight: 700; }
table.games tr.game td { border-bottom: 1px solid var(--line); }
table.games tr.game:hover td { background: var(--head); }
.c-time { width: 56px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-game { font-weight: 600; }
.c-nro { width: 64px; font-variant-numeric: tabular-nums; }
.c-chg { width: 70px; }
tr.gone td { color: var(--muted); text-decoration: line-through; }
tr.gone td.c-chg { text-decoration: none; }
.off { white-space: nowrap; }
.off:not(:last-child)::after { content: ","; color: var(--muted); }
.off.trial { font-style: italic; }
.off.unnamed, .unnamed { color: var(--muted); }
.trial { font-style: italic; }
.c-ref { white-space: nowrap; }
.c-off { display: none; }
.c-chg .tag { margin-right: 2px; }

/* Change cards (Changes page, game history) */
.card { padding: 6px 2px; border-bottom: 1px solid var(--line); max-width: 720px; }
.card .line1 .tag { margin-right: 2px; }
.card .line2 { margin-top: 2px; }
.card .line3 { font-size: 12px; margin-top: 1px; }
.filters { display: flex; gap: 6px; margin-left: 8px; }
.button.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }

table.facts { width: auto; }
table.facts th { color: var(--muted); font-weight: 400; padding-right: 16px; }
.foot { margin-top: 10px; }
.m-only { display: none; }

form.login { max-width: 320px; margin: 40px auto; display: grid; gap: 12px; font-size: 15px; }
form.login label { display: grid; gap: 4px; }
.error { color: #b91c1c; }
ul.apps { font-size: 15px; }

/* Phones: each game becomes a compact three-line block */
@media (max-width: 720px) {
  header { flex-wrap: wrap; gap: 6px 14px; }
  header .user { display: none; }
  main { padding: 6px 8px 20px; }
  .weekbar { flex-wrap: wrap; }
  table.games thead { display: none; }
  table.games, table.games tbody { display: block; }
  table.games tr.dayrow { display: block; }
  table.games tr.dayrow th { display: block; }
  table.games tr.game {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    grid-template-areas: "time game chg" "time meta nro" "time off off";
    padding: 5px 0;
    border-bottom: 1px solid var(--line);
  }
  table.games tr.game td { border: 0; padding: 0 4px; width: auto; }
  .c-time { grid-area: time; font-weight: 600; }
  .c-game { grid-area: game; }
  .c-chg { grid-area: chg; text-align: right; }
  .c-series { grid-area: meta; color: var(--muted); font-size: 12px; }
  .c-rink, .c-ref { display: none; }
  table.games .c-off { display: block; }
  .m-only { display: inline; }
  .c-nro { grid-area: nro; text-align: right; font-size: 12px; }
  .c-off { grid-area: off; font-size: 12px; }
}
