/* Mobile and touch adaptations shared by the tree, profiles, and account tools. */
:root{--tap-size:44px}
html,body{min-height:100%;min-height:100dvh}
body{-webkit-text-size-adjust:100%;text-size-adjust:100%}
.app-shell{height:100%;height:100dvh}
button,input,select,textarea{touch-action:manipulation}
:where(button,a,input,select,textarea,[tabindex]):focus-visible{outline:2px solid var(--gold,#d5b46e);outline-offset:2px}
.person-explorer__status{position:fixed;z-index:6;left:50%;bottom:max(18px,calc(12px + env(safe-area-inset-bottom)));max-width:calc(100% - 32px);padding:11px 15px;border:1px solid rgba(213,180,110,.28);border-radius:999px;background:rgba(19,24,32,.96);box-shadow:0 15px 42px rgba(0,0,0,.45);color:#ecd9ae;font:700 13px/1.35 system-ui,sans-serif;text-align:center;transform:translateX(-50%)}
.person-explorer__status[hidden]{display:none}

@media (any-pointer:coarse){
  .brand,.profile-chip{min-width:var(--tap-size)}
  .brand,.search-wrap input{min-height:var(--tap-size)}
  :where(.icon-btn,.profile-chip,.primary-btn,.view-switch button,.zoom-controls button,.close-detail,.focus-family-btn,.life-map-launch,.detail-stat--link,.connection-item,.person-explorer__close,.person-explorer__tabs button,.person-explorer__identity .life-edit-profile,.life-primary-action,.life-secondary-action,.life-section-heading button,.profile-edit-action,.profile-history-action,.record-inline-edit,.relationship-card,.life-family-face,.life-photo-tile,.memory-theater__top button,.memory-theater__controls button,.profile-add-action,.profile-empty-action,.profile-choice-row label>span,.profile-contribution__close,.profile-contribution__actions button,.admin-access-btn,.admin-close,.admin-back,.admin-tabs button,.admin-primary,.admin-danger,.admin-error button,.member-row>button,.person-result button,.record-editor-btn,.record-editor__head button,.record-editor__tabs button,.record-back,.record-row,.record-field:has(input[type="checkbox"]),.record-form__actions button,.record-related-add button,.life-milestone--add,.life-milestone__person,.life-moment .record-inline-edit,.photo-add-button,.photo-load-more,.photo-primary,.photo-secondary,.photo-danger,.photo-close,.photo-viewer__close,.photo-viewer__arrow,.photo-profile-choice,.photo-gallery-card__profile,.photo-gallery-card__order button,.photo-reorder-button,.photo-upload-item>button,.photo-tag-chip button,.photo-tag-results button,.photo-crop-aspects button,.photo-crop-actions button,.photo-crop-zoom input){min-height:var(--tap-size)}
  :where(.icon-btn,.zoom-controls button,.close-detail,.person-explorer__close,.profile-contribution__close,.admin-access-btn,.admin-close,.admin-back,.record-editor__head button,.photo-close,.photo-viewer__close,.photo-viewer__arrow,.photo-gallery-card__order button,.photo-upload-item>button,.photo-tag-chip button){min-width:var(--tap-size)}
  :where(input,select,textarea,.search-wrap input,.person-search-input,.record-toolbar input,.record-toolbar select,.record-field input,.record-field select,.record-field textarea,.photo-form-grid input,.photo-form-grid textarea,.photo-tag-search,.photo-upload-item input,.photo-crop-zoom input){font-size:16px}
  .person-explorer__identity .life-edit-profile,
  .profile-edit-action,.profile-history-action,.record-inline-edit,
  .photo-crop-aspects button,.photo-crop-actions button{min-height:var(--tap-size);font-size:14px}
  .photo-crop-zoom input{min-height:var(--tap-size)}
  :where(button,a){-webkit-tap-highlight-color:rgba(213,180,110,.16)}
  :where(button,a):active{opacity:.82}
  .world{will-change:auto}
  .viewport.dragging .world,.viewport.pinching .world,.world.camera-animated{will-change:transform}
  body:not(.classic-tree-mode) .edge.circuit-glow,
  body:not(.classic-tree-mode) .edge.circuit-pulse{display:none}
  .node-orb::before{animation:none!important}
}

@media (max-width:820px), (any-pointer:coarse) and (max-width:1000px) and (max-height:500px){
  .app-shell{grid-template-rows:auto minmax(0,1fr)}
  .topbar{
    z-index:80;
    height:auto;
    min-height:0;
    grid-template-columns:minmax(98px,auto) minmax(0,1fr);
    grid-template-areas:"brand actions" "search search";
    gap:8px 10px;
    align-content:center;
    padding:max(8px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) 9px max(10px,env(safe-area-inset-left));
  }
  .brand{grid-area:brand;gap:8px;min-width:44px;min-height:44px}
  .brand-mark{width:30px;height:30px;flex:0 0 30px}
  .brand>span:last-child{display:grid}
  .brand strong{font-size:16px}
  .brand small{font-size:9px}
  .search-wrap{grid-area:search;min-width:0}
  .search-wrap input{height:46px;padding-left:42px;border-radius:12px;font-size:16px}
  .search-results{z-index:90;top:calc(100% + 6px);max-height:min(52dvh,420px);overscroll-behavior:contain}
  .search-result{min-height:54px;padding:10px}
  .search-result .mini-dot{width:34px;height:34px;flex-basis:34px;font-size:10px}
  .search-result b{font-size:14px}
  .search-result small{font-size:12px}
  .top-actions{
    grid-area:actions;
    min-width:0;
    max-width:100%;
    justify-content:flex-start;
    gap:6px;
    overflow-x:auto;
    overscroll-behavior-x:contain;
    scrollbar-width:none;
    scroll-snap-type:x proximity;
  }
  .top-actions::-webkit-scrollbar,.person-explorer__tabs::-webkit-scrollbar{display:none}
  .top-actions>*{flex:0 0 auto;scroll-snap-align:end}
  #fit-btn{order:0}
  .view-switch{order:1}
  .top-actions>a.icon-btn{order:2}
  .profile-chip{order:3}
  .admin-access-btn{order:4}
  .record-editor-btn{order:5}
  .icon-btn,.profile-chip,.tree-scope-btn{width:44px;height:44px;padding:0;border-radius:12px}
  .tree-scope-btn{display:grid}
  .tree-scope-btn span,.profile-chip b{display:none}
  .profile-chip{justify-content:center}
  .profile-chip span{width:32px;height:32px;font-size:10px}
  .view-switch{position:static!important;inset:auto!important;transform:none!important;height:48px;padding:2px;border-radius:12px}
  .view-switch button{min-width:58px;min-height:44px;padding:0 9px;font-size:14px}
  .viewport{min-height:0;overscroll-behavior:none}
  .intro-card{left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));bottom:max(66px,calc(54px + env(safe-area-inset-bottom)));width:auto;padding:18px;border-radius:18px}
  .intro-card h1{font-size:clamp(25px,8vw,31px)}
  .intro-card>p:not(.eyebrow){font-size:14px;line-height:1.5}
  .primary-btn{width:100%;height:46px;font-size:14px}
  .zoom-controls{right:max(10px,env(safe-area-inset-right));bottom:max(10px,env(safe-area-inset-bottom));grid-template-columns:repeat(2,48px);border-radius:14px}
  .zoom-controls button{width:48px;height:48px;border:0;border-right:1px solid var(--line);font-size:23px}
  .zoom-controls button:last-child{border-right:0}
  .dataset-badge{left:max(10px,env(safe-area-inset-left));bottom:max(14px,env(safe-area-inset-bottom));max-width:calc(100% - 132px);padding:8px 10px;transform:none;font-size:10px}
  body:has(.detail-panel:not([hidden])) .zoom-controls{bottom:calc(min(46dvh,420px) + 10px + env(safe-area-inset-bottom))}
  body:has(.detail-panel:not([hidden])) .dataset-badge{display:none}
  .detail-panel{
    position:fixed;
    z-index:70;
    inset:auto 0 0 0;
    width:100%;
    height:min(46vh,420px);
    height:min(46dvh,420px);
    padding:28px max(18px,env(safe-area-inset-right)) calc(22px + env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left));
    border-width:1px 0 0;
    border-radius:24px 24px 0 0;
    overscroll-behavior:contain;
    box-shadow:0 -18px 54px rgba(0,0,0,.52);
  }
  .detail-panel:before{content:"";position:absolute;left:50%;top:8px;width:42px;height:4px;border-radius:999px;background:rgba(255,255,255,.22);transform:translateX(-50%)}
  body.classic-tree-mode .detail-panel:before{background:rgba(70,48,25,.38)}
  .close-detail{position:sticky;float:right;right:0;top:0;z-index:3;width:44px;height:44px;margin:-8px -4px 0 10px;border-radius:12px;background:rgba(22,27,36,.94)}
  body.classic-tree-mode .detail-panel>.close-detail{position:sticky}
  .detail-person-head{min-height:64px}
  .detail-panel h2{font-size:clamp(25px,7vw,31px)}
  .detail-summary{font-size:14px;line-height:1.55}
  .detail-stats{gap:7px;margin:18px 0}
  .detail-stat{min-height:68px;padding:11px 9px}
  .detail-stat span{font-size:9px;line-height:1.25}
  .connection-item{min-height:52px;padding:8px 10px}
  .connection-item i{width:34px;height:34px;flex:0 0 34px;font-size:10px}
  .connection-item b{font-size:13px}
  .connection-item small{font-size:11px}
  .tree-guide{display:none}
  .viewport[data-zoom-tier="far"] .graph-node:not(.focused) .node-copy,
  .viewport[data-zoom-tier="far"] .graph-node:not(.focused) .node-photo{display:none}
  .viewport[data-zoom-tier="far"] .graph-node:not(.focused) .node-initials{opacity:1}
  .viewport[data-zoom-tier="far"] .graph-node:not(.focused) .node-orb::before{display:none}
  .viewport[data-zoom-tier="far"] .graph-node:not(.focused) .node-orb{box-shadow:none}
}

