:root {
  --paper: #fbf7ef;
  --card: #ffffff;
  --ink: #1b2436;
  --ink-soft: #5a6475;
  --line: #e2dcd0;
  --owl: #c8873b;
  --owl-soft: #f6e8d4;
  --pitch: #2f7d53;
  --pitch-soft: #e3f1e8;
  --pond: #3f7f93;
  --pond-soft: #e2eef2;
  --sasquatch: #6b4f8a;
  --warn: #a8442c;
  --warn-soft: #fae7e1;
  /* Two colour scales, kept apart on purpose.
     Green and red only ever mean right and wrong.
     Blue, sand and purple only ever mean home, draw and away. */
  --pick-home: #2d6ca2;
  --pick-draw: #96836a;
  --pick-away: #7b57a3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 36, 54, .06), 0 8px 24px rgba(27, 36, 54, .06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141a26;
    --card: #1d2533;
    --ink: #eef1f6;
    --ink-soft: #a3adbd;
    --line: #2f3a4c;
    --owl: #e2a75c;
    --owl-soft: #382d1d;
    --pitch: #5cbb84;
    --pitch-soft: #1c3027;
    --pond: #6fb3c7;
    --pond-soft: #1b2b33;
    --sasquatch: #a98fc7;
    --warn: #e28a70;
    --warn-soft: #3a241e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

:root[data-theme="dark"] {
  --paper: #141a26;
  --card: #1d2533;
  --ink: #eef1f6;
  --ink-soft: #a3adbd;
  --line: #2f3a4c;
  --owl: #e2a75c;
  --owl-soft: #382d1d;
  --pitch: #5cbb84;
  --pitch-soft: #1c3027;
  --pond: #6fb3c7;
  --pond-soft: #1b2b33;
  --sasquatch: #a98fc7;
  --warn: #e28a70;
  --warn-soft: #3a241e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 72px; }

/* ---------- header ---------- */
header.top {
  background: #1b2436;
  color: #fdfaf4;
  padding: 18px 16px 0;
}
.top-inner { max-width: 760px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand svg { width: 46px; height: 46px; flex: none; }
.brand h1 { font-size: 1.22rem; margin: 0; line-height: 1.2; letter-spacing: .2px; }
.brand p { margin: 2px 0 0; font-size: .82rem; color: #b9c2d2; }

nav.tabs { display: flex; gap: 4px; margin-top: 16px; overflow-x: auto; }
nav.tabs a {
  flex: none; padding: 10px 15px; border-radius: 10px 10px 0 0;
  text-decoration: none; color: #c6cedd; font-weight: 600; font-size: .93rem; white-space: nowrap;
}
nav.tabs a[aria-current="page"] { background: var(--paper); color: var(--ink); }
nav.tabs a:hover:not([aria-current="page"]) { background: rgba(255, 255, 255, .1); color: #fff; }

/* ---------- blocks ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin: 18px 0; box-shadow: var(--shadow);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
h2 { font-size: 1.22rem; margin: 26px 0 10px; }
h3 { font-size: 1.02rem; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-soft); font-size: .9rem; }
.tiny { font-size: .82rem; color: var(--ink-soft); }
a { color: var(--pitch); }

.banner {
  border-radius: var(--radius); padding: 14px 16px; margin: 18px 0;
  border: 1px solid; display: flex; gap: 12px; align-items: flex-start;
}
.banner .ico { font-size: 1.3rem; line-height: 1.2; flex: none; }
.banner.open { background: var(--pitch-soft); border-color: var(--pitch); }
.banner.shut { background: var(--warn-soft); border-color: var(--warn); }
.banner.info { background: var(--pond-soft); border-color: var(--pond); }
.banner strong { display: block; }

/* ---------- the form ---------- */
label.field { display: block; font-weight: 700; margin-bottom: 6px; }
input[type="text"],
input[type="password"] {
  width: 100%; padding: 13px 14px; font-size: 1.05rem; font-family: inherit;
  border: 2px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
}
input[type="text"]:focus,
input[type="password"]:focus { outline: 3px solid var(--owl); outline-offset: 1px; border-color: var(--owl); }

.fixture { border-top: 1px solid var(--line); padding: 14px 0; }
.fixture:first-of-type { border-top: 0; }
.fixture .when { font-size: .8rem; color: var(--ink-soft); margin-bottom: 7px; }
.fixture .teams { font-weight: 700; margin-bottom: 9px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.fixture .teams .vs { color: var(--ink-soft); font-weight: 500; flex: none; }
.fixture .team { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.fixture .team.right { justify-content: flex-end; text-align: right; }

/* club badges, drawn in clubs.js */
.badge { width: 22px; height: 26px; flex: none; display: block; }
.opts label .badge { width: 25px; height: 29px; margin-bottom: 1px; }
td .badge, th .badge { width: 18px; height: 21px; display: inline-block; vertical-align: -5px; margin-right: 5px; }
.gamecell { display: flex; align-items: center; gap: 6px; }

.opts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.opts label {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 88px; padding: 9px 4px; cursor: pointer;
  border: 2px solid var(--line); border-radius: 11px; background: var(--card);
  font-size: .82rem; font-weight: 600; text-align: center; color: var(--ink-soft);
}
.opts label .big { font-size: .96rem; color: var(--ink); }
.opts input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opts label:hover { border-color: var(--owl); }
.opts label:has(input:focus-visible) { outline: 3px solid var(--owl); outline-offset: 2px; }
.opts label:has(input:checked) { border-color: var(--pitch); background: var(--pitch-soft); }
.opts label:has(input:checked) .big { color: var(--pitch); }
.opts label:has(input:checked) { color: var(--ink); }

button.small {
  font: inherit; font-size: .92rem; font-weight: 700;
  padding: 9px 16px; border-radius: 999px;
  color: #fff; background: var(--pond); border: 0; cursor: pointer;
}
button.small:hover { filter: brightness(1.08); }
button.small:focus-visible { outline: 3px solid var(--owl); outline-offset: 2px; }
button.small:disabled { opacity: .55; cursor: not-allowed; filter: none; }

button.go,
a.go {
  width: 100%; padding: 16px; font-size: 1.08rem; font-weight: 800; font-family: inherit;
  color: #fff; background: var(--pitch); border: 0; border-radius: 12px; cursor: pointer;
}
button.go:hover,
a.go:hover { filter: brightness(1.07); }
button.go:disabled { background: var(--ink-soft); cursor: not-allowed; opacity: .7; }
.progress { text-align: center; font-weight: 700; margin: 14px 0 10px; }

/* ---------- tables ---------- */
.scroller { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { background: var(--owl-soft); }
tr.squidrow td { background: var(--pond-soft); font-style: italic; }
td.rank { font-weight: 800; color: var(--ink-soft); width: 2.2rem; }
.wins { font-weight: 800; font-size: 1.05rem; }

/* ---------- animals ---------- */
.animal { display: flex; align-items: center; gap: 10px; }
.animal svg { width: 34px; height: 34px; flex: none; }
.ladder { display: grid; gap: 10px; }
.rung { display: flex; gap: 13px; align-items: center; padding: 10px; border-radius: 11px; border: 1px solid var(--line); }
.rung svg { width: 50px; height: 50px; flex: none; }
.rung .n {
  font-weight: 800; font-size: 1rem; min-width: 2.1rem; text-align: center;
  background: #1b2436; color: #fff; border-radius: 8px; padding: 3px 0; flex: none;
}
.rung .nm { font-weight: 700; }
.rung .bl { font-size: .85rem; color: var(--ink-soft); }
.rung.owl { border-color: var(--owl); background: var(--owl-soft); }
.rung.squid { border-color: var(--pond); background: var(--pond-soft); }

.bigscore { display: flex; align-items: center; gap: 16px; }
.bigscore svg { width: 76px; height: 76px; flex: none; }
.bigscore .sc { font-size: 2.3rem; font-weight: 800; line-height: 1; }

select {
  width: 100%; padding: 13px 14px; font-size: 1.02rem; font-family: inherit; font-weight: 600;
  border: 2px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
}

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 700; border: 1px solid; }
.pill.win { color: var(--pitch); border-color: var(--pitch); background: var(--pitch-soft); }
.pill.hit { color: var(--pitch); border-color: var(--pitch); background: var(--pitch-soft); }
.pill.miss { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.pill.pending { color: var(--ink-soft); border-color: var(--line); }

/* ---------- how everyone picked ---------- */
.distrow { margin: 0 0 14px; }
.distrow .lbl { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; margin-bottom: 5px; align-items: center; }
.distrow .lbl .res { color: var(--ink-soft); font-size: .8rem; white-space: nowrap; }
.dist { display: flex; height: 28px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--line); }
.dist span { display: flex; align-items: center; justify-content: center; font-size: .74rem; font-weight: 800; color: #fff; min-width: 0; overflow: hidden; }
.dist .h { background: var(--pick-home); }
.dist .d { background: var(--pick-draw); }
.dist .a { background: var(--pick-away); }
.dist .right { box-shadow: inset 0 0 0 3px var(--pitch); }
.dist .none { background: transparent; }

.key { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-soft); margin: 0 0 14px; }
.key i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; vertical-align: -2px; margin-right: 6px; }
.key .kh { background: var(--pick-home); }
.key .kd { background: var(--pick-draw); }
.key .ka { background: var(--pick-away); }
.key .kr { background: transparent; box-shadow: inset 0 0 0 3px var(--pitch); }

/* ---------- the grid of who picked what ---------- */
table.grid { font-size: .84rem; }
table.grid th, table.grid td { padding: 6px 5px; text-align: center; border-bottom: 1px solid var(--line); }
table.grid th.who, table.grid td.who {
  position: sticky; left: 0; background: var(--card); text-align: left;
  z-index: 1; border-right: 2px solid var(--line); padding-right: 10px; white-space: nowrap;
}
table.grid tr.me td.who { background: var(--owl-soft); }
table.grid th small { display: block; font-weight: 600; font-size: .68rem; letter-spacing: 0; text-transform: none; }
table.grid th .won { color: var(--ink); font-weight: 800; }
table.grid td.hit { background: var(--pitch-soft); color: var(--pitch); font-weight: 800; }
table.grid td.miss { background: var(--warn-soft); color: var(--warn); }
table.grid td.tot { font-weight: 800; border-left: 2px solid var(--line); }

/* ---------- score distribution ---------- */
.distribution { display: flex; gap: 5px; align-items: flex-end; margin-top: 10px; }
.distribution .b { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.distribution .bar { width: 100%; background: var(--owl); border-radius: 5px 5px 0 0; min-height: 4px; }
.distribution .b.zero .bar { background: var(--line); }
.distribution .n { font-size: .72rem; font-weight: 700; }
.distribution .s { font-size: .68rem; color: var(--ink-soft); }
.distribution svg { width: 22px; height: 22px; }

.names { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 0; padding: 0; list-style: none; }
.names li { background: var(--owl-soft); border: 1px solid var(--owl); color: var(--ink); border-radius: 99px; padding: 3px 11px; font-size: .86rem; font-weight: 600; }

footer.foot { border-top: 1px solid var(--line); margin-top: 36px; padding-top: 18px; }

.quote {
  font-style: italic; color: var(--ink-soft); font-size: .95rem;
  border-left: 3px solid var(--owl); padding: 2px 0 2px 13px; margin: 0 0 16px;
}
.quote::before { content: "\201C"; }
.quote::after { content: "\201D"; }

.load { text-align: center; padding: 40px 0; color: var(--ink-soft); }
.hide { display: none !important; }

@media (max-width: 420px) {
  body { font-size: 16px; }
  .opts label { min-height: 92px; font-size: .74rem; }
  .brand svg { width: 40px; height: 40px; }
  .brand h1 { font-size: 1.08rem; }
}
.revealrow {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.revealrow:last-of-type { border-bottom: 0; }
.revealbtns { display: flex; gap: 8px; flex-wrap: wrap; }
button.small.on {
  background: var(--owl); color: #fff; box-shadow: inset 0 0 0 2px var(--ink);
}
@media (max-width: 480px) {
  .revealrow { flex-direction: column; align-items: flex-start; }
}

/* ---------------------------------------------------------- MLS bracket */
/* Club tiles are two flat colours and an abbreviation. Nothing is drawn from
   anybody's crest, and there are no logos anywhere on this page. */
.mlschip {
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  width: 46px; height: 46px; flex: none;
  border-radius: 11px; background: var(--c); color: var(--i);
  border: 1px solid rgba(27, 36, 54, .18);
  font-weight: 800; font-size: .82rem; letter-spacing: .02em;
}
.mlschip .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--a); }
.mlschip .ab { position: relative; padding-left: 5px; }
.mlschip.sm { width: 28px; height: 28px; border-radius: 7px; font-size: .62rem; }
.mlschip.sm .bar { width: 4px; }

.mlsline { display: flex; align-items: center; gap: 11px; min-width: 0; text-align: left; }
.mlsline .who { min-width: 0; }
.mlsline .nm { display: block; font-weight: 700; line-height: 1.25; }
.mlsline .sub { display: block; font-size: .76rem; color: var(--ink-soft); }
.mlsline .seed {
  display: inline-block; min-width: 1.15em; text-align: center;
  background: var(--line); border-radius: 4px; padding: 0 3px; margin-right: 3px; font-weight: 700;
}

.roundhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* The tree. Each column spreads its games evenly over the same height, which
   is what makes the rounds line up without anybody measuring anything. The
   West flows left to right, the East flows right to left, and the cup sits in
   the middle, the way a bracket is drawn on television. */
.bscroll { overflow-x: auto; overflow-y: hidden; padding: 4px 0 10px; }
.bgrid { display: flex; align-items: stretch; min-width: 1150px; height: 580px; }
.bcol { display: flex; flex-direction: column; flex: 1 1 0; min-width: 158px; }
.bcol.mid { flex: 1.1 1 0; }
.bhead {
  text-align: center; font-size: .72rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-soft); padding-bottom: 8px; line-height: 1.3;
}
.bhead small { display: block; font-weight: 600; letter-spacing: .02em; text-transform: none; opacity: .8; }
.bbody { flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.bpair { flex: 1; display: flex; flex-direction: column; justify-content: space-around; position: relative; }

.bmatch { position: relative; padding: 0 9px; }
.bbox { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card); }
.bwhen {
  font-size: .66rem; color: var(--ink-soft); text-align: center;
  padding-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.bteam {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 5px 7px; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: .8rem; text-align: left; cursor: pointer;
}
.bteam + .bteam { border-top: 1px solid var(--line); }
.bteam .bname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bteam .bseed { font-size: .66rem; color: var(--ink-soft); font-weight: 700; }
.bteam.empty .bname { color: var(--ink-soft); font-weight: 400; font-style: italic; }
button.bteam:hover { background: var(--owl-soft); }
button.bteam:focus-visible { outline: 3px solid var(--owl); outline-offset: -3px; }
.bteam.on { background: var(--owl-soft); font-weight: 800; box-shadow: inset 3px 0 0 var(--owl); }
.bcol.rtl .bteam.on { box-shadow: inset -3px 0 0 var(--owl); }
.bteam.on .bname { font-weight: 800; }
.bteam.through { color: var(--pitch); }
.bteam.on.got { background: var(--pitch-soft); box-shadow: inset 3px 0 0 var(--pitch); }
.bteam.on.lost { background: var(--warn-soft); box-shadow: inset 3px 0 0 var(--warn); }
.bcol.rtl .bteam.on.got { box-shadow: inset -3px 0 0 var(--pitch); }
.bcol.rtl .bteam.on.lost { box-shadow: inset -3px 0 0 var(--warn); }

/* The joining lines: a stub out of each game, and one upright joining a pair. */
.bcol.ltr .bmatch::after,
.bcol.rtl .bmatch::before {
  content: ""; position: absolute; top: 24px; width: 9px;
  border-top: 2px solid var(--line);
}
.bcol.ltr .bmatch::after { right: 0; }
.bcol.rtl .bmatch::before { left: 0; }
.bcol.ltr .bpair::after,
.bcol.rtl .bpair::before {
  content: ""; position: absolute; top: 25%; bottom: 25%;
  border-right: 2px solid var(--line);
}
.bcol.ltr .bpair::after { right: 0; }
.bcol.rtl .bpair::before { left: 0; }
.bpair.single::after, .bpair.single::before { display: none; }
.bcol.mid .bmatch::after, .bcol.mid .bmatch::before { display: none; }
.bcol.mid .bbox { border-color: var(--owl); border-width: 2px; }
.bcol.mid .bwhen { font-weight: 700; }

.wcrow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wcrow .bmatch { padding: 0; }
.bslide { display: none; }

@media (max-width: 1210px) {
  .bslide { display: block; }
}
@media (max-width: 560px) {
  .wcrow { grid-template-columns: 1fr; }
}

/* ------------------------------------------------- the one time nudge */
.nudge {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(27, 36, 54, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.nudgecard {
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; max-width: 420px; width: 100%;
}
.nudgecard h3 { margin: 0 0 10px; }
.nudgecard p { margin: 0 0 10px; }
.nudgebtns { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.nudgebtns .go {
  display: inline-block; width: auto; margin: 0; padding: 13px 24px;
  border-radius: 999px; text-decoration: none; text-align: center; font-size: 1rem;
}
.nudgebtns button.small {
  padding: 13px 22px; font-size: 1rem;
  background: transparent; color: var(--ink-soft);
  box-shadow: inset 0 0 0 2px var(--line);
}
.nudgebtns button.small:hover { filter: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink-soft); }
