/* SUPER BYTE BROS — полноэкранный мобильный лейаут */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #10140f;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#screen {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  box-shadow: 0 0 4vmin rgba(0, 0, 0, .8);
}

/* ---------- сенсорные кнопки ---------- */
#controls { display: none; }
body.touch #controls { display: block; }

.cbtn {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 3.5vmin);
  width: 17vmin;
  height: 17vmin;
  min-width: 64px;
  min-height: 64px;
  max-width: 104px;
  max-height: 104px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .09);
  color: rgba(255, 255, 255, .85);
  font-size: 6vmin;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  padding: 0;
  transition: background .06s linear;
}
.cbtn.on { background: rgba(255, 255, 255, .30); border-color: rgba(255,255,255,.6); }

#btnL { left: calc(env(safe-area-inset-left, 0px) + 3.5vmin); }
#btnR { left: calc(env(safe-area-inset-left, 0px) + 24vmin); }
#btnA {
  right: calc(env(safe-area-inset-right, 0px) + 3.5vmin);
  border-color: rgba(255, 200, 60, .55);
  color: #ffd75e;
}
#btnA.on { background: rgba(255, 200, 60, .25); }
#btnB {
  right: calc(env(safe-area-inset-right, 0px) + 22vmin);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1vmin);
  border-color: rgba(120, 200, 255, .45);
  color: #9fd7ff;
  width: 14vmin; height: 14vmin;
  font-size: 5vmin;
}
#btnB.on { background: rgba(120, 200, 255, .22); }

/* ---------- верхняя панель ---------- */
#topbar {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 6px);
  right: calc(env(safe-area-inset-right, 0px) + 8px);
  display: flex;
  gap: 6px;
  z-index: 11;
  opacity: .5;
}
.tbtn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(0, 0, 0, .35);
  color: #fff;
  font-size: 16px;
  touch-action: manipulation;
}
.tbtn:active { background: rgba(255, 255, 255, .25); }

/* ---------- подсказка про поворот (только портрет на телефоне) ---------- */
#hint { display: none; }
@media (orientation: portrait) and (max-width: 820px) {
  body.touch #hint {
    display: block;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 42%);
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .8);
    background: rgba(0, 0, 0, .55);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 12;
    pointer-events: none;
    transition: opacity .8s ease;
  }
  body.playing #hint { opacity: 0; }
}
