/* Keep each modal inside its viewport; the dialog owns vertical scrolling. */
html{box-sizing:border-box;-webkit-text-size-adjust:100%}
*,*::before,*::after{box-sizing:inherit}
body{min-width:0;max-width:100%}
body :is(button,input,select,textarea){min-width:0;max-width:100%}
body :is(h1,h2,h3,h4,p,span,strong,small,label,legend,button,a){overflow-wrap:anywhere}
body :is(.row-actions,.post-meeting-actions,.community-tabs,.reward-filters,.welcome-strip,.plan,.selected-genres){flex-wrap:wrap}
body .row-actions button,body .coord-inbox,body .location-options button,body .study-areas button,body .study-subjects button{white-space:normal}
body :is(.friend-row,.my-group,.meeting-item,.group-card,.person-card,.album-card,.coord-notice,.reward-level)>*{min-width:0;max-width:100%}
body .chat-compose{grid-template-columns:minmax(0,1fr) auto}
body .map-search,body .custom-topic-row,body .custom-genre{grid-template-columns:minmax(0,1fr) auto}
body .bubble{overflow-wrap:anywhere;flex-shrink:0}
dialog{padding:0;max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);border-radius:20px;overflow-y:auto;overscroll-behavior:contain}
dialog .dialog-card{box-sizing:border-box;max-width:100%;max-height:none;overflow:visible}
dialog .dialog-card h2{padding-right:38px;overflow-wrap:anywhere}
dialog .dialog-card :is(section,article,div,fieldset,form){min-width:0}
dialog :is(input,select,textarea,button){max-width:100%;box-sizing:border-box}
dialog :is(p,strong,small,button,label){overflow-wrap:anywhere}
dialog button{white-space:normal}
dialog iframe{max-width:100%}
.premium-actions,.premium-colors{flex-wrap:wrap}
.reward-level{display:flex;flex-direction:column;min-width:0;height:auto}
.reward-level .premium-details{margin-top:auto}
@media(max-width:620px){
 .topbar{height:auto;min-height:64px;padding:12px 16px;gap:12px;flex-wrap:wrap;position:relative}
 .topbar .brand{flex:1}
 .topbar nav{position:static;order:3;flex:0 0 100%;width:100%;height:auto;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin:8px 0 0;padding:6px 0;background:transparent;border:0}
 .topbar .nav-link{min-width:0;padding:10px 4px;font-size:13px;line-height:1.3;white-space:normal}
 main{width:100%;padding:28px 16px 30px}
 .filters,.filter-group,.topics{min-width:0!important;max-width:100%;width:100%;overflow:visible;white-space:normal;flex-wrap:wrap}
 .filters{gap:12px}.filter-label{flex-basis:100%}
 .section-head{flex-wrap:wrap;gap:8px}
 dialog{width:calc(100vw - 24px);margin:auto}
 dialog .dialog-card{width:100%!important;padding:24px 16px}
 dialog .camino-panel{padding:0}
 .camino-hero,.camino-body{padding:24px 16px}
 dialog :is(input,select,textarea){font-size:16px}
 dialog :is(.profile-reputation,.reward-path){grid-template-columns:repeat(2,minmax(0,1fr))}
 .reward-level{padding:12px;min-height:0}
 .premium-overview,.premium-preview{padding:16px}
 .premium-actions>button,.premium-colors>button{flex:1 1 140px}
 .create-fab,.support-fab{position:static!important;display:block;width:calc(100% - 32px);margin:8px 16px;padding:12px 16px;transform:none!important}
 .support-fab{margin-bottom:24px}
 .toast{max-width:calc(100vw - 24px);width:max-content;bottom:16px}
}
@media(max-width:900px){
 body dialog{box-sizing:border-box;width:calc(100% - 24px);max-width:calc(100% - 24px);padding:0;margin:auto;overflow-x:hidden;overflow-y:auto}
 body dialog .dialog-card{width:100%!important;max-width:100%!important;min-width:0;max-height:none;overflow:visible}
 body dialog .dialog-card *{min-width:0}
 body dialog :is(.row-actions,.post-meeting-actions,.premium-actions,.premium-colors,.community-tabs,.chat-head,.coord-actions){flex-wrap:wrap;max-width:100%}
 body dialog :is(button,span,strong,small,p,label,legend){white-space:normal;overflow-wrap:anywhere}
 body dialog :is(.friend-row,.my-group,.join-requests article){grid-template-columns:42px minmax(0,1fr)}
 body dialog :is(.friend-row,.my-group) .row-actions{grid-column:1/-1}
 body dialog .selected-location-card{grid-template-columns:auto minmax(0,1fr)}
 body dialog .selected-location-card>button{grid-column:1/-1;justify-self:start}
 body dialog .season-progress{grid-template-columns:minmax(0,1fr) auto}
 body dialog .season-bar{grid-column:1/-1;grid-row:2}
 body dialog :is(.date-time-picker>div,.meeting-age-range>div){grid-template-columns:minmax(0,1fr)}
 body dialog input[type=date],body dialog input[type=time]{width:100%;min-width:0;-webkit-appearance:none}
 body dialog .profile-reputation{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:480px){
 body dialog .reward-path{grid-template-columns:minmax(0,1fr)}
 body dialog :is(.meeting-item,.album-card,.camino-summary,.meal-invite-card){grid-template-columns:minmax(0,1fr)}
 body dialog .meeting-item>*{grid-column:1!important}
 body dialog .row-actions>button,body dialog .post-meeting-actions>button{flex:1 1 120px}
 body .topbar nav{grid-template-columns:repeat(2,minmax(0,1fr))}
 body dialog .dialog-card h2{font-size:clamp(24px,7vw,32px);line-height:1.15}
}

/* Compact mobile navigation: one label, stable badges, no oversized tab strip. */
@media(max-width:760px){
 body .topbar{padding:14px 16px 16px;gap:10px;height:auto;flex-wrap:wrap;position:relative}
 body .topbar .brand{flex:1;font-size:21px;gap:9px}
 body .topbar .profile-button{padding:0;gap:6px}
 body .topbar .profile-name{display:none}
 body .topbar nav{position:static;order:3;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));flex:0 0 100%;width:100%;height:auto;margin:4px 0 0;padding:0;gap:8px;border:0;background:none}
 body .topbar .nav-link{display:flex;align-items:center;justify-content:center;gap:6px;min-height:44px;height:auto;margin:0;padding:10px 8px;border:1px solid var(--line);border-radius:14px;background:var(--card);font:500 14px/1.25 "DM Sans",sans-serif;letter-spacing:normal;color:var(--muted);overflow-wrap:normal;word-break:normal}
 body .topbar .nav-link.active{background:var(--green);color:#ded8bd;border-color:var(--green)}
 body .topbar .nav-link::after,body .topbar .camino-link::before{content:none;display:none}
 body .topbar #caminoBtn{grid-column:1/-1;justify-content:space-between;padding:10px 14px;font-size:14px}
 body .topbar :is(.count,.camino-level){display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:auto;min-width:24px;height:24px;padding:2px 7px;border-radius:999px;white-space:nowrap;overflow-wrap:normal;word-break:keep-all;font-size:12px;line-height:1}
}

/* Keep the profile close control above the decorative preview. */
body #profileDialog #closeOwnProfile{position:absolute;top:12px;right:12px;z-index:30;display:grid;place-items:center;width:44px;height:44px;min-height:44px;padding:0!important;border-radius:50%;border:1px solid #514b35;background:#18392c;color:#ded8bd;font:28px/1 "DM Sans",sans-serif;cursor:pointer;box-shadow:0 2px 8px #0003}
body #profileDialog #closeOwnProfile:focus-visible{outline:3px solid #dceca4;outline-offset:3px}
body #profileDialog .public-preview-label{padding-right:48px}
@media(max-width:620px){body #profileDialog .public-profile-preview{margin:-24px -16px 18px;padding:24px 16px}}

body button.close{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;touch-action:manipulation;z-index:30}
