/* v2 — 썸네일 구간 선택 */
:root {
  --v2-highlight: #e0ff00;
  --v2-ink: #282828;
  --v2-primary: #282828;
  --v2-primary-soft: #ebebeb;
  --v2-border: #c8c8c8;
  /* 상단 헤더 구분선 (앱 본문 --v2-border 등과 분리) */
  --v2-nav-line: #e6e6e6;
  --v2-nav-pad-x: max(22px, calc((100vw - 1280px) / 2 + 22px));
  --v2-text: #282828;
  --v2-muted: #6e6e6e;
  --v2-thumb-w: 156px;
  --v2-thumb-gap: 14px;
  --v2-range: rgba(224, 255, 0, 0.22);
  --v2-range-border: #282828;
  --v2-accent: #e0ff00;
}

@media (max-width: 720px) {
  :root {
    --v2-nav-pad-x: 14px;
  }

  .v2-app--at-home .v2-header {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .v2-home-inner {
    padding-left: 14px;
    padding-right: 14px;
  }
}

html {
  height: 100%;
}

.body-v2 {
  margin: 0;
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'Roboto', -apple-system, sans-serif;
  font-size: 14px;
  color: var(--v2-text);
  background-color: #f5f5f5;
}

.hidden { display: none !important; }

.v2-auth-gate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 245, 245, 0.92);
}

.v2-auth-gate__card {
  text-align: center;
  color: var(--v2-muted);
  font-size: 14px;
}

.v2-auth-gate__card .spinner {
  margin: 0 auto 12px;
}

.v2-app--auth-loading {
  visibility: hidden;
}

.v2-header-auth {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.v2-user-menu {
  position: relative;
}

.v2-header .v2-user-trigger {
  padding: 0 0 0 4px;
}

.v2-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(52vw, 340px);
  margin: 0;
  padding: 4px 0 4px 4px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--v2-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.v2-user-avatar {
  width: 21px;
  height: 21px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
  flex-shrink: 0;
}

.v2-user-trigger:hover {
  background: transparent;
  text-underline-offset: 3px;
}

.v2-user-trigger:focus-visible {
  outline: 2px solid rgba(224, 255, 0, 0.65);
  outline-offset: 2px;
}

.v2-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}

.v2-header .v2-user-name {
  line-height: 21px;
}

.v2-user-caret {
  color: var(--v2-muted);
  font-size: 12px;
  line-height: 1;
}

.v2-user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 210px;
  background: #fff;
  border: 1px solid var(--v2-border);
  border-radius: 10px;
  padding: 6px;
  z-index: 1000;
}

.v2-user-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border-radius: 8px;
  color: #334155;
  font-size: 13px;
  text-decoration: none;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
}

.v2-user-item:hover {
  background: #ececec;
}

.v2-user-item--button {
  font: inherit;
}

.v2-user-sep {
  height: 1px;
  background: #e5e7eb;
  margin: 6px 6px;
}

.v2-header-admin {
  font-size: 13px;
  color: var(--v2-text);
  text-decoration: none;
  font-weight: 500;
}
.v2-header-admin:hover {
  color: var(--v2-ink);
}

.v2-header-admin:hover {
  text-decoration: underline;
}

.v2-app {
  --v2-app-pad-x: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 var(--v2-app-pad-x) 8px;
  box-sizing: border-box;
  min-height: 0;
  overflow: hidden;
  max-height: 100%;
}

/* 홈: 좌우 패딩 없음 → 헤더 보더가 뷰포트 끝까지. 본문·헤더 안쪽은 --v2-nav-pad-x */
.v2-app--at-home {
  padding: 0 0 10px;
}

.v2-site-footer {
  flex-shrink: 0;
  padding: 12px 16px 14px;
  text-align: center;
  font-size: 11px;
  color: var(--v2-muted);
  letter-spacing: 0.02em;
}

.v2-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--v2-nav-line);
  /* 파트너 .nav-inner: 상하 14px + 한 줄 21px(로고) → 보이는 높이 49px + 보더 1px */
  padding-top: 14px;
  padding-bottom: 14px;
  padding-left: 0;
  padding-right: 0;
}

/* .v2-app 좌우 패딩 때문에 보더가 짧아지지 않게 — 선만 뷰포트 폭까지, 안쪽은 본문과 같은 인셋 */
.v2-app:not(.v2-app--at-home) .v2-header {
  margin-left: calc(-1 * var(--v2-app-pad-x));
  margin-right: calc(-1 * var(--v2-app-pad-x));
  padding-left: var(--v2-app-pad-x);
  padding-right: var(--v2-app-pad-x);
}