@media (max-width:650px), (any-pointer:coarse) and (max-width:1000px) and (max-height:500px){
  .person-explorer{height:100%;height:100dvh;grid-template-rows:auto minmax(0,1fr)}
  .person-explorer__header{min-height:0;grid-template-columns:minmax(0,1fr) 44px;grid-template-areas:"identity close" "tabs tabs";gap:8px 10px;padding:max(10px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left))}
  .person-explorer__identity .life-avatar{width:40px;height:40px}
  .person-explorer__identity small{font-size:10px}
  .person-explorer__identity b{font-size:17px}
  .person-explorer__identity em{font-size:11px}
  .person-explorer__tabs{margin-inline:-2px;padding:2px;overflow-x:auto;overscroll-behavior-x:contain;scroll-padding-inline:4px;scrollbar-width:none}
  .person-explorer__tabs button{height:44px;min-height:44px;padding:0 14px;font-size:14px}
  .person-explorer__close{width:44px;height:44px}
  .person-explorer__content{overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
  .perspective-page,.perspective-page--narrow{width:calc(100% - 28px);padding:24px 0 calc(48px + env(safe-area-inset-bottom))}
  .perspective-intro{margin-bottom:22px}
  .perspective-intro p{font-size:11px}
  .perspective-intro h2{font-size:clamp(28px,9vw,38px);line-height:1.06}
  .perspective-empty{padding:30px 18px;font-size:14px;line-height:1.5}
  .life-hero{display:grid;min-height:min(620px,calc(100dvh - 112px));align-content:end}
  .life-hero.has-image:after{background:linear-gradient(0deg,#080b11 0%,rgba(5,7,11,.78) 48%,rgba(5,7,11,.16) 100%)}
  .life-hero__copy{width:100%;padding:clamp(150px,34dvh,290px) 18px 18px}
  .life-hero h1{margin:9px 0 12px;font-size:clamp(40px,13vw,60px);line-height:.94}
  .life-hero h1{overflow-wrap:anywhere}
  .life-hero__copy>p{font-size:17px;line-height:1.45}
  .life-hero__actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:20px}
  .life-hero__actions>:last-child:nth-child(3){grid-column:1/-1}
  .life-primary-action,.life-secondary-action{height:48px;padding:0 12px;font-size:14px}
  .life-hero__facts{position:static;grid-template-columns:repeat(4,1fr);margin:0 12px 14px;border-radius:14px}
  .life-hero__facts span{padding:11px 6px;font-size:9px;text-align:center}
  .life-hero__facts b{font-size:21px}
  .life-overview__body{width:calc(100% - 28px);padding:24px 0 calc(56px + env(safe-area-inset-bottom))}
  .life-section-heading>span{font-size:19px}
  .life-section-heading button{min-height:44px;padding:0 4px;font-size:14px}
  .person-explorer__identity .life-edit-profile,.profile-edit-action,.profile-history-action,.record-inline-edit{min-height:44px;font-size:14px}
  .person-explorer__identity .life-edit-profile{margin-left:0;padding:0 12px}
  .life-section-heading .profile-edit-action,.life-section-heading .profile-history-action{padding-inline:12px}
  .life-filmstrip{display:flex;gap:8px;margin-inline:-14px;padding:0 14px;overflow-x:auto;scroll-snap-type:x mandatory;overscroll-behavior-x:contain}
  .life-film-frame,.life-film-frame:first-child{flex:0 0 76vw;height:220px;grid-row:auto;scroll-snap-align:center}
  .life-overview__grid{grid-template-columns:1fr;gap:28px;margin-top:30px}
  .life-family-row{display:flex;gap:8px;margin-inline:-14px;padding:0 14px;overflow-x:auto;scroll-snap-type:x proximity}
  .life-family-face{flex:0 0 126px;min-height:118px;scroll-snap-align:start}
  .featured-story{padding:20px}
  .memory-theater{height:auto;min-height:0;aspect-ratio:4/5;max-height:calc(100dvh - 112px)}
  .memory-theater__top{left:12px;right:12px;top:12px;font-size:12px}
  .memory-theater__caption{left:18px;right:18px;bottom:74px;width:auto}
  .memory-theater__caption h2{font-size:clamp(25px,8vw,36px)}
  .memory-theater__caption p{font-size:13px;line-height:1.45}
  .memory-theater__controls{left:12px;right:12px;bottom:14px;gap:6px}
  .memory-theater__controls button{min-width:48px;height:48px}
  .life-photo-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:14px}
  .life-photo-tile{min-height:150px}
  .bowtie-scroll{scroll-behavior:auto;overscroll-behavior:contain}
  .bowtie-stage{margin:0}
  .bowtie-person{min-width:104px;min-height:76px}
  .bowtie-person>span>b{font-size:13px}
  .bowtie-person>span>small{font-size:10px}
  .life-timeline article{padding-bottom:28px}
  .life-timeline time{font-size:13px}
  .life-timeline p,.place-card p,.memory-card p{font-size:14px;line-height:1.55}
  .place-card,.memory-card{min-height:0;padding:18px}
  .source-card__link{min-height:44px;display:inline-flex;align-items:center;font-size:14px}
  .customize-profile textarea,.customize-profile input[type="url"]{min-height:48px;font-size:16px}
  .profile-choice-row label>span{display:flex;min-height:44px;align-items:center;font-size:14px}
  .customize-actions button{min-height:48px;font-size:14px}
}

