/* Shared phone layouts. Keep content in flow; do not mask page overflow. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
main,main section,main aside,main article,main form{min-width:0}
img,video{max-width:100%}
@media(max-width:767px){
 body{font-size:16px;line-height:1.55}
 #siteHeader .header-layout{display:grid;grid-template-columns:minmax(0,1fr) auto auto;grid-template-rows:44px 44px;height:auto;gap:8px;padding:10px 12px}
 #siteHeader .header-links{display:none!important}
 #siteHeader .header-actions{display:contents}
 #brandLink{grid-column:1;grid-row:1;gap:6px;min-width:0}
 #brandLink>.brand-gradient{display:inline;font-size:14px;white-space:nowrap;letter-spacing:-.05em}
 #brandLink .brand-symbol{width:30px;height:30px}
 #siteHeader .credit-pill{grid-column:2;grid-row:1;min-height:44px;max-width:100px;padding:5px 7px;gap:4px}
 #siteHeader .credit-value{font-size:14px;max-width:64px;overflow:hidden;text-overflow:ellipsis}
 #siteHeader .credit-caption,#siteHeader .credit-plus{display:none}
 #siteHeader .credit-coin{width:25px;height:25px}
 #userMenuRoot{grid-column:3;grid-row:1}
 #siteHeader #userMenuBtn{min-width:44px;height:44px;padding:5px;justify-content:center;gap:0}
 #userMenuLabel,#userMenuBtn svg{display:none!important}
 #siteHeader .theme-toggle{grid-column:3;grid-row:2;width:44px;height:44px;justify-content:center;padding:0}
 #siteHeader .theme-label{display:none}
 #siteHeader details{display:block!important;grid-column:1/3;grid-row:2;position:relative;min-width:0}
 #siteHeader details>summary{display:flex;align-items:center;min-height:44px;padding:8px 12px;font-size:14px;list-style:none}
 #siteHeader details>summary:before{content:'☰';margin-right:10px;font-size:18px}
 #siteHeader details>div{left:0;right:auto;width:min(420px,calc(100vw - 24px));padding:10px;max-height:calc(100dvh - 132px);overflow-y:auto;box-shadow:0 12px 24px #0004}
 #siteHeader details>div>a,#userMenu a{display:flex;align-items:center;min-height:46px;padding:10px 12px}
 #userMenu{max-width:calc(100vw - 24px);max-height:calc(100dvh - 80px);overflow:auto}
 body>main,body main.max-w-7xl,body main.max-w-6xl,body main.max-w-5xl,body main.max-w-4xl{width:100%;padding:24px 16px 40px}
 main h1{font-size:clamp(28px,8vw,36px);line-height:1.12;letter-spacing:-.04em;overflow-wrap:anywhere}
 main h2{line-height:1.25;overflow-wrap:anywhere}
 main p,main label,main a,main small{overflow-wrap:anywhere}
 main :is(input:not([type=checkbox]):not([type=radio]),textarea,select){font-size:16px;min-height:46px;max-width:100%}
 main textarea{line-height:1.5;padding:12px;min-height:112px}
 main :is(button,.btn,.btn-glass){min-height:44px;white-space:normal;line-height:1.35}
 main .card.p-6,main .glass.p-6{padding:18px}
 main .flex-1,main .break-words{min-width:0}
 .auth-card{width:100%;padding:24px 18px!important;margin:0!important}
 .auth-card h1{font-size:32px}
 .unlock-toolbar{gap:8px;flex-wrap:wrap}.unlock-toolbar .btn{flex:1 1 auto;font-size:13px;padding:10px 12px}
 .unlock-toolbar>div{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px}
 .unlock-toolbar #tabColors,.unlock-toolbar #tabBadges{grid-column:span 3}
 .unlock-toolbar #filterAll,.unlock-toolbar #filterUnlocked,.unlock-toolbar #filterLocked{grid-column:span 2}
 .unlock-toolbar #summary{grid-column:1/-1;margin:4px 0 0;font-size:11px}
 .unlock-toolbar>div>span:not(#summary){display:none}
 #colorCategories{display:flex;flex-wrap:wrap;gap:7px}#colorCategories button{font-size:12px;padding:9px 11px}
 .color-collection-grid,.grid-auto{grid-template-columns:minmax(0,1fr)!important;gap:16px}
 .medal-tile,.color-tile{width:100%;min-width:0}.medal-art{height:154px}.medal-image{width:140px;height:140px}
 .medal-story,.medal-requirement,.color-clue{font-size:14px;line-height:1.6}
 .member-identity{max-width:100%;gap:8px}.member-identity b{overflow-wrap:anywhere}
 .member-badge,.member-identity .member-badge{width:30px;height:30px;flex-basis:30px}
 #leaderboard>.card{display:grid;grid-template-columns:28px minmax(0,1fr);gap:12px;padding:16px}
 #leaderboard>.card>.chip{grid-column:2;justify-self:start}
 #statsCard .grid{gap:16px 10px}#statsCard .text-2xl{font-size:23px}
 #publicName,#uidBox,#emailBox{white-space:normal;overflow-wrap:anywhere}
 #publicProfileLink{width:100%}
 #bundleContainer{grid-template-columns:1fr!important}#bundleStatus{max-width:48%;text-align:right}
 #txList>div{flex-wrap:wrap;gap:8px}#txList>div>div:last-child{font-size:12px}
 .personal-wall-grid{grid-template-columns:1fr;gap:24px}.personal-wall{padding:20px 0}.personal-message{font-size:22px}
 .overview-byline{gap:10px;align-items:center}.overview-byline .member-identity{flex-basis:100%}
 .board-marquee{padding:22px 18px}.overview-message-hero{font-size:30px;line-height:1.25;padding-right:16px}
 .wall-note{padding:18px 14px 0;box-shadow:3px 3px 0 var(--ui-depth)}
 .note-byline{display:grid;grid-template-columns:24px minmax(0,1fr);gap:8px}.note-author{min-width:0!important}
 .note-stamp{grid-column:2;margin-left:0!important}.note-author>p{margin-left:38px;font-size:11px}
 .wall-note .post-message{font-size:clamp(24px,7vw,32px);line-height:1.35;margin:22px 0}
 .note-actions,.note-tips{flex-wrap:wrap;gap:9px}.note-tips input.input{min-height:44px!important;font-size:16px!important;width:76px}
 .note-reactions button{min-width:44px}.note-emoji-options{max-width:calc(100vw - 60px);left:0!important;flex-wrap:wrap}
 .fixed[id$="Modal"]{padding:16px;overflow-y:auto;overscroll-behavior:contain;z-index:100}
 .fixed[id$="Modal"]>div{margin:12px auto!important;max-width:100%;width:100%;max-height:calc(100dvh - 56px);overflow-y:auto;padding:18px}
 .fixed[id$="Modal"] button{min-width:44px;min-height:44px}
 #colorList,#badgeList,#showcaseList{max-height:45dvh;overflow-y:auto}
 footer{padding-left:16px;padding-right:16px}footer nav{display:flex;flex-wrap:wrap;gap:4px 14px!important}footer nav a{display:inline-flex;align-items:center;min-height:44px;font-size:13px}
 .arcade-page main{padding:24px 16px 40px}.arcade-heading{gap:20px;padding-bottom:24px}.arcade-heading h1{font-size:36px}
 .arcade-ticket{padding:16px;gap:12px}.arcade-ticket img{width:44px;height:44px}.arcade-ticket strong{font-size:24px}
 .arcade-selector{grid-template-columns:1fr;gap:8px}.arcade-selector button{display:grid;grid-template-columns:90px minmax(0,1fr);align-items:center;gap:3px 10px;font-size:18px;padding:12px;text-align:left}.arcade-selector span{grid-row:1/3;margin:0}.arcade-selector small{grid-column:2;margin:0;font-size:12px}
 .cabinet-body{padding:14px;gap:20px}.game-stage{min-width:0}.game-stage .arcade-controls{margin:0 0 14px}
 .game-screen{min-height:0}.game-screen canvas{max-height:min(50svh,400px);max-width:100%;width:auto;height:auto}
 .game-pad{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));padding:12px 0 0;gap:6px}.game-pad button,.game-pad #dropControl{min-width:0;min-height:48px;padding:8px 3px;font-size:20px}.game-pad #dropControl{font-size:12px}
 .game-goal{font-size:20px}.game-sidebar #gameInstructions,.arcade-rules p{font-size:14px;line-height:1.6}
 .arcade-controls button{padding:10px 8px;font-size:13px}.cabinet-top{padding:16px}.cabinet-top h2{font-size:25px}
 .arcade-leaderboards h2{font-size:26px}#arcadeScores li{grid-template-columns:26px minmax(0,1fr) auto;gap:8px}#arcadeScores li>strong{font-size:18px}.board-periods{display:grid;grid-template-columns:1fr 1fr}
 .memory-board{padding:8px;gap:6px}.memory-card{min-height:48px;aspect-ratio:1;font-size:25px}
}
@media(min-width:768px) and (max-width:1023px){main{padding-left:24px;padding-right:24px}.header-layout{gap:12px}.personal-wall-grid{gap:20px}}
@media(hover:none){button:hover,.btn:hover,.btn-glass:hover,.bundle-card:hover{transform:none}}
@media(max-width:1023px) and (max-height:500px){.game-screen canvas{max-height:55svh}.game-pad button{min-height:44px}}

@media(max-width:767px){
.editor-toolbar{height:auto!important;min-height:140px;padding:14px!important;gap:8px!important}.editor-toolbar>div{width:100%}.editor-toolbar .btn-glass{min-height:44px;font-size:13px}#gjs{height:calc(100dvh - 170px)!important;min-height:500px;max-width:100%}.gjs-editor{max-width:100%}.gjs-cv-canvas{width:100%!important;height:calc(60% - 40px)!important;top:40px!important}.gjs-pn-commands{display:none!important}.gjs-pn-devices-c{left:0!important;max-width:40%;overflow-x:auto}.gjs-pn-options{right:0!important;max-width:60%;overflow-x:auto}.gjs-pn-views{top:60%!important;left:0!important;right:0!important;width:100%!important;height:40px}.gjs-pn-views-container{top:calc(60% + 40px)!important;left:0!important;right:0!important;width:100%!important;height:calc(40% - 40px)!important;overflow:auto;padding:12px!important}.gjs-pn-buttons{flex-wrap:nowrap}.gjs-pn-btn{min-width:30px}.gjs-block{width:45%;min-height:70px}
}
@media(max-width:767px){
 .auth-card{padding:22px 16px!important}
 .auth-brand{gap:9px;margin-bottom:12px}.auth-brand .brand-symbol-hero{width:38px;height:38px}.auth-card .auth-brand h1{font-size:clamp(25px,7vw,32px)}
 .auth-card>p:first-of-type{font-size:15px;line-height:1.5;margin-bottom:18px}
 .auth-callouts{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-bottom:20px}
 .auth-callouts>div{padding:10px 4px;border-radius:10px;font-size:11px;line-height:1.4}
 .auth-callouts .font-semibold{font-size:13px;margin-bottom:4px}
 .auth-card .btn-provider{min-height:50px;font-size:16px;padding:12px 10px}
 .auth-card #status:empty{display:none}.auth-card #status{margin-top:12px}
 .auth-card .auth-legal{font-size:12px;line-height:1.6;margin-top:12px}
 #app-footer footer>.max-w-7xl{padding:20px 0;gap:14px}
 #app-footer footer>.max-w-7xl>div:first-child{flex-direction:column;align-items:flex-start;gap:12px;width:100%}
 #app-footer footer nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;gap:0 8px!important}
 #app-footer footer nav a{min-height:44px;font-size:13px}
 #app-footer #footerYear{font-size:11px;line-height:1.6}
}
/* Compact mobile chrome: one row, with secondary actions in disclosure menus. */
.mobile-footer-bar,.mobile-theme-toggle{display:none}
@media(max-width:767px){
 #siteHeader .header-layout{grid-template-columns:minmax(0,1fr) auto 44px 44px;grid-template-rows:44px;gap:6px;padding:8px 10px}
 #siteHeader .header-actions>.theme-toggle{display:none}
 #siteHeader details{grid-column:4;grid-row:1;position:static}
 #siteHeader details>summary{width:44px;height:44px;padding:0;justify-content:center;border-radius:12px}
 #siteHeader details>summary:before{margin:0;font-size:22px}
 #siteHeader .mobile-menu-label{display:none}
 #siteHeader details>div{left:auto;right:10px;top:60px;max-height:calc(100dvh - 76px)}
 #siteHeader details .mobile-theme-toggle{display:flex;position:static;width:100%;height:46px;justify-content:flex-start;gap:10px;padding:10px 12px}
 #siteHeader details .theme-label{display:inline}
 #siteHeader .credit-pill{max-width:88px}
 #brandLink>.brand-gradient{font-size:13px}
 #brandLink .brand-symbol{width:26px;height:26px}
 #app-footer footer>.max-w-7xl{display:none}
 #app-footer footer{padding:0 14px}
 .mobile-footer-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:60px;white-space:nowrap}
 .mobile-footer-brand{display:flex;align-items:center;gap:7px;font-size:13px;font-weight:800}
 .mobile-footer-year{font-size:11px;opacity:.65}
 .mobile-footer-bar details{position:relative}
 .mobile-footer-bar summary{display:flex;align-items:center;gap:8px;min-height:44px;padding:0 8px;font-size:13px;cursor:pointer;list-style:none}
 .mobile-footer-bar summary::-webkit-details-marker{display:none}
 #app-footer .mobile-footer-bar nav{position:absolute;bottom:calc(100% + 8px);right:0;width:200px;display:flex;flex-direction:column;gap:0!important;background:var(--bg);border:1px solid var(--ui-line,#667085);border-radius:12px;padding:8px;box-shadow:0 8px 24px #0004;z-index:50}
 #app-footer .mobile-footer-bar nav a{display:flex;padding:8px 12px;min-height:44px}
}
/* Keep the shared footer at the viewport edge when content is short. */
body:has(> #app-footer){display:flex;flex-direction:column;min-height:100vh;min-height:100dvh}
body>#app-header,body>#app-footer{flex-shrink:0}
body>#app-footer{margin-top:auto}
body:has(> #app-footer)>main{flex-shrink:0}
