.profile-mobile-view-control,.profile-compact-featured{display:none}
@media(max-width:600px){
  #profile-work-region{scroll-margin-top:80px;overflow-anchor:none}
  #profile-work-region .portfolio-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
  #profile-work-region[data-columns="1"] .portfolio-grid{grid-template-columns:minmax(0,1fr);gap:12px}
  #profile-work-region[data-columns="3"] .portfolio-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
  #profile-work-region[data-columns="1"] .portfolio-work-shell{aspect-ratio:auto}
  #profile-work-region[data-columns="1"] .portfolio-work{height:auto;aspect-ratio:var(--profile-media-ratio,1)}
  #profile-work-region[data-columns="1"] .portfolio-work>video,#profile-work-region[data-columns="1"] .portfolio-work>img{object-fit:contain}
  #profile-work-region[data-columns="1"] .profile-work-overlay{opacity:1;transform:none}
  #profile-work-region:not([data-columns="1"]) .profile-work-overlay{display:none}
  #profile-work-region:not([data-columns="1"]) .profile-compact-featured{position:absolute;display:grid;place-items:center;left:5px;bottom:5px;z-index:4;width:20px;height:20px;border-radius:5px;background:rgba(18,18,20,.55);color:var(--accent);font-size:14px}
  #profile-work-region .profile-work-menu{top:0;right:0}
  #profile-work-region .profile-work-menu summary{position:relative;width:44px;height:44px;border:0;border-radius:0;background:transparent;backdrop-filter:none;-webkit-backdrop-filter:none;isolation:isolate}
  #profile-work-region .profile-work-menu summary::before{content:"";position:absolute;z-index:-1;inset:8px;border-radius:7px;background:rgba(18,18,20,.65)}
  #profile-work-region .portfolio-work.preview-active{transform:none}
  #profile-work-region .works-badge{max-width:calc(100% - 8px);font-size:9px}
}