.v2-app--at-home .v2-header {
  width: 100%;
  margin-bottom: 12px;
  padding-left: var(--v2-nav-pad-x);
  padding-right: var(--v2-nav-pad-x);
}

.v2-header-brand {
  display: none;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: nowrap;
  min-width: 0;
  line-height: 1.2;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.v2-header-brand:hover {
  opacity: 0.88;
}

.v2-app--at-home .v2-header-brand {
  display: flex;
}

.v2-header-logo {
  display: block;
  height: 21px;
  width: auto;
  flex-shrink: 0;
}

.v2-header-brand-name {
  font-family: "Outfit", "Roboto", sans-serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  margin-bottom: -2px;
  color: var(--v2-text);
  letter-spacing: -0.02em;
}

.v2-header-start {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.v2-header-work {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.v2-header-back {
  flex-shrink: 0;
}

.v2-header-mode {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--v2-text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--v2-ink);
  color: #fff;
}

.v2-filename {
  font-size: 12px;
  color: var(--v2-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v2-header-filename {
  flex: 1;
  min-width: 0;
  margin-left: 16px;
  text-align: right;
}

.v2-screen { }

.v2-home,
.v2-placeholder {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.v2-merge-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  margin: 0 -16px;
  width: calc(100% + 32px);
}

.v2-merge-layout {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 0;
  gap: 0;
}

.v2-merge-pane-left {
  width: min(420px, 42vw);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--v2-border);
  background: #fff;
}

.v2-merge-pane-left-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  min-height: 0;
  transition: background 0.15s ease;
}

.v2-merge-pane-top {
  flex-shrink: 0;
  padding: 12px 14px 0;
}

.v2-merge-pane-bottom {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 20px;
}

.v2-merge-pane-left-inner.v2-merge-drop-target--over {
  background: rgba(224, 255, 0, 0.12);
  outline: 2px solid var(--v2-accent);
  outline-offset: -2px;
}

.v2-merge-pane-lead {
  font-size: 13px;
  line-height: 1.5;
}

.v2-merge-pane-desc {
  list-style: disc;
  padding-left: 1.35em;
}

.v2-merge-pane-desc li {
  margin-top: 0.35em;
}

.v2-merge-pane-desc li:first-child {
  margin-top: 0;
}

/* 합치기: 업로드 화면과 같은 드롭 영역(이 화면 전체는 기존처럼 드롭 가능) */
.v2-merge-dropzone {
  border: 2px dashed #e6e6e6;
  border-radius: 14px;
  padding: 28px 20px;
  margin-bottom: 14px;
  text-align: center;
  background: #fff;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
  cursor: pointer;
}

.v2-merge-dropzone:hover,
.v2-merge-dropzone.drag-over {
  border-color: var(--v2-primary);
  background: var(--v2-primary-soft);
}

.v2-merge-dropzone-label {
  margin: 0 0 12px;
  color: var(--v2-muted);
  font-size: 14px;
}

.v2-merge-dropzone-hint {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--v2-muted);
}

.v2-merge-dropzone-hint kbd {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--v2-border);
  background: #fff;
  font-family: inherit;
}

.v2-merge-pane-viewer {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.v2-merge-pane-viewer-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: auto;
  position: relative;
}

.v2-merge-viewer-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--v2-border);
  background: #fff;
}

.v2-merge-viewer-footer .v2-page-label {
  color: var(--v2-text);
}

.v2-modal__merge-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 10px;
  width: 100%;
}

.v2-modal__merge-actions .btn {
  width: 100%;
  flex: 0 0 auto;
  min-width: 0;
}

.v2-merge-viewer-empty {
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--v2-muted);
  max-width: 280px;
  line-height: 1.5;
}

.v2-merge-viewer-canvas-wrap {
  padding: 16px;
  box-sizing: border-box;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#v2-merge-viewer-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--v2-border);
  border-radius: 2px;
  background: #fff;
}

.v2-merge-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 16px;
}

#v2-merge-run-btn.btn-primary:disabled {
  opacity: 1;
  background: #d4d4d4;
  color: #737373;
  cursor: not-allowed;
  filter: none;
}

.v2-merge-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.v2-merge-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid var(--v2-border);
  border-radius: 10px;
  font-size: 13px;
}

.v2-merge-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-merge-item-pages {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--v2-muted);
}

.v2-merge-item-actions {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}

.v2-merge-item-top {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.v2-merge-pages-panel {
  margin: 0;
  padding: 8px 10px 10px;
  background: #fff;
  border: 1px dashed var(--v2-border);
  border-radius: 8px;
}

.v2-merge-pages-hint {
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--v2-muted);
  line-height: 1.35;
}

