/* Mobile totality pass — keeps recent desktop fixes working at scale on phones/tablets */
@media (max-width: 767px){
  :root{--thream-mobile-gutter:12px;--thream-mobile-radius:18px}
  html,body,#root{max-width:100%;overflow-x:hidden}
  body{background:#f6f8fb!important}
  button,a,input,select,textarea{max-width:100%}
  button,a{touch-action:manipulation}
  input,select,textarea{font-size:16px!important}

  /* Intention/Campus page: dense single-column mobile layout */
  [data-intention-v4-page]{width:100%!important;max-width:none!important;padding:8px var(--thream-mobile-gutter) 92px!important;margin:0!important}
  [data-intention-v4-hero]{border-radius:20px!important;overflow:hidden!important;margin:0 0 10px!important;box-shadow:0 8px 24px rgba(15,23,42,.06)!important}
  [data-intention-v4-hero] h1{font-size:24px!important;line-height:1.08!important}
  [data-intention-v4-hero] p{font-size:13px!important;line-height:1.5!important}
  [data-intention-v4-stories]{padding:10px!important;border-radius:18px!important;margin:0 0 10px!important;overflow:hidden!important}
  [data-intention-v4-composer]{padding:10px!important;border-radius:18px!important;margin-bottom:10px!important}
  [data-intention-v4-composer] > button:first-child{min-height:46px!important;width:100%!important}
  [data-intention-v4-composer] > button:first-child span{padding:10px 12px!important;border-radius:14px!important;font-size:13px!important;text-align:left!important}
  [data-intention-v4-composer] > div:last-child{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important;margin-top:8px!important}
  [data-intention-v4-composer] > div:last-child button{min-width:0!important;padding:8px 5px!important;border-radius:12px!important;font-size:10px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  [data-intention-v4-feedgrid]{display:block!important}
  [data-intention-v4-feedgrid] aside{display:none!important}
  [data-intention-v4-page] article{border-radius:18px!important;margin-bottom:10px!important;overflow:hidden!important}

  /* Intention / Spotlight switch never blocks content on mobile */
  .thream-view-switch-wrap{position:fixed!important;left:50%!important;right:auto!important;top:auto!important;bottom:calc(72px + env(safe-area-inset-bottom))!important;transform:translateX(-50%)!important;z-index:80!important;width:auto!important;margin:0!important;pointer-events:none!important}
  .thream-view-switch{pointer-events:auto!important;box-shadow:0 10px 28px rgba(15,23,42,.18)!important}

  /* Stories strip — actual media, round previews, horizontal scrolling */
  .thream-story-strip{overflow:hidden!important;padding:10px 8px!important}
  .thream-story-row{display:flex!important;gap:12px!important;overflow-x:auto!important;overflow-y:hidden!important;scroll-snap-type:x proximity!important;-webkit-overflow-scrolling:touch!important;padding:2px!important;scrollbar-width:none!important}
  .thream-story-row::-webkit-scrollbar{display:none!important}
  .thream-story-bubble{flex:0 0 72px!important;min-width:72px!important;max-width:72px!important;scroll-snap-align:start!important;overflow:visible!important}
  .thream-story-bubble [class*='rounded-full'],.thream-story-media-wrap{width:64px!important;height:64px!important;min-width:64px!important;min-height:64px!important;aspect-ratio:1/1!important;border-radius:50%!important;overflow:hidden!important}
  .thream-story-media-thumb,.thream-story-bubble img,.thream-story-bubble video{width:100%!important;height:100%!important;aspect-ratio:1/1!important;object-fit:cover!important;border-radius:50%!important}

  /* Story composer: full-width bottom sheet, all controls reachable */
  .thream-story-overlay{padding:0!important;align-items:flex-end!important;overflow:hidden!important}
  .thream-story-composer{width:100%!important;max-width:none!important;max-height:96dvh!important;border-radius:26px 26px 0 0!important;padding:14px!important;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch!important}
  .thream-story-header{position:sticky!important;top:-14px!important;z-index:30!important;grid-template-columns:44px 1fr auto!important;gap:8px!important;padding:10px 0!important;background:rgba(255,255,255,.97)!important;backdrop-filter:blur(14px)!important}
  .thream-story-close{width:42px!important;height:42px!important}
  .thream-story-title-group strong{font-size:17px!important}.thream-story-title-group span{font-size:10px!important}
  .thream-story-share{height:42px!important;min-width:auto!important;padding:0 14px!important;border-radius:13px!important;font-size:12px!important}
  .thream-story-body{display:flex!important;flex-direction:column!important;gap:10px!important;margin-top:8px!important}
  .thream-story-left,.thream-story-right{padding:10px!important;border-radius:16px!important}
  .thream-story-upload{height:230px!important;min-height:230px!important;border-radius:16px!important;padding:16px!important}
  .thream-story-preview{width:100%!important;height:100%!important;object-fit:contain!important;background:#07101f!important}
  .thream-story-caption{height:110px!important;min-height:110px!important;padding:14px!important;border-radius:14px!important;font-size:16px!important}
  .thream-story-tools{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important}
  .thream-story-tool{min-width:0!important;min-height:44px!important;padding:0 10px!important;border-radius:12px!important;font-size:11px!important}
  .thream-story-tool-audience{grid-column:1/-1!important}
  .thream-story-popover{max-width:calc(100vw - 24px)!important;left:12px!important;right:12px!important;width:auto!important;z-index:10050!important}

  /* Full-screen story viewer; swipe/next/previous controls remain usable */
  .thream-story-viewer-live,.thream-story-viewer{padding:0!important;z-index:10040!important;background:#020817!important}
  .thream-story-viewer-shell{width:100%!important;height:100dvh!important;max-width:none!important;max-height:none!important;border-radius:0!important}
  .thream-story-viewer-media{width:100%!important;height:100dvh!important;max-height:none!important;object-fit:contain!important;border-radius:0!important;background:#020817!important}
  .thream-story-viewer-top{padding:calc(14px + env(safe-area-inset-top)) 14px 10px!important}
  .thream-story-viewer-bottom{padding:10px 14px calc(18px + env(safe-area-inset-bottom))!important}

  /* Create post: true mobile form, no desktop whitespace */
  .thream-cp-overlay{padding:0!important;align-items:stretch!important;background:#fff!important;backdrop-filter:none!important}
  .thream-cp-modal{width:100%!important;height:var(--thream-vvh,100dvh)!important;max-width:none!important;max-height:var(--thream-vvh,100dvh)!important;border:0!important;border-radius:0!important;padding:0 12px calc(86px + env(safe-area-inset-bottom))!important;background:#f7f9fc!important;overflow-y:auto!important;overflow-x:hidden!important;display:block!important;box-shadow:none!important}
  .thream-cp-header{position:sticky!important;top:0!important;z-index:50!important;margin:0 -12px 10px!important;padding:8px 12px!important;min-height:62px!important;grid-template-columns:40px 1fr auto!important;background:rgba(255,255,255,.98)!important;backdrop-filter:blur(14px)!important}
  .thream-cp-header>strong{font-size:16px!important;text-align:center!important}
  .thream-cp-header>button:first-child{width:38px!important;height:38px!important;border-radius:12px!important}
  .thream-cp-header>button:last-child{height:38px!important;min-height:38px!important;min-width:76px!important;padding:0 13px!important;border-radius:12px!important;font-size:11px!important}
  .thream-cp-types{width:100%!important;max-width:none!important;margin:0 0 8px!important;overflow-x:auto!important;white-space:nowrap!important}
  .thream-cp-intentions{display:flex!important;gap:7px!important;overflow-x:auto!important;padding:26px 1px 3px!important;margin:8px 0 10px!important;scrollbar-width:none!important}
  .thream-cp-intentions>button{flex:0 0 106px!important;min-width:106px!important;min-height:46px!important;padding:8px!important;font-size:10px!important;border-radius:12px!important;text-align:center!important}
  .thream-cp-title,.thream-cp-body,.thream-cp-tags,.thream-cp-conditional{margin-bottom:8px!important}
  .thream-cp-body textarea{min-height:130px!important;max-height:220px!important;padding:14px!important;border-radius:14px!important}
  .thream-cp-title input,.thream-cp-tags input,.thream-cp-conditional input{min-height:44px!important;border-radius:12px!important}
  .thream-cp-right{display:flex!important;flex-direction:column!important;gap:8px!important;margin:8px 0 0!important;padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important}
  .thream-cp-audience,.thream-cp-media,.thream-cp-options,.thream-live-media-preview,.thream-live-media-picker-compact{width:100%!important;margin:0!important;border-radius:14px!important}
  .thream-cp-media button:has(svg[class*='lucide-image']){min-height:94px!important}
  .thream-live-media-stage{min-height:96px!important}.thream-live-media-stage img,.thream-live-media-stage video{max-height:210px!important;object-fit:contain!important}

  /* Shared files/media in messages always fit and remain actionable */
  .thream-shared-image{max-width:100%!important;height:auto!important;border-radius:14px!important}
  .thream-file-actions{display:flex!important;gap:6px!important;flex-wrap:wrap!important}
  .thream-file-actions a,.thream-file-actions button{min-height:36px!important;padding:0 11px!important;font-size:10px!important}
  .thream-media-lightbox{padding:0!important}.thream-media-lightbox img,.thream-media-lightbox video{max-width:100vw!important;max-height:100dvh!important;border-radius:0!important}
  .thream-media-lightbox .thream-media-toolbar{top:calc(10px + env(safe-area-inset-top))!important;right:10px!important}

  /* Modals/dropdowns/profile cards never hide behind fixed nav */
  [role='dialog'],[class*='popover'],[class*='dropdown'],[class*='menu']{max-width:calc(100vw - 16px)}
}

/* Tablet parity: recent features should not fall back to desktop-only widths */
@media (min-width:768px) and (max-width:1100px){
  [data-intention-v4-page]{padding-left:16px!important;padding-right:16px!important}
  [data-intention-v4-feedgrid]{grid-template-columns:minmax(0,1fr) 260px!important;gap:14px!important}
  .thream-cp-modal{width:min(880px,calc(100vw - 24px))!important}
  .thream-story-composer{width:min(940px,calc(100vw - 28px))!important}
}
