/* Phone chrome only. Room geometry belongs to mobile-room.css.
   Desktop nodes return to their original positions above 900px. */
#mobile-header,#mobile-tabs{display:none}
#mobile-more-dialog{width:min(400px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;border:1px solid #dbcbb5;border-radius:22px;background:#fffaf2;color:#66513f;padding:16px;box-shadow:0 18px 70px #3b2e2838}
#mobile-more-dialog::backdrop{background:#322d2959}
.mobile-more-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.mobile-more-heading h2{font-size:22px;margin:0}
#mobile-more-dialog button{min-height:44px;border:0;border-radius:12px;background:transparent;color:inherit;font:inherit;font-weight:700;padding:10px 14px;text-align:left}
#mobile-more-dialog>button{display:flex;align-items:center;justify-content:space-between;width:100%;margin-top:6px;background:#f1eadc}
#mobile-more-dialog>button:hover{background:#e7edde}
#mobile-more-dialog #mobile-signout{margin-top:18px;color:#965347}
#mobile-more-dialog button:focus-visible{outline:3px solid #477f68;outline-offset:2px}
@media(max-width:900px){
  :root{--mobile-top-height:calc(56px + env(safe-area-inset-top,0px));--mobile-bottom-height:calc(64px + env(safe-area-inset-bottom,0px));--mobile-viewport-height:100dvh;--mobile-keyboard-inset:0px}
  body{min-width:320px;scroll-padding-top:calc(var(--mobile-top-height) + 12px);scroll-padding-bottom:calc(var(--mobile-bottom-height) + 12px)}
  .app-shell{display:block;min-height:100dvh}
  .th-mobile .sidebar{display:none}
  .th-mobile .app-shell>main{padding-top:var(--mobile-top-height);padding-bottom:var(--mobile-bottom-height);min-width:0}
  .mobile-auth{--mobile-bottom-height:0px}
  .mobile-keyboard-open{--mobile-bottom-height:0px}
  .mobile-keyboard-open #mobile-tabs{display:none}
  /* The room owns its narrowly scoped native-chat state and real viewport geometry. */
  body.mobile-room-composing #mobile-header,body.mobile-room-composing #mobile-tabs{display:none}
  #mobile-header{position:fixed;inset:0 0 auto;z-index:30;display:flex;align-items:center;justify-content:space-between;gap:8px;height:var(--mobile-top-height);padding:env(safe-area-inset-top,0px) max(12px,env(safe-area-inset-right,0px)) 0 max(12px,env(safe-area-inset-left,0px));background:#fffdf8;border-bottom:1px solid #e8ddcc}
  #mobile-header .brand{font-size:22px;gap:7px;flex-shrink:0;min-height:44px}
  #mobile-header .brand-mark{width:28px;height:28px;font-size:22px;border-radius:9px}
  .mobile-header-account{display:flex;align-items:center;gap:8px;min-width:0}
  #mobile-header #coin-wallet{display:flex;align-items:center;gap:5px;min-width:0;margin:0;padding:0 2px;background:none;border:0;border-radius:0;min-height:44px;white-space:nowrap;font-size:11px;box-shadow:none}
  #mobile-header #coin-balance{font-size:13px;min-width:0;max-width:78px;overflow:hidden;text-overflow:ellipsis}
  #mobile-more-button{min-height:44px;min-width:44px;flex-shrink:0;padding:8px;border:1px solid #e8ddcc;border-radius:12px;background:#f6f0e4;color:#66513f;font-size:12px;font-weight:800}
  #mobile-tabs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;inset:auto 0 0;z-index:30;height:var(--mobile-bottom-height);padding:4px max(4px,env(safe-area-inset-right,0px)) env(safe-area-inset-bottom,0px) max(4px,env(safe-area-inset-left,0px));background:#fffdf8;border-top:1px solid #e8ddcc}
  #mobile-tabs button{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:4px;min-width:0;min-height:44px;margin:0 2px;padding:4px 0;border:0;border-radius:12px;background:transparent;color:#86735c;font-size:10px;line-height:1.15;font-weight:700;touch-action:manipulation}
  #mobile-tabs button svg{width:22px;height:22px;flex:0 0 22px}
  #mobile-tabs button.active{background:#e7edde;color:#385d4b}
  #mobile-tabs button:focus-visible,#mobile-more-button:focus-visible{outline:3px solid #477f68;outline-offset:-3px}
  .th-mobile .dashboard{min-height:0}
  .th-mobile .main-content{padding:14px max(12px,env(safe-area-inset-right,0px)) 20px max(12px,env(safe-area-inset-left,0px));min-width:0}
  .th-mobile .view{min-width:0;max-width:720px}
  .th-mobile .view-heading{gap:10px;margin-bottom:14px;flex-wrap:wrap}
  .th-mobile .view-heading h1{font-size:28px;margin:0;line-height:1.2}
  .th-mobile .view-heading p{font-size:12px}
  .th-mobile .subtle-button,.th-mobile .text-button{min-height:44px;padding:8px 10px}
  .th-mobile .split-content{grid-template-columns:minmax(0,1fr);gap:12px}
  .th-mobile .panel{min-width:0;padding:18px;border-radius:18px}
  .th-mobile .panel h2{font-size:21px}
  .th-mobile .panel-header{gap:8px;flex-wrap:wrap}
  .th-mobile .field{font-size:13px;margin-bottom:14px;min-width:0}
  .th-mobile .field input,.th-mobile .field select,.th-mobile .chat-form input{font-size:16px;min-height:44px;min-width:0}
  .th-mobile .swatch{width:44px;height:44px;flex:0 0 44px}
  .th-mobile .button,.th-mobile .switch-button{min-height:44px}
  .th-mobile .map-actions{display:flex;flex-wrap:wrap;gap:4px}
  .th-mobile .daily-tasks{grid-template-columns:minmax(0,1fr)}
  .th-mobile .forum-grid{grid-template-columns:minmax(0,1fr)}
  .th-mobile .create-forum{display:block}
  .th-mobile .create-forum form{margin-top:14px;min-width:0}
  /* Keep the original civic illustration; make the welcome screen one compact column. */
  .th-mobile .auth-layout{display:flex;flex-direction:column;align-items:stretch;gap:16px;min-height:0;padding:20px max(16px,env(safe-area-inset-right,0px)) max(24px,env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));max-width:480px;margin:0 auto}
  .th-mobile .intro-panel{display:flex;align-items:center;justify-content:space-between;gap:12px}
  .th-mobile .intro-panel h1{font-size:36px;margin:0;line-height:1.05}
  .th-mobile .intro-illustration{width:128px;height:84px;max-height:none;aspect-ratio:auto;margin:0;border-radius:14px;flex-shrink:0}
  .th-mobile .welcome-scene{width:100%;height:100%;object-fit:cover}
  .th-mobile .auth-card{padding:20px 16px;border-radius:20px;max-width:none;box-shadow:0 8px 24px #405b4610}
  .th-mobile .auth-top{margin-bottom:20px}
  .th-mobile .auth-switch{width:100%}
  .th-mobile .switch-button{flex:1;font-size:14px}
  .th-mobile .customization-row{min-width:0}
  /* Preserve wardrobe's fixed preview frame and internal control scroll. */
  .th-mobile .avatar-editor>.avatar-showcase{top:calc(var(--mobile-top-height) + 8px)}
  .th-mobile .avatar-settings{min-width:0}
  .th-mobile .face-editor-dialog,.th-mobile .visit-house-dialog{max-height:calc(var(--mobile-viewport-height) - 24px);width:min(620px,calc(100vw - 24px))}
  .th-mobile .face-editor-tabs button,.th-mobile #face-editor-controls button{min-width:44px;min-height:44px}
  .th-mobile #face-editor input[type="range"]{min-height:44px}
  .th-mobile #face-editor{scroll-padding-block:68px 76px}
  .th-mobile #face-editor :is(button,input){scroll-margin-block:8px}
  .th-mobile .toast{bottom:calc(var(--mobile-bottom-height) + 12px);max-width:calc(100vw - 24px)}
}
@media(max-width:900px) and (max-height:500px){
  .th-mobile .auth-layout{padding-top:12px;gap:10px}
  .th-mobile .intro-illustration{height:56px;width:86px}
  .th-mobile .intro-panel h1{font-size:28px}
}
@media(max-width:900px) and (min-width:568px) and (max-height:500px){
.th-mobile .avatar-editor{grid-template-columns:128px minmax(0,1fr);gap:12px}
.th-mobile .avatar-editor>.avatar-showcase{height:160px;flex-direction:column;gap:4px;padding:8px}
.th-mobile .avatar-editor>.avatar-settings{max-height:calc(var(--mobile-viewport-height) - var(--mobile-top-height) - var(--mobile-bottom-height) - 76px);min-height:0}
}
@media(prefers-reduced-motion:reduce){#mobile-header *,#mobile-tabs *,#mobile-more-dialog *{transition:none!important;animation:none!important}}
