/* i guess low
 *
 * A terminal's materials - Cascadia Mono and Windows Terminal's "Campbell"
 * colours - set in a brutalist layout: thick rules, huge numbers, hard
 * edges, nothing rounded, nothing glowing, nothing faded. Green is the one
 * accent; red, yellow and blue only ever mean something. */

:root {
  --bg: #0c0c0c;
  --fg: #cccccc;
  --hi: #f2f2f2;
  --dim: #767676;
  --line: #cccccc;
  --red: #e74856;
  --green: #16c60c;
  --yellow: #c19c00;
  --blue: #3b78ff;
  --cyan: #61d6d6;
  --font: "Cascadia Mono", "Cascadia Code", Consolas, "Ubuntu Mono", "DejaVu Sans Mono",
    Menlo, monospace;
  --rule: 2px solid var(--line);
  /* Sections print one after another, this far apart. */
  --beat: 110ms;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--font);
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--green); color: var(--bg); }

p, ol, pre, table, h2 { margin: 0; }

a { color: var(--hi); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { background: var(--hi); color: var(--bg); text-decoration: none; }

b, .b { color: var(--hi); font-weight: 700; }
.dim { color: var(--dim); }
.win { color: var(--green); }
.lose, .bad { color: var(--red); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------------------------------------------------------------- frame */

.top,
main,
footer { width: 100%; max-width: 1040px; margin: 0 auto; padding-inline: 20px; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  padding-block: 14px;
  border-bottom: var(--rule);
}

.brand { color: var(--hi); font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.brand b { padding: 0 6px; margin-left: 2px; background: var(--green); color: var(--bg); }
.brand:hover { background: none; color: var(--hi); }

.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; }
.top nav a { color: var(--fg); text-decoration: none; }
.top nav a.on { background: var(--hi); color: var(--bg); padding: 0 6px; margin: 0 -6px; }
.top nav a:hover { background: var(--hi); color: var(--bg); }
.top nav form { margin: 0; }

.status { margin-left: auto; color: var(--dim); white-space: nowrap; }
.busy { color: var(--green); }
.busy:not(:empty) { margin-right: 14px; }

main { flex: 1; padding-block: 8px 64px; }

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  padding-block: 14px 22px;
  border-top: var(--rule);
  color: var(--dim);
}

/* ------------------------------------------------------------- sections */

.sec { margin-top: 44px; }

/* A section header is its name, then a thick rule running to the edge,
   then an optional tag on the right. */
.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  color: var(--hi);
  font-size: 1rem;
  font-weight: 700;
}
.rule::after { content: ""; order: 1; flex: 1; border-top: var(--rule); }
.rule .tag,
.rule .ranges { order: 2; }
.tag { color: var(--dim); font-weight: 400; text-decoration: none; }
a.tag { color: var(--fg); text-decoration: underline; }
.tag.live { background: var(--green); color: var(--bg); padding: 0 6px; font-weight: 700; }
.tag.warn { background: var(--yellow); color: var(--bg); padding: 0 6px; font-weight: 700; }
.tag.bad { background: var(--red); color: var(--bg); padding: 0 6px; font-weight: 700; }

/* ---------------------------------------------------------------- round */

