/* The marker is set only when state.tool === scene; tool16 shares the legacy class. */
.ai-page .qh-scene-prompt-step[data-qh-scene15="v2"] {
  grid-template-areas: "title title" "upload upload" "references references" "label ." "input generate" "cost ." "notice notice" "result result" !important;
}
.ai-page .qh-scene-prompt-step[data-qh-scene15="v2"] > .live-task-notice {
  grid-area: notice !important; grid-column: 1 / -1 !important;
  box-sizing: border-box; min-width: 0; width: 100%; max-width: 100%; margin: 8px 0 0;
}
.ai-page .qh-scene-prompt-step[data-qh-scene15="v2"] > .live-result {
  grid-area: result !important; grid-column: 1 / -1 !important;
  box-sizing: border-box; min-width: 0; width: 100%; max-width: 100%;
  overflow-wrap: anywhere; word-break: break-word;
}
.ai-page .qh-scene-prompt-step[data-qh-scene15="v2"] .live-result pre,
.ai-page .qh-scene-prompt-step[data-qh-scene15="v2"] .live-result p {
  white-space: pre-wrap; max-width: 100%; overflow-wrap: anywhere;
}
.ai-page .qh-scene-prompt-step[data-qh-scene15="v2"] .live-result > .secondary-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; min-height: 40px; padding: 10px 18px;
  color: #123e71 !important; background: #eaf3ff !important;
  border: 1px solid #a6bdd8 !important; border-radius: 8px;
  opacity: 1; font-weight: 600; cursor: pointer;
}
.ai-page .qh-scene-prompt-step[data-qh-scene15="v2"] .live-result > .secondary-button:hover {
  background: #dceaff !important;
}
@media (max-width:700px) {
  .ai-page .qh-scene-prompt-step[data-qh-scene15="v2"] {
    grid-template-columns: minmax(0,1fr) !important;
    grid-template-areas: "title" "upload" "references" "label" "input" "generate" "cost" "notice" "result" !important;
  }
}

/* Scene 15-only gallery and @ picker, shared by its two marked scopes. */
.ai-page [data-qh-scene15="v2"] > .qh-scene15-references {
  grid-area: references !important; grid-column: 1 / -1 !important;
  min-width: 0; max-width: 100%; padding: 0; margin: 0; box-sizing: border-box;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-references [hidden],
.ai-page [data-qh-scene15="v2"] .qh-scene15-references[hidden] { display: none !important; }
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-heading {
  color: #425971; font-size: 13px; line-height: 1.6; margin-bottom: 8px;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-list {
  display: flex; flex-wrap: wrap; align-items: start; gap: 10px;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-card {
  position: relative; flex: 0 0 112px; width: 112px; min-width: 0; box-sizing: border-box;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-references button {
  box-sizing: border-box; text-shadow: none; box-shadow: none; transform: none;
  color: #183e67 !important; background: #f2f7fe !important; border: 1px solid #bfd3e8 !important;
  font-size: 12px; cursor: pointer; opacity: 1;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-references button:focus-visible {
  outline: 2px solid #2580db; outline-offset: 2px;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-choose {
  display: flex; flex-direction: column; align-items: stretch; width: 112px; padding: 5px; border-radius: 10px;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-thumb {
  display: block; width: 100px !important; height: 76px !important; min-height: 0;
  object-fit: contain !important; border-radius: 6px; background: #e6eef8;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-token { margin-top: 5px; font-size: 13px; }
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-name {
  display: block; width: 100%; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.5;
}
.ai-page [data-qh-scene15="v2"] button.qh-scene15-ref-remove {
  position: absolute; top: -5px; right: -5px; width: 26px; height: 26px; min-height: 0;
  display: grid; place-items: center; padding: 0; border-radius: 50%; line-height: 1; font-size: 18px;
  color: #723442 !important; background: #fff !important;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-doc-icon {
  display: grid; place-items: center; min-height: 76px; color: #476487; background: #e6eef8; border-radius: 6px;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-message,
.ai-page [data-qh-scene15="v2"] .qh-scene15-menu-empty {
  margin: 8px 0 0; color: #47617a; font-size: 12px; line-height: 1.6;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-menu {
  display: flex; flex-direction: column; gap: 4px; margin: 8px 0 0; padding: 8px;
  max-height: 230px; overflow-y: auto; border: 1px solid #9dbfe4; border-radius: 10px; background: #fff;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-option {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 9px; min-width: 0; min-height: 44px; border-radius: 7px; text-align: left;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-option[aria-selected="true"] { background: #dcecff !important; border-color: #4288d0 !important; }
.ai-page [data-qh-scene15="v2"] .qh-scene15-menu-thumb,
.ai-page [data-qh-scene15="v2"] .qh-scene15-ref-option .qh-scene15-doc-icon {
  display: block; flex: 0 0 36px; width: 36px !important; height: 30px !important; min-height: 0; object-fit: contain !important; border-radius: 4px;
}
.ai-page [data-qh-scene15="v2"] .qh-scene15-option-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lower image references are a normal full-width row, not the upper prompt grid area. */
.ai-page .qh-scene-image-step[data-qh-scene15="v2"] > .qh-scene15-references {
  grid-area: auto !important; grid-column: 1 / -1 !important; width: 100%; margin: 12px 0;
}
