/**
 * Launch Intelligence — mobile workflow (Phase 3).
 * Loaded after launch-intelligence.css. Desktop unchanged above 768px.
 */

@media (max-width: 768px) {
  /* ── Reduce duplicate chrome (topbar already shows step context) ── */
  #page-launch > .page-head {
    display: none;
  }

  #page-launch .li-step {
    padding: 16px 14px calc(96px + env(safe-area-inset-bottom, 0px));
    border-radius: 14px;
  }

  /* ── Stepper: horizontal scroll + edge fade ── */
  #page-launch .li-stepper-wrap {
    position: relative;
    margin-bottom: 10px;
  }

  #page-launch .li-stepper-wrap::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 32px;
    background: linear-gradient(90deg, transparent, var(--bg-2, #0e0e14));
    pointer-events: none;
    border-radius: 0 12px 12px 0;
  }

  html.light #page-launch .li-stepper-wrap::after {
    background: linear-gradient(90deg, transparent, var(--bg-2, #f6f3fc));
  }

  #page-launch .li-stepper {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    padding-bottom: 6px;
  }

  #page-launch .li-node {
    flex: 0 0 auto;
    min-width: 96px;
    scroll-snap-align: start;
    min-height: 44px;
  }

  #page-launch .li-node b {
    font-size: 10px;
  }

  #page-launch .li-node small {
    font-size: 9px;
  }

  /* ── Forms: prevent iOS zoom + full width ── */
  #page-launch .glass-field,
  #page-launch .glass-textarea,
  #page-launch .glass-select,
  #page-launch input.glass-field,
  #page-launch select.glass-select {
    font-size: 16px;
    max-width: 100%;
  }

  #page-launch .li-field-stack,
  #page-launch .li-action-row,
  #page-launch .li-trait-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #page-launch .li-action-row .ghost,
  #page-launch .li-action-row .primary,
  #page-launch .li-action-row .outline,
  #page-launch .li-trait-actions .ghost,
  #page-launch .li-trait-actions .primary {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  /* ── Hero / identity layout ── */
  #page-launch .li-step[data-li-step="0"] .li-collect,
  #page-launch .li-step[data-li-step="5"] .li-collect {
    grid-template-columns: 1fr;
    text-align: center;
  }

  #page-launch .li-step[data-li-step="0"] .li-cover,
  #page-launch .li-step[data-li-step="5"] .li-cover {
    width: min(100%, 200px);
    height: auto;
    aspect-ratio: 1;
    margin: 0 auto;
  }

  #page-launch .li-ring {
    width: 100px;
    height: 100px;
  }

  #page-launch .li-step-band--hero .li-score-panel .li-ring {
    width: 108px;
    height: 108px;
  }

  #page-launch .li-step-shell > .li-mix {
    grid-template-columns: 1fr;
  }

  #page-launch .li-step-shell > .li-mix > .li-card {
    border-right: none;
  }

  #page-launch .li-step-shell > .li-mix > .li-card.li-mix-preview {
    grid-column: 1;
    padding-top: var(--li-space-md);
    border-top: 1px solid var(--li-divider);
  }

  #page-launch .li-mix-preview .li-preview {
    min-height: 180px;
  }

  #page-launch .li-step-shell > .li-review-grid {
    grid-template-columns: 1fr;
  }

  #page-launch .li-metadata-overview {
    grid-template-columns: 1fr;
    gap: var(--li-space-md);
  }

  #page-launch .li-metadata-overview__ring {
    justify-self: center;
  }

  /* ── Sticky workflow footer ── */
  #page-launch .li-foot {
    position: sticky;
    bottom: 0;
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin: var(--li-space-md) -14px -16px;
    margin-bottom: calc(-16px - env(safe-area-inset-bottom, 0px));
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    border: none;
    border-top: 1px solid var(--glass-canvas-border, rgba(139, 92, 246, 0.18));
    border-radius: 0;
    background: var(--glass-canvas-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.22);
  }

  html.light #page-launch .li-foot {
    box-shadow: 0 -10px 28px rgba(91, 33, 182, 0.1);
  }

  #page-launch .li-foot .li-tip-row,
  #page-launch .li-foot .li-tip {
    display: none;
  }

  #page-launch .li-foot-start {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #page-launch .li-foot-start .li-tip-row {
    display: none;
  }

  #page-launch .li-foot-start .ghost {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  #page-launch .li-foot [data-li-back] {
    order: 1;
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  #page-launch .li-foot [data-li-continue],
  #page-launch .li-foot [data-li-deploy],
  #page-launch .li-foot .li-foot-cta .primary {
    order: 2;
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 14px;
  }

  #page-launch .li-foot--deploy .li-deploy-status-line {
    order: 0;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    text-align: center;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.22);
  }

  #page-launch .li-foot--deploy .li-foot-cta {
    order: 3;
    width: 100%;
  }

  #page-launch .li-foot--deploy [data-li-back] {
    order: 2;
  }

  #page-launch .li-foot-more {
    order: 1;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.04);
    padding: 0 10px;
  }

  #page-launch .li-foot-more summary {
    list-style: none;
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--purple-2);
    user-select: none;
  }

  #page-launch .li-foot-more summary::-webkit-details-marker {
    display: none;
  }

  #page-launch .li-foot-more-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 10px;
  }

  #page-launch .li-foot-more .li-tip-row {
    display: flex;
    font-size: 12px;
    line-height: 1.45;
  }

  #page-launch .li-foot-more .ghost {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  #page-launch .li-step[data-li-step="5"] .li-foot .li-actions {
    flex-direction: column;
    width: 100%;
  }

  /* ── Modals ── */
  .overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .overlay .modal {
    width: min(100vw - 24px, 100%) !important;
    max-width: min(100vw - 24px, 100%) !important;
    max-height: min(90dvh, 720px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 auto;
  }

  #create-modal .modal {
    max-width: min(100vw - 24px, 100%) !important;
  }

  .modal-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal-actions .primary,
  .modal-actions .ghost,
  .modal-actions button {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  #page-launch .li-stepper {
    scroll-snap-type: none;
  }
}