.v2-merge-pages-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v2-merge-page-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.v2-merge-page-label {
  min-width: 2.5rem;
  color: var(--v2-fg, #282828);
}

.v2-merge-page-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.v2-merge-reset-pages {
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  font-size: 11px;
  color: var(--v2-accent);
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
}

.v2-merge-reset-pages:hover {
  opacity: 0.85;
}

.v2-merge-reset-pages:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.v2-merge-preview {
  margin-top: 4px;
}

.v2-merge-file-chips {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 0;
  min-height: 0;
}

.v2-merge-file-chips.v2-merge-file-chips--drag-active {
  outline: 1px dashed var(--v2-border);
  border-radius: 10px;
  padding: 4px;
  margin: -4px -4px 8px -4px;
}

.v2-merge-file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--v2-border);
  width: 100%;
  box-sizing: border-box;
  cursor: grab;
  user-select: none;
}

.v2-merge-file-chip:active {
  cursor: grabbing;
}

.v2-merge-file-chip--dragging {
  opacity: 0.55;
}

.v2-merge-file-chip-drop-end {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--v2-muted);
  border-radius: 8px;
  box-sizing: border-box;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.v2-merge-file-chip-drop-end--active {
  background: rgba(224, 255, 0, 0.15);
  color: var(--v2-ink);
  outline: 1px dashed var(--v2-accent);
}

.v2-merge-file-chip-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-merge-file-chip-remove {
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: 11px;
  border: none;
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
  cursor: pointer;
  font-family: inherit;
}

.v2-merge-file-chip-remove:hover {
  background: #fecaca;
}

.v2-merge-thumb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-height: 48px;
  overflow: visible;
  padding: 14px 14px 0;
  border-top: 1px solid var(--v2-nav-line);
}

.v2-merge-pane-bottom .v2-merge-error {
  margin-left: 14px;
  margin-right: 14px;
}

.v2-merge-thumb-list.v2-merge-thumb-list--drag-over {
  outline: 2px dashed var(--v2-accent);
  outline-offset: 4px;
  border-radius: 10px;
}

.v2-merge-thumb-card {
  position: relative;
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid var(--v2-border);
  background: #fff;
  cursor: grab;
  user-select: none;
  overflow: visible;
  transition: border-color 0.12s ease;
}

.v2-merge-thumb-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.v2-merge-thumb-thumb {
  position: relative;
  flex-shrink: 0;
}

.v2-merge-thumb-card:active {
  cursor: grabbing;
}

.v2-merge-thumb-card--selected {
  border-color: var(--v2-accent);
}

.v2-merge-thumb-card--dragging {
  opacity: 0.45;
}

.v2-merge-thumb-canvas-wrap {
  position: relative;
  width: 88px;
  height: 112px;
  border-radius: 6px;
  overflow: hidden;
  background: #dcdcdc;
}

.v2-merge-thumb-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.v2-merge-thumb-meta {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--v2-muted);
  word-break: break-word;
}

.v2-merge-thumb-meta-detail {
  margin-top: 4px;
  font-size: 11px;
  color: var(--v2-muted);
}

