
/* Tool67 four basic pages — stable layout fix */
:root{
  --t67-page-width: 980px;
  --t67-core-height: 300px;
  --t67-gap: 12px;
  --t67-bg: #f4f6f8;
  --t67-line: #c9d2de;
  --t67-line-strong: #aab6c5;
  --t67-card: #ffffff;
  --t67-upload: #f7f8fa;
  --t67-upload-hover: #eef2f6;
  --t67-text: #111827;
  --t67-muted: #64748b;
  --t67-button: #1f2937;
  --t67-active: #777;
}
html,body{background:var(--t67-bg)!important;}
.t67-basic-page,.t67-video-basic-page{max-width:1100px!important;margin:0 auto!important;padding:8px 0 52px!important;background:transparent!important;}
.t67-basic-page .fr-hero,.t67-video-basic-page .fr-hero{text-align:center!important;padding:8px 16px 16px!important;background:transparent!important;}
.t67-basic-page .fr-kicker,.t67-video-basic-page .fr-kicker{display:none!important;}
.t67-basic-page .fr-hero h1,.t67-video-basic-page .fr-hero h1{margin:0 0 7px!important;color:#11161f!important;font-size:56px!important;line-height:1.06!important;letter-spacing:-.025em!important;}
.t67-basic-page .fr-subtitle,.t67-video-basic-page .fr-subtitle{margin:0 auto!important;max-width:660px!important;color:#5d7190!important;font-size:14px!important;line-height:1.4!important;}

/* One exact content width on all four pages. */
.t67-basic-page>.fr-tool,
.t67-video-basic-page>.fr-tool,
.t67-video-basic-page>.t67-video-basic-root,
.t67-video-basic-root>.fr-tool{
  width:min(var(--t67-page-width),calc(100vw - 32px))!important;
  max-width:min(var(--t67-page-width),calc(100vw - 32px))!important;
  margin-left:auto!important;
  margin-right:auto!important;
  box-sizing:border-box!important;
}

/* Tabs remain fixed and centered. */
.t67-basic-page>.core-tabs,.t67-video-basic-page>.core-tabs{display:flex!important;justify-content:center!important;width:auto!important;max-width:calc(100vw - 20px)!important;margin:0 auto 8px!important;padding:0!important;gap:4px!important;border:0!important;background:transparent!important;overflow-x:auto!important;}
.t67-basic-page>.core-tabs a,.t67-video-basic-page>.core-tabs a{display:flex!important;align-items:center!important;justify-content:center!important;flex:0 0 112px!important;width:112px!important;min-width:112px!important;max-width:112px!important;height:38px!important;min-height:38px!important;padding:0 12px!important;margin:0!important;border:1px solid #b8c3d0!important;border-radius:0!important;background:#f8fafc!important;color:#53667d!important;box-shadow:none!important;text-decoration:none!important;white-space:nowrap!important;font-size:13.5px!important;font-weight:500!important;line-height:1!important;letter-spacing:0!important;text-transform:none!important;}
.t67-basic-page>.core-tabs a.active,.t67-video-basic-page>.core-tabs a.active{background:var(--t67-active)!important;border-color:var(--t67-active)!important;color:#fff!important;}
.t67-basic-page>.core-tabs a,.t67-video-basic-page>.core-tabs a{transition:background-color .18s ease,border-color .18s ease,color .18s ease!important;}
.t67-basic-page>.core-tabs a:hover,.t67-video-basic-page>.core-tabs a:hover{background:#eef3f8!important;border-color:#9fb0c3!important;color:#2a3c51!important;}
.t67-basic-page>.core-tabs a.active:hover,.t67-video-basic-page>.core-tabs a.active:hover{background:#6d6d6d!important;border-color:#6d6d6d!important;color:#fff!important;}

/* Never allow inherited rounded cards. */
.t67-basic-page .fr-api-card,.t67-video-basic-page .fr-api-card,.t67-basic-page .fr-api-settings,.t67-video-basic-page .fr-api-settings,.t67-basic-page .fr-api-credit,.t67-video-basic-page .fr-api-credit,.t67-basic-page .fr-api-result,.t67-video-basic-page .fr-api-result,.t67-video-basic-result,.t67-vscene-result-stage,.t67-i2i-workspace,.t67-i2v-workspace,.t67-i2v-media-extras .t67-vref-extra-group{border-radius:0!important;box-shadow:none!important;}
.t67-basic-page textarea,.t67-video-basic-page textarea,.t67-basic-page select,.t67-video-basic-page select,.t67-basic-page input,.t67-video-basic-page input,.t67-basic-page button,.t67-video-basic-page button{border-radius:0!important;}

/* Prompt-only pages. */
.t67-basic-page .core-input-shell,.t67-video-basic-root .core-input-shell{width:100%!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important;box-sizing:border-box!important;}
.t67-basic-page .core-input-shell .fr-api-field,.t67-video-basic-root .core-input-shell .fr-api-field{width:100%!important;margin:0!important;box-sizing:border-box!important;}
.t67-basic-page .core-input-shell textarea,.t67-video-basic-root .core-input-shell textarea{display:block!important;width:100%!important;max-width:100%!important;height:var(--t67-core-height)!important;min-height:var(--t67-core-height)!important;margin:0!important;padding:16px!important;border:1px solid var(--t67-line)!important;background:#fff!important;color:var(--t67-text)!important;box-shadow:none!important;font-size:15px!important;line-height:1.55!important;resize:vertical!important;box-sizing:border-box!important;}
.t67-basic-page textarea:focus,.t67-video-basic-page textarea:focus{outline:none!important;border-color:#8e9caf!important;box-shadow:none!important;}

/* Image pages use a 4:5 composer and the same 300px core height. */
.t67-i2i-workspace,.t67-i2v-workspace{width:100%!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important;box-sizing:border-box!important;}
.t67-i2i-composer,.t67-i2v-composer{display:grid!important;grid-template-columns:minmax(0,4fr) minmax(0,5fr)!important;gap:var(--t67-gap)!important;width:100%!important;height:var(--t67-core-height)!important;margin:0!important;align-items:stretch!important;box-sizing:border-box!important;}
.t67-i2i-upload-side,.t67-i2v-reference-column{display:flex!important;flex-direction:column!important;min-width:0!important;width:100%!important;height:var(--t67-core-height)!important;gap:0!important;padding:0!important;margin:0!important;border:0!important;background:transparent!important;box-sizing:border-box!important;}
.t67-i2i-upload-panel,.t67-i2v-image-panel.t67-vscene-drop{position:relative!important;display:block!important;width:100%!important;height:var(--t67-core-height)!important;min-height:var(--t67-core-height)!important;max-height:var(--t67-core-height)!important;margin:0!important;padding:8px!important;border:1px solid var(--t67-line-strong)!important;background:var(--t67-upload)!important;overflow:hidden!important;cursor:pointer!important;box-shadow:none!important;box-sizing:border-box!important;transition:background-color .15s ease,border-color .15s ease!important;}
.t67-i2i-upload-panel:hover,.t67-i2v-image-panel.t67-vscene-drop:hover,.t67-i2v-image-panel.t67-vscene-drop.drag{background:var(--t67-upload-hover)!important;border-color:#8f9fb3!important;}
.t67-i2i-empty,.t67-i2v-image-panel .t67-vscene-empty{position:absolute!important;inset:8px!important;display:flex!important;align-items:center!important;justify-content:center!important;flex-direction:column!important;gap:8px!important;padding:0!important;text-align:center!important;color:var(--t67-text)!important;}
.t67-i2i-upload-panel.has-images .t67-i2i-empty,.t67-i2v-image-panel .t67-vscene-empty[hidden]{display:none!important;}
.t67-i2i-empty input,.t67-i2v-image-panel>input{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;}
.t67-upload-icon,.t67-i2v-image-panel .t67-vscene-plus{display:grid!important;place-items:center!important;width:42px!important;height:42px!important;margin:0!important;border:1px solid var(--t67-line)!important;background:#fff!important;color:#26384d!important;}
.t67-upload-icon svg,.t67-i2v-image-panel .t67-vscene-plus svg{width:21px!important;height:21px!important;fill:none!important;stroke:currentColor!important;stroke-width:1.6!important;stroke-linecap:round!important;stroke-linejoin:round!important;}
.t67-i2i-empty b,.t67-i2v-image-panel .t67-vscene-empty b{display:block!important;margin:0!important;font-size:15px!important;font-weight:600!important;line-height:1.2!important;}
.t67-i2i-empty small,.t67-i2v-image-panel .t67-vscene-empty span{display:block!important;max-width:260px!important;margin:0!important;color:#6d7c91!important;font-size:11px!important;line-height:1.4!important;}
.t67-i2i-prompt-side,.t67-i2v-prompt,.t67-i2i-prompt-side .fr-api-field{width:100%!important;height:var(--t67-core-height)!important;min-width:0!important;margin:0!important;box-sizing:border-box!important;}
.t67-i2i-prompt-side textarea,.t67-i2v-prompt textarea{display:block!important;width:100%!important;max-width:100%!important;height:var(--t67-core-height)!important;min-height:var(--t67-core-height)!important;max-height:var(--t67-core-height)!important;margin:0!important;padding:16px!important;border:1px solid var(--t67-line)!important;background:#fff!important;color:var(--t67-text)!important;box-shadow:none!important;font-size:15px!important;line-height:1.55!important;resize:vertical!important;box-sizing:border-box!important;}

/* Hide counts below i2v; they must not steal core height. */
.t67-i2v-upload-meta{display:none!important;}
.t67-i2i-upload-meta{position:absolute!important;right:8px!important;bottom:5px!important;z-index:5!important;min-height:0!important;padding:0!important;margin:0!important;color:#738197!important;font-size:10px!important;pointer-events:none!important;}

/* Full-image preview grids: no white cards around images, no overflow. */
.t67-i2i-reference-grid.core-reference-list,.t67-i2v-image-panel .t67-vref-images{display:none!important;width:100%!important;height:100%!important;min-height:0!important;max-height:100%!important;margin:0!important;padding:0!important;gap:6px!important;align-content:stretch!important;justify-content:stretch!important;grid-auto-flow:row!important;overflow:hidden!important;box-sizing:border-box!important;}
.t67-i2i-reference-grid.core-reference-list.has-images,.t67-i2v-image-panel .t67-vref-images:not(:empty){display:grid!important;}
.t67-i2i-reference-grid[data-count="1"],.t67-i2v-image-panel .t67-vref-images[data-count="1"]{grid-template-columns:1fr!important;grid-template-rows:1fr!important;}
.t67-i2i-reference-grid[data-count="2"],.t67-i2v-image-panel .t67-vref-images[data-count="2"]{grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:1fr!important;}
.t67-i2i-reference-grid[data-count="3"],.t67-i2v-image-panel .t67-vref-images[data-count="3"]{grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:1fr!important;}
.t67-i2i-reference-grid[data-count="4"],.t67-i2v-image-panel .t67-vref-images[data-count="4"]{grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;}
.t67-i2i-reference-grid[data-count="5"],.t67-i2v-image-panel .t67-vref-images[data-count="5"]{grid-template-columns:repeat(6,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;}
.t67-i2i-reference-grid[data-count="5"]>.t67-i2i-reference-item,.t67-i2v-image-panel .t67-vref-images[data-count="5"]>.t67-vref-image{grid-column:span 2!important;}
.t67-i2i-reference-grid[data-count="5"]>.t67-i2i-reference-item:nth-child(4),.t67-i2v-image-panel .t67-vref-images[data-count="5"]>.t67-vref-image:nth-child(4){grid-column:2/span 2!important;}
.t67-i2i-reference-grid[data-count="5"]>.t67-i2i-reference-item:nth-child(5),.t67-i2v-image-panel .t67-vref-images[data-count="5"]>.t67-vref-image:nth-child(5){grid-column:4/span 2!important;}
.t67-i2i-reference-grid[data-count="6"],.t67-i2v-image-panel .t67-vref-images[data-count="6"]{grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;}
.t67-i2i-reference-grid[data-count="7"],.t67-i2v-image-panel .t67-vref-images[data-count="7"],.t67-i2i-reference-grid[data-count="8"],.t67-i2v-image-panel .t67-vref-images[data-count="8"],.t67-i2i-reference-grid[data-count="9"],.t67-i2v-image-panel .t67-vref-images[data-count="9"]{grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:repeat(3,minmax(0,1fr))!important;}
.t67-i2i-reference-grid[data-count="10"]{grid-template-columns:repeat(5,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;}
.t67-i2i-reference-item,.t67-i2v-image-panel .t67-vref-image{position:relative!important;display:flex!important;align-items:center!important;justify-content:center!important;width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important;overflow:hidden!important;box-sizing:border-box!important;}
.t67-i2i-reference-item img,.t67-i2v-image-panel .t67-vref-image img{display:block!important;width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;object-fit:contain!important;background:transparent!important;border:0!important;box-shadow:none!important;}

/* Only zoom/crop/remove on uploaded video references; icons sit above image. */
.t67-i2v-image-panel .t67-vref-tools,.t67-i2i-reference-item>.t67-ict-tools{position:absolute!important;z-index:8!important;display:flex!important;flex-direction:column!important;gap:4px!important;opacity:0!important;transform:translateX(4px)!important;transition:opacity .14s ease,transform .14s ease!important;}
.t67-i2v-image-panel .t67-vref-image:hover .t67-vref-tools,.t67-i2i-reference-item:hover>.t67-ict-tools{opacity:1!important;transform:none!important;}
.t67-i2v-image-panel .t67-vref-tools button,.t67-i2i-reference-item>.t67-ict-tools .t67-ict-btn{display:grid!important;place-items:center!important;width:27px!important;height:27px!important;border:1px solid rgba(255,255,255,.18)!important;border-radius:0!important;background:rgba(15,23,42,.82)!important;color:#fff!important;box-shadow:none!important;}
.t67-i2v-image-panel .t67-vref-tools span,.t67-i2v-image-panel .t67-vref-role{display:none!important;}
.t67-i2i-reference-item>.t67-ict-tools [data-action="rotate"],.t67-i2i-reference-item>.t67-ict-tools [data-action="flip"],.t67-i2i-reference-item>.t67-ict-tools [data-action="edit"],.t67-i2i-reference-item>.t67-ict-tools [data-action="video"],.t67-i2i-reference-item>.t67-ict-tools [data-action="download"]{display:none!important;}

/* Reference video/audio is below the 300px core and collapsed by default. */
.t67-i2v-reference-row{width:100%!important;margin-top:5px!important;}
.t67-i2v-reference-more{display:grid!important;grid-template-columns:minmax(0,4fr) minmax(0,5fr)!important;gap:var(--t67-gap)!important;width:100%!important;}
.t67-i2v-add-media-toggle{grid-column:1!important;display:flex!important;align-items:center!important;justify-content:space-between!important;width:100%!important;height:34px!important;margin:0!important;padding:0 10px!important;border:1px solid var(--t67-line)!important;background:#fff!important;color:#334155!important;font-size:11px!important;font-weight:600!important;cursor:pointer!important;box-shadow:none!important;}
.t67-i2v-add-media-toggle::after{content:'+';font-size:16px;font-weight:400;line-height:1;}
.t67-i2v-add-media-toggle.is-open::after{content:'−';}
.t67-i2v-media-extras{grid-column:1/-1!important;display:none!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important;margin-top:0!important;padding:0!important;}
.t67-i2v-media-extras:not([hidden]){display:grid!important;}
.t67-i2v-media-extras .t67-vref-extra-group{padding:8px!important;border:1px solid var(--t67-line)!important;background:#fff!important;}
.t67-i2v-media-extras .t67-vref-head>span{font-size:10px!important;color:#65758a!important;font-weight:600!important;}
.t67-i2v-media-extras .t67-vref-head small{display:none!important;}
.t67-i2v-media-extras .t67-vref-add{display:flex!important;align-items:center!important;justify-content:center!important;min-height:34px!important;padding:0 8px!important;border:1px dashed var(--t67-line)!important;background:#fafbfc!important;color:#334155!important;font-size:10px!important;font-weight:600!important;cursor:pointer!important;}
.t67-i2v-media-extras .t67-vref-add input{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;}
.t67-i2v-media-extras .t67-vref-total{font-size:10px!important;color:#758297!important;}

/* Parameter rows. */
.t67-basic-page .fr-api-settings,.t67-video-basic-page .fr-api-settings{width:100%!important;margin-top:var(--t67-gap)!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important;box-sizing:border-box!important;}
.t67-basic-page .core-compact-toolbar{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:8px!important;width:100%!important;}
.t67-video-basic-settings .t67-vscene-row{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:8px!important;width:100%!important;}
.t67-basic-page .core-compact-field,.t67-video-basic-settings .t67-vscene-field{display:flex!important;flex-direction:column!important;min-width:0!important;gap:4px!important;}
.t67-basic-page .core-compact-field span,.t67-video-basic-settings .t67-vscene-field span{margin:0!important;color:#65758a!important;font-size:10px!important;line-height:1.2!important;font-weight:600!important;letter-spacing:0!important;}
.t67-basic-page select,.t67-video-basic-page select,.t67-video-basic-settings input,.t67-video-basic-settings textarea{width:100%!important;height:36px!important;min-height:36px!important;padding:0 26px 0 9px!important;border:1px solid var(--t67-line)!important;background:#fff!important;color:var(--t67-text)!important;box-shadow:none!important;font-size:11px!important;line-height:36px!important;box-sizing:border-box!important;}
#modelInfo,#t67SceneModelInfo,.fr-create-reference-note,.t67-vscene-model-info{display:none!important;}
.t67-vscene-meta{display:flex!important;align-items:center!important;justify-content:flex-end!important;min-height:17px!important;margin:5px 0 0!important;padding:0!important;}
.t67-vscene-audio,.t67-vscene-audio span{font-size:10px!important;font-weight:400!important;line-height:1!important;}
.t67-vscene-audio{display:inline-flex!important;align-items:center!important;gap:4px!important;color:#53657b!important;}
.t67-vscene-audio input{width:13px!important;height:13px!important;min-height:13px!important;margin:0!important;padding:0!important;}

/* Buttons/credits/status. */
.t67-basic-page .fr-run.primary,.t67-video-basic-page .fr-run.primary,.t67-video-basic-run{width:100%!important;height:54px!important;min-height:54px!important;margin-top:10px!important;padding:0 14px!important;border:0!important;background:var(--t67-button)!important;color:#fff!important;box-shadow:none!important;font-size:15px!important;font-weight:600!important;box-sizing:border-box!important;}
.t67-basic-page .fr-api-credit,.t67-video-basic-page .fr-api-credit{min-height:30px!important;margin-top:7px!important;padding:5px 0!important;border:0!important;background:transparent!important;color:#68788e!important;font-size:10px!important;}
.t67-basic-page .fr-api-status,.t67-video-basic-page .fr-api-status{min-height:14px!important;margin-top:2px!important;font-size:10px!important;color:#64748b!important;}

/* Image result area: no surrounding box. */
#resultCard{position:relative!important;margin-top:var(--t67-gap)!important;padding:0 0 24px!important;border:0!important;background:transparent!important;box-shadow:none!important;}
#resultCard .fr-api-result-stage,#resultBox{min-height:0!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important;}
.result-grid{display:grid!important;width:100%!important;gap:8px!important;align-items:start!important;}
.result-grid[data-count="1"]{grid-template-columns:1fr!important;}
.result-grid[data-count="2"]{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
.result-grid[data-count="3"]{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
.result-grid[data-count="4"]{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
.result-grid[data-count="5"]{grid-template-columns:repeat(6,minmax(0,1fr))!important;}
.result-grid[data-count="5"]>.result-item{grid-column:span 2!important;}
.result-grid[data-count="5"]>.result-item:nth-child(4){grid-column:2/span 2!important;}
.result-grid[data-count="5"]>.result-item:nth-child(5){grid-column:4/span 2!important;}
.result-grid[data-count="6"]{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
.result-item{position:relative!important;min-width:0!important;border:0!important;background:transparent!important;box-shadow:none!important;}
.result-img{position:relative!important;display:block!important;width:100%!important;min-height:0!important;border:0!important;background:transparent!important;overflow:visible!important;}
.result-img>img{display:block!important;width:100%!important;height:auto!important;max-width:100%!important;object-fit:contain!important;background:transparent!important;border:0!important;box-shadow:none!important;}
.result-actions{display:none!important;}
.result-item>.t67-ict-tools{top:7px!important;right:7px!important;gap:4px!important;}
.result-item>.t67-ict-tools .t67-ict-btn{width:28px!important;height:28px!important;border-radius:0!important;box-shadow:none!important;background:rgba(15,23,42,.82)!important;}
.result-zipbar{position:absolute!important;right:0!important;bottom:0!important;display:flex!important;justify-content:flex-end!important;margin:0!important;}
.result-zipbar[hidden]{display:none!important;}
.result-zipbar button{display:inline-flex!important;align-items:center!important;gap:5px!important;padding:0!important;border:0!important;background:transparent!important;color:#40546d!important;font-size:11px!important;font-weight:700!important;cursor:pointer!important;}
.result-zipbar button svg{width:14px!important;height:14px!important;stroke:currentColor!important;fill:none!important;stroke-width:1.8!important;}
.result-zipbar button:hover{text-decoration:underline!important;color:#1f2937!important;}
.slot-state{min-height:120px!important;border:1px solid #e2e8f0!important;background:#fafbfc!important;}
.slot-copy{display:flex!important;min-height:120px!important;align-items:center!important;justify-content:center!important;flex-direction:column!important;gap:6px!important;padding:14px!important;color:#68788e!important;font-size:10px!important;text-align:center!important;}

/* Video result. */
.t67-video-basic-result{margin-top:var(--t67-gap)!important;padding:0!important;border:0!important;background:transparent!important;}
.t67-video-basic-result .t67-vscene-result-stage{min-height:220px!important;background:#0a0d12!important;overflow:hidden!important;}
.t67-video-basic-result .t67-vscene-result-stage video{display:block!important;width:auto!important;height:auto!important;max-width:100%!important;max-height:520px!important;background:#000!important;}

@media(max-width:900px){
  .t67-basic-page .fr-hero h1,.t67-video-basic-page .fr-hero h1{font-size:48px!important;}
  .t67-i2i-composer,.t67-i2v-composer{grid-template-columns:1fr!important;height:auto!important;}
  .t67-i2i-upload-panel,.t67-i2v-reference-column,.t67-i2i-prompt-side textarea,.t67-i2v-prompt textarea{height:260px!important;min-height:260px!important;max-height:260px!important;}
}
@media(max-width:720px){
  :root{--t67-page-width:calc(100vw - 20px);}
  .t67-basic-page,.t67-video-basic-page{padding-bottom:38px!important;}
  .t67-basic-page .fr-hero h1,.t67-video-basic-page .fr-hero h1{font-size:40px!important;}
  .t67-basic-page>.core-tabs,.t67-video-basic-page>.core-tabs{justify-content:flex-start!important;width:404px!important;max-width:calc(100vw - 12px)!important;}
  .t67-basic-page .core-compact-toolbar,.t67-video-basic-settings .t67-vscene-row,.t67-video-basic-settings #t67SceneSpecific .t67-vscene-row{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;}
  .t67-i2v-media-extras{grid-template-columns:1fr!important;}
}


/* deterministic uploaded-image grids — based on actual child count, not only data-count */
.t67-i2v-image-panel #t67ScenePreviews{
  display:grid!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  max-width:none!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  gap:6px!important;
  overflow:hidden!important;
  align-content:stretch!important;
  justify-content:stretch!important;
  grid-auto-flow:row!important;
  box-sizing:border-box!important;
}
.t67-i2v-image-panel #t67ScenePreviews:empty{display:none!important;}
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(1):last-child){grid-template-columns:1fr!important;grid-template-rows:1fr!important;}
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(2):last-child){grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:1fr!important;}
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(3):last-child){grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:1fr!important;}
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(4):last-child){grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;}
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(5):last-child){grid-template-columns:repeat(6,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;}
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(5):last-child)>:nth-child(-n+3){grid-column:span 2!important;}
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(5):last-child)>:nth-child(4){grid-column:2/span 2!important;}
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(5):last-child)>:nth-child(5){grid-column:4/span 2!important;}
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(6):last-child){grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;}
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(7):last-child),
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(8):last-child),
.t67-i2v-image-panel #t67ScenePreviews:has(>:nth-child(9):last-child){grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:repeat(3,minmax(0,1fr))!important;}
.t67-i2v-image-panel #t67ScenePreviews>.t67-vref-image{
  position:relative!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  max-width:none!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  overflow:hidden!important;
}
.t67-i2v-image-panel #t67ScenePreviews>.t67-vref-image>img{
  display:block!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  max-width:100%!important;
  max-height:100%!important;
  object-fit:contain!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
}
/* toolbars live on the image itself, top-right */
.t67-i2v-image-panel #t67ScenePreviews>.t67-vref-image>.t67-vref-tools{
  position:absolute!important;
  display:flex!important;
  flex-direction:column!important;
  gap:4px!important;
  opacity:0!important;
  pointer-events:none!important;
  transform:translateX(3px)!important;
  z-index:20!important;
}
.t67-i2i-reference-item>.t67-ict-tools{
  position:absolute!important;
  display:flex!important;
  flex-direction:column!important;
  gap:4px!important;
  opacity:0!important;
  pointer-events:none!important;
  transform:translateX(3px)!important;
  z-index:20!important;
}
.t67-i2v-image-panel #t67ScenePreviews>.t67-vref-image:hover>.t67-vref-tools,
.t67-i2i-reference-item:hover>.t67-ict-tools{
  opacity:1!important;
  pointer-events:auto!important;
  transform:none!important;
}
/* Keep every corner square. */
.t67-basic-page *, .t67-video-basic-page *{--t67-no-radius:0px;}
.t67-basic-page .core-tabs a,.t67-video-basic-page .core-tabs a,
.t67-i2i-upload-panel,.t67-i2v-image-panel,.t67-i2i-reference-item,.t67-vref-image,
.t67-vref-tools button,.t67-ict-btn{border-radius:0!important;}


/* Mobile final spacing / compact tabs */
@media(max-width:720px){
  .t67-basic-page>.core-tabs,
  .t67-video-basic-page>.core-tabs{
    width:100%!important;
    max-width:100%!important;
    justify-content:stretch!important;
    gap:2px!important;
    margin-bottom:14px!important;
    overflow:visible!important;
  }
  .t67-basic-page>.core-tabs a,
  .t67-video-basic-page>.core-tabs a{
    flex:1 1 25%!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    height:31px!important;
    min-height:31px!important;
    padding:0 2px!important;
    font-size:9.5px!important;
    line-height:1!important;
  }

  /* Keep the vertical rhythm around 20px on every basic page. */
  .t67-basic-page>.fr-tool + .fr-tool,
  .t67-video-basic-root>.fr-tool + .fr-tool{
    margin-top:20px!important;
  }
  .t67-i2i-composer,
  .t67-i2v-composer{
    row-gap:20px!important;
    margin-bottom:0!important;
  }
  .t67-i2i-workspace + .fr-api-settings,
  .t67-i2v-reference-row + .fr-api-settings,
  .t67-video-basic-page .fr-api-settings{
    margin-top:20px!important;
  }
  .t67-i2v-reference-row{
    margin-top:8px!important;
    margin-bottom:0!important;
  }

  /* Image-to-video: explicit breathing room between upload and prompt blocks. */
  .t67-i2v-composer > .t67-i2v-reference-column{
    margin-bottom:0!important;
  }
  .t67-i2v-composer > .t67-i2v-prompt{
    margin-top:0!important;
  }

  /* Image-to-image: reduce excessive inherited spacing. */
  .t67-i2i-upload-meta{
    display:none!important;
  }
  .t67-i2i-settings{
    margin-top:20px!important;
  }

  /* Mobile settings stay 2 per row with the same compact spacing. */
  .t67-basic-page .core-compact-toolbar,
  .t67-video-basic-settings .t67-vscene-row,
  .t67-video-basic-settings #t67SceneSpecific .t67-vscene-row{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }
}