/* Mobile profile information and controls; desktop and gallery cards stay unchanged. */
.profile-main-tabs,.profile-mobile-statistics,.profile-edit-mobile-label{display:none}
.profile-bio-wrap,.profile-identity-summary{display:contents}
@media(max-width:600px){
  .profile-cover{height:100px}
  .profile-cover .profile-cover-scrim{background:linear-gradient(180deg,rgba(0,0,0,.08),rgba(0,0,0,.14))}
  /* Real profile gutters; no negative offsets on the information groups. */
  .app-main:has(>.profile-cover){padding-inline:16px}
  .app-main>.profile-cover{margin-inline:-16px}
  .portfolio-head.profile-head-covered{display:grid;grid-template-columns:48px minmax(0,1fr) auto;align-items:center;align-content:start;gap:8px;min-height:0;height:auto;margin:0 0 8px;padding:8px 0 0}
  .profile-head-covered>.avatar-profile{grid-column:1;grid-row:1;width:48px;height:48px;font-size:20px}
  .profile-head-covered .portfolio-identity{display:contents}
  .profile-head-covered .profile-identity-summary{grid-column:2;grid-row:1;display:flex;flex-direction:column;justify-content:center;gap:2px;min-width:0}
  .profile-head-covered .portfolio-identity h1{min-width:0;margin:0;font-size:20px;font-weight:600;line-height:1.15;letter-spacing:-.025em}
  .profile-head-covered .profile-handle{min-width:0;display:flex;flex-wrap:wrap;gap:0 5px;margin:0;overflow:visible;white-space:normal;color:var(--muted);font-size:13px;font-weight:400;line-height:1.35}
  .profile-head-covered .profile-handle .profile-username,.profile-head-covered .profile-handle .profile-details{display:inline;margin:0;overflow-wrap:anywhere;color:inherit;font-weight:400}
  .profile-head-covered .profile-handle a{color:inherit;font-weight:400}
  .profile-head-covered .profile-details::before{content:none}
  .profile-head-covered .profile-bio-wrap{display:block;grid-column:1/-1;min-width:0}
  .profile-head-covered .profile-bio{max-width:none;margin:0;font-size:14px;font-weight:400;line-height:1.4;-webkit-line-clamp:2;white-space:pre-line}
  .profile-head-covered .profile-bio.is-expanded{display:block;overflow:visible;-webkit-line-clamp:unset}
  .profile-bio-toggle{min-width:44px;min-height:44px;margin:0;padding:0 8px 0 0;border:0;background:none;color:var(--text);font:inherit;font-size:13px;font-weight:500;cursor:pointer}
  .profile-head-covered .profile-public-stats{grid-column:1/-1;display:flex;flex-wrap:wrap;justify-content:flex-start;gap:0 16px;margin:0;font-size:13px;font-weight:400;line-height:1.3}
  .profile-head-covered .profile-public-stats>span,.profile-head-covered .profile-public-stats>a{display:inline-flex;min-width:max-content;min-height:44px;align-items:center;flex-wrap:nowrap;gap:4px;white-space:nowrap;word-break:normal;overflow-wrap:normal}
  .profile-head-covered .profile-public-stats strong{flex:none;margin:0;font-size:14px;font-weight:600;line-height:inherit}
  .profile-head-covered .profile-public-stats .profile-work-label{white-space:nowrap}
  .profile-head-covered .profile-public-stats>.profile-extra-stat{display:none}
  .portfolio-head.profile-head-covered>.portfolio-action{grid-column:3;grid-row:1;order:0;align-self:center;flex-basis:auto;min-width:0;flex-wrap:nowrap;margin:0;gap:4px}
  .profile-head-covered>.portfolio-action>.profile-owner-actions,.profile-head-covered>.portfolio-action>.follow-form{width:auto;flex-wrap:nowrap;align-items:center;gap:4px}
  .profile-head-covered>.portfolio-action .button{width:auto;min-width:56px;min-height:44px;padding:0 8px;font-size:13px;font-weight:500}
  .portfolio-head.profile-head-covered .profile-owner-actions>.profile-edit-button{position:relative;isolation:isolate;flex:none;width:auto;min-width:44px;height:44px;min-height:44px;padding:0 10px;border:0;border-radius:8px;background:none;box-shadow:none;color:var(--text);font-size:13px;font-weight:500}
  .profile-head-covered .profile-edit-button::before{content:"";position:absolute;z-index:-1;inset:6px 0;border:1px solid var(--line);border-radius:8px;background:var(--color-surface)}
  .profile-head-covered .profile-edit-button:hover::before{background:var(--color-surface-hover);border-color:var(--color-border-strong)}
  .profile-head-covered .profile-edit-desktop-label{display:none}.profile-head-covered .profile-edit-mobile-label{display:inline}
  .profile-head-covered .profile-actions-menu-trigger{width:44px;height:44px;min-width:44px;min-height:44px;border:0;background:transparent;border-radius:8px}
  .profile-head-covered .profile-actions-menu-trigger svg{width:20px;height:20px}
  .profile-head-covered>.profile-submit-hint{grid-column:1/-1;margin:0;font-size:13px}
  .profile-head-covered>.profile-submit-hint a{display:inline-flex;align-items:center;min-height:44px}
  .profile-mobile-statistics{display:flex;grid-column:1/-1;flex-wrap:wrap;align-items:center;gap:6px 16px;margin:0;padding:0;color:var(--muted);font-size:13px;font-weight:400}
  .profile-mobile-statistics>span,.profile-mobile-statistics>a{display:inline-flex;align-items:center;gap:4px;color:inherit;white-space:nowrap;word-break:normal;overflow-wrap:normal}
  .profile-mobile-statistics>a{min-width:44px;min-height:44px}
  .profile-mobile-statistics strong{color:var(--text);font-size:14px;font-weight:600}
  .profile-head-covered+.profile-tabs{display:none}
  .profile-main-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:2px;margin:0;padding:3px;border:1px solid var(--line);border-radius:11px;background:var(--soft)}
  .profile-main-tabs>a{display:flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:0 4px;border-radius:8px;color:var(--muted);font-size:14px;font-weight:400}
  .profile-main-tabs>a.active{background:var(--color-surface);box-shadow:0 1px 4px rgba(0,0,0,.1);color:var(--text);font-weight:600}
  .profile-mobile-view-control{position:relative;display:flex;min-height:48px;align-items:center;gap:8px;justify-content:flex-start;flex-wrap:nowrap;padding:0;margin:0 0 8px;font-size:14px;color:var(--muted)}
  #profile-mobile-view{display:none}
  .profile-collection-control{position:relative;min-width:0;max-width:calc(100% - 52px);flex:0 1 auto;z-index:10}
  .profile-mobile-view-control #profile-work-collection{min-width:44px;max-width:100%;height:44px;min-height:44px;padding:0 30px 0 10px;border:1px solid var(--line);border-radius:10px;background-color:var(--soft);color:var(--text);font:inherit;font-size:14px;font-weight:500;line-height:1.4;cursor:pointer;appearance:none;-webkit-appearance:none;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='m3 5 4 4 4-4' fill='none' stroke='%239a99a5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-size:14px 14px;background-position:right 8px center;background-repeat:no-repeat}
  #profile-work-collection option{background:var(--color-surface);color:var(--text)}
  .profile-collection-menu>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:44px;min-height:44px;padding:0 10px;border:1px solid var(--line);border-radius:10px;background:var(--soft);color:var(--text);font-size:14px;font-weight:500;list-style:none;cursor:pointer}
  .profile-collection-menu>summary::-webkit-details-marker{display:none}
  .profile-collection-menu>summary>span{min-width:0;overflow-wrap:anywhere}
  .profile-collection-menu>summary svg{width:14px;height:14px;flex:none;stroke:currentColor}
  .profile-collection-menu[open]>summary{border-color:var(--color-border-strong);background:var(--color-surface-hover)}
  .profile-collection-options{position:absolute;left:0;top:48px;min-width:100%;width:max-content;max-width:calc(100vw - 32px);padding:4px;border:1px solid var(--line);border-radius:11px;background:var(--color-surface);box-shadow:var(--shadow-popover)}
  .profile-collection-options>a{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:44px;padding:0 10px;border-radius:7px;color:var(--text);font-size:14px;font-weight:400}
  .profile-collection-options>a[aria-current="page"]{background:var(--soft);font-weight:500}
  .profile-collection-options .profile-collection-check{color:var(--accent)}
  .profile-view-menu{position:relative;flex:none;margin-left:auto;z-index:9}
  .profile-view-menu>summary{width:44px;height:44px;display:grid;place-items:center;list-style:none;border-radius:8px;cursor:pointer;color:var(--text)}
  .profile-view-menu>summary::-webkit-details-marker{display:none}
  .profile-view-menu>summary svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.6}
  .profile-view-menu[open]>summary{background:var(--soft)}
  .profile-view-menu>div{position:absolute;right:0;top:44px;width:152px;padding:4px;border:1px solid var(--line);border-radius:11px;background:var(--color-surface);box-shadow:var(--shadow-popover)}
  .profile-view-menu button{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:44px;padding:0 10px;border:0;border-radius:7px;background:transparent;color:var(--text);font:inherit;font-size:13px;text-align:left;cursor:pointer}
  .profile-view-menu button[aria-pressed="true"]{background:var(--soft);font-weight:500}.profile-view-menu button[aria-pressed="true"]::after{content:"✓";color:var(--accent)}
  .profile-view-status{position:absolute;right:48px;bottom:0;max-width:60%;padding:0 3px;background:var(--bg);font-size:10px;pointer-events:none}
  .profile-view-retry{position:absolute;right:44px;min-width:44px;min-height:44px;border:0;background:var(--color-surface);color:var(--text);font-size:13px;cursor:pointer}
  .profile-collection-menu summary:focus-visible,.profile-collection-options a:focus-visible,.profile-main-tabs a:focus-visible,.profile-view-menu summary:focus-visible,.profile-view-menu button:focus-visible,.profile-bio-toggle:focus-visible,#profile-work-collection:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
}