@media(max-width:420px){
  .brand>span:last-child{display:none}
  .topbar{grid-template-columns:44px minmax(0,1fr)}
  .intro-card{bottom:max(66px,calc(54px + env(safe-area-inset-bottom)))}
  .detail-stats{grid-template-columns:repeat(3,minmax(0,1fr))}
  .detail-stat strong{font-size:18px}
  .detail-stat span{padding:0;letter-spacing:.035em;text-transform:none}
  .detail-stat i{display:none}
  .photo-gallery-grid{grid-template-columns:1fr 1fr}
}

@media (max-width:760px), (any-pointer:coarse) and (max-width:1000px) and (max-height:500px){
  .photo-modal,.photo-viewer{height:100%;height:100dvh;padding:0}
  .photo-modal__card{width:100%;height:100%;height:100dvh;max-height:none;border:0;border-radius:0;overscroll-behavior:contain}
  .photo-modal__header{padding:max(14px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 12px max(16px,env(safe-area-inset-left))}
  .photo-modal form{padding:15px max(16px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left))}
  .photo-form-grid{grid-template-columns:1fr}
  .photo-form-wide{grid-column:auto}
  .photo-form-grid label>span,.photo-field-label{font-size:12px}
  .photo-form-grid input,.photo-form-grid textarea,.photo-tag-search,.photo-upload-item input{min-height:46px;font-size:16px}
  .photo-form-status{font-size:13px;line-height:1.4}
  .photo-crop-aspects button,.photo-crop-actions button{min-height:44px;font-size:14px}
  .photo-crop-zoom input{min-height:44px}
  .photo-profile-choice{min-height:48px;align-self:auto}
  .photo-dropzone{min-height:132px;padding:16px;text-align:center}
  .photo-upload-item{grid-template-columns:56px minmax(0,1fr) 44px}
  .photo-upload-item img{width:56px;height:56px}
  .photo-upload-item b{font-size:13px}
  .photo-upload-item small,.photo-dropzone small{font-size:12px}
  .photo-modal__footer,.photo-footer-actions{gap:8px}
  .photo-modal__footer{position:sticky;bottom:0;margin-inline:-16px;padding:12px 16px calc(12px + env(safe-area-inset-bottom));background:rgba(12,16,23,.96)}
  body.classic-tree-mode .photo-modal__footer{background:rgba(205,177,124,.97)}
  .photo-modal__footer :where(button){min-height:46px}
  .photo-primary,.photo-secondary,.photo-danger{font-size:14px}
  .photo-viewer__stage{width:100%;height:100%;height:100dvh;grid-template-columns:1fr;grid-template-rows:minmax(0,58dvh) minmax(0,1fr);border:0;border-radius:0}
  .photo-viewer__info{padding:18px max(18px,env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left))}
  .photo-viewer__info h2{font-size:22px}
  .photo-viewer__info time,.photo-viewer__tags span{font-size:12px}
  .photo-viewer__close{position:fixed;top:max(10px,env(safe-area-inset-top));right:max(10px,env(safe-area-inset-right));width:46px;height:46px}
  .photo-viewer__arrow{top:29dvh;width:48px;height:64px}
  .photo-viewer__arrow--prev{left:max(8px,env(safe-area-inset-left))}
  .photo-viewer__arrow--next{right:max(8px,env(safe-area-inset-right))}
  .photo-gallery-card__profile{min-height:44px;padding:0 9px;font-size:12px}
  .photo-gallery-card__order{grid-template-columns:44px 1fr 44px}
  .photo-gallery-card__order button{width:44px;height:44px}
  .photo-gallery-card__grip{height:44px}
  .photo-gallery-card.is-reordering .photo-gallery-card__meta{bottom:57px}
  .photo-reorder-button,.photo-add-button{min-height:44px;padding:0 11px;font-size:14px}
  .photo-toast{bottom:calc(16px + env(safe-area-inset-bottom));font-size:13px}
}

