/* Final touch and project stability pass. Kept separate from historical visual
   layers so the mobile shell has one unambiguous final authority. */

@media (max-width: 760px) {
  #mobileApp .m-settings-sheet,
  #mobileApp .m-settings-sheet-card,
  #mobileApp .m-sheet-drag-region {
    touch-action: none !important;
  }

  #mobileApp .m-settings-sheet-card[data-dragging="true"] {
    user-select: none;
    will-change: transform, opacity;
  }

  #mobileProjectsList .m-project[data-status="queued"] .m-project-placeholder,
  #mobileProjectsList .m-project[data-status="running"] .m-project-placeholder,
  #mobileProjectsList .m-project[data-status="waiting"] .m-project-placeholder {
    background: linear-gradient(110deg, #edf1ff 8%, #dfe8ff 38%, #edf1ff 68%);
    background-size: 220% 100%;
    animation: v-project-skeleton 1.3s linear infinite;
  }

  #mobileProjectsList .m-project[data-status="failed"] .m-project-placeholder {
    background: #fff0f2;
    color: #d92d45;
  }

  #mobileProjectsList.is-grid .m-project[data-status="queued"],
  #mobileProjectsList.is-grid .m-project[data-status="running"],
  #mobileProjectsList.is-grid .m-project[data-status="waiting"] {
    background: #fbfcff;
  }

  #mobileProjectsList .m-project-error { color: #c7273e !important; }

  @keyframes v-project-skeleton {
    to { background-position: -220% 0; }
  }

  #mobileProfileContent.is-editing .m-profile-hero {
    margin-bottom: 0 !important;
    transform: none !important;
    filter: none !important;
  }

  #mobileProfileContent.is-editing .m-profile-cover,
  #mobileProfileContent.is-editing .m-profile-main,
  #mobileProfileContent.is-editing .m-profile-avatar,
  #mobileProfileContent.is-editing .m-profile-main h2,
  #mobileProfileContent.is-editing .m-profile-main p {
    transform: none !important;
    transition: none !important;
  }

  #mobileProfileContent.is-editing .m-profile-data {
    position: relative;
    z-index: 2;
  }

  /* The viewer is an image-first canvas: dots and actions stay near the
     artwork instead of being pinned to the bottom of a tall mobile dialog. */
  #projectViewer .project-viewer-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    min-height: 100dvh !important;
  }

  #projectViewer .project-viewer-media {
    flex: 0 0 auto !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 14px !important;
    overflow: visible !important;
  }

  #projectViewer .project-viewer-dots {
    position: static !important;
    order: 2;
    margin: 12px auto 0 !important;
    transform: none !important;
  }

  #projectViewer .project-viewer-actions {
    position: static !important;
    width: max-content !important;
    max-width: calc(100vw - 28px) !important;
    margin: 2px auto 0 !important;
    transform: none !important;
  }
}

@media (min-width: 761px) {
  @keyframes v-project-skeleton {
    to { background-position: -220% 0; }
  }

  @keyframes v-project-spin {
    to { transform: rotate(360deg); }
  }

  #projectsModal .project-preview.is-loading {
    background: linear-gradient(112deg, #f4f6fc 5%, #e7edff 45%, #f4f6fc 85%) !important;
    background-size: 220% 100% !important;
    animation: v-project-skeleton 1.35s linear infinite;
  }

  #projectsModal .project-preview.is-error { background: #fff0f2 !important; color: #c7273e; }

  #projectsModal .project-preview-loader {
    display: grid;
    place-items: center;
    gap: 8px;
    color: var(--v-blue);
  }

  #projectsModal .project-preview-loader i {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(6, 93, 253, .22);
    border-top-color: var(--v-blue);
    border-radius: 50%;
    animation: v-project-spin 900ms linear infinite;
  }
}
