/* Базовые настройки страницы */
body { 
  background: #6f6f6f; 
  margin: 0; 
  padding: 10px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: sans-serif; 
  touch-action: none; 
  min-height: 100vh;
}

/* Верхняя панель */
.top-bar {
  display: flex; 
  justify-content: space-between; 
  width: 100%; 
  max-width: 600px; 
  margin-bottom: 10px;
}

.back-btn { 
  background: rgba(0,0,0,0.5); 
  color: white; 
  text-decoration: none; 
  padding: 8px 15px; 
  border-radius: 8px; 
  font-weight: bold; 
  font-size: 14px; 
  border: 1px solid #fff; 
  cursor: pointer;
  z-index: 1001;
}

#btnQuit {
  background: #F44336; 
  color: white; 
  border: 1px solid #fff; 
  border-radius: 8px; 
  padding: 8px 15px; 
  font-weight: bold; 
  cursor: pointer;
}

/* Информационные сообщения */
#ui { 
  width: 100%;
  max-width: 600px;
  text-align: center; 
  font-weight: bold; 
  font-size: 20px; 
  color: #fff; 
  text-shadow: 2px 2px 0 #000; 
  margin-bottom: 10px;
}

#toastMsg {
  position: absolute; 
  top: 100px; 
  left: 50%; 
  transform: translateX(-50%);
  background: rgba(244, 67, 54, 0.9); 
  color: white; 
  padding: 15px 30px;
  font-size: 24px; 
  font-weight: bold; 
  border-radius: 8px;
  opacity: 0; 
  pointer-events: none; 
  transition: opacity 0.5s ease; 
  z-index: 10;
}

/* Игровой холст и нижняя панель */
#gameWrapper {
  width: 100%;
  max-width: 600px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#gameCanvas { 
  width: 100%; 
  height: auto; 

  display: block;
  background: #87CEEB; 
  border-radius: 8px 8px 0 0; 
}

#bottomHud {
  width: 100%;
  box-sizing: border-box;
  background: rgba(172, 143, 132, 1);
  color: white;
  padding: 10px;
  display: flex;
  flex-wrap: wrap; 
  justify-content: space-around;
  align-items: center;
  font-size: 14px;
  font-weight: bold;
  border-radius: 0 0 8px 8px;
  gap: 8px;
}
#bottomHud span {
  display: flex;
  align-items: center;
  gap: 4px; /* Небольшой отступ между эмодзи и цифрой для красоты */
}
.action_instructions div {
    display: flex;
    align-items: center;
    padding: 10px;
    gap: 4px;
    font-size: 14px;
    
}

.text-green { color: #4CAF50; }
.text-gold { color: #FFD700; }

/* Мобильные элементы управления */
#mobileControls { 
  width: 100%; 
  max-width: 600px; 
  margin-top: 15px; 
  display: flex; 
  justify-content: space-between; 
  align-items: flex-end; /* Прижимаем все кнопки к нижнему краю */
  box-sizing: border-box; 
  padding: 0 10px;
}

/* Боковые блоки (flex: 1 центрирует средний блок идеально ровно) */
.dpad-side { 
  display: flex; 
  gap: 10px; 
  flex: 1; 
}
.right-side { 
  justify-content: flex-end; /* Прижимаем молоток к правому краю экрана */
}

/* Центральный блок перемещения */
.dpad-center { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 5px; /* Расстояние от Прыжка до стрелок */
}
.dpad-arrows { 
  display: flex; 
  gap: 30px; /* Пространство между кнопками Влево и Вправо */
}

/* Уменьшенные кнопки (50px вместо 60px) */
.m-btn { 
  width: 30px; 
  height: 30px; 
  background: rgba(0,0,0,0.4); 
  border: 2px solid #fff; 
  border-radius: 50%; 
  color: #fff; 
  font-size: 20px; 
  text-align: center; 
  line-height: 33px; 
  user-select: none; 
}

.m-btn:active { background: rgba(255,255,255,0.4); }

/* Специфичные цвета для кнопок способностей */
#btnFreeze { 
    background: #000;
    border-color: #0097A7; 
}
#btnBuild { 
    background: #fff;
    border-color: #5C2E0B; 
}
#btnHammer { 
    background: #fff; 
    border-color: #FF5722;
}

/* Скрытие мобильных кнопок на компьютерах */
@media (min-width: 1000px) {
  #mobileControls { display: none; }
}
.move_instructions, 
.action_instructions{
    display: flex;
    justify-content: space-around;
}
.keys-grid{
   width: 100%;
    margin: 0 auto;
    max-width: 590px;

}
#pcInstructions{
    width: 60%;
    margin: 0 auto;
    color: #fff;
}
.title_instructions{
    width: 100%;
    text-align: center;
}
@media(max-width: 1000px){
    #pcInstructions{
        display: none;
    }
}