/* Mobile sheet responsiveness and cross-shell project refresh. */
@media (max-width: 760px) {
  #mobileSettingsSheet .m-sheet-drag-region,
  #mobileSettingsSheet .m-sheet-grabber,
  #mobileSettingsSheet .m-settings-sheet-card > header {
    touch-action: none !important;
    -webkit-user-select: none;
    user-select: none;
  }

  #mobileSettingsSheet .m-sheet-drag-region {
    min-height: 104px;
    margin: -10px calc(var(--m-edge) * -1) 0;
    padding: 10px var(--m-edge) 10px;
    cursor: grab;
  }

  #mobileSettingsSheet .m-settings-sheet-card > header,
  #mobileSettingsSheet .m-sheet-drag-region header {
    cursor: grab;
  }

  #mobileSettingsSheet .m-settings-sheet-card[data-dragging="true"] .m-sheet-drag-region,
  #mobileSettingsSheet .m-settings-sheet-card[data-dragging="true"] .m-sheet-drag-region header,
  #mobileSettingsSheet .m-settings-sheet-card[data-dragging="true"] .m-sheet-grabber {
    cursor: grabbing;
  }
}

/* Mobile polish: the sheet header is a real drag handle and notifications live
   above every modal instead of being trapped inside blurred dialog content. */
@media (max-width: 760px) {
  #mobileSettingsSheet .m-settings-sheet-card {
    touch-action: auto;
    overscroll-behavior: contain;
  }

  #mobileSettingsSheet .m-sheet-drag-region {
    position: relative;
    z-index: 2;
    min-height: 110px;
    touch-action: none !important;
  }

  #mobileSettingsSheet .m-sheet-drag-region > header {
    margin: 0;
    min-height: 62px;
    touch-action: none !important;
  }

  #mobileSettingsSheet .m-settings-options {
    position: relative;
    z-index: 1;
    touch-action: pan-y;
  }

  .m-mode-pill.is-active small {
    background: rgba(255,255,255,.22);
    color: #fff;
  }

  #toast {
    position: fixed;
    z-index: 1200;
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    max-width: none;
    min-height: 58px;
    padding: calc(13px + env(safe-area-inset-top)) 20px 15px;
    border-radius: 0 0 22px 22px;
    transform: translateY(-10px);
    clip-path: inset(0 0 100% 0 round 0 0 22px 22px);
    opacity: 0;
    box-shadow: 0 14px 36px rgba(6,93,253,.28);
    transition: clip-path 320ms cubic-bezier(.22,1,.36,1), transform 320ms cubic-bezier(.22,1,.36,1), opacity 180ms ease;
  }

  #toast.visible {
    transform: translateY(0);
    clip-path: inset(0 0 0 0 round 0 0 22px 22px);
    opacity: 1;
  }

  #mobileProfilePage .m-page-heading { margin-bottom: 8px; }
  #mobileProfileEditButton { width: 34px; height: 34px; }

  #mobileProfileContent.is-editing .m-profile-hero {
    opacity: 1;
    filter: none;
    height: auto;
    min-height: 0;
    overflow: hidden !important;
    border-radius: 24px;
    transition: none !important;
  }

  #mobileProfileContent.is-editing .m-profile-cover {
    position: static;
    inset: auto;
    height: 118px;
    border-radius: 0;
    transition: none !important;
  }

  #mobileProfileContent.is-editing .m-profile-main {
    display: block;
    min-height: 130px;
    height: auto;
    padding: 0 16px 16px;
    background: var(--m-tile);
    transition: none !important;
  }

  #mobileProfileContent.is-editing .m-profile-avatar {
    display: block;
    width: 78px;
    height: 78px;
    margin-top: -38px;
    border-width: 4px;
    transition: none !important;
  }

  #mobileProfileContent.is-editing .m-profile-main h2 {
    margin: 13px 0 0;
    color: var(--m-ink);
    font-size: 22px;
  }

  #mobileProfileContent.is-editing .m-profile-main p {
    margin: 4px 0 0;
    color: var(--m-muted);
  }

  #mobileProfileContent.is-editing .m-profile-stats {
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    opacity: 0;
    border-top-color: transparent;
    transition: max-height 240ms ease, margin 240ms ease, opacity 160ms ease;
  }

  #mobileProfileContent.is-editing .m-profile-data { margin-top: 22px; }

  .m-achievement-popover { display: none !important; }
}
