.pdfConverterView {
  color-scheme: dark;
  --bg: #0b1114;
  --panel: #11191d;
  --panel-2: #172126;
  --line: #2a3b42;
  --text: #edf7f2;
  --muted: #9cafaa;
  --mint: #45d3a7;
  --amber: #f0b24d;
  --blue: #78b8ff;
}

.pdfConverterView,
.pdfConverterView * { box-sizing: border-box; }

.pdfConverterView {
  position: fixed;
  inset: 0;
  z-index: 2400;
  overflow: auto;
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans KR", "Pretendard", Arial, sans-serif;
}

.pdfConverterView[hidden] { display: none; }
body.pdfConverterOpen { overflow: hidden; }

.pdfConverterView button,
.pdfConverterView input { font: inherit; }

.pdfConverterView button {
  min-height: 32px;
  border: 1px solid rgba(69, 211, 167, 0.3);
  border-radius: 5px;
  background: rgba(69, 211, 167, 0.08);
  padding: 0 11px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.pdfConverterView button:disabled { opacity: 0.42; cursor: not-allowed; }

.pdfConverterView .horizontalScrollShell {
  display: grid;
  grid-template-columns: 0 minmax(0, 1fr) 0;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.pdfConverterView .horizontalScrollShell.hasHorizontalOverflow {
  grid-template-columns: 22px minmax(0, 1fr) 22px;
}

.pdfConverterView .horizontalScrollShell > :not(.horizontalScrollCaret) {
  grid-column: 2;
  min-width: 0;
}

.pdfConverterView .horizontalScrollCaret {
  position: static;
  display: grid;
  place-items: center;
  width: 22px;
  min-width: 0;
  height: 30px;
  min-height: 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  color: var(--mint);
}

.pdfConverterView .horizontalScrollCaret[hidden] {
  display: none;
}

.pdfConverterView .horizontalScrollCaret.isPrevious {
  grid-column: 1;
}

.pdfConverterView .horizontalScrollCaret.isNext {
  grid-column: 3;
}

.pdfConverterView .horizontalScrollCaret::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--mint);
}

.pdfConverterView .horizontalScrollCaret.isPrevious::before {
  transform: rotate(180deg);
}

.pdfConverterView .horizontalScrollCaret:hover,
.pdfConverterView .horizontalScrollCaret:focus-visible {
  background: transparent;
  color: var(--mint);
  filter: brightness(1.2);
}

.pdfConverterView .horizontalScrollCaret:focus-visible {
  outline: 1px solid var(--mint);
  outline-offset: -2px;
}

.pdfConverterView button.active,
.pdfConverterView button:hover:not(:disabled) {
  border-color: rgba(69, 211, 167, 0.7);
  background: rgba(69, 211, 167, 0.18);
}

.pdfConverterView input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0c1316;
  padding: 7px 10px;
  color: var(--text);
}