.countdown {
  color: var(--hi);
  font-size: clamp(3rem, 11vw, 6rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.meter { margin-top: 18px; white-space: nowrap; overflow: hidden; }
.meter-bar { color: var(--green); }
.meter-pct { color: var(--hi); font-weight: 700; }

/* Big figures in a row, each over its caption, split by thick rules. */
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-top: 26px;
  border-top: var(--rule);
  border-bottom: var(--rule);
}
.figures p { display: flex; flex-direction: column; padding: 14px 18px 14px 0; }
.figures p + p { padding-left: 18px; border-left: var(--rule); }
.figures b { font-size: 2.4rem; line-height: 1.1; letter-spacing: -0.02em; word-break: break-all; }
.figures b.win { color: var(--green); }
.figures b.lose { color: var(--red); }
.figures span { color: var(--dim); }

/* ---------------------------------------------------------------- guess */

.guessform { display: flex; flex-wrap: wrap; gap: 0; max-width: 640px; }

input[type="text"] {
  flex: 1 1 260px;
  min-width: 0;
  padding: 12px 16px;
  background: var(--bg);
  border: 2px solid var(--blue);
  border-radius: 0;
  color: var(--hi);
  font: 700 2rem/1 var(--font);
  caret-color: var(--green);
}
input[type="text"]::placeholder { color: #3a3a3a; }
/* Blue at rest, green while you type in it. */
input[type="text"]:focus { outline: none; border-color: var(--green); }

button,
.btn {
  display: inline-block;
  padding: 12px 20px;
  background: var(--hi);
  border: 2px solid var(--hi);
  border-radius: 0;
  color: var(--bg);
  font: 700 1rem/1.5 var(--font);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
button:hover,
.btn:hover,
button:focus-visible,
.btn:focus-visible { background: var(--green); border-color: var(--green); color: var(--bg); outline: none; }
.guessform button { font-size: 1.1rem; }

.btn.ghost,
button.ghost { background: transparent; color: var(--fg); border-color: var(--dim); }
.btn.ghost:hover,
button.ghost:hover { background: var(--hi); border-color: var(--hi); color: var(--bg); }

.linkish {
  padding: 0;
  background: none;
  border: 0;
  color: var(--fg);
  font: inherit;
  font-weight: 400;
}
.linkish:hover { background: var(--hi); color: var(--bg); }

.sec > .dim,
.sec > .notice { margin-top: 12px; }
.sec > .notice:first-child { margin: 0 0 22px; }

.sealed {
  position: relative;
  display: inline-block;
  padding: 18px 26px;
  border: 2px solid var(--green);
}
.sealed-value { color: var(--hi); font-size: clamp(2.6rem, 10vw, 5rem); font-weight: 700; line-height: 1; word-break: break-all; }
.stamp {
  position: absolute;
  top: -14px;
  right: -12px;
  padding: 2px 8px;
  background: var(--red);
  color: var(--bg);
  font-weight: 700;
  transform: rotate(4deg);
}

/* ------------------------------------------------------------- messages */

.notice { padding: 10px 14px; border-left: 6px solid; background: #161616; }
.notice b { margin-right: 8px; }
.notice.ok { border-color: var(--green); }
.notice.ok b { color: var(--green); }
.notice.error { border-color: var(--red); }
.notice.error b { color: var(--red); }
.notice.warn { border-color: var(--yellow); }
.notice.warn b { color: var(--yellow); }

/* ---------------------------------------------------------------- rules */

.rules { list-style: none; padding: 0; display: grid; gap: 10px; max-width: 720px; }
.rules li { display: grid; grid-template-columns: 3ch 1fr; gap: 12px; }
.rules b { color: var(--green); }

.verdict { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.verdict b { font-size: clamp(3rem, 12vw, 6rem); line-height: 1; letter-spacing: -0.03em; }

/* --------------------------------------------------------------- confirm */

.question { color: var(--hi); font-size: 1.4rem; font-weight: 700; }
.bignumber {
  color: var(--hi);
  font-size: clamp(3.4rem, 15vw, 8rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  word-break: break-all;
  margin: 6px 0 22px;
}
.bignumber.bad { color: var(--red); }
.confirmform { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.message { color: var(--hi); font-size: 1.1rem; margin-bottom: 22px; max-width: 60ch; }

/* ---------------------------------------------------------------- lists */

/* The top three, side by side: rank, days won big, then who. */
.podium {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  border-top: var(--rule);
  border-bottom: var(--rule);
  margin-bottom: 12px;
}
.podium li { display: flex; flex-direction: column; padding: 12px 18px 12px 0; min-width: 0; }
.podium li + li { padding-left: 18px; border-left: var(--rule); }
.podium .rank { color: var(--dim); }
.podium .wins { font-size: 2.6rem; line-height: 1.1; }
.podium .who { color: var(--hi); font-weight: 700; overflow-wrap: anywhere; }
.podium .p1 .rank, .podium .p1 .wins { color: var(--green); }

/* Search and jump-to-day, side by side. */
.finders { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-bottom: 16px; }
.finder { display: flex; }
.finder input[type="text"],
.finder input[type="date"] {
  flex: 1 1 200px;
  padding: 6px 10px;
  background: var(--bg);
  border: 2px solid var(--dim);
  border-radius: 0;
  color: var(--hi);
  font: inherit;
  color-scheme: dark;
}
.finder input:focus { outline: none; border-color: var(--green); }
.finder button { padding: 6px 14px; }
.listed { margin-top: 10px; }

.leaders { list-style: none; padding: 0; border-top: var(--rule); }
.leaders li {
  display: grid;
  grid-template-columns: 4ch 1fr auto;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #2a2a2a;
}
.leaders .rank { color: var(--dim); }
.leaders .wins { font-size: 1.5rem; }
.leaders li.first .rank { color: var(--green); }
.leaders li.first .who { color: var(--hi); font-size: 1.3rem; }
.leaders li.first .wins { color: var(--green); font-size: 2.4rem; }

.ranked { list-style: none; padding: 0; }
.ranked li { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid #2a2a2a; }
.ranked b { font-size: 1.5rem; }
.ranked span { color: var(--dim); }
.ranked .up b { color: var(--green); }
.ranked .down b { color: var(--red); }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 40px; }
.split .sub { margin: 22px 0 6px; color: var(--hi); font-weight: 700; }

/* --------------------------------------------------------------- tables */

.grid { border-collapse: collapse; width: 100%; }
.grid.narrow { width: auto; min-width: 260px; }
.grid th {
  padding: 0 18px 6px 0;
  border-bottom: var(--rule);
  color: var(--dim);
  font-weight: 400;
  text-align: left;
}
.grid td { padding: 7px 18px 7px 0; border-bottom: 1px solid #2a2a2a; vertical-align: baseline; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid th:last-child, .grid td:last-child { padding-right: 0; }
.grid td.win { color: var(--green); font-weight: 700; }

.diff { width: auto; margin-bottom: 8px; }
.diff td { font-size: 1.05rem; }
.diff .sign { width: 2ch; font-weight: 700; }
.diff .arrow { color: var(--dim); padding-inline: 8px; }
.diff tr.up .sign, .diff tr.up td.b { color: var(--green); }
.diff tr.down .sign, .diff tr.down td.b { color: var(--red); }
.diff tr.same .sign { color: var(--dim); }

/* A value with a bar beside it: the bar is the value against the largest in
   the table, so the column reads as a chart without losing the number. */
.barcell { width: 32%; white-space: nowrap; }
.barcell b { margin-left: 10px; }
.minibar {
  display: inline-block;
  vertical-align: middle;
  width: calc(var(--w) * 0.7);
  height: 10px;
  background: var(--cyan);
}
.barcell.win .minibar { background: var(--green); }
.barcell.win b { color: var(--green); }

details summary { cursor: pointer; color: var(--hi); font-weight: 700; }
details summary:hover { color: var(--green); }
details[open] summary { margin-bottom: 12px; }

/* ---------------------------------------------------------------- chart */

.legend { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-bottom: 12px; color: var(--dim); }
.legend i { font-style: normal; }
.legend .win { color: var(--green); }
.legend .once, .legend .picked { color: var(--cyan); }
.legend .many { color: var(--blue); }

/* One column per number, all sharing the width: the more numbers, the
   thinner each column, down to a pixel. They stand on a thick baseline. */
.chart { position: relative; padding-top: 22px; }
.chart-max { position: absolute; top: 0; left: 0; color: var(--dim); font-size: 0.8rem; }
.chart-max::after { content: " picks"; }
/* Every pick above the chart, one chip per number. */
.tail-head { margin: 6px 0 8px; color: var(--hi); font-weight: 700; }
.tail { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tail li { padding: 1px 7px; border: 1px solid #3a3a3a; white-space: nowrap; }
.tail li b { color: var(--cyan); font-weight: 700; }
.tail li span { margin-left: 4px; color: var(--dim); }
.tail li.won { border-color: var(--green); }
.tail li.won b { color: var(--green); }
.tail li:hover { border-color: var(--hi); }
.cols {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  height: 300px;
  border-bottom: var(--rule);
}
.col { position: relative; display: flex; flex-direction: column; min-width: 0; }
/* The plot area; a bar's height is a share of it. */
.col-track { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.col-bar {
  position: relative;
  height: var(--h);
  /* A sliver of gap between neighbours that shrinks with the column. */
  margin-inline: 12%;
  background: var(--cyan);
  transform-origin: bottom;
  animation: grow 420ms steps(6) both;
  animation-delay: calc(var(--b, 0) * var(--beat) + min(var(--i, 0) * 12ms, 600ms));
}
/* Labels hang below the baseline and may be wider than their column. */
.col-n { position: absolute; top: 100%; left: 50%; padding-top: 4px; }
.col-n span {
  display: block;
  translate: -50% 0;
  color: var(--dim);
  font-size: 0.72rem;
  white-space: nowrap;
}
.chart { margin-bottom: 1.6em; }
.col-c {
  position: absolute;
  bottom: 100%;
  left: 50%;
  translate: -50% 0;
  visibility: hidden;
  padding: 0 3px;
  background: var(--bg);
  color: var(--hi);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.win .col-bar { background: var(--green); }
.once .col-bar, .picked .col-bar { background: var(--cyan); }
.many .col-bar { background: var(--blue); }
.col:hover .col-c { visibility: visible; }
.col:hover .col-n span { color: var(--hi); }
.col:hover .col-bar { filter: brightness(1.35); }

/* --------------------------------------------------------------- trends */

.ranges { display: flex; gap: 10px; font-weight: 400; }
.ranges a { color: var(--fg); text-decoration: none; padding: 0 6px; border: 1px solid var(--dim); }
.ranges a.on { background: var(--hi); border-color: var(--hi); color: var(--bg); font-weight: 700; }

.analyse { color: var(--dim); }
.analyse-bar {
  display: inline-block;
  vertical-align: bottom;
  overflow: hidden;
  white-space: pre;
  color: var(--green);
  width: 32ch;
  animation: fill 520ms steps(30) 120ms both;
}
.analyse-done { color: var(--hi); font-weight: 700; animation: show 1ms 680ms both; }

/* ---------------------------------------------------------- test banner */

.testbanner {
  margin: 0;
  padding: 6px 20px;
  background: var(--yellow);
  color: var(--bg);
}
.testbanner b { color: var(--bg); }
.testbanner a, .testbanner .linkish { color: var(--bg); text-decoration: underline; }
div.testbanner form.inline { display: inline; margin: 0; }

/* ----------------------------------------------------------- admin page */
/* /admin keeps its own markup; these give its classes the same look. */

.card { margin-top: 44px; }
.eyebrow { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; color: var(--hi); font-weight: 700; }
.eyebrow::after { content: ""; flex: 1; border-top: var(--rule); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 24px; margin: 0 0 16px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.top form.inline { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row input[type="text"] { font-size: 1rem; flex: 1 1 160px; padding: 10px 12px; }
.admin-form { display: block; }
.check { display: flex; gap: 10px; align-items: baseline; margin-top: 10px; }
.check input { accent-color: var(--green); }
.hint, .empty, .tally, .nowinner { color: var(--dim); margin-top: 10px; }
.hint strong { color: var(--hi); }
.login { color: var(--dim); }
.value { color: var(--green); font-weight: 700; font-size: 1.5rem; }
.ghosttag { color: var(--dim); }
.demolist { list-style: none; padding: 0; margin: 0 0 12px; }
.demolist li { display: flex; gap: 20px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #2a2a2a; }
.history { border-collapse: collapse; width: 100%; margin-top: 8px; }
.history th { padding: 0 18px 6px 0; color: var(--dim); font-weight: 400; text-align: left; border-bottom: var(--rule); }
.history td { padding: 7px 18px 7px 0; border-bottom: 1px solid #2a2a2a; }
.history .num { text-align: right; }

/* --------------------------------------------------------------- motion */
/* Hard steps only. Sections switch on one after another like lines printed
   to a terminal; bars fill cell by cell; the stamp lands in three frames. */

@keyframes show { from { visibility: hidden; } }
@keyframes fill { from { width: 1ch; } }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes stamp {
  0% { visibility: hidden; }
  1% { visibility: visible; transform: rotate(4deg) scale(2.2); }
  50% { transform: rotate(4deg) scale(0.9); }
  100% { transform: rotate(4deg); }
}

.sec, .card { animation: show 1ms both; animation-delay: calc(var(--b, 0) * var(--beat)); }
.meter-bar { display: inline-block; overflow: hidden; vertical-align: bottom; width: 32ch; animation: fill 420ms steps(30) 80ms both; }
.notice.ok ~ .sealed .stamp { animation: stamp 300ms steps(3) 350ms both; }

button.is-busy { pointer-events: none; }

@media (max-width: 640px) {
  body { font-size: 14px; }
  .top, main, footer { padding-inline: 14px; }
  .status .clock { display: none; }
  .figures p + p { padding-left: 0; border-left: 0; border-top: 1px solid #2a2a2a; }
  .sealed { display: block; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 6px; }
  .guessform button { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
  }
}
