/* 온라인 전시관 — 360 둘러보기
   왼쪽 전시실 목록 · 좌우 이동 · 바닥 화살표 · 자동 플레이 · 확대 */

.tour {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  background: #0d0914;
  color: var(--ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tour[hidden] { display: none; }

/* ── 왼쪽 목록 ───────────────────────────── */

.t-side {
  position: relative;
  z-index: 3;
  flex: none;
  width: 232px;
  display: flex;
  flex-direction: column;
  background: #14101d;
  border-right: 1px solid var(--line-soft);
}

.t-side-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.t-side-top .ttl {
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
}

.t-side-top .sub {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--ink-dim);
  margin-top: 2px;
}

.t-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 20px; }
.t-list::-webkit-scrollbar { width: 8px; }
.t-list::-webkit-scrollbar-thumb { background: #35294a; border-radius: 4px; }

.t-room {
  padding: 13px 14px 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--ink-dim);
}

.t-list button {
  display: block;
  width: 100%;
  padding: 9px 14px 9px 26px;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-sub);
  position: relative;
  border-left: 2px solid transparent;
}

.t-list button::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 16px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #4a3c60;
}

.t-list button:hover { color: var(--ink); background: #1b1526; }

.t-list button[aria-current="true"] {
  color: var(--on-accent);
  background: var(--accent);
  border-left-color: var(--accent-deep);
  font-weight: 700;
}

.t-list button[aria-current="true"]::before { background: var(--on-accent); }

/* ── 보는 자리 ───────────────────────────── */

.t-stage { position: relative; flex: 1; min-width: 0; overflow: hidden; }

.t-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.tour.dragging .t-stage canvas { cursor: grabbing; }

/* ── 제목 쪽지 ───────────────────────────── */

.t-cap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  padding: 16px 20px 40px;
  background: linear-gradient(180deg, rgba(13, 9, 20, .8), rgba(13, 9, 20, 0));
  pointer-events: none;
}

.t-cap b {
  display: block;
  font-family: var(--serif);
  font-size: 17px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
}

.t-cap span {
  display: block;
  font-size: 12.5px;
  color: #d9cfe0;
  margin-top: 3px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
}

/* ── 자막 ────────────────────────────────── */

/* 바닥 단추들(오른쪽 아래)과 좌우 넘김 단추를 피해서 가운데 아래에 놓습니다 */
.t-sub {
  position: absolute;
  left: 50px;
  right: 50px;
  bottom: 68px;
  z-index: 3;
  max-width: 760px;
  margin: 0 auto;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid rgba(244, 236, 230, .16);
  background: rgba(13, 9, 20, .84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.t-sub[hidden] { display: none; }

/* 긴 자막(영문은 470자가 넘습니다)은 줄이지 않고 이 안에서 굴립니다 */
.t-sub .tx {
  margin: 0;
  max-height: 24vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  white-space: pre-line;          /* 원고의 줄바꿈을 살립니다 */
  font-size: 14.5px;
  line-height: 1.75;
  word-break: keep-all;
  text-wrap: pretty;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;            /* 자막 안에서는 손가락으로 굴릴 수 있게 */
  user-select: text;
  -webkit-user-select: text;
}

.t-sub .tx::-webkit-scrollbar { width: 5px; }
.t-sub .tx::-webkit-scrollbar-thumb { background: rgba(244, 236, 230, .26); border-radius: 3px; }

.t-sub-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 9px;
}

.t-sub-nav .no {
  font-size: 12px;
  color: #d9cfe0;
  font-variant-numeric: tabular-nums;
}

.t-sub-nav .no[hidden],
.t-sub-nav .t-btn[hidden] { display: none; }

.t-sub-nav .t-btn {
  width: 30px;
  height: 30px;
  font-size: 17px;
  line-height: 1;
}

/* ── 단추들 ──────────────────────────────── */

.t-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(244, 236, 230, .2);
  border-radius: 50%;
  background: rgba(20, 16, 29, .76);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
}

