/* CarouselPress 뷰어 — 받은 .csl 을 브라우저 안에서 여는 화면.
   메인 페이지와 /view 가 같이 씁니다. */

/* ---------- standalone opener page ---------- */

.opener {
  max-width: 560px;
  margin: 0 auto;
  padding: 56px 24px 100px;
  text-align: center;
}
.opener h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.opener .lead { margin: 14px 0 32px; color: var(--ink-soft); }
.opener .open-card { padding: 44px 24px 34px; }

/* ---------- open card ---------- */

.open-card {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--cream-card);
  border: 2px dashed rgba(43, 32, 21, 0.22);
  border-radius: 24px;
  padding: 30px 24px 26px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.open-card:hover, .open-card.over {
  border-color: var(--gold-deep);
  background: #fffdf7;
}
.open-card.over { transform: scale(1.01); }
.open-card input { display: none; }
.open-card img {
  width: 84px; height: 84px;
  border-radius: 20px;
  margin: 0 auto 16px;
  box-shadow: 0 10px 24px -12px rgba(90, 62, 20, 0.5);
}
.open-card .headline {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  margin-bottom: 6px;
}
.open-card .sub {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 18px;
  line-height: 1.55;
}
.open-card .pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: var(--cream);
  border-radius: 999px;
  padding: 12px 26px;
  font-weight: 600;
  font-size: 0.95rem;
}
.open-card .safe {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--ink-faint);
  line-height: 1.6;
}

.open-error {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fdecea;
  border: 1px solid #f5c6c0;
  color: #8a2318;
  font-size: 0.9rem;
  text-align: left;
}
.open-error[hidden] { display: none; }

/* ---------- viewer ---------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.viewer[hidden] { display: none; }

.viewer-bar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 3;
}
.round {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
.round:active { transform: scale(0.94); }
.round.off { color: rgba(255,255,255,0.45); }

/* Cover: the first tap is what lets the music start. */
.cover { text-align: center; padding: 24px; max-width: 420px; }
.cover[hidden] { display: none; }
.cover img {
  width: min(230px, 60vw);
  border-radius: 16px;
  margin: 0 auto 24px;
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.8);
}
.cover h2 { font-size: 1.5rem; margin-bottom: 10px; }
.cover .from { font-size: 0.88rem; color: rgba(255,255,255,0.5); margin-bottom: 26px; }
.cover .open-btn {
  background: #fff; color: #111;
  border: 0; border-radius: 999px;
  padding: 14px 34px;
  font: inherit; font-weight: 600;
  cursor: pointer;
}
.cover .warn {
  margin-top: 20px;
  font-size: 0.86rem;
  color: #ffb4a8;
  line-height: 1.6;
}

/* Stage — the photo gets the carousel's own shape, exactly like the app. */
.show { width: 100%; display: flex; flex-direction: column; align-items: center; }
.show[hidden] { display: none; }

.stage {
  position: relative;
  width: min(100%, calc(66dvh * var(--ar, 0.8)));
  aspect-ratio: var(--ar, 0.8);
  overflow: hidden;
  flex: none;
}
.pager {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pager::-webkit-scrollbar { display: none; }
.page {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: center;
  position: relative;
  background: #000;
}
.page img, .page video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.page .broken {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
  padding: 24px; text-align: center;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
}

.scrim {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 92px;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.45));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.scrim.on { opacity: 1; }

.indicator {
  position: absolute;
  left: 0; right: 0; bottom: 14px;
  display: flex; align-items: center;
  padding: 0 18px;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.dots { display: flex; gap: 6px; margin: 0 auto; }
.dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transition: all 0.2s ease;
}
.dot.on { width: 7px; height: 7px; background: #fff; }
.counter {
  position: absolute; right: 18px;
  font-size: 0.72rem; font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,0.9);
}

.words {
  width: min(100%, calc(66dvh * var(--ar, 0.8)));
  padding: 18px 22px calc(20px + env(safe-area-inset-bottom));
  text-align: left;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.words.off { opacity: 0; transform: translateY(10px); pointer-events: none; }
.words h2 { font-size: 1.05rem; margin-bottom: 8px; }
.words p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.65;
  color: rgba(255,255,255,0.85);
  white-space: pre-wrap;
  max-height: 26dvh;
  overflow-y: auto;
}

.banner {
  position: absolute;
  left: 12px; right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(140, 30, 20, 0.92);
  font-size: 0.84rem;
  line-height: 1.5;
  z-index: 4;
}
.banner[hidden] { display: none; }
