/* 화면 UI — + 블럭 만들기, connect 안내, 선택/인쇄 바. */

/* ── + 블럭 만들기 버튼 ──────────────────────────────── */
#add-btn {
  position: fixed;
  right: 20px;
  bottom: 44px;
  z-index: 70;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid var(--paper);
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#add-btn svg { display: block; }
#add-btn:hover { background: var(--pink); border-color: var(--pink); }

/* ── 블럭 만들기 패널 ────────────────────────────────── */
#add-panel {
  position: fixed;
  right: 20px;
  bottom: 100px;
  z-index: 71;
  width: min(320px, 86vw);
  padding: 16px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
}
#add-panel[hidden] { display: none; }
#add-panel .add-title { font-size: 15px; margin-bottom: 10px; }
/* 드롭존 — 클릭하면 파일 선택, 이미지를 끌어다 놓아도 된다 */
#add-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  border: 2px dashed var(--ink);
  margin-bottom: 8px;
  padding: 8px;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
}
#add-drop.is-over { background: #39ff14; }
#add-drop.has-file .add-drop__hint { display: none; }
.add-drop__hint {
  font-size: 12px;
  line-height: 1.5;
  opacity: 0.7;
}
#add-preview {
  display: block;
  max-width: 100%;
  max-height: 140px;
}
#add-preview[hidden] { display: none; }
#add-panel textarea {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid var(--ink);
  background: transparent;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  padding: 8px;
  resize: vertical;
}
#add-panel .add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
#add-panel .add-actions button {
  border: 2px solid var(--ink);
  background: transparent;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  padding: 5px 12px;
  cursor: pointer;
}
#add-panel #add-submit { background: var(--ink); color: var(--paper); }

/* ── connect 모드 안내 배너 ──────────────────────────── */
#connect-hint {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  padding: 10px 16px;
  background: #39ff14;
  color: #0c0c0c;
  font-weight: 700;
  font-size: 13px;
}
#connect-hint[hidden] { display: none; }
body.connecting .piece .band { cursor: url('../img/cursor-select.svg') 15 4, crosshair; }

/* ── 선택/인쇄 바 ────────────────────────────────────── */
#printbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 40px;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 버튼이 많아지면 줄로 나뉘되, 글자는 절대 행갈이되지 않는다 */
  flex-wrap: wrap;
  gap: 8px 10px;
  max-width: calc(100vw - 24px);
  padding: 10px 16px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
}
#printbar[hidden] { display: none; }
#printbar button {
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  background: transparent;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;   /* '그룹 해제'가 두 줄로 쪼개지지 않게 */
}
#printbar #printbar-count { flex: 0 0 auto; white-space: nowrap; }
#printbar #print-btn { background: var(--ink); color: var(--paper); }

/* 모바일: 두 줄까지 자연스럽게 나뉘고, 화면 밖으로 밀리지 않게 */
@media (max-width: 640px) {
  #printbar {
    left: 12px;
    right: 12px;
    transform: none;
    bottom: 16px;
    max-width: none;
    gap: 7px 8px;
    padding: 9px 12px;
  }
  #printbar button {
    font-size: 12.5px;
    padding: 5px 10px;
  }
}

/* ── 이미지 라이트박스 ─────────────────────────────────── */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  overflow: hidden;
  touch-action: none;
}
#lightbox.open { display: flex; }
#lightbox img {
  max-width: 88vw;
  max-height: 88vh;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
}
.lightbox-x {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

/* Shift+드래그 선택 상자 (view.js) — 화면(스크린) 좌표에 그린다 */
#select-box {
  position: fixed;
  z-index: 900;
  pointer-events: none;
  border: 1.5px dashed var(--paper);
  background: rgba(255, 255, 255, 0.08);
}

/* ── 비디오 박스 ─────────────────────────────────────── */
#video-btn {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 70;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid var(--paper);
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#video-btn:hover { background: var(--pink); border-color: var(--pink); }

#videobox {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.94);
  padding: 4vh 4vw;
}
#videobox.open { display: flex; }
.videobox__inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(92vw, 1200px);
  max-height: 92vh;
}
#videobox video {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}

