/* Phone and tablet ergonomics. These rules never change PDF export resolution. */
.mobile-toolbar-row { display: contents; }
.mobile-all-tools,.mobile-control,.mobile-panel-close,.mobile-panel-scrim { display: none; }
.hand-mode #overlay-canvas,.hand-mode #text-targets,.hand-mode #text-targets * { pointer-events: none!important; }
.hand-mode .page-stage { touch-action: pan-x pan-y pinch-zoom; cursor: grab; }

@media (max-width:900px) {
  html { -webkit-text-size-adjust: 100%; scroll-padding-top: 75px; }
  body { overflow-x: clip; }
  button,a,input,select,textarea { -webkit-tap-highlight-color: transparent; }
  button,a { touch-action: manipulation; }
  input:not([type=color]):not([type=checkbox]):not([type=range]),select,textarea:not(.inline-pdf-text) { font-size: 16px!important; }
  button:focus-visible,a:focus-visible { outline-offset: -3px; }
  .sidebar { display: none; }
  .home-main { margin: 0; width: 100%; }
  .topbar { height: 64px; padding: 8px 18px; position: sticky; top: 0; z-index: 10; }
  .mobile-brand { display: flex; align-items: center; gap: 7px; font: 800 18px Manrope,sans-serif; color: #273143; }
  .mobile-brand img { width: 38px; height: 38px; }
  .topbar .breadcrumb,.top-badges>span:first-child { display: none; }
  .top-badges .free-tag { font-size: 11px; }
  .home-content { padding: 22px 18px 0; }
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero-copy { padding: 0; }
  .hero .eyebrow { font-size: 10px; }
  .hero h1 { font-size: clamp(32px,8.3vw,44px); letter-spacing: -1.6px; margin: 12px 0; }
  .hero-copy>p { font-size: 14px; line-height: 1.65; max-width: 100%; margin-bottom: 12px; }
  .hero-copy>p br { display: none; }
  .hero-caption { display: none; }
  .text-button { min-height: 44px; font-size: 13px; }
  .upload-card { min-height: 0; padding: 22px; border-radius: 16px; }
  .upload-label,.upload-card .file-art { display: none; }
  .upload-card h2 { font-size: 19px; margin: 0 0 6px; }
  .upload-card p { font-size: 13px; margin: 0 0 16px; }
  .upload-card .primary { width: 100%; min-height: 50px; font-size: 16px; justify-content: center; }
  .upload-hint { font-size: 11px; margin-top: 10px; }
  .subtle-link { min-height: 44px; font-size: 13px; padding: 8px; }
  .trust-strip { display: grid; grid-template-columns: 1fr 1fr; padding: 18px 0; gap: 12px 8px; margin-bottom: 23px; }
  .trust-strip span,.trust-strip span:last-child { display: flex; font-size: 10px; }
  .section-heading { flex-direction: column; align-items: stretch; gap: 15px; }
  .section-heading h2 { font-size: 23px; }
  .search-box { height: 48px; width: 100%; margin: 0; }
  .search-box input { width: 100%; min-width: 0; }
  .search-box kbd { display: none; }
  .filter-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); overflow: visible; width: 100%; margin: 14px 0 18px; gap: 4px; }
  .filter-tabs button { padding: 8px 4px; min-height: 44px; font-size: 12px; white-space: normal; line-height: 1.4; }
  .tool-grid { grid-template-columns: 1fr; gap: 10px; }
  .tool-card { min-height: 92px; padding: 17px 35px 17px 74px; position: relative; border-radius: 12px; }
  .tool-card .tool-icon { position: absolute; left: 16px; top: 20px; width: 42px; height: 42px; }
  .tool-card h3 { font-size: 15px; line-height: 1.4; margin: 0 0 5px; }
  .tool-card p { font-size: 12px; line-height: 1.5; color: #647187; }
  .tool-card .popular { display: none; }
  .tool-card>.card-arrow { top: 23px; right: 14px; }
  .home-footer { flex-direction: column; gap: 8px; font-size: 12px; }
  .home-footer>div { flex-direction: column; align-items: flex-start; gap: 0; }
  .home-footer a,.home-footer button { display: inline-flex; align-items: center; min-height: 44px; font-size: 12px; }

}
/* Include wide phones held sideways, while leaving desktop windows on the desktop layout. */
@media (max-width:900px), (pointer:coarse) and (orientation:landscape) and (max-height:520px) and (max-width:1100px) {
  .pdf-editor-open { overflow: hidden; }
  .editor { height: 100dvh; position: fixed; inset: 0; width: 100%; overflow: hidden; }
  .editor-header { display: grid; grid-template-columns: 44px minmax(0,1fr) repeat(4,44px); align-items: center; height: auto; min-height: 52px; flex: none; gap: 2px; padding: calc(4px + env(safe-area-inset-top)) max(4px,env(safe-area-inset-right)) 4px max(4px,env(safe-area-inset-left)); }
  .editor-brand { display: none; }
  .document-title { margin: 0; padding: 0 4px; border: 0; min-width: 0; }
  .document-title input { width: 100%; text-overflow: ellipsis; padding: 2px 0; font-size: 16px!important; }
  .document-title>span { display: none; }
  .editor-header #redo-button { display: inline-flex; }
  .editor-header>.icon-button,.editor-header .ghost,.editor-header .primary { height: 44px; min-height: 44px; min-width: 0; width: auto; padding: 0; justify-content: center; }
  .editor-header #undo-button span,.editor-header #export-menu span,.editor-header #download-button span { display: none; }
  .editor-header .icon { width: 19px; height: 19px; }
  .editor-tabs { height: 44px; padding: 0 10px; gap: 0; justify-content: space-between; overflow-x: auto; overflow-y: hidden; }
  .editor-tabs button { min-height: 44px; padding: 0 7px; font-size: 12px; flex-shrink: 0; }
  .editor-tabs>span { display: none; }
  .mobile-toolbar-row { display: flex; flex-shrink: 0; min-width: 0; border-bottom: 1px solid var(--line); background: white; }
  .editor-toolbar,.editor-toolbar[data-mode=edit] { flex: 1; min-width: 0; height: 50px; min-height: 50px; padding: 3px 4px; gap: 2px; border: 0; scrollbar-width: none; }
  .editor-toolbar .tool-button,.editor-toolbar[data-mode=edit] .tool-button { height: 44px; min-height: 44px; padding: 2px; gap: 2px; }
  .mobile-all-tools { display: flex; flex: 0 0 73px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; margin: 3px 5px 3px 0; color: #b62c27; background: #fff0ed; border: 1px solid #f0d2cc; border-radius: 9px; font-size: 11px; font-weight: 700; }
  .mobile-all-tools .icon { width: 20px; height: 20px; }
  .editor-body { min-height: 0; position: relative; }
  .canvas-area,.native-edit-mode .canvas-area { display: flex; flex-direction: column; padding: 8px max(8px,env(safe-area-inset-right)) 8px max(8px,env(safe-area-inset-left)); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .native-edit-mode:not(.hand-mode) .canvas-helper { display: none; }
  .native-edit-mode #overlay-canvas { pointer-events: none; }
  .native-edit-mode .page-stage { touch-action: pan-x pan-y pinch-zoom; }
  .canvas-helper { flex: none; font-size: 11px; line-height: 1.5; margin: 0 0 6px; }
  .hand-mode .canvas-helper { font-size: 0; }
  .hand-mode .canvas-helper::after { content: 'Scroll to move around. Tap Resume editing when ready.'; font-size: 11px; }
  .page-stage { flex: none; margin: auto; border: 0; }
  .pages-panel,.properties-panel { display: none; }
  .editor.show-pages .pages-panel { display: block; position: fixed; z-index: 32; inset: 106px auto calc(58px + env(safe-area-inset-bottom)) 0; width: 170px; padding: 12px; background: white; border-radius: 0 14px 14px 0; box-shadow: 7px 0 30px #15223520; }
  .pages-panel .panel-title { font-size: 11px; letter-spacing: .5px; gap: 4px; }
  .pages-panel .panel-title .icon-button { width: 44px; height: 44px; }
  .thumb { padding: 10px; min-height: 80px; }
  .thumb span { font-size: 11px; }
  .add-files { min-height: 48px; font-size: 12px; }
  .editor.show-options .properties-panel { display: block; position: fixed; z-index: 32; top: auto; bottom: calc(58px + env(safe-area-inset-bottom)); left: 0; right: 0; width: 100%; max-height: min(62dvh,580px); padding: 0 18px 20px; border-radius: 18px 18px 0 0; border: 1px solid var(--line); box-shadow: 0 -8px 35px #15223520; }
  .properties-panel>.panel-title { position: sticky; top: 0; z-index: 1; padding-top: 8px; margin: 0; background: white; font-size: 11px; min-height: 54px; }
  .properties-panel h3 { margin-top: 8px; font-size: 18px; }
  .properties-panel p,.property-hint { font-size: 13px; }
  .field-label,.toggle-label { font-size: 13px; }
  .field { min-height: 44px; }
  .toggle-label { min-height: 44px; margin: 4px 0; }
  input[type=checkbox] { width: 20px; height: 20px; flex-shrink: 0; }
  input[type=range] { min-height: 44px; }
  .property-action,.page-actions button { min-height: 44px; font-size: 13px; }
  .edit-list-heading { font-size: 11px; }
  .edit-row>button:first-child { min-height: 44px; font-size: 13px; }
  .edit-row .icon-button { width: 44px; height: 44px; }
  .mobile-panel-close { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 8px; color: #4c5c72; margin-left: auto; flex-shrink: 0; }
  .mobile-panel-scrim { display: none; }
  .show-pages .mobile-panel-scrim,.show-options .mobile-panel-scrim { display: block; position: fixed; z-index: 31; inset: 0 0 calc(58px + env(safe-area-inset-bottom)); background: #17203345; }
  .editor-footer { height: calc(58px + env(safe-area-inset-bottom)); min-height: calc(58px + env(safe-area-inset-bottom)); padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); gap: 4px; z-index: 35; }
  .editor-footer>span { display: none!important; }
  .mobile-control,.editor-footer .mobile-options { display: flex; min-height: 48px; flex: 1; flex-direction: column; justify-content: center; align-items: center; gap: 4px; padding: 4px; font-size: 11px; color: #526177; border-radius: 8px; }
  .mobile-control .icon,.mobile-options .icon { width: 20px; height: 20px; }
  .mobile-control[aria-pressed=true],.mobile-control[aria-expanded=true],.mobile-options[aria-expanded=true] { color: #b62c27; background: #fff0ed; }
  .zoom-bar,.native-edit-mode .zoom-bar,.text-panel-open .zoom-bar { position: static; transform: none; flex: none; width: 100%; gap: 2px; padding: 0 max(4px,env(safe-area-inset-right)) 0 max(4px,env(safe-area-inset-left)); justify-content: center; border-width: 1px 0 0; border-radius: 0; box-shadow: none; }
  .zoom-bar button { width: 44px; height: 44px; flex-shrink: 0; font-size: 21px; }
  .zoom-bar .icon { width: 17px; height: 17px; }
  .zoom-bar span { font-size: 12px; min-width: 29px; }
  .zoom-divider { margin: 0 2px; }
  .text-format-bar { max-height: 142px; overflow: auto; align-items: center; min-height: 0; padding: 7px 10px; gap: 8px; }
  .format-hint { font-size: 11px; line-height: 1.4; }
  .text-format-bar:has(.format-hint) { min-height: 0; padding: 4px 10px; }
  .format-hint .format-detail { display: none; }
  .text-format-bar:has(.format-apply) { flex-wrap: nowrap; min-height: 60px; }
  .text-format-bar label,.format-toggle,.format-apply,.format-cancel { flex-shrink: 0; min-height: 44px; }
  .text-format-bar select { max-width: 140px; }
  .text-format-bar input[type=color],.format-toggle { width: 44px; height: 44px; }
  .format-apply { position: sticky; right: -10px; min-width: 90px; box-shadow: -6px 0 12px #fff; }
  .format-count,.format-shortcut { display: none; }
  .text-tools-panel { position: fixed; z-index: 33; top: auto; bottom: calc(58px + env(safe-area-inset-bottom)); left: 0; right: 0; width: 100%; max-height: 65dvh; padding: 18px; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 45px #17203330; }
  .text-panel-title { position: sticky; top: -18px; background: white; padding: 6px 0; margin-bottom: 10px; z-index: 1; }
  .text-panel-title button { width: 44px; height: 44px; }
  .search-checks,.text-tools-panel>label,.text-panel-note { font-size: 13px; }
  .search-actions button,.search-summary button,.spell-scan,.spelling-suggestions button { min-height: 44px; font-size: 13px; }
  .search-summary button { width: 44px; }
  .text-result span { font-size: 13px; }

  dialog { width: calc(100% - 20px); max-width: 600px; max-height: calc(100dvh - 28px); padding: 18px; border-radius: 16px; overscroll-behavior: contain; }
  .modal-header { position: sticky; top: -18px; background: #fff; z-index: 2; padding: 10px 0; margin-bottom: 12px; }
  .modal-header h2 { font-size: 20px; }
  .modal-header .icon-button { width: 44px; height: 44px; }
  #modal-body>p,.notice,.feature-list { font-size: 13px; }
  .format-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .format-grid button { min-height: 72px; padding: 12px; font-size: 14px; gap: 8px; }
  .format-grid small { font-size: 12px; }
  .modal-actions { flex-wrap: wrap; position: sticky; bottom: -18px; padding: 12px 0; background: white; z-index: 1; }
  .modal-actions button { min-height: 48px; flex: 1; justify-content: center; font-size: 14px; }
  .modal-tabs button { min-height: 44px; font-size: 13px; }
  .split-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .split-list label { display: flex; align-items: center; gap: 8px; min-height: 48px; font-size: 13px; }
  #toast { bottom: calc(124px + env(safe-area-inset-bottom)); width: calc(100% - 32px); font-size: 13px; }
  #mobile-tool-picker { padding: 0 18px 22px; }
  .mobile-picker-heading { display: flex; position: sticky; top: 0; z-index: 1; background: white; padding: 16px 0 12px; align-items: center; justify-content: space-between; gap: 12px; }
  .mobile-picker-heading h2 { font-size: 21px; margin: 0; }
  .mobile-picker-heading p { font-size: 12px; color: #647187; margin: 5px 0 0; }
  .mobile-picker-heading .icon-button { width: 44px; height: 44px; }
  .mobile-picker-content h3 { font-size: 13px; margin: 20px 0 10px; color: #647187; }
  .mobile-tool-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
  .mobile-tool-grid button { min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: #f4f6f9; border: 1px solid #e1e6ed; border-radius: 10px; padding: 8px 4px; font-size: 12px; color: #34425a; }
  .mobile-tool-grid button .icon { width: 23px; height: 23px; }
  .mobile-tool-grid button:active { background: #fff0ed; border-color: #d93830; }
}
@media (max-width:900px) {
  .privacy-page { margin: 0; border: 0; border-radius: 0; padding: 28px 20px; }

  /* The resume tools use the same touch sizes and readable forms. */
  .resume-sidebar { display: none; }
  .resume-main { margin-left: 0; }
  .resume-content { padding: 22px 18px 0; }
  .resume-topbar { padding: 0 14px; height: 64px; }
  .resume-topbar .breadcrumb { display: none; }
  .resume-mobile-brand { display: flex; }
  .resume-mobile-nav { display: flex; gap: 6px; padding: 8px 14px; position: sticky; top: 0; z-index: 5; background: white; border-bottom: 1px solid var(--line); }
  .resume-mobile-nav a { flex: 1; display: flex; justify-content: center; align-items: center; min-height: 44px; font-size: 13px; background: #f2f4f7; border-radius: 7px; }
  .resume-app .r-button,.resume-app .text-link,.resume-app .primary { min-height: 44px; font-size: 13px; }
  .resume-app .r-label { font-size: 13px; }
  .resume-app .input-grid,.resume-app .builder-layout { grid-template-columns: 1fr; }
  .resume-app .section-toolbar { flex-wrap: wrap; }
  .resume-app .section-toolbar input { flex-basis: 100%; }
  .resume-app .section-toolbar button { min-width: 44px; min-height: 44px; font-size: 13px; }
  .resume-app .template-option { min-height: 90px; }
  .resume-app .template-option b { font-size: 12px; }
  .resume-app .export-bar { padding: 16px; }
  .resume-app #resume-dialog { max-height: calc(100dvh - 24px); padding: 16px; }
}
@media (min-width:540px) and (max-width:900px) {
  .tool-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .tool-card { padding-left: 64px; }
  .tool-card .tool-icon { left: 12px; width: 36px; height: 36px; }
}
@media (min-width:600px) and (max-width:900px) and (max-height:520px), (pointer:coarse) and (orientation:landscape) and (max-height:520px) and (max-width:1100px) {
  .editor.show-pages .pages-panel { top: 54px; }
  .text-format-bar .format-hint { display: none; }
  .text-format-bar:has(.format-hint) { padding: 0; }
  .canvas-helper { display: none; }
  .editor-footer { height: calc(50px + env(safe-area-inset-bottom)); min-height: calc(50px + env(safe-area-inset-bottom)); }
  .mobile-control,.editor-footer .mobile-options { flex-direction: row; min-height: 42px; gap: 8px; }
}
@media (max-width:360px) {
  .editor-header { padding-left: 5px; padding-right: 5px; }
  .editor-header .primary { font-size: 11px; padding: 8px; gap: 5px; }
  .editor-tabs button { font-size: 11px; padding: 0 5px; }
  .format-grid { grid-template-columns: 1fr; }
  .mobile-tool-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