.v2-merge-thumb-file {
  font-weight: 600;
  color: var(--v2-fg, #282828);
  font-size: 11px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.v2-merge-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--v2-border);
  border-radius: 6px;
  background: #fff;
  color: var(--v2-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.v2-merge-thumb-remove:hover {
  background: #fee2e2;
  color: #7f1d1d;
}

.v2-merge-thumb-drop-end {
  width: 100%;
  min-height: 36px;
  border-radius: 8px;
  border: 1px dashed transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--v2-muted);
}

.v2-merge-thumb-drop-end.v2-merge-thumb-drop-end--active {
  border-color: var(--v2-accent);
  background: rgba(224, 255, 0, 0.1);
}

/* 좌우는 고정 여백만 — --v2-nav-pad-x 는 뷰포트 풀폭 헤더용이라 여기에 쓰면
   max-width(960px) 안에서 패딩이 수백 px씩 잡혀 카드 그리드가 찌그러짐 */
.v2-home-inner {
  max-width: 960px;
  margin: 8px auto 56px;
  padding: clamp(36px, 8vh, 72px) 22px 0;
  box-sizing: border-box;
}

.v2-home-top {
  display: grid;
  gap: 28px;
  align-items: center;
  margin-bottom: 36px;
}

@media (min-width: 768px) {
  .v2-home-top {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
    gap: 36px 44px;
    margin-bottom: 34px;
    align-items: start;
  }
}

/* 맥북 13인치급(약 1024~1440×700~900): 히어로·타이포 균형 */
@media (min-width: 1024px) and (max-width: 1440px) {
  .v2-home-inner {
    max-width: 1000px;
    padding-left: 32px;
    padding-right: 32px;
    padding-top: clamp(40px, 7vh, 64px);
  }

  .v2-home-top {
    gap: 32px 40px;
    margin-bottom: 38px;
  }

  .v2-home-headline {
    font-size: clamp(1.5rem, 2.15vw, 1.95rem);
    line-height: 1.26;
  }

  .v2-home-sub {
    font-size: 15px;
    max-width: 34em;
  }
}

@media (min-width: 1024px) and (max-width: 1440px) and (max-height: 820px) {
  .v2-home-inner {
    padding-top: 32px;
    margin-bottom: 40px;
  }

  .v2-home-top {
    margin-bottom: 28px;
  }
}

.v2-home-masthead {
  text-align: center;
  margin: 0 auto;
  max-width: 36rem;
}

@media (min-width: 768px) {
  .v2-home-masthead {
    text-align: left;
    margin: 0;
    max-width: none;
    padding-top: 2px;
  }

  .v2-home-trust {
    justify-content: flex-start;
  }
}

.v2-home-headline {
  margin: 0 0 16px;
  font-size: clamp(1.375rem, 3.8vw, 1.875rem);
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: -0.035em;
  color: var(--v2-text);
}

.v2-home-sub {
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.68;
  color: var(--v2-muted);
  letter-spacing: -0.02em;
}

.v2-home-trust {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 22px;
  font-size: 12px;
  font-weight: 500;
  color: var(--v2-muted);
  letter-spacing: -0.01em;
}

.v2-home-trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.v2-home-trust-item::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--v2-accent);
  opacity: 0.65;
  flex-shrink: 0;
}

.v2-home-hero {
  margin: 0 auto;
  max-width: 390px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--v2-border);
  background: #fff;
}

@media (min-width: 768px) {
  .v2-home-hero {
    margin: 0;
    max-width: none;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.v2-home-hero-svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 320 / 96;
}

.v2-home-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 20px;
  align-items: stretch;
}

@media (min-width: 640px) {
  .v2-home-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
  }
}

@media (max-width: 639px) {
  .v2-home-menu {
    grid-template-columns: 1fr;
    max-width: 360px;
    margin: 0 auto;
  }
}

.v2-home-menu > li {
  display: flex;
  min-height: 0;
}

.v2-home-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 0;
  box-sizing: border-box;
  text-align: center;
  padding: 28px 20px 22px;
  border: none;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.2s ease;
}

.v2-home-card:hover {
  transform: translateY(-1px);
}

.v2-home-card:focus-visible {
  outline: 2px solid rgba(224, 255, 0, 0.65);
  outline-offset: 2px;
}

.v2-home-card-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: #fff;
  border: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.v2-home-card:hover .v2-home-card-icon {
  background: rgba(224, 255, 0, 0.12);
  transform: scale(1.03);
}

.v2-home-card-icon svg {
  display: block;
  width: 38px;
  height: 38px;
}

.v2-home-card-title {
  display: block;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--v2-text);
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.v2-home-card-desc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 13px;
  line-height: 1.58;
  color: var(--v2-muted);
  text-align: center;
  margin: 0;
}

.v2-home-card-desc--list {
  align-items: stretch;
  gap: 7px;
  width: 100%;
  max-width: 19rem;
  margin-left: auto;
  margin-right: auto;
}

.v2-home-card-desc-li {
  display: flex;
  gap: 0.5em;
  align-items: flex-start;
  text-align: left;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.52;
  letter-spacing: -0.01em;
  color: var(--v2-muted);
}

.v2-home-card-desc-li::before {
  content: "";
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  margin-top: 0.5em;
  border-radius: 50%;
  background: #8a8a8a;
}

/* 업로드 화면 .btn.btn-primary 와 동일한 룩 (카드 전체가 버튼이므로 span 만 스타일) */
.v2-home-card-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  margin-left: auto;
  margin-right: auto;
  padding: 8px 16px;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--v2-ink);
  background: var(--v2-highlight);
  border: none;
  border-radius: 8px;
  transition: filter 0.15s ease, transform 0.2s ease;
}

.v2-home-card:hover .v2-home-card-cta {
  filter: brightness(0.96);
  color: var(--v2-ink);
}

.v2-home-card-cta-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.v2-home-card:hover .v2-home-card-cta-arrow {
  transform: translateX(4px);
}

.v2-upload-back-wrap {
  margin: 0 0 12px;
}