/* 클립 타임라인: 길이 비례 칸 + 썸네일, 진행 커서 */
.videobox__timeline {
  position: relative;
  display: flex;
  gap: 2px;
  height: 44px;
  flex: 0 0 auto;
}
.videobox__seg {
  flex-basis: 0;
  min-width: 6px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background-color: #222;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}
.videobox__seg:hover { opacity: 0.9; }
.videobox__seg.is-active {
  opacity: 1;
  border-color: #39ff14;
  box-shadow: 0 0 0 1px #39ff14;
}
.videobox__cursor {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: #fff;
  pointer-events: none;
}
.videobox__bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  color: #f2f0ea;
  font-size: 25px;
  flex: 0 0 auto;
}
.videobox__caption { font-weight: 700; }
.videobox__open {
  margin-left: auto;
  color: #f2f0ea;
  opacity: 0.7;
  font-size: 23px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.videobox__open:hover { opacity: 1; }
.videobox__time { opacity: 0.65; font-size: 22px; }

.videobox-x {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

/* ── 동시 접속자 수 (좌상단) ─────────────────────────── */
.people {
  position: fixed;
  top: 18px;
  left: 20px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 2px solid var(--paper);
  color: var(--paper);
  font-size: 13px;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.people__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #39ff14;
  animation: people-pulse 1.8s ease-in-out infinite;
}
.people.is-alone .people__dot { background: var(--paper); animation: none; }
.people__n { font-weight: 700; }
.people__label { opacity: 0.7; }
@keyframes people-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@media (prefers-reduced-motion: reduce) {
  .people__dot { animation: none; }
}

/* ── 타임라인 위 구간 이름 — 두 워크숍을 나누는 대문 ── */
.videobox__sections {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}
.videobox__section {
  flex-basis: 0;
  min-width: 0;
  padding: 4px 6px;
  border: none;
  border-bottom: 2px solid rgba(242, 240, 234, 0.35);
  background: none;
  color: #f2f0ea;
  font-size: 17px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.videobox__section:hover { border-bottom-color: #39ff14; }
/* 워크숍이 바뀌는 클립 — 경계를 또렷하게 */
.videobox__seg.is-section-start {
  margin-left: 10px;
  border-left: 3px solid #f2f0ea;
}


/* ── 공간 레이어 — 로고가 화면에 고정된 채 배경에 떠 있다 ── */
#spacelayer {
  position: fixed;
  inset: 0;
  z-index: 0;              /* 조각(포스트)보다 뒤 */
  pointer-events: none;
}
.spacelayer__svg { width: 100%; height: 100%; display: block; }
.spacelayer__link {
  fill: none;
  stroke: var(--paper);
  stroke-width: 1.4px;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#space-clay);   /* 맵과 같은 클레이 노이즈 */
}
.spacelayer__node {
  pointer-events: auto;    /* 로고만 눌린다 */
  cursor: pointer;
}

/* 공간을 누르면 뜨는 패널 — 맵 사이트의 항목을 그대로 */
#space-panel {
  position: fixed;
  inset: 0;
  z-index: 880;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(0, 0, 0, 0.86);
}
#space-panel.open { display: flex; }
.space-panel__card {
  position: relative;
  width: min(680px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 30px 32px 34px;
  background: var(--paper);
  color: var(--ink);
}
.space-panel__head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}
.space-panel__logo { width: 64px; height: auto; filter: invert(1); }
.space-panel__name { font-size: 22px; font-weight: 700; }
.space-panel__note { font-size: 12.5px; opacity: 0.7; margin-top: 3px; word-break: keep-all; }
.space-panel__item { margin-bottom: 22px; }
.space-panel__img {
  width: 100%;
  height: auto;
  margin-bottom: 9px;
  display: block;
}
.space-panel__title {
  display: inline-block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.space-panel__body {
  font-size: 12.5px;
  line-height: 1.75;
  word-break: keep-all;
}
.space-panel__x {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 640px) {
  .space-panel__card { padding: 24px 20px 28px; }
}
