@import url("https://fonts.googleapis.com/css?family=Press+Start+2P");
body {
  margin: 0;
  display: flex;
  font-family: "Press Start 2P", cursive;
}

#controls {
  position: fixed;
  bottom: 24px;
  left: 0;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 200;
  pointer-events: none;
}

.controls-grid {
  display: grid;
  grid-template-areas:
    ". up ."
    "left down right";
  grid-template-columns: 60px 60px 60px;
  grid-template-rows: 60px 60px;
  gap: 10px;
  pointer-events: auto;
}

#forward { grid-area: up; }
#left { grid-area: left; }
#backward { grid-area: down; }
#right { grid-area: right; }

#controls button {
  width: 60px;
  height: 60px;
  font-size: 2em;
  background: #23272f;
  color: #39ff14;
  border: 2px solid #39ff14;
  border-radius: 12px;
  box-shadow: 0 2px 8px #000a;
  cursor: pointer;
  outline: none;
  pointer-events: auto;
  transition: background 0.2s, color 0.2s;
}

#controls button:active {
  background: #39ff14;
  color: #23272f;
}

#score {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 2em;
  color: white;
}

#result-container {
  position: absolute;
  min-width: 100%;
  min-height: 100%;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  background: rgba(24, 28, 36, 0.95);
  z-index: 1000;
}

#result {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #23272f;
  color: #f1f1f1;
  padding: 32px 40px;
  border-radius: 16px;
  box-shadow: 0 8px 32px #000a;
  text-align: center;
}

#result h1 {
  margin-top: 0;
  font-size: 2.2em;
  letter-spacing: 2px;
}

#result button {
  margin-top: 24px;
  padding: 14px 40px;
  font-size: 1.2em;
  background: #39ff14;
  color: #23272f;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  transition: background 0.2s;
}

#result button:hover {
  background: #00ffe7;
}

#youtube,
#youtube-card {
  display: none;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: black;
}

@media (min-height: 425px) {
  #youtube {
    z-index: 50;
    width: 100px;
    display: block;
    height: 70px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: red;
    border-radius: 50% / 11%;
    transform: scale(0.8);
    transition: transform 0.5s;
  }

  #youtube:hover,
  #youtube:focus {
    transform: scale(0.9);
    color: black;
  }

  #youtube::before {
    content: "";
    display: block;
    position: absolute;
    top: 7.5%;
    left: -6%;
    width: 112%;
    height: 85%;
    background: red;
    border-radius: 9% / 50%;
  }

  #youtube::after {
    content: "";
    display: block;
    position: absolute;
    top: 20px;
    left: 40px;
    width: 45px;
    height: 30px;
    border: 15px solid transparent;
    box-sizing: border-box;
    border-left: 30px solid white;
  }

  #youtube span {
    font-size: 0;
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
  }

  #youtube:hover + #youtube-card {
    z-index: 49;
    display: block;
    position: fixed;
    bottom: 12px;
    right: 10px;
    padding: 25px 130px 25px 25px;
    width: 300px;
    background-color: white;
  }
}

#start-container {
  position: absolute;
  min-width: 100%;
  min-height: 100%;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 28, 36, 0.95);
  z-index: 1000;
}

#start-popup {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #23272f;
  color: #f1f1f1;
  padding: 32px 40px;
  border-radius: 16px;
  box-shadow: 0 8px 32px #000a;
  text-align: center;
}

#start-popup h1 {
  margin-top: 0;
  font-size: 2.2em;
  letter-spacing: 2px;
}

#start-popup button {
  margin-top: 24px;
  padding: 14px 40px;
  font-size: 1.2em;
  background: #39ff14;
  color: #23272f;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  transition: background 0.2s;
}

#start-popup button:hover {
  background: #00ffe7;
}

#swipe-hint {
  display: none;
  position: fixed;
  bottom: 40px;
  left: 0;
  width: 100vw;
  text-align: center;
  color: #39ff14;
  font-size: 1.2em;
  font-family: "Press Start 2P", cursive;
  text-shadow: 0 2px 8px #000a;
  z-index: 300;
  pointer-events: none;
  letter-spacing: 1px;
}

@media (max-width: 600px) {
  #start-popup,
  #result {
    width: auto;
    max-width: calc(100vw - 40px);
    padding: 24px 10px 28px 10px;
    margin: 2vh auto;
    border-radius: 16px;
    font-size: 1.05em;
    box-sizing: border-box;
  }
  #start-popup h1,
  #result h1 {
    font-size: 1.5em;
    word-break: break-word;
  }
  #start-popup button,
  #result button {
    padding: 14px 32px;
    font-size: 1.1em;
  }
  #controls {
    display: none !important;
  }
  #swipe-hint {
    display: block !important;
  }
}