body {
  margin: 0;
  padding: 0;
  background: black;
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  touch-action: none; /* Prevent default touch behaviors */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.game-container {
  width: 100vw;
  height: 100vh;
  max-width: 500px;
  max-height: 700px;
  border: 3px solid #fff;
  background: url('/static/background_1.jpg') no-repeat center center;
  background-size: cover;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
canvas { 
  display: block; 
  background: transparent; 
  width: 100%;
  height: 100%;
  touch-action: none;
}

#startButton,
#restartButton {
  position: absolute;
  padding: 12px 24px;
  font-size: 16px;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  font-weight: bold;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}
#startButton {
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background-color: #4CAF50;
  min-width: 120px;
}
#startButton:hover, #startButton:active { 
  background-color: #45a049; 
  transform: translate(-50%, -50%) scale(0.95);
}
#restartButton {
  top: calc(50% + 50px);
  left: 50%;
  transform: translateX(-50%);
  background-color: #ff6347;
  display: none;
  min-width: 120px;
}
#restartButton:hover, #restartButton:active { 
  background-color: #ff4500; 
  transform: translateX(-50%) scale(0.95);
}

#saveResultForm {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
  background: white;
  border: 2px solid #333;
  border-radius: 12px;
  width: 90%;
  max-width: 300px;
  box-sizing: border-box;
  text-align: center;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
#saveResultForm h3 {
  margin: 0 0 15px;
  font-size: 16px;
  color: #333;
}
#saveResultForm input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 16px;
  text-align: center;
}
#saveResultForm input:focus {
  outline: none;
  border-color: #4CAF50;
}
#saveResultForm .buttons {
  display: flex;
  gap: 10px;
}
#saveResultForm button {
  flex: 1;
  padding: 12px;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s ease;
}
#saveResultForm .save-btn {
  background-color: #4CAF50;
  color: white;
}
#saveResultForm .skip-btn {
  background-color: #ccc;
  color: black;
}
#saveResultForm .save-btn:hover, #saveResultForm .save-btn:active {
  background-color: #45a049;
  transform: scale(0.95);
}
#saveResultForm .skip-btn:hover, #saveResultForm .skip-btn:active {
  background-color: #bbb;
  transform: scale(0.95);
}

#sideImage {
  display: none; /* Hide on mobile */
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .game-container {
    border-width: 2px;
  }
  
  #startButton, #restartButton {
    padding: 15px 30px;
    font-size: 18px;
    min-width: 140px;
  }
  
  #saveResultForm {
    padding: 25px;
  }
  
  #saveResultForm h3 {
    font-size: 18px;
  }
  
  #saveResultForm input {
    padding: 15px;
    font-size: 18px;
  }
  
  #saveResultForm button {
    padding: 15px;
    font-size: 16px;
  }
}

/* Telegram Mini App specific optimizations */
@media (max-height: 600px) {
  .game-container {
    max-height: 100vh;
  }
}