/* Extend only the original 05 card. Its header, form, history and theme stay intact. */
#qh-video05-integrated{--q05-bg:#fff;--q05-text:#192d46;--q05-muted:#65758a;--q05-line:#dce5f0;--q05-soft:#f5f8fc;--q05-blue:#205ccc;min-width:0;max-width:100%;box-sizing:border-box}
#qh-video05-integrated [hidden],#qh-video05-integrated [data-q05-legacy-bridge]{display:none!important}
#qh-video05-integrated [class^="q05-"],#qh-video05-integrated [class^="q05-"] *{box-sizing:border-box}
#qh-video05-integrated .q05-material-tools,#qh-video05-integrated .q05-local-actions,#qh-video05-integrated .q05-section-heading{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;margin:18px 0 8px}
#qh-video05-integrated .q05-local-actions{justify-content:flex-start}
#qh-video05-integrated .q05-limits,#qh-video05-integrated .q05-provider-note{color:var(--q05-muted);font-size:12px;line-height:1.7;margin:8px 0;overflow-wrap:anywhere}
#qh-video05-integrated .q05-local-panel{padding:16px;border:1px solid var(--q05-line);border-radius:12px;background:var(--q05-soft);margin-top:16px}
#qh-video05-integrated .q05-local-panel p,#qh-video05-integrated .q05-local-panel small{color:var(--q05-muted);font-size:12px;line-height:1.7}
#qh-video05-integrated .q05-local-panel h3{font-size:17px;margin:0;color:var(--q05-text)}
#qh-video05-integrated .q05-local-panel input,#qh-video05-integrated input.q05-seconds{font:inherit;background:var(--q05-bg);color:var(--q05-text);border:1px solid var(--q05-line);padding:8px;border-radius:8px;max-width:100%;min-width:0}
#qh-video05-integrated input.q05-seconds{width:80px;margin-top:6px}
#qh-video05-integrated [class^="q05-"] button,#qh-video05-integrated button.q05-thumbnail{font:inherit;line-height:1.4;border:1px solid var(--q05-line);border-radius:8px;padding:8px 12px;background:var(--q05-bg);color:var(--q05-text);min-height:36px;cursor:pointer;max-width:100%;white-space:normal;overflow-wrap:anywhere}
#qh-video05-integrated [class^="q05-"] button:disabled{opacity:.6;cursor:not-allowed}
#qh-video05-integrated [class^="q05-"] button:hover:not(:disabled){border-color:var(--q05-blue)}
#qh-video05-integrated :focus-visible{outline:3px solid #80aaf3;outline-offset:2px}
#qh-video05-integrated .video-upload.is-dragging{outline:2px solid var(--q05-blue)}
#qh-video05-integrated .q05-connections strong,#qh-video05-integrated .q05-connections small{display:block}
#qh-video05-integrated .q05-native-model-select{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;clip-path:inset(50%)!important;white-space:nowrap!important;border:0!important;padding:0!important;margin:-1px!important;opacity:0!important;pointer-events:none!important}
/* Keep the nested grid within its column; long selected names wrap rather than cover the task field. */
#qh-video05-integrated .video-control:has(> .q05-model-picker){grid-template-columns:minmax(0,1fr)}
#qh-video05-integrated .q05-model-picker{position:relative;width:100%;min-width:0;max-width:100%;z-index:5}
#qh-video05-integrated .q05-model-picker .q05-model-toggle{display:flex;align-items:center;gap:9px;width:100%;min-width:0;min-height:58px;padding:8px 12px;text-align:left;border-color:var(--q05-line);background:var(--q05-bg);color:var(--q05-text);white-space:normal}
#qh-video05-integrated .q05-model-toggle:hover:not(:disabled){background:var(--q05-soft);border-color:var(--q05-blue)}
#qh-video05-integrated .q05-model-selected-label{display:flex;align-items:center;gap:8px;min-width:0;flex:1;white-space:normal}
#qh-video05-integrated .q05-model-selected-label>span:last-child{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.4}
#qh-video05-integrated .q05-model-chevron{flex:0 0 auto;font-size:17px;line-height:1;color:var(--q05-muted);margin-left:auto;transform:translateY(-2px)}
#qh-video05-integrated .q05-model-menu{position:absolute;left:0;right:auto;top:calc(100% + 6px);width:max(100%,360px);max-width:calc(100vw - 24px);max-height:min(420px,60vh);overflow:auto;padding:6px;border:1px solid var(--q05-line);border-radius:11px;background:var(--q05-bg);box-shadow:0 14px 35px #10233b2b}
#qh-video05-integrated .q05-model-option{display:flex;align-items:center;gap:9px;width:100%;min-height:44px;padding:5px 7px;border:0;border-radius:8px;background:transparent;color:var(--q05-text);text-align:left;font-size:13px;white-space:nowrap}
#qh-video05-integrated .q05-model-option:hover:not(:disabled),#qh-video05-integrated .q05-model-option:focus-visible{background:var(--q05-soft);outline:none}
#qh-video05-integrated .q05-model-option.is-selected{background:#e8f1ff;color:#123e86}
#qh-video05-integrated .q05-model-option-label{min-width:0;overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere;line-height:1.35}
#qh-video05-integrated .q05-model-icon{display:inline-grid;place-items:center;flex:0 0 32px;width:32px;height:32px;border-radius:8px;background:#eef2f6;color:#101820}
#qh-video05-integrated .q05-model-icon svg{display:block;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#qh-video05-integrated .q05-model-icon svg rect,#qh-video05-integrated .q05-model-icon svg circle{fill:currentColor;stroke:none}
#qh-video05-integrated .q05-model-icon svg path[fill="currentColor"]{stroke:none}
#qh-video05-integrated .video-control,#qh-video05-integrated .video-controls select{min-width:0;max-width:100%}
#qh-video05-integrated .video-controls{grid-template-columns:repeat(3,minmax(0,1fr))}
#qh-video05-integrated .q05-assets{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px;margin-top:14px}
#qh-video05-integrated .q05-asset{border:1px solid var(--q05-line);border-radius:10px;overflow:hidden;min-width:0;background:var(--q05-bg)}
#qh-video05-integrated button.q05-thumbnail{width:100%;height:116px;padding:0;background:var(--q05-soft);border:none;border-bottom:1px solid var(--q05-line);border-radius:0;display:grid;place-items:center}
#qh-video05-integrated .q05-thumbnail img{width:100%;height:116px;object-fit:contain;display:block}
#qh-video05-integrated .q05-media-icon{font-size:27px;color:#4471af}
#qh-video05-integrated .q05-asset-info{padding:10px 11px;display:flex;flex-direction:column;gap:3px}
#qh-video05-integrated .q05-asset-info b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
#qh-video05-integrated .q05-asset-actions{display:flex;justify-content:space-between;gap:4px;padding:0 8px 8px}
#qh-video05-integrated .q05-asset-actions button{font-size:11px;padding:6px;min-height:30px}
#qh-video05-integrated .q05-mention-list{display:flex;flex-wrap:wrap;gap:6px;padding:10px;border:1px solid var(--q05-line);max-height:180px;overflow:auto;background:var(--q05-soft);border-radius:8px}
#qh-video05-integrated .q05-mention-list button{font-size:12px}
#qh-video05-integrated .q05-micro{display:flex;gap:14px;justify-content:space-between;flex-wrap:wrap;color:var(--q05-muted);font-size:11px;margin-top:8px}
#qh-video05-integrated .q05-validation,#qh-video05-integrated .q05-note{padding:13px 16px;margin:14px 0;background:var(--q05-soft);border:1px solid var(--q05-line);border-radius:9px;font-size:13px}
#qh-video05-integrated .q05-validation ul{margin:7px 0;padding-left:21px}
#qh-video05-integrated .is-error{color:#b43f36!important}
#qh-video05-integrated .q05-validation.is-error{background:#fff6f3;border-color:#ebc7bf}
#qh-video05-integrated .q05-notice{font-size:12px;margin:15px 0 0;overflow-wrap:anywhere;min-height:20px}
#qh-video05-integrated .q05-connections{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
#qh-video05-integrated .q05-connections article{padding:15px;border:1px solid var(--q05-line);border-radius:10px;min-width:0}
#qh-video05-integrated .q05-connections code{display:block;color:var(--q05-muted);font-size:11px;overflow-wrap:anywhere;margin:5px 0}
#qh-video05-integrated .q05-empty{grid-column:1/-1;padding:35px 15px;border:1px dashed var(--q05-line);text-align:center;color:var(--q05-muted);border-radius:10px}
#qh-video05-integrated .q05-dialog{border:1px solid var(--q05-line);border-radius:15px;padding:18px;width:min(850px,94vw);max-height:92vh;background:var(--q05-bg);color:var(--q05-text)}
#qh-video05-integrated .q05-dialog::backdrop{background:#101e35aa}
#qh-video05-integrated .q05-dialog-head{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:15px;overflow-wrap:anywhere}
#qh-video05-integrated [data-q05-preview]{display:grid;place-items:center}
#qh-video05-integrated [data-q05-preview] img,#qh-video05-integrated [data-q05-preview] video{max-width:100%;max-height:70vh;object-fit:contain}
#qh-video05-integrated [data-q05-preview] audio{width:100%}
.ai-page:not(.bluewhite) #qh-video05-integrated{--q05-bg:#142033;--q05-text:#e1e9f6;--q05-muted:#9eafc7;--q05-line:#324359;--q05-soft:#1b2a40;--q05-blue:#8bb7ff}
.ai-page:not(.bluewhite) #qh-video05-integrated .q05-model-option.is-selected{background:#213e69;color:#e6f0ff}
.ai-page:not(.bluewhite) #qh-video05-integrated .q05-model-icon{background:#273447;color:#f1f5fb}
/* Allow the original horizontal tool navigation to shrink inside its grid track. */
#app .ai-page .ai-workspace:has(> .agent-panel > #qh-video05-integrated) > .engine-sidebar{min-width:0}
#app .agent-panel:has(> #qh-video05-integrated){box-sizing:border-box;min-width:0!important;max-width:100%}
@media(max-width:760px){
/* Constrain the expanded menu to its field on narrow screens; long labels wrap. */
#qh-video05-integrated .q05-model-menu{width:100%;max-width:100%}
#app .ai-page .ai-workspace:has(> .agent-panel > #qh-video05-integrated){grid-template-columns:minmax(0,1fr)!important;min-width:0!important}
#app .agent-panel:has(> #qh-video05-integrated){padding:10px!important}
#qh-video05-integrated .video-controls,#qh-video05-integrated .q05-connections{grid-template-columns:minmax(0,1fr)}
#qh-video05-integrated .q05-assets{grid-template-columns:repeat(2,minmax(0,1fr))}
#qh-video05-integrated .q05-material-tools,#qh-video05-integrated .q05-section-heading{align-items:flex-start}
}

