/* Theme: https://coolors.co/000000-14213d-fca311-e5e5e5-ffffff */

:root {
  --black: #000000;
  --white: #ffffff;
  --primary: #14203d;
  --accent: #fca311;
  --grey: #e5e5e5;
  --red: #e82b3b;

  --grid-width: 0;
  --grid-height: 0;
}

html {
  background-color: var(--primary);
  color: var(--white);
}

html body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: var(--page-height, 100vh);
  justify-content: space-between;
  align-items: center;
}

#snek {
  max-width: 640px;
  width: calc(100vmin - 4rem);
  margin: 1rem;
  padding: 12px;
  border-radius: 1em;
  background-color: rgba(255, 255, 255, 0.2);
}

#snek.gamedoy .grid {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

h1 {
  text-align: center;
  font-weight: 200;
  font-family: monospace;
  font-size: 2.5em;
  margin: 1rem 0 0;
}

#score {
  margin: 0 0 1em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  text-align: center;
  font-style: italic;
}

#score::before,
#score::after {
  content: '~';
}

#snek .grid {
  display: grid;
  grid: repeat(var(--grid-height), 1fr) / repeat(var(--grid-width), 1fr);
  border-radius: 0.25rem;
  gap: var(--grid-gap, 1px);
  overflow: hidden;
  background-color: var(--accent);
}

#snek .grid > span {
  height: 0;
  padding-bottom: 100%;
}

#snek .grid > span.snake {
  background-color: var(--white);
}

#snek .grid > span.goal {
  background-color: var(--red);
}

.touch-controls {
  display: flex;
  visibility: hidden;
  width: 100%;
}

.touch-controls button {
  flex: 1;
  background-color: var(--grey);
  margin: 0.5rem 0.2rem;
  padding: 0;
  height: 3rem;
  width: 4em;
  border: none;
  border-radius: 0.5rem;
  font-size: 1.5em;
}

.touch-controls button:first-child {
  margin-left: 0.4rem;
}
.touch-controls button:last-child {
  margin-right: 0.4rem;
}

.touch-controls button:active {
  background-color: rgba(0, 0, 0, 0.6);
}

@media screen and (max-width: 1024px) {
  .touch-controls {
    visibility: visible;
  }
}

[aria-hidden='true'] {
  display: none;
}