.v2-placeholder-card {
  margin-top: 24px;
}

.v2-work-layout--trim {
  grid-template-columns: 1fr !important;
}

.v2-work-layout--trim .v2-sidebar {
  display: none !important;
}

.v2-work-layout--trim .v2-viewer {
  min-height: min(70vh, 640px);
}

.v2-trim-bar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--v2-border);
  background: var(--v2-primary-soft);
}

.v2-trim-bar-left {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.v2-trim-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 2px;
}

.v2-trim-mode-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--v2-muted);
}

.v2-trim-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--v2-text);
  cursor: pointer;
}

.v2-trim-mode-option input {
  margin: 0;
  accent-color: var(--v2-ink);
}

.v2-trim-mode--disabled {
  opacity: 0.55;
  pointer-events: none;
}

.v2-trim-bar-lead {
  margin: 0;
  font-size: 13px;
  color: var(--v2-text);
  line-height: 1.45;
}

.v2-trim-bar-lead--sub {
  font-size: 12px;
  color: var(--v2-muted);
}

.v2-trim-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.btn.btn-ghost.v2-trim-bar-outline-btn {
  border: 1px solid #999;
  box-sizing: border-box;
}

.v2-work-layout--trim .textLayer {
  pointer-events: none !important;
}

.v2-trim-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.v2-trim-crop-frame {
  position: absolute;
  border: 2px solid var(--v2-accent);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.52);
  box-sizing: border-box;
  pointer-events: auto;
  cursor: move;
  touch-action: none;
}

.v2-trim-handle {
  position: absolute;
  width: 11px;
  height: 11px;
  background: #fff;
  border: 2px solid var(--v2-ink);
  border-radius: 2px;
  box-sizing: border-box;
  pointer-events: auto;
  z-index: 2;
  touch-action: none;
}

.v2-trim-handle[data-edge='nw'] {
  left: -6px;
  top: -6px;
  cursor: nwse-resize;
}
.v2-trim-handle[data-edge='n'] {
  left: 50%;
  top: -6px;
  transform: translateX(-50%);
  cursor: ns-resize;
}
.v2-trim-handle[data-edge='ne'] {
  right: -6px;
  top: -6px;
  cursor: nesw-resize;
}
.v2-trim-handle[data-edge='e'] {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}
.v2-trim-handle[data-edge='se'] {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}
.v2-trim-handle[data-edge='s'] {
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  cursor: ns-resize;
}
.v2-trim-handle[data-edge='sw'] {
  left: -6px;
  bottom: -6px;
  cursor: nesw-resize;
}
.v2-trim-handle[data-edge='w'] {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.v2-sidebar-meta .v2-meta-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v2-meta-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v2-meta-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--v2-muted);
}

.v2-meta-input,
.v2-meta-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--v2-border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--v2-text);
}

.v2-meta-textarea {
  resize: vertical;
  min-height: 52px;
}

.v2-meta-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 업로드 화면 이후 작업 UI — 테두리·라인 톤 (var(--v2-border) 사용처 일괄) */
#v2-work-screen,
#v2-merge-screen {
  --v2-border: #e6e6e6;
}

#v2-work-screen.v2-work {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#v2-upload-screen.v2-screen {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.v2-upload-card {
  max-width: 520px;
  margin: 40px auto;
  padding: 28px;
  background: #fff;
  border-radius: 16px;
  border: none;
}

.v2-step-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 8px;
}

.v2-step-lead {
  color: var(--v2-muted);
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0 0 20px;
}

.v2-dropzone {
  border: 2px dashed #e6e6e6;
  border-radius: 14px;
  padding: 36px 24px;
  text-align: center;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.v2-dropzone:hover,
.v2-dropzone.drag-over {
  border-color: var(--v2-primary);
  background: var(--v2-primary-soft);
}

.v2-dropzone-label {
  margin: 0 0 12px;
  color: var(--v2-muted);
  font-size: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--v2-highlight); color: var(--v2-ink); }
.btn-primary:not(:disabled):hover { filter: brightness(0.96); }
.btn-ghost {
  background: transparent;
  color: var(--v2-muted);
}
.btn-ghost:hover { background: var(--v2-border); color: var(--v2-text); }
/** 보조 액션 — primary·ghost와 구분되는 중립 톤 */
.btn-neutral {
  background: #f5f5f7;
  color: #282828;
  border: 1px solid #f5f5f7;
}
.btn-neutral:not(:disabled):hover {
  background: #e6e6e6;
  border-color: #e6e6e6;
  color: #282828;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--v2-border);
  border-radius: 8px;
}

.v2-error {
  margin-top: 14px;
  color: #dc2626;
  font-size: 13px;
}