/* Only the user-marked 05 heading; keep the main balance display and form untouched. */
#qh-video05-integrated .video-tool-heading.q05-reference-heading{display:block!important;min-height:0!important;padding:0!important;margin:0 0 12px!important;border:0!important;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif;color:#2f4359}
#app #qh-video05-integrated .video-tool-heading.q05-reference-heading .qh-video-wallet-card{display:none!important}
#qh-video05-integrated .q05-reference-heading h3.q05-title-row{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:0 0 8px;padding:0;font-family:inherit;font-size:18px;font-weight:500;line-height:1.35;color:inherit}
#qh-video05-integrated .q05-title-model{display:inline-flex;align-items:center;gap:9px;min-width:0;font-size:18px;font-weight:500;line-height:1.45;color:inherit}
#qh-video05-integrated .q05-title-logo{display:inline-flex;align-items:center;justify-content:center;flex:0 0 30px;width:30px;height:30px;padding:0;background:#eef1f5;border-radius:8px}
#qh-video05-integrated .q05-title-logo svg{display:block;width:20px;height:20px;flex:none}
#qh-video05-integrated .q05-title-row .q05-title-badge{display:inline-flex;align-items:center;margin:0;padding:5px 10px;border:1px solid rgba(47,128,237,.3);border-radius:999px;background:#eaf4ff;color:inherit;font-family:inherit;font-size:12px;font-weight:900;font-style:normal;line-height:1.35}
#qh-video05-integrated .q05-reference-heading p.q05-title-description{display:block;width:auto;max-width:none;margin:0;padding:0;font-family:inherit;font-size:13px;font-weight:400;line-height:1.75;color:inherit}

