/* 客製化補強 Tailwind 之外的細節 */

/* 滾動條美化（桌面） */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: #d8b4fe;
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  ::-webkit-scrollbar-thumb:hover { background: #a855f7; background-clip: padding-box; border: 2px solid transparent; }
}

/* time slider 加粗 */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 9999px;
  background: linear-gradient(to right, #e9d5ff, #fbcfe8);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(168, 85, 247, .4);
  border: 3px solid white;
}
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(168, 85, 247, .4);
}

/* drop zone hover */
#drop-zone-inner.dragover {
  background-color: #e9d5ff !important;
  border-color: #7c3aed !important;
  transform: scale(1.01);
  transition: all .15s;
}

/* style chips */
.style-chip {
  cursor: pointer;
  user-select: none;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  transition: all .15s ease;
  position: relative;
}
.style-chip:hover {
  border-color: #c084fc;
  background: #faf5ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -8px rgba(168, 85, 247, .35);
}
.style-chip.selected {
  border-color: #9333ea;
  background: linear-gradient(135deg, #faf5ff, #fdf2f8);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, .12);
}
.style-chip.selected::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  width: 18px;
  height: 18px;
  background: #9333ea;
  color: white;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.style-chip-emoji { font-size: 28px; line-height: 1; }
.style-chip-label { font-size: 12px; font-weight: 700; color: #475569; line-height: 1.3; }
.style-chip.selected .style-chip-label { color: #6b21a8; }

/* result card */
.result-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
}
.result-card-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: white;
}
.result-card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 12px; font-size: 13px; line-height: 1.65; color: #334155; }
.result-card-section-title { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }
.scene-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 8px;
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 12px;
}
.scene-row .time { font-weight: 800; color: #7c3aed; }
.scene-row .desc { color: #475569; }

.prompt-block {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: #334155;
  line-height: 1.7;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid #e2e8f0;
}

.copy-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all .15s;
}
.copy-btn:hover { border-color: #a855f7; color: #7c3aed; background: #faf5ff; }
.copy-btn.copied { border-color: #10b981; color: #059669; background: #ecfdf5; }

/* color themes for each style header */
.theme-cinematic    { background: linear-gradient(135deg, #1e293b, #475569); }
.theme-suno_mv      { background: linear-gradient(135deg, #be185d, #f472b6); }
.theme-storyboard_kid { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.theme-anime_jp     { background: linear-gradient(135deg, #db2777, #f9a8d4); }
.theme-cyberpunk    { background: linear-gradient(135deg, #6d28d9, #06b6d4); }
.theme-ghibli       { background: linear-gradient(135deg, #16a34a, #fde68a); color: #1e3a8a; }
.theme-documentary  { background: linear-gradient(135deg, #57534e, #a8a29e); }
.theme-kpop_mv      { background: linear-gradient(135deg, #ec4899, #f97316); }

/* toast animation */
#toast.show {
  animation: toastSlide .25s ease;
}
@keyframes toastSlide {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* skeleton when generating */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9);
  background-size: 200% 100%;
  animation: skel 1.4s infinite;
  border-radius: 8px;
}
@keyframes skel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   Merge 串接短片（ffmpeg.wasm 瀏覽器內處理）
   ============================================================ */

.merge-warn {
  font-size: 12px;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  padding: 10px 14px;
  color: #92400e;
  line-height: 1.5;
}

.merge-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 16px;
  border: 2px dashed #d8b4fe;
  border-radius: 14px;
  background: linear-gradient(135deg, #faf5ff, #fdf2f8);
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.merge-drop-zone:hover { border-color: #a855f7; background: linear-gradient(135deg, #f3e8ff, #fce7f3); transform: translateY(-1px); }
.merge-drop-zone.dragover { border-color: #7c3aed; background: #e9d5ff; transform: scale(1.01); }
.merge-drop-icon { font-size: 36px; line-height: 1; }
.merge-drop-text { font-size: 14px; font-weight: 700; color: #6b21a8; }
.merge-drop-hint { font-size: 11px; color: #94a3b8; }

.merge-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.merge-file-list:empty { display: none; }

.merge-file-item {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: all .12s;
}
.merge-file-item:hover { border-color: #c084fc; background: #faf5ff; }

.merge-file-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: white;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.merge-file-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.merge-file-size {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

.merge-file-actions {
  display: flex;
  gap: 4px;
}
.merge-file-actions button {
  width: 26px;
  height: 26px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  transition: all .12s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.merge-file-actions button:hover { border-color: #a855f7; color: #7c3aed; background: #faf5ff; }
.merge-file-actions button[data-remove]:hover { border-color: #ef4444; color: #ef4444; background: #fef2f2; }

.merge-actions {
  display: flex;
  gap: 8px;
}
.merge-btn-primary {
  flex: 1;
  padding: 12px 16px;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  color: white;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s;
  font-size: 14px;
}
.merge-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9, #db2777);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px rgba(124, 58, 237, .55);
}
.merge-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.merge-btn-secondary {
  padding: 12px 16px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  color: #64748b;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.merge-btn-secondary:hover { border-color: #ef4444; color: #ef4444; }

#merge-progress {
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
}
.merge-phase {
  font-size: 13px;
  font-weight: 700;
  color: #6b21a8;
  margin-bottom: 8px;
}
.merge-progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}
.merge-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #a855f7, #ec4899, #f59e0b);
  background-size: 200% 100%;
  animation: streaming-bar-shift 2s ease-in-out infinite;
  width: 0%;
  transition: width .25s ease-out;
}
.merge-log {
  font-family: 'Courier New', monospace;
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#merge-result {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 14px;
}
.merge-video-preview {
  width: 100%;
  border-radius: 10px;
  background: black;
  aspect-ratio: 16 / 9;
}
.merge-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ============================================================
   PlatformLauncher — 一鍵跳到 AI 影片平台
   ============================================================ */

.platform-launcher {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.platform-launcher.hidden { display: none; }

.platform-launcher-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: share-fade-in .15s ease;
}

.platform-launcher-card {
  position: relative;
  background: white;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: share-slide-up .25s cubic-bezier(.2, .8, .3, 1);
}

.platform-launcher-header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #faf5ff, #fdf2f8);
}
.platform-launcher-header h3 {
  font-size: 15px;
  font-weight: 800;
  color: #6b21a8;
  margin: 0;
}
.platform-launcher-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 22px;
  color: #64748b;
  cursor: pointer;
  transition: background .15s;
}
.platform-launcher-close:hover { background: rgba(255,255,255,.6); color: #1e293b; }

.platform-launcher-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.platform-launcher-hint {
  font-size: 12.5px;
  color: #475569;
  background: #f8fafc;
  border-left: 3px solid #a855f7;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  line-height: 1.55;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 640px) {
  .platform-grid { grid-template-columns: repeat(4, 1fr); }
}

.platform-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  text-align: center;
}
.platform-card:hover {
  border-color: #a855f7;
  background: #faf5ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -8px rgba(168, 85, 247, .4);
}
.platform-card:active { transform: translateY(0); }

.platform-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 4px;
}

.platform-card-name {
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.2;
}

.platform-card-hint {
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.3;
}

.platform-card-lang {
  font-size: 9.5px;
  color: #a855f7;
  font-weight: 700;
  background: #f3e8ff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

.platform-prompt-preview {
  margin-top: 14px;
  border: 1px dashed #e2e8f0;
  border-radius: 10px;
}
.platform-prompt-preview summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  list-style: none;
}
.platform-prompt-preview summary::-webkit-details-marker { display: none; }
.platform-prompt-preview[open] summary { border-bottom: 1px dashed #e2e8f0; color: #7c3aed; }

.platform-prompt-body {
  padding: 12px 14px;
  background: #fafbff;
}
.platform-prompt-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

/* segment 內「跳到平台」按鈕 */
.btn-launch-platform {
  margin-top: 6px;
  width: 100%;
  padding: 8px 12px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: white;
  font-size: 12.5px;
  font-weight: 800;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-launch-platform:hover {
  background: linear-gradient(135deg, #9333ea, #db2777);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(168, 85, 247, .55);
}
.btn-launch-platform:active { transform: translateY(0); }

/* ============================================================
   ShareSheet — 一鍵分享到 X / FB / LINE / Threads / WhatsApp
   ============================================================ */

.share-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 640px) {
  .share-sheet { align-items: center; padding: 16px; }
}

.share-sheet.hidden { display: none; }

.share-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: share-fade-in .15s ease;
}

.share-sheet-card {
  position: relative;
  background: white;
  width: 100%;
  max-width: 440px;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  animation: share-slide-up .25s cubic-bezier(.2, .8, .3, 1);
}

@media (min-width: 640px) {
  .share-sheet-card { border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
}

@keyframes share-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes share-slide-up {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.share-sheet-header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
}
.share-sheet-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
}
.share-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 22px;
  color: #64748b;
  cursor: pointer;
  transition: background .15s;
}
.share-close:hover { background: #f1f5f9; color: #1e293b; }

.share-sheet-body {
  padding: 16px 20px 20px;
}

.share-sheet-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

.share-text {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.55;
  color: #1e293b;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.share-text:focus {
  outline: none;
  border-color: #a855f7;
  background: white;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, .15);
}

.share-platforms {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
@media (max-width: 380px) {
  .share-platforms { grid-template-columns: repeat(3, 1fr); }
}

.share-platform {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 6px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  cursor: pointer;
  transition: all .15s;
  min-height: 80px;
}
.share-platform:hover {
  border-color: #a855f7;
  background: #faf5ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -8px rgba(168, 85, 247, .35);
}
.share-platform.copied {
  border-color: #10b981;
  background: #ecfdf5;
}

.share-platform-icon {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: #1e293b;
}
.share-platform[data-platform="x"] .share-platform-icon { background: linear-gradient(135deg, #1e293b, #0f172a); color: white; }
.share-platform[data-platform="facebook"] .share-platform-icon { background: #e7f3ff; }
.share-platform[data-platform="line"] .share-platform-icon { background: #e6f9ec; }
.share-platform[data-platform="threads"] .share-platform-icon { background: linear-gradient(135deg, #1e293b, #4c1d95); color: white; }
.share-platform[data-platform="whatsapp"] .share-platform-icon { background: #e9fdf2; }
.share-platform[data-platform="webshare"] .share-platform-icon { background: linear-gradient(135deg, #a855f7, #ec4899); color: white; }

.share-platform-label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

.share-sheet-hint {
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 12px;
  line-height: 1.5;
}

/* ============================================================
   Streaming loading overlay — 打字機 echo
   ============================================================ */

.streaming-tail {
  background: linear-gradient(180deg, #faf5ff 0%, #fdf2f8 100%);
  border: 1px dashed #e9d5ff;
  border-radius: 8px;
  padding: 10px 12px;
  max-height: 5.4em;          /* 約 3 行字 */
  overflow: hidden;
  position: relative;
  font-family: 'Courier New', 'Noto Sans Mono CJK TC', monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* 上方淡入遮罩，營造「不斷往上捲」的感覺 */
.streaming-tail::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.2em;
  background: linear-gradient(180deg, rgba(250, 245, 255, 1) 0%, rgba(250, 245, 255, 0) 100%);
  pointer-events: none;
}

/* 末尾游標閃爍效果 */
.streaming-tail::after {
  content: '▊';
  color: #a855f7;
  animation: streaming-cursor 1s steps(2) infinite;
  margin-left: 1px;
}

@keyframes streaming-cursor {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* 進度條動態漸層動畫 */
#streaming-bar {
  background-size: 200% 100%;
  animation: streaming-bar-shift 2s ease-in-out infinite;
}

@keyframes streaming-bar-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ============================================================
   進階提示（A1 歌詞 + A2 角色描述）
   ============================================================ */

.advanced-prompt {
  border: 2px dashed #e2e8f0;
  border-radius: 12px;
  background: #fafbff;
  transition: all .15s;
}
.advanced-prompt[open] {
  border-style: solid;
  border-color: #d8b4fe;
  background: linear-gradient(135deg, #faf5ff, #fdf2f8);
}
.advanced-prompt summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.advanced-prompt summary::-webkit-details-marker { display: none; }
.advanced-prompt summary:hover { color: #7c3aed; }
.advanced-prompt[open] summary { color: #6b21a8; border-bottom: 1px dashed #e9d5ff; }
.advanced-summary-toggle {
  font-size: 16px;
  color: #94a3b8;
  transition: transform .2s;
}
.advanced-prompt[open] .advanced-summary-toggle {
  transform: rotate(180deg);
  color: #7c3aed;
}

.advanced-prompt-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.advanced-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.advanced-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
}

.advanced-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  color: #1e293b;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.advanced-field textarea:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, .15);
}
.advanced-field textarea::placeholder {
  color: #94a3b8;
  white-space: pre-line;
}

.char-count {
  position: absolute;
  right: 6px;
  bottom: 4px;
  font-size: 10px;
  color: #94a3b8;
  background: rgba(255, 255, 255, .85);
  padding: 1px 6px;
  border-radius: 6px;
  pointer-events: none;
}
.char-count.near-limit { color: #db2777; font-weight: 700; }

.advanced-hint {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.5;
  margin-top: -2px;
}

/* ============================================================
   影片播放/暫停按鈕（浮在影片中央）
   ============================================================ */

.video-preview-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.92), rgba(236, 72, 153, 0.92));
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 32px -6px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity .25s, transform .15s ease, background .15s, box-shadow .15s;
  padding: 0;
}

.video-play-btn:hover {
  background: linear-gradient(135deg, #9333ea, #db2777);
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 14px 36px -4px rgba(124, 58, 237, .55), 0 0 0 4px rgba(255, 255, 255, 0.25);
}

.video-play-btn:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.video-play-btn:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 4px;
}

.video-play-btn .video-play-icon,
.video-play-btn .video-pause-icon {
  width: 32px;
  height: 32px;
}

/* 預設顯示「播放」icon、隱藏「暫停」icon */
.video-play-btn .video-pause-icon { display: none; }

/* 播放中：按鈕淡出（hover 時才顯示）+ 圖示換成「暫停」 */
.video-preview-wrap.playing .video-play-btn {
  opacity: 0;
  pointer-events: auto;
}
.video-preview-wrap.playing:hover .video-play-btn,
.video-preview-wrap.playing:focus-within .video-play-btn {
  opacity: 1;
}
.video-preview-wrap.playing .video-play-icon { display: none; }
.video-preview-wrap.playing .video-pause-icon { display: inline-block; }

/* 影片還沒載入前，按鈕也藏起來 */
.video-preview-wrap:not(.has-video) .video-play-btn { display: none; }

/* mobile 微縮 */
@media (max-width: 480px) {
  .video-play-btn { width: 60px; height: 60px; border-width: 2px; }
  .video-play-btn .video-play-icon,
  .video-play-btn .video-pause-icon { width: 26px; height: 26px; }
}

/* ============================================================
   分段提示詞 segments — 每段獨立可貼到 AI 影片平台
   ============================================================ */

.segments-intro { margin-bottom: 8px; }
.segments-hint {
  font-size: 12px;
  color: #64748b;
  line-height: 1.55;
  margin-top: 4px;
}

.segments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.segment-row {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  transition: all .15s;
}
.segment-row:hover { border-color: #c084fc; }
.segment-row.expanded { background: white; border-color: #a855f7; box-shadow: 0 0 0 2px rgba(168, 85, 247, .08); }

.segment-header {
  display: grid;
  grid-template-columns: 32px 1fr 20px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}

.seg-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: white;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.seg-meta { min-width: 0; }
.seg-line-1 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}
.seg-time { color: #7c3aed; }
.seg-shot { color: #1e293b; }
.seg-duration {
  margin-left: auto;
  font-size: 11px;
  color: white;
  background: #94a3b8;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
}
.seg-line-2 { font-size: 12.5px; color: #475569; line-height: 1.5; }
.seg-line-3 { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.seg-toggle {
  font-size: 16px;
  color: #94a3b8;
  transition: transform .2s;
  text-align: center;
}
.segment-row.expanded .seg-toggle { transform: rotate(180deg); color: #7c3aed; }

.segment-body {
  display: none;
  padding: 0 12px 12px 12px;
  border-top: 1px dashed #e2e8f0;
  margin-top: 4px;
  padding-top: 12px;
}
.segment-row.expanded .segment-body { display: flex; flex-direction: column; gap: 10px; }

.seg-prompt-group { display: flex; flex-direction: column; gap: 4px; }
.seg-prompt-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.seg-buttons { display: flex; gap: 6px; }
.copy-btn-mini {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 8px;
  background: white;
  border: 2px solid #e2e8f0;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all .15s;
}
.copy-btn-mini:hover { border-color: #a855f7; color: #7c3aed; background: #faf5ff; }
.copy-btn-mini.copied { border-color: #10b981; color: #059669; background: #ecfdf5; }

/* details / 整體版 */
.full-prompt-details {
  margin-top: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}
.full-prompt-details summary {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  background: #f8fafc;
  list-style: none;
  user-select: none;
  transition: background .15s;
}
.full-prompt-details summary::-webkit-details-marker { display: none; }
.full-prompt-details summary:hover { background: #f1f5f9; }
.full-prompt-details[open] summary { border-bottom: 1px solid #e2e8f0; background: #faf5ff; color: #7c3aed; }
.full-prompt-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: white;
}

.card-footer-actions {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed #e2e8f0;
  display: flex;
  gap: 6px;
}
.btn-download-txt,
.btn-share-card {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  border: 2px solid;
}
.btn-download-txt {
  background: linear-gradient(135deg, #f0f9ff, #faf5ff);
  border-color: #ddd6fe;
  color: #6b21a8;
}
.btn-download-txt:hover {
  border-color: #a855f7;
  background: linear-gradient(135deg, #faf5ff, #fdf2f8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -6px rgba(168, 85, 247, .35);
}
.btn-share-card {
  background: linear-gradient(135deg, #fef3c7, #fce7f3);
  border-color: #fbcfe8;
  color: #9d174d;
}
.btn-share-card:hover {
  border-color: #ec4899;
  background: linear-gradient(135deg, #fdf2f8, #fce7f3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -6px rgba(236, 72, 153, .35);
}
.btn-share-link {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  border: 2px solid #bae6fd;
  background: linear-gradient(135deg, #f0f9ff, #ecfeff);
  color: #0369a1;
}
.btn-share-link:hover {
  border-color: #0284c7;
  background: linear-gradient(135deg, #ecfeff, #e0f2fe);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -6px rgba(2, 132, 199, .35);
}
.btn-share-card:disabled,
.btn-download-txt:disabled,
.btn-share-link:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* mobile tweaks */
@media (max-width: 480px) {
  .style-chip { padding: 8px 6px; }
  .style-chip-emoji { font-size: 24px; }
  .style-chip-label { font-size: 11px; }

  /* segment row 在窄螢幕簡化 */
  .segment-header { grid-template-columns: 28px 1fr 16px; gap: 8px; padding: 8px 10px; }
  .seg-badge { width: 26px; height: 26px; font-size: 12px; }
  .seg-line-1 { flex-wrap: wrap; gap: 4px 8px; font-size: 12px; }
  .seg-duration { font-size: 10px; padding: 1px 6px; }
  .seg-line-2 { font-size: 12px; }
}

/* print: hide controls */
@media print {
  header, footer, #drop-zone, #generate-section, #loading, #toast, #help-modal { display: none !important; }
  .result-card { break-inside: avoid; box-shadow: none; border: 1px solid #cbd5e1; }
}
