:root {
  color-scheme: dark;
  --background: #000;
  --text: #fff;
  --green: #30ff30;
  --red: #ff3030;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font:
    16px/1.5 ui-monospace,
    'SF Mono',
    Menlo,
    Consolas,
    monospace;
}

main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 2rem 1rem;
  text-align: center;
}

h1 {
  margin: 1rem 0;
  line-height: 0;
}

/* The title is drawn pixel by pixel in the games' own font: see title.svg. */
.pixel-title {
  width: min(100%, 32rem);
  height: auto;
}

/* A dotted rule, like a row of lit pixels under the title. */
.dots {
  max-width: 32rem;
  margin: 0 auto 1.5rem;
  border: 0;
  border-top: 0.25rem dotted var(--text);
}

a {
  color: var(--green);
}

/*
 * One card per game, with its controls inside: the grid adds columns as the screen widens and
 * becomes a single column on a phone, however many games there are.
 */
.games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 19rem));
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0;
  padding: 0;
  list-style: none;
}

.game {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 2px solid var(--green);
}

.game > a {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  text-decoration: none;
}

.game > a:hover img,
.game > a:focus-visible img {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.game img {
  width: 224px;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

/* A vector screen has no pixels to keep square: smooth scaling keeps its thin lines visible. */
.game img.vector {
  width: 100%;
  image-rendering: auto;
}

/* Controls as a two-column list: keys on the left, what they do on the right. */
.controls {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  align-content: start;
  margin: 0;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--green);
  text-align: left;
  font-size: 0.875rem;
}

.controls dt {
  justify-self: end;
  white-space: nowrap;
}

.controls dd {
  margin: 0;
}

.touch {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.7;
}

.title {
  font-weight: bold;
}

.meta {
  color: var(--text);
  opacity: 0.7;
}

kbd {
  padding: 0 0.3em;
  border: 1px solid var(--text);
}
