body {
  background: #222;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  margin: 0;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: 0;
  padding-right: 0;
  position: fixed;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* Prevent iOS Safari bounce scrolling */
html, body {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#gameContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: calc(100vh); /* Make container 40px shorter to avoid iPhone task bar */
  /* You can adjust 40px to fit your needs */
}

/* Only shrink game area for mobile devices to avoid iPhone task bar */
body.mobile-device #gameContainer,
body.mobile-device canvas {
  height: calc(100vh); /* Adjust 40px as needed */
}

/* For desktop, use full height */
body:not(.mobile-device) #gameContainer,
body:not(.mobile-device) canvas {
  height: 100vh;
}

canvas {
  background: #ffffff;
  border: 1px solid #000;
  display: block;
  margin: 0 auto;
}

/* Mobile devices: adjust for Safari address bar */
body.mobile-device canvas {
  margin-top: -60px; /* Pull canvas up to overlap Safari address bar on mobile */
}

.press-start-2p-regular {
  font-family: "Press Start 2P", system-ui;
  font-weight: 400;
  font-style: normal;
}

#restartBtn {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 30px;
  font-size: 24px;
  font-family: 'Arial', sans-serif;
  background-color: #ff4747;
  color: white;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

#restartBtn:hover {
  background-color: #d43838;
  transform: translate(-50%, -50%) scale(1.05);
}

#gameContainer {
  position: relative;
  display: inline-block;
  max-width: 100vw;
  max-height: 100vh;
}

#skipBtn {
  position: absolute;
  left: 50%;
  bottom: 10%;
  transform: translateX(-50%);
  padding: 15px 30px;
  font-size: 24px;
  font-family: 'Arial', sans-serif;
  background-color: #b925ca;
  color: white;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

#skipBtn:hover {
  background-color: #851ac8;
  transform: translateX(-50%) scale(1.05);
}

#playerNameInput {
  padding: 12px 18px;
  font-size: 22px;
  border: 2px solid #b925ca;
  border-radius: 8px;
  outline: none;
  margin: 10px 0;
  background: #fff8ff;
  color: #222;
  box-shadow: 0 2px 8px rgba(185,37,202,0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#playerNameInput:focus {
  border-color: #ff4747;
  box-shadow: 0 0 8px #ff474733;
}

#nameInputContainer {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.95);
  padding: 24px 32px;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  display: none; /* shown by JS when needed */
  z-index: 10;
  text-align: center;
}

#submitNameBtn {
  padding: 12px 28px;
  font-size: 22px;
  font-family: 'Arial', sans-serif;
  background-color: #b925ca;
  color: white;
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);
  cursor: pointer;
  margin-left: 10px;
  margin-top: 10px;
  transition: background 0.2s, transform 0.2s;
}

#submitNameBtn:hover {
  background-color: #ff4747;
  transform: scale(1.05);
}

/* --- MOBILE STYLES (orientation handling) --- */

/* Portrait mode: Hide game and show overlay */
@media screen and (orientation: portrait) {
  #gameContainer {
    display: none; /* Hide game */
  }

  body::before {
    content: "🔄 Prosím otoč zařízení pro lepší zkušenost";
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100vh;
    width: 100vw;
    background: #222;
    color: #fff;
    font-size: 1.5em;
    padding: 20px;
  }
}

/* Landscape mode: Show game normally */
@media screen and (orientation: landscape) {
  #gameContainer {
    display: block;
  }

  body::before {
    content: none;
  }
}

body, #gameContainer {
  height: 100%;
  max-height: 100vh;
}


