:root {
  color-scheme: light dark;
  --bg: #fbfaf8;
  --fg: #1d1c1a;
  --muted: #6b6860;
  --line: #e2dfd8;
  --accent: #1f5fbf;
  --isc: #1f5fbf;
  --osc: #a8501a;
  --warn-bg: #fdf1d8;
  --gold: #c79a00;
  --silver: #8a939e;
  --bronze: #b46a2c;
  --gold-bg: #fff4c2;
  --silver-bg: #eceef1;
  --bronze-bg: #f7e3d3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a;
    --fg: #e9e7e2;
    --muted: #9a978f;
    --line: #2f2f35;
    --accent: #8ab4f8;
    --isc: #8ab4f8;
    --osc: #f0a56b;
    --warn-bg: #3a2f16;
    --gold: #f2c230;
    --silver: #c3cad3;
    --bronze: #d98e52;
    --gold-bg: #3b3210;
    --silver-bg: #2c3037;
    --bronze-bg: #3a2618;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0 auto;
  padding: 1rem;
  max-width: 62rem;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.9rem; }
nav a[aria-current] { color: var(--fg); font-weight: 600; text-decoration: none; }
h1 { margin: 0.75rem 0 0.25rem; font-size: 1.4rem; }
.note { margin: 0.25rem 0 1rem; color: var(--muted); font-size: 0.9rem; }

.search { margin: 0.75rem 0; }
.search input[type="search"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.1rem;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.options { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; margin-top: 0.6rem; }
.options label { cursor: pointer; }
select, .combo input {
  max-width: 100%;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: inherit;
  font: inherit;
}
.filter { margin: 0 0 1rem; }

.combo { position: relative; display: inline-block; margin-left: 0.3rem; }
.combo input { width: 16rem; padding-right: 1.8rem; }
.combo button {
  position: absolute;
  top: 50%;
  right: 0.2rem;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.combo ul {
  position: absolute;
  z-index: 2;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 17rem;
  margin: 0.25rem 0 0;
  padding: 0.2rem 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.18);
  list-style: none;
}
.combo li { padding: 0.25rem 0.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.combo li.active, .combo li[role="option"]:hover { background: var(--line); }
.combo li.none { color: var(--muted); cursor: default; }

#status { margin: 0.5rem 0; font-weight: 600; }
#status.hit { padding: 0.4rem 0.6rem; border-radius: 6px; background: var(--warn-bg); }
#hint { color: var(--muted); font-size: 0.9rem; }
#hint code { padding: 0.05rem 0.3rem; border: 1px solid var(--line); border-radius: 4px; font-size: 0.85rem; }
h2 { margin: 1.5rem 0 0.25rem; font-size: 1rem; }
h2 small { color: var(--muted); font-weight: normal; }

table.entries { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.entries th, .entries td { padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.entries th { color: var(--muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.entries thead th { position: sticky; top: 0; background: var(--bg); }
.entries img, .combo img, h1 img { width: 23px; height: 15px; margin-right: 0.45em; object-fit: contain; vertical-align: -2px; }
h1 img { width: 35px; height: 23px; vertical-align: -3px; }
.entries a { color: inherit; text-decoration: none; }
.entries a:hover { color: var(--accent); text-decoration: underline; }
.list:not(.with-contest) td:nth-child(-n + 2), .list.with-contest td:nth-child(2), .list.with-contest td:nth-child(3) { cursor: pointer; }
.list:not(.with-contest) td:nth-child(-n + 2):hover, .list.with-contest td:nth-child(2):hover, .list.with-contest td:nth-child(3):hover { color: var(--accent); text-decoration: underline; }

/* Top three of a final: a tinted row and a star before the result. */
.entries tr.gold { background: var(--gold-bg); }
.entries tr.silver { background: var(--silver-bg); }
.entries tr.bronze { background: var(--bronze-bg); }
tr.gold .result::before, tr.silver .result::before, tr.bronze .result::before,
.list tr.gold td:last-child::before, .list tr.silver td:last-child::before, .list tr.bronze td:last-child::before { content: "★ "; }
tr.gold .result::before, .list tr.gold td:last-child::before { color: var(--gold); }
tr.silver .result::before, .list tr.silver td:last-child::before { color: var(--silver); }
tr.bronze .result::before, .list tr.bronze td:last-child::before { color: var(--bronze); }
.steps { display: flex; gap: 1.5rem; }
.contest { font-weight: 700; font-size: 0.8rem; }
.contest.isc { color: var(--isc); }
.contest.osc { color: var(--osc); }
.dim { color: var(--muted); }

@media (min-width: 40rem) {
  .entries td:has(> img), .list td:last-child, .entries .result { white-space: nowrap; }
}
@media (max-width: 40rem) {
  .entries th, .entries td { padding: 0.3rem 0.3rem; }
  #results .country { display: none; }
  .combo input { width: 12rem; }
}
