.animate-preview__output-head > div > div { display: flex; flex-direction: column; gap: 2px; }
.animate-preview .neuro-preview__top-generate.is-floating { position: fixed; z-index: 80; top: 18px; right: max(24px,calc((100vw - 1600px)/2 + 24px)); animation: animate-top-generate-in .24s ease both; }
body.admin-bar .animate-preview .neuro-preview__top-generate.is-floating { top: 50px; }
.animate-preview__output-head small { color: #8b858b; font-size: 12px; font-weight: 500; }
.animate-preview .ramka_rez { border: 0 !important; background: transparent; overflow: visible; }
.animate-preview .video-root { padding: 0; border: 0 !important; background: transparent; overflow: visible; }
.animate-preview .video-container { border: 0 !important; background: transparent; }
.animate-preview .video-wrapper { border: 0 !important; overflow: visible; }
.animate-preview #result-wrapper { min-height: 527px; }
.animate-preview__upload-wrap { position: relative; width: 100%; min-width: 0; min-height: 527px; margin: 0; }
.animate-preview__upload { position: relative; display: flex; width: 100%; height: 100%; min-height: 527px; align-items: center; justify-content: center; overflow: hidden; border: 0 !important; border-radius: 24px; background: radial-gradient(circle at 50% 46%,#fff7eb 0,#fffaf5 32%,#f8f6f3 76%); box-shadow: inset 0 0 0 1px rgba(70,50,35,.05),0 16px 46px rgba(72,45,24,.08); cursor: pointer; transition: background .25s ease,box-shadow .25s ease,transform .25s ease; }
.animate-preview__upload::before { position: absolute; inset: 0; border: 2px dashed transparent; border-radius: inherit; content: ""; pointer-events: none; transition: border-color .2s ease,background .2s ease; }
.animate-preview__upload:hover { background: radial-gradient(circle at 50% 46%,#fff0dc 0,#fff9f1 38%,#f8f6f3 78%); box-shadow: inset 0 0 0 1px rgba(242,116,18,.13),0 20px 52px rgba(124,69,22,.13); }
.animate-preview__upload.drag-over { transform: scale(.992); }
.animate-preview__upload.drag-over::before { border-color: #ff7a0b; background: rgba(255,137,28,.055); }
.animate-preview__upload-empty { position: relative; z-index: 1; display: flex; min-width: min(360px,78%); flex-direction: column; align-items: center; padding: 27px 38px 25px; border-radius: 22px; background: linear-gradient(135deg,#ff8b20,#f56b00); box-shadow: 0 17px 35px rgba(230,96,0,.27),0 4px 10px rgba(107,52,8,.12); text-align: center; transition: transform .25s ease,box-shadow .25s ease; }
.animate-preview__upload:hover .animate-preview__upload-empty { box-shadow: 0 22px 44px rgba(230,96,0,.35),0 6px 14px rgba(107,52,8,.14); transform: translateY(-5px) scale(1.018); }
.animate-preview__upload-empty .neuro-upload-slot__icon-stack { width: 66px; height: 60px; margin-bottom: 10px; transform: none; animation: animate-upload-icon 2s ease-in-out infinite; }
.animate-preview__upload-empty .neuro-upload-slot__icon { width: 58px; height: 58px; filter: brightness(0) invert(1); }
.animate-preview__upload-empty .neuro-upload-slot__arrow { right: -2px; bottom: -2px; width: 27px; height: 27px; border: 2px solid #ff8120; background: #fff; color: #f5740b; font-size: 19px; }
.animate-preview__upload-empty strong { margin-top: 5px; color: #fff; font-size: 22px; line-height: 1.25; }
.animate-preview__upload-empty > span:last-child { margin-top: 5px; color: rgba(255,255,255,.82); font-size: 14px; }
.animate-preview__upload .photo-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #f4f1ee; }
.animate-preview__upload .photo-preview[style*="display: block"] { animation: animate-photo-reveal .48s cubic-bezier(.22,.8,.32,1) both; }
.animate-preview__upload .file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.animate-preview .processing-message { position: absolute; z-index: 8; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 17px; border-radius: 24px; background: rgba(255,250,244,.94); color: #4b4542; font-size: 17px; font-weight: 700; backdrop-filter: blur(8px); }
.animate-preview .processing-message::before { width: 52px; height: 52px; border: 5px solid #ffe0bf; border-top-color: #fa7810; border-radius: 50%; content: ""; animation: animate-upload-spin .85s linear infinite; }
.animate-preview__retry { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; margin: 18px auto 0; padding: 12px 24px; border: 0; border-radius: 14px; background: linear-gradient(135deg,#ff8b20,#f56b00); box-shadow: 0 12px 26px rgba(230,96,0,.25); color: #fff; font-size: 16px; font-weight: 750; cursor: pointer; transition: transform .2s ease,box-shadow .2s ease; }
.animate-preview__retry[hidden] { display: none !important; }
.animate-preview__retry:hover { box-shadow: 0 16px 34px rgba(230,96,0,.34); transform: translateY(-2px); }
.animate-preview__retry:focus-visible { outline: 3px solid rgba(255,132,26,.24); outline-offset: 3px; }
.animate-preview__upload-wrap #foto-del { z-index: 5; top: 9px; right: 9px; width: 42px; height: 42px; padding: 11px; border: 0; border-radius: 50%; background: #f58219 !important; box-shadow: 0 5px 14px rgba(0,0,0,.18); transition: background .2s ease,box-shadow .2s ease,transform .2s ease; }
.animate-preview__upload-wrap #foto-del:hover { background: #ff9a3b !important; box-shadow: 0 8px 19px rgba(225,101,0,.3); transform: translateY(-1px); }
.animate-preview__upload-wrap #foto-del img { width: 100%; height: 100%; border: 0; background: transparent; filter: brightness(0) invert(1); opacity: 1; }
.animate-preview__upload-wrap #foto-del:hover img { filter: brightness(0) invert(1); opacity: 1; }
.animate-preview #nastroyki { display: block !important; }
.animate-preview__restore-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid #ece5df; border-radius: 15px; background: #faf8f6; }
.animate-preview__restore-row > div:first-child { display: flex; min-width: 0; flex-direction: column; }
.animate-preview__restore-row strong { color: #3d3d44; font-size: 15px; }
.animate-preview__restore-row span { color: #8b858b; font-size: 12px; }
.animate-preview__restore-cost { display: flex; align-items: center; gap: 4px; color: #e96800; }
.animate-preview__restore-cost[hidden] { display: none !important; }
.animate-preview__restore-cost img { width: 22px; height: 22px; }
.animate-preview__selects { display: grid; gap: 10px; margin-top: 12px; }
.animate-preview__selects label { display: grid; grid-template-columns: 92px minmax(0,1fr); align-items: center; gap: 10px; color: #6f6971; font-size: 13px; font-weight: 700; }
.animate-preview__selects .select-field { width: 100%; min-height: 47px; margin: 0; padding: 9px 38px 9px 12px; border: 1px solid #ddd8d3; border-radius: 13px; background-color: #fff; color: #3d3d44; font-size: 15px; }
.animate-preview__selects .animate-select__native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0); white-space: nowrap; opacity: 0; pointer-events: none; }
.animate-select { position: relative; min-width: 0; }
.animate-select__trigger { display: flex; width: 100%; min-height: 49px; align-items: center; justify-content: space-between; gap: 15px; padding: 10px 14px 10px 16px; border: 1px solid #ddd6d0; border-radius: 14px; background: linear-gradient(180deg,#fff,#fdfbf9); box-shadow: 0 3px 9px rgba(74,49,28,.035); color: #3d3d44; font: inherit; font-size: 15px; font-weight: 650; text-align: left; cursor: pointer; transition: border-color .2s ease,box-shadow .2s ease,transform .2s ease; }
.animate-select__trigger:hover { border-color: #ff9a46; box-shadow: 0 7px 18px rgba(238,112,11,.12); }
.animate-select__trigger:focus-visible { outline: 3px solid rgba(255,132,26,.2); outline-offset: 2px; }
.animate-select__trigger i { width: 10px; height: 10px; flex: 0 0 10px; border-right: 2px solid #77716e; border-bottom: 2px solid #77716e; transform: rotate(45deg) translate(-2px,-2px); transition: transform .2s ease; }
.animate-select.is-open .animate-select__trigger { border-color: #f57a12; box-shadow: 0 8px 24px rgba(238,112,11,.17); }
.animate-select.is-open .animate-select__trigger i { transform: rotate(225deg) translate(-1px,-1px); }
.animate-select__menu { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; left: 0; display: grid; gap: 4px; padding: 7px; visibility: hidden; border: 1px solid rgba(223,211,201,.9); border-radius: 16px; background: rgba(255,255,255,.97); box-shadow: 0 18px 45px rgba(62,40,21,.17); opacity: 0; transform: translateY(-7px) scale(.985); transform-origin: top; pointer-events: none; backdrop-filter: blur(14px); transition: opacity .17s ease,transform .17s ease,visibility .17s ease; }
.animate-select.is-open .animate-select__menu { visibility: visible; opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.animate-select__option { display: flex; width: 100%; min-height: 43px; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px 9px 13px; border: 0; border-radius: 11px; background: transparent; color: #464044; font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; transition: color .15s ease,background .15s ease,transform .15s ease; }
.animate-select__option:hover,.animate-select__option:focus-visible { outline: 0; background: #fff2e4; color: #e96800; transform: translateX(2px); }
.animate-select__option i { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; border-radius: 50%; background: #f57a12; color: #fff; font-size: 13px; font-style: normal; opacity: 0; transform: scale(.7); transition: opacity .15s ease,transform .15s ease; }
.animate-select__option.is-selected { background: #fff7ee; color: #e96800; }
.animate-select__option.is-selected i { opacity: 1; transform: scale(1); }
.animate-preview .video-root { grid-template-columns: 1fr; }
.animate-preview .download-button.new1 { position: static; width: 100%; margin: 10px 0 0; }
.animate-preview__new-generation { display: flex; width: 100%; min-height: 56px; align-items: center; justify-content: center; gap: 9px; margin: 10px 0 0; padding: 12px 20px; border: 2px solid #f58219; border-radius: 15px; background: #fff; color: #e96800; font-size: 17px; font-weight: 750; cursor: pointer; transition: color .2s ease,background .2s ease,box-shadow .2s ease,transform .2s ease; }
.animate-preview__new-generation span { font-size: 25px; font-weight: 400; line-height: 1; }
.animate-preview__new-generation:hover { background: #fff5e9; box-shadow: 0 10px 24px rgba(235,105,0,.15); transform: translateY(-2px); }
.animate-preview__new-generation:focus-visible { outline: 3px solid rgba(255,132,26,.22); outline-offset: 3px; }
.animate-preview__login { text-decoration: none; }
.animate-preview .login-btn { margin-left: 0; margin-right: 0; }
.animate-preview.is-guest-preview.has-uploaded-photo .neuro-preview__guest-login { display: flex; }
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .animate-preview__output-head > span { display: none; }

/* Guest entry point: neuro-preview.css hides its workspace until a different
   upload component is populated. The Animate tool owns its uploader, so keep
   this scene visible from the very first render. */
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .neuro-preview__workspace {
  display: block !important;
  max-width: 820px;
  margin: 0 auto;
}
.animate-preview.is-guest-preview:not(.has-uploaded-photo) #nastroyki {
  display: none !important;
}
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .neuro-preview__mobile-flow,
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .neuro-preview__top-generate,
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .animate-preview__output-head {
  display: none !important;
}
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .neuro-preview__output {
  display: block !important;
  position: static;
  min-height: 0;
}
/* One white card, then one gray drop surface. The orange contour belongs to
   that gray surface, not to an extra nested upload card. */
.animate-preview.is-guest-preview:not(.has-uploaded-photo) #result-wrapper {
  background: #f4f1ee;
  box-shadow: inset 0 0 0 2px #f58219;
  border-radius: 24px !important;
  overflow: hidden !important;
}
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .animate-preview__upload-wrap,
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .animate-preview__upload {
  border-radius: 24px !important;
  overflow: hidden !important;
}
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .animate-preview__upload {
  border: 0 !important;
  background: transparent;
  box-shadow: none;
}
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .animate-preview__upload::before { border: 0; }
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .animate-preview__upload:hover,
.animate-preview.is-guest-preview:not(.has-uploaded-photo) .animate-preview__upload.drag-over {
  background: rgba(255,137,28,.035);
  box-shadow: inset 0 0 0 1px rgba(245,130,25,.18);
}
.animate-preview:has(.animate-preview__upload.is-preparing) .neuro-preview__output {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.animate-preview:has(.animate-preview__upload.is-preparing) #result-wrapper,
.animate-preview .animate-preview__upload.is-preparing {
  background: #fffaf4;
  box-shadow: none !important;
}
.animate-preview .animate-preview__upload.is-preparing {
  border: 0 !important;
  cursor: wait;
}
.animate-preview .animate-preview__upload.is-preparing::before { border: 0; background: transparent; }
.animate-preview .animate-preview__upload.is-preparing .processing-message {
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.animate-preview.is-guest-preview.has-uploaded-photo .neuro-preview__workspace {
  display: grid !important;
  max-width: none;
  margin: 0;
}
.animate-preview.is-guest-preview.has-uploaded-photo .neuro-preview__output {
  display: block !important;
}
.animate-preview.is-guest-preview .animate-preview__upload-wrap,
.animate-preview.is-guest-preview .animate-preview__upload {
  display: flex !important;
}

@media (min-width: 841px) {
  /* Держим правую сцену примерно в высоте колонки настроек. */
  .animate-preview #result-wrapper {
    display: flex;
    height: clamp(520px,62vh,650px);
    min-height: 0;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 24px;
    background: #f4f1ee;
  }
  .animate-preview__upload-wrap,
  .animate-preview__upload { height: 100%; min-height: 0; }
  .animate-preview #result-wrapper > img,
  .animate-preview #result-wrapper > video {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
  }
}

/* Uploaded source: the image itself is the card. Do not keep a second canvas,
   gray side bars, or a result frame around it. */
.animate-preview.has-uploaded-photo .neuro-preview__output {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.animate-preview #result-wrapper.has-source-photo {
  width: min(100%, calc(70svh * var(--source-ratio, 1)));
  height: auto;
  min-height: 0;
  aspect-ratio: var(--source-ratio, 1);
  max-height: 70svh;
  margin: 0 auto;
  background: transparent;
  box-shadow: none !important;
  overflow: visible !important;
}
.animate-preview #result-wrapper.has-source-photo .animate-preview__upload-wrap,
.animate-preview #result-wrapper.has-source-photo .animate-preview__upload {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0 !important;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
  overflow: visible !important;
}
.animate-preview #result-wrapper.has-source-photo .photo-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background: transparent;
  box-shadow: 0 12px 30px rgba(48,32,19,.16);
  object-fit: contain;
}
.animate-preview #result-wrapper.has-source-photo #foto-del {
  top: 12px;
  right: 12px;
}

@keyframes animate-upload-icon { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes animate-upload-spin { to { transform: rotate(360deg); } }
@keyframes animate-photo-reveal { from { opacity: 0; transform: scale(.975); filter: blur(5px); } to { opacity: 1; transform: scale(1); filter: blur(0); } }
@keyframes animate-top-generate-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes animate-settings-attention { 0%,100% { border-color: #ece8e3; box-shadow: 0 18px 60px rgba(76,48,25,.08); } 28%,72% { border-color: #f58a2a; box-shadow: 0 0 0 6px rgba(245,130,25,.14),0 20px 54px rgba(232,105,0,.18); } }
.animate-preview .neuro-preview__controls.is-attention { animation: animate-settings-attention 1.9s ease-in-out both; }

@media (prefers-reduced-motion: reduce) {
  .animate-preview__upload-empty .neuro-upload-slot__icon-stack,.animate-preview .processing-message::before { animation: none; }
}

@media (max-width: 840px) {
  .animate-preview.is-guest-preview.has-uploaded-photo .neuro-preview__workspace {
    display: flex !important;
  }
  .animate-preview[data-mobile-step="photos"] .neuro-preview__workspace { display: flex; }
  .animate-preview[data-mobile-step="photos"] .neuro-preview__controls { display: none; }
  .animate-preview[data-mobile-step="photos"] .neuro-preview__output { display: block; }
  .animate-preview[data-mobile-step="settings"] .neuro-preview__workspace { display: flex; }
  .animate-preview[data-mobile-step="settings"] .neuro-preview__controls { display: block; }
  .animate-preview[data-mobile-step="settings"] .neuro-preview__output { display: none; }
  .animate-preview[data-mobile-step="result"] .neuro-preview__workspace { display: flex; }
  .animate-preview[data-mobile-step="result"] .neuro-preview__controls { display: none; }
  .animate-preview[data-mobile-step="result"] .neuro-preview__output { display: block; }
  .animate-preview #result-wrapper, .animate-preview__upload-wrap, .animate-preview__upload { min-height: 442px; }
  /* Once the source is ready, the preview frame follows the image ratio instead
     of keeping an empty fixed-height canvas above and below it. */
  .animate-preview .video-root { padding: 0; }
  .animate-preview__selects label { grid-template-columns: 1fr; gap: 5px; }
  .animate-preview__restore-row { grid-template-columns: 1fr auto; }
  .animate-preview__restore-row .draggable-toggle-container { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 520px) {
  .animate-preview #result-wrapper, .animate-preview__upload-wrap, .animate-preview__upload { min-height: 390px; }
  .animate-preview #result-wrapper.has-source-photo,
  .animate-preview #result-wrapper.has-source-photo .animate-preview__upload-wrap,
  .animate-preview #result-wrapper.has-source-photo .animate-preview__upload { min-height: 0; }
  .animate-preview__output-head > span { display: none; }
  .animate-preview__upload-empty { min-width: 86%; padding: 28px 20px; }
  .animate-preview__upload-empty strong { font-size: 18px; }
  .animate-preview__restore-row { padding: 12px; }
}
