* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f7f8ff;
  --card: #ffffff;
  --card-soft: #fcfbff;
  --text: #161b33;
  --muted: #727b91;
  --muted-2: #8a91a5;
  --border: #ececff;
  --primary: #6958ff;
  --primary-2: #7c68ff;
  --primary-soft: #f0edff;
  --shadow: 0 18px 40px rgba(99, 91, 255, 0.08);
  --shadow-2: 0 14px 30px rgba(99, 91, 255, 0.15);
}

body {
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top, rgba(105, 88, 255, 0.08), transparent 35%),
    var(--bg);
  color: var(--text);
  padding: 28px;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
}
.main-card {
  padding-bottom: 10px;
}
.top {
  margin-bottom: 18px;
}
.title {
  display: flex;
  align-items: center;
  gap: 16px;
}
.icon-box {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff, #f6f4ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: 0 14px 28px rgba(105, 88, 255, 0.12);
  flex: 0 0 auto;
  margin-bottom: 20px;
}
.icon-box i {
  font-size: 54px;
}
h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -1.6px;
  margin-bottom: 0px !important;
}
.desc {
  max-width: 740px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 15px;
  margin-top: 0px;
}

.features {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.feature {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 15px;
  font-size: 13px;
  font-weight: 600;
  color: #5d6478;
}
.feature i {
  font-size: 13px;
  border: 7px solid #fff;
  border-radius: 50%;
  background: #fff;
}
.feature:nth-child(1) i {
  color: var(--primary);
}
.feature:nth-child(2) i {
  color: #11b56d;
}
.feature:nth-child(3) i {
  color: #4d8dff;
}

.tool-box {
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}
.section-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}
.sub {
  color: var(--muted-2);
  font-size: 13px;
  margin-bottom: 18px;
}

.drop {
  border: 2px dashed #d9d2ff;
  background: linear-gradient(180deg, #fff, #fbfaff);
  border-radius: 22px;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px;
  transition: 0.22s ease;
}
.drop.dragover {
  border-color: var(--primary);
  background: #f8f6ff;
  transform: translateY(-1px);
}
.upload-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(to bottom, var(--primary-2), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  color: #fff;
  font-size: 28px;
  box-shadow: 0 14px 28px rgba(99, 91, 255, 0.26);
}
.drop h2 {
  font-size: 24px;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}
.drop p {
  color: var(--muted-2);
  margin: 0 0 18px;
  font-size: 14px;
}

.browse-btn,
.merge-btn,
.secondary-btn,
.clear-chip {
  border: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}
.browse-btn,
.secondary-btn,
.clear-chip {
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  transition: 0.2s ease;
}
.browse-btn {
  background: linear-gradient(to right, var(--primary), var(--primary-2));
  box-shadow: 0 12px 25px rgba(99, 91, 255, 0.22);
}
.secondary-btn,
.clear-chip {
  background: linear-gradient(to right, #667085, #8a91a5);
  box-shadow: 0 12px 25px rgba(102, 112, 133, 0.18);
}
.browse-btn:hover,
.secondary-btn:hover,
.merge-btn:hover,
.clear-chip:hover {
  transform: translateY(-1px);
}
.browse-btn i,
.secondary-btn i,
.merge-btn i,
.clear-chip i {
  margin-right: 8px;
}

.files {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}
.file {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: #fff;
  transition: 0.2s ease;
}
.file:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(99, 91, 255, 0.06);
}
.left-file {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.pdf-mini {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #fff3f3;
  color: #ff6161;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex: 0 0 auto;
}
.file-meta {
  min-width: 0;
}
.file-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 540px;
}
.size {
  font-size: 12px;
  color: var(--muted-2);
}
.trash {
  color: #9aa1b6;
  cursor: pointer;
  transition: 0.2s;
  flex: 0 0 auto;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
}
.trash:hover {
  color: #ff6161;
  background: #fff3f3;
}

.preview {
  margin-top: 14px;
  border: 1px solid #ececff;
  border-radius: 20px;
  padding: 16px;
  background: #fff;
}
.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}
.preview-head h3 {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}
.preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.page-thumb {
  border: 1px solid #e5e9f3;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #fbfaff);
  overflow: hidden;
  min-height: 300px;
  position: relative;
}
.page-canvas-wrap {
  position: relative;
  width: 100%;
  padding: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #ececff;
}
.page-canvas-wrap canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(18, 28, 45, 0.08);
}
.page-number-overlay {
  position: absolute;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(99, 91, 255, 0.12);
  background: rgba(240, 237, 255, 0.96);
  color: var(--primary);
  pointer-events: none;
  white-space: nowrap;
}
.thumb-label {
  font-size: 12px;
  color: #7f8799;
  padding: 10px 12px 12px;
  text-align: center;
}

.settings {
  margin-top: 18px;
}
.setting-card {
  border: 1px solid #ececff;
  border-radius: 22px;
  padding: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfbff 100%);
  box-shadow: 0 14px 30px rgba(99, 91, 255, 0.06);
}
.setting-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.setting-head .section-title {
  margin-bottom: 0;
}
.setting-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.options-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid #edf1f7;
  border-radius: 18px;
  background: #fff;
  padding: 16px;
  height: auto;
}
.panel-title {
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  letter-spacing: 0.2px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title i {
  color: var(--primary);
}
.hint {
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 10px;
  line-height: 1.5;
}

.page-mode-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.mode-pill {
  flex: 1 1 180px;
  border: 1px solid #dde5ef;
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: 0.18s ease;
  user-select: none;
}
.mode-pill input {
  accent-color: var(--primary);
}
.mode-pill span {
  font-size: 13px;
  font-weight: 700;
  color: #2f3547;
}
.mode-pill.active {
  border-color: rgba(99, 91, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.08);
}

.position-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}
.position-grid {
  width: 96px;
  height: 120px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  border: 1px solid #cfd7e6;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 0 0 1px #eef2f7;
}
.position-cell {
  border: 1px dashed #cfd7e6;
  background: #fff;
  position: relative;
  cursor: pointer;
  outline: none;
}
.position-cell:nth-child(3n + 1) {
  border-left: none;
}
.position-cell:nth-child(3n) {
  border-right: none;
}
.position-cell:nth-child(-n + 3) {
  border-top: none;
}
.position-cell:nth-last-child(-n + 3) {
  border-bottom: none;
}
.position-cell.selected::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ff5151;
  position: absolute;
  right: 4px;
  bottom: 4px;
  box-shadow: 0 2px 8px rgba(255, 81, 81, 0.3);
}
.position-cell[data-pos="top-left"].selected::after {
  left: 4px;
  top: 4px;
  right: auto;
  bottom: auto;
}
.position-cell[data-pos="top-center"].selected::after {
  left: 50%;
  top: 4px;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
}
.position-cell[data-pos="top-right"].selected::after {
  right: 4px;
  top: 4px;
  bottom: auto;
}
.position-cell[data-pos="middle-left"].selected::after {
  left: 4px;
  top: 50%;
  right: auto;
  bottom: auto;
  transform: translateY(-50%);
}
.position-cell[data-pos="middle-center"].selected::after {
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
}
.position-cell[data-pos="middle-right"].selected::after {
  right: 4px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}