/* QH05 uniform model picker: match the field width and keep every choice aligned. */
#qh-video05-integrated .q05-model-picker{container-type:inline-size}
#qh-video05-integrated .q05-model-picker .q05-model-toggle{height:58px;min-height:58px;padding:8px 10px;gap:6px;font-size:12px;line-height:1.4}
#qh-video05-integrated .q05-model-picker .q05-model-selected-label{gap:6px;font-size:12px;line-height:1.4}
#qh-video05-integrated .q05-model-picker .q05-model-selected-label>span:last-child{flex:1;line-height:1.4}
#qh-video05-integrated .q05-model-picker .q05-model-chevron{font-size:14px}
#qh-video05-integrated .q05-model-picker .q05-model-menu{display:grid;grid-template-columns:minmax(0,1fr);grid-auto-rows:58px;gap:4px;left:0;right:0;width:100%;min-width:0;max-width:100%;padding:4px;overflow-x:hidden;overflow-y:auto;scrollbar-width:thin;scrollbar-gutter:stable;overscroll-behavior:contain}
#qh-video05-integrated .q05-model-picker .q05-model-option{display:flex;align-items:center;width:100%;min-width:0;height:58px;min-height:58px;margin:0;padding:6px 8px;gap:6px;border:1px solid var(--q05-line);border-radius:8px;font-size:12px;line-height:1.4;white-space:normal}
#qh-video05-integrated .q05-model-picker .q05-model-option-label{flex:1;min-width:0;font-size:12px;line-height:1.4;white-space:normal;overflow-wrap:anywhere;text-overflow:clip}
#qh-video05-integrated .q05-model-picker .q05-model-icon{flex:0 0 24px;width:24px;height:24px;border-radius:6px}
#qh-video05-integrated .q05-model-picker .q05-model-icon svg{width:16px;height:16px}
#qh-video05-integrated .q05-model-picker .q05-model-option:focus-visible{outline:2px solid var(--q05-blue);outline-offset:-2px}
/* Keep equal row heights even when a desktop column becomes unusually narrow. */
@container (max-width:220px){
#qh-video05-integrated .q05-model-picker .q05-model-toggle,#qh-video05-integrated .q05-model-picker .q05-model-option{height:76px;min-height:76px}
#qh-video05-integrated .q05-model-picker .q05-model-menu{grid-auto-rows:76px}
}

