.pdf-tool-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 20px 70px;
}

.responsive-ad-slot[hidden] { display: none !important; }
.pdf-mobile-menu-toggle,
.pdf-mobile-language,
.pdf-mobile-workflow,
.pdf-mobile-back { display: none; }

.mobile-page-preview,
.mobile-page-edit > summary { display: none; }

.pdf-tool-hero {
  padding: 42px 12px 30px;
  text-align: center;
}

.pdf-tool-hero h1 {
  max-width: 860px;
  margin: 8px auto 14px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.02;
}

.pdf-tool-hero p {
  max-width: 760px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.08rem;
}

.privacy-chip {
  display: inline-flex;
  margin-top: 18px;
  padding: 8px 13px;
  border-radius: 999px;
  background: #e8f7f0;
  color: #176544;
  font-weight: 700;
}

.session-storage-note {
  max-width: 780px;
  margin: 12px auto 0 !important;
  padding: 10px 14px;
  border: 1px solid #d8e1e8;
  border-radius: 10px;
  background: #f7f9fb;
  color: #4d6171 !important;
  font-size: .9rem !important;
  line-height: 1.45;
}

.pdf-builder-card {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(480px, 1.18fr);
  gap: 24px;
  align-items: start;
  padding: clamp(18px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.pdf-builder-editor,
.document-preview-panel {
  min-width: 0;
}

.builder-column-head {
  margin-bottom: 16px;
}

.builder-column-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.builder-column-head h2,
.builder-column-head p {
  margin: 0;
}

.builder-column-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.92rem;
}

.step-label {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #061a34;
  color: #fff;
  font-weight: 800;
}

.image-dropzone {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 24px;
  border: 2px dashed #8fa7bb;
  border-radius: 18px;
  background: #f6f9fc;
  text-align: center;
  cursor: pointer;
}

.image-dropzone.is-dragging {
  border-color: #1267d8;
  background: #edf5ff;
}

.image-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.image-dropzone span {
  margin-top: 8px;
  color: var(--muted);
}

.builder-message {
  min-height: 24px;
  margin: 12px 0;
  color: #8a341d;
}

.page-number-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f9fb;
}

.page-number-settings legend {
  padding: 0 6px;
  color: #17364d;
  font-weight: 800;
}

.page-number-settings label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.86rem;
}

.page-number-settings .page-number-checkbox {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #17364d;
  font-weight: 750;
}

.page-number-settings select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #aebdca;
  border-radius: 8px;
  background: #fff;
  color: #17364d;
  font: inherit;
}

.page-number-settings select:disabled {
  opacity: 0.55;
}

.image-page-list {
  display: grid;
  gap: 12px;
}

.image-page-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.image-page-card.is-dragging {
  opacity: 0.5;
  border-color: #1267d8;
}

.image-page-card.is-drag-target {
  border-color: #1267d8;
  box-shadow: 0 0 0 3px rgba(18, 103, 216, 0.14);
  transform: translateY(2px);
}

.image-page-controls {
  display: grid;
  gap: 12px;
}

.image-page-head,
.page-buttons,
.builder-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.image-page-head span {
  max-width: 70%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-position-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #17364d;
  font-weight: 800;
}

.page-position-label input {
  width: 58px;
  padding: 6px 7px;
  border: 1px solid #aebdca;
  border-radius: 7px;
  background: #fff;
  color: #17364d;
  font: inherit;
  text-align: center;
}

.page-position-label input:focus {
  border-color: #1267d8;
  outline: 3px solid rgba(18, 103, 216, 0.14);
}

.page-drag-handle {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #aebdca;
  border-radius: 8px;
  background: #f5f8fa;
  color: #27465e;
  cursor: grab;
  touch-action: none;
}

.page-drag-handle:active,
body.is-reordering-pages .page-drag-handle {
  cursor: grabbing;
}

.page-drag-handle span {
  font-size: 1.35rem;
  line-height: 1;
}

.page-buttons {
  justify-content: flex-start;
}

.page-buttons button,
.secondary-action {
  padding: 8px 11px;
  border: 1px solid #b9c7d3;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.page-buttons button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.crop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.crop-grid label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.crop-adjuster {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  gap: 6px;
  align-items: center;
}

.crop-adjuster input {
  width: 100%;
}

.crop-adjuster button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid #aebdca;
  border-radius: 7px;
  background: #fff;
  color: #17364d;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
}

.crop-adjuster button:hover {
  border-color: #1267d8;
  color: #1267d8;
}

