/* ============================================================
   GLOBAL
============================================================ */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: black;
  overflow: hidden;
  color: white;
}

/* ============================================================
   VIDEO LAYERS
============================================================ */
.video-container {
  position: fixed;
  top: 0;
  left: 0;

  width: 100vw;
  height: 100vh;

  background: black;
  overflow: hidden;
  z-index: 1;
}

#remoteVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   LOCAL PREVIEW (draggable floating box)
============================================================ */
.local-preview {
  position: fixed !important;
  width: 140px;
  height: 180px;

  top: 12px;
  left: 12px;

  border-radius: 16px;
  overflow: hidden;
  background: rgba(0,0,0,0.6);

  backdrop-filter: blur(15px) saturate(180%);

  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);

  cursor: grab;
  touch-action: none;

  z-index: 9999;
}

.local-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   CONTROL BUTTONS — VisionOS Glass
============================================================ */

#infoBtn, 
#inviteBtn, 
#aiToggleBtn {
  position: fixed;
  top: 12px;
  right: 12px;

  margin-left: 8px;
  padding: 10px 16px;

  font-size: 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.25);

  color: white;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(20px) saturate(180%);

  cursor: pointer;
  transition: 0.2s ease;

  z-index: 9999;
}

/* Arrange buttons horizontally */
#inviteBtn {
  right: 72px;
}
#aiToggleBtn {
  right: 140px;
}

#infoBtn:hover, 
#inviteBtn:hover, 
#aiToggleBtn:hover {
  background: rgba(255,255,255,0.32);
  box-shadow: 0 0 20px rgba(255,255,255,0.5);
}

#infoBtn:active, 
#inviteBtn:active, 
#aiToggleBtn:active {
  transform: scale(0.92);
}

/* ============================================================
   END CALL BUTTON
============================================================ */
#endCallBtn {
  position: fixed;
  bottom: 24px;
  right: 24px;

  width: 56px;
  height: 56px;

  border-radius: 50%;
  border: none;

  background: rgba(255, 60, 60, 0.9);
  color: white;
  font-size: 26px;
  font-weight: bold;

  display: flex;
  justify-content: center;
  align-items: center;

  box-shadow: 0 8px 30px rgba(255, 0, 0, 0.35);

  cursor: pointer;
  transition: 0.15s ease;

  z-index: 9999;
}

#endCallBtn:active {
  transform: scale(0.85);
}

/* ============================================================
   INFO PANEL — VisionOS Glass Slide-Up Panel
============================================================ */
#infoPanel {
  position: fixed;
  left: 0;
  bottom: 0;

  width: 100vw;
  height: 42vh;

  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(25px) saturate(180%);
  border-top: 1px solid rgba(255,255,255,0.18);

  padding: 20px;
  overflow-y: auto;

  transform: translateY(100%);
  transition: transform 0.35s ease;

  z-index: 9000;
}

#infoPanel.open {
  transform: translateY(0);
}

#infoPanel h1 {
  margin: 0;
  text-align: center;
  font-size: 22px;
  color: #ffd700;
}

/* LOG BOX */
#log {
  width: 100%;
  height: 200px;

  background: rgba(255,255,255,0.12);
  border-radius: 12px;

  overflow-y: auto;
  padding: 10px;

  font-size: 16px;
  margin-bottom: 15px;
}

/* SEND BOX */
.send-box {
  width: 100%;
  display: flex;
  gap: 10px;
}

.send-box input {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;

  background: rgba(255,255,255,0.2);
  color: white;
}

.send-box button {
  padding: 10px 16px;
  border-radius: 10px;

  background: #ffd700;
  color: #333;
  font-weight: bold;

  border: none;
  cursor: pointer;
}

/* ============================================================
   TOAST NOTIFICATIONS
============================================================ */
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);

  background: rgba(0,0,0,0.75);
  padding: 12px 20px;
  border-radius: 12px;

  color: white;
  font-size: 14px;

  opacity: 0;
  pointer-events: none;

  transition: opacity 0.3s ease;
  z-index: 9999;
}

#toast.show {
  opacity: 1;
}

/* ============================================================
   SUBTITLES — VisionOS Floating Glass Pill
============================================================ */
#subtitles {
  position: fixed;
  bottom: 10vh;
  left: 50%;
  transform: translateX(-50%);

  padding: 14px 24px;

  min-width: 240px;
  max-width: 78vw;

  text-align: center;
  font-size: 18px;
  line-height: 1.4;

  border-radius: 22px;
  
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.25);

  opacity: 0;
  transition: opacity 0.35s ease;

  color: white;
  z-index: 9999;
}

#subOriginal {
  font-size: 15px;
  opacity: 0.85;
}

#subTranslated {
  font-size: 20px;
  font-weight: 600;
  margin-top: 4px;
}
#joystick {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 140px;
    height: 140px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    touch-action: none;
    z-index: 9999;   /* 🔴 REQUIRED */
  }
  #knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 50px;
    height: 50px;
    margin-left: -25px;
    margin-top: -25px;
    background: rgba(255,255,255,0.7);
    border-radius: 50%;
  }
/* ============================================================
   MOBILE RESPONSIVE
============================================================ */
@media (max-width: 768px) {
  #subtitles {
    bottom: 14vh;
    font-size: 16px;
    padding: 12px 16px;
  }

  #localWrapper {
    width: 120px;
    height: 160px;
  }
}
