* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #101208;
  color: #d9d3bc;
  font-family: "Courier New", ui-monospace, monospace;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  user-select: none;
}

main {
  width: min(1080px, 100%);
  padding: 16px 16px 28px;
  display: grid;
  grid-template-columns: auto minmax(260px, 420px);
  column-gap: 28px;
  row-gap: 14px;
  align-items: start;
  justify-content: center;
}

.tv {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #1c1c1c;
  padding: 14px 14px 8px;
  border-radius: 18px 18px 28px 28px;
  box-shadow:
    inset 0 0 0 3px #3a3a3a,
    0 18px 40px rgba(0, 0, 0, 0.45);
}

.mark {
  margin: 8px 0 0;
  line-height: 0;
}

.mark img {
  width: 97px;
  height: 45px;
  opacity: 0.72;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.help { grid-column: 2; grid-row: 1; }
.pad { grid-column: 2; grid-row: 2; }

canvas {
  display: block;
  width: min(46vw, calc((100dvh - 80px) * 160 / 192), 520px);
  height: auto;
  background: #000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

.help {
  text-align: center;
  line-height: 1.45;
  font-size: 13px;
}

.help p { margin: 0 0 8px; }

.scores { color: #9aa484; }

kbd {
  display: inline-block;
  min-width: 1.2em;
  padding: 0 5px;
  border: 1px solid #4a6240;
  background: #1c2116;
  color: #f0e7bf;
  font-family: inherit;
}

.pad {
  display: none;
  width: 100%;
  max-width: 420px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pad button {
  font-family: inherit;
  font-size: 18px;
  color: #f0e7bf;
  background: #1e2618;
  border: 2px solid #4ea03a;
  min-height: 52px;
  border-radius: 6px;
  touch-action: none;
}

.pad button:active { background: #2c4a22; }

@media (max-width: 900px) {
  main {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  .help,
  .pad { max-width: 100%; }

  .tv { grid-column: 1; grid-row: 1; }
  .help { grid-column: 1; grid-row: 2; }
  .pad { grid-column: 1; grid-row: 3; }

  canvas {
    width: min(92vw, calc((100dvh - 230px) * 160 / 192), 480px);
  }
}

@media (pointer: coarse), (max-width: 820px) {
  .pad { display: grid; }
  .help { font-size: 12px; }
}
