/* OceanofTools PDF Tools — mobile-only responsive hardening
   Desktop layout is intentionally untouched. */

@media (max-width: 900px) {
  html, body { max-width: 100%; overflow-x: hidden; }

  .pfts-page, .pdfc-page, .pdfi-page,
  .pfts-page *, .pdfc-page *, .pdfi-page * { box-sizing: border-box; }

  .pfts-page, .pdfc-page, .pdfi-page {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    overflow-x: clip !important;
  }

  .pfts-page > *, .pdfc-page > *, .pdfi-page > *,
  .pfts-tool-card, .pfts-tool-grid, .pfts-workspace, .pfts-side-card,
  .pfts-options, .pfts-options-grid, .pfts-preview-shell, .pfts-result,
  .pfts-content-section, .pfts-related, .pfts-report,
  .pdfc-tool-card, .pdfc-grid, .pdfc-workspace, .pdfc-sidebar,
  .pdfc-content-section, .pdfc-related, .pdfc-report,
  .pdfi-section, .pdfi-grid, .pdfi-content {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .pfts-hero, .pdfc-hero, .pdfi-hero {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .pfts-tool-grid, .pdfc-grid,
  .pfts-content-grid, .pdfc-content-grid,
  .pfts-options-grid, .pdfc-advanced,
  .pfts-steps, .pdfc-steps,
  .pfts-related-grid, .pdfc-related-grid,
  .pfts-sheet-list, .pdfc-comparison-grid {
    grid-template-columns: 1fr !important;
  }

  .pfts-side-card, .pdfc-sidebar {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .pfts-field, .pdfc-field,
  .pfts-field-full, .pdfc-field-full,
  .pfts-preview-toolbar .pfts-field {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    grid-column: auto !important;
  }

  .pfts-page input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]),
  .pfts-page select, .pfts-page textarea,
  .pdfc-page input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]),
  .pdfc-page select, .pdfc-page textarea {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .pfts-actions, .pfts-result-actions,
  .pdfc-action-row, .pdfc-result-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  .pfts-actions > *, .pfts-result-actions > *,
  .pdfc-action-row > *, .pdfc-result-actions > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .pfts-preview-toolbar {
    align-items: stretch !important;
  }

  .pfts-file-list, .pfts-page-grid, .pfts-report-preview,
  .pfts-canvas-wrap, .pdfc-result, .pdfc-file-card {
    max-width: 100% !important;
  }

  .pfts-canvas-wrap {
    width: 100% !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .pfts-canvas-wrap canvas {
    max-width: none !important;
  }

  .pfts-canvas-stack {
    min-width: 100% !important;
    max-width: none !important;
  }

  .pfts-report-preview, .pfts-page-grid,
  .pfts-source-tabs, .pfts-preview-toolbar {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .pfts-page table, .pdfc-page table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .pfts-page img, .pfts-page video, .pfts-page iframe,
  .pdfc-page img, .pdfc-page video, .pdfc-page iframe {
    max-width: 100% !important;
    height: auto;
  }

  .pfts-page pre, .pfts-page code,
  .pdfc-page pre, .pdfc-page code {
    max-width: 100% !important;
    overflow-x: auto !important;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .pfts-file-list *, .pfts-result *, .pfts-report-preview *,
  .pdfc-file-card *, .pdfc-result * {
    overflow-wrap: anywhere;
  }

  .pfts-progress-copy, .pdfc-progress-header,
  .pfts-report, .pdfc-report {
    min-width: 0 !important;
  }

  .pfts-chat-row {
    min-width: 0 !important;
  }

  .pfts-signature-canvas {
    max-width: 100% !important;
    height: 170px !important;
  }

  .pdfi-category-heading {
    flex-wrap: wrap !important;
  }
}

@media (max-width: 640px) {
  .pfts-page, .pdfc-page, .pdfi-page {
    padding-left: 7px !important;
    padding-right: 7px !important;
    padding-top: 10px !important;
  }

  .pfts-breadcrumb, .pdfc-breadcrumb {
    display: none !important;
  }

  .pfts-hero, .pdfc-hero {
    display: block !important;
    padding: 15px 14px !important;
    border-radius: 16px !important;
  }

  .pfts-hero-icon, .pdfc-hero-icon {
    display: none !important;
  }

  .pfts-hero h1, .pdfc-hero h1 {
    margin: 0 0 7px !important;
    font-size: clamp(1.45rem, 7.4vw, 1.95rem) !important;
    line-height: 1.08 !important;
    overflow-wrap: anywhere !important;
  }

  .pfts-hero p, .pdfc-hero p {
    font-size: .84rem !important;
    line-height: 1.5 !important;
  }

  .pfts-eyebrow, .pdfc-eyebrow {
    display: none !important;
  }

  .pfts-trust-row, .pdfc-trust-row {
    display: flex !important;
    grid-column: auto !important;
    flex-wrap: wrap !important;
    overflow: visible !important;
    gap: 6px !important;
    margin-top: 9px !important;
    padding: 0 !important;
  }

  .pfts-trust-row span, .pdfc-trust-row span {
    flex: 0 1 auto !important;
    white-space: normal !important;
  }

  .pfts-tool-card, .pdfc-tool-card,
  .pfts-content-section, .pdfc-content-section,
  .pfts-related, .pdfc-related,
  .pfts-report, .pdfc-report,
  .pdfi-section {
    width: 100% !important;
    max-width: 100% !important;
    padding: 13px !important;
    border-radius: 16px !important;
  }

  .pfts-workspace, .pdfc-workspace,
  .pfts-side-card, .pdfc-sidebar {
    padding: 0 !important;
  }

  .pdfc-sidebar {
    padding-top: 13px !important;
    border-left: 0 !important;
    border-top: 1px solid var(--pdfc-border) !important;
  }

  .pfts-side-card {
    margin-top: 13px !important;
  }

  .pfts-drop-zone, .pdfc-drop-zone {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 185px !important;
    padding: 20px 12px !important;
    border-radius: 15px !important;
  }

  .pfts-upload-icon, .pdfc-upload-icon {
    width: 52px !important;
    height: 52px !important;
    font-size: 1.3rem !important;
    border-radius: 15px !important;
  }

  .pfts-drop-zone strong, .pdfc-drop-zone strong {
    font-size: 1rem !important;
    overflow-wrap: anywhere;
  }

  .pfts-drop-zone span, .pfts-drop-zone small,
  .pdfc-drop-zone span, .pdfc-drop-zone small {
    max-width: 100% !important;
    overflow-wrap: anywhere;
  }

  .pfts-options, .pfts-preview-shell,
  .pfts-result, .pfts-progress-panel,
  .pdfc-advanced, .pdfc-progress-section, .pdfc-result {
    padding: 12px !important;
    border-radius: 14px !important;
  }

  .pfts-options-grid, .pfts-content-grid, .pfts-steps,
  .pdfc-advanced, .pdfc-content-grid, .pdfc-comparison-grid,
  .pdfc-presets, .pdfc-related-grid,
  .pdfi-grid, .pdfi-content {
    grid-template-columns: 1fr !important;
  }

  .pfts-page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }

  .pfts-page-thumb {
    min-width: 0 !important;
    padding: 8px !important;
  }

  .pfts-preview-toolbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
  }

  .pfts-source-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 7px !important;
    overflow: visible !important;
  }

  .pfts-source-tabs button {
    flex: 1 1 calc(50% - 7px) !important;
    min-width: 0 !important;
  }

  .pfts-actions, .pfts-result-actions,
  .pdfc-action-row, .pdfc-result-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }

  .pfts-actions > *, .pfts-result-actions > *,
  .pdfc-action-row > *, .pdfc-result-actions > *,
  .pfts-primary-button, .pfts-secondary-button,
  .pdfc-primary-button, .pdfc-secondary-button, .pdfc-text-button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    justify-content: center !important;
    white-space: normal !important;
  }

  .pfts-file-list > *, .pdfc-file-card {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .pdfc-file-card {
    align-items: flex-start !important;
  }

  .pdfc-file-details strong,
  .pfts-file-copy strong {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  .pdfc-stats, .pfts-result-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .pfts-chat-row {
    flex-direction: column !important;
  }

  .pfts-chat-row > * {
    width: 100% !important;
  }

  .pfts-report, .pdfc-report {
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  .pfts-report a, .pdfc-report a {
    width: 100% !important;
    max-width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }

  .pdfi-hero {
    padding: 22px 15px !important;
    border-radius: 18px !important;
  }

  .pdfi-hero h1 {
    font-size: clamp(1.8rem, 9vw, 2.65rem) !important;
  }

  .pdfi-section {
    margin-top: 14px !important;
  }

  .pdfi-category-heading {
    align-items: flex-start !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .pdfi-category-heading > span {
    white-space: normal !important;
  }
}

@media (max-width: 420px) {
  .pfts-page-grid { grid-template-columns: 1fr !important; }
  .pdfc-stats, .pfts-result-stats { grid-template-columns: 1fr !important; }
  .pfts-source-tabs button { flex-basis: 100% !important; }
}

@media (max-width: 900px) {
  /* Flex/grid children with intrinsic widths are a common cause of mobile overflow. */
  .pfts-tool-card *, .pdfc-tool-card *,
  .pfts-content-section *, .pdfc-content-section *,
  .pfts-related *, .pdfc-related *,
  .pfts-report *, .pdfc-report * {
    min-width: 0;
  }

  .pfts-page .pfts-file-actions,
  .pfts-page .pfts-range-row,
  .pfts-page .pfts-section-heading,
  .pdfc-page .pdfc-label-row,
  .pdfc-page .pdfc-result-heading {
    max-width: 100% !important;
    flex-wrap: wrap !important;
  }
}
