/* Touch layout: the same live 3D room, readable overlays and safe-area controls. */
@media(max-width:760px) and (orientation:portrait){
 .overlay{left:max(14px,env(safe-area-inset-left));top:max(14px,env(safe-area-inset-top))}
 .day-night button{min-height:38px;padding:8px 10px;font-size:12px}
 #reset{width:44px;height:44px;margin-top:9px}
 #room-shortcuts{top:auto;bottom:max(16px,env(safe-area-inset-bottom));left:14px;right:14px;justify-content:space-around;gap:2px;padding:7px 3px;border:1px solid #eee2c62b;border-radius:12px;background:#241d17b5;backdrop-filter:blur(10px)}
 #room-shortcuts .room-shortcut{width:auto;flex:1 1 0;height:58px;min-width:44px;padding:5px 0;gap:3px}
 #room-shortcuts .room-shortcut:after{content:attr(aria-label);font-size:10px;letter-spacing:.03em;color:#f0e8d9}
 #room-shortcuts .room-shortcut svg{width:23px;height:23px}
 #shortcut-label{display:none}
 #hud-sound-home{top:max(18px,env(safe-area-inset-top));right:14px;left:auto;bottom:auto}
 #hud-sound-home button{min-height:44px;padding:8px;font-size:11px}
 #interaction-exit{bottom:calc(max(16px,env(safe-area-inset-bottom)) + 88px);right:18px;min-height:44px;padding:8px 12px;border:1px solid #fff3;background:#211a1470;border-radius:5px}
 .writing-letter #room-shortcuts{display:none}
 #letter-tools,.writing-letter #letter-tools{top:auto;bottom:calc(var(--keyboard-inset,0px) + max(18px,env(safe-area-inset-bottom)));left:50%;right:auto;transform:translateX(-50%);display:flex;flex-direction:row;width:auto;gap:16px;padding:8px;border-radius:8px;background:#241d178c}
 #letter-tools .letter-icon{width:46px;height:46px}
 #letter-tool-tip{display:none}
 .letter-note{right:16px;left:16px;top:auto;bottom:calc(var(--keyboard-inset,0px) + 100px);width:auto;max-width:none;max-height:calc(var(--visible-height,100dvh) - 130px);overflow:auto;transform:none;font-size:14px}
 #letter-preview-dialog[open]{width:calc(100vw - 20px);height:calc(var(--visible-height,100dvh) - 24px);max-height:calc(var(--visible-height,100dvh) - 24px);margin:12px auto;border-radius:13px}
 #letter-preview-dialog header{padding:16px 14px;gap:8px;min-height:80px;height:auto}
 #letter-preview-dialog header>div{padding-left:10px}
 #letter-preview-dialog header strong{font-size:21px}
 #letter-preview-dialog header p{font-size:11px;line-height:1.5;max-width:175px}
 #letter-preview-dialog button{font-size:12px;min-height:44px;padding:8px 10px;white-space:nowrap}
 #letter-preview-dialog #letter-preview-pages{padding:8px 14px 20px;min-height:110px}
 #letter-preview-editor{padding:24px 20px;font-size:18px;line-height:29px}
 #letter-preview-dialog .letter-reply{margin:0 14px;padding:12px}
 #letter-preview-dialog .letter-reply label{font-size:16px;margin-bottom:5px}
 #letter-preview-dialog #letter-email{font-size:16px;padding:10px}
 #letter-preview-dialog footer{margin:10px 14px 0;padding:12px 0;gap:7px}
 #letter-submit-state{flex-basis:100%;font-size:10px;line-height:1.4}
 #contact-dialog .contact-flight{width:calc(100vw - 32px);margin-left:calc((100vw - 32px) / -2);height:408px;margin-top:-204px}
 #contact-dialog .contact-paper{height:338px;padding:31px 24px}
 #contact-dialog [data-copy]{width:44px;height:44px;right:-10px;bottom:-9px;padding:13px}
 #contact-dialog .contact-value{padding-right:30px;font-size:16px;letter-spacing:0;overflow-wrap:anywhere}
 #contact-dialog .contact-return{min-height:44px;top:20px;right:20px}
 #school-stamp-access{bottom:174px;width:calc(100% - 32px);justify-content:center;gap:18px}
 #school-stamp-access button{min-height:44px;padding:10px}
 #school-card{top:47%;bottom:auto;left:5%;width:90%}
 .school-return{min-height:44px;bottom:-48px}
 #about-dialog .about-return{min-width:44px;min-height:44px}
 #about-dialog .about-return span{display:inline}
 #about-dialog .about-tool-row{grid-template-columns:repeat(3,1fr)}
 #vhs-shrink{min-width:44px;min-height:44px;bottom:max(15px,env(safe-area-inset-bottom))}
}
@media(max-height:500px) and (orientation:landscape){
 .overlay{top:max(8px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left))}
 #room-shortcuts{top:8px;right:max(12px,env(safe-area-inset-right));gap:5px}
 #room-shortcuts .room-shortcut{width:44px;height:44px;flex-basis:44px}
 #contact-dialog .contact-flight{zoom:.82}
 #interaction-exit{bottom:max(12px,env(safe-area-inset-bottom))}
}

@media(max-width:760px) and (orientation:portrait){
 #letter-tools,.writing-letter #letter-tools{width:max-content;flex-wrap:nowrap}
 #letter-preview-dialog header{padding-top:12px;padding-bottom:12px}
 #letter-preview-dialog #letter-email::placeholder{font-size:12px}
}

button,a,input,textarea{-webkit-tap-highlight-color:transparent}