.t-btn:hover { border-color: var(--accent); color: var(--accent); }
.t-btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.t-btn:disabled { opacity: .3; cursor: default; }
.t-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.t-tools {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.t-zoom {
  position: absolute;
  right: 16px;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 좌우 넘기기 */
.t-step {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  width: 34px;
  height: 64px;
  border: 1px solid rgba(244, 236, 230, .18);
  background: rgba(20, 16, 29, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: 18px;
}

.t-step.prev { left: 0; border-left: 0; border-radius: 0 8px 8px 0; }
.t-step.next { right: 0; border-right: 0; border-radius: 8px 0 0 8px; }
.t-step:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); }
.t-step:disabled { opacity: .25; cursor: default; }

/* ── 장면 안의 표시들 ────────────────────── */

.t-spots { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

.t-spot {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .9);
  white-space: nowrap;
}

/* 바닥에 놓인 이동 화살표 */
.t-spot.go .ico {
  width: 46px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(255, 255, 255, .55);
  display: grid;
  place-items: center;
  animation: t-pulse 2.2s ease-in-out infinite;
}

.t-spot.go .ico svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.t-spot.go:hover .ico { background: var(--accent); border-color: #fff; }
.t-spot .lb { font-size: 11.5px; letter-spacing: .02em; }

@keyframes t-pulse {
  0%, 100% { transform: translateY(0); opacity: .9; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* 작품·글자 들여다보기 */
.t-spot.look .ico {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(232, 168, 124, .3);
  border: 1.5px solid var(--accent);
  display: grid;
  place-items: center;
  animation: t-ring 2.4s ease-out infinite;
}

.t-spot.look .ico svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.t-spot.look:hover .ico { background: var(--accent); }

@keyframes t-ring {
  0% { box-shadow: 0 0 0 0 rgba(232, 168, 124, .55); }
  70%, 100% { box-shadow: 0 0 0 14px rgba(232, 168, 124, 0); }
}

/* ── 들여다보기 창 ───────────────────────── */

.t-look {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: rgba(8, 6, 12, .95);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.t-look[hidden] { display: none; }

.t-look-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
}

.t-look-top div { flex: 1; min-width: 0; }
.t-look-top b { display: block; font-family: var(--serif); font-size: 16px; }
.t-look-top p { font-size: 13px; color: var(--ink-sub); margin-top: 3px; }

.t-look-img {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  cursor: grab;
}

.t-look-img.dragging { cursor: grabbing; }

.t-look-img img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  transform-origin: 0 0;
  will-change: transform;
}

.t-look-hint {
  padding: 10px 16px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-dim);
}

/* ── 불러오는 중 ─────────────────────────── */

.t-wait {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 4;
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(13, 9, 20, .8);
  font-size: 12px;
  color: var(--ink-sub);
  pointer-events: none;
}

.t-wait[hidden] { display: none; }

.t-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  padding: 11px 18px;
  border-radius: 22px;
  background: rgba(13, 9, 20, .78);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .5s;
}

.t-hint[hidden] { display: none; }

/* ── 좁은 화면 ───────────────────────────── */

.t-side-toggle { display: none; }

@media (max-width: 760px) {
  .tour { flex-direction: column; }

  .t-side {
    position: absolute;
    inset: 0 auto 0 0;
    width: 76%;
    max-width: 300px;
    z-index: 6;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .6);
  }

  .tour.menu .t-side { transform: none; }

  .t-side-toggle {
    display: inline-flex;
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 4;
  }

  .t-cap { padding: 14px 16px 34px; }
  .t-cap b { font-size: 15px; }

  /* 좁은 화면 — 왼쪽 아래 목록 단추와 오른쪽 아래 단추들 위로 올립니다 */
  .t-sub { left: 12px; right: 12px; bottom: 62px; padding: 11px 13px; }
  .t-sub .tx { font-size: 13.5px; line-height: 1.7; max-height: 30vh; }
  .t-sub-nav { margin-top: 7px; }
  .t-zoom { top: auto; bottom: 70px; transform: none; }
  .t-step { width: 30px; height: 56px; }
}

/* 가는 길이 화면 밖에 있을 때 — 가장자리에 붙여 어느 쪽인지 알려 줍니다 */
.t-spot.edge { flex-direction: row; gap: 7px; }
.t-spot.edge .ico { width: 36px; height: 36px; border-radius: 50%; animation: none; flex: none; }
.t-spot.edge .lb {
  max-width: 148px; overflow: hidden; text-overflow: ellipsis;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(20, 16, 29, .72); font-size: 11.5px;
}
.t-spot.edge[data-side="r"] { flex-direction: row-reverse; transform: translate(-100%, -50%); }
.t-spot.edge[data-side="l"] { transform: translate(0, -50%); }
.t-spot.edge[data-side="r"] .ico svg { transform: rotate(90deg); }
.t-spot.edge[data-side="l"] .ico svg { transform: rotate(-90deg); }

/* ── 화살표 방향 고치기 (주소에 ?edit=1) ── */

.t-edit {
  position: absolute;
  left: 16px;
  top: 76px;
  z-index: 4;
  width: 208px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 16, 29, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 13px;
}

.t-edit .e-hd { font-family: var(--serif); font-weight: 700; font-size: 13.5px; }
.t-edit .e-now { font-family: var(--mono); font-size: 26px; font-weight: 700; margin-top: 6px; }
.t-edit .e-val { font-family: var(--mono); font-size: 11.5px; color: var(--ink-sub); margin-bottom: 10px; }
.t-edit .e-row { display: flex; gap: 6px; }

.t-edit button {
  flex: 1;
  padding: 8px 6px;
  border: 1px solid rgba(244, 236, 230, .25);
  border-radius: 7px;
  background: rgba(244, 236, 230, .06);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.3;
}

.t-edit button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.t-edit .e-save { width: 100%; margin-top: 8px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.t-edit .e-save:disabled { opacity: .35; cursor: default; background: rgba(244, 236, 230, .06); border-color: rgba(244, 236, 230, .25); color: var(--ink-sub); }
.t-edit .e-msg { font-size: 11.5px; color: var(--ink-sub); margin-top: 8px; min-height: 14px; }

@media (max-width: 760px) { .t-edit { top: 64px; left: 10px; width: 184px; } }