/* QH05_CLEAN_FOOTER_20260918: remove the marked helper UI only.
   Keep the controls mounted so draft values, generation and task polling stay unchanged. */
#qh-video05-integrated [data-q05-provider-note],
#qh-video05-integrated .q05-local-actions,
#qh-video05-integrated [data-seedance25-section] {
  display: none !important;
}

/* QH05_INLINE_ACTIONS_20260918: keep both helper buttons compact and adjacent.
   CSS only: the original buttons, handlers and generation controls stay mounted. */
#qh-video05-integrated .agent-actions {
  display: grid;
  grid-template-columns: 94px minmax(94px, 1fr) 168px;
}
#qh-video05-integrated .agent-actions > .reference-button,
#qh-video05-integrated .agent-actions > .clear-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: start;
  width: 94px;
  height: 45px;
  min-height: 45px;
  padding: 0 6px;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}
#qh-video05-integrated .agent-actions > .reference-button { grid-area: 1 / 1; }
#qh-video05-integrated .agent-actions > .clear-button { grid-area: 1 / 2; }
#qh-video05-integrated .agent-actions > .generate-button { grid-area: 1 / 3; }
/* QH05_RESTORE_UPSCALE_ENTRY_20260920: optional original tool18 shortcut below Generate. */
#qh-video05-integrated .agent-actions > .upscale-button { grid-area: 2 / 3; }
/* QH05_STEP_BUTTON_ALIGNMENT_20260920: equal boxes; original actions and colors unchanged. */
#qh-video05-integrated .agent-actions > .generate-button,
#qh-video05-integrated .agent-actions > .upscale-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 74px;
  min-height: 74px;
}
#qh-video05-integrated .agent-actions > .cost-inline { grid-area: 2 / 1 / 3 / 3; }
#qh-video05-integrated .agent-actions > .upscale-completed-result { grid-area: 1 / 1 / span 2 / 3; }
@media (max-width: 640px) {
  #qh-video05-integrated .agent-actions { grid-template-columns: 94px minmax(94px, 1fr); }
  #qh-video05-integrated .agent-actions > .generate-button { grid-area: 2 / 1 / 3 / -1; }
  #qh-video05-integrated .agent-actions > .upscale-button { grid-area: 3 / 1 / 4 / -1; }
  #qh-video05-integrated .agent-actions > .cost-inline { grid-area: 4 / 1 / 5 / -1; }
  #qh-video05-integrated .agent-actions > .upscale-completed-result { grid-area: 5 / 1 / 6 / -1; }
}

/* QH05_CONTROL_ALIGNMENT_20260919: keep the duration hint on the label line
   so the duration and resolution fields share the same top and bottom edges. */
#qh-video05-integrated .duration-control > label {
  white-space: nowrap;
}
#qh-video05-integrated .duration-control > label > em {
  display: inline;
}

/* QH05_RATIO_ROW_20260919: let aspect ratio fill the third desktop column
   beside duration and resolution, preserving natural single-column flow. */
#qh-video05-integrated .aspect-control {
  grid-column: auto;
}

/* QH05_ASSETS_TEN_20260919: compact reference materials only.
   Ten equal desktop columns; keep preview, reference and remove controls intact. */
