/* === Base === */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", system-ui, sans-serif;
  color: #1c1c1f;
  background: #fff;
}
.hidden { display: none !important; }
a { color: #1f6feb; text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  font-family: inherit;
  cursor: pointer;
}

/* === Auth pages (login, signup) === */
body.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 65%, rgba(0,0,0,0.04) 0%, rgba(255,255,255,0) 70%),
    #fafafa;
}
.auth-card {
  width: min(380px, 90vw);
  background: #fff;
  border: 1px solid #e3e3e8;
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
}
.auth-card h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: #6c6c76; margin-bottom: 20px; }
.auth-card label {
  display: block; font-size: 12px; color: #5c5c66;
  font-weight: 600; margin-bottom: 6px; letter-spacing: 0.04em;
}
.auth-card input[type=text], .auth-card input[type=email], .auth-card input[type=password] {
  width: 100%; padding: 10px 12px;
  border: 1px solid #d8d8de; border-radius: 8px;
  font-size: 14px; font-family: inherit; color: inherit;
  background: #fafafa; outline: none;
  transition: border-color 0.15s;
}
.auth-card input:focus { border-color: #1f6feb; background: #fff; }
.auth-row { margin-bottom: 14px; }
.auth-card button[type=submit] {
  width: 100%; padding: 11px 12px;
  background: #1c1c1f; color: #fff;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  transition: background 0.15s;
}
.auth-card button[type=submit]:hover { background: #303036; }
.auth-card button[type=submit]:disabled { background: #9c9ca6; cursor: wait; }
.auth-err {
  background: #fdecec; color: #8b1d1d;
  border: 1px solid #f0c7c7; border-radius: 8px;
  padding: 8px 12px; font-size: 12.5px;
  margin-bottom: 12px;
}
.auth-foot {
  margin-top: 16px; font-size: 12px; color: #6c6c76; text-align: center;
}

/* === Dashboard === */
body.dash-page { min-height: 100vh; }
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid #e3e3e8;
}
.dash-brand { font-weight: 700; font-size: 15px; letter-spacing: -0.2px; }
.dash-nav { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.dash-nav span { color: #6c6c76; }
.dash-nav button {
  padding: 6px 12px; border: 1px solid #d8d8de; border-radius: 6px;
  background: #fff; font-size: 12.5px; color: #1c1c1f;
}
.dash-nav button:hover { background: #f5f5f8; }
.dash-main { max-width: 1100px; margin: 0 auto; padding: 32px 28px; }
.dash-main h1 { font-size: 22px; font-weight: 700; margin-bottom: 20px; letter-spacing: -0.3px; }
.contents-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.content-card {
  display: block;
  background: #fff;
  border: 1px solid #e3e3e8;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s, box-shadow 0.15s;
}
.content-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  text-decoration: none;
}
.content-thumb {
  aspect-ratio: 9 / 16;
  background: #fff center / cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.thumb-fallback {
  font-size: 56px; font-weight: 800; color: #b8b8c0;
  letter-spacing: -0.04em;
}
.content-meta { padding: 12px 14px 14px; }
.content-title {
  font-size: 14px; font-weight: 600; letter-spacing: -0.1px;
  margin-bottom: 4px;
}
.content-desc {
  font-size: 12px; color: #6c6c76; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pill {
  display: inline-block; font-size: 10px; font-weight: 600;
  background: #e6f1ff; color: #1f6feb;
  padding: 1px 6px; border-radius: 4px;
  vertical-align: 1px;
}
.dash-empty {
  grid-column: 1 / -1;
  padding: 40px 20px; text-align: center;
  background: #fff; border: 1px dashed #d8d8de; border-radius: 12px;
  color: #6c6c76; font-size: 13px; line-height: 1.6;
}
/* figure360 뷰어 전용 스타일 — view-mode/admin-mode body 클래스에만 적용 */
body.view-mode, body.admin-mode {
  position: fixed; inset: 0;
  width: 100%; height: 100%; overflow: hidden; background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Pretendard', system-ui, sans-serif;
  color: #1a1a1a;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body.view-mode #root, body.admin-mode #root {
  width: 100%; height: 100%; overflow: hidden;
}
#stage {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  background: #ffffff;
}
/* 밝기는 BrightnessSlider 인라인 filter로 제어 — 여기서는 mask만 담당 */
.figure-canvas, .figure-video {
  /* 가장자리 fade — ease-out 느낌으로 다단 stop, 양 축 교차 */
  --fade: 80px;
  --soft: 40px;
  -webkit-mask-image:
    linear-gradient(to right,
      transparent 0,
      rgba(0,0,0,0.55) var(--soft),
      #000 var(--fade),
      #000 calc(100% - var(--fade)),
      rgba(0,0,0,0.55) calc(100% - var(--soft)),
      transparent 100%),
    linear-gradient(to bottom,
      transparent 0,
      rgba(0,0,0,0.55) var(--soft),
      #000 var(--fade),
      #000 calc(100% - var(--fade)),
      rgba(0,0,0,0.55) calc(100% - var(--soft)),
      transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image:
    linear-gradient(to right,
      transparent 0,
      rgba(0,0,0,0.55) var(--soft),
      #000 var(--fade),
      #000 calc(100% - var(--fade)),
      rgba(0,0,0,0.55) calc(100% - var(--soft)),
      transparent 100%),
    linear-gradient(to bottom,
      transparent 0,
      rgba(0,0,0,0.55) var(--soft),
      #000 var(--fade),
      #000 calc(100% - var(--fade)),
      rgba(0,0,0,0.55) calc(100% - var(--soft)),
      transparent 100%);
          mask-composite: intersect;
}
.glass {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06),
    0 8px 28px rgba(0, 0, 0, 0.08),
    0 2px 6px rgba(0, 0, 0, 0.04);
  color: #1a1a1a;
}
.glass-strong {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.70);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    0 12px 36px rgba(0, 0, 0, 0.10),
    0 2px 8px rgba(0, 0, 0, 0.05);
}
.glass-btn {
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
  -webkit-user-select: none; user-select: none;
}
.glass-btn:hover { background: rgba(255, 255, 255, 0.32); border-color: rgba(255, 255, 255, 0.75); }
.glass-btn:active { transform: scale(0.96); }
.glass-btn[data-active="true"] {
  background: rgba(30, 30, 30, 0.55);
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
}
/* === 회전 스크롤바 — 미니멀 (얇은 라인 + 슬림 thumb) === */
.rot-track {
  position: relative;
  height: 36px;             /* 터치 타깃 유지 */
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  overflow: visible;
}
.rot-track::before {
  content: '';
  position: absolute;
  left: 8px; right: 8px;
  top: 50%; height: 1px;
  background: rgba(0, 0, 0, 0.22);
  transform: translateY(-50%);
  pointer-events: none;
}
.rot-tick {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 1px; background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.rot-tick.major { height: 8px; background: rgba(0, 0, 0, 0.55); }
.rot-tick.minor { display: none; }   /* 미세 눈금 숨김 */
.rot-thumb {
  position: absolute; top: 50%;
  transform: translate(-50%, -50%);
  width: 3px; height: 22px; border-radius: 2px;
  background: #1a1a1a;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.20);
  pointer-events: none;
}
.vert-track {
  position: relative;
  width: 44px;
  border-radius: 22px;
  overflow: hidden;
}
.vert-thumb {
  position: absolute; left: 50%; transform: translate(-50%, -50%);
  width: 36px; height: 56px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 4px 14px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.label {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(40, 40, 40, 0.7); font-weight: 600;
}
.hotspot {
  position: absolute;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.hotspot[data-edit="false"] {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px dashed rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18), inset 0 0 0 1px rgba(255,255,255,0.4);
}
.hotspot[data-edit="false"][data-hidden="true"] { background: transparent !important; border: none !important; box-shadow: none !important; }
.hotspot[data-edit="false"][data-hidden="true"]:hover { background: transparent !important; border: none !important; }
.hotspot[data-edit="false"]:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 1);
  border-style: solid;
}
.hotspot[data-edit="true"] {
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.4);
  cursor: move;
}
.hotspot-handle {
  position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.7);
  right: -8px; bottom: -8px;
  cursor: nwse-resize;
}
.hotspot-pulse {
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
  animation: pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0% { transform: scale(0.85); opacity: 0.9; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { opacity: 0; }
}
.greeting {
  pointer-events: none;
  animation: fadeUp 0.6s ease-out both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.speech {
  pointer-events: none;
  animation: speechPop 0.35s ease-out both;
}
@keyframes speechPop {
  from { opacity: 0; transform: translate(-50%, 6px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* === 인트로 오버레이 (로딩 + 안내) === */
.intro-overlay {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  animation: introFadeIn 0.5s ease-out both;
  padding: 24px;
}
.intro-overlay[data-leaving="true"] {
  animation: introFadeOut 0.6s ease-in both;
  pointer-events: none;
}
@keyframes introFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes introFadeOut {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}
.intro-card {
  max-width: 520px; width: 100%;
  text-align: center;
  animation: introCardRise 0.7s ease-out both;
}
@keyframes introCardRise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.intro-title {
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 700; letter-spacing: -0.02em;
  color: #1a1a1a;
  animation: introTitleFade 1.2s ease-out 0.15s both;
}
.intro-subtitle {
  font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(60, 60, 60, 0.55);
  margin-bottom: 8px;
  animation: introTitleFade 1.2s ease-out 0.05s both;
}
@keyframes introTitleFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.intro-section {
  margin-top: 22px;
  text-align: left;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 14px 16px;
  animation: introTitleFade 1.2s ease-out 0.35s both;
}
.intro-section.legal {
  background: rgba(255, 246, 235, 0.85);
  border-color: rgba(190, 110, 30, 0.18);
  color: #5a3812;
}
.intro-section h4 {
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  color: rgba(40, 40, 40, 0.85);
}
.intro-section.legal h4 { color: #8a4a18; }
.intro-section ul { list-style: none; padding: 0; margin: 0; }
.intro-section li {
  font-size: 13px; line-height: 1.55;
  padding: 3px 0 3px 16px;
  position: relative;
  color: rgba(40, 40, 40, 0.85);
}
.intro-section.legal li { color: #5a3812; }
.intro-section li::before {
  content: '·'; position: absolute; left: 4px; top: 1px;
  font-size: 18px; line-height: 1;
}
.intro-progress {
  margin-top: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: introTitleFade 1.2s ease-out 0.5s both;
}
.intro-progress-bar {
  width: 100%; max-width: 320px;
  height: 4px; border-radius: 2px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.intro-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1a1a1a, #4a4a4a);
  transition: width 0.18s ease;
}
.intro-progress-label {
  font-size: 12px; color: rgba(40, 40, 40, 0.55);
  letter-spacing: 0.04em;
}
.intro-start-btn {
  margin-top: 6px;
  padding: 12px 32px;
  font-size: 14px; font-weight: 600;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.85);
  background: #1a1a1a; color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease, background 0.2s ease;
  letter-spacing: 0.04em;
}
.intro-start-btn:hover { background: #000; }
.intro-start-btn:active { transform: scale(0.97); }
.intro-start-btn:disabled {
  background: rgba(0, 0, 0, 0.18);
  border-color: rgba(0, 0, 0, 0.06);
  color: rgba(255, 255, 255, 0.85);
  cursor: wait;
}
#ui-toggle {
  position: fixed;
  top: max(16px, calc(env(safe-area-inset-top) + 4px));
  right: max(16px, env(safe-area-inset-right));
  z-index: 9999;
  width: clamp(40px, 5.6vw, 52px);
  height: clamp(40px, 5.6vw, 52px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.hint { font-size: 12px; color: rgba(40, 40, 40, 0.6); }
.top-toolbar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: calc(max(12px, env(safe-area-inset-right)) + clamp(52px, 8vw, 64px));
  display: flex;
  flex-wrap: wrap;
  gap: clamp(4px, 0.8vw, 8px);
  z-index: 50;
  pointer-events: none;
}
.top-toolbar > * { pointer-events: auto; }
.top-toolbar .spacer { flex: 1 1 auto; }

/* === 관리자 사이드 도크 — 우측 세로, UI 토글 아래 === */
.admin-dock {
  position: fixed;
  top: max(74px, calc(env(safe-area-inset-top) + 64px));
  right: max(12px, env(safe-area-inset-right));
  display: flex; flex-direction: column;
  gap: 8px;
  z-index: 60;
  align-items: flex-end;
  pointer-events: none;
}
.admin-dock > * { pointer-events: auto; }
@media (max-width: 600px) {
  .admin-dock .pill-label { display: inline; }
}
@media (max-width: 600px) {
  .top-toolbar .pill-label { display: none; }
  .hint { display: none; }
}
@media (max-width: 380px) {
  .top-toolbar { top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; }
}

/* === 뷰어 모드: 버튼·스크롤 트랙 배경/테두리 제거 === */
body.view-mode .glass,
body.view-mode .glass-strong,
body.view-mode .glass-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
body.view-mode .glass-btn:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  border: none !important;
}
body.view-mode .glass-btn[data-active="true"] {
  background: rgba(0, 0, 0, 0.08) !important;
  color: #1a1a1a !important;
}
body.view-mode .vert-track {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
body.view-mode .vert-thumb {
  background: rgba(0, 0, 0, 0.42) !important;
  border: none !important;
  box-shadow: none !important;
}
body.view-mode #ui-toggle {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
body.view-mode #ui-toggle:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}