/* work layout — 좌: 썸네일 / 우: 뷰어 를 각각 화면의 절반(1:1). 높이는 뷰포트에 맞추고 스크롤은 썸네일·캔버스 내부만 */
.v2-work-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

/* 3단계: 적용 UI — 설명 좌측, 버튼 우측(한 줄 라벨) */
.v2-viewer-toolbar .v2-apply-dock--toolbar {
  width: 100%;
  flex: 1;
  min-width: 0;
}
.v2-apply-dock--toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  min-width: 0;
}
.v2-apply-dock--toolbar .v2-apply-hint {
  flex: 1 1 120px;
  min-width: 0;
  margin: 0;
  text-align: left;
  font-size: 11px;
  line-height: 1.45;
  color: var(--v2-muted);
}
.v2-apply-dock--toolbar .v2-apply-page-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .v2-apply-dock--toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .v2-apply-dock--toolbar .v2-apply-hint {
    text-align: left;
  }
  .v2-apply-dock--toolbar .v2-apply-page-btn {
    width: 100%;
    text-align: center;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .body-v2 {
    max-height: none;
    min-height: 100vh;
    height: auto;
    overflow: auto;
  }
  .v2-app {
    overflow: visible;
    max-height: none;
  }
  .v2-work-layout {
    grid-template-columns: 1fr;
    overflow: visible;
    min-height: min(55vh, 520px);
  }
  .v2-work-layout .v2-sidebar {
    min-height: min(55vh, 520px);
    overflow: visible;
  }
  .v2-work-layout .v2-thumb-scroll {
    max-height: min(50vh, 480px);
  }
  .v2-work-layout .v2-toc-tree-scroll,
  .v2-work-layout .v2-edit-scroll {
    max-height: min(50vh, 480px);
  }
  .v2-work-layout .v2-viewer {
    min-height: min(45vh, 420px);
  }
}

.v2-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--v2-border);
  overflow: hidden;
}

.v2-step-block {
  flex-shrink: 0;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--v2-border);
}

.v2-step-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--v2-muted);
  margin-bottom: 6px;
}
.v2-step-badge--inline {
  margin-right: 8px;
  margin-bottom: 0;
  vertical-align: middle;
}

.v2-upload-policy {
  margin: 14px 0 0;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--v2-muted);
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
}
.v2-upload-policy-item {
  margin: 0 0 10px;
}
.v2-upload-policy-item:last-child {
  margin-bottom: 0;
}
.v2-upload-policy strong {
  color: var(--v2-text);
  font-weight: 600;
}

.v2-range-summary {
  margin: 10px 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--v2-primary);
}

.v2-range-actions { margin-bottom: 4px; }

.v2-thumb-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 16px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.v2-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--v2-thumb-w), 1fr));
  gap: var(--v2-thumb-gap);
  align-content: start;
}

.thumb-cell {
  position: relative;
  border: 2px solid var(--v2-border);
  border-radius: 8px;
  padding: 0;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  touch-action: none;
  transition: border-color 0.12s;
}
.thumb-cell:hover {
  border-color: #a3a3a3;
}
.thumb-cell.in-range {
  border-color: var(--v2-range-border);
  background: var(--v2-range);
}
.thumb-cell.provisional {
  opacity: 0.92;
}

.thumb-canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.thumb-num {
  display: block;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--v2-muted);
  padding: 6px 4px;
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--v2-border);
}

.thumb-cell.in-range .thumb-num {
  color: var(--v2-primary);
}

.v2-sidebar-footer {
  flex-shrink: 0;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--v2-border);
  background: #fff;
}

.v2-extract-btn,
.v2-download-btn {
  width: 100%;
  padding: 10px 14px;
}

.v2-footer-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.v2-footer-btn-row .btn {
  flex: 1 1 calc(50% - 4px);
  min-width: min(100%, 148px);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
}
.v2-footer-btn-row--single .btn {
  flex: 1 1 100%;
  min-width: 100%;
}

.v2-step-lead--toc {
  margin-top: 0;
  margin-bottom: 8px;
}

.v2-edit-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 12px 12px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

/* 헤더·행 각각 독립 그리드라 auto 열이 어긋남 → 동일 고정 열 + justify-self 로 정렬 */
.v2-edit-head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 52px 72px 56px 104px;
  gap: 8px;
  align-items: center;
  padding: 0 10px 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--v2-border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--v2-muted);
  text-transform: none;
}
.v2-edit-col--drag {
  min-width: 28px;
}
.v2-edit-col--title {
  min-width: 0;
  justify-self: start;
}
.v2-edit-col--level {
  justify-self: center;
  text-align: center;
}
.v2-edit-col--page {
  justify-self: center;
  text-align: center;
}
.v2-edit-col--action {
  justify-self: center;
  text-align: center;
  min-width: 0;
}
.v2-edit-col--goto {
  justify-self: center;
  text-align: center;
  min-width: 0;
}