.position-cell[data-pos="bottom-left"].selected::after {
  left: 4px;
  bottom: 4px;
  right: auto;
  top: auto;
}
.position-cell[data-pos="bottom-center"].selected::after {
  left: 50%;
  bottom: 4px;
  right: auto;
  top: auto;
  transform: translateX(-50%);
}
.position-cell[data-pos="bottom-right"].selected::after {
  right: 4px;
  bottom: 4px;
  top: auto;
  left: auto;
}

.form-stack {
  display: grid;
  gap: 14px;
}
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.format-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #4f566b;
}
.format-group select,
.format-group input {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  border: 1px solid #dde1ef;
  background: #fff;
  padding: 0 14px;
  outline: none;
  font-family: "Inter", sans-serif;
  color: #2f3547;
  font-size: 14px;
  transition: 0.22s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.format-group select:hover,
.format-group input:hover {
  border-color: #cbd2e8;
}
.format-group select:focus,
.format-group input:focus {
  border-color: #6958ff;
  box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.12);
}
.format-group input[type="number"]::-webkit-outer-spin-button,
.format-group input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.mini-note {
  margin-top: 8px;
  margin-bottom: 8px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.45;
}

.merge-btn {
  width: 100%;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(to right, var(--primary), #836dff);
  margin-top: 18px;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 18px 30px rgba(99, 91, 255, 0.22);
  transition: 0.22s ease;
}
.merge-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none;
}

.progress-wrap {
  width: 100%;
  height: 10px;
  background: #ececff;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 18px;
  display: none;
}
.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(to right, #6958ff, #836dff);
  transition: width 0.25s ease;
}
.progress-text {
  margin-top: 10px;
  font-size: 13px;
  color: #7f8799;
  font-weight: 500;
}
.note {
  margin-top: 10px;
  color: #7f8799;
  font-size: 12px;
  line-height: 1.5;
}
.empty-preview {
  padding: 18px;
  text-align: center;
  color: #7f8799;
  font-size: 13px;
  border: 1px dashed #d9d2ff;
  border-radius: 16px;
  background: #fbfaff;
}

/* =============================================================================
   STRUCTURAL BREAKPOINTS (layout changes)
============================================================================= */

@media (max-width: 980px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
  .row-2,
  .row-3 {
    grid-template-columns: 1fr;
  }
  .position-wrap {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

@media (max-width: 700px) {
  body {
    padding: 14px;
  }
  .main-card {
    padding: 18px;
  }
  .tool-box {
    padding: 18px;
    border-radius: 20px;
  }
  .title {
    align-items: flex-start;
  }
  .icon-box {
    width: 74px;
    height: 74px;
  }
  .icon-box i {
    font-size: 40px;
  }
  h1 {
    font-size: 32px;
  }
  .drop h2 {
    font-size: 20px;
  }
  .drop {
    min-height: 220px;
    padding: 16px;
  }
  .file-name {
    max-width: 180px;
  }
  .preview-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .icon-box {
    display: none;
  }
}

/* =========================
   PDF PAGE NUMBER DARK MODE
========================= */

body.dark {
  color-scheme: dark;

  --bg: #0b1120;
  --card: #111827;
  --card-2: #0f172a;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.14);

  --primary: #3b82f6;
  --primary-hover: #2563eb;
}

body.dark {
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.12), transparent 35%),
    var(--bg);
  color: var(--text);
}

/* Main containers */

body.dark .tool-box,
body.dark .setting-card,
body.dark .drop,
body.dark .files,
body.dark .progress-wrap,
body.dark .preview {
  background: var(--card) !important;
  border-color: var(--border) !important;
}

/* Headings */
body.dark h1,
body.dark h2,
body.dark h3,
body.dark h4,
body.dark .section-title,
body.dark .panel-title,
body.dark .preview-head h3 {
  color: #ffffff !important;
}

/* Text */
body.dark .desc,
body.dark .sub,
body.dark p,
body.dark label,
body.dark .mini-note,
body.dark .hint,
body.dark .progress-text,
body.dark .note {
  color: var(--muted) !important;
}

/* Features - no background */
body.dark .features {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark .feature {
  background: transparent !important;

  color: #dbeafe !important;
  box-shadow: none !important;
}

body.dark .feature i {
  color: #60a5fa !important;
}

/* Upload area */
body.dark .drop {
  background: var(--card-2) !important;
}

body.dark .drop:hover,
body.dark .drop.drag-over {
  border-color: var(--primary) !important;
}

/* PDF mini icon */
body.dark .pdf-mini {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #60a5fa !important;
}

/* Buttons */

body.dark .browse-btn,
body.dark .merge-btn {
  background: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28) !important;
}

body.dark .browse-btn:hover,
body.dark .merge-btn:hover {
  background: var(--primary-hover) !important;
  transform: translateY(-2px);
}

body.dark .clear-chip,
body.dark .position-cell,
body.dark .mode-pill {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: var(--border) !important;
}

body.dark .clear-chip:hover {
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

body.dark .merge-btn.disabled,
body.dark .merge-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.dark .mode-pill.active,
body.dark .position-cell.selected {
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--primary-hover)
  ) !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

