/* Render download completion feedback for desktop/Tauri WebView */
.studio-download-card {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10050;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(380px, calc(100vw - 32px));
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: rgba(18, 24, 38, 0.96);
  color: #f8fafc;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: translateY(12px);
  opacity: 0;
  animation: studioDownloadCardIn 240ms ease forwards;
}

.studio-download-card.is-hit {
  animation: studioDownloadCardHit 420ms ease;
}

.studio-download-card.is-fading {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 260ms ease, transform 260ms ease;
}

.studio-download-card__icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
}

.studio-download-card__icon svg {
  width: 22px;
  height: 22px;
}

.studio-download-card__body {
  min-width: 0;
  flex: 1;
}

.studio-download-card__title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.studio-download-card__name {
  margin-top: 3px;
  color: #cbd5e1;
  font-size: 15px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-download-card__meta {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 14px;
  min-height: 14px;
}

.studio-download-card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.studio-download-card__button,
.studio-download-card__close {
  height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  font-size: 15px;
  cursor: pointer;
}

.studio-download-card__button {
  padding: 0 10px;
}

.studio-download-card__close {
  width: 28px;
  padding: 0;
}

.studio-download-card__button:hover,
.studio-download-card__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.studio-render-complete-note {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 12px;
  padding: 9px 10px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.09);
  color: var(--text-primary, #f5f5f5);
  text-align: left;
  box-sizing: border-box;
}

.studio-render-complete-note__check {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

.studio-render-complete-note strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
}

.studio-render-complete-note small {
  display: block;
  margin-top: 2px;
  color: var(--text-tertiary, #94a3b8);
  font-size: 14px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-download-flyer {
  position: fixed;
  z-index: 10049;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 14px 38px rgba(37, 99, 235, 0.42);
  pointer-events: none;
  animation: studioDownloadFly 760ms cubic-bezier(.22, .9, .24, 1) forwards;
}

.studio-download-flyer svg {
  width: 20px;
  height: 20px;
}

@keyframes studioDownloadCardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes studioDownloadCardHit {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(0) scale(1.035); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes studioDownloadFly {
  0% { opacity: 0; transform: translate3d(0, 0, 0) scale(.7); }
  12% { opacity: 1; }
  72% { opacity: 1; transform: translate3d(calc(var(--download-fly-x) * .88), calc(var(--download-fly-y) - 28px), 0) scale(.92); }
  100% { opacity: 0; transform: translate3d(var(--download-fly-x), var(--download-fly-y), 0) scale(.45); }
}

@media (max-width: 640px) {
  .studio-download-card {
    right: 12px;
    left: 12px;
    bottom: 14px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .studio-download-card,
  .studio-download-card.is-hit,
  .studio-download-flyer {
    animation: none;
  }

  .studio-download-card {
    opacity: 1;
    transform: none;
  }
}

/* ═══ 렌더링 진행 모달 (ttsRenderModal) ═══
   포스터(첫 클립 썸네일) + 진행률 오버레이 + 완료 시 재생/폴더/다운로드 액션 */
.render-modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 16, 0.72);
  backdrop-filter: blur(6px);
}

.render-modal {
  width: min(420px, calc(100% - 40px));
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, #161a24 0%, #10131b 100%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.render-modal__poster {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0a0c12;
}

.render-modal__poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.render-modal__poster-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  opacity: 0.45;
}

.render-modal__poster-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 12, 18, 0.05) 40%, rgba(10, 12, 18, 0.82) 100%);
  pointer-events: none;
}

.render-modal__poster-info {
  position: absolute;
  left: 16px;
  bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.render-modal__percent {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f8fafc;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.render-modal__body {
  padding: 16px 20px 18px;
}

.render-modal__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 4px;
}

.render-modal__status {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-bottom: 12px;
  min-height: 1.1em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.render-modal__bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
  margin-bottom: 16px;
}

.render-modal__bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #dc2626, #f97316);
  transition: width 0.3s ease;
}

.render-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.render-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.10);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.render-btn:hover {
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(148, 163, 184, 0.4);
}

.render-btn:active {
  transform: translateY(1px);
}

.render-btn--primary {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

.render-btn--primary:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.render-btn--ghost {
  background: transparent;
}
