:root {
  --game-scale-x: 1;
  --game-scale-y: 1;
  --game-scale: min(var(--game-scale-x), var(--game-scale-y));
  color: #272527;
  background: #f9f1f8;
  font-family: "Fira Code", monospace;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

::selection {
  color: #f9f1f8;
  background: #c4a5d3;
}

main {
  display: flex;
  height: 100vh;
  height: 100svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: clamp(0.75rem, 3vh, 2rem) 1rem;
  text-align: center;
}

h1 {
  margin: 0 0 0.5rem;
  color: #5a2c70;
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  font-style: italic;
  font-weight: 500;
}

.description {
  margin: 0 0 clamp(0.5rem, 2vh, 1.5rem);
  color: #a66c96;
  font-size: 0.875rem;
}

.game-frame {
  width: calc(500px * var(--game-scale) + 4px);
  height: calc(600px * var(--game-scale) + 4px);
  flex: 0 0 auto;
  overflow: hidden;
  border: 2px solid #dfb2d1;
  border-radius: 0.75rem;
  background: #fffaff;
  box-shadow: 0 12px 32px rgb(90 44 112 / 12%);
}

#game {
  position: relative;
  width: 500px;
  height: 600px;
  transform: scale(var(--game-scale));
  transform-origin: top left;
}

#status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: #5a2c70;
  background: #fffaff;
}

#status[hidden] {
  display: none;
}

footer {
  margin-top: clamp(0.5rem, 2vh, 1.5rem);
  color: #a66c96;
  font-size: 0.75rem;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: #c4a5d3;
  text-decoration: underline;
}

@media (max-width: 540px) {
  :root {
    --game-scale-x: 0.9;
  }
}

@media (max-width: 470px) {
  :root {
    --game-scale-x: 0.78;
  }
}

@media (max-width: 400px) {
  :root {
    --game-scale-x: 0.66;
  }
}

@media (max-width: 360px) {
  :root {
    --game-scale-x: 0.58;
  }
}

@media (max-width: 330px) {
  :root {
    --game-scale-x: 0.52;
  }
}

@media (max-height: 820px) {
  :root {
    --game-scale-y: 0.86;
  }
}

@media (max-height: 700px) {
  :root {
    --game-scale-y: 0.7;
  }

  h1 {
    margin-bottom: 0.25rem;
  }

  .description,
  footer {
    font-size: 0.6875rem;
  }
}

@media (max-height: 580px) {
  :root {
    --game-scale-y: 0.54;
  }
}

@media (max-height: 460px) {
  :root {
    --game-scale-y: 0.42;
  }
}