@media (max-width:720px), (any-pointer:coarse) and (max-width:1000px) and (max-height:500px){
  .admin-panel{width:100%;height:100%;height:100dvh;border-left:0;overscroll-behavior:contain}
  .admin-panel-head{padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 14px max(16px,env(safe-area-inset-left))}
  .admin-panel-head h2{font-size:22px}
  .admin-shield{width:44px;height:44px}
  .admin-close,.admin-back{width:44px;height:44px}
  .admin-overview{padding:0 max(16px,env(safe-area-inset-right)) 14px max(16px,env(safe-area-inset-left))}
  .admin-tabs{top:calc(58px + max(16px,env(safe-area-inset-top)));gap:4px;padding:0 max(16px,env(safe-area-inset-right)) 10px max(16px,env(safe-area-inset-left));overflow-x:auto;scrollbar-width:none}
  .admin-tabs button{height:44px;min-height:44px;padding:0 13px;font-size:14px;white-space:nowrap}
  .admin-panel-body{padding:18px max(16px,env(safe-area-inset-right)) calc(34px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
  .access-request{display:grid;grid-template-columns:44px minmax(0,1fr);padding:14px}
  .access-request .admin-primary{width:100%;justify-content:center;font-size:14px}
  .request-heading{display:grid;gap:8px}
  .request-heading b,.member-identity b{font-size:15px}
  .request-heading small,.member-identity span,.access-request p{font-size:13px}
  .member-row{flex-wrap:wrap}
  .member-row>button{margin-left:50px;min-width:calc(100% - 50px)}
  .person-search-input{height:48px;font-size:16px}
  .person-result{align-items:flex-start;flex-wrap:wrap}
  .person-result>div{min-width:0;flex:1}
  .person-result button,.member-row>button,.admin-danger{min-height:44px;font-size:14px}
  .admin-status{font-size:13px;line-height:1.4}
}

@media (max-width:700px), (any-pointer:coarse) and (max-width:1000px) and (max-height:500px){
  .record-editor{width:100%;height:100%;height:100dvh;overscroll-behavior:contain}
  .record-editor__head{padding:max(14px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 12px max(16px,env(safe-area-inset-left))}
  .record-editor__head button{width:44px;height:44px}
  .record-editor__tabs{top:calc(56px + max(14px,env(safe-area-inset-top)));padding:0 max(16px,env(safe-area-inset-right)) 10px max(16px,env(safe-area-inset-left));overflow-x:auto;scrollbar-width:none}
  .record-editor__tabs button{min-height:44px;font-size:14px;white-space:nowrap}
  .record-editor__body{padding:16px max(16px,env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
  .record-toolbar{grid-template-columns:1fr}
  .record-toolbar :where(input,select),.record-field :where(input,select,textarea){min-height:48px;font-size:16px}
  .record-field:has(input[type="checkbox"]){min-height:44px;align-content:center}
  .record-row{min-height:58px;padding:12px}
  .record-form__actions button{min-height:48px}
  .history-entry header{display:grid;gap:5px}
  .history-changes span{grid-template-columns:1fr;gap:3px}
  .history-changes i{transform:rotate(90deg)}
}

@media (max-width:650px), (any-pointer:coarse) and (max-width:1000px) and (max-height:500px){
  .profile-contribution{place-items:stretch;padding:0}
  .profile-contribution__panel{width:100%;max-height:100vh;max-height:100dvh;min-height:100vh;min-height:100dvh;border:0;border-radius:0}
  .profile-contribution__header{padding-top:calc(18px + env(safe-area-inset-top))}
  .profile-contribution__fields{grid-template-columns:1fr}
  .profile-contribution__field--wide{grid-column:auto}
  .profile-contribution__header,
  .profile-contribution__fields,
  .profile-contribution__error,
  .profile-contribution__help,
  .profile-contribution__actions{padding-left:max(18px,env(safe-area-inset-left));padding-right:max(18px,env(safe-area-inset-right))}
  .profile-contribution__header p{font-size:13px}
  .profile-contribution__field>span{font-size:13px}
  .profile-contribution__help{font-size:12px;line-height:1.45}
  .profile-contribution__actions{position:sticky;bottom:0}
  .profile-contribution__actions button{flex:1;min-width:0}
  .profile-contribution__actions button{min-height:48px;font-size:14px}
  .auth-gate{width:100%;height:100%;height:100dvh;padding:max(14px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) max(30px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left))}
  .auth-card{width:100%;max-width:520px;padding:24px 20px;box-sizing:border-box}
  .auth-card h1{font-size:clamp(34px,11vw,42px)}
  .auth-copy{font-size:16px;line-height:1.5}
  .auth-form input,.auth-form textarea{min-height:48px;font-size:16px}
  .auth-card button{min-height:48px;font-size:15px}
  .auth-account-line{align-items:stretch;flex-direction:column}
  .auth-account-line button{width:100%}
}

@media (max-width:1000px) and (max-height:500px){
  .intro-card{bottom:max(8px,env(safe-area-inset-bottom));max-height:calc(100% - max(8px,env(safe-area-inset-bottom)) - 8px);overflow-y:auto;overscroll-behavior:contain}
  .intro-card:not(.hidden)~.zoom-controls,.intro-card:not(.hidden)~.dataset-badge{display:none}
}

@media (any-pointer:coarse) and (min-width:600px) and (max-width:1000px) and (max-height:500px){
  .intro-card{right:auto;width:min(410px,calc(100% - 84px))}
  .topbar{grid-template-columns:40px minmax(150px,1fr) minmax(0,1fr);grid-template-areas:"brand search actions";padding:max(5px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) 5px max(8px,env(safe-area-inset-left));gap:7px}
  .brand>span:last-child{display:none}
  .search-wrap input{height:44px}
  .detail-panel{
    inset:max(58px,env(safe-area-inset-top)) 0 0 auto;
    width:min(46vw,380px);
    height:auto;
    padding:24px max(18px,env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) 18px;
    border-width:0 0 0 1px;
    border-radius:20px 0 0 20px;
    box-shadow:-18px 0 54px rgba(0,0,0,.52);
  }
  .detail-panel:before{display:none}
  body:has(.detail-panel:not([hidden])) .zoom-controls{display:none}
  .person-explorer__header{grid-template-columns:minmax(150px,.7fr) minmax(0,1fr) 44px;grid-template-areas:"identity tabs close";padding:max(5px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) 5px max(8px,env(safe-area-inset-left))}
  .person-explorer__identity small,.person-explorer__identity em{display:none}
  .person-explorer__tabs{min-width:0}
  .life-hero{min-height:calc(100dvh - 58px)}
  .life-hero__copy{width:calc(100% - 236px);padding:72px 12px 18px max(18px,env(safe-area-inset-left))}
  .life-hero h1{font-size:clamp(34px,8vw,48px)}
  .life-hero__facts{position:absolute;right:max(12px,env(safe-area-inset-right));bottom:max(12px,env(safe-area-inset-bottom));width:220px;margin:0}
  .memory-theater{height:calc(100dvh - 58px);min-height:0;max-height:none;aspect-ratio:auto}
  .memory-theater__top{top:max(10px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right))}
  .memory-theater__caption{left:max(18px,env(safe-area-inset-left));right:max(18px,env(safe-area-inset-right));bottom:calc(66px + env(safe-area-inset-bottom))}
  .memory-theater__controls{left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));bottom:max(8px,env(safe-area-inset-bottom))}
  .profile-contribution__header{padding-top:max(8px,env(safe-area-inset-top));padding-bottom:8px}
  .profile-contribution__fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding-top:12px}
  .profile-contribution__field--wide{grid-column:1/-1}
  .photo-viewer__stage{grid-template-columns:minmax(0,1fr) minmax(240px,38vw);grid-template-rows:1fr}
  .photo-viewer__arrow{top:50%}
  .photo-viewer__arrow--next{right:calc(min(240px,38vw) + max(8px,env(safe-area-inset-right)))}
  .photo-crop-stage canvas{aspect-ratio:16/9}
}

@media (any-pointer:coarse) and (min-width:600px) and (max-width:1000px) and (max-height:500px){
  .photo-crop-editor{grid-template-columns:minmax(0,1fr) minmax(280px,42%);align-items:start;gap:10px 14px}
  .photo-crop-stage{grid-row:1/3}
  .photo-crop-toolbar{grid-template-columns:1fr;gap:8px}
  .photo-crop-aspects,.photo-crop-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}
  .photo-crop-actions{grid-template-columns:repeat(3,minmax(0,1fr))}
  .photo-crop-aspects button,.photo-crop-actions button{min-width:0;padding-inline:6px}
  .photo-crop-editor>p{grid-column:2}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
