* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

: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;
  --danger: #ff5b6e;
  --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: 1200px;
  margin: 0 auto;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 34px;
  margin-bottom: 28px;
}

.left {
  flex: 1;
  min-width: 0;
}

.title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.small-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.actions-bar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin: 14px 0 16px;
}

.btn {
  border: none;
  height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--primary), var(--primary2));
  color: white;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 12px 25px rgba(99, 91, 255, 0.2);
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn.secondary {
  background: #fff;
  color: #5f6780;
  border: 1px solid #dde1ef;
  box-shadow: none;
}

.btn.secondary:hover {
  border-color: #cdd3ea;
}

.btn.ghost {
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid #e5e8f5;
  background: white;
  color: #50576b;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s ease;
  box-shadow: none;
}

.btn.ghost:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #6958ff;
  color: #6958ff;
}

.btn.ghost i {
  margin-right: 7px;
}

.btn:disabled,
.btn.ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.icon-box {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #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 {
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -1.6px;
  margin-bottom: 0px !important;
}

.desc {
  max-width: 650px;
  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: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  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: 0 10px 28px rgba(99, 91, 255, 0.05);
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.sub {
  color: var(--muted-2);
  font-size: 13px;
  margin-bottom: 18px;
}

.drop {
  border: 2px dashed #d9d2ff;
  background: linear-gradient(180deg, #ffffff, #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: white;
  font-size: 28px;
  box-shadow: 0 14px 28px rgba(99, 91, 255, 0.26);
}

.drop h2 {
  font-size: 24px;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.drop p {
  color: var(--muted-2);
  margin-bottom: 18px;
  font-size: 14px;
}

.browse-btn,
.merge-btn,
.small-btn,
.icon-btn {
  border: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

.browse-btn {
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  background: linear-gradient(to right, var(--primary), var(--primary-2));
  color: white;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 12px 25px rgba(99, 91, 255, 0.22);
  transition: 0.2s ease;
}

.browse-btn:hover {
  transform: translateY(-1px);
}

.browse-btn i {
  margin-right: 8px;
}

input[type="file"] {
  display: none;
}

.files {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  --page-count: 1;
}

.uploaded-file {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
}

.uploaded-file-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.uploaded-file-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: #eef4ff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.uploaded-file-info {
  min-width: 0;
}

.uploaded-file-name {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uploaded-file-meta {
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

.uploaded-remove-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: #fee2e2;
  color: #dc2626;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
}

.page-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 25px rgba(99, 91, 255, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  flex: 0 0 auto;
  width: clamp(
    240px,
    calc((100% - (14px * (var(--page-count) - 1))) / var(--page-count)),
    360px
  );
  scroll-snap-align: start;
  transition: 0.2s ease;
}

.page-card.selected {
  border-color: #6958ff;
  box-shadow: 0 16px 28px rgba(105, 88, 255, 0.16);
}

.page-thumb {
  position: relative;
  background: linear-gradient(180deg, #fdfdff, #f4f3ff);
  padding: 14px;
  flex: 1;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(31, 34, 59, 0.08);
  background: white;
  object-fit: contain;
}

.page-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(105, 88, 255, 0.95);
  color: white;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(105, 88, 255, 0.25);
}

.page-check {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 22px;
  height: 22px;
}

.page-select {
  width: 22px;
  height: 22px;
  accent-color: #6958ff;
  cursor: pointer;
}

.page-body {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.page-name {
  font-size: 13px;
  font-weight: 700;
  color: #2f3547;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-btn,
.small-btn {
  height: 36px;
  border-radius: 10px;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 700;
  transition: 0.2s ease;
}

.icon-btn {
  flex: 1;
  background: #f5f6ff;
  color: #4f566b;
  border: 1px solid #e6e9fb;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: #d7dbf4;
  transform: translateY(-1px);
}

.icon-btn.danger {
  background: #fff3f5;
  color: #d93d55;
  border-color: #ffd8de;
}

.drag-handle {
  cursor: grab;
}

.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

.reorder {
  margin-top: 12px;
  color: #9aa1b2;
  font-size: 12px;
  background: rgba(154, 161, 184, 0.18);
  width: max-content;
  padding: 7px 12px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.reorder svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
}

.settings {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.setting-card {
  border: 1px solid rgba(224, 227, 242, 0.95);
  border-radius: 22px;
  padding: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbff 100%);
  box-shadow: 0 14px 30px rgba(99, 91, 255, 0.06);
}

.setting-card label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #4f566b;
}

select {
  width: 100%;
  height: 52px;
  border-radius: 16px;
  border: 1px solid #dde1ef;
  background: #fff;
  padding: 0 15px;
  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);
}

select:hover {
  border-color: #cbd2e8;
}

select:focus {
  border-color: #6958ff;
  box-shadow: 0 0 0 4px rgba(105, 88, 255, 0.12);
}

.merge-btn {
  width: 100%;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(to right, var(--primary), #836dff);
  margin-top: 18px;
  color: white;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 18px 30px rgba(99, 91, 255, 0.22);
  transition: 0.22s ease;
  cursor: pointer;
}

.merge-btn:hover {
  transform: translateY(-2px);
}

.merge-btn i {
  margin-right: 8px;
}

.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;
}

.empty-state {
  width: 100%;
  padding: 22px;
  color: var(--muted-2);
  font-size: 13px;
  border: 1px dashed #e2e5f3;
  border-radius: 18px;
  background: #fff;
}

.quick-tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 12px;
}

.tool-btn {
  height: 52px;
  border-radius: 16px;
  border: 1px solid #e4e7f5;
  background: white;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #2f3547;
  cursor: pointer;
  transition: 0.22s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.tool-btn:hover {
  transform: translateY(-2px);
  border-color: #6958ff;
  box-shadow: 0 12px 25px rgba(105, 88, 255, 0.08);
}

.tool-btn i {
  color: #6958ff;
  font-size: 20px;
}

.tool-btn.danger i {
  color: #ff5d6c;
}

.tool-btn.danger:hover {
  border-color: #ffd7dc;
  background: #fff8f9;
}

.equal-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
  margin-top: 24px;
}

.equal-card {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  border: 1px solid rgba(224, 227, 242, 0.95);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbff 100%);
  box-shadow: 0 14px 30px rgba(99, 91, 255, 0.06);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.tool-grid .tool-btn {
  height: 90px;
  flex-direction: column;
  font-weight: 600;
}

.option-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 18px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-group label {
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
}

.option-group select {
  height: 52px;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  outline: none;
  transition: 0.2s ease;
}

.option-group select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

/* ==============================================
   LARGE SCREENS — starts at 1200px
=============================================== */

@media (min-width: 1200px) {
  body {
    padding: 30px 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: 112px;
    height: 112px;
    border-radius: 20px;
  }
  .icon-box i {
    font-size: 66px;
  }

  .features {
    gap: 18px;
    margin-top: 18px;
  }
  .feature {
    font-size: 14px;
    padding: 12px 18px;
  }

  .tool-box {
    padding: 32px;
    border-radius: 28px;
  }
  .section-title {
    font-size: 21px;
  }
  .sub {
    font-size: 14px;
  }

  .drop {
    min-height: 270px;
    border-radius: 24px;
  }
  .drop h2 {
    font-size: 27px;
  }
  .drop p {
    font-size: 15px;
  }
  .upload-circle {
    width: 80px;
    height: 80px;
    font-size: 32px;
  }
  .browse-btn {
    height: 50px;
    padding: 0 26px;
    font-size: 15px;
  }

  .btn {
    height: 50px;
    font-size: 15px;
  }
  .btn.ghost {
    height: 46px;
    font-size: 14px;
  }

  .page-card {
    min-height: 400px;
    width: clamp(
      280px,
      calc((100% - (14px * (var(--page-count) - 1))) / var(--page-count)),
      400px
    );
  }
  .page-thumb {
    min-height: 340px;
    padding: 18px;
  }
  .page-badge {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  .page-body {
    padding: 14px;
  }
  .page-name {
    font-size: 14px;
    margin-bottom: 12px;
  }
  .icon-btn,
  .small-btn {
    height: 40px;
    font-size: 14px;
  }

  .quick-tools {
    gap: 16px;
  }
  .tool-btn {
    height: 56px;
    font-size: 15px;
  }
  .tool-btn i {
    font-size: 22px;
  }
  .tool-grid .tool-btn {
    height: 100px;
  }

  .setting-card,
  .equal-card {
    padding: 28px;
    border-radius: 26px;
  }
  .setting-card label,
  .option-group label {
    font-size: 14px;
  }
  select,
  .option-group select {
    height: 56px;
    font-size: 15px;
  }

  .merge-btn {
    height: 58px;
    font-size: 16px;
  }
}

/* ——— 1600 px ——— */
@media (min-width: 1600px) {
  body {
    padding: 38px 3vw;
  }
  h1 {
    font-size: 56px;
    letter-spacing: -2px;
  }
  .desc {
    font-size: 16.5px;
  }

  .icon-box {
    width: 120px;
    height: 120px;
  }
  .icon-box i {
    font-size: 72px;
  }

  .tool-box {
    padding: 36px;
  }
  .section-title {
    font-size: 23px;
  }
  .sub {
    font-size: 15px;
  }

  .drop {
    min-height: 290px;
  }
  .drop h2 {
    font-size: 30px;
  }
  .drop p {
    font-size: 16px;
  }
  .upload-circle {
    width: 86px;
    height: 86px;
    font-size: 34px;
  }
  .browse-btn {
    height: 54px;
    font-size: 15.5px;
  }

  .page-card {
    min-height: 440px;
  }
  .tool-grid .tool-btn {
    height: 110px;
    font-size: 16px;
  }
  .merge-btn {
    height: 62px;
    font-size: 17px;
  }
}

/* ——— 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: 20px;
  }
  .top {
    gap: 60px;
    margin-bottom: 40px;
  }

  .icon-box {
    width: 134px;
    height: 134px;
    border-radius: 24px;
  }
  .icon-box i {
    font-size: 80px;
  }

  .features {
    gap: 20px;
    margin-top: 22px;
  }
  .feature {
    font-size: 16px;
    padding: 14px 22px;
    gap: 10px;
  }
  .feature i {
    font-size: 16px;
  }

  .tool-box {
    padding: 44px;
    border-radius: 34px;
  }
  .section-title {
    font-size: 26px;
    margin-bottom: 10px;
  }
  .sub {
    font-size: 17px;
    margin-bottom: 26px;
  }

  .drop {
    min-height: 330px;
    border-radius: 28px;
  }
  .drop h2 {
    font-size: 34px;
    margin-bottom: 14px;
  }
  .drop p {
    font-size: 18px;
    margin-bottom: 28px;
  }
  .upload-circle {
    width: 96px;
    height: 96px;
    font-size: 38px;
    margin-bottom: 26px;
  }
  .browse-btn {
    height: 58px;
    padding: 0 32px;
    font-size: 17px;
    border-radius: 14px;
  }

  .btn {
    height: 56px;
    font-size: 16px;
    border-radius: 14px;
  }
  .btn.ghost {
    height: 52px;
    font-size: 15px;
    border-radius: 14px;
  }

  .files {
    gap: 18px;
  }
  .page-card {
    min-height: 500px;
    border-radius: 22px;
    width: clamp(
      320px,
      calc((100% - (18px * (var(--page-count) - 1))) / var(--page-count)),
      460px
    );
  }
  .page-thumb {
    min-height: 420px;
    padding: 22px;
  }
  .page-badge {
    width: 36px;
    height: 36px;
    font-size: 16px;
    top: 16px;
    left: 16px;
  }
  .page-check {
    top: 16px;
    right: 16px;
  }
  .page-select {
    width: 26px;
    height: 26px;
  }
  .page-body {
    padding: 16px 18px;
  }
  .page-name {
    font-size: 16px;
    margin-bottom: 14px;
  }
  .page-actions {
    gap: 10px;
  }
  .icon-btn,
  .small-btn {
    height: 46px;
    padding: 0 16px;
    font-size: 15px;
    border-radius: 12px;
  }

  .quick-tools {
    gap: 18px;
    margin-top: 16px;
  }
  .tool-btn {
    height: 64px;
    font-size: 16px;
    border-radius: 14px;
  }
  .tool-btn i {
    font-size: 24px;
  }
  .tool-grid .tool-btn {
    height: 120px;
    gap: 14px;
    font-size: 17px;
  }
  .tool-grid .tool-btn i {
    font-size: 28px;
  }

  .reorder {
    font-size: 14px;
    padding: 9px 16px;
    margin-top: 20px;
  }
  .reorder svg {
    width: 18px;
    height: 18px;
  }

  .setting-card,
  .equal-card {
    padding: 36px;
    border-radius: 28px;
  }
  .format-row {
    gap: 26px;
  }
  .setting-card label,
  .option-group label {
    font-size: 16px;
    margin-bottom: 14px;
  }
  select,
  .option-group select {
    height: 62px;
    font-size: 16px;
    border-radius: 14px;
    padding: 0 18px;
  }

  .merge-btn {
    height: 70px;
    font-size: 19px;
    border-radius: 18px;
    margin-top: 28px;
  }
}

/* ——— 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: 28px;
  }
  .top {
    gap: 80px;
    margin-bottom: 56px;
  }

  .icon-box {
    width: 170px;
    height: 170px;
    border-radius: 30px;
  }
  .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: 60px;
    border-radius: 42px;
  }
  .section-title {
    font-size: 34px;
    margin-bottom: 14px;
  }
  .sub {
    font-size: 21px;
    margin-bottom: 34px;
  }

  .drop {
    min-height: 430px;
    border-radius: 36px;
    border-width: 3px;
  }
  .drop h2 {
    font-size: 48px;
    margin-bottom: 18px;
    letter-spacing: -1px;
  }
  .drop p {
    font-size: 23px;
    margin-bottom: 38px;
  }
  .upload-circle {
    width: 124px;
    height: 124px;
    font-size: 52px;
    margin-bottom: 34px;
    box-shadow: 0 24px 48px rgba(99, 91, 255, 0.3);
  }
  .browse-btn {
    height: 78px;
    padding: 0 48px;
    font-size: 21px;
    border-radius: 20px;
  }

  .btn {
    height: 74px;
    font-size: 19px;
    border-radius: 18px;
  }
  .btn.ghost {
    height: 68px;
    font-size: 18px;
    border-radius: 16px;
  }

  .files {
    gap: 24px;
  }
  .page-card {
    min-height: 640px;
    border-radius: 28px;
    width: clamp(
      420px,
      calc((100% - (24px * (var(--page-count) - 1))) / var(--page-count)),
      580px
    );
  }
  .page-thumb {
    min-height: 560px;
    padding: 30px;
  }
  .page-badge {
    width: 44px;
    height: 44px;
    font-size: 20px;
    top: 20px;
    left: 20px;
  }
  .page-check {
    top: 20px;
    right: 20px;
  }
  .page-select {
    width: 30px;
    height: 30px;
  }
  .page-body {
    padding: 22px 26px;
  }
  .page-name {
    font-size: 20px;
    margin-bottom: 18px;
  }
  .page-actions {
    gap: 12px;
  }
  .icon-btn,
  .small-btn {
    height: 58px;
    padding: 0 22px;
    font-size: 18px;
    border-radius: 16px;
  }

  .quick-tools {
    gap: 22px;
    margin-top: 20px;
  }
  .tool-btn {
    height: 80px;
    font-size: 19px;
    border-radius: 18px;
    border-width: 2px;
  }
  .tool-btn i {
    font-size: 30px;
  }
  .tool-grid {
    gap: 20px;
  }
  .tool-grid .tool-btn {
    height: 150px;
    gap: 18px;
    font-size: 21px;
  }
  .tool-grid .tool-btn i {
    font-size: 36px;
  }

  .reorder {
    font-size: 18px;
    padding: 12px 22px;
    margin-top: 26px;
    border-radius: 50px;
    gap: 12px;
  }
  .reorder svg {
    width: 22px;
    height: 22px;
  }

  .setting-card,
  .equal-card {
    padding: 44px;
    border-radius: 34px;
  }
  .format-row {
    gap: 34px;
  }
  .setting-card label,
  .option-group label {
    font-size: 20px;
    margin-bottom: 20px;
  }
  select,
  .option-group select {
    height: 78px;
    font-size: 19px;
    border-radius: 18px;
    padding: 0 24px;
  }

  .merge-btn {
    height: 88px;
    font-size: 23px;
    border-radius: 24px;
    margin-top: 36px;
    box-shadow: 0 24px 48px rgba(99, 91, 255, 0.28);
  }
}

/* =========================
   SMALL SCREENS
========================= */

@media (max-width: 950px) {
  .top {
    flex-direction: column;
    align-items: flex-start;
  }
  .settings {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .icon-box {
    display: none;
  }
  .feature {
    padding: 11px 16px 11px 0px;
  }
}

@media (max-width: 700px) {
  .files {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  }
  .quick-tools {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  body {
    padding: 14px;
  }
  .main-card {
    padding: 18px;
    border-radius: 22px;
  }
  .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;
  }
  .page-card {
    min-height: 320px;
  }
  .page-thumb {
    min-height: 260px;
  }
}

@media (max-width: 425px) {
  body {
    padding: 10px;
    font-size: 13px;
  }
  .main-card {
    padding-bottom: 0;
  }
  h1 {
    font-size: 26px;
    line-height: 1.15;
  }
  .desc {
    font-size: 13px;
    line-height: 1.6;
  }
  .section-title {
    font-size: 16px;
  }
  .sub {
    font-size: 12px;
  }
  .feature {
    font-size: 12px;
    padding: 9px 12px;
    gap: 6px;
  }
  .feature i {
    font-size: 12px;
  }
  .drop h2 {
    font-size: 18px;
  }
  .drop p {
    font-size: 12px;
  }
  .browse-btn,
  .merge-btn {
    font-size: 13px;
    height: 46px;
  }
  .btn.ghost {
    font-size: 12px;
    height: 38px;
  }
  .page-name {
    font-size: 12px;
  }
  .icon-btn,
  .small-btn {
    font-size: 12px;
    height: 34px;
  }
  .setting-card label {
    font-size: 12px;
  }
  select,
  .option-group select {
    font-size: 13px;
    height: 46px;
  }
  .tool-btn {
    font-size: 13px;
    height: 46px;
  }
  .tool-grid .tool-btn {
    height: 70px;
  }
  .reorder {
    font-size: 11px;
    padding: 5px 10px;
  }
  .icon-box {
    display: none;
  }
  .tool-box,
  .setting-card,
  .equal-card {
    padding: 14px;
    border-radius: 16px;
  }
  .drop {
    min-height: 180px;
    padding: 16px;
  }
  .settings {
    gap: 12px;
  }
  .actions-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .small-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 375px) {
  body {
    padding: 8px;
    font-size: 12.5px;
  }
  h1 {
    font-size: 23px;
    line-height: 1.2;
  }
  .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;
  }
  .drop {
    min-height: 165px;
    padding: 14px;
    border-radius: 16px;
  }
  .drop h2 {
    font-size: 17px;
  }
  .drop p {
    font-size: 11.5px;
  }
  .upload-circle {
    width: 52px;
    height: 52px;
    font-size: 22px;
  }
  .browse-btn,
  .merge-btn {
    font-size: 12.5px;
    height: 44px;
    border-radius: 10px;
  }
  .btn.ghost {
    font-size: 11px;
    height: 36px;
  }
  .page-card {
    min-height: 280px;
  }
  .page-thumb {
    min-height: 220px;
  }
  .page-badge {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  .icon-btn,
  .small-btn {
    font-size: 11px;
    height: 32px;
  }
  .tool-btn {
    font-size: 12px;
    height: 42px;
  }
  .tool-grid .tool-btn {
    height: 64px;
  }
  .setting-card,
  .equal-card {
    padding: 12px;
    border-radius: 14px;
  }
  .setting-card label,
  .option-group label {
    font-size: 11.5px;
  }
  select,
  .option-group select {
    font-size: 12.5px;
    height: 42px;
    border-radius: 10px;
  }
  .reorder {
    font-size: 10.5px;
    padding: 5px 9px;
  }
  .tool-box {
    padding: 12px;
    border-radius: 16px;
  }
  .icon-box {
    display: none;
  }
}

@media (max-width: 325px) {
  body {
    padding: 6px;
    font-size: 12px;
  }
  .tool-box,
  .setting-card,
  .equal-card {
    padding: 10px;
    border-radius: 12px;
  }
  h1 {
    font-size: 21px;
    line-height: 1.18;
  }
  .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;
  }
  .drop {
    min-height: 150px;
    padding: 12px;
    border-radius: 14px;
  }
  .drop h2 {
    font-size: 15px;
  }
  .drop p {
    font-size: 10.5px;
    margin-bottom: 12px;
  }
  .upload-circle {
    width: 48px;
    height: 48px;
    font-size: 20px;
    margin-bottom: 12px;
  }
  .browse-btn,
  .merge-btn {
    height: 42px;
    font-size: 12px;
    border-radius: 10px;
  }
  .btn.ghost {
    height: 34px;
    font-size: 10px;
  }
  .page-card {
    min-height: 240px;
  }
  .page-thumb {
    min-height: 180px;
  }
  .page-body {
    padding: 10px;
  }
  .page-name {
    font-size: 11px;
    margin-bottom: 6px;
  }
  .icon-btn,
  .small-btn {
    font-size: 10px;
    height: 30px;
    padding: 0 8px;
  }
  .tool-btn {
    font-size: 11px;
    height: 38px;
  }
  .tool-grid .tool-btn {
    height: 56px;
  }
  .setting-card label,
  .option-group label {
    font-size: 11px;
    margin-bottom: 8px;
  }
  select,
  .option-group select {
    height: 40px;
    font-size: 12px;
    border-radius: 10px;
  }
  .reorder {
    font-size: 10px;
    padding: 4px 8px;
    gap: 4px;
  }
  .icon-box {
    display: none;
  }
}

/* =========================
   ORGANISE PDF DARK MODE
========================= */

body.dark {
  color-scheme: dark;

  --bg: #0b1020;
  --card: #11172a;
  --card-2: #0f1628;
  --text: #edf2ff;
  --muted: #a7b0ca;
  --muted-2: #8d97b4;
  --border: rgba(148, 163, 184, 0.14);

  --primary: #8b7bff;
  --primary-2: #a18fff;
  --primary-soft: rgba(139, 123, 255, 0.12);
  --danger: #ff6b81;
}

body.dark {
  background:
    radial-gradient(circle at top, rgba(139, 123, 255, 0.12), transparent 35%),
    var(--bg);
  color: var(--text);
}

/* Main blocks */
body.dark .tool-box,
body.dark .setting-card,
body.dark .equal-card,
body.dark .drop,
body.dark .files,
body.dark .actions-bar,
body.dark .progress-wrap,
body.dark .empty-state,
body.dark .uploaded-file {
  background: var(--card) !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
}

body.dark .reorder {
  background: rgba(139, 123, 255, 0.12);
  color: #c7d0ff;
}

body.dark .reorder svg {
  color: #60a5fa !important;
}

/* Headings */
body.dark h1,
body.dark h2,
body.dark h3,
body.dark h4,
body.dark .section-title {
  color: #f8fafc !important;
}

/* Text */
body.dark .desc,
body.dark .sub,
body.dark p,
body.dark label,
body.dark .reorder span,
body.dark .progress-text,
body.dark .page-name,
body.dark .uploaded-file-meta {
  color: #94a3b8 !important;
}

/* Features — no background */
body.dark .features {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark .feature {
  background: transparent !important;
  color: #cbd5e1 !important;
  box-shadow: none !important;
}

body.dark .feature i {
  color: #60a5fa !important;
}

/* Upload area */
body.dark .drop {
  background: var(--card-2) !important;
  border: 1px dashed rgba(148, 163, 184, 0.25) !important;
}

body.dark .drop:hover,
body.dark .drop.drag-over {
  border-color: var(--primary) !important;
}

body.dark .upload-circle {
  background: linear-gradient(
    to bottom,
    var(--primary),
    var(--primary-2)
  ) !important;
}

/* Buttons */
body.dark .browse-btn,
body.dark .merge-btn {
  background: linear-gradient(
    to right,
    var(--primary),
    var(--primary-2)
  ) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28) !important;
}

body.dark .browse-btn:hover,
body.dark .merge-btn:hover {
  filter: brightness(1.1);
}

body.dark .merge-btn.disabled,
body.dark .merge-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.dark .btn.ghost,
body.dark .tool-btn {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: rgba(148, 163, 184, 0.14) !important;
}

body.dark .browse-btn:hover,
body.dark .merge-btn:hover,
body.dark .btn.ghost:hover:not(:disabled),
body.dark .tool-btn:hover {
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

body.dark .tool-btn i {
  color: var(--primary) !important;
}

body.dark .tool-btn.danger {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #fca5a5 !important;
}

body.dark .tool-btn.danger:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #ffffff !important;
}

body.dark .tool-btn.danger i {
  color: #ef4444 !important;
}

body.dark .icon-btn {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: rgba(148, 163, 184, 0.14) !important;
}

body.dark .icon-btn:hover {
  border-color: var(--primary) !important;
}

body.dark .icon-btn.danger {
  background: rgba(239, 68, 68, 0.1) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

body.dark .icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #ffffff !important;
}

/* Selects */
body.dark select,
body.dark .option-group select {
  background: #0f172a !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(148, 163, 184, 0.18) !important;
}

body.dark select:focus,
body.dark .option-group select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(139, 123, 255, 0.15) !important;
}

/* Safe-looking files/cards */
body.dark .page-card {
  background: #0f172a !important;
  border-color: rgba(148, 163, 184, 0.14) !important;
}

body.dark .page-card.selected {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(139, 123, 255, 0.25) !important;
}

body.dark .page-thumb {
  background: linear-gradient(180deg, #0b1220, #0f172a) !important;
}

body.dark canvas {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4) !important;
}

body.dark .page-badge {
  background: var(--primary) !important;
}

body.dark .page-select {
  accent-color: var(--primary) !important;
}

body.dark .file-item,
body.dark .file-card {
  background: #0f172a !important;
  border-color: rgba(148, 163, 184, 0.12) !important;
}

/* Uploaded file */
body.dark .uploaded-file-icon {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #60a5fa !important;
}

body.dark .uploaded-file-name {
  color: #f8fafc !important;
}

body.dark .uploaded-remove-btn {
  background: rgba(239, 68, 68, 0.1) !important;
  color: #ef4444 !important;
}

body.dark .uploaded-remove-btn:hover {
  background: #dc2626 !important;
  color: white !important;
}

/* Tool grid */
body.dark .tool-grid .tool-btn {
  background: #0f172a !important;
}

/* Progress */
body.dark .progress-wrap {
  background: #1e293b !important;
}

body.dark .progress-bar {
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--primary-2)
  ) !important;
}

/* Scrollbar */
body.dark ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
body.dark ::-webkit-scrollbar-track {
  background: #0f162a;
}
body.dark ::-webkit-scrollbar-thumb {
  background: #283552;
  border-radius: 999px;
}
body.dark ::-webkit-scrollbar-thumb:hover {
  background: #34456a;
}

/* Mobile */
@media (max-width: 650px) {
  body.dark .main-card,
  body.dark .tool-box,
  body.dark .setting-card,
  body.dark .drop {
    border-radius: 20px;
  }

  body.dark .reorder {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 11px;
    flex-wrap: wrap;
    row-gap: 4px;
  }

  body.dark .actions-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  body.dark .small-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .page-container {
    padding-left: 0px !important;
    padding-right: 0px !important;
    padding-top: 0px !important;
  }
}

@media (max-width: 850px) {
  .small-actions {
    width: 100%;
  }

  .small-actions .btn {
    flex: 1;
    justify-content: center;
  }
}
