* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a2e;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  overflow: hidden;
  touch-action: none;
}

/* The game fills the whole viewport and is responsive — the canvas resizes to the area
   and all gameplay uses dynamic SIRKA/VYSKA, so there is no fixed-size letterboxing. */
#hra {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#platno {
  display: block;
  width: 100%;
  height: 100%;
  background: #0d0d35;
  cursor: pointer;
}

#info {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  display: none;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 24px;
  color: white;
  pointer-events: none;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(68, 102, 255, 0.5);
}

#level-label {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  display: none;
  text-align: center;
  color: #8888cc;
  font-size: 13px;
  font-weight: bold;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(68, 102, 255, 0.3);
}

#boss-info {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
}

#boss-jmeno {
  color: #ff4466;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 0 15px rgba(255, 68, 102, 0.8);
  margin-bottom: 4px;
}

#boss-hp-bar {
  display: none;
  width: 250px;
  height: 10px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  margin: 0 auto;
  overflow: hidden;
}

#boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff4466, #ff8844);
  border-radius: 5px;
  transition: width 0.1s;
}

#game-over, #victory {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12; /* above the touch-controls overlay (z-index 8) so buttons are tappable */
  background: rgba(0, 0, 0, 0.85);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  border-radius: 6px;
  padding: 20px;
}

#game-over h1 {
  font-size: 44px;
  color: #ff4444;
  text-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
  margin-bottom: 10px;
}

#victory h1 {
  font-size: 40px;
  color: #44ff88;
  text-shadow: 0 0 20px rgba(68, 255, 136, 0.5);
  margin-bottom: 10px;
}

#game-over p, #victory p {
  font-size: 24px;
  margin-bottom: 8px;
}

#xp-zisk, #victory-xp {
  font-size: 20px !important;
  color: #ffdd44;
}

#rocket-up, #rocket-up-victory {
  display: none;
  font-size: 22px !important;
  color: #ff8844;
  text-shadow: 0 0 15px rgba(255, 136, 68, 0.8);
  margin-bottom: 15px !important;
  animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

#game-over button, #victory button {
  padding: 10px 30px;
  font-size: 20px;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  margin: 5px;
  min-width: 180px;
}

#menu-btn, #victory-menu-btn {
  background: #4466ff;
}
#menu-btn:hover, #victory-menu-btn:hover {
  background: #5577ff;
}

#retry-btn, #next-level-btn {
  background: #44aa66;
}
#retry-btn:hover, #next-level-btn:hover {
  background: #55cc77;
}

.touch-controls {
  display: none;
}

@media (pointer: coarse) {
  .touch-controls {
    position: absolute;
    right: 14px;
    bottom: 14px;
    left: 14px;
    z-index: 8;
    display: none;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    pointer-events: none;
  }

  /* Only visible while actually playing (class set by responsive.js). */
  body.bd-playing .touch-controls {
    display: flex;
  }

  .touch-controls button {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 8px;
    background: rgba(10, 12, 38, 0.68);
    color: #ffffff;
    font: 800 18px 'Segoe UI', sans-serif;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
  }

  .touch-controls button:active,
  .touch-controls button[data-active="true"] {
    background: rgba(68, 102, 255, 0.9);
    box-shadow: 0 0 18px rgba(68, 102, 255, 0.8);
  }

  .touch-controls__pad {
    display: grid;
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(2, 48px);
    gap: 7px;
  }

  .touch-controls__pad button[data-key="ArrowUp"] {
    grid-column: 2;
  }

  .touch-controls__pad button[data-key="ArrowLeft"] {
    grid-column: 1;
    grid-row: 2;
  }

  .touch-controls__pad button[data-key="ArrowDown"] {
    grid-column: 2;
    grid-row: 2;
  }

  .touch-controls__pad button[data-key="ArrowRight"] {
    grid-column: 3;
    grid-row: 2;
  }

  .touch-controls__actions {
    display: flex;
    gap: 10px;
  }

  .touch-controls__actions button {
    width: 56px;
    height: 56px;
  }
}
