:root {
  /* the mark is pixel art - nothing on this page is rounded */
  --mono: Menlo, Consolas, Monaco, 'Liberation Mono', 'Lucida Console', monospace;

  --paper: #FCFCFA;
  --ink: #17171B;
  --red: #C31818;
  --rule: #E4E4DE;
  --muted: #6E6E74;
  --sink: #F4F4F0;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ---- header ---- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 840px;
  margin: 0 auto;
  padding: 22px 24px;
  border-bottom: 1px solid var(--rule);
}

.die {
  /* the mark is pixel art - never let it smooth */
  image-rendering: pixelated;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: inherit;
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.who {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}

.team {
  font-family: var(--mono);
  font-weight: 500;
}

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link:hover { color: var(--red); }

/* ---- layout ---- */

main {
  max-width: 840px;
  margin: 0 auto;
  padding: 40px 24px 72px;
}

h1 {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 25px;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede { margin: 0 0 22px; color: var(--muted); }

/* ---- sign in ---- */

.gate { max-width: 420px; }

.gate .go { margin-top: 6px; }

.go {
  border-radius: 3px;
  padding: 11px 20px;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.go:hover { background: var(--red); }
.go:disabled { background: var(--muted); cursor: progress; }

/* ---- submit desk ---- */

.deskhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.deskhead label,
.filehint {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.filehint { text-transform: none; letter-spacing: 0; }

#code {
  border-radius: 3px;
  display: block;
  width: 100%;
  min-height: 210px;
  padding: 14px 15px;
  background: #fff;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  resize: vertical;
}

#code:focus { border-color: var(--ink); outline-offset: 1px; }
#code::placeholder { color: #B4B4B0; }

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.file span {
  border-radius: 3px;
  display: inline-block;
  padding: 10px 15px;
  border: 1px solid var(--rule);
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

.file span:hover { border-color: var(--ink); }

.cycles {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-size: 14px;
  color: var(--muted);
}

#cycles {
  border-radius: 3px;
  width: 68px;
  padding: 10px 10px;
  background: #fff;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 14px;
}

.note.working { color: var(--muted); }

.note {
  margin: 14px 0 0;
  min-height: 1em;
  font-size: 14px;
  color: var(--red);
}

/* ---- result: the one loud moment ---- */

.result {
  border-radius: 3px;
  margin-top: 34px;
  padding: 22px 24px 20px;
  background: var(--sink);
}

.readout {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.rlabel {
  margin-right: auto;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.rscore {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 46px;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.rof { color: var(--muted); font-size: 15px; }

.wave {
  display: block;
  width: 100%;
  height: 44px;
  margin: 18px 0 0;
}

.wave rect { fill: var(--ink); }

.rbest {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.rbest strong {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
}

.download { display: inline-block; margin-top: 12px; }

/* ---- scoreboard ---- */

.boardwrap { margin-top: 56px; }

.board {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.board th,
.board td {
  padding: 11px 6px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}

.board thead th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.board td:first-child {
  width: 34px;
  font-family: var(--mono);
  color: var(--muted);
}

.board .num { text-align: right; }

.board td.num {
  font-family: var(--mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.board tr.mine td { background: #FFF3F3; }
.board tr.mine td:nth-child(2)::after {
  content: "you";
  margin-left: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--red);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.empty { color: var(--muted); font-size: 14px; }

/* ---- admin ---- */

.event-status { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.admin { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--rule); }
.admin h3 { margin: 32px 0 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.admin-config { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.admin-config label { color: var(--muted); font-size: 12px; }
.admin-config input { display: block; width: 100%; margin-top: 5px; padding: 9px; border: 1px solid var(--rule); background: #fff; }
.admin-data details { border-bottom: 1px solid var(--rule); padding: 9px 0; }
.admin-data summary { cursor: pointer; }
.admin-data ol, .admin-data p { margin: 10px 0; color: var(--muted); }
.admin-data pre { overflow: auto; padding: 12px; background: var(--sink); font-size: 12px; }

/* ---- motion ---- */

@keyframes rise {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.wave rect {
  transform-origin: center;
  animation: rise 340ms cubic-bezier(.2,.8,.3,1) backwards;
}

@media (prefers-reduced-motion: reduce) {
  .wave rect { animation: none; }
}

@media (max-width: 560px) {
  .controls { flex-wrap: wrap; }
  .cycles { margin-right: 0; }
  .go { flex: 1; }
  .rscore { font-size: 38px; }
  .admin-config { grid-template-columns: 1fr; }
}
