/* Shared mobile navigation; page refinements stay scoped outside the editor. */
@media (max-width: 1000px), (pointer: coarse) {
  .appbar {
    flex-wrap: wrap;
    flex-shrink: 0;
    height: auto;
    min-height: 54px;
    gap: 8px;
    padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  }

  .appbar .brand { min-width: 0; max-width: 100%; }
  .appbar .brand .word { white-space: normal; letter-spacing: .06em; }
  .appbar .brand::before { flex-shrink: 0; }
  .appbar a { display: inline-flex; align-items: center; min-height: 44px; }
  .appbar :is(.back, .backproj, .profilelink) { justify-content: center; white-space: normal; }

  :is(.projects-page, .profile-settings-page, .integrations-page, .settings-page, .media-library-page) {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  :is(.projects-page, .profile-settings-page, .integrations-page, .settings-page, .media-library-page, .auth-page)
    :is(button, input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select) {
    min-height: 44px;
  }

  :is(.projects-page, .profile-settings-page, .integrations-page, .settings-page, .media-library-page)
    :is(input:not([type=checkbox]):not([type=radio]), select, textarea) {
    font-size: 16px;
    max-width: 100%;
  }

  .projects-page .grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
  .projects-page .appbar .userchip { display: flex; flex-wrap: wrap; flex: 1 1 100%; order: 3; }
  .projects-page .appbar .gearlink { display: none; }
  .projects-page .userchip > span { flex: 1; min-width: 0; }
  .projects-page .userchip button { display: inline-flex; align-items: center; }
  .projects-page :is(.viewtoggle button, .ovf, .selbox) { min-width: 44px; min-height: 44px; }
  .projects-page.selmode .tbadge { left: 60px; }
  .projects-page :is(.tb-right, .search, .search input, .sortsel) { min-width: 0; max-width: 100%; }
  .projects-page .grid.list .cbody { min-width: 0; }
  .projects-page .project-wizard .modal-body { overflow-y: auto; overscroll-behavior: contain; }
  .projects-page .project-wizard .modal-foot { flex-wrap: wrap; }
  .projects-page .project-wizard .modal-foot button { padding-inline: 12px; }
  .projects-page .wizard-progress { max-height: 30dvh; overflow-y: auto; flex-shrink: 1; }
  .projects-page .wizard-progress .own-upload-status { max-height: none; overflow: visible; }

  .profile-settings-page .appbar .section-label { display: none; }
  .profile-settings-page .editor > * { min-width: 0; }
  .profile-settings-page .inspector { position: static; }
  .profile-settings-page .editor-group > summary { gap: 8px; }
  .profile-settings-page .editor-group > summary > span:first-child { min-width: 0; }
  .profile-settings-page .editor-group > summary [data-group-summary] { max-width: 38%; }
  .profile-settings-page .template-dialog-close { width: 44px; }
  .profile-settings-page .template-dialog-header { grid-template-columns: 38px minmax(0, 1fr) 44px; }
  .profile-settings-page .actions { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .profile-settings-page .notice { top: 8px; overflow-wrap: anywhere; }

  .integrations-page .appnav { flex-wrap: wrap; overflow: visible; }
  .integrations-page .operation > div { flex-wrap: wrap; }
  .integrations-page .binding-list b { overflow-wrap: anywhere; }

  .settings-page .appbar { position: static; }
  .settings-page .row > .field { min-width: 0; }
  .settings-page .btns { flex-wrap: wrap; }
  .settings-page .status > span:last-child { min-width: 0; overflow-wrap: anywhere; }

  .media-library-page .media-dialog-header { flex-wrap: wrap; gap: 12px; }
  .media-library-page .media-dialog-header h2 { flex: 1 1 160px; }
  .media-library-page .media-project-link { display: inline-flex; align-items: center; min-height: 44px; }
  .media-library-page #mediaVideoClose { flex: 0 0 auto; min-height: 44px; }

  .auth-page { min-height: 100dvh; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .auth-page :is(.verify-msg, .err) { overflow-wrap: anywhere; }
  .auth-page .resend button { min-width: 44px; }
}

@media (max-width: 600px) {
  .appbar .brand { flex-basis: 100%; }
  .appbar .brand .sub { display: none; }
  .appbar :is(.spacer, .sp) { display: none; }
  .projects-page .profilelink { flex: 1 1 auto; font-size: .75rem; letter-spacing: 0; white-space: nowrap; }
  .projects-page .grid.list .card { flex-direction: column; align-items: stretch; }
  .projects-page .grid.list .thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .projects-page .grid.list .cfoot { width: 100%; max-width: none; margin-left: 0; }
  .projects-page .tb-right { width: 100%; margin-left: 0; }
  .projects-page .search { flex: 1 1 100%; }
  .projects-page .search input, .projects-page .search input:focus { width: 100%; }
  .projects-page .sortsel { flex: 1; }
  .projects-page .project-wizard .modal-foot #mCancel { margin-right: 0; }
  .projects-page .project-wizard .modal-foot button { flex: 1 1 auto; }
  .profile-settings-page .actions { position: static; }
  .profile-settings-page .template-dialog-header { grid-template-columns: minmax(0, 1fr) 44px; }
  .profile-settings-page .template-dialog-mark { display: none; }
  .settings-page .wrap { width: 100%; padding: 24px 16px 48px; }
  .settings-page .card { padding: 20px 16px; }
  .settings-page .row { flex-direction: column; gap: 0; }
  .settings-page .btns { align-items: stretch; flex-direction: column; }
  .media-library-page #mediaLibrary { padding-top: 28px; }
  .media-library-page .media-hero h1 { font-size: clamp(1.6rem, 7.5vw, 2.3rem); }
}

@media (max-height: 500px) and (max-width: 1000px) {
  .profile-settings-page .actions { position: static; }
  .auth-page { padding-top: 16px; }
  .auth-page .brand { margin-bottom: 16px; }
}
@media (max-width:820px){
  .project-collection{padding:18px 12px 24px}
  .collection-layout{grid-template-columns:minmax(0,1fr);gap:24px}
  .collection-transfer{padding:20px 16px}
  .collection-footer{flex-direction:column;align-items:stretch}
  .collection-footer .review-btn{flex:0 0 auto;width:100%}
}
@media(max-width:640px){
.removed-drive-row{flex-direction:column;align-items:stretch;gap:12px}
  .removed-drive .act{width:100%}
  .project-removal-dialog{padding:20px}
  .project-removal-actions{flex-direction:column-reverse}
  .project-removal-actions .act{width:100%}
}
/* Social package review keeps full cover proportions and native text input. */
@media(max-width:820px){
  .social-export-dialog{width:calc(100% - 24px);max-height:calc(100dvh - 24px);padding:16px}
  .social-export-body{grid-template-columns:minmax(0,1fr);gap:24px}
  .social-policy-fields{grid-template-columns:minmax(0,1fr)}
  .social-export-header{flex-wrap:wrap}
  .social-export-footer .review-upload-actions button{flex:1 1 180px}
  .social-export-dialog input:not([type=checkbox]),.social-export-dialog textarea,.social-export-dialog select{font-size:16px}
  .profile-settings-page #group-social-export select,.profile-settings-page #group-social-export input:not([type=checkbox]):not([type=radio]){min-height:44px}
  .profile-settings-page #group-social-export input[type=checkbox]{width:20px;height:20px;min-height:20px;padding:0;flex:none}
  .review-social-policy .review-upload-actions{flex-direction:column;align-items:stretch}
}
@media(max-width:700px){
  .scene-range{grid-template-columns:1fr;gap:0}
  .scene-assistant{padding:20px 0}
  .scene-assistant .review-upload-actions{flex-direction:column;align-items:stretch}
  .scene-assistant input,.scene-assistant select,.scene-assistant textarea,.scene-facts input,.scene-facts textarea{font-size:16px}
  .scene-consents{padding:12px}
}
