.nd-mobile-result { display: none; }
.nd-mobile-result-dialog:not([open]) { display: none !important; }

/* Phone only: prompt and submit precede result and history, including DOM order. */
@media (max-width: 719px) {
  html body.studio-shell[data-page="create"] .gen-main.nd-mobile-results-ready {
    display: flex !important;
    flex-direction: column;
    height: auto !important;
    min-height: 0 !important;
    gap: .625rem;
    padding: .625rem;
    overflow: visible;
  }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready > .gen-composer-wrap {
    order: 0; flex: 0 0 auto; width: 100%; max-height: none; overflow: visible; padding: 0;
  }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready > .gen-feed {
    order: 1; flex: 0 0 auto; min-height: 0 !important; height: auto !important;
    overflow: visible; container-type: normal;
  }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready > .gen-history-rail { order: 2; }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready .gen-feed > #gen-selected { display: none !important; }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready #generate {
    padding: .75rem; margin: 0; border-radius: 1rem;
  }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready .nd-ref-paste-hint { display: none; }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready .nd-ref-actions::before {
    content: 'Референсы'; font-size: .8125rem; color: var(--muted); font-weight: 600;
  }
  html[lang="en"] body.studio-shell[data-page="create"] .nd-mobile-results-ready .nd-ref-actions::before { content: 'References'; }
  html[lang="es"] body.studio-shell[data-page="create"] .nd-mobile-results-ready .nd-ref-actions::before { content: 'Referencias'; }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready .nd-ref-actions { padding-top: 0; }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready .nd-ref-add { min-height: 44px; }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready .gen-composer-wrap .nd-mention-editor {
    min-height: 7rem; height: clamp(7rem, 18dvh, 10rem); max-height: 12rem;
  }
  html body.studio-shell[data-page="create"] .nd-mobile-result {
    display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); align-items: center; gap: .5rem .75rem;
    padding: .75rem; background: var(--panel, #293430); border-radius: 1rem;
  }
  .nd-mobile-result-icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: .75rem; background: color-mix(in srgb, currentColor 7%, transparent); }
  .nd-mobile-result-icon svg { width: 1.5rem; height: 1.5rem; }
  .nd-mobile-result-info { display: grid; gap: .25rem; min-width: 0; }
  .nd-mobile-result-info strong { font-size: .9375rem; line-height: 1.3; }
  .nd-mobile-result-info > span { font-size: .75rem; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
  html body.studio-shell[data-page="create"] .nd-mobile-result > button {
    grid-column: 1 / -1; min-height: 44px; width: 100%; padding: .625rem .875rem;
    border-radius: .75rem; border: 0; background: color-mix(in srgb, var(--accent, #c9ff4f) 18%, transparent); color: inherit; font: inherit; font-weight: 650;
  }
  .nd-mobile-result > button[hidden] { display: none !important; }
  .nd-mobile-result[data-state="failed"] .nd-mobile-result-icon { color: #e17063; }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready #gen-history-status:empty { display: none; }
  html body.studio-shell[data-page="create"] .nd-mobile-results-ready #gen-submit-feedback { margin: 0 0 .5rem; padding: .625rem .75rem; }
  .nd-mobile-results-ready #gen-submit-feedback small { display: none; }

  html.nd-result-view-open { overflow: hidden; }
  html.nd-result-view-open body { overflow: hidden !important; }
  html body.studio-shell .nd-mobile-result-dialog[open] {
    display: flex; flex-direction: column; position: fixed;
    inset: 0; margin: auto; padding: 0; width: 100%; max-width: 100%;
    height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0;
    color: var(--text, #f1f3ec); background: var(--bg, #18201d); overflow: hidden;
  }
  .nd-mobile-result-dialog::backdrop { background: #000b; }
  .nd-mobile-result-header {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    flex: 0 0 auto; padding: max(.625rem, env(safe-area-inset-top)) .75rem .625rem;
    border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  }
  .nd-mobile-result-header h2 { font-family: inherit; font-size: 1rem; font-weight: 650; line-height: 1.3; margin: 0; }
  .nd-mobile-result-header button {
    display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border: 0;
    border-radius: .75rem; background: color-mix(in srgb, currentColor 8%, transparent); color: inherit; font-size: 1.75rem;
  }
  .nd-mobile-result-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: .75rem .75rem max(.75rem, env(safe-area-inset-bottom)); }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog #gen-selected { display: block !important; height: auto !important; min-height: 0 !important; }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog .gen-selected-content { display: block; }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog .gen-player-stage {
    width: 100%; height: auto !important; min-height: 0 !important; aspect-ratio: auto !important; overflow: hidden;
  }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog .gen-player-stage :is(video,img) {
    position: static !important; display: block; width: 100% !important; height: auto !important; max-height: 58dvh !important; object-fit: contain;
  }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog .gen-context-tags { position: static !important; margin-bottom: .5rem; flex-wrap: wrap; }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog .gen-context-tags span { font-size: .75rem; }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog .gen-selected-head { gap: .375rem; flex-wrap: wrap; margin-bottom: .75rem; }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog .gen-selected-date { font-size: .75rem; }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog .gen-result-actions { margin-top: .625rem; }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog .gen-context { margin-top: .75rem; }
  html body.studio-shell[data-page="create"] .nd-mobile-result-dialog .gen-context summary { min-height: 44px; }
}
