/* Phone-only refinement layer. Desktop rules and theme palettes stay in their own files. */
@media screen and (max-width:800px){
 :root[data-interface]{scroll-padding-top:84px}
 :root[data-interface] main>:not(dialog){min-width:0}
 :root[data-interface] :is(button,a,input,select,textarea,summary){touch-action:manipulation}
 :root[data-interface] :is([role=tabpanel],.account-card,.editor-panel,.social-card,details,[id^=member-],[id^=art-]){scroll-margin-top:84px}
 :root[data-interface] :is(.header,.legal-header):not([data-mobile-enhanced]){flex-wrap:wrap;gap:14px;padding:16px;height:auto}
 :root[data-interface] :is(.header,.legal-header):not([data-mobile-enhanced])>.button{max-width:100%;white-space:normal}
 :root[data-interface] :is(.profile-head,.owner-card,.admin-intro,.social-toolbar,.receipt-heading,.conversation-head,.availability-identity,.gift-body,.news-row-head)>div{min-width:0}
 :root[data-interface] :is(.profile-head h2,.profile-public-info h2,.conversation-head a,.post-meta a,.receipt-number,.shop-card h3,.news-row-head strong){overflow-wrap:anywhere}
 :root[data-interface] :is(.social-prose,.news-body){font-size:15px;line-height:1.75}
 :root[data-interface] :is(.social-prose,.news-body,.legal-document){overflow-wrap:anywhere}
 :root[data-interface] :is(.account-actions,.social-actions,.receipt-actions,.support-history-actions,.news-actions){gap:10px}
 :root[data-interface] :is(.account-actions,.social-actions,.receipt-actions,.support-history-actions,.news-actions)>.button{max-width:100%;flex:1 1 160px}
 :root[data-interface] :is(.news-permalink,.profile-art-link,.legal-back,summary){display:inline-flex;align-items:center;min-height:44px;line-height:1.5}
 :root[data-interface] :is(.security-details,.blocked-details,.availability-group,.support-alternative)>summary{display:flex}
 :root[data-interface] :is(input[type=range],.appearance-preview-action button,.theme-filter,#theme-preview-motion){min-height:44px}
 :root[data-interface] :is(.theme-group,.interface-settings,.appearance-card){min-width:0}
 :root[data-interface] .theme-group-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 :root[data-interface] .theme-option{display:flex;flex-direction:column;gap:8px;min-width:0;padding:10px;text-align:left}
 :root[data-interface] .theme-option :is(strong,small){margin:0;min-width:0;max-width:100%;overflow-wrap:anywhere}
 :root[data-interface] .theme-option strong{font-size:14px;line-height:1.45}
 :root[data-interface] .theme-option small{font-size:13px;line-height:1.55}
 :root[data-interface] .theme-option-state{margin-top:auto;padding-top:5px;line-height:1.5}
 :root[data-interface] .theme-option .theme-view-label{padding-top:3px;line-height:1.5}
 /* Labels share rows instead of colliding in the corners of small thumbnails. */
 :root[data-interface] .theme-option .theme-scene{display:flex;flex-wrap:wrap;align-content:flex-end;align-items:flex-end;justify-content:flex-start;gap:4px;width:100%;height:auto;min-height:132px;aspect-ratio:4/3;padding:7px;isolation:isolate}
 :root[data-interface] .theme-option .theme-scene>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:-1}
 :root[data-interface] .theme-option :is(.theme-tier-badge,.theme-motion-badge,.theme-season-badge){position:relative;inset:auto;max-width:100%;margin:0;white-space:normal;font-size:10px;line-height:1.4;padding:3px 5px}
 :root[data-interface] .theme-interface-badge{font-size:11px;line-height:1.4}
 :root[data-interface] .theme-option .theme-interface-badge{margin-top:6px}
 :root[data-interface] .interface-theme-override{flex-wrap:wrap;gap:14px;padding:16px}
 :root[data-interface] .interface-theme-override>div{min-width:0;flex:1 1 220px}
 :root[data-interface] .interface-theme-override>.button{flex:1 1 190px;white-space:normal}
 :root[data-interface] .interface-mini{max-width:100%}
 :root[data-interface] :is(.account-section-tabs,.admin-tabs,.theme-filters,.game-tag-filters,.filters,.week-grid){scroll-padding-inline:8px;overscroll-behavior-inline:contain}
 :root[data-interface] :is(.account-section-tabs,.admin-tabs,.theme-filters) button:focus-visible{outline-offset:-3px}
 :root[data-interface] :is(.art-editors,.news-admin-layout){grid-template-columns:minmax(0,1fr)}
 :root[data-interface] .art-editor{padding:16px}
 :root[data-interface] input[type=file]{overflow:hidden}
 :root[data-interface] input[type=file]::file-selector-button{max-width:100%;min-height:36px;white-space:normal;margin-right:8px}
 :root[data-interface] .public-subscription{flex-wrap:wrap;gap:12px}
 :root[data-interface] .public-subscription>div{min-width:0;flex:1 1 130px}
 :root[data-interface] .public-subscription img{max-width:100%;width:150px;height:auto}
 :root[data-interface] .shop-card-actions{gap:10px}
 :root[data-interface] .shop-card-actions .button{flex:1 1 140px}
 :root[data-interface] .shop-admin-row{min-width:0}
 :root[data-interface] .availability-identity{flex-wrap:wrap;align-items:flex-start;gap:12px}
 :root[data-interface] .availability-identity>.availability-preview{width:min(140px,100%)}
 :root[data-interface] .availability-identity>.appearance-preview-action{flex:1 1 140px;min-width:0}
 :root[data-interface] .gift-body{flex-wrap:wrap}
 :root[data-interface] .gift-body>.availability-preview{width:100px;max-width:100%}
 :root[data-interface] .gift-body>div:last-child{flex:1 1 140px;min-width:0}
 :root[data-interface] .news-row-head{flex-wrap:wrap}
 :root[data-interface] .news-row-head .text-button{margin-left:auto}
 :root[data-interface] .news-links .button{min-height:48px}
 :root[data-interface] .chat-scroll{max-height:50dvh;min-height:120px;scroll-padding:12px}
 :root[data-interface] .chat-message{padding:14px 12px}
 :root[data-interface] .chat-message .message-delete{min-height:44px;padding:10px 0}
 :root[data-interface] .inbox-item{min-height:64px}
 /* The close control remains reachable while the contents scroll. */
 :root[data-interface] dialog{box-sizing:border-box;max-width:calc(100% - 16px);max-height:calc(100dvh - max(16px,env(safe-area-inset-top)) - max(16px,env(safe-area-inset-bottom)));overflow:auto;scroll-padding-block:74px 20px;overscroll-behavior:contain}
 :root[data-interface] :is(#theme-preview-dialog,#interface-preview-dialog,#appearance-preview-dialog){max-height:calc(100dvh - max(16px,env(safe-area-inset-top)) - max(16px,env(safe-area-inset-bottom)))}
 :root[data-interface] :is(.theme-preview-toolbar,.interface-preview-head){position:sticky;top:0;z-index:3;background:var(--panel);border-bottom:1px solid var(--line);align-items:center;flex-wrap:nowrap;gap:10px}
 :root[data-interface] .interface-preview-head{top:-16px;margin:-16px -16px 12px;padding:12px 16px}
 :root[data-interface] .theme-preview-toolbar{padding:12px 16px}
 :root[data-interface] :is(.theme-preview-toolbar,.interface-preview-head)>div{min-width:0}
 :root[data-interface] :is(.theme-preview-toolbar,.interface-preview-head) h2{font-size:20px;line-height:1.3;overflow-wrap:anywhere}
 :root[data-interface] :is(.theme-preview-toolbar,.interface-preview-head)>.button{flex-shrink:0;padding:10px 12px}
 :root[data-interface] :is(.theme-preview-toolbar,.interface-preview-head) .theme-interface-badge{display:flex;width:fit-content;margin:6px 0 0;font-size:10px}
 :root[data-interface] .interface-preview-frame iframe{height:58dvh;min-height:220px}
 :root[data-interface] .theme-preview-footer .account-actions{display:grid;grid-template-columns:minmax(0,1fr)}
 :root[data-interface] .theme-preview-footer .button{width:100%}
 :root[data-interface] .theme-demo-background.motion-scene{contain:paint}
 :root[data-interface] .theme-demo-background>img{object-position:center}
 :root[data-interface] .notice-head h2{font-size:24px;line-height:1.3;overflow-wrap:anywhere}
 :root[data-interface] .notice-close{flex-shrink:0}
 :root[data-interface] :is(.notice-head,.home-video-dialog-head){position:sticky;top:0;z-index:3;background:var(--panel);border-bottom:1px solid var(--line)}
 :root[data-interface] :is(.dialog-close,#shop-close){position:sticky;top:0;right:auto;left:auto;float:right;z-index:4;margin:0 0 8px 10px;min-height:44px;min-width:44px;padding:10px;background:var(--panel);border:1px solid var(--line);border-radius:8px}
 :root[data-interface] .dialog-body>.eyebrow{padding-right:0;min-height:44px;display:flex;align-items:center;line-height:1.6}
 :root[data-interface] :is(.dialog-body,#shop-dialog)>h2{clear:both}
 :root[data-interface] dialog::backdrop{backdrop-filter:none;-webkit-backdrop-filter:none}
 /* One stable viewport layer; keep animation itself and the user's motion setting. */
 :root[data-interface] .animated-theme-background{height:100lvh;bottom:auto;transform:translateZ(0)}
 :root[data-interface] body:has(>.animated-theme-background)::before{background-image:none}
 :root[data-interface] body:has(dialog[open])>.animated-theme-background .motion-scene,
 :root[data-interface] body:has(dialog[open])>.animated-theme-background *,
 :root[data-interface] body:has(dialog[open]) :is(.orbit-signature,.sentinel-signature,.brand-mark)::before,
 :root[data-interface] body:has(dialog[open]) .sentinel-sigil{animation-play-state:paused!important}
 :root[data-interface] :is(.account-card,.social-card,.editor-panel,.admin-list-panel,.theme-option,.news-post,.game-card,.shop-card){box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none}
 @media(hover:none){
  :root[data-interface] :is(.theme-option,.platform,.game-card,.featured-game,.shop-card,.forum-topic,.button):hover{transform:none;box-shadow:none}
 }
 @media(max-width:600px){
  :root[data-interface] .shop-grid{grid-template-columns:minmax(0,1fr)}
  :root[data-interface] .profile-head{gap:12px}
  :root[data-interface] .profile-head>.account-actions{width:100%}
  :root[data-interface] .news-images{grid-template-columns:minmax(0,1fr)}
  :root[data-interface] .theme-preview-toolbar{padding:12px}
 }
 @media(max-width:380px){
  :root[data-interface] .theme-group-grid{grid-template-columns:minmax(0,1fr)}
  :root[data-interface] .theme-option{padding:12px;gap:10px}
  :root[data-interface] .theme-option .theme-scene{aspect-ratio:16/9;min-height:132px}
  :root[data-interface] .theme-option strong{font-size:16px}
  :root[data-interface] .platforms{grid-template-columns:minmax(0,1fr)}
  :root[data-interface] .platform{min-height:72px;align-items:center;padding:14px}
  :root[data-interface] .platform>svg{width:24px;height:24px}
  :root[data-interface] .hero-copy{padding-left:16px;padding-right:16px}
  :root[data-interface] .hero h1{font-size:clamp(29px,8.8vw,33px)}
  :root[data-interface] .hero-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:10px}
  :root[data-interface] .hero-actions .text-link{justify-self:start}
  :root[data-interface] .theme-preview-toolbar h2{font-size:18px}
 }
 @media(max-height:520px){
  :root[data-interface] .account-section-tabs{position:static}
  :root[data-interface] .interface-preview-frame iframe{height:70dvh;min-height:180px}
  :root[data-interface] .chat-scroll{min-height:90px;max-height:42dvh}
 }
 @media(prefers-reduced-motion:no-preference){
  :root[data-interface] :is(.theme-option,.platform,.game-card,.shop-card,.button){transition:background-color .18s ease,border-color .18s ease,color .18s ease}
 }
}

/* Phone refresh: only <=800px, including the exclusive and management layouts. */
@media screen and (max-width:800px){
 :root[data-interface] :is(.admin-page,.account-page,.helpdesk-page){min-width:0}
 :root[data-interface] :is(.admin-header,.admin-intro,.helpdesk-toolbar,.profile-head,.account-actions){flex-wrap:wrap}
 :root[data-interface] :is(.admin-header,.helpdesk-toolbar,.shop-summary)>*{min-width:0}
 :root[data-interface] :is(.admin-tabs,.account-section-tabs){max-width:100%;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
 :root[data-interface] :is(.admin-tabs,.account-section-tabs) button{min-height:44px;flex-shrink:0}
 :root[data-interface] .shop-disclosure>.shop-summary{display:flex;width:100%;min-height:68px;gap:12px;box-sizing:border-box}
 :root[data-interface] .shop-summary-copy .eyebrow{font-size:10px;letter-spacing:1.8px;overflow-wrap:anywhere}
 :root[data-interface] .shop-summary #shop-heading{font-size:24px}
 :root[data-interface] .shop-summary-action{font-size:12px;gap:6px}
 :root[data-interface] .shop-disclosure-content{padding-top:14px}
 :root[data-interface] .shop-card-copy{padding:16px}
 :root[data-interface] .shop-card-actions>.button{width:100%;min-height:44px}
 :root[data-interface] .legal-footer{gap:12px;flex-wrap:wrap}
 :root[data-interface] .legal-footer a{min-height:44px;display:inline-flex;align-items:center;line-height:1.5}
 :root[data-interface] [data-mobile-enhanced] nav .mobile-helpdesk{grid-column:1/-1;border-color:var(--accent);color:var(--text);overflow-wrap:anywhere}
 :root[data-interface] .item-actions{display:flex;flex-wrap:wrap;gap:6px}
 :root[data-interface] .item-actions button{min-height:44px;min-width:44px;padding:10px 8px;font-size:12px;line-height:1.4;white-space:normal}
 /* Avoid costly SVG blur layers while keeping artwork, colors and motion. */
 :root[data-interface] .animated-theme-background svg [filter]{filter:none}
 :root[data-interface] :is(.header,.admin-header,.account-section-tabs,.admin-tabs,.notice-panel){backdrop-filter:none;-webkit-backdrop-filter:none}
 :root[data-interface][data-phone-scrolling=true] .animated-theme-background *,
 :root[data-interface][data-phone-scrolling=true] :is(.orbit-signature,.sentinel-signature,.atlas-signature,.singularity-signature) *::after,
 :root[data-interface][data-phone-scrolling=true] :is(.orbit-signature,.sentinel-signature,.atlas-signature,.singularity-signature) *::before{animation-play-state:paused!important}
 :root[data-interface] :is(.helpdesk-message,.helpdesk-thread,.chat-message,.conversation-head){overflow-wrap:anywhere;min-width:0}
 @media(max-width:380px){:root[data-interface] .shop-summary #shop-heading{font-size:21px}:root[data-interface] .shop-summary-action{font-size:11px}}
}