.pdfConverterView label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.converterShell {
  width: min(1440px, calc(100vw - 24px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 18px 0 24px;
}

.converterHeader,
.converterNotice,
.converterTree,
.converterWorkSurface {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.converterHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.converterBrand { display: flex; align-items: center; gap: 12px; }
.converterBrand img { width: 46px; height: 46px; }
.converterBrand p {
  margin: 0 0 3px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 900;
}
.converterBrand h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.converterBrand h1:focus { outline: none; }
.headerActions { display: flex; align-items: center; gap: 8px; }

.secondaryActionButton {
  border-color: rgba(156, 175, 170, 0.34);
  background: rgba(12, 19, 22, 0.78);
  color: #cddbd7;
}

.homeIconButton {
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.homeIconButton svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.pdfConverterView button.homeIconButton {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #c9ddd6;
}

.pdfConverterView button.homeIconButton:hover:not(:disabled),
.pdfConverterView button.homeIconButton:focus-visible {
  border: 0;
  background: transparent;
  color: var(--mint);
  outline: 1px solid rgba(69, 211, 167, 0.46);
  outline-offset: 3px;
}

.converterNotice {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 14px;
}

.converterNotice strong { color: var(--mint); }

.converterLayout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 10px;
  height: calc(100svh - 136px);
  min-height: 560px;
  margin-top: 10px;
}

.pdfConverterView .converterLayout > .horizontalScrollShell {
  min-height: 0;
}

.pdfConverterView .converterLayout > .horizontalScrollShell.hasHorizontalOverflow {
  grid-template-columns: 0 minmax(0, 1fr) 0;
}

.pdfConverterView .converterLayout > .horizontalScrollShell > .horizontalScrollCaret {
  display: none;
}

.pdfConverterView .converterLayout > .horizontalScrollShell > .converterTree {
  height: 100%;
}

.converterTree {
  display: block;
  flex: none;
  gap: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 10px;
  scrollbar-width: none;
}

.converterTree::-webkit-scrollbar { display: none; }

.treeTitle {
  margin: 0 0 9px 8px;
  color: #f2cd82;
  font-size: 14px;
  font-weight: 800;
}

.converterTreeNode {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 32px;
  border: 0;
  border-left: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 5px 7px 5px 8px;
  color: #cbdad5;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.converterTreeNode:hover:not(:disabled) {
  border-color: transparent;
  background: transparent;
  color: #f2fffb;
}

.converterTreeNode.active,
.converterTreeNode.active:hover:not(:disabled) {
  border-left-color: var(--mint);
  background: transparent;
  color: var(--mint);
}

.treeNodeNumber {
  display: inline-block;
  min-width: 16px;
  margin-right: 4px;
  color: var(--muted);
  font-size: 12px;
}

.converterTreeNode.active .treeNodeNumber { color: var(--mint); }

.converterWorkSurface {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(18px, 3vw, 28px);
  scrollbar-width: none;
}

.converterWorkSurface::-webkit-scrollbar { display: none; }

.converterWorkStep { min-height: 100%; }
.converterWorkStep[hidden] { display: none; }

.stepHeading {
  display: grid;
  gap: 5px;
  max-width: 720px;
  margin-bottom: 22px;
}

.stepHeading p {
  margin: 0;
  color: var(--mint);
  font-size: 12px;
  font-weight: 900;
}

.stepHeading h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
}

.stepHeading span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.stepForm {
  display: grid;
  gap: 11px;
  width: min(620px, 100%);
  padding: 2px 0;
}

.stepForm + .stepForm { margin-top: 22px; }
.stepForm h3,
.selectionListPanel h3,
.previewSection h3 {
  margin: 0;
  color: #dffaf2;
  font-size: 14px;
}

.locationForm { grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(920px, 100%); }

.primaryFileButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 38px;
  border: 1px solid rgba(69, 211, 167, 0.62);
  border-radius: 5px;
  background: rgba(69, 211, 167, 0.18);
  padding: 0 13px;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.primaryFileButton:hover { border-color: rgba(69, 211, 167, 0.92); background: rgba(69, 211, 167, 0.27); }
.primaryFileButton input { display: none; }

.pageRangeRow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.compactButtons,
.toolbarGroup { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.compactButtons button { min-width: 0; }

.pageRangeRow button,
.compactButtons button,
.segmentedControl button {
  border-color: rgba(69, 211, 167, 0.28);
  background: rgba(69, 211, 167, 0.07);
  color: #d5eee6;
}

.pageRangeRow button:hover:not(:disabled),
.compactButtons button:hover:not(:disabled),
.segmentedControl button:hover:not(:disabled) {
  border-color: rgba(69, 211, 167, 0.62);
  background: rgba(69, 211, 167, 0.14);
  color: #f2fffb;
}

.compactButtons button.active,
.segmentedControl button.active {
  border-color: rgba(69, 211, 167, 0.92);
  background: rgba(69, 211, 167, 0.28);
  color: #fff;
}

.segmentedControl { display: flex; gap: 7px; }
.segmentedControl button { min-width: 112px; }
.mutedText { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.bundlePath {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(920px, 100%);
  margin-top: 22px;
  padding: 4px 0;
  color: #dffaf2;
  font-size: 13px;
  font-weight: 800;
  overflow-x: auto;
  scrollbar-width: none;
}

.bundlePath::-webkit-scrollbar { display: none; }
.bundlePath span { flex: 0 0 auto; overflow-wrap: anywhere; }
.bundlePath span + span::before { content: ">"; margin-right: 8px; color: var(--muted); }

.pdfConverterView .horizontalScrollShell:has(> .bundlePath) {
  width: min(920px, 100%);
  margin-top: 22px;
}

.pdfConverterView .horizontalScrollShell > .bundlePath {
  width: 100%;
  margin-top: 0;
  cursor: grab;
  touch-action: pan-x;
}

.pdfConverterView .horizontalScrollShell > .bundlePath.dragging {
  cursor: grabbing;
}

.selectionStep { display: flex; min-height: 100%; flex-direction: column; }

.selectionWorkspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  min-height: 470px;
  flex: 1;
  gap: 10px;
}

.viewerPanel,
.selectionListPanel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d1518;
}

.viewerPanel { display: flex; flex-direction: column; }

.viewerToolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(42, 59, 66, 0.72);
  padding: 10px;
}

.viewerToolbar span { min-width: 72px; color: var(--muted); text-align: center; font-size: 13px; font-weight: 900; }

.pdfStage {
  display: grid;
  place-items: start center;
  min-height: 0;
  flex: 1;
  overflow: auto;
  background: #080d10;
  padding: 18px;
  scrollbar-width: none;
}

.pdfStage::-webkit-scrollbar { display: none; }
.emptyViewer { border: 1px dashed rgba(156, 175, 170, 0.35); border-radius: 7px; padding: 18px; color: var(--muted); }
.pageCanvasWrap { position: relative; line-height: 0; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.36); }
#pdfCanvas { display: block; background: #fff; }
.selectionLayer { position: absolute; inset: 0; cursor: crosshair; }