.v2-edit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.v2-edit-add-row {
  margin-top: 12px;
  padding: 0 10px 4px;
}
.v2-edit-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 52px 72px 56px 104px;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--v2-border);
  border-radius: 8px;
  padding: 8px 10px;
  transition: opacity 0.15s ease;
}
.v2-edit-row.is-dragging {
  opacity: 0.55;
}
.v2-edit-row.is-drop-target {
  outline: 2px solid var(--v2-accent);
  outline-offset: -2px;
  border-radius: 8px;
}
.v2-edit-drag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 100%;
  min-height: 36px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--v2-muted);
  cursor: grab;
  border-radius: 6px;
  flex-shrink: 0;
  touch-action: none;
}
.v2-edit-drag:hover {
  background: var(--v2-primary-soft, #e8efff);
  color: var(--v2-primary);
}
.v2-edit-drag:active {
  cursor: grabbing;
}
.v2-edit-drag:focus-visible {
  outline: 2px solid var(--v2-primary);
  outline-offset: 1px;
}
.v2-edit-drag-icon {
  font-size: 14px;
  line-height: 1;
  letter-spacing: -0.12em;
  user-select: none;
  pointer-events: none;
}
.v2-edit-title {
  justify-self: stretch;
  font-size: 13px;
  border: 1px solid var(--v2-border);
  border-radius: 6px;
  padding: 6px 8px;
  min-width: 0;
}
.v2-edit-page {
  justify-self: stretch;
  width: 100%;
  font-size: 13px;
  border: 1px solid var(--v2-border);
  border-radius: 6px;
  padding: 6px 8px;
  min-width: 0;
  text-align: center;
  box-sizing: border-box;
}
.v2-edit-level {
  justify-self: center;
  font-size: 13px;
  border: 1px solid var(--v2-border);
  border-radius: 6px;
  padding: 5px 6px;
  min-width: 0;
  width: 100%;
  max-width: 52px;
  box-sizing: border-box;
  background: #fff;
  color: var(--v2-text);
  cursor: pointer;
}
.v2-edit-level:focus {
  outline: 2px solid rgba(224, 255, 0, 0.65);
  outline-offset: 2px;
  border-color: var(--v2-ink);
}
.v2-edit-del,
.v2-edit-goto {
  justify-self: center;
  flex-shrink: 0;
  padding: 6px 8px !important;
  white-space: nowrap;
}
@media (max-width: 420px) {
  .v2-edit-head {
    grid-template-columns: minmax(0, 1fr) 48px 64px 56px 104px;
  }
  .v2-edit-col--drag {
    display: none;
  }
  .v2-edit-row {
    grid-template-columns: 1fr;
  }
  .v2-edit-drag {
    justify-content: flex-start;
    width: 100%;
    min-height: 32px;
  }
  .v2-edit-row .v2-edit-del,
  .v2-edit-row .v2-edit-goto {
    justify-self: start;
  }
}

/* 3단계: 추출 목차 트리 */
.v2-toc-head-inline {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--v2-muted);
}

.v2-toc-head-edit-link {
  color: #4a77bb;
  text-decoration: none;
  font-weight: inherit;
}

.v2-toc-head-edit-link:visited {
  color: #4a77bb;
}

.v2-toc-head-edit-link:hover {
  color: #3a63a8;
}

.v2-toc-tree-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 10px 12px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.v2-toc-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.v2-toc-item {
  margin: 0;
  padding: 0;
  border-radius: 6px;
}
.v2-toc-item.is-active {
  background: var(--v2-range);
}
.v2-toc-item.is-active .v2-toc-link {
  color: var(--v2-ink);
  font-weight: 600;
}

.v2-toc-item.is-selected {
  outline: 2px solid var(--v2-accent);
  outline-offset: -2px;
  background: rgba(224, 255, 0, 0.12);
}
.v2-toc-item.is-selected.is-active {
  background: rgba(224, 255, 0, 0.2);
}

.v2-hint--footer {
  margin-top: 10px;
}

.v2-toc-row {
  display: flex;
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: 6px;
}

.v2-toc-link {
  flex: 1;
  min-width: 0;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--v2-text);
  cursor: pointer;
  padding: 0;
}
.v2-toc-link:hover {
  text-decoration: underline;
}

.v2-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--v2-muted);
}

