/* Phone and tablet presentation. Loaded last; artwork and export sizes stay unchanged. */
.mobile-studio-nav,.atlas-mobile-destinations{display:none}
@media(max-width:900px){
 :is(button,a,input,select,textarea,summary){touch-action:manipulation}
 :is(input:not([type=checkbox]):not([type=range]),select,textarea){font-size:16px!important}
 .drawer-head button,#progress-window .drawer-head button{width:44px;height:44px;min-width:44px;min-height:44px}
 html:has(.command-room[data-panel]){overflow:hidden}
 #progress-window{width:calc(100% - 14px);max-width:calc(100% - 14px)}
 .drawer-head{padding:12px 16px;gap:12px}
 .drawer-content{overflow-wrap:break-word}
 .drawer :is(.button,.secondary,.coin-hub-tabs button,.reward-tabs button){min-height:44px}

 /* A flowing home screen with a reachable navigation dock. */
 html:has(.command-room),body.command-room{height:auto;min-height:100%;overflow:auto}
 .command-room .room-shell{height:auto;min-height:100dvh;overflow:clip;display:flex;flex-direction:column;padding-bottom:calc(132px + env(safe-area-inset-bottom,0px))}
 .room-shell .room-scenery,.room-shell .living-canvas,.room-shell .living-video,.room-shell:before{position:fixed;inset:0;width:100%;height:100dvh}
 .room-shell .room-top{order:0;flex:none;min-height:72px;height:auto;padding:14px 16px;gap:10px;flex-wrap:wrap}
 .room-top .brand{font-size:25px}.room-top .brand-coin{width:34px;height:34px}.room-top .room-location,.room-top .status-chip{display:none}
 .room-top .season-badge{font-size:10px;margin-left:auto;padding:7px 9px}
 .room-shell .room-copy{position:relative;inset:auto;order:1;width:calc(100% - 32px);max-width:650px;margin:18px auto 0;padding:20px;border-radius:16px}
 .room-copy .origin-trigger{font-size:10px;line-height:1.6;min-height:44px;max-width:100%;margin:0 0 8px;letter-spacing:.8px}
 .room-copy h1{font-size:clamp(44px,10vw,66px);line-height:1;letter-spacing:-1px}
 .room-copy .room-subtitle{font-size:17px;margin:16px 0 8px;max-width:none}
 .room-copy .pack-manifesto{font-size:14px;line-height:1.6;max-width:none;margin:0 0 18px}
 .room-copy .room-story-actions{display:grid;gap:10px}.room-copy .room-story-actions :is(button,a){font-size:13px;min-height:44px;white-space:normal}
 .room-shell .room-hero{position:relative;inset:auto;order:2;flex:none;width:100%;max-width:620px;height:auto;margin:12px auto 18px;padding:0 16px;opacity:1}
 .room-hero>img{height:300px;max-height:42dvh;width:100%;min-height:220px}
 .room-hero figcaption{position:relative;inset:auto;transform:none;width:min(100%,320px);min-width:0;padding:12px 16px;margin:-10px auto 0}
 .room-hero figcaption>span{display:block;font-size:10px}.room-hero strong{font-size:24px}
 .room-hero .home-pose-buttons button{min-height:44px;min-width:84px;font-size:13px}
 .room-hero figcaption>button,.room-hero figcaption>a:not([hidden]){min-height:44px;display:flex;align-items:center;justify-content:center;font-size:13px;margin:0 auto}
 .room-shell .world-controls{position:relative;inset:auto;order:3;width:calc(100% - 32px);max-width:650px;margin:0 auto;display:grid;grid-template-columns:1fr 1fr;padding:12px;gap:10px}
 .world-controls label{display:flex;flex-direction:column;align-items:stretch;gap:4px;min-width:0;font-size:11px}
 .world-controls label:first-child{grid-column:1/-1}
 .world-controls :is(select,.wallpaper-mode,select[aria-label='World framing']){min-width:0;width:100%;max-width:none;min-height:44px;padding:9px 8px}
 .world-controls .cinema-view{grid-column:1/-1;min-height:44px;font-size:13px;border:1px solid #ffffff30;border-radius:8px;padding:10px;white-space:normal}
 .world-controls .world-load-status{grid-column:1/-1;font-size:12px}
 .room-shell .pack-side-links{position:relative;inset:auto;order:4;width:calc(100% - 32px);max-width:650px;margin:14px auto;padding:10px;display:flex;flex-wrap:wrap;gap:8px 20px;justify-content:center}
 .pack-side-links>span{display:none}.pack-side-links a{min-height:44px;font-size:12px}
 .room-shell .room-footnote{position:relative;inset:auto;order:5;margin:0 24px;font-size:11px;line-height:1.7}
 .room-shell .room-dock{position:fixed;z-index:20;bottom:0;left:0;transform:none;width:100%;max-width:none;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin:0;padding:8px 10px calc(10px + env(safe-area-inset-bottom,0px));border-radius:16px 16px 0 0;background:#101722f5;backdrop-filter:blur(14px);box-shadow:0 -8px 30px #0005}
 .room-dock>:is(button,a){min-height:46px;padding:5px;font-size:11px;display:flex;flex-direction:row;gap:7px;box-shadow:none}.room-dock b{font-size:20px}
 .room-shell.scenery-mode{min-height:100dvh;padding:0}.scenery-mode :is(.room-copy,.room-hero,.room-dock,.room-footnote){display:none}
 .room-shell.scenery-mode .world-controls{position:fixed;bottom:calc(16px + env(safe-area-inset-bottom,0px));left:16px;right:16px;width:auto}

 /* Fusion: preview plus one editing section, instead of three long rails. */
 .next-lab .top{height:auto;min-height:62px;padding:10px 12px;gap:8px;flex-wrap:wrap}
 .next-lab .top .studio-heading{display:none}.next-lab .help-link{display:inline-flex;min-height:44px;font-size:12px}
 .next-lab .top .help-link[href]{display:none}.next-lab #tabs{margin-left:auto;gap:3px}.next-lab #tabs button{font-size:12px;padding:6px}
 .next-lab .projectbar{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);padding:10px 12px;gap:8px}.next-lab .project-name{grid-column:1/-1;min-width:0}.next-lab .projectbar input{max-width:none;min-height:44px}
 .next-lab #save-status{grid-column:1/-1;max-width:none;font-size:11px;overflow-wrap:anywhere}.next-lab :is(#save,#download,#post-meme){width:100%;white-space:normal;font-size:12px;min-height:44px;padding:8px}
 .next-lab .next-more>summary{display:flex;align-items:center;min-height:44px;padding:10px;font-size:12px}.next-lab .next-more-body{top:48px}
 .next-more-body a{display:flex;align-items:center;min-height:44px;padding:8px;font-size:13px;color:#ffe0bc}
 .next-lab .studio-quickbar{flex-wrap:nowrap;overflow-x:auto;padding:8px 12px;gap:7px;scrollbar-width:thin}
 .next-lab .studio-quickbar button{flex:none;min-height:44px;font-size:12px;padding:8px 12px}.next-lab .inunify-badge{display:none}
 .next-lab .atelier-workspace{display:grid;grid-template-columns:minmax(0,1fr);height:auto;overflow:visible}
 .next-lab .canvas-column{grid-column:1;grid-row:1;height:clamp(390px,65dvh,640px);min-height:0;padding:12px;scroll-margin-top:12px}
 .next-lab .canvas-column>.stage{height:100%;gap:8px}.next-lab .preview-heading{flex-wrap:wrap;gap:8px}
 .next-lab .preview-heading h2{font-size:14px}
 .next-lab .next-layer-buttons button{min-height:44px;padding:8px 12px;font-size:12px}.next-lab .next-layer-label{display:none}
 .next-lab .canvas-holder{padding:6px 12px}.next-lab .actions button{min-height:44px;font-size:12px}.next-lab #preview-tip{font-size:11px;line-height:1.5}
 .next-lab .mobile-studio-nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-column:1;grid-row:2;position:sticky;top:0;z-index:35;gap:5px;padding:8px;background:#101721f5;border-block:1px solid #455064;backdrop-filter:blur(12px)}
 .mobile-studio-nav button{min-height:44px;font-size:12px;padding:6px 2px}.mobile-studio-nav button[aria-pressed=true]{border-color:#ffb66e;color:#ffdfbf}
 .next-lab .atelier-workspace .creative-rail{grid-column:1;grid-row:3;display:none!important;min-height:0;max-height:none;height:auto;overflow:visible;border:0;scroll-margin-top:72px}
 .next-lab[data-mobile-panel=library] .asset-rail,.next-lab[data-mobile-panel=position] .arrange-rail,.next-lab[data-mobile-panel=design] .design-rail{display:flex!important}
 .next-lab .next-assets,.next-lab .next-inspector{height:auto;min-width:0}.next-lab .next-panel-title{font-size:11px;padding:16px}
 .next-lab .creative-rail>.next-library-toggle{display:none!important}
 .next-lab .next-tabs button{min-height:44px;font-size:13px}.next-lab .next-pane{overflow:visible;padding:16px;scrollbar-gutter:auto}
 .next-lab .asset-rail .next-pane{max-height:65dvh;overflow:auto;overscroll-behavior:auto}
 .next-lab #heroes{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.next-lab #heroes img{height:100px}
 .next-lab #worlds{grid-template-columns:repeat(2,minmax(0,1fr))}.next-lab #worlds button{font-size:12px}
 .next-lab .next-arrange{max-height:none;overflow:visible;padding:16px}.next-lab .arrange-grid{grid-template-columns:1fr 1fr}
 .next-lab :is(.next-note,.control-card>p,.next-arrange label,.hero-dialogue label,.field-help>label){font-size:13px;line-height:1.6}
 .next-lab :is(.arrange-buttons button,.control-card .row button){min-height:44px;font-size:12px}.next-lab .next-arrange input[type=range]{min-height:44px}
 .next-lab .hero-dialogue summary{min-height:44px;padding:12px 0;font-size:14px}
 .next-lab .studio-status{min-height:44px;height:auto;padding:12px}.next-lab #status{font-size:12px}.next-lab .status-hint{display:none}

 .canvas-context{max-height:45dvh}.canvas-context button{min-height:44px;font-size:12px}.canvas-context header{position:sticky;top:-12px;background:#182230;padding:6px 0}
 #context-close{min-width:44px}.canvas-context textarea,.canvas-context select{font-size:16px}

 /* Hero browsing, map checklists, treasury and community. */
 #heroes-window :is(.hero-paging button,.card-controls button,.card-controls a,.showcase-actions button,#hero-clear-search,.showcase-poses button){min-height:44px;min-width:44px;font-size:12px}
 #heroes-window .card-controls a{display:flex;align-items:center;justify-content:center}
 .atlas-mobile-destinations{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0}
 .atlas-mobile-destinations button{display:flex;align-items:center;gap:9px;text-align:left;min-height:60px;padding:10px;border:1px solid #6a513d;background:#171c27;color:#f5dfc1;border-radius:9px;font:700 13px/1.35 system-ui}
 .atlas-mobile-destinations button[aria-pressed=true]{background:#523820;border-color:#ffc17b}.atlas-mobile-destinations small{display:block;font-size:10px;color:#d1c2b0;font-weight:400;margin-top:4px}
 .destination-detail{scroll-margin-top:12px}.destination-description,.destination-checklist li{font-size:14px;line-height:1.65}.destination-note,.destination-record p,.destination-record li{font-size:13px;line-height:1.65}
 .growth-count p,.growth-goals small,.progress-footer,.atlas-caption{font-size:12px;line-height:1.6}.destination-cta,.progress-switcher button{min-height:44px}
 .reward-tabs button{white-space:normal;font-size:13px}.reward-help{min-width:44px;min-height:44px}.coin-toolbar{flex-wrap:wrap}.coin-toolbar select{min-width:0;max-width:100%;min-height:44px}
 .search{min-width:0}.filters button,.card-copy button,.share-actions button,.results-line button{min-height:44px}
 .nav nav{flex-wrap:wrap;gap:8px 16px}.nav nav a,.community-nav a{min-height:44px;display:flex;align-items:center}
 .community-nav,.board-heading{flex-wrap:wrap}.community-nav{gap:8px 20px}.board-heading{align-items:flex-start}
 /* The close control remains reachable while a meme preview scrolls. */
 body:not(.command-room):not(.creator) dialog{padding-top:10px}
 body:not(.command-room):not(.creator) dialog>.close{position:sticky;top:0;margin-left:auto;display:flex;width:44px;height:44px;background:#243246;box-shadow:0 3px 12px #0008;margin-bottom:10px}
}
@media(max-width:700px){
 #heroes-window .gallery-layout{scroll-behavior:auto}.showcase-main{scroll-margin-top:0}
 #home-roster.collection-grid{grid-template-columns:repeat(3,minmax(0,1fr));max-height:none;overflow:visible}
 .collection-card{grid-template-rows:auto 38px}.collection-card span{font-size:12px}.collection-note{font-size:12px}
 .showcase-heading p,.hero-presentation figcaption>span{font-size:11px;line-height:1.5}.showcase-heading{flex-wrap:wrap}.showcase-main{padding:16px 12px 12px}
 .showcase-ratings span{font-size:10px}.card-back p{font-size:11px}.back-footer{font-size:9px}
 .collection-tools{font-size:12px;flex-wrap:wrap}.collection-tools select{max-width:150px;min-height:44px}
 .next-lab .brand-mark{width:28px;height:28px}.next-lab .studio-brand{font-size:13px}
}
@media(max-width:380px){
 .room-top .season-badge{margin-left:0}.room-copy .origin-trigger{font-size:9px}.room-copy h1{font-size:44px}
 #home-roster.collection-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .next-lab #heroes{grid-template-columns:repeat(2,minmax(0,1fr))}.next-lab #worlds{grid-template-columns:1fr}.next-lab .arrange-grid{grid-template-columns:1fr}
 .next-lab #tabs{width:100%;justify-content:flex-start}.next-lab .help-link{margin-left:auto}
 .reward-metrics{grid-template-columns:1fr}.atlas-mobile-destinations{grid-template-columns:1fr}
}
@media(max-width:480px){.community-hero{flex-direction:column;gap:12px;padding:15px 0 30px}.community-hero img{margin:0;width:72px}.community-hero h1{font-size:40px}.nav{flex-wrap:wrap;gap:10px}.nav nav{width:100%;justify-content:space-between}}
@media(max-width:900px) and (max-height:500px){
 .room-shell .room-dock{grid-template-columns:repeat(6,minmax(0,1fr))}.room-dock>:is(button,a){flex-direction:column;font-size:10px;gap:2px}.command-room .room-shell{padding-bottom:85px}
 .next-lab .canvas-column{height:520px}
}

/* A transparent arena companion stands in the scene; only its controls have a surface. */
.home-hero-widget{position:fixed;right:22px;left:auto;bottom:40px;width:340px;max-width:calc(100vw - 24px);z-index:15;pointer-events:none}
.room-shell .home-hero-widget .room-hero{position:absolute;inset:auto 0 54px auto;width:100%;height:min(320px,48dvh);max-width:none;margin:0;padding:0;opacity:1;background:none;border:0;border-radius:0;box-shadow:none;backdrop-filter:none;pointer-events:none}
.room-shell .home-hero-widget .room-hero[hidden]{display:none}
.home-hero-widget .room-hero>img{display:block;flex:none;width:100%;height:100%;min-height:0;max-height:none;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 10px 9px #0007)}
.home-hero-widget .room-hero figcaption{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;background:none;border:0;box-shadow:none}
.home-hero-controls{display:flex;justify-content:flex-end;align-items:center;gap:5px;pointer-events:auto}
.home-hero-controls button{min-height:44px;padding:8px 10px;border:1px solid #c98c54;border-radius:8px;background:#111925ed;color:#ffe0b8;font:700 12px system-ui;cursor:pointer;touch-action:manipulation;box-shadow:0 4px 12px #0004}
.home-hero-controls .home-pose-buttons{display:flex;gap:4px;margin:0}
.home-hero-controls .home-pose-buttons button{min-width:50px}
.home-hero-controls .home-pose-buttons button[aria-pressed=true]{background:#693b1b;border-color:#e7a35c}
.home-hero-controls #home-hero-next{display:flex;align-items:center;justify-content:center;gap:8px;flex:1;background:#693b1b}
.home-hero-controls #home-hero-toggle{flex:none}
.home-hero-controls button:hover{background:#885025}
.home-hero-controls button[aria-disabled=true]{opacity:.65;cursor:wait}
.home-hero-controls [hidden]{display:none!important}
.scenery-mode .home-hero-widget{display:none}
@media(min-width:1201px){.room-shell .room-dock{left:calc((100vw - 380px)/2);width:min(850px,calc(100vw - 440px))}}
@media(max-width:1200px) and (min-width:901px){.home-hero-widget{bottom:140px}}
@media(max-width:900px){.home-hero-widget{position:relative;inset:auto;order:2;flex:none;align-self:flex-end;width:min(340px,calc(100% - 32px));max-width:none;margin:14px 16px 22px 0}.room-shell .home-hero-widget .room-hero{position:relative;inset:auto;height:290px;margin:0 0 10px}.home-hero-controls #home-hero-next{padding-inline:6px}}
@media(max-width:900px) and (max-height:500px){.room-shell .home-hero-widget .room-hero{height:240px}}

/* The text dock remains attached to the canvas on phones; only Style/Assets switch below. */
@media(max-width:900px){
 .next-lab .canvas-column{height:auto;min-height:0;padding:12px}.next-lab .canvas-column>.stage{height:auto;gap:8px}.next-lab .canvas-holder{flex:none;height:clamp(220px,calc((100vw - 48px) / var(--canvas-ratio,1)),520px)}
 .next-lab .preview-heading{grid-template-columns:minmax(0,1fr) auto;gap:8px}.next-lab .preview-heading>div:first-child{grid-column:1;grid-row:1}.next-lab #dimensions{grid-column:2;grid-row:1;font-size:9px}.next-lab .canvas-random-tools{grid-column:1/-1;grid-row:2;justify-content:stretch}.next-lab .random-core{flex:1;min-height:44px;font-size:12px}
 .next-lab .studio-textbar{grid-template-columns:repeat(2,minmax(0,1fr));padding:6px;gap:5px}.next-lab .text-dock-button{min-height:44px}.text-tool-label,.text-tool-preview{font-size:11px}
 .next-lab .text-popover :is(input,textarea,select){font-size:16px}.next-lab .text-popover-close{min-height:44px;min-width:44px}.next-lab .text-popover .row button{min-height:44px}
 .next-lab .canvas-footer .actions{gap:5px}.next-lab .canvas-footer .actions button{font-size:10px;min-height:36px;padding:6px 8px}.next-lab .canvas-footer #preview-tip{display:none}

}

@media(max-width:760px){
 .next-lab .mobile-studio-nav{position:fixed;inset:auto 0 0;box-sizing:border-box;padding:6px 10px calc(6px + env(safe-area-inset-bottom));background:#151923;border-top:2px solid #9a723e}
 .next-lab{padding-bottom:calc(70px + env(safe-area-inset-bottom))}
 .next-lab .mobile-studio-nav button{border-radius:9px;color:#e4ded4;font-weight:800}
 .next-lab .mobile-studio-nav button[aria-pressed=true]{background:#593a21;color:#fff3dd}
 body:has(dialog[open]) .mobile-studio-nav{visibility:hidden}
}
