:root {
  --bg: #0d1117; --panel: #161b22; --line: #2a3139;
  --text: #e6edf3; --dim: #8b949e;
  --blue: #3b82f6; --orange: #f97316; --good: #34d399; --bad: #f87171;
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 16px; background: var(--bg); color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, sans-serif;
}
[hidden] { display: none !important; }

/* Until someone logs in, the login form is the whole page. */
body.locked header, body.locked main { display: none; }
#login { max-width: 320px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; }
#login label { display: flex; flex-direction: column; gap: 4px; color: var(--dim); font-size: 12px; }
#login input, input[type=password] {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 7px 10px; font: inherit;
}
input.key { width: 290px; font-family: Consolas, monospace; font-size: 12px; }

header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
h1 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: .02em; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); flex: none; }
.dot.on { background: var(--good); }
#status { color: var(--dim); }
nav { margin-left: auto; display: flex; gap: 4px; }
#tabs button { white-space: nowrap; }

button, select, input[type=text], input[type=number] {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 5px 10px; font: inherit;
}
button { cursor: pointer; }
button:hover { border-color: var(--dim); }
button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
input[type=number] { width: 64px; }

section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 16px; }
h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 0 0 10px; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 600; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
h3 small { color: var(--dim); font-weight: 400; font-size: 12px; }
.empty { color: var(--dim); }

.grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

/* Tables scroll inside their own box so the page never scrolls sideways. */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: right; font-size: 11px; color: var(--dim); font-weight: 600; padding: 4px 8px; white-space: nowrap; }
td { text-align: right; padding: 4px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
table.stat { table-layout: fixed; }
/* Full stat names are long, so headings wrap onto two lines instead of widening the column. */
table.stat th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
table.stat th:first-child { width: 200px; }
table.stat td:first-child { overflow: hidden; text-overflow: ellipsis; }
table.left th, table.left td { text-align: left; }
tr.team td { font-weight: 600; border-top: 2px solid var(--line); }
tr.t0 td:first-child { color: var(--blue); } tr.t1 td:first-child { color: var(--orange); }

.score { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.score b { font-size: 30px; font-weight: 700; }
.score .b { color: var(--blue); } .score .o { color: var(--orange); }
.score .clock { margin-left: auto; font-size: 20px; color: var(--dim); }

.series { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 16px; }
.series b { font-size: 22px; font-variant-numeric: tabular-nums; }
.series .meta, .chips { color: var(--dim); font-size: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chips span { border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-variant-numeric: tabular-nums; }

.controls { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.controls label { color: var(--dim); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg button:last-child { border-radius: 0 6px 6px 0; }

.leaders { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.leaders div { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.leaders h4 { margin: 0 0 4px; font-size: 12px; color: var(--dim); font-weight: 600; }
.leaders ol { margin: 0; padding: 0; list-style: none; }
.leaders li { display: flex; gap: 8px; align-items: baseline; }
.leaders li em { display: block; font-style: normal; font-weight: 400; color: var(--dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.leaders li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaders li small { color: var(--dim); }
.leaders li:first-child { font-weight: 600; }

#log div { padding: 2px 0; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
#log .ts { color: var(--dim); margin-right: 8px; }
#log .ev { color: var(--good); margin-right: 6px; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.row label { color: var(--dim); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.note { color: var(--dim); font-size: 12px; margin: 0 0 10px; }
.error { color: var(--bad); }