.selectionBox,
.draftBox { position: absolute; border: 2px solid var(--mint); background: rgba(69, 211, 167, 0.1); pointer-events: none; }
.selectionBox.image { border-color: var(--amber); background: rgba(240, 178, 77, 0.12); }
.selectionBox span { position: absolute; top: -24px; left: -2px; min-width: 28px; border-radius: 4px; background: #0b1114; padding: 3px 7px; color: var(--text); font-size: 12px; font-weight: 900; line-height: 1; }
.draftBox { border-style: dashed; border-color: var(--blue); background: rgba(120, 184, 255, 0.12); }

.selectionListPanel { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; padding: 12px; }
.sectionHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sectionHead button { min-height: 30px; font-size: 13px; }

.selectionList,
.blockPreview { display: grid; align-content: start; gap: 8px; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.selectionList::-webkit-scrollbar,
.blockPreview::-webkit-scrollbar { display: none; }

.selectionItem,
.previewBlock { background: rgba(12, 19, 22, 0.72); padding: 9px 10px; }
.selectionTop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.selectionTop strong,
.previewBlock strong { color: var(--mint); font-size: 14px; }
.selectionMeta,
.previewMeta { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.selectionActions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.selectionActions button { min-height: 30px; padding: 0 8px; font-size: 13px; }

.resultAction { width: min(780px, 100%); margin-bottom: 16px; }
.resultAction button { min-height: 38px; font-size: 15px; }
.bundleSummary { width: min(780px, 100%); color: var(--muted); font-size: 13px; line-height: 1.6; white-space: pre-line; }
.previewSection { display: grid; gap: 10px; width: min(780px, 100%); margin-top: 22px; border-top: 1px solid rgba(42, 59, 66, 0.72); padding-top: 16px; }
.previewBlock p { margin: 7px 0 0; color: var(--text); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.previewBlock img { display: block; max-width: 100%; margin-top: 8px; border: 1px solid rgba(238, 247, 242, 0.12); }
.saveGuide { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.saveActions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 760px) {
  .converterShell { width: min(100vw - 16px, 720px); padding-top: 8px; }
  .converterHeader,
  .converterNotice { align-items: stretch; flex-direction: column; }
  .headerActions { justify-content: stretch; }
  .headerActions > * { flex: 1; }
  .converterLayout { display: block; height: auto; min-height: 0; }
  .pdfConverterView .converterLayout > .horizontalScrollShell.hasHorizontalOverflow {
    grid-template-columns: 22px minmax(0, 1fr) 22px;
  }
  .pdfConverterView .converterLayout > .horizontalScrollShell > .horizontalScrollCaret:not([hidden]) {
    display: grid;
  }
  .converterTree {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    touch-action: pan-x;
    scrollbar-width: none;
  }
  .pdfConverterView .converterLayout > .horizontalScrollShell > .converterTree { height: auto; }
  .converterTree::-webkit-scrollbar { display: none; }
  .converterTree.dragging { cursor: grabbing; }
  .treeTitle { flex: 0 0 auto; margin: 6px 4px 0 0; }
  .converterTreeNode { flex: 0 0 auto; width: auto; min-height: 30px; border-left: 0; border-bottom: 1px solid transparent; padding: 4px 8px; }
  .converterTreeNode.active,
  .converterTreeNode.active:hover:not(:disabled) { border-left: 0; border-bottom-color: var(--mint); }
  .converterWorkSurface { min-height: 520px; overflow: visible; padding: 18px; }
  .locationForm { grid-template-columns: 1fr; }
  .selectionWorkspace { grid-template-columns: 1fr; min-height: 0; }
  .viewerPanel { min-height: 440px; }
  .selectionListPanel { min-height: 260px; }
}

@media (max-width: 760px) {
  .converterHeader {
    align-items: center;
    flex-direction: row;
  }

  .headerActions {
    justify-content: flex-end;
  }

  .headerActions > .homeIconButton {
    flex: 0 0 32px;
  }
}
