/* ===== Unified Popup — /content/ 통합 뷰어 =====
   ?newpopup=1 URL 플래그로 활성화. 기존 팝업 CSS와 충돌 방지 위해 .up- 프리픽스 사용. */

.up-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 41, 0.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  opacity: 0;
  pointer-events: none;
  /* transition 거의 즉시 — 페이드인 중 반투명 overlay로 뒤 페이지가 비쳐 회색 단계 보이는 거 방지 */
  transition: opacity 0.05s;
}
.up-overlay.up-open { opacity: 1; pointer-events: auto; }
.up-container {
  flex: 1;
  display: flex;
  background: #faf8f7;
  transform: scale(0.985);
  transition: transform 0.2s;
}
.up-overlay.up-open .up-container { transform: scale(1); }

.up-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 96px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.up-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

/* Type-specific renderers */
/* 영상 로딩 스피너 — 첫 frame 그려지기 전까지 흰 마스크 위에 표시 */
.up-video-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e8e2df;
  border-top-color: #5d7dbb;
  border-radius: 50%;
  animation: up-video-spin 0.8s linear infinite;
}
@keyframes up-video-spin {
  to { transform: rotate(360deg); }
}

.up-content.up-full-video {
  aspect-ratio: 1500 / 1875;
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  background: #fff;       /* 첫 클릭 시 newPlayer 만들기 전에 잠깐 비치는 색 — 흰색으로 */
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.up-content.up-full-video video,
.up-content.up-video video {
  display: block;
  position: absolute !important;  /* 부모 강제 채움 — flex/inline 영향 차단 */
  /* 1px 오버스캔 — aspect-ratio로 컨테이너 폭이 소수점일 때 생기는
     서브픽셀 이음새(오른쪽/아래 검은 선) 제거. 부모 overflow:hidden이 넘친 1px 잘라냄 */
  top: -1px !important;
  left: -1px !important;
  width: calc(100% + 2px) !important;
  height: calc(100% + 2px) !important;
  object-fit: cover;
  object-position: center center;
  background: #fff;       /* 이음새가 비쳐도 흰 캔버스와 동일색 — 검정 선 방지 */
}
.up-content.up-video {
  aspect-ratio: 1 / 1;
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  background: #fff;       /* 흰색 — 일반 영상 캔버스와 동일색, 빈 공간 검정 차단 */
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
/* 일반 영상 anim-container — absolute + center로 부모 안 가운데, 자기 비율 유지 */
.up-content.up-video .anim-container,
.up-content.up-full-video .anim-container {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: auto !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
}
.up-content.up-page {
  /* 단일페이지 — 영상과 동일한 방식 (세로 기준, 정사각) — 단 흰 배경 */
  aspect-ratio: 1 / 1;
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.up-content.up-topic {
  display: block;
  max-width: 720px;
  height: 100%;
  width: 100%;
  background: #fff;
  color: #2d2a29;
  padding: 44px 56px;
  border-radius: 12px;
  overflow-y: auto;
}
.up-content.up-article {
  display: block;
  /* 영상과 동일하게 세로 기준 + 정사각 비율로 — 가로 크기 자동 매칭 */
  aspect-ratio: 1 / 1;
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  color: #2d2a29;
  padding: 44px 56px;
  border-radius: 12px;
  overflow-y: auto;
}
/* 책형식 본문 — 영상 팝업과 동일하게 정사각형을 패딩 없이 꽉 채움 */
.up-content.up-article.up-book {
  padding: 0;
  overflow: hidden;
}
.up-content.up-article.up-book #upBookPane,
.up-content.up-article.up-book .book-fit {
  width: 100%;
  height: 100%;
}
.up-content.up-article.up-book .book-page {
  box-shadow: none;
  border-radius: 0;
}
.up-content.up-tip {
  display: block;
  max-width: 540px;
  max-height: 100%;
  width: 100%;
  background: #fff;
  color: #2d2a29;
  padding: 36px 40px;
  border-radius: 12px;
  overflow-y: auto;
}
.up-content.up-muscle,
.up-content.up-bone {
  max-width: 440px;
  max-height: 100%;
  width: 100%;
  background: #fff;
  color: #2d2a29;
  padding: 36px 40px;
  border-radius: 12px;
  overflow-y: auto;
  gap: 18px;
}

.up-loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  height: 100%;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  background: linear-gradient(135deg, #5d7dbb, #4a6699);
  gap: 8px;
}

/* Topic / Article 본문 */
.up-content.up-topic h1,
.up-content.up-article h1 { font-size: 20px; font-weight: 500; margin: 0 0 6px; line-height: 1.3; }
.up-content.up-article .up-article-sub { font-size: 15px; color: #6b6562; margin-bottom: 22px; line-height: 1.5; }
.up-content.up-topic .up-topic-sub { font-size: 12px; color: #6b6562; margin-bottom: 22px; }
.up-content.up-topic h2,
.up-content.up-article h2 { font-size: 16px; margin: 22px 0 8px; }
.up-content.up-topic p,
.up-content.up-article p { font-size: 14px; line-height: 1.85; margin: 0 0 12px; }
.up-content.up-topic b,
.up-content.up-article b { color: #bb5d5d; }

/* 본문 각주 마커 + 출처 목록 */
.up-content.up-article sup.ref-mark {
  color: #6e809d; font-weight: 700; font-size: 0.7em; cursor: pointer;
  padding: 0 1px; vertical-align: super; line-height: 0;
}
.up-content.up-article sup.ref-mark:hover { text-decoration: underline; }
.up-content.up-article .up-refs {
  margin-top: 28px; padding-top: 16px; border-top: 1px solid #e8e6e3;
}
.up-content.up-article .up-refs-title {
  font-size: 13px; font-weight: 700; color: #6b6562; margin-bottom: 10px;
}
.up-content.up-article .up-refs-list {
  margin: 0; padding-left: 22px; font-size: 12.5px; color: #6b6562; line-height: 1.65;
}
.up-content.up-article .up-ref-item { margin-bottom: 7px; }
.up-content.up-article .up-ref-claim { color: #2d2a29; }
.up-content.up-article .up-refs-list a { color: #6e809d; word-break: break-all; }
.up-content.up-article .up-ref-flash { background: #fff3cd; border-radius: 4px; transition: background 0.3s; }

/* Tip 카드 */
.up-tip-quote { font-size: 56px; font-weight: 800; color: #bb8d5d; line-height: 1; margin: 0 0 18px; }
.up-tip-body { font-size: 18px; font-weight: 600; line-height: 1.55; margin: 0 0 14px; }
.up-tip-body em { color: #bb8d5d; font-style: normal; font-weight: 700; }
.up-tip-foot { font-size: 12px; color: #6b6562; border-top: 1px solid #e8e2df; padding-top: 12px; margin-bottom: 22px; }
.up-tip-context { font-size: 13.5px; line-height: 1.8; color: #2d2a29; }
.up-tip-context p { margin: 0 0 10px; }
.up-tip-context b { color: #bb8d5d; }

/* 사전 */
.up-dict-image-box {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  padding: 12px;
}
.up-dict-image-box.muscle { background: linear-gradient(135deg, #bb5d5d, #994a4a); }
.up-dict-image-box.bone { background: linear-gradient(135deg, #5d7d7d, #4a6464); }
.up-dict-imgwrap { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.up-dict-img { width: 100%; max-width: 280px; border-radius: 12px; display: block; }
.up-dict-layerbox { position: relative; width: 100%; max-width: 280px; }
.up-dict-layerbox .up-dict-layer { width: 100%; border-radius: 12px; display: block; }
.up-dict-layerbox .up-dict-musc { position: absolute; top: 0; left: 0; }
.up-dict-slider { width: 100%; max-width: 280px; accent-color: #bb5d5d; cursor: pointer; }
.up-dict-name { font-size: 24px; margin: 0; text-align: center; font-weight: 700; }
.up-dict-old { font-size: 13px; color: #6b6562; text-align: center; margin-top: 2px; }
.up-dict-latin { font-size: 12px; color: #999; text-align: center; font-style: italic; }
.up-dict-desc { font-size: 14px; line-height: 1.8; margin-top: 10px; }

/* ===== 사전 팝업: 영상처럼 정사각형 + 오른쪽 정보열 숨김 (핫스팟만 표시) ===== */
.up-container:has(.up-content.up-muscle) .up-right,
.up-container:has(.up-content.up-bone) .up-right { display: none; }
.up-content.up-muscle,
.up-content.up-bone {
  aspect-ratio: 1 / 1;
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  padding: 0;
  gap: 0;
  background: #efeae7;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
/* 정사각형엔 이미지+핫스팟만 (이름/설명 텍스트 숨김) */
.up-content.up-muscle > :not(.up-dict-imgwrap),
.up-content.up-bone > :not(.up-dict-imgwrap) { display: none; }
.up-content.up-muscle .up-dict-imgwrap,
.up-content.up-bone .up-dict-imgwrap {
  width: 100%; height: 100%; gap: 0;
  display: flex; align-items: center; justify-content: center;
}
/* 세로형 이미지를 정사각형 안에 contain + 핫스팟 오버레이 정렬 */
.up-dict-fit { position: relative; max-width: 100%; max-height: 100%; margin: auto; }
.up-dict-fit .up-dict-img { display: block; width: 100%; height: 100%; max-width: none; border-radius: 0; }
.up-dict-fit .up-dict-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* 정보 패널 접기 — 기본은 접어서 콘텐츠가 화면을 꽉 쓰게 한다.
   다시 펴는 토글(#upPanelToggle)은 관리자에게만 보인다(.up-admin). */
.up-container.up-collapsed .up-right { display: none; }
/* ★플로팅 바 — 우상단에 [카운터 · 메모 · 저장 · (관리자)토글 · ×] 한 줄.
   일반 독자는 사이드바가 항상 접혀 헤더의 메모/저장 버튼을 못 보므로 여기가 실제 입구다.
   버튼을 낱개 absolute로 두면 조합(관리자/비관리자)마다 right 값이 어긋난다 → flex 한 줄로. */
.up-float-bar {
  position: absolute; top: 14px; right: 16px; z-index: 30;
  display: flex; align-items: center; gap: 8px;
}
/* 튀지 않게 — 헤더 아이콘(.up-icon-btn)과 같은 연회색 + 가는 선 + 옅은 그림자.
   진한 색·굵은 스트로크로 두면 콘텐츠보다 버튼이 먼저 눈에 들어온다(실제 지적됨). */
.up-float-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid #e8e2df; background: rgba(255,255,255,.85);
  color: #999; font-size: 17px; line-height: 1; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  padding: 0;
  box-shadow: 0 1px 5px rgba(0,0,0,.06);
  transition: background .15s, color .15s, border-color .15s;
}
.up-float-btn:hover { background: #fff; color: #4a4442; border-color: #cfc8c4; }
.up-float-btn svg { width: 17px; height: 17px; pointer-events: none; stroke-width: 1.6; }
#upPanelToggle { font-size: 16px; }
#upPanelToggle.up-admin { display: flex; }          /* 관리자에게만 */
/* 접었을 땐 패널(헤더 버튼들)이 사라지므로 ×·메모·저장을 플로팅으로 대체 제공 */
.up-container.up-collapsed #upFloatClose,
.up-container.up-collapsed #upFloatMemo,
.up-container.up-collapsed #upFloatSave { display: flex; }
/* 활성 표시 — 헤더 버튼과 같은 색 규칙(메모=오렌지, 저장=빨강).
   .saved는 폴더 픽커(app.js updateAllSaveButtons)가 앵커 버튼에 즉시 토글하는 클래스 —
   안 잡아 주면 담는 순간엔 색이 안 바뀌고 다음 렌더에야 바뀐다. */
#upFloatMemo.active { background: #c9a55d; border-color: #c9a55d; color: #fff; }
#upFloatSave.active, #upFloatSave.saved { background: #bb5d5d; border-color: #bb5d5d; color: #fff; }
#upFloatSave.active svg, #upFloatSave.saved svg { fill: #fff; }

/* Right panel */
.up-right {
  width: 360px;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid rgba(0,0,0,0.06);
}
.up-right-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid #e8e2df;
  position: relative;
}
.up-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid #e8e2df;
  background: #fff;
  cursor: pointer;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: #6b6562;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.up-close-btn:hover { border-color: #2d2a29; color: #2d2a29; }

/* 헤더 액션 버튼 (메모 / 저장) — 기존 video-popup 스타일과 동일 */
.up-header-actions {
  position: absolute;
  top: 10px;
  right: 52px;
  display: flex;
  gap: 6px;
}
.up-icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #e8e2df;
  background: #fff;
  cursor: pointer;
  border-radius: 50%;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.12s;
}
.up-icon-btn svg { width: 18px; height: 18px; color: #999; }

/* 메모 버튼 — 오렌지(warning) */
.up-icon-btn#upMemoBtn:hover { border-color: #c9a55d; color: #c9a55d; }
.up-icon-btn#upMemoBtn:hover svg { color: #c9a55d; }
.up-icon-btn#upMemoBtn.active { background: #c9a55d; border-color: #c9a55d; }
.up-icon-btn#upMemoBtn.active svg { color: #fff; }

/* 저장 버튼 — 빨강(primary) */
.up-icon-btn#upSaveBtn:hover { border-color: #bb5d5d; color: #bb5d5d; }
.up-icon-btn#upSaveBtn:hover svg { color: #bb5d5d; }
.up-icon-btn#upSaveBtn.active { background: #bb5d5d; border-color: #bb5d5d; }
.up-icon-btn#upSaveBtn.active svg { color: #fff; fill: #fff; }

.up-icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* 영상 프롬프트 복사 툴바 (검수/관리자만) — 본문 검수 툴바와 같은 줄 스타일 */
.up-vid-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  margin: 0 0 12px;
  background: #fbf8f2;
  border: 1px solid #e6dcc2;
  border-radius: 8px;
}
.up-vid-toolbar .up-vt-label { font-size: 11px; color: #9a8c66; font-weight: 700; margin-right: 2px; }
.up-vid-toolbar button {
  border: 1px solid #d8c89a;
  background: #fff;
  color: #6b5d33;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s;
}
.up-vid-toolbar button:hover { background: #c9a55d; border-color: #c9a55d; color: #fff; }
.up-vid-toolbar button.up-vt-both { background: #6b5d33; border-color: #6b5d33; color: #fff; }
.up-vid-toolbar button.up-vt-both:hover { background: #534826; }

/* Inline expand 패널 (저장/메모) */
.up-expand-panel {
  background: #faf8f7;
  border-bottom: 1px solid #e8e2df;
  padding: 14px 22px;
  display: none;
}
.up-expand-panel.open { display: block; }
.up-expand-panel h4 {
  font-size: 11px;
  font-weight: 700;
  color: #999;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.up-expand-empty { font-size: 12px; color: #999; padding: 8px 0; }
.up-expand-hint { font-size: 11px; color: #c9a55d; margin-top: 6px; }

.up-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: white;
  margin-bottom: 8px;
}
.up-title { font-size: 16px; font-weight: 700; margin: 0; line-height: 1.4; padding-right: 140px; color: #2d2a29; }
.up-subtitle { font-size: 11.5px; color: #6b6562; margin-top: 4px; }

.up-right-body { flex: 1; overflow-y: auto; padding: 16px 22px 24px; }

.up-meta-row {
  display: flex;
  font-size: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #e8e2df;
  align-items: flex-start;
}
.up-meta-row:last-child { border-bottom: none; }
.up-meta-row .up-meta-key { width: 80px; color: #6b6562; flex-shrink: 0; }
.up-meta-row .up-meta-val { flex: 1; color: #2d2a29; word-break: break-word; }
.up-tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.up-tag { display: inline-block; font-size: 10.5px; padding: 2px 7px; background: #f5f1ef; border-radius: 3px; color: #6b6562; }

.up-section-divider {
  font-size: 10.5px;
  font-weight: 700;
  color: #999;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 22px 0 10px;
}

.up-memo-mini-textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid #e8e2df;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: #2d2a29;
  resize: vertical;
  background: #fff;
  outline: none;
  line-height: 1.55;
}
.up-memo-mini-textarea:focus { border-color: #bb5d5d; }
.up-memo-mini-textarea:disabled { background: #f5f1ef; color: #999; cursor: not-allowed; }
.up-memo-mini-status { font-size: 10.5px; color: #999; text-align: right; min-height: 14px; margin-top: 4px; }
.up-memo-mini-status.saved { color: #5d9b6d; }
.up-memo-mini-status.saving { color: #5d7dbb; }
.up-memo-mini-status.error { color: #bb5d5d; }

.up-folder-mini-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.up-folder-mini-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e8e2df;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  color: #2d2a29;
  transition: background 0.1s, border-color 0.1s;
}
.up-folder-mini-item:hover { background: #f5f1ef; }
.up-folder-mini-item.included { background: rgba(187,93,93,0.08); border-color: #bb5d5d; color: #bb5d5d; font-weight: 600; }
.up-folder-mini-check {
  width: 16px;
  text-align: center;
  font-weight: 700;
}

.up-memo-textarea {
  width: 100%;
  min-height: 72px;
  border: 1px solid #e8e2df;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12.5px;
  color: #2d2a29;
  resize: vertical;
  background: #f5f1ef;
  outline: none;
  line-height: 1.55;
}
.up-memo-textarea:focus { border-color: #bb5d5d; background: #fff; }
.up-memo-status { font-size: 10.5px; color: #999; text-align: right; min-height: 14px; margin-top: 4px; }
.up-memo-status.saved { color: #5d9b6d; }
.up-memo-status.saving { color: #5d7dbb; }
.up-memo-status.error { color: #bb5d5d; }
.up-memo-status.no-auth { color: #c9a55d; }

.up-folder-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.up-folder-btn {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 10px;
  background: #f5f1ef;
  border: 1px solid #e8e2df;
  border-radius: 6px;
  color: #2d2a29;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.up-folder-btn:hover { background: #fff; border-color: #cfc8c4; }
.up-folder-btn.included { background: rgba(187,93,93,0.1); border-color: #bb5d5d; color: #bb5d5d; }
.up-folder-empty { font-size: 12px; color: #999; padding: 8px 0; }

/* 연관 콘텐츠 */
.up-conn-group { margin-bottom: 12px; }
.up-conn-group-label {
  font-size: 11px;
  color: #6b6562;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.up-conn-group-label::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c, #bb5d5d);
}
.up-conn-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px 6px;
  cursor: pointer;
  border-radius: 6px;
  margin: 0 -6px;
}
.up-conn-item:hover { background: #f5f1ef; }
.up-conn-thumb {
  width: 34px;
  height: 34px;
  border-radius: 5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
}
.up-conn-text { font-size: 12px; color: #2d2a29; line-height: 1.35; }

/* URL pill / counter — 카운터는 플로팅 바 안 첫 칸(버튼들과 flex로 나란히, 겹침 걱정 없음) */
.up-url-bar { display: none; }
.up-counter {
  font-size: 11px;
  font-family: 'SF Mono', Menlo, monospace;
  color: #6b6562;
  background: rgba(255,255,255,0.9);
  border: 1px solid #e8e2df;
  padding: 5px 10px;
  border-radius: 5px;
}
.up-counter:empty { display: none; }   /* 순회 목록이 1개면 빈 알약이 남지 않게 */

/* Nav arrows */
.up-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 72px;
  border: 1px solid #e8e2df;
  background: rgba(255, 255, 255, 0.9);
  color: #2d2a29;
  cursor: pointer;
  border-radius: 8px;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background 0.12s, box-shadow 0.12s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.up-nav-arrow:hover { background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,0.12); }
.up-nav-arrow.prev { left: 16px; }
.up-nav-arrow.next { right: 16px; }
.up-nav-arrow:disabled { opacity: 0.25; cursor: default; box-shadow: none; }
.up-nav-arrow:disabled:hover { background: rgba(255, 255, 255, 0.9); box-shadow: none; }

/* Flag indicator — 기본 활성이라 일반 사용자에겐 안 보이게 */
.up-flag-indicator { display: none; }

/* ── ★세로 화면(폰·아이패드 세로) — 정사각/비율 콘텐츠는 '폭 기준'으로 잡는다 ──
   기본 규칙(height:100% + width:auto)은 가로 화면용이다. 세로 화면에서 그대로 두면
   높이 100%로 잡힌 정사각이 max-width:100%에 눌려 비율이 깨지고, 안쪽 영상/이미지
   (object-fit:cover)가 확대되어 좌우가 잘려 나간다(실제 지적됨 — 아이패드 세로에서
   오른쪽이 잘린 채 떴다). orientation으로 가르므로 아이패드 가로·가로 폰은 기존대로. */
@media (orientation: portrait) {
  .up-content.up-video, .up-content.up-full-video, .up-content.up-page,
  .up-content.up-article, .up-content.up-muscle, .up-content.up-bone {
    width: 100%; height: auto; max-height: 100%;
  }
}

/* ── 태블릿(아이패드) — 좌우 여백 축소, 콘텐츠가 화면을 더 쓰게 ── */
@media (max-width: 1100px) {
  .up-left { padding: 24px 72px; }
}

@media (max-width: 760px) {
  .up-container { flex-direction: column; }
  .up-left { padding: 12px 16px; min-height: 45vh; max-height: 55vh; }
  /* ★사이드바 접힘(일반 독자 기본)에선 콘텐츠 영역이 세로 전체를 쓴다 —
     예전엔 max-height:55vh가 그대로 남아 화면 아래 절반이 빈 회색으로 떴다(실제 지적됨).
     아이폰 홈바/노치는 safe-area로 피한다. */
  .up-container.up-collapsed .up-left {
    max-height: none; min-height: 0; flex: 1;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  /* 읽는 콘텐츠(책형식 아닌 본문·토픽·팁)는 정사각 대신 세로를 꽉 채워 읽기 편하게.
     아래 화살표가 떠 있으므로 본문 끝이 가리지 않게 바닥 여백을 넉넉히 */
  .up-content.up-article:not(.up-book), .up-content.up-topic, .up-content.up-tip {
    aspect-ratio: auto; width: 100%; height: 100%; max-width: none; padding: 24px 20px 84px;
  }
  /* up-page·사전(muscle/bone)은 영상처럼 fit — padding 없음 */
  .up-right { width: 100%; max-height: 55vh; border-left: none; border-top: 1px solid #e8e2df; }
  /* ★화살표는 콘텐츠 '옆'이 아니라 '아래' — 옆에 두면 그 폭+패딩만큼 정사각이 작아진다(실제 지적됨).
     콘텐츠는 위쪽 정렬이 아니라 가운데라 아래 공간이 남고, 거기에 ‹ › 두 개를 나란히 둔다. */
  .up-nav-arrow {
    top: auto; transform: none;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    width: 64px; height: 44px; font-size: 22px;
  }
  .up-nav-arrow.prev { left: calc(50% - 72px); }
  .up-nav-arrow.next { right: calc(50% - 72px); }
  .up-float-bar { top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; }
}
