:root {
  --bg: #05070c;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0a0d14;
  touch-action: none;
}

/* ---------- Экранное управление ---------- */
#touch-ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
#touch-ui.hidden { display: none; }

#dpad, #actions {
  position: absolute;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
#dpad { left: max(16px, env(safe-area-inset-left)); }
#actions { right: max(16px, env(safe-area-inset-right)); }

.btn {
  pointer-events: auto;
  width: 62px;
  height: 62px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  touch-action: none;
  transition: transform .05s, background .05s;
}
.btn:active, .btn.pressed {
  background: rgba(255,255,255,0.30);
  transform: scale(0.92);
}
.btn.act {
  width: 76px;
  height: 76px;
  font-size: 32px;
  border-radius: 50%;
}
.btn.throw { background: rgba(90,200,255,0.18); border-color: rgba(120,210,255,0.5); }
.btn.jump  { background: rgba(120,255,140,0.18); border-color: rgba(140,255,150,0.5); margin-bottom: 30px; }

#btn-mute {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 11;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  pointer-events: auto;
}

/* ---------- Подсказка о повороте ---------- */
#rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: var(--bg);
  color: #ffd23f;
  font-size: 20px;
  font-weight: 700;
}

/* Показываем подсказку только на узких тач-экранах в портрете */
@media (orientation: portrait) and (max-width: 820px) and (pointer: coarse) {
  #rotate-hint { display: flex; }
}
