@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/roboto-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/roboto-mono-latin-700-normal.woff2") format("woff2");
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html,
body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: "Roboto Mono", monospace;
  background: #1a1033;
  color: #ede9fe;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  max-width: 40rem;
  padding: 0.5rem;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.buttons {
  display: flex;
  gap: 0.4rem;
}

.bar a,
.bar button {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  font: inherit;
  font-size: 1.05rem;
  color: inherit;
  text-decoration: none;
  background: #2e1f57;
  border: 1px solid #4c3a85;
  border-radius: 0.5rem;
  cursor: pointer;
}

.stage {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

canvas {
  display: block;
  border-radius: 0.5rem;
  touch-action: none;
}

.overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92%, 26rem);
  max-height: 96%;
  overflow-y: auto;
  padding: 1.25rem;
  text-align: center;
  background: rgb(26 16 51 / 94%);
  border: 1px solid #6d5bd0;
  border-radius: 0.75rem;
  box-shadow: 0 0 40px rgb(167 139 250 / 30%);
}

.overlay[hidden] {
  display: none;
}

.overlay h1 {
  font-size: 1.8rem;
  color: #c4b5fd;
}

#overlay-body {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

#overlay-body p + p,
#overlay-body p + ul {
  margin-top: 0.6rem;
}

.help {
  padding: 0;
  list-style: none;
  text-align: left;
}

.stars {
  font-size: 2.4rem;
  letter-spacing: 0.2em;
}

.big {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fde68a;
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

.start {
  padding: 0.7rem 2.5rem;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1033;
  background: #fde68a;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
}

.secondary {
  padding: 0.4rem 1rem;
  font: inherit;
  font-size: 0.85rem;
  color: #c4b5fd;
  background: none;
  border: 1px solid #4c3a85;
  border-radius: 0.5rem;
  cursor: pointer;
}

.secondary[hidden] {
  display: none;
}

.pad {
  display: grid;
  grid-template-areas:
    ". up ."
    "left down right";
  gap: 0.4rem;
  padding: 0.5rem 0 0.75rem;
}

.pad button {
  width: 3.6rem;
  height: 3.2rem;
  font-size: 1.3rem;
  color: #ede9fe;
  background: #2e1f57;
  border: 1px solid #4c3a85;
  border-radius: 0.75rem;
  touch-action: none;
  cursor: pointer;
}

.pad button:active,
.pad button.held {
  background: #4c3a85;
}

.pad [data-dir="up"] {
  grid-area: up;
}

.pad [data-dir="left"] {
  grid-area: left;
}

.pad [data-dir="down"] {
  grid-area: down;
}

.pad [data-dir="right"] {
  grid-area: right;
}

@media (hover: hover) and (pointer: fine) {
  .pad {
    display: none;
  }
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid #fde68a;
  outline-offset: 2px;
}
