@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  src: url("fonts/AtkinsonHyperlegibleMono-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: "Atkinson Hyperlegible Mono", ui-monospace, monospace;
  background: #050817;
  color: #91a7c9;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(48, 68, 102, 0.28), transparent 42%),
    linear-gradient(180deg, #080d20 0%, #03050e 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(145, 167, 201, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(145, 167, 201, 0.12) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

.shell {
  width: min(100%, 1040px);
}

.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 0 2px 14px;
}

.signal {
  width: 7px;
  height: 34px;
  background: #ffe66d;
  box-shadow: 0 0 22px rgba(255, 230, 109, 0.55);
}

.eyebrow {
  margin: 0 0 4px;
  color: #5ec4c7;
  font-size: 11px;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  color: #eff7ff;
  font-size: clamp(23px, 3vw, 34px);
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1;
}

h1 span {
  color: #ffe66d;
}

.fullscreen {
  border: 1px solid #304466;
  padding: 9px 12px;
  background: #0d142b;
  color: #b7ffdc;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.fullscreen:hover,
.fullscreen:focus-visible {
  border-color: #5ec4c7;
  outline: none;
  background: #13213a;
}

.game-frame {
  position: relative;
  display: grid;
  width: 100%;
  overflow: hidden;
  border: 1px solid #263a60;
  background: #050817;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.56), 0 0 0 5px rgba(7, 12, 30, 0.72);
  aspect-ratio: 16 / 9;
}

#canvas,
#loadingCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#canvas {
  visibility: hidden;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 2px 0;
  color: #536d94;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.footer-light {
  color: #7184a6;
}

.leaderboard {
  margin-top: 24px;
  border: 1px solid #263a60;
  padding: 18px;
  background: rgba(5, 8, 23, 0.76);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}

.leaderboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #1c2a48;
  padding-bottom: 13px;
}

.leaderboard h2 {
  margin: 0;
  color: #eff7ff;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

#leaderboard-status {
  color: #5ec4c7;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-align: right;
}

#leaderboard-list {
  display: grid;
  margin: 0;
  padding: 8px 0;
  list-style: none;
}

#leaderboard-list li {
  display: grid;
  grid-template-columns: 34px minmax(90px, 1fr) 90px 48px;
  gap: 12px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid rgba(38, 58, 96, 0.45);
  color: #7184a6;
  font-size: 13px;
}

#leaderboard-list li span:nth-last-child(-n + 2) {
  text-align: right;
}

#leaderboard-list strong {
  overflow: hidden;
  color: #b7ffdc;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#leaderboard-list .leaderboard-empty {
  display: block;
  padding: 10px 0;
  color: #536d94;
  text-align: center;
  letter-spacing: 0.1em;
}

.score-form {
  display: grid;
  grid-template-columns: auto minmax(120px, 220px) auto 1fr;
  gap: 10px;
  align-items: center;
  padding-top: 13px;
}

.score-form label,
.score-form p {
  color: #7184a6;
  font-size: 10px;
  letter-spacing: 0.1em;
}

.score-form p {
  margin: 0 0 0 6px;
}

.score-form input,
.score-form button {
  height: 40px;
  border: 1px solid #304466;
  border-radius: 0;
  background: #0d142b;
  color: #eff7ff;
  font: inherit;
  font-size: 12px;
}

.score-form input {
  min-width: 0;
  padding: 0 10px;
  outline: none;
  text-transform: uppercase;
}

.score-form input:focus {
  border-color: #5ec4c7;
}

.score-form button {
  padding: 0 14px;
  color: #b7ffdc;
  cursor: pointer;
}

.score-form button:not(:disabled):hover,
.score-form button:not(:disabled):focus-visible {
  border-color: #5ec4c7;
  background: #13213a;
  outline: none;
}

.score-form input:disabled,
.score-form button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

@media (max-width: 640px) {
  body {
    padding: 10px;
  }

  .masthead {
    padding-bottom: 9px;
  }

  .eyebrow,
  footer span:first-child,
  footer span:last-child {
    display: none;
  }

  footer {
    justify-content: center;
  }

  .fullscreen {
    padding: 7px 8px;
  }

  .leaderboard {
    margin-top: 16px;
    padding: 13px;
  }

  .leaderboard-heading {
    align-items: start;
    flex-direction: column;
    gap: 6px;
  }

  #leaderboard-status {
    text-align: left;
  }

  #leaderboard-list li {
    grid-template-columns: 28px minmax(80px, 1fr) 80px 38px;
    gap: 7px;
    font-size: 11px;
  }

  .score-form {
    grid-template-columns: 1fr auto;
  }

  .score-form label,
  .score-form p {
    grid-column: 1 / -1;
    margin-left: 0;
  }
}
