/* Only V3 uses this dialog; the existing homepage composer retains its draft. */
body.v3-home-page .case-browser .case-remix-button {
  width: calc(100% - 32px * var(--case-remix-scale, 1)); height: calc(38px * var(--case-remix-scale, 1));
  bottom: calc(14px * var(--case-remix-scale, 1)); padding: 0; border: 1px solid #ffffff26;
  border-radius: 10px; background: #212225bd;
  font-size: calc(14px * var(--case-remix-scale, 1)); backdrop-filter: blur(14px);
  transform: translate(-50%, 8px); transition: opacity .2s, transform .2s, background .2s;
}
body.v3-home-page .case-browser .case-result { --case-remix-scale: 1; }
body.v3-home-page .case-browser :is(.scene-tile,.photo-tile,.portrait-tile,.shortform-tile,.shortform-feature,.case-result):is(:hover,:focus-within) > .case-remix-button { transform: translate(-50%,0); }
body.v3-home-page .case-browser .case-remix-button:hover { background: #ffffff38; }
.case-remix-dialog {
  --remix-border: #ffffff16; --remix-muted: #91939d; color-scheme: dark;
  position: fixed; inset: 0; margin: auto; padding: 0; border: 1px solid #ffffff1c; border-radius: 10px;
  width: min(1080px, calc(100vw - var(--sidebar-width, 210px) - 64px)); max-width: none;
  height: min(728px, calc(100vh - 112px)); max-height: none;
  transform: translateX(calc(var(--sidebar-width, 210px) / 2)); background: #18191d; color: #f4f4f6;
  font: 400 14px/1.5 var(--font-ui, sans-serif); box-shadow: 0 32px 100px #0009;
}
.case-remix-dialog::backdrop { background: #0009; backdrop-filter: blur(9px); }
.case-remix-dialog * { box-sizing: border-box; }
.case-remix-dialog [hidden] { display: none !important; }
.case-remix-dialog button,.case-remix-dialog select,.case-remix-dialog textarea,.case-remix-dialog input { font: inherit; color: inherit; }
.case-remix-dialog button { cursor: pointer; }
.case-remix-dialog button:disabled { cursor: default; opacity: .42; }
.case-remix-dialog :is(button,input,select,textarea):focus-visible { outline: 2px solid #80aaff; outline-offset: 3px; }
.remix-layout { display: grid; grid-template-columns: 42% 58%; grid-template-rows: minmax(0, 1fr); height: 100%; }
.remix-preview { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; overflow: hidden; padding: 30px; background: radial-gradient(ellipse at top, #30333b 0%, #1e2026 70%); border-right: 1px solid var(--remix-border); }
.remix-preview-media { display: flex; width: 100%; height: 100%; min-height: 0; align-items: center; justify-content: center; }
.remix-preview-media :is(img,video) { width: auto; height: auto; max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; border-radius: 10px; }
.remix-preview-badge { position: absolute; top: 20px; left: 22px; padding: 5px 10px; border-radius: 10px; background: #18191dbe; color: #ddd; font-size: 12px; backdrop-filter: blur(12px); pointer-events: none; }
.remix-form { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.remix-header { flex-shrink: 0; display: flex; align-items: flex-start; gap: 12px; padding: 28px 30px 20px; }
.remix-header h2 { font-size: 22px; font-weight: 600; margin: 0; line-height: 1.4; }
.remix-header p { color: var(--remix-muted); margin: 5px 0 0; font-size: 12px; }
.remix-close { flex: none; margin: -6px -9px 0 auto; border: 0; background: #ffffff09; border-radius: 50%; width: 32px; height: 32px; font-size: 24px !important; line-height: 1 !important; color: #aaa !important; }
.remix-body { padding: 0 30px 20px; overflow-y: auto; scrollbar-width: thin; flex: 1; }
.remix-mode { display: flex; gap: 6px; padding: 4px; background: #101114; border-radius: 10px; margin-bottom: 20px; }
.remix-mode button { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 10px; color: #989aa3; font-size: 12px; }
.remix-mode button[aria-pressed=true] { background: #34363e; color: #fff; }
.remix-slots { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: 22px; }
.remix-slot { min-width: 0; }
.remix-slot-header { display: flex; align-items: center; gap: 5px; margin-bottom: 8px; font-size: 13px; }
.remix-slot-header em { font-size: 10px; font-style: normal; color: #aaa; }
.remix-slot-header em.required { color: #a8bfff; }
.remix-slot-header small { margin-left: auto; color: var(--remix-muted); font-size: 11px; }
.remix-upload { height: 104px; width: 100%; border: 1px dashed #ffffff2b; border-radius: 10px; background: #ffffff03; color: var(--remix-muted) !important; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; font-size: 12px !important; }
.remix-upload span { font-size: 28px; font-weight: 300; line-height: 1.1; color: #d3d5dc; }
.remix-upload:hover,.remix-slot.is-dragging .remix-upload { border-color: #82a9ff; background: #7198ee0b; }
.remix-library-link { width: 100%; padding: 8px 0 0; background: none; border: 0; font-size: 11px !important; color: #a9abb5 !important; }
.remix-library-link:hover { color: #e4e9ff !important; }
.remix-thumbs { height: 104px; display: flex; gap: 5px; }
.remix-thumb { min-width: 0; flex: 1; position: relative; border-radius: 10px; overflow: hidden; background: #101114; }
.remix-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.remix-remove { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #000b; font-size: 15px !important; line-height: 1 !important; }
.remix-add { flex: 0 0 26px; border: 1px dashed #ffffff26; background: transparent; border-radius: 10px; font-size: 20px !important; }
.remix-description { display: block; font-size: 13px; }
.remix-description textarea { display: block; width: 100%; height: 92px; resize: vertical; max-height: 160px; padding: 12px; margin-top: 9px; border: 1px solid var(--remix-border); border-radius: 10px; background: #111216; font-size: 12px; line-height: 1.7; }
.remix-description textarea::placeholder { color: #72747e; }
.remix-params { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.remix-params label { display: flex; align-items: center; gap: 6px; color: #a5a7b0; font-size: 11px; }
.remix-params select { max-width: 150px; height: 32px; border-radius: 10px; border: 1px solid var(--remix-border); background: #25262c; font-size: 12px; padding: 0 6px; }
.remix-footer { flex-shrink: 0; border-top: 1px solid var(--remix-border); padding: 14px 30px 24px; }
.remix-status { min-height: 19px; font-size: 12px; color: #a4a7b2; margin: 0 0 10px; }
.remix-status.is-error { color: #ffb1ac; }
.remix-generate { width: 100%; height: 44px; border: 0; border-radius: 10px; background: #2c6ee9; color: #fff; font-weight: 600 !important; }
.remix-generate:disabled { background: #34363f; color: #b3b6c1; opacity: 1 !important; }
.remix-library { margin: -6px 0 20px; padding: 12px; border: 1px solid var(--remix-border); border-radius: 10px; background: #111216; }
.remix-library-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.remix-library-head strong { font-weight: 500; font-size: 13px; white-space: nowrap; }
.remix-library-head input { width: 100%; min-width: 0; padding: 5px 8px; background: #24252b; border: 1px solid var(--remix-border); border-radius: 10px; font-size: 12px; }
.remix-library-head button { border: 0; background: none; font-size: 20px; }
.remix-library-filters { display: flex; gap: 6px; margin: 0 0 10px; }
.remix-library-filters button { border: 1px solid var(--remix-border); border-radius: 10px; background: #22232a; padding: 3px 8px; font-size: 11px; color: #aaa; }
.remix-library-filters button[aria-pressed=true] { color: #b7cdff; border-color: #7198ee6b; }
.remix-library-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 7px; max-height: 210px; overflow: auto; }
.remix-library-grid button { position: relative; padding: 0; overflow: hidden; border: 1px solid transparent; border-radius: 10px; background: #222; aspect-ratio: 1; }
.remix-library-grid button[aria-pressed=true] { border: 2px solid #7da7ff; }
.remix-library-grid img { width: 100%; height: 100%; object-fit: cover; }
.remix-library-message { grid-column: 1/-1; font-size: 12px; color: #a2a4ae; padding: 12px 0; }
.remix-library-message button { aspect-ratio: auto; margin-left: 10px; color: #b7cdff; padding: 4px 10px; }
.remix-inspect { position: absolute; z-index: 5; inset: 0; padding: 40px; background: #101115f5; display: flex; align-items: center; justify-content: center; }
.remix-inspect img { width: 100%; height: 100%; object-fit: contain; }
.remix-inspect button { position: absolute; right: 20px; top: 15px; }
@media(prefers-reduced-motion:reduce) { body.v3-home-page .case-browser .case-remix-button { transition: none; } }

body.v3-home-page .case-browser .photo-row:focus-within .photo-track { animation-play-state: paused; }

/* Simplified case remix controls. Keep error and task status visible. */
.remix-status:not(.is-error) { display: none; }
.remix-description textarea { margin-top: 0; }

/* Keep output options above the generation action. */
.remix-body { display: flex; flex-direction: column; }
.remix-body > * { flex-shrink: 0; }
.remix-params { margin-top: auto; padding-top: 24px; gap: 20px; }
.remix-params label { gap: 10px; font-size: 14px; }
.remix-params select { height: 42px; min-width: 88px; max-width: 180px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
/* Balanced reference layout with a subtle dotted preview surface. */
.remix-layout { grid-template-columns: 1fr 1fr; }
.remix-preview {
  padding: 20px 36px;
  border-right: 0;
  background-color: #24262c;
  background-image: radial-gradient(circle, #ffffff24 .8px, transparent 1px);
  background-size: 18px 18px;
}
.remix-preview-media :is(img,video) { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.remix-form { background: #18191d; border-radius: 10px 0 0 10px; }
.remix-header { padding: 30px 30px 24px; }
.remix-slots { gap: 12px; margin-bottom: 28px; }
.remix-slot-header { margin-bottom: 10px; font-size: 14px; }
.remix-upload,.remix-thumbs { height: 124px; }
.remix-upload { background: #ffffff04; font-size: 13px !important; gap: 8px; }
.remix-description textarea { height: 160px; max-height: 220px; background: #22242a; padding: 14px; font-size: 13px; }
.remix-footer { border-top: 0; padding: 12px 30px 20px; }
@media (max-width: 800px) {
  .remix-preview { padding: 16px; }
  .remix-header { padding: 22px 18px 20px; }
  .remix-body { padding-left: 18px; padding-right: 18px; }
  .remix-footer { padding-left: 18px; padding-right: 18px; }
  .remix-slots { gap: 8px; }
  .remix-upload,.remix-thumbs { height: 104px; }
}
/* A single animated dot canvas spans the complete remix card. */
.case-remix-dialog { isolation: isolate; overflow: hidden; background: #24262c; }
.remix-preview { background: transparent; }
.remix-form { background: transparent; }
/* Output settings use the saved defaults without visible controls. */
.remix-params { display: none; }

/* Clip the rendered media itself, including object-fit letterboxing. */
.case-remix-dialog .remix-preview-media { border-radius: 10px; overflow: hidden; }
.case-remix-dialog .remix-preview-media :is(img,video) { border-radius: 10px; clip-path: inset(0 round 10px); width: auto; height: auto; max-width: 100%; max-height: 100%; }

/* Keep the description input neutral while editing. */
.case-remix-dialog .remix-description textarea:is(:focus,:focus-visible) { outline: none; box-shadow: none; border-color: var(--remix-border); }

/* Compact video transport, aligned to the actual video frame. */
.case-remix-dialog .remix-video-player { position: relative; flex: none; overflow: hidden; border-radius: 10px; background: #000; }
.case-remix-dialog .remix-video-player video { display: block; width: 100%; height: 100%; border-radius: inherit; }
.remix-video-controls { position: absolute; inset: auto 0 0; display: flex; align-items: center; gap: 8px; padding: 26px 12px 12px; background: linear-gradient(transparent, #000b); color: #ddd; }
.remix-video-controls button { flex: 0 0 18px; width: 18px; height: 22px; padding: 0; border: 0; background: none; display: grid; place-items: center; }
.remix-video-controls button:hover { color: #fff; }
.remix-video-controls svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.remix-video-controls input[type=range] { flex: 1; min-width: 0; height: 4px; padding: 0; margin: 0; border: 0; border-radius: 10px; appearance: none; -webkit-appearance: none; cursor: pointer; background: linear-gradient(to right, #ddd var(--played, 0%), #ffffff55 var(--played, 0%)); }
.remix-video-controls input[type=range]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border: 0; border-radius: 50%; background: #ddd; }
.remix-video-controls input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #ddd; }

/* Original image loading stays local to the case preview. */
.case-remix-dialog .remix-preview-media{position:relative}
.remix-preview-status{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);display:flex;align-items:center;gap:10px;max-width:calc(100% - 24px);padding:7px 12px;border:1px solid #ffffff20;border-radius:10px;background:#191c23e6;color:#d6dbe5;font-size:12px;white-space:nowrap}
.remix-preview-status button{padding:0;border:0;background:none;color:#a8cfff;text-decoration:underline}