.crop-grid output {
  grid-column: 2;
  grid-row: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.builder-actions {
  position: sticky;
  bottom: 12px;
  z-index: 2;
  justify-content: flex-end;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(6, 26, 52, 0.1);
  backdrop-filter: blur(8px);
}

.builder-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.document-preview-panel {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 108px);
  padding: 18px;
  overflow: auto;
  border: 1px solid #ccd7e0;
  border-radius: 18px;
  background: #eef2f5;
}

.document-preview-list {
  display: grid;
  gap: 20px;
}

.document-preview-empty {
  display: grid;
  min-height: 420px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 30px;
  border: 2px dashed #b6c3ce;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.document-preview-empty strong {
  color: #30485b;
}

.document-preview-page {
  display: grid;
  gap: 8px;
}

.document-preview-page figcaption {
  display: flex;
  justify-content: space-between;
  color: #4d6171;
  font-size: 0.82rem;
  font-weight: 700;
}

.document-preview-sheet {
  display: grid;
  width: min(100%, 520px);
  margin: 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid #c7d0d8;
  background: #fff;
  box-shadow: 0 10px 28px rgba(17, 37, 53, 0.15);
}

.document-preview-sheet.is-portrait {
  aspect-ratio: 210 / 297;
}

.document-preview-sheet.is-landscape {
  aspect-ratio: 297 / 210;
}

.document-preview-sheet canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.tool-privacy-note {
  max-width: 760px;
  margin: 42px auto;
  text-align: center;
}

.ad-slot-placeholder {
  display: grid;
  max-width: 994px;
  min-height: 90px;
  margin: 0 auto;
  padding: 12px;
  place-items: center;
  border: 1px dashed #a7b7c5;
  border-radius: 10px;
  background: #f4f7f9;
  color: #667788;
  font-size: 0.85rem;
}

.ad-slot-square {
  max-width: 300px;
  min-height: 250px;
}

@media (max-width: 980px) {
  .pdf-builder-card {
    grid-template-columns: 1fr;
  }

  .document-preview-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 700px) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
  }

  .brand-logo-link img {
    width: min(220px, calc(100vw - 84px));
    max-height: 46px;
  }

  .pdf-mobile-language {
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: #061a34;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
  }

  .pdf-mobile-language::after {
    content: "▾";
    position: absolute;
    right: 4px;
    bottom: 3px;
    color: var(--muted);
    font-size: 9px;
  }

  .pdf-mobile-language select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
  }

  .site-header .site-nav { display: none !important; }

  .pdf-tool-shell {
    padding: 8px 12px 82px;
  }

  .pdf-tool-hero { padding: 18px 6px 16px; }
  .pdf-tool-hero h1 { margin: 5px auto 9px; font-size: 1.75rem; line-height: 1.08; }
  .pdf-tool-hero p { font-size: .95rem; }
  .privacy-chip { margin-top: 10px; padding: 6px 10px; font-size: .82rem; }

  .pdf-builder-card {
    padding: 14px;
    border-radius: 16px;
  }

  .document-preview-panel { display: none; }

  .image-dropzone { min-height: 112px; padding: 16px; }
  .page-number-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-number-settings .page-number-checkbox { grid-column: 1 / -1; }

  .image-page-card { padding: 10px; }
  .mobile-page-preview { display: block; margin: 0; }
  .mobile-page-sheet {
    display: grid;
    width: 100%;
    place-items: center;
    overflow: hidden;
    border: 1px solid #c7d0d8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(17,37,53,.12);
  }
  .mobile-page-sheet.is-portrait { aspect-ratio: 210 / 297; }
  .mobile-page-sheet.is-landscape { aspect-ratio: 297 / 210; }
  .mobile-page-sheet canvas { display: block; width: 100%; height: 100%; }
  .mobile-page-edit { margin-top: 10px; }
  .mobile-page-edit > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9fb;
    color: #17364d;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
  }
  .mobile-page-edit > summary::-webkit-details-marker { display: none; }
  .mobile-page-edit > summary::after { content: "▶"; font-size: 12px; transition: transform .16s ease; }
  .mobile-page-edit[open] > summary::after { transform: rotate(90deg); }
  .mobile-page-edit > .image-page-controls { margin-top: 10px; }

  .crop-grid {
    grid-template-columns: 1fr;
  }

  .document-preview-panel {
    padding: 12px;
  }

  .document-preview-empty {
    min-height: 260px;
  }

  .builder-actions { display: none; }
  body.has-pdf-pages .builder-actions {
    position: fixed;
    right: 12px;
    bottom: 10px;
    left: 12px;
    z-index: 12;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0;
    padding: 8px;
  }

  .builder-actions .primary-cta { width: 100%; }
}
.site-nav select {
  max-width: 150px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: #ffffff;
  color: #17212b;
  font: inherit;
}
