@import url("https://fonts.googleapis.com/css?family=Press+Start+2P");

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

body {
  font-family: "Press Start 2P", cursive;
  font-size: 2em;
  color: white;
  /* Предотвращение выделения текста на сенсорных устройствах */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  /* Предотвращение перетаскивания изображений */
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#restartButton {
  position: absolute;
  top: 20px;
  left: 20px;
  display: none;
  background-color: #ff9800;
  color: #000;
  padding: 10px 20px 10px 20px;
  font-family: inherit;
  font-size: 0.6em;
  z-index: 1200;
}

button {
  outline: none;
  cursor: pointer;
  border: none;
  box-shadow: 3px 5px 0px 0px rgba(0, 0, 0, 0.75);
}

.score {
  position: absolute;
  top: 20px;
  right: 20px;
  visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px;
  background: #00000080;
  font-size: 0.6em;
  box-shadow: 3px 5px 0px 0px rgba(0, 0, 0, 0.75);
  z-index: 1000;
}

#start {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  visibility: hidden; /* Скрыто по умолчанию, будет показано после вызова GameReady API */
}

#start>div {
  text-align: center;
}

#start h1 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 2em;
}

#start .character-select {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

#start .character-option {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  background-color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 2px solid transparent;
}

#start .character-option.selected {
  border-color: #00c853;
}

#start .character-option img {
  width: 100%;
  height: 100%;
}

#start button {
  background-color: #00c853;
  padding: 20px 50px 20px 50px;
  font-family: inherit;
  font-size: inherit;
}

#end {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
}

#end button {
  background-color: red;
  padding: 20px 50px 20px 50px;
  font-family: inherit;
  font-size: inherit;
}

#controlls {
  position: fixed;
    /* top: 0; */
    left: 50%;
    transform: translateX(-50%);
    bottom: 20px;
    width: fit-content;
    height: fit-content;
    display: none;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    z-index: 1100;
}

#controlls div {
  display: grid;
  grid-template-columns: 50px 50px 50px;
  grid-template-rows: auto auto;
  grid-column-gap: 10px;
  grid-row-gap: 10px;
}

#controlls button {
  width: 100%;
  background-color: white;
  border: 1px solid lightgray;
  pointer-events: auto;
}

#controlls button:first-of-type {
  grid-column: 1/-1;
}

.sound-button {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 50px;
  height: 50px;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  cursor: pointer;
  border: 2px solid white;
  transition: background-color 0.3s;
}

.sound-button:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.sound-button svg {
  width: 24px;
  height: 24px;
}

/* Предотвращение выделения текста на canvas */
canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* Оптимизация для сенсорных устройств */
}

/* Скрытие системного плеера для audio элементов */
audio {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
}

@media (max-width: 768px) {
  body {
    font-size: 1.5em;
  }
}
@media (max-height: 520px) {
  body {
    font-size: 1em;
  }
  #end{
    padding-top: 5vh;
  }
  #end button, #start button  {
    padding: 15px 45px 15px 45px;
  }
  #start .character-option {
    width: 60px;
    height: 60px;
  }
}
@media (max-width: 420px) {
  body {
    font-size: 1em;
  }
}