.v2-viewer {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--v2-border);
  overflow: hidden;
}

.v2-viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--v2-border);
}

.v2-viewer-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--v2-border);
  background: #fff;
}

.v2-viewer-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.v2-page-input {
  width: 52px;
  padding: 4px 6px;
  border: 1px solid var(--v2-border);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

.v2-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  background: #fff;
  min-height: 0;
}

.v2-view-zoom-tools {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--v2-border);
}

.v2-zoom-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--v2-text);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.v2-zoom-btn--fit {
  font-size: 13px;
  font-weight: 700;
}

.v2-zoom-btn:hover {
  background: rgba(224, 255, 0, 0.35);
  border-color: var(--v2-accent);
}

.v2-zoom-btn:focus-visible {
  outline: 2px solid rgba(224, 255, 0, 0.65);
  outline-offset: 1px;
}

.v2-page-stack {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.v2-main-canvas {
  display: block;
  position: relative;
  z-index: 0;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--v2-border);
  /* 텍스트 레이어가 위에 있어도 캔버스가 이벤트를 가로채는 경우 방지 (선택·복사) */
  pointer-events: none;
}

/* PDF.js 텍스트 레이어 — 캔버스 위에서 드래그·복사 선택 */
.textLayer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  line-height: 1;
  z-index: 1;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  opacity: 1;
  text-size-adjust: none;
  forced-color-adjust: none;
}
.textLayer span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0 0;
}
.textLayer span::selection,
.textLayer .markedContent span::selection {
  background: rgba(224, 255, 0, 0.45);
}
.textLayer br::selection {
  background: transparent;
}

.v2-viewer-spinner {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 245, 245, 0.75);
}
.v2-viewer-spinner.hidden { display: none; }

.v2-viewer-spinner .spinner {
  border: 3px solid rgba(56, 56, 56, 0.12);
  border-top-color: var(--v2-accent);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: v2spin 0.7s linear infinite;
}
@keyframes v2spin {
  to { transform: rotate(360deg); }
}

.v2-loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  box-sizing: border-box;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: rgba(245, 245, 245, 0.92);
  -webkit-overflow-scrolling: touch;
}
.v2-loading-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: min(380px, calc(100vw - 32px));
  margin: auto;
  background: #fff;
  padding: 22px 28px;
  border-radius: 12px;
  text-align: center;
  min-width: 0;
}
.v2-loading-card #v2-loading-msg {
  margin: 0;
  line-height: 1.5;
  word-break: keep-all;
}
/* 기본 .spinner는 뷰어 어두운 오버레이용(밝은 링). 카드는 흰 배경이라 대비용 링으로 덮음 */
.v2-loading-card .spinner {
  border: 3px solid rgba(56, 56, 56, 0.15);
  border-top-color: var(--v2-accent);
}
.v2-loading-progress-wrap {
  margin-top: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.v2-loading-track {
  flex: 1;
  max-width: 180px;
  height: 6px;
  background: var(--v2-border);
  border-radius: 3px;
  overflow: hidden;
}
.v2-loading-bar {
  height: 100%;
  width: 0%;
  background: var(--v2-primary);
  transition: width 0.1s;
}

.v2-toast {
  position: fixed;
  top: max(20px, calc(env(safe-area-inset-top, 0px) + 12px));
  left: 50%;
  right: auto;
  bottom: auto;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 18px;
  background: #282828;
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  border-radius: 10px;
  border: 1px solid var(--v2-border);
  z-index: 1001;
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
  transition: transform 0.28s ease, opacity 0.28s ease;
}
.v2-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 목차 PDF 다운로드 직후 안내 */
.v2-modal {
  position: fixed;
  inset: 0;
  z-index: 1002;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  overflow: auto;
  background: rgba(245, 245, 245, 0.85);
  -webkit-overflow-scrolling: touch;
}

.v2-modal__card {
  flex-shrink: 0;
  width: 100%;
  max-width: min(400px, calc(100vw - 32px));
  margin: auto;
  background: #fff;
  border-radius: 12px;
  padding: 22px 24px 20px;
}

.v2-modal__title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--v2-text);
}

.v2-modal__message {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--v2-muted);
}

.v2-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v2-modal__actions .btn {
  width: 100%;
  justify-content: center;
}

.v2-modal__spinner-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  margin: 0 0 12px;
}

.v2-modal__spinner-wrap .spinner {
  border: 3px solid rgba(56, 56, 56, 0.15);
  border-top-color: var(--v2-accent);
}

.v2-modal__spinner-wrap.hidden {
  display: none !important;
  margin: 0;
  min-height: 0;
}