#qh-video05-integrated .q05-assets {
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
}
#qh-video05-integrated .q05-assets > .q05-asset {
  border-radius: 8px;
}
#qh-video05-integrated .q05-assets button.q05-thumbnail,
#qh-video05-integrated .q05-assets .q05-thumbnail img {
  height: 64px;
}
#qh-video05-integrated .q05-assets .q05-thumbnail img {
  object-fit: contain;
}
#qh-video05-integrated .q05-assets .q05-media-icon {
  font-size: 22px;
}
#qh-video05-integrated .q05-assets .q05-asset-info {
  padding: 5px 4px;
  gap: 2px;
}
#qh-video05-integrated .q05-assets .q05-asset-info b,
#qh-video05-integrated .q05-assets .q05-asset-info small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 14px;
}
#qh-video05-integrated .q05-assets .q05-asset-info b { font-size: 11px; }
#qh-video05-integrated .q05-assets .q05-asset-info small { font-size: 10px; }
#qh-video05-integrated .q05-assets .q05-asset-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  padding: 0 4px 4px;
}
#qh-video05-integrated .q05-assets .q05-asset-actions button {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 3px 2px;
  font-size: 11px;
  line-height: 16px;
  border-radius: 5px;
  white-space: nowrap;
  overflow-wrap: normal;
}
@media (max-width: 760px) {
  #qh-video05-integrated .q05-assets { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  #qh-video05-integrated .q05-assets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* QH05_ALL_MODEL_CLEAN_UI_20260919: hide only the three marked helper areas
   for every model/mode, including remounts and async provider status updates.
   Keep the nodes and storage hooks; uploads, validation and billing are unchanged. */
#qh-video05-integrated .video-controls > .video-tip,
#qh-video05-integrated .q05-material-tools,
#qh-video05-integrated [data-q05-limits] {
  display: none !important;
}

/* QH05_PROVIDER_PANEL_CLEANUP_20260920: unified history owns results; provider mounts keep running. */
#qh-video05-integrated.q05-history-managed > [data-wan3-section],
#qh-video05-integrated.q05-history-managed > [data-kling-omni-section],
#qh-video05-integrated.q05-history-managed > [data-minimax-h3-section],
#qh-video05-integrated.q05-history-managed > [data-seedance25-section],
#qh-video05-integrated.q05-history-managed > [data-happyhorse11-section],
#qh-video05-integrated.q05-history-managed > [data-grok15-section],
#qh-video05-integrated .q05-notice:empty {
  display: none !important;
}

/* QH05_REMOVE_TWO_NOTICES_20260920: shared presentation for every video model.
   Keep the character counter, file controls, validation and error notices visible. */
#qh-video05-integrated .q05-micro > span:not([data-q05-charcount]),
#qh-video05-integrated [data-q05-notice]:not(.is-error) {
  display: none !important;
}

/* QH05_GROK_REFERENCE_CONTROLS_20260921: match the requested two-column order
   only for Grok; keep all original controls and every other model intact. */
#qh-video05-integrated.q05-grok-controls .video-controls {
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
}
#qh-video05-integrated.q05-grok-controls .video-control { align-content: start; }
#qh-video05-integrated.q05-grok-controls .video-control > label {
  min-height: 18px;
  line-height: 18px;
  white-space: normal;
}
#qh-video05-integrated.q05-grok-controls .video-control select,
#qh-video05-integrated.q05-grok-controls .q05-model-picker .q05-model-toggle {
  height: 44px;
  min-height: 44px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 20px;
}
#qh-video05-integrated.q05-grok-controls .duration-control > strong,
#qh-video05-integrated.q05-grok-controls .duration-control > label > em,
#qh-video05-integrated.q05-grok-controls .duration-control > .q05-seconds {
  display: none;
}
#qh-video05-integrated.q05-grok-controls .duration-control > input[type="range"] {
  margin: 0;
  min-width: 0;
  height: 44px;
}
#qh-video05-integrated.q05-grok-controls .aspect-control { grid-column: auto; }
@media (max-width: 600px) {
  #qh-video05-integrated.q05-grok-controls .video-controls { grid-template-columns: minmax(0, 1fr); }
}

/* qh05-restore-page-scroll-20260926: restore original whole-page scrolling only. */
.ai-page.bluewhite .ai-workspace:has(#qh-video05-integrated) {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}
.ai-page.bluewhite .ai-workspace:has(#qh-video05-integrated) > .engine-sidebar,
.ai-page.bluewhite .ai-workspace:has(#qh-video05-integrated) > .agent-panel {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}
