:root {
  --color-grey:rgb(210, 210, 210);
}

html,
body {
  height: 100%;
  margin: 0;
  background: #000;
  overflow-x: hidden;
  font-family: "Gothic A1", sans-serif;
}

/* 데스크탑: 가로로 배치(각 뷰어는 viewport height 기준) */
#viewers {
  display: flex;
  flex-direction: row;
  width: 100vw;
  height: 100vh;
  overflow-x: auto;
  overflow-y: hidden;
}

.viewer {
  position: relative;
  flex: 0 0 50vw;
  height: 100vh; /* window height 기준 */
  width: 50vw;
  overflow: hidden;
  background: #000;
}

.main-title {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 20;
  color: var(--color-grey);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.viewer-meta {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: calc(100% - 10px);
  gap: 10px; /* 라벨 텍스트 끝에서 + 버튼까지 10px */
  padding: 8px 10px;
  border: 1.5px solid var(--color-grey);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10;
}

.viewer-label,
.viewer-plus {
  color: var(--color-grey);
}

.viewer-label {
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  min-width: 220px;
}

.viewer-plus {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1.5px solid var(--color-grey);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.viewer-plus svg {
  width: 14px;
  height: 14px;
  display: block;
}

.viewer-plus path {
  fill: none;
  stroke: var(--color-grey);
  stroke-width: 1.8;
  stroke-linecap: square;
}

.viewer canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none; /* 터치 드래그로 orbit 가능 */
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 30;
}

.modal.is-open {
  display: flex;
}

.modal-card {
  position: relative;
  width: min(92vw, 360px);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #111;
  color: var(--color-grey);
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.modal-card p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.5;
}

.modal-card a {
  color: var(--color-grey);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: transparent;
  color: var(--color-grey);
  font-size: 16px;
  cursor: pointer;
}

/* 모바일: 세로로 배치(각 뷰어는 width 기준으로 정사각형) */
@media (max-width: 768px) {
  #viewers {
    flex-direction: column;
    width: 100vw;
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .viewer-label {
    font-size: 14px;
  }

  .viewer-plus {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
  }

  .viewer-plus svg {
    width: 12px;
    height: 12px;
  }

  .viewer {
    flex: none;
    width: 100vw; /* window width 기준 */
    height: 50dvh; /* 모바일에서 2개 기준: 각 뷰어 50% 높이 */
  }

  .viewer canvas {
    touch-action: none;
  }

  .modal-card {
    width: calc(100vw - 20px); /* 좌우 5px 여백 */
    max-width: none;
    box-sizing: border-box;
  }
}