/* Inputs and selects */
body.dark select,
body.dark input {
  background: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid rgba(148, 163, 184, 0.18) !important;
}

body.dark select:focus,
body.dark input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
  outline: none;
}

/* File items */
body.dark .file {
  background: #0f172a !important;
  border: 1px solid rgba(148, 163, 184, 0.12) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
}

body.dark .file:hover {
  border-color: rgba(59, 130, 246, 0.35) !important;
  background: #131d33 !important;
}

body.dark .file-name {
  color: #f1f5f9 !important;
}

body.dark .size {
  color: #94a3b8 !important;
}

body.dark .trash {
  color: #64748b;
  background: transparent;
}

body.dark .trash:hover {
  background: rgba(248, 113, 113, 0.1) !important;
  color: #f87171 !important;
}

/* Preview */
body.dark .preview {
  background: #0f172a !important;
}

body.dark .preview-head {
  border-bottom-color: var(--border) !important;
}

body.dark .preview-list {
  background: #0b1120 !important;
}

body.dark .page-thumb {
  background: linear-gradient(180deg, #111827, #0f172a) !important;
  border-color: var(--border) !important;
}

body.dark .page-canvas-wrap {
  border-bottom-color: var(--border) !important;
  background: #0b1120 !important;
}

body.dark .page-number-overlay {
  border-color: rgba(59, 130, 246, 0.2) !important;
  background: rgba(59, 130, 246, 0.15) !important;
  color: #93c5fd !important;
}

body.dark .thumb-label {
  color: #64748b !important;
}

body.dark .empty-preview {
  background: #0f172a !important;
  border-color: var(--border) !important;
  color: #64748b !important;
}

/* Panels */
body.dark .panel {
  background: #10182d !important;
  border-color: var(--border) !important;
}

body.dark .setting-head {
  border-bottom-color: var(--border) !important;
}

body.dark .setting-chip {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #60a5fa !important;
}

/* Position grid */
body.dark .position-grid {
  background: #0f172a !important;
  border-color: var(--border) !important;
}

body.dark .position-cell {
  background: #111827 !important;
}

body.dark .position-cell:hover {
  border-color: var(--primary) !important;
}

/* Page mode row */
body.dark .page-mode-row {
  background: #0f172a !important;
  border-color: var(--border) !important;
}

/* Progress */
body.dark .progress-wrap {
  background: #1e293b !important;
}

body.dark .progress-bar {
  background: linear-gradient(90deg, #3b82f6, #2563eb) !important;
}

/* Scrollbar */
body.dark ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body.dark ::-webkit-scrollbar-track {
  background: #0f172a;
}

body.dark ::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 999px;
}

body.dark ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Selection */
body.dark ::selection {
  background: rgba(59, 130, 246, 0.35);
  color: #ffffff;
}

/* Mobile */
@media (max-width: 768px) {
  body.dark .main-card,
  body.dark .tool-box,
  body.dark .setting-card,
  body.dark .drop,
  body.dark .preview {
    border-radius: 22px;
  }

  body.dark .panel {
    padding: 14px;
  }
}

/* =============================================================================
   LARGE SCREENS — 1200 px+
   Uses vw-based widths so content fills the viewport
============================================================================= */

@media (min-width: 1200px) {
  body {
    padding: 28px 3vw;
  }

  .page-container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .container {
    max-width: 94vw !important;
    width: 94vw !important;
  }
}

/* ——— 1440 px ——— */
@media (min-width: 1440px) {
  body {
    padding: 36px 3vw;
  }

  .container {
    max-width: 94vw !important;
    width: 94vw !important;
  }

  h1 {
    font-size: 50px;
    letter-spacing: -1.8px;
  }

  .desc {
    max-width: 55vw;
    font-size: 16px;
  }

  .icon-box {
    width: 108px;
    height: 108px;
    border-radius: 26px;
    margin-bottom: 28px;
  }
  .icon-box i {
    font-size: 60px;
  }

  .features {
    gap: 16px;
    margin-top: 18px;
  }
  .feature {
    font-size: 14px;
    padding: 12px 18px;
    gap: 10px;
  }
  .feature i {
    font-size: 14px;
  }

  .tool-box {
    padding: 30px;
    border-radius: 28px;
  }

  .section-title {
    font-size: 22px;
  }
  .sub {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .drop {
    min-height: 260px;
    border-radius: 24px;
    padding: 24px;
  }
  .upload-circle {
    width: 76px;
    height: 76px;
    font-size: 30px;
    margin-bottom: 20px;
  }
  .drop h2 {
    font-size: 26px;
    margin-bottom: 12px;
  }
  .drop p {
    font-size: 15px;
    margin-bottom: 22px;
  }

  .browse-btn,
  .secondary-btn,
  .clear-chip {
    height: 50px;
    font-size: 14px;
    padding: 0 22px;
    border-radius: 14px;
  }

  .files {
    gap: 14px;
    margin-top: 16px;
  }
  .file {
    padding: 16px 18px;
    gap: 16px;
    border-radius: 18px;
  }
  .pdf-mini {
    width: 46px;
    height: 46px;
    font-size: 20px;
    border-radius: 14px;
  }
  .file-name {
    font-size: 15px;
    margin-bottom: 5px;
  }
  .size {
    font-size: 13px;
  }
  .trash {
    padding: 12px;
    font-size: 16px;
  }

  .preview {
    margin-top: 16px;
    padding: 20px;
    border-radius: 24px;
  }
  .preview-head {
    margin-bottom: 14px;
  }
  .preview-head h3 {
    font-size: 16px;
  }
  .preview-list {
    gap: 16px;
  }
  .page-thumb {
    min-height: 340px;
    border-radius: 18px;
  }
  .page-canvas-wrap {
    padding: 14px;
  }
  .page-canvas-wrap canvas {
    border-radius: 10px;
  }
  .page-number-overlay {
    font-size: 14px;
    padding: 8px 12px;
  }
  .thumb-label {
    font-size: 13px;
    padding: 12px 14px 14px;
  }

  .setting-card {
    padding: 26px;
    border-radius: 26px;
  }
  .setting-head {
    margin-bottom: 16px;
  }
  .setting-chip {
    padding: 10px 14px;
    font-size: 13px;
  }

  .options-grid {
    gap: 22px;
  }

  .panel {
    padding: 18px;
    border-radius: 20px;
  }
  .panel-title {
    font-size: 14px;
    margin-bottom: 14px;
  }
  .hint {
    font-size: 13px;
    margin-top: 12px;
  }

  .page-mode-row {
    gap: 12px;
  }
  .mode-pill {
    padding: 14px 16px;
    gap: 12px;
    border-radius: 16px;
  }
  .mode-pill span {
    font-size: 14px;
  }

  .position-wrap {
    gap: 18px;
  }
  .position-grid {
    width: 110px;
    height: 136px;
  }
  .position-cell.selected::after {
    width: 18px;
    height: 18px;
  }

  .form-stack {
    gap: 16px;
  }
  .row-2,
  .row-3 {
    gap: 14px;
  }
  .format-group label {
    font-size: 14px;
    margin-bottom: 10px;
  }
  .format-group select,
  .format-group input {
    height: 52px;
    font-size: 15px;
    border-radius: 16px;
    padding: 0 16px;
  }
  .mini-note {
    font-size: 13px;
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .merge-btn {
    height: 58px;
    font-size: 16px;
    border-radius: 16px;
    margin-top: 22px;
  }

  .progress-wrap {
    height: 12px;
    margin-top: 22px;
  }
  .progress-text {
    margin-top: 12px;
    font-size: 14px;
  }
  .note {
    margin-top: 12px;
    font-size: 13px;
  }
  .empty-preview {
    padding: 22px;
    font-size: 14px;
    border-radius: 18px;
  }
}

/* ——— 1600 px ——— */
@media (min-width: 1600px) {
  body {
    padding: 38px 3vw;
  }

  h1 {
    font-size: 56px;
    letter-spacing: -2px;
  }

  .desc {
    font-size: 16.5px;
    line-height: 1.75;
  }

  .icon-box {
    width: 118px;
    height: 118px;
    border-radius: 28px;
    margin-bottom: 32px;
  }
  .icon-box i {
    font-size: 66px;
  }

  .title {
    gap: 22px;
  }
  .top {
    margin-bottom: 22px;
  }

  .features {
    gap: 18px;
  }
  .feature {
    font-size: 15px;
    padding: 13px 20px;
  }

  .tool-box {
    padding: 34px;
    border-radius: 32px;
  }

  .section-title {
    font-size: 24px;
    margin-bottom: 8px;
  }
  .sub {
    font-size: 15px;
    margin-bottom: 28px;
  }

  .drop {
    min-height: 280px;
    padding: 28px;
  }
  .upload-circle {
    width: 84px;
    height: 84px;
    font-size: 34px;
    margin-bottom: 22px;
  }
  .drop h2 {
    font-size: 28px;
  }
  .drop p {
    font-size: 15px;
  }

  .browse-btn,
  .secondary-btn,
  .clear-chip {
    height: 54px;
    font-size: 15px;
  }

  .file {
    padding: 18px 20px;
  }
  .pdf-mini {
    width: 52px;
    height: 52px;
    font-size: 22px;
    border-radius: 16px;
  }
  .file-name {
    font-size: 16px;
  }
  .size {
    font-size: 13.5px;
  }
  .trash {
    font-size: 18px;
  }

  .preview {
    padding: 24px;
  }
  .preview-head h3 {
    font-size: 17px;
  }
  .preview-list {
    gap: 18px;
  }
  .page-thumb {
    min-height: 380px;
    border-radius: 20px;
  }
  .page-number-overlay {
    font-size: 15px;
    padding: 9px 14px;
  }
  .thumb-label {
    font-size: 14px;
  }

  .setting-card {
    padding: 30px;
    border-radius: 30px;
  }
  .options-grid {
    gap: 26px;
  }
  .panel {
    padding: 20px;
  }
  .panel-title {
    font-size: 15px;
    margin-bottom: 16px;
  }

  .mode-pill {
    padding: 16px 18px;
  }
  .mode-pill span {
    font-size: 15px;
  }

  .position-grid {
    width: 120px;
    height: 148px;
  }

  .format-group select,
  .format-group input {
    height: 56px;
    font-size: 15px;
  }

  .merge-btn {
    height: 62px;
    font-size: 17px;
    border-radius: 18px;
  }

  .progress-wrap {
    height: 14px;
  }
}

/* ——— 1920 px ——— */
@media (min-width: 1920px) {
  body {
    padding: 42px 3vw;
  }

  h1 {
    font-size: 66px;
    letter-spacing: -2.2px;
  }

  .desc {
    max-width: 52vw;
    font-size: 18px;
    line-height: 1.75;
  }

  .title {
    gap: 24px;
    margin-bottom: 24px;
  }
  .top {
    margin-bottom: 26px;
  }

  .icon-box {
    width: 132px;
    height: 132px;
    border-radius: 30px;
    margin-bottom: 38px;
  }
  .icon-box i {
    font-size: 76px;
  }

  .features {
    gap: 20px;
    margin-top: 22px;
  }
  .feature {
    font-size: 16px;
    padding: 14px 22px;
    gap: 10px;
  }
  .feature i {
    font-size: 16px;
  }

  .tool-box {
    padding: 40px;
    border-radius: 36px;
  }

  .section-title {
    font-size: 26px;
    margin-bottom: 10px;
  }
  .sub {
    font-size: 17px;
    margin-bottom: 32px;
  }

  .drop {
    min-height: 320px;
    border-radius: 26px;
    padding: 34px;
    border-width: 3px;
  }
  .upload-circle {
    width: 96px;
    height: 96px;
    font-size: 40px;
    margin-bottom: 24px;
  }
  .drop h2 {
    font-size: 34px;
    margin-bottom: 14px;
  }
  .drop p {
    font-size: 17px;
    margin-bottom: 28px;
  }

  .browse-btn,
  .secondary-btn,
  .clear-chip {
    height: 58px;
    font-size: 16px;
    padding: 0 28px;
    border-radius: 16px;
  }

  .files {
    gap: 18px;
    margin-top: 20px;
  }
  .file {
    padding: 22px 24px;
    gap: 20px;
    border-radius: 20px;
  }
  .pdf-mini {
    width: 60px;
    height: 60px;
    font-size: 26px;
    border-radius: 20px;
  }
  .file-name {
    font-size: 18px;
    margin-bottom: 6px;
  }
  .size {
    font-size: 14.5px;
  }
  .trash {
    padding: 14px;
    font-size: 20px;
    border-radius: 14px;
  }

  .preview {
    margin-top: 20px;
    padding: 28px;
    border-radius: 28px;
  }
  .preview-head {
    margin-bottom: 18px;
  }
  .preview-head h3 {
    font-size: 20px;
  }
  .preview-list {
    gap: 22px;
  }
  .page-thumb {
    min-height: 440px;
    border-radius: 22px;
  }
  .page-canvas-wrap {
    padding: 18px;
  }
  .page-canvas-wrap canvas {
    border-radius: 14px;
  }
  .page-number-overlay {
    font-size: 16px;
    padding: 10px 16px;
  }
  .thumb-label {
    font-size: 15px;
    padding: 14px 18px 18px;
  }

  .setting-card {
    padding: 36px;
    border-radius: 34px;
  }
  .setting-head {
    margin-bottom: 20px;
  }
  .setting-chip {
    padding: 12px 18px;
    font-size: 14px;
    gap: 10px;
  }

  .options-grid {
    gap: 30px;
  }

  .panel {
    padding: 24px;
    border-radius: 24px;
  }
  .panel-title {
    font-size: 17px;
    margin-bottom: 18px;
    gap: 10px;
  }
  .panel-title i {
    font-size: 18px;
  }
  .hint {
    font-size: 14px;
    margin-top: 14px;
  }

  .page-mode-row {
    gap: 16px;
  }
  .mode-pill {
    padding: 16px 20px;
    gap: 14px;
    border-radius: 18px;
  }
  .mode-pill span {
    font-size: 15px;
  }

  .position-wrap {
    gap: 22px;
  }
  .position-grid {
    width: 136px;
    height: 168px;
    border-radius: 14px;
  }
  .position-cell.selected::after {
    width: 24px;
    height: 24px;
  }
  .position-cell[data-pos="top-left"].selected::after,
  .position-cell[data-pos="top-center"].selected::after,
  .position-cell[data-pos="top-right"].selected::after {
    top: 6px;
  }
  .position-cell[data-pos="bottom-left"].selected::after,
  .position-cell[data-pos="bottom-center"].selected::after,
  .position-cell[data-pos="bottom-right"].selected::after {
    bottom: 6px;
  }
  .position-cell[data-pos="top-left"].selected::after,
  .position-cell[data-pos="middle-left"].selected::after,
  .position-cell[data-pos="bottom-left"].selected::after {
    left: 6px;
  }
  .position-cell[data-pos="top-right"].selected::after,
  .position-cell[data-pos="middle-right"].selected::after,
  .position-cell[data-pos="bottom-right"].selected::after {
    right: 6px;
  }

  .form-stack {
    gap: 20px;
  }
  .row-2,
  .row-3 {
    gap: 18px;
  }
  .format-group label {
    font-size: 15px;
    margin-bottom: 14px;
  }
  .format-group select,
  .format-group input {
    height: 60px;
    font-size: 16px;
    border-radius: 18px;
    padding: 0 18px;
  }
  .mini-note {
    font-size: 14px;
    margin-top: 12px;
    margin-bottom: 12px;
  }

  .merge-btn {
    height: 70px;
    font-size: 18px;
    border-radius: 20px;
    margin-top: 28px;
  }

  .progress-wrap {
    height: 16px;
    margin-top: 28px;
  }
  .progress-text {
    margin-top: 14px;
    font-size: 15px;
  }
  .note {
    margin-top: 14px;
    font-size: 14px;
  }
  .empty-preview {
    padding: 28px;
    font-size: 16px;
    border-radius: 22px;
  }
}

/* ——— 2560 px ——— */
@media (min-width: 2560px) {
  body {
    padding: 52px 3vw;
  }

  h1 {
    font-size: 84px;
    letter-spacing: -3px;
  }

  .desc {
    max-width: 50vw;
    font-size: 22px;
    line-height: 1.8;
  }

  .title {
    gap: 30px;
    margin-bottom: 30px;
  }
  .top {
    margin-bottom: 34px;
  }

  .icon-box {
    width: 170px;
    height: 170px;
    border-radius: 36px;
    margin-bottom: 48px;
  }
  .icon-box i {
    font-size: 100px;
  }

  .features {
    gap: 26px;
    margin-top: 28px;
  }
  .feature {
    font-size: 20px;
    padding: 18px 28px;
    gap: 14px;
  }
  .feature i {
    font-size: 20px;
    border-width: 10px;
  }

  .tool-box {
    padding: 56px;
    border-radius: 44px;
  }

  .section-title {
    font-size: 34px;
    margin-bottom: 14px;
  }
  .sub {
    font-size: 21px;
    margin-bottom: 40px;
  }

  .drop {
    min-height: 400px;
    border-radius: 32px;
    padding: 44px;
    border-width: 3px;
  }
  .upload-circle {
    width: 120px;
    height: 120px;
    font-size: 52px;
    margin-bottom: 32px;
  }
  .drop h2 {
    font-size: 46px;
    margin-bottom: 18px;
  }
  .drop p {
    font-size: 21px;
    margin-bottom: 36px;
  }

  .browse-btn,
  .secondary-btn,
  .clear-chip {
    height: 76px;
    font-size: 20px;
    padding: 0 42px;
    border-radius: 20px;
  }

  .files {
    gap: 24px;
    margin-top: 26px;
  }
  .file {
    padding: 28px 34px;
    gap: 26px;
    border-radius: 24px;
  }
  .pdf-mini {
    width: 74px;
    height: 74px;
    font-size: 34px;
    border-radius: 24px;
  }
  .file-name {
    font-size: 23px;
    margin-bottom: 8px;
  }
  .size {
    font-size: 18px;
  }
  .trash {
    padding: 18px;
    font-size: 26px;
    border-radius: 18px;
  }

  .preview {
    margin-top: 26px;
    padding: 36px;
    border-radius: 34px;
  }
  .preview-head {
    margin-bottom: 22px;
  }
  .preview-head h3 {
    font-size: 26px;
  }
  .preview-list {
    gap: 28px;
  }
  .page-thumb {
    min-height: 580px;
    border-radius: 30px;
  }
  .page-canvas-wrap {
    padding: 24px;
  }
  .page-canvas-wrap canvas {
    border-radius: 18px;
  }
  .page-number-overlay {
    font-size: 20px;
    padding: 14px 20px;
  }
  .thumb-label {
    font-size: 19px;
    padding: 18px 22px 22px;
  }

  .setting-card {
    padding: 48px;
    border-radius: 42px;
  }
  .setting-head {
    margin-bottom: 26px;
  }
  .setting-chip {
    padding: 16px 24px;
    font-size: 17px;
    gap: 12px;
  }

  .options-grid {
    gap: 38px;
  }

  .panel {
    padding: 32px;
    border-radius: 30px;
  }
  .panel-title {
    font-size: 21px;
    margin-bottom: 22px;
    gap: 14px;
  }
  .panel-title i {
    font-size: 22px;
  }
  .hint {
    font-size: 17px;
    margin-top: 18px;
  }

  .page-mode-row {
    gap: 20px;
  }
  .mode-pill {
    padding: 22px 28px;
    gap: 16px;
    border-radius: 24px;
    flex: 1 1 240px;
  }
  .mode-pill span {
    font-size: 19px;
  }

  .position-wrap {
    gap: 28px;
  }
  .position-grid {
    width: 176px;
    height: 218px;
    border-radius: 18px;
  }
  .position-cell.selected::after {
    width: 32px;
    height: 32px;
  }
  .position-cell[data-pos="top-left"].selected::after,
  .position-cell[data-pos="top-center"].selected::after,
  .position-cell[data-pos="top-right"].selected::after {
    top: 8px;
  }
  .position-cell[data-pos="bottom-left"].selected::after,
  .position-cell[data-pos="bottom-center"].selected::after,
  .position-cell[data-pos="bottom-right"].selected::after {
    bottom: 8px;
  }
  .position-cell[data-pos="top-left"].selected::after,
  .position-cell[data-pos="middle-left"].selected::after,
  .position-cell[data-pos="bottom-left"].selected::after {
    left: 8px;
  }
  .position-cell[data-pos="top-right"].selected::after,
  .position-cell[data-pos="middle-right"].selected::after,
  .position-cell[data-pos="bottom-right"].selected::after {
    right: 8px;
  }

  .form-stack {
    gap: 26px;
  }
  .row-2,
  .row-3 {
    gap: 24px;
  }
  .format-group label {
    font-size: 18px;
    margin-bottom: 18px;
  }
  .format-group select,
  .format-group input {
    height: 76px;
    font-size: 19px;
    border-radius: 24px;
    padding: 0 24px;
  }
  .mini-note {
    font-size: 17px;
    margin-top: 16px;
    margin-bottom: 16px;
  }

  .merge-btn {
    height: 88px;
    font-size: 23px;
    border-radius: 28px;
    margin-top: 36px;
    box-shadow: 0 24px 48px rgba(99, 91, 255, 0.28);
  }

  .progress-wrap {
    height: 20px;
    margin-top: 36px;
  }
  .progress-text {
    margin-top: 18px;
    font-size: 18px;
  }
  .note {
    margin-top: 18px;
    font-size: 17px;
  }
  .empty-preview {
    padding: 36px;
    font-size: 21px;
    border-radius: 28px;
  }
}

/* =============================================================================
   SMALL SCREENS — mobile compaction
============================================================================= */

/* ——— 425 px ——— */
@media (max-width: 425px) {
  body {
    padding: 10px;
    font-size: 13px;
  }

  .main-card {
    padding-bottom: 0;
  }

  h1 {
    font-size: 26px;
    line-height: 1.15;
    letter-spacing: -1px;
  }

  .desc {
    font-size: 13px;
    line-height: 1.6;
  }

  .section-title {
    font-size: 17px;
  }

  .sub {
    font-size: 12px;
  }

  .feature {
    font-size: 12px;
    padding: 9px 12px;
    gap: 6px;
  }
  .feature i {
    font-size: 12px;
  }

  .tool-box {
    padding: 14px;
    border-radius: 18px;
  }

  .drop {
    min-height: 180px;
    border-radius: 16px;
    padding: 16px;
  }
  .upload-circle {
    width: 48px;
    height: 48px;
    font-size: 20px;
    margin-bottom: 12px;
  }
  .drop h2 {
    font-size: 18px;
    margin-bottom: 6px;
  }
  .drop p {
    font-size: 12px;
    margin-bottom: 14px;
  }

  .browse-btn,
  .secondary-btn,
  .clear-chip {
    height: 42px;
    padding: 0 16px;
    font-size: 12px;
    border-radius: 10px;
  }

  .files {
    gap: 10px;
    margin-top: 10px;
  }
  .file {
    padding: 12px 14px;
    gap: 10px;
    border-radius: 14px;
  }
  .pdf-mini {
    width: 36px;
    height: 36px;
    font-size: 15px;
    border-radius: 10px;
  }
  .file-name {
    font-size: 13px;
    margin-bottom: 3px;
    max-width: 140px;
  }
  .size {
    font-size: 11px;
  }
  .trash {
    padding: 8px;
    font-size: 13px;
    border-radius: 8px;
  }

  .preview {
    margin-top: 10px;
    padding: 12px;
    border-radius: 16px;
  }
  .preview-head {
    margin-bottom: 8px;
  }
  .preview-head h3 {
    font-size: 13px;
  }
  .preview-list {
    gap: 10px;
  }
  .page-thumb {
    min-height: 240px;
    border-radius: 14px;
  }
  .page-canvas-wrap {
    padding: 8px;
  }
  .page-canvas-wrap canvas {
    border-radius: 6px;
  }
  .page-number-overlay {
    font-size: 10px;
    padding: 4px 6px;
  }
  .thumb-label {
    font-size: 11px;
    padding: 8px 8px 10px;
  }

  .setting-card {
    padding: 14px;
    border-radius: 18px;
  }
  .setting-head {
    margin-bottom: 10px;
    gap: 8px;
  }
  .setting-chip {
    padding: 6px 10px;
    font-size: 11px;
  }

  .options-grid {
    gap: 14px;
  }

  .panel {
    padding: 12px;
    border-radius: 14px;
  }
  .panel-title {
    font-size: 12px;
    margin-bottom: 8px;
  }
  .hint {
    font-size: 11px;
    margin-top: 6px;
  }

  .page-mode-row {
    gap: 8px;
  }
  .mode-pill {
    padding: 10px 12px;
    gap: 8px;
    border-radius: 12px;
    flex: 1 1 140px;
  }
  .mode-pill span {
    font-size: 12px;
  }

  .position-wrap {
    gap: 10px;
  }
  .position-grid {
    width: 80px;
    height: 100px;
  }
  .position-cell.selected::after {
    width: 12px;
    height: 12px;
  }

  .form-stack {
    gap: 10px;
  }
  .row-2,
  .row-3 {
    gap: 8px;
  }
  .format-group label {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .format-group select,
  .format-group input {
    height: 44px;
    font-size: 13px;
    border-radius: 12px;
    padding: 0 12px;
  }
  .mini-note {
    font-size: 11px;
    margin-top: 6px;
    margin-bottom: 6px;
  }

  .merge-btn {
    height: 50px;
    font-size: 13px;
    border-radius: 12px;
    margin-top: 14px;
  }

  .progress-wrap {
    height: 8px;
    margin-top: 14px;
  }
  .progress-text {
    margin-top: 8px;
    font-size: 12px;
  }
  .note {
    margin-top: 8px;
    font-size: 11px;
  }
  .empty-preview {
    padding: 14px;
    font-size: 12px;
    border-radius: 14px;
  }
}

/* ——— 375 px ——— */
@media (max-width: 375px) {
  body {
    padding: 8px;
    font-size: 12.5px;
  }

  h1 {
    font-size: 23px;
    line-height: 1.2;
    letter-spacing: -0.8px;
  }

  .desc {
    font-size: 12px;
    line-height: 1.5;
  }

  .section-title {
    font-size: 15px;
  }

  .sub {
    font-size: 11.5px;
  }

  .title {
    gap: 10px;
  }

  .feature {
    font-size: 11.5px;
    padding: 8px 10px;
  }
  .feature i {
    font-size: 11px;
    border-width: 6px;
  }

  .tool-box {
    padding: 12px;
    border-radius: 16px;
  }

  .drop {
    min-height: 160px;
    border-radius: 14px;
    padding: 14px;
  }
  .upload-circle {
    width: 42px;
    height: 42px;
    font-size: 18px;
    margin-bottom: 10px;
  }
  .drop h2 {
    font-size: 17px;
  }
  .drop p {
    font-size: 11px;
    margin-bottom: 12px;
  }

  .browse-btn,
  .secondary-btn,
  .clear-chip {
    height: 40px;
    padding: 0 14px;
    font-size: 12px;
    border-radius: 10px;
  }

  .file {
    padding: 10px 12px;
    gap: 8px;
  }
  .pdf-mini {
    width: 32px;
    height: 32px;
    font-size: 14px;
    border-radius: 8px;
  }
  .file-name {
    font-size: 12px;
    margin-bottom: 2px;
    max-width: 120px;
  }
  .size {
    font-size: 10.5px;
  }
  .trash {
    padding: 6px;
    font-size: 12px;
  }

  .preview {
    padding: 10px;
    border-radius: 14px;
  }
  .preview-head h3 {
    font-size: 12px;
  }
  .page-thumb {
    min-height: 210px;
    border-radius: 12px;
  }
  .page-number-overlay {
    font-size: 9px;
    padding: 3px 5px;
  }
  .thumb-label {
    font-size: 10px;
    padding: 6px;
  }

  .setting-card {
    padding: 12px;
    border-radius: 16px;
  }
  .setting-chip {
    font-size: 10px;
    padding: 5px 8px;
  }

  .panel {
    padding: 10px;
    border-radius: 12px;
  }
  .panel-title {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .mode-pill {
    padding: 8px 10px;
    flex: 1 1 120px;
  }
  .mode-pill span {
    font-size: 11px;
  }

  .position-grid {
    width: 72px;
    height: 90px;
  }
  .position-cell.selected::after {
    width: 10px;
    height: 10px;
  }

  .format-group label {
    font-size: 11px;
    margin-bottom: 5px;
  }
  .format-group select,
  .format-group input {
    height: 42px;
    font-size: 12px;
    border-radius: 10px;
  }
  .mini-note {
    font-size: 10px;
  }

  .merge-btn {
    height: 46px;
    font-size: 12.5px;
    border-radius: 12px;
    margin-top: 12px;
  }

  .progress-text {
    font-size: 11px;
  }
  .note {
    font-size: 10px;
  }
  .empty-preview {
    padding: 12px;
    font-size: 11px;
    border-radius: 12px;
  }
}

/* ——— 325 px ——— */
@media (max-width: 325px) {
  body {
    padding: 6px;
    font-size: 12px;
  }

  .tool-box {
    padding: 10px;
    border-radius: 14px;
  }

  h1 {
    font-size: 21px;
    line-height: 1.18;
    letter-spacing: -0.6px;
  }

  .desc {
    font-size: 11.5px;
    line-height: 1.45;
  }

  .section-title {
    font-size: 14px;
  }

  .sub {
    font-size: 10.5px;
  }

  .title {
    gap: 8px;
  }

  .feature {
    font-size: 10.5px;
    padding: 7px 9px;
    gap: 5px;
  }
  .feature i {
    font-size: 10px;
    border-width: 5px;
  }

  .drop {
    min-height: 145px;
    border-radius: 12px;
    padding: 12px;
    border-width: 1.5px;
  }
  .upload-circle {
    width: 38px;
    height: 38px;
    font-size: 16px;
    margin-bottom: 8px;
  }
  .drop h2 {
    font-size: 15px;
    margin-bottom: 4px;
  }
  .drop p {
    font-size: 10.5px;
    margin-bottom: 10px;
  }

  .browse-btn,
  .secondary-btn,
  .clear-chip {
    height: 38px;
    padding: 0 12px;
    font-size: 11.5px;
    border-radius: 10px;
  }

  .file {
    padding: 8px 10px;
    gap: 6px;
    border-radius: 12px;
  }
  .pdf-mini {
    width: 28px;
    height: 28px;
    font-size: 12px;
    border-radius: 6px;
  }
  .file-name {
    font-size: 11px;
    max-width: 100px;
  }
  .size {
    font-size: 10px;
  }
  .trash {
    padding: 5px;
    font-size: 11px;
    border-radius: 6px;
  }

  .preview {
    padding: 8px;
    border-radius: 12px;
  }
  .preview-head h3 {
    font-size: 11px;
  }
  .page-thumb {
    min-height: 180px;
    border-radius: 10px;
  }
  .page-canvas-wrap {
    padding: 6px;
  }
  .page-number-overlay {
    font-size: 8px;
    padding: 2px 4px;
  }
  .thumb-label {
    font-size: 9px;
    padding: 4px;
  }

  .setting-card {
    padding: 10px;
    border-radius: 14px;
  }
  .setting-chip {
    font-size: 9px;
    padding: 4px 6px;
  }

  .panel {
    padding: 8px;
    border-radius: 10px;
  }
  .panel-title {
    font-size: 10px;
    margin-bottom: 4px;
  }
  .hint {
    font-size: 9px;
  }

  .mode-pill {
    padding: 6px 8px;
    flex: 1 1 100px;
  }
  .mode-pill span {
    font-size: 10px;
  }

  .position-grid {
    width: 64px;
    height: 80px;
  }
  .position-cell.selected::after {
    width: 8px;
    height: 8px;
  }

  .form-stack {
    gap: 8px;
  }
  .row-2,
  .row-3 {
    gap: 6px;
  }
  .format-group label {
    font-size: 10px;
    margin-bottom: 4px;
  }
  .format-group select,
  .format-group input {
    height: 40px;
    font-size: 11px;
    border-radius: 10px;
    padding: 0 10px;
  }
  .mini-note {
    font-size: 9px;
  }

  .merge-btn {
    height: 42px;
    font-size: 12px;
    border-radius: 10px;
    margin-top: 10px;
  }

  .progress-wrap {
    height: 6px;
    margin-top: 10px;
  }
  .progress-text {
    font-size: 10px;
    min-height: 12px;
  }
  .note {
    font-size: 9px;
  }
  .empty-preview {
    padding: 10px;
    font-size: 10px;
    border-radius: 10px;
  }
}

/* =============================================================================
   THUMBNAIL WHITESPACE FIX — paste these rules into pgnopdf.css,
   replacing the existing .page-thumb / .page-canvas-wrap / canvas rules
============================================================================= */

.page-thumb {
  border: 1px solid #e5e9f3;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  position: relative;
  /* min-height removed — content height drives the card */
}

.page-canvas-wrap {
  position: relative;
  width: 100%;
  padding: 0; /* ← KEY FIX: was 12px */
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  line-height: 0; /* prevent phantom gap under <img> */
  /* border-bottom removed — no separator line needed */
}

.page-canvas-wrap canvas,
.page-canvas-wrap img.page-canvas {
  width: 100%; /* ← fills card edge-to-edge */
  height: auto;
  display: block; /* kills inline baseline gap */
  border-radius: 0; /* no inner radius */
  box-shadow: none;
}

.page-number-overlay {
  position: absolute;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid rgba(99, 91, 255, 0.12);
  background: rgba(240, 237, 255, 0.96);
  color: var(--primary);
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
}

.thumb-label {
  font-size: 12px;
  color: #7f8799;
  padding: 8px 12px 10px;
  text-align: center;
  background: #f8f9fb;
  border-top: 1px solid #ececff;
}

/* ── Dark mode ─────────────────────────────────────────────────── */

body.dark .page-canvas-wrap {
  background: #0b1120 !important;
  border-bottom: none !important;
  padding: 0 !important;
}

body.dark .page-thumb {
  background: #111827 !important;
  border-color: var(--border) !important;
}

/* ── Large-screen overrides (1440px +) ─────────────────────────── */
/* These neutralise any padding/radius re-introduced by the breakpoints */

@media (min-width: 1440px) {
  .page-canvas-wrap {
    padding: 0 !important;
  }
  .page-canvas-wrap canvas,
  .page-canvas-wrap img.page-canvas {
    border-radius: 0 !important;
  }
  .page-thumb {
    min-height: unset;
  }
}

@media (min-width: 1600px) {
  .page-canvas-wrap {
    padding: 0 !important;
  }
  .page-canvas-wrap canvas,
  .page-canvas-wrap img.page-canvas {
    border-radius: 0 !important;
  }
}

@media (min-width: 1920px) {
  .page-canvas-wrap {
    padding: 0 !important;
  }
  .page-canvas-wrap canvas,
  .page-canvas-wrap img.page-canvas {
    border-radius: 0 !important;
  }
  .page-thumb {
    min-height: unset;
  }
}

@media (min-width: 2560px) {
  .page-canvas-wrap {
    padding: 0 !important;
  }
  .page-canvas-wrap canvas,
  .page-canvas-wrap img.page-canvas {
    border-radius: 0 !important;
  }
}

/* ── Small screens ─────────────────────────────────────────────── */

@media (max-width: 425px) {
  .page-canvas-wrap {
    padding: 0 !important;
  }
  .page-canvas-wrap canvas,
  .page-canvas-wrap img.page-canvas {
    border-radius: 0 !important;
  }
  .page-thumb {
    min-height: unset;
    border-radius: 14px;
  }
}

@media (max-width: 375px) {
  .page-canvas-wrap {
    padding: 0 !important;
  }
  .page-thumb {
    min-height: unset;
    border-radius: 12px;
  }
}

@media (max-width: 325px) {
  .page-canvas-wrap {
    padding: 0 !important;
  }
  .page-thumb {
    min-height: unset;
    border-radius: 10px;
  }
}

body.dark .position-grid {
  gap: 0px !important;
}

@media (max-width: 600px) {
  .page-container {
    padding-left: 0px !important;
    padding-right: 0px !important;
    padding-top: 0px !important;
  }
}
