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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Source Sans Pro", "Segoe UI", sans-serif;
}

/* 세로모드 → 가로 회전 (모바일) */
@media (orientation: portrait) {
  html {
    transform: rotate(-90deg);
    transform-origin: top left;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100vh;
    height: 100vw;
  }
}

/* ── 영상 전체화면 ── */
header.viewer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
}
header.viewer video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

/* ── 상태 오버레이 ── */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 5;
  transition: opacity 0.3s;
}
.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.overlay span {
  color: #fff;
  font-size: 14px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
}
.overlay .error {
  color: #ff6b6b;
}

/* ── 모드 배지 ── */
.mode-badge {
  position: fixed;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  z-index: 10;
  pointer-events: none;
  display: none;
}
.mode-badge.webrtc {
  display: block;
  background: #4caf50;
  color: #fff;
}
.mode-badge.hls {
  display: block;
  background: #ff9800;
  color: #fff;
}

/* ── 하단 중앙 화살표 버튼 ── */
.angle-btn {
  position: absolute;
  left: 45%;
  right: 45%;
  width: 10%;
  min-width: 40px;
  height: 3vh;
  border: 0;
  background-color: #788b9d;
  opacity: 0.95;
  display: none;
  z-index: 12;
  cursor: pointer;
}
.angle-btn svg {
  display: block;
  margin: auto;
}
.angle-up {
  bottom: 0;
}
.angle-down {
  bottom: 25vh;
}

/* ── 하단 컨트롤 패널 ── */
.control-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.8);
  width: 100%;
  height: 25vh;
  display: none;
  z-index: 10;
}

/* ── 기능 박스 (nexbean func_box1) ── */
.func-box1 {
  position: absolute;
  border: 1px solid #d4dee8;
  background-color: #788b9d;
  color: #fff;
  border-radius: 12px;
  height: 60%;
  top: 25%;
  display: none;
}

/* PTZ/줌 버튼 */
.ptz-button {
  background-color: #788b9d;
  border: 0;
  position: absolute;
  font-size: 2vh;
  z-index: 1;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.ptz-button:hover {
  background-color: #6a7d8f;
  border-radius: 8px;
}
.ptz-button.disabled {
  cursor: default;
}
.ptz-button.disabled:hover {
  background-color: #788b9d;
}

.box-label {
  font-size: 1.5vh;
  display: block;
  margin-top: 2px;
}
.box-center-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 43%;
  text-align: center;
  font-size: 1.5vh;
  color: #aaa;
  pointer-events: none;
}

/* 기능 박스 위치 (nexbean 동일) */
#box-ptz {
  left: 2vw;
  width: 20vw;
}
#box-zoom {
  left: 24vw;
  width: 15vw;
}
#box-volume {
  left: 41vw;
  width: 15vw;
}
#box-tts {
  left: 58vw;
  width: 12vw;
}
#box-siren {
  left: 72vw;
  width: 12vw;
}
#box-broadcast {
  left: 86vw;
  width: 12vw;
}

/* 단일 버튼 박스 (TTS, 경고음, 안전방송) */
.func-single {
  align-items: center;
  justify-content: center;
}
.btn-func {
  width: 100%;
  height: 100%;
  text-align: center;
  font-size: 2vh;
  background-color: #788b9dcc;
  border-radius: 12px;
  border: 0;
  color: #000;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
}
.btn-func.disabled {
  cursor: default;
}

/* ── 우하단 열기 버튼 ── */
.btn-open {
  position: absolute;
  right: 5px;
  bottom: 5px;
  z-index: 11;
  cursor: pointer;
  opacity: 0.7;
  display: block;
}
.btn-open:hover {
  opacity: 1;
}

/* ── 우상단 닫기 버튼 ── */
.btn-close {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 11;
  cursor: pointer;
  opacity: 0.7;
  display: none;
}
.btn-close:hover {
  opacity: 1;
}

/* ── 좌상단 새로고침 버튼 ── */
.btn-refresh {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 11;
  cursor: pointer;
  opacity: 0.7;
  display: none;
}
.btn-refresh:hover {
  opacity: 1;
}

/* ── 현재 모드 표시 ── */
.mode-indicator-wrap {
  position: absolute;
  left: 40px;
  top: 10px;
  z-index: 11;
  display: none;
}
.mode-indicator {
  padding: 3px 10px;
  border: 1px solid #788b9d;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: #ccc;
  font-size: 11px;
  pointer-events: none;
}

/* ── 토스트 알림 ── */
.toast-container {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 24px;
  background: rgba(233, 69, 96, 0.9);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: auto;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── 반응형 ── */
@media (max-width: 600px) {
  .func-box1 {
    border-radius: 8px;
  }
  .box-label {
    font-size: 1.2vh;
  }
}
