/* mobile.css - Mobile-specific styles (loaded when max-width: 1024px) */

/* ────────────────────────────────────────
   Safe area handling (iPhone notch, Android status/home bars)
───────────────────────────────────────── */
@supports (padding-top: env(safe-area-inset-top)) {
  .video-wrapper,
  .video-container,
  #videoStream {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  #menu-toggle-btn {
    top: calc(env(safe-area-inset-top) + 10px);
    left: calc(env(safe-area-inset-left) + 10px);
  }

  .y-controls {
    right: calc(env(safe-area-inset-right) + 12px);
  }

  .throw-controls {
    right: calc(env(safe-area-inset-right) + 16px);
  }
}

/* ────────────────────────────────────────
   Force true edge-to-edge fullscreen
───────────────────────────────────────── */
.video-wrapper,
.video-container {
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  max-height: none !important;
  overflow: hidden;
}

#videoStream {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;       /* default: fill + crop for mobile */
  object-position: center;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #000;
}

/* ────────────────────────────────────────
   PORTRAIT MODE - crop sides, move throw controls up
───────────────────────────────────────── */
@media (orientation: portrait) {
  #videoStream {
    object-fit: cover !important;
    /* If important content is cut off too much, try:
       object-position: 20% center;   or   80% center;   etc.
    */
  }

  /* Move Throw Ball + slider UP so it doesn't cover X controls */
  .throw-controls {
    position: absolute;
    bottom: 160px !important;           /* ← main adjustment: raise it above bottom buttons */
    right: 16px !important;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 12px;
    padding: 12px 16px;
    z-index: 12;
    max-width: 180px;
  }

  #throwBall {
    width: 70px;
    height: 70px;
    font-size: 18px;
    margin: 0 auto 12px;
    display: block;
  }

  .throw-controls .control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .throw-controls label,
  #powerLevelValue,
  .balls-thrown-value {
    color: white;
    font-size: 14px;
  }

  input[type="range"] {
    width: 140px;
  }

  /* Make bottom X controls a bit more compact */
  .x-controls .control-group {
    gap: 6px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.55);
  }

  .x-controls button,
  #homeX {
    width: 52px;
    height: 52px;
    font-size: 15px;
  }
}

/* ────────────────────────────────────────
   LANDSCAPE MODE - immersive fill, controls stay bottom-right
───────────────────────────────────────── */
@media (orientation: landscape) {
  #videoStream {
    object-fit: cover !important;
  }

  /* Keep throw button bottom-right, respect safe area */
  .throw-controls {
    bottom: calc(env(safe-area-inset-bottom) + 24px) !important;
    right: calc(env(safe-area-inset-right) + 24px) !important;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 14px;
    border-radius: 10px;
  }

  #throwBall {
    width: 60px;
    height: 60px;
    font-size: 16px;
  }

  /* Slightly larger landscape controls */
  .x-controls button,
  .y-controls button,
  #homeX, #homeY {
    width: 58px;
    height: 58px;
    font-size: 16px;
  }
}

/* ────────────────────────────────────────
   General mobile improvements
───────────────────────────────────────── */
html, body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Smaller top bar elements on small screens */
@media (max-width: 480px) {
  .top-center-group {
    gap: 8px;
    top: calc(env(safe-area-inset-top) + 8px);
  }

  #audio-toggle-btn {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  #queue-btn, #show-queue-btn {
    padding: 8px 14px;
    font-size: 14px;
  }
}