/* ================================================================
   QD INFINITY — Luminous Ethereality Theme
   Companion CSS for dynamic content generated by main.js
   Static layout handled by Tailwind utility classes in index.html
   ================================================================ */

:root {
  --bg-main: #ECEFF1;
  --bg-card: #ffffff;
  --accent: #0B1320;
  --accent-soft: rgba(11,19,32,0.10);
  --green: #2e7d32;
  --green-soft: rgba(46,125,50,0.1);
  --border: rgba(144,164,174,0.30);
  --text: #0B1320;
  --text-dim: #2C3E50;
  --radius: 16px;
  --font-mono: ui-monospace, Consolas, monospace;
  --surface-low: #ECEFF1;
  --surface-high: #CFD8DC;
  --surface-highest: #CFD8DC;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; }
body { margin: 0; min-height: 100%; font-family: 'Inter', "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }

#dotMatrixCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.vignette-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 80% 70% at 50% 50%,
    transparent 40%,
    rgba(11, 19, 32, 0.06) 75%,
    rgba(11, 19, 32, 0.14) 100%
  );
}

/* ============================================================
   Sidebar nav items (toggled by main.js via is-active class)
   ============================================================ */
.sw-nav-item {
  color: #2C3E50;
  background: transparent;
  border: none;
  font-family: inherit;
}
.sw-nav-item:hover {
  color: #0B1320;
  background: #CFD8DC;
}
.sw-nav-item.is-active {
  color: #fff;
  background: #0B1320;
  box-shadow: 0 4px 20px rgba(11,19,32,0.15);
}
.sw-nav-item.is-active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

/* ============================================================
   Page visibility (toggled by main.js via hidden attribute)
   ============================================================ */
.page-scroll[hidden] { display: none !important; }

.page-scroll {
  background: transparent;
}

/* Scrollbar styling for page areas */
.page-scroll::-webkit-scrollbar { width: 4px; }
.page-scroll::-webkit-scrollbar-thumb { background: rgba(11,19,32,0.12); border-radius: 10px; }
.page-scroll::-webkit-scrollbar-track { background: transparent; }

.snap-center-custom { scroll-snap-align: center; }

/* ============================================================
   Chat interface — iMessage style
   ============================================================ */
.chat-msg {
  display: flex; gap: 12px;
  animation: chatSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.chat-msg--user { justify-content: flex-end; }
.chat-msg--ai { justify-content: flex-start; align-items: flex-start; }
.chat-msg--status { justify-content: flex-start; align-items: flex-start; }

.chat-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}

.chat-bubble {
  max-width: 75%; padding: 12px 18px; border-radius: 20px;
  font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
}
.chat-bubble--user {
  background: #0B1320; color: #ECEFF1;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 16px rgba(11,19,32,0.12);
}
.chat-bubble--ai {
  background: white; border: 1px solid rgba(144,164,174,0.12);
  color: var(--text); border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.chat-bubble--status {
  background: transparent; border: none;
  color: var(--text-dim); font-size: 12px; padding: 2px 0;
}
.chat-bubble--status .chat-status-ok { color: var(--green); font-weight: 600; }
.chat-bubble--status .chat-status-err { color: #9f403d; font-weight: 600; }

/* ── Profile page ── */
#pageProfile .profile-msg { display: flex; gap: 20px; align-items: flex-start; animation: chatSlideUp 0.5s cubic-bezier(0.16,1,0.3,1); }
#pageProfile .profile-msg--ai { justify-content: flex-start; }
#pageProfile .profile-msg--user { justify-content: flex-end; }

#pageProfile .profile-msg--ai .profile-text {
  font-size: 17px; font-weight: 300; line-height: 1.75; color: #26353b;
  white-space: pre-wrap; word-break: break-word; max-width: 640px;
}
#pageProfile .profile-msg--user .profile-text {
  background: rgba(255,255,255,0.4); backdrop-filter: blur(20px);
  border: 1px solid rgba(165,180,188,0.1); box-shadow: 0 2px 12px rgba(0,0,0,0.02);
  padding: 18px 28px; border-radius: 2rem; border-top-right-radius: 0;
  font-size: 16px; font-weight: 500; color: #4e525d; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; max-width: 520px; width: fit-content;
}
#pageProfile .profile-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
}
#pageProfile .profile-avatar--ai { background: #5a5e6a; }
#pageProfile .profile-avatar--user { background: #eef5f9; }

.typing-dots { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #90A4AE; animation: typingBounce 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-7px); opacity: 1; }
}

/* Script card within chat */
.script-card {
  transition: box-shadow 0.3s;
}
.script-card:hover {
  box-shadow: 0 8px 40px rgba(11,19,32,0.06);
}

/* ============================================================
   Style Bible sidebar sections
   ============================================================ */
.sb-section {
  padding-bottom: 1.5rem;
}
.sb-section + .sb-section {
  border-top: 1px solid rgba(207,216,220,0.6);
  padding-top: 1.5rem;
}
.sb-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.15em;
  text-transform: uppercase; color: #0B1320;
  margin-bottom: 0.75rem;
}

/* ── Style Bible entrance animation ── */
@keyframes sb-card-slide {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes sb-section-rise {
  from { transform: translateY(18px); opacity: 0; filter: blur(4px); }
  to   { transform: translateY(0);    opacity: 1; filter: blur(0); }
}
@keyframes sb-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.sb-entrance {
  animation: sb-card-slide 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.sb-entrance .sb-section {
  opacity: 0;
  animation: sb-section-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
#styleBiblePreview { position: relative; }
.sb-entrance #styleBiblePreview::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(124,138,255,0.06) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: sb-shimmer 1.8s ease-out 0.3s both;
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
}

/* ── Extract progress bar pulse ── */
@keyframes extract-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
@keyframes extract-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.extract-bar-pulse {
  animation: extract-pulse 1.8s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    var(--md-sys-color-primary, #5b6abf) 0%,
    rgba(124,138,255,0.6) 50%,
    var(--md-sys-color-primary, #5b6abf) 100%
  ) !important;
  background-size: 200% 100%;
  animation: extract-shimmer 2s ease-in-out infinite, extract-pulse 1.8s ease-in-out infinite;
}

/* ── Asset cards entrance animation ── */
@keyframes asset-fade-up {
  from { transform: translateY(24px); opacity: 0; filter: blur(3px); }
  to   { transform: translateY(0);    opacity: 1; filter: blur(0); }
}
@keyframes asset-section-slide {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.asset-cards-entrance > section {
  opacity: 0;
  animation: asset-section-slide 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.asset-cards-entrance > section:nth-child(1) { animation-delay: 0.08s; }
.asset-cards-entrance > section:nth-child(2) { animation-delay: 0.22s; }
.asset-cards-entrance > section:nth-child(3) { animation-delay: 0.36s; }

.asset-cards-entrance .asset-card {
  opacity: 0;
  animation: asset-fade-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.asset-cards-entrance .asset-card:nth-child(1)  { animation-delay: 0.15s; }
.asset-cards-entrance .asset-card:nth-child(2)  { animation-delay: 0.22s; }
.asset-cards-entrance .asset-card:nth-child(3)  { animation-delay: 0.29s; }
.asset-cards-entrance .asset-card:nth-child(4)  { animation-delay: 0.36s; }
.asset-cards-entrance .asset-card:nth-child(5)  { animation-delay: 0.43s; }
.asset-cards-entrance .asset-card:nth-child(6)  { animation-delay: 0.50s; }
.asset-cards-entrance .asset-card:nth-child(7)  { animation-delay: 0.57s; }
.asset-cards-entrance .asset-card:nth-child(8)  { animation-delay: 0.64s; }
.asset-cards-entrance .asset-card:nth-child(9)  { animation-delay: 0.71s; }
.asset-cards-entrance .asset-card:nth-child(10) { animation-delay: 0.78s; }
.asset-cards-entrance .asset-card:nth-child(n+11) { animation-delay: 0.85s; }

/* ============================================================
   Shot cards — grid row layout (rendered by renderShotList)
   ============================================================ */
textarea.sc-visual,
textarea.sc-visual:focus {
  background: transparent; border: none; outline: none;
  box-shadow: none; padding: 0; min-height: unset;
  font-size: 0.875rem; line-height: 1.625; color: var(--text);
  resize: none;
}

/* ============================================================
   Storyboard cards (rendered by renderImageGrid)
   ============================================================ */
.sb-sheet-image {
  position: relative; width: 100%; min-height: 120px;
  background: white; border-radius: 0.5rem; overflow: hidden;
}
.sb-sheet-image img { width: 100%; display: block; }
.sb-sheet-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(236,239,241,0.92); z-index: 2; gap: 10px;
  backdrop-filter: blur(4px);
}
.sb-sheet-loading[hidden] { display: none; }
.sb-sheet-loading .tc-spinner { width: 24px; height: 24px; border-width: 2px; }
.sb-sheet-loading span { font-size: 12px; color: #0B1320; font-weight: 600; }
.sb-sheet-error {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,247,246,0.95); z-index: 2;
  font-size: 12px; color: #9f403d; padding: 16px; text-align: center; word-break: break-word;
}
.sb-sheet-error[hidden] { display: none; }

/* ============================================================
   Prompt preview cards (rendered by renderPromptPreviewList)
   ============================================================ */
.prompt-preview-card {
  background: white; border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; padding: 16px 20px; position: relative;
  transition: all 0.3s; box-shadow: 0 0 40px rgba(11,19,32,0.02);
}
.prompt-preview-card:hover { box-shadow: 0 4px 24px rgba(11,19,32,0.06); }
.prompt-preview-card.is-done { border-color: var(--green); }
.prompt-preview-card.is-err  { border-color: #9f403d; }
.prompt-preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.prompt-preview-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.prompt-preview-scene { font-size: 14px; font-weight: 700; color: #0B1320; }
.prompt-preview-status { margin-left: auto; font-size: 11px; color: var(--text-dim); font-weight: 600; }
.prompt-preview-status.ok   { color: var(--green); }
.prompt-preview-status.err  { color: #9f403d; }
.prompt-preview-status.wait { color: var(--accent); }
.prompt-preview-desc {
  font-size: 13px; color: var(--text-dim); margin-bottom: 10px; line-height: 1.6;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.prompt-preview-prompt {
  background: var(--surface-low); border-radius: 12px; padding: 12px 16px;
  font-size: 13px; color: #2C3E50; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  min-height: 24px; max-height: 140px; overflow-y: auto;
}
.prompt-preview-prompt:empty::before { content: "等待 AI 转写…"; color: #90A4AE; }
.prompt-preview-actions { margin-top: 10px; display: flex; gap: 8px; }

/* ============================================================
   Video prompt cards (rendered by renderVideoPromptList)
   ============================================================ */
.vp-card {
  background: white; border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; overflow: hidden;
  transition: all 0.3s; box-shadow: 0 0 60px rgba(11,19,32,0.02);
}
.vp-card:hover { box-shadow: 0 6px 30px rgba(11,19,32,0.06); }
.vp-card.is-done { border-color: var(--green); }
.vp-card.is-err  { border-color: #9f403d; }
.vp-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid rgba(144,164,174,0.1);
}
.vp-card-body { padding: 16px 20px; }
.vp-card-thumb--wide {
  width: 100%; height: auto; border-radius: 12px;
  background: var(--surface-low); overflow: hidden; position: relative; margin-bottom: 12px;
}
.vp-card-thumb--wide img { width: 100%; display: block; opacity: 0.85; }
.vp-card-thumb--wide .vp-no-img {
  padding: 28px; text-align: center; color: #90A4AE; font-size: 12px;
}
.vp-card-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.vp-card-scene { font-size: 14px; font-weight: 700; color: #0B1320; }
.vp-card-status { margin-left: auto; font-size: 11px; font-weight: 700; }
.vp-card-status.ok   { color: var(--green); }
.vp-card-status.err  { color: #9f403d; }
.vp-card-status.wait { color: var(--accent); }
.vp-card-tag {
  display: inline-block; padding: 3px 10px; border-radius: 2rem;
  font-size: 10px; font-weight: 700;
}
.vp-card-tag--dur  { background: rgba(46,125,50,0.1); color: #2e7d32; }
.vp-shots-breakdown {
  background: var(--surface-low); border-radius: 12px; padding: 12px 16px;
}
.vp-shots-title {
  font-size: 10px; font-weight: 800; color: var(--text-dim);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.08em;
}
.vp-shot-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid rgba(144,164,174,0.1); font-size: 12px;
}
.vp-shot-row:last-child { border-bottom: none; }
.vp-shot-time { font-family: var(--font-mono); color: #2e7d32; font-weight: 700; min-width: 56px; flex-shrink: 0; }
.vp-panel-tag {
  background: var(--accent-soft); color: var(--accent);
  font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.vp-shot-type { color: #7c3aed; font-weight: 700; flex-shrink: 0; }
.vp-shot-cam { color: #0B1320; flex-shrink: 0; }
.vp-shot-visual {
  color: var(--text-dim); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vp-card-prompt-area { padding: 0 20px 16px; }
.vp-card-prompt-label {
  font-size: 11px; color: var(--text-dim); margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px; font-weight: 700;
}
.vp-card-prompt-label .vp-tag-video {
  font-size: 9px; padding: 2px 8px; border-radius: 2rem;
  background: rgba(159,64,61,0.1); color: #9f403d; font-weight: 700;
}
.vp-card-prompt {
  background: var(--surface-low); border-radius: 12px; padding: 14px 16px;
  font-size: 13px; color: #2C3E50; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  min-height: 40px; max-height: 180px; overflow-y: auto;
}
.vp-card-prompt:empty::before { content: "等待 AI 生成视频提示词…"; color: #90A4AE; }
.vp-card-actions { padding: 0 20px 16px; display: flex; gap: 8px; }
.vp-btn-del { color: #9f403d !important; }

/* ============================================================
   Asset cards (rendered by renderAssetGrid with new Tailwind)
   ============================================================ */
.asset-card-loading {
  display: flex; align-items: center; justify-content: center;
  background: rgba(236,239,241,0.9); z-index: 2;
}
.asset-card-loading[hidden] { display: none; }
.asset-card-loading .tc-spinner { width: 20px; height: 20px; border-width: 2px; }
.asset-empty-hint { text-align: center; padding: 24px; color: #90A4AE; font-size: 13px; }

/* ============================================================
   Generic buttons (.btn used by dynamically generated HTML)
   ============================================================ */
.btn {
  border: none; border-radius: 3rem; cursor: pointer;
  font-weight: 700; font-family: inherit; transition: all 0.2s;
}
.btn-primary {
  background: #0B1320; color: #ECEFF1;
  box-shadow: 0 4px 16px rgba(11,19,32,0.15);
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface-low); color: #2C3E50;
  border: 1px solid rgba(144,164,174,0.2);
}
.btn-secondary:hover { background: var(--surface-high); }
.btn-sm { padding: 7px 16px; font-size: 12px; }
.btn-icon {
  background: none; border: none; color: #90A4AE; cursor: pointer;
  font-size: 14px; padding: 4px; border-radius: 50%;
  transition: all 0.2s;
}
.btn-icon:hover { color: #9f403d; background: rgba(159,64,61,0.06); }

/* ============================================================
   Generic form inputs (for dynamic content forms)
   ============================================================ */
.gen-hint { margin: 8px 0 0; font-size: 12px; color: var(--text-dim); text-align: center; }

/* ============================================================
   Task cards (video generation — rendered by main.js)
   ============================================================ */
.task-card {
  background: white; border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; padding: 16px 20px;
  transition: all 0.3s; box-shadow: 0 0 40px rgba(11,19,32,0.02);
}
.task-card:hover { box-shadow: 0 4px 24px rgba(11,19,32,0.05); }
.task-card.is-active { border-color: #0B1320; box-shadow: 0 0 0 2px var(--accent-soft); }
.tc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tc-badge {
  flex-shrink: 0; padding: 3px 12px; border-radius: 2rem;
  font-size: 10px; font-weight: 700; white-space: nowrap;
}
.tc-badge--submit, .tc-badge--polling { background: var(--accent-soft); color: #0B1320; }
.tc-badge--fetching { background: var(--green-soft); color: #2e7d32; }
.tc-badge--done { background: var(--green-soft); color: #2e7d32; }
.tc-badge--failed, .tc-badge--timeout { background: rgba(159,64,61,0.1); color: #9f403d; }
.tc-time { font-size: 10px; color: #90A4AE; margin-left: auto; flex-shrink: 0; }
.tc-prompt {
  margin: 0 0 10px; font-size: 13px; color: var(--text-dim); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.tc-preview {
  position: relative; border-radius: 14px; overflow: hidden;
  background: #0B1320; width: 100%; padding-top: 56.25%;
}
.tc-busy {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: #0B1320; z-index: 2;
}
.tc-busy[hidden] { display: none; }
.tc-busy::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(11,19,32,0.12) 0%, transparent 65%);
  animation: tc-glow 3s ease-in-out infinite;
}
@keyframes tc-glow { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.tc-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(11,19,32,0.2); border-top-color: #0B1320;
  border-radius: 50%; animation: tc-spin 0.9s linear infinite; position: relative; z-index: 3;
}
@keyframes tc-spin { to { transform: rotate(360deg); } }
.tc-busy-text { position: relative; z-index: 3; margin-top: 10px; font-size: 12px; color: #90A4AE; }
.tc-video-wrap { position: absolute; inset: 0; }
.tc-video-wrap[hidden] { display: none; }
.tc-video-wrap video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.tc-play-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.25); z-index: 4; cursor: pointer;
}
.tc-play-overlay[hidden] { display: none; }
.tc-play-btn {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.9); color: #0B1320;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; padding-left: 3px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15); transition: transform 0.15s;
}
.tc-play-overlay:hover .tc-play-btn { transform: scale(1.1); background: #fff; }
.tc-video-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: rgba(236,239,241,0.95); z-index: 6;
}
.tc-video-loading[hidden] { display: none; }
.tc-loading-text { margin-top: 8px; font-size: 12px; color: #0B1320; }
.tc-failed {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: rgba(255,247,246,0.95); z-index: 2;
}
.tc-failed[hidden] { display: none; }
.tc-failed-text { font-size: 12px; color: #9f403d; text-align: center; padding: 0 16px; line-height: 1.6; max-width: 90%; word-break: break-word; }
.tc-failed-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: center; }
.tc-failed-btn {
  padding: 7px 16px; border: 1px solid rgba(159,64,61,0.2);
  border-radius: 2rem; background: rgba(159,64,61,0.06); color: #9f403d; font-size: 11px; cursor: pointer;
}
.tc-failed-btn--recover { border-color: #1a73e8; background: rgba(26,115,232,0.08); color: #1a73e8; font-weight: 700; }
.tc-failed-btn--recover:hover { background: rgba(26,115,232,0.18); }
.tc-failed-btn--retry { border-color: #0B1320; background: var(--accent-soft); color: #0B1320; font-weight: 700; }
.tc-failed-btn--retry:hover { background: rgba(11,19,32,0.2); }
.tc-actions { display: flex; gap: 8px; margin-top: 10px; }
.tc-actions[hidden] { display: none; }
.tc-btn {
  flex: 1; padding: 8px 6px; border: 1px solid rgba(144,164,174,0.2); border-radius: 2rem;
  background: #fff; color: var(--text); font-size: 11px; cursor: pointer; font-family: inherit;
  text-align: center; white-space: nowrap; transition: all 0.2s;
}
.tc-btn:hover { border-color: #0B1320; }
.tc-btn--accent { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.tasks-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px; text-align: center;
}
.tasks-empty[hidden] { display: none; }

/* ============================================================
   Batch generation page
   ============================================================ */
.bc-card {
  background: white; border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; overflow: hidden; transition: all 0.3s;
  box-shadow: 0 0 40px rgba(11,19,32,0.02);
}
.bc-card:hover { border-color: #0B1320; box-shadow: 0 4px 20px rgba(11,19,32,0.05); }
.bc-card-top { display: flex; gap: 12px; padding: 14px 16px; }
.bc-thumb {
  width: 100px; height: 56px; flex-shrink: 0; border-radius: 10px;
  overflow: hidden; background: var(--surface-high);
}
.bc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bc-no-img { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #90A4AE; font-size: 10px; }
.bc-info { flex: 1; min-width: 0; }
.bc-head { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.bc-dur { font-size: 10px; font-weight: 800; color: #0B1320; background: var(--accent-soft); padding: 3px 10px; border-radius: 2rem; }
.bc-refs { font-size: 10px; color: var(--text-dim); }
.bc-shots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.bc-shot-tag { font-size: 9px; color: #0B1320; background: var(--accent-soft); padding: 2px 8px; border-radius: 2rem; white-space: nowrap; }
.bc-prompt {
  font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.bc-card-actions { padding: 0 16px 14px; display: flex; gap: 8px; align-items: center; }
.bc-regen-btn {
  font-size: 11px; padding: 6px 16px; border-radius: 2rem;
  background: #0B1320; color: #fff; border: none; cursor: pointer; font-weight: 700;
}
.bc-regen-btn:hover { opacity: 0.85; }
.bc-status { font-size: 10px; padding: 3px 10px; border-radius: 2rem; font-weight: 700; }
.bc-status--fail { color: #9f403d; background: rgba(159,64,61,0.08); }
.bc-status--active { color: #0B1320; background: var(--accent-soft); }
.bc-status--done { color: #2e7d32; background: var(--green-soft); }

/* ============================================================
   Reference frames (video gen page)
   ============================================================ */
.frame-slot { position: relative; min-height: 80px; }
.frame-pick {
  position: absolute; inset: 0; border: 2px dashed rgba(144,164,174,0.3);
  border-radius: 14px; background: var(--surface-low); color: var(--text-dim);
  cursor: pointer; font-size: 18px; z-index: 1;
  display: flex; align-items: center; justify-content: center;
}
.frame-preview {
  position: absolute; inset: 0; border-radius: 14px;
  background-size: cover; background-position: center;
  border: 2px solid #0B1320; z-index: 2;
}
.frame-clear {
  position: absolute; top: -6px; right: -6px; z-index: 3;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid rgba(144,164,174,0.2); background: #fff; color: #9f403d;
  cursor: pointer; padding: 0; line-height: 1; font-size: 14px;
}

/* ============================================================
   Config pills and dropdown (video gen page)
   ============================================================ */
.config-pill-btn {
  background: #fff; border: 1px solid rgba(144,164,174,0.2); color: var(--text);
  padding: 8px 16px; border-radius: 2rem; cursor: pointer; font-size: 12px;
  min-width: 100px; text-align: left; transition: all 0.2s;
}
.config-pill-btn:hover, .config-pill-btn.is-open { border-color: #0B1320; }
.dd-panel {
  position: absolute; bottom: 100%; left: 0; margin-bottom: 4px;
  min-width: 130px; max-height: 220px; overflow-y: auto;
  background: #fff; border: 1px solid rgba(144,164,174,0.2); border-radius: 14px;
  z-index: 50; box-shadow: 0 8px 30px rgba(11,19,32,0.12);
}
.ds-dd-item {
  display: block; width: 100%; padding: 10px 16px;
  border: none; border-bottom: 1px solid rgba(144,164,174,0.1);
  background: transparent; color: var(--text); font-size: 12px; text-align: left; cursor: pointer;
}
.ds-dd-item:last-child { border-bottom: none; }
.ds-dd-item:hover { background: var(--surface-low); }
.ds-dd-item.is-on { color: #0B1320; font-weight: 700; }
.ds-chip {
  flex: 1; padding: 10px; border: 1px solid rgba(144,164,174,0.2); border-radius: 12px;
  background: #fff; color: #90A4AE; font-size: 12px; cursor: pointer; font-weight: 600;
  text-align: center; transition: all 0.2s;
}
.ds-chip.is-on { background: #0B1320; border-color: #0B1320; color: #fff; }

/* ============================================================
   Settings page
   ============================================================ */
.settings-tab {
  padding: 12px 24px; border: none; background: transparent;
  color: var(--text-dim); font-size: 14px; font-weight: 700;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color 0.2s, border-color 0.2s;
  font-family: inherit;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.is-active { color: #0B1320; border-bottom-color: #0B1320; }

.simple-api-card {
  background: white; border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; padding: 20px 24px;
  border-left: 4px solid #0B1320; transition: all 0.3s;
  box-shadow: 0 0 40px rgba(11,19,32,0.02);
}
.simple-card-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.simple-card-icon { flex-shrink: 0; margin-top: 2px; }
.simple-card-head-text { flex: 1; min-width: 120px; }
.simple-card-title { font-size: 16px; font-weight: 800; color: #0B1320; margin-bottom: 4px; }
.simple-card-desc { font-size: 13px; color: var(--text-dim); line-height: 1.6; }

.api-provider-card {
  background: var(--surface-low); border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; padding: 16px 20px;
}
.api-provider-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-provider-name { font-size: 15px; font-weight: 800; color: #0B1320; }
.api-cap-tag {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 3px 10px; border-radius: 3rem; line-height: 1.4;
}
.api-cap-text       { background: rgba(11,19,32,0.1); color: #0B1320; }
.api-cap-multimodal { background: rgba(124,58,237,0.1); color: #7c3aed; }
.api-cap-image      { background: rgba(46,125,50,0.1);  color: #2e7d32; }
.api-cap-video      { background: rgba(159,64,61,0.1);  color: #9f403d; }

.step-card {
  background: var(--surface-low); border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; padding: 16px 20px;
}
.step-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-card-num { font-size: 11px; font-weight: 800; color: #0B1320; background: var(--accent-soft); padding: 3px 12px; border-radius: 2rem; }
.step-card-label { font-size: 15px; font-weight: 800; color: #0B1320; }
.step-card-desc { font-size: 13px; color: var(--text-dim); margin: 8px 0 6px; line-height: 1.6; }
.step-card-rec { font-size: 11px; color: #2e7d32; margin-bottom: 10px; }
.step-card-rec-label { font-weight: 700; }
.step-card-not { color: #9f403d; }
.step-card-fields { display: flex; gap: 10px; align-items: center; }
.step-card-fields select { width: 150px; flex-shrink: 0; }
.step-card-fields input { flex: 1; min-width: 0; }

/* ============================================================
   Project list (dynamically generated)
   ============================================================ */
.plist-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid rgba(144,164,174,0.1); gap: 10px;
}
.plist-item:last-child { border-bottom: none; }
.plist-current { background: var(--accent-soft); border-radius: 12px; }
.plist-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.plist-name { font-size: 14px; font-weight: 700; color: #0B1320; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist-date { font-size: 10px; color: #90A4AE; }
.plist-badge { font-size: 10px; color: #0B1320; background: var(--accent-soft); padding: 3px 12px; border-radius: 3rem; font-weight: 700; }

/* ============================================================
   Loading overlays
   ============================================================ */
.loading-overlay {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; text-align: center;
}
.loading-overlay[hidden] { display: none; }
.loading-overlay .tc-spinner { width: 20px; height: 20px; border-width: 2px; }
.loading-text { font-size: 13px; color: var(--text-dim); }

/* ============================================================
   Overrides for Tailwind form plugin conflicts
   ============================================================ */
[type='text']:focus, [type='url']:focus, [type='password']:focus, textarea:focus, select:focus {
  --tw-ring-color: rgba(11,19,32,0.15);
  border-color: #0B1320;
}

/* ============================================================
   Hide scrollbar but keep scroll functionality
   ============================================================ */
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* ============================================================
   Elegant thin scrollbar — visible but minimal
   ============================================================ */
.elegant-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(144,164,174,0.2) transparent;
}
.elegant-scroll:hover {
  scrollbar-color: rgba(144,164,174,0.35) transparent;
}
.elegant-scroll::-webkit-scrollbar { width: 5px; }
.elegant-scroll::-webkit-scrollbar-track { background: transparent; margin: 8px 0; }
.elegant-scroll::-webkit-scrollbar-thumb {
  background: rgba(144,164,174,0.18);
  border-radius: 10px;
  transition: background 0.2s;
}
.elegant-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(144,164,174,0.4);
}

/* ============================================================
   Pencil texture overlay (for storyboard cards)
   ============================================================ */
.pencil-texture {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.03; pointer-events: none; position: absolute; inset: 0;
}

/* ── Border Glow (adapted from reactbits BorderGlow) ── */
.glow-border-wrap {
  --edge-proximity: 0;
  --cursor-angle: 45deg;
  --edge-sensitivity: 30;
  --color-sensitivity: 50;
  --cone-spread: 25;
  --glow-padding: 40px;
  --card-bg: #0B1320;
  --fill-opacity: 0.5;

  position: relative;
  border-radius: inherit;
  isolation: isolate;
  transform: translate3d(0, 0, 0.01px);
  display: grid;
  border: 1px solid rgb(255 255 255 / 15%);
  background: var(--card-bg);
  overflow: visible;
  box-shadow:
    rgba(0,0,0,0.1) 0 1px 2px,
    rgba(0,0,0,0.1) 0 2px 4px,
    rgba(0,0,0,0.1) 0 4px 8px,
    rgba(0,0,0,0.1) 0 8px 16px;
}

.glow-border-wrap::before,
.glow-border-wrap::after,
.glow-border-wrap > .glow-edge-light {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transition: opacity 0.25s ease-out;
  z-index: -1;
}

.glow-border-wrap:not(:hover):not(.glow-active)::before,
.glow-border-wrap:not(:hover):not(.glow-active)::after,
.glow-border-wrap:not(:hover):not(.glow-active) > .glow-edge-light {
  opacity: 0;
  transition: opacity 0.75s ease-in-out;
}

/* Layer 1: colored mesh-gradient border */
.glow-border-wrap::before {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--card-bg) 0 100%) padding-box,
    linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box,
    radial-gradient(at 80% 55%, #c084fc 0px, transparent 50%) border-box,
    radial-gradient(at 69% 34%, #f472b6 0px, transparent 50%) border-box,
    radial-gradient(at 8% 6%,   #38bdf8 0px, transparent 50%) border-box,
    radial-gradient(at 41% 38%, #c084fc 0px, transparent 50%) border-box,
    radial-gradient(at 86% 85%, #f472b6 0px, transparent 50%) border-box,
    radial-gradient(at 82% 18%, #38bdf8 0px, transparent 50%) border-box,
    radial-gradient(at 51% 4%,  #f472b6 0px, transparent 50%) border-box,
    linear-gradient(#c084fc 0 100%) border-box;

  opacity: calc(
    (var(--edge-proximity) - var(--color-sensitivity))
    / (100 - var(--color-sensitivity))
  );

  -webkit-mask-image: conic-gradient(
    from var(--cursor-angle) at center,
    black  calc(var(--cone-spread) * 1%),
    transparent calc((var(--cone-spread) + 15) * 1%),
    transparent calc((100 - var(--cone-spread) - 15) * 1%),
    black  calc((100 - var(--cone-spread)) * 1%)
  );
  mask-image: conic-gradient(
    from var(--cursor-angle) at center,
    black  calc(var(--cone-spread) * 1%),
    transparent calc((var(--cone-spread) + 15) * 1%),
    transparent calc((100 - var(--cone-spread) - 15) * 1%),
    black  calc((100 - var(--cone-spread)) * 1%)
  );
}

/* Layer 2: colored mesh-gradient background fill near edges */
.glow-border-wrap::after {
  border: 1px solid transparent;
  background:
    radial-gradient(at 80% 55%, #c084fc 0px, transparent 50%) padding-box,
    radial-gradient(at 69% 34%, #f472b6 0px, transparent 50%) padding-box,
    radial-gradient(at 8% 6%,   #38bdf8 0px, transparent 50%) padding-box,
    radial-gradient(at 41% 38%, #c084fc 0px, transparent 50%) padding-box,
    radial-gradient(at 86% 85%, #f472b6 0px, transparent 50%) padding-box,
    radial-gradient(at 82% 18%, #38bdf8 0px, transparent 50%) padding-box,
    radial-gradient(at 51% 4%,  #f472b6 0px, transparent 50%) padding-box,
    linear-gradient(#c084fc 0 100%) padding-box;

  -webkit-mask-image:
    linear-gradient(to bottom, black, black),
    radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%),
    radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%),
    radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%),
    radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%),
    radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%),
    conic-gradient(from var(--cursor-angle) at center, transparent 5%, black 15%, black 85%, transparent 95%);
  mask-image:
    linear-gradient(to bottom, black, black),
    radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%),
    radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%),
    radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%),
    radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%),
    radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%),
    conic-gradient(from var(--cursor-angle) at center, transparent 5%, black 15%, black 85%, transparent 95%);

  -webkit-mask-composite: destination-out, source-over, source-over, source-over, source-over, source-over;
  mask-composite: subtract, add, add, add, add, add;
  opacity: calc(
    var(--fill-opacity) *
    (var(--edge-proximity) - var(--color-sensitivity))
    / (100 - var(--color-sensitivity))
  );
  mix-blend-mode: soft-light;
}

/* Layer 3: outer glow halo */
.glow-border-wrap > .glow-edge-light {
  inset: calc(var(--glow-padding) * -1);
  pointer-events: none;
  z-index: 1;

  -webkit-mask-image: conic-gradient(
    from var(--cursor-angle) at center,
    black 2.5%, transparent 10%, transparent 90%, black 97.5%
  );
  mask-image: conic-gradient(
    from var(--cursor-angle) at center,
    black 2.5%, transparent 10%, transparent 90%, black 97.5%
  );

  opacity: calc(
    (var(--edge-proximity) - var(--edge-sensitivity))
    / (100 - var(--edge-sensitivity))
  );
  mix-blend-mode: plus-lighter;
}

.glow-border-wrap > .glow-edge-light::before {
  content: '';
  position: absolute;
  inset: var(--glow-padding);
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px   hsl(40 80% 80% / 100%),
    inset 0 0 1px  0   hsl(40 80% 80% / 60%),
    inset 0 0 3px  0   hsl(40 80% 80% / 50%),
    inset 0 0 6px  0   hsl(40 80% 80% / 40%),
    inset 0 0 15px 0   hsl(40 80% 80% / 30%),
    inset 0 0 25px 2px hsl(40 80% 80% / 20%),
    inset 0 0 50px 2px hsl(40 80% 80% / 10%),
          0 0 1px  0   hsl(40 80% 80% / 60%),
          0 0 3px  0   hsl(40 80% 80% / 50%),
          0 0 6px  0   hsl(40 80% 80% / 40%),
          0 0 15px 0   hsl(40 80% 80% / 30%),
          0 0 25px 2px hsl(40 80% 80% / 20%),
          0 0 50px 2px hsl(40 80% 80% / 10%);
}

/* Inner card */
.glow-border-inner {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: auto;
  z-index: 1;
}

/* Override text colors inside glow cards for dark bg */
.glow-border-inner .ov-step {
  --tw-bg-opacity: 0;
}
.glow-border-inner .ov-step:hover {
  background: rgba(255,255,255,0.06);
}
.glow-border-inner .text-on-surface,
.glow-border-inner .text-on-background {
  color: rgba(255,255,255,0.9) !important;
}
.glow-border-inner .text-on-surface-variant {
  color: rgba(255,255,255,0.5) !important;
}
.glow-border-inner .text-\[\#26353b\] {
  color: rgba(255,255,255,0.9) !important;
}
.glow-border-inner .text-\[\#526168\] {
  color: rgba(255,255,255,0.5) !important;
}
.glow-border-inner .text-\[\#5a5e6a\] {
  color: rgba(255,255,255,0.6) !important;
}
.glow-border-inner .bg-\[\#5a5e6a\]\/10 {
  background: rgba(255,255,255,0.1) !important;
}
.glow-border-inner .bg-white\/60 {
  background: rgba(255,255,255,0.08) !important;
}
.glow-border-inner input.bg-white\/60,
.glow-border-inner input[type="text"] {
  color: rgba(255,255,255,0.85) !important;
  border-color: rgba(255,255,255,0.1) !important;
}
.glow-border-inner input::placeholder {
  color: rgba(255,255,255,0.3) !important;
}

/* ══════ Textarea slim scrollbar ══════ */
.glow-border-inner textarea::-webkit-scrollbar { width: 3px; }
.glow-border-inner textarea::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }
.glow-border-inner textarea::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }
.glow-border-inner textarea::-webkit-scrollbar-track { background: transparent; }
.glow-border-inner textarea { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }

/* ══════ Edit Action Pill Buttons ══════ */
.edit-action-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 28px 10px 20px;
  border-radius: 999px;
  min-width: 150px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(11, 19, 32, 0.6);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.edit-action-pill:hover:not(:disabled) {
  border-color: var(--pill-accent, #67e8f9);
  box-shadow: 0 0 20px var(--pill-glow, rgba(0,242,255,0.15)), inset 0 0 20px var(--pill-glow, rgba(0,242,255,0.08));
  transform: translateY(-1px);
}
.edit-action-pill:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
}
.edit-action-pill:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.edit-action-pill .edit-action-icon {
  transition: transform 0.3s ease;
}
.edit-action-pill:hover:not(:disabled) .edit-action-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px var(--pill-accent, #67e8f9));
}

/* ══════ Edit Action Loading State ══════ */
.edit-action-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 10;
  border-radius: 999px;
  background: rgba(11, 19, 32, 0.88);
  backdrop-filter: blur(8px);
  animation: editLoadFadeIn 0.3s ease-out;
}
@keyframes editLoadFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.edit-action-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: var(--spinner-color, #67e8f9);
  animation: editSpin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes editSpin {
  to { transform: rotate(360deg); }
}
.edit-action-loading .edit-load-text {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.06em;
  white-space: nowrap;
  animation: editLoadPulse 1.8s ease-in-out infinite;
}
.edit-action-loading .edit-load-sub {
  display: none;
}
@keyframes editLoadPulse {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* ══════ Agent FAB ══════ */
.agent-fab {
  position: fixed;
  right: 4.5rem;
  bottom: 4.5rem;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #0a0f11;
  color: #f6fafd;
  border: 4px solid white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  z-index: 9998;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: agentFloat 4s ease-in-out infinite;
  overflow: hidden;
}
@keyframes agentFloat {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}
.agent-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 14px 50px rgba(0,0,0,0.22);
}
.agent-fab:active { transform: scale(0.90); animation: none; }
.agent-fab-icon { font-size: 30px; position: relative; z-index: 2; }
.agent-fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(90,94,106,0.15);
  backdrop-filter: blur(2px);
  pointer-events: none;
  z-index: 1;
}
.agent-fab.is-open {
  animation: none;
}
.agent-fab.is-open .agent-fab-icon { display: none; }
.agent-fab.is-open .agent-fab-pulse { display: none; }
.agent-fab.is-open::after {
  content: '✕';
  font-size: 22px;
  font-weight: 300;
  position: relative;
  z-index: 2;
}

/* ══════ Agent Panel ══════ */
.agent-panel {
  position: fixed;
  right: 4.5rem;
  bottom: 8.5rem;
  width: 420px;
  max-height: 70vh;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.12) 100%);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 1.5rem;
  box-shadow: 0 20px 60px rgba(31,38,135,0.08), 0 0 0 1px rgba(255,255,255,0.3) inset;
  z-index: 9997;
  overflow: hidden;
  transform-origin: bottom right;
  animation: agentPanelIn 0.35s ease-out;
}
@keyframes agentPanelIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.agent-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  flex-shrink: 0;
}
.agent-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.agent-panel-body::-webkit-scrollbar { width: 3px; }
.agent-panel-body::-webkit-scrollbar-thumb { background: rgba(144,164,174,0.2); border-radius: 3px; }
.agent-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  flex: 1;
}
.agent-panel-refs {
  padding: 8px 20px;
  border-top: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.agent-panel-input {
  padding: 16px 20px 20px;
  flex-shrink: 0;
}
.agent-input-wrap {
  position: relative;
  background: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.04);
  backdrop-filter: blur(8px);
  overflow: hidden;
  transition: background 0.2s, box-shadow 0.2s;
}
.agent-input-wrap:focus-within {
  background: rgba(255,255,255,0.65);
  box-shadow: 0 8px 32px rgba(0,0,0,0.06);
}
.agent-input-ta {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-size: 13px;
  line-height: 1.6;
  padding: 14px 60px 14px 18px;
  min-height: 52px;
  max-height: 120px;
  color: #26353b;
}
.agent-input-ta:focus { outline: none; box-shadow: none; }
.agent-input-ta::placeholder { color: rgba(82,97,104,0.4); }
.agent-send-btn {
  position: absolute;
  right: 10px;
  bottom: 8px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #0a0f11;
  color: #f6fafd;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.agent-send-btn:hover { transform: scale(1.05); }
.agent-send-btn:active { transform: scale(0.92); }
.agent-send-btn:disabled { opacity: 0.3; pointer-events: none; }

/* Agent Messages */
.agent-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}
.agent-msg--user { align-items: flex-end; }
.agent-msg--ai { align-items: flex-start; }
.agent-msg-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(82,97,104,0.4);
  padding: 0 4px;
}
.agent-msg-bubble {
  padding: 14px 18px;
  border-radius: 1rem;
  font-size: 13px;
  line-height: 1.7;
  max-width: 90%;
  word-break: break-word;
}
.agent-msg--ai .agent-msg-bubble {
  background: rgba(221,234,241,0.6);
  color: #26353b;
  border: 1px solid rgba(255,255,255,0.4);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.agent-msg--user .agent-msg-bubble {
  background: #5a5e6a;
  color: #f7f7ff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(90,94,106,0.2);
}
.agent-msg-loading {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: rgba(221,234,241,0.6);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 1rem;
  border-top-left-radius: 4px;
}
.agent-msg-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(90,94,106,0.35);
  animation: agentDotBounce 1.2s ease-in-out infinite;
}
.agent-msg-loading span:nth-child(2) { animation-delay: 0.15s; }
.agent-msg-loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes agentDotBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Reference Chips */
.agent-ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  color: #0B1320;
  background: rgba(207,216,220,0.5);
  border: 1px solid rgba(144,164,174,0.2);
  border-radius: 999px;
  white-space: nowrap;
  cursor: default;
  letter-spacing: 0.02em;
}
.agent-ref-chip .material-symbols-outlined {
  font-size: 12px;
  opacity: 0.5;
}
.agent-ref-chip .agent-ref-close {
  cursor: pointer;
  opacity: 0.4;
  margin-left: 2px;
  font-size: 12px;
}
.agent-ref-chip .agent-ref-close:hover { opacity: 1; }

/* Action Cards */
.agent-action-card {
  border: 1px solid rgba(144,164,174,0.2);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.7);
  margin-top: 4px;
}
.agent-action-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.agent-action-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #2C3E50;
  background: rgba(207,216,220,0.4);
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.agent-action-preview {
  font-size: 12px;
  color: #2C3E50;
  line-height: 1.6;
  background: rgba(236,239,241,0.5);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  max-height: 80px;
  overflow-y: auto;
}
.agent-action-btns {
  display: flex;
  gap: 6px;
}
.agent-action-btns button {
  padding: 5px 14px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.agent-action-apply {
  background: #0B1320;
  color: #ECEFF1;
}
.agent-action-apply:hover { opacity: 0.85; }
.agent-action-skip {
  background: rgba(207,216,220,0.4);
  color: #2C3E50;
}
.agent-action-skip:hover { background: rgba(207,216,220,0.6); }

/* Cascade reminder */
.agent-cascade-card {
  border: 1px solid #ffcc80;
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fff8e1, #fff3e0);
}
.agent-cascade-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #e65100;
  margin-bottom: 8px;
}
.agent-cascade-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #2C3E50;
  padding: 4px 0;
}
.agent-cascade-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  accent-color: #e65100;
}
.agent-cascade-btns {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.agent-cascade-btns button {
  padding: 5px 14px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.agent-cascade-regen {
  background: #e65100;
  color: white;
}
.agent-cascade-later {
  background: rgba(255,204,128,0.4);
  color: #e65100;
}

/* Card reference hover hint */
.agent-refable {
  position: relative;
}
.agent-refable::after {
  content: '@';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(11,19,32,0.7);
  color: white;
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 5;
}
.agent-refable:hover::after {
  opacity: 0.6;
}

/* ── Stale / outdated indicators ── */
.stale-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 9px;
  font-weight: 700;
  color: #e65100;
  background: #fff3e0;
  border: 1px solid #ffcc80;
  border-radius: 999px;
  letter-spacing: 0.03em;
  vertical-align: middle;
  animation: stalePulse 2s ease-in-out infinite;
}
@keyframes stalePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.stale-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #e65100;
  background: linear-gradient(90deg, #fff3e0, #ffe0b2);
  border-bottom: 1px solid #ffcc80;
  border-radius: 12px 12px 0 0;
}
/* ── Script Library Panel ── */
.script-lib-panel {
  position: absolute;
  display: flex; flex-direction: column;
  z-index: 20;
  transition: all 0.35s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.script-lib--collapsed {
  width: auto; height: auto; max-height: none;
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  border-radius: 0 14px 14px 0;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 4px 0 16px rgba(0,0,0,0.06), 0 0 0 1px rgba(255,255,255,0.4) inset;
  border: none; padding: 0;
}
.script-lib--collapsed .script-lib-expanded { display: none; }
.script-lib--collapsed .script-lib-collapsed-strip { display: flex; }
.script-lib--expanded {
  width: 353px; max-height: 1060px; height: 80vh;
  left: 0; top: 50%; transform: translateY(-50%);
  background: linear-gradient(135deg, rgba(246,250,253,0.92) 0%, rgba(238,245,249,0.82) 100%);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  border-right: 1px solid rgba(255,255,255,0.25);
  border-radius: 0 1.5rem 1.5rem 0;
  box-shadow: 6px 0 40px rgba(90,94,106,0.06);
}
.script-lib--expanded .script-lib-expanded {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
}
.script-lib--expanded .script-lib-collapsed-strip { display: none; }

.script-lib-collapsed-strip {
  display: none;
  flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; cursor: pointer;
  color: rgba(82,97,104,0.6); transition: all 0.2s;
  writing-mode: horizontal-tb;
}
.script-lib-collapsed-strip:hover { color: #5a5e6a; background: rgba(255,255,255,0.9); border-radius: 0 14px 14px 0; }
.script-lib-badge {
  font-size: 9px; font-weight: 800;
  background: #5a5e6a; color: #fff;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

.script-lib-header {
  padding: 24px 20px 6px; flex-shrink: 0;
}
.script-lib-actions { padding: 16px 16px 12px; flex-shrink: 0; }
.script-lib-upload-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px 16px;
  border: none; border-radius: 9999px;
  background: #0B1320; color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(11,19,32,0.12);
}
.script-lib-upload-btn:hover {
  background: #1a2a3d;
  box-shadow: 0 6px 24px rgba(11,19,32,0.18);
  transform: translateY(-1px);
}
.script-lib-upload-btn:active { transform: scale(0.97); }

.script-lib-subtitle {
  font-size: 10px; font-weight: 700; letter-spacing: 0.15em;
  text-transform: uppercase; color: rgba(82,97,104,0.5);
  padding: 8px 20px 10px;
}

.script-lib-list {
  flex: 1; overflow-y: auto; padding: 0 16px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.script-lib-list::-webkit-scrollbar { display: none; }

.script-lib-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 6px 4px; border-radius: 12px; cursor: pointer;
  transition: all 0.2s; position: relative;
}
.script-lib-item:hover { background: rgba(255,255,255,0.5); }
.script-lib-item.is-active { background: rgba(255,255,255,0.7); }

.script-lib-item-thumb {
  width: 36px; height: 46px; border-radius: 8px; flex-shrink: 0;
  background: #fff; border: 1px solid rgba(165,180,188,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  overflow: hidden; position: relative;
}
.script-lib-item-thumb-bar {
  width: 100%; height: 3px;
}
.script-lib-item-thumb-bar--upload { background: #5a5e6a; }
.script-lib-item-thumb-bar--generated { background: #7b1fa2; opacity: 0.4; }
.script-lib-item-thumb-bar--episode { background: #2e7d32; opacity: 0.4; }

.script-lib-item-info { flex: 1; min-width: 0; padding-top: 2px; }
.script-lib-item-name {
  font-size: 13px; font-weight: 600; color: #26353b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.2s;
}
.script-lib-item:hover .script-lib-item-name { color: #5a5e6a; }
.script-lib-item-date {
  font-size: 10px; color: rgba(82,97,104,0.45); margin-top: 3px;
}
.script-lib-item-actions {
  display: flex; gap: 1px; position: absolute; right: 4px; top: 6px;
  opacity: 0; transition: opacity 0.15s;
}
.script-lib-item:hover .script-lib-item-actions { opacity: 1; }
.script-lib-item-btn {
  width: 22px; height: 22px; border-radius: 8px; border: none;
  background: transparent; color: rgba(82,97,104,0.4); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.script-lib-item-btn:hover { background: rgba(0,0,0,0.05); color: #5a5e6a; }

.upstream-stale-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 600;
  color: #bf360c;
  background: linear-gradient(135deg, #fff3e0, #ffe0b244);
  border: 1px solid #ffcc80;
  border-radius: 12px;
  margin-bottom: 12px;
}
.upstream-stale-banner .material-symbols-outlined { font-size: 18px; color: #e65100; }
.prompt-preview-status.stale-warn {
  color: #e65100;
  background: #fff3e0;
  border-color: #ffcc80;
}

/* ═══════════════════════════════════════════
   Auto Edit Studio
   ═══════════════════════════════════════════ */

/* dark frosted-glass base — organic asymmetric radius from stitch(17), dark-adapted */
.edit-glass-panel {
  background: linear-gradient(180deg, rgba(40, 44, 52, 0.55) 0%, rgba(30, 33, 40, 0.45) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 40px 10px 40px 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

/* scanline overlay for preview monitor */
.edit-scanlines {
  background: linear-gradient(to bottom, rgba(11,19,32,0) 50%, rgba(11,19,32,0.03) 50%);
  background-size: 100% 4px;
  pointer-events: none;
}

/* neural grid pattern for panels */
.edit-neural-grid {
  background-image: radial-gradient(rgba(144,164,174,0.06) 1px, transparent 1px);
  background-size: 12px 12px;
}

/* halftone texture button */
.edit-halftone-btn {
  position: relative; overflow: hidden;
}
.edit-halftone-btn::after {
  content: '';
  position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(0,242,255,0.08) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.3s;
}
.edit-halftone-btn:hover::after { opacity: 1; }

/* playhead red pulse glow */
@keyframes playhead-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,59,48,0.5); }
  50% { box-shadow: 0 0 20px rgba(255,59,48,0.8); }
}
.edit-playhead-glow { animation: playhead-pulse 2s infinite ease-in-out; }

/* hairline accent — top edge only for glass containers */
.edit-hairline-top { border-top: 0.5px solid rgba(144,164,174,0.15); }

/* label font utility */
.edit-label {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 13px; font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

/* headline font utility */
.edit-headline {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 500; letter-spacing: -0.02em;
}

/* hide scrollbar utility */
.edit-hide-scrollbar::-webkit-scrollbar { display: none; }
.edit-hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Timeline thin scrollbar — both axes */
#editTimelineScroll::-webkit-scrollbar { width: 4px; height: 4px; }
#editTimelineScroll::-webkit-scrollbar-track { background: transparent; }
#editTimelineScroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12); border-radius: 4px;
}
#editTimelineScroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}
#editTimelineScroll::-webkit-scrollbar-corner { background: transparent; }
#editTimelineScroll { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.12) transparent; }
/* segment block — stitch(17) style */
.edit-segment-block {
  flex-shrink: 0; height: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px; overflow: hidden;
  cursor: pointer; position: relative;
  background: rgba(30,42,58,0.75);
  transition: all 0.2s;
}
.edit-segment-block:hover {
  background: rgba(35,48,65,0.85);
}
.edit-segment-block.edit-seg-active {
  box-shadow: 0 0 0 1px rgba(0,242,255,0.4), 0 4px 16px rgba(0,242,255,0.1);
  border-color: rgba(0,242,255,0.3);
}

/* color bar — top accent line */
.edit-seg-color-bar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px; z-index: 5;
}
.edit-seg-color-bar::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px; background: rgba(0,242,255,0.3);
}

/* filmstrip (fills block background) */
.edit-seg-filmstrip {
  position: absolute; top: 3px; left: 0; right: 0; bottom: 20px;
  display: flex; overflow: hidden;
}
.edit-filmstrip-frame {
  height: 100%; flex-shrink: 0;
  object-fit: cover; opacity: 0.7;
}

/* info overlay on top of filmstrip */
.edit-seg-overlay {
  position: absolute; top: 3px; left: 0; right: 0;
  display: flex; align-items: center; gap: 4px;
  padding: 3px 6px; z-index: 4;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
}
.edit-seg-label {
  font-size: 14px; font-weight: 800;
  color: rgba(255,255,255,0.9);
}
.edit-seg-emotion {
  font-size: 12px; color: rgba(255,255,255,0.5);
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; flex: 1;
}
.edit-seg-dur {
  font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}

/* waveform canvas */
.edit-seg-waveform {
  position: absolute; bottom: 0; left: 0;
  height: 20px; z-index: 3;
  pointer-events: none;
}

/* trim handles */
.edit-trim-handle {
  position: absolute; top: 0; bottom: 0;
  width: 6px; z-index: 10;
  cursor: col-resize;
  transition: background 0.15s;
}
.edit-trim-handle:hover,
.edit-trim-handle:active {
  background: rgba(255,255,255,0.6);
}
.edit-trim-left { left: 0; border-radius: 6px 0 0 6px; }
.edit-trim-right { right: 0; border-radius: 0 6px 6px 0; }
.edit-trim-handle::after {
  content: ""; position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 16px;
  background: rgba(255,255,255,0.4);
  border-radius: 1px;
}
.edit-trim-handle:hover::after,
.edit-trim-handle:active::after {
  background: #fff;
  height: 20px;
}

/* transition marker */
.edit-transition-marker {
  width: 20px; height: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 800;
  color: rgba(0,242,255,0.3);
  border: 1px dashed rgba(0,242,255,0.2);
  border-radius: 50%; cursor: pointer;
  margin: auto 2px; transition: all 0.2s;
}
.edit-transition-marker:hover {
  background: rgba(0,242,255,0.06);
  color: rgba(0,242,255,0.7);
}

/* time ruler */
.edit-ruler {
  display: block; height: 24px;
  margin-bottom: 2px;
}

/* preloaded video pool */
.edit-pool-video {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain; border-radius: 8px;
  display: none; background: #000;
}

/* BGM track block */
.edit-bgm-block {
  display: flex; align-items: center; gap: 4px;
  height: 100%; padding: 0 8px;
  background: linear-gradient(135deg, #7c3aed30, #6d28d930);
  border: 1px solid #7c3aed40;
  border-radius: 6px; cursor: grab;
  color: #7c3aed; font-size: 10px;
  white-space: nowrap; overflow: hidden;
}
.edit-bgm-block:active { cursor: grabbing; }

/* tag card in right panel — Phase style */
.edit-tag-card {
  padding: 12px 14px; border-radius: 0;
  background: rgba(255,255,255,0.02);
  border: none;
  border-left: 2px solid rgba(144,164,174,0.10);
  font-size: 13px;
  transition: border-color 0.3s;
}
.edit-tag-card:hover { border-left-color: rgba(144,164,174,0.5); }
.edit-tag-card p,
.edit-tag-card .text-on-surface-variant\/70 { color: rgba(207,216,220,0.7) !important; }
.edit-tag-card .text-on-surface-variant\/50,
.edit-tag-card .text-on-surface-variant\/40 { color: rgba(144,164,174,0.6) !important; }
.edit-tag-card .bg-surface-container { background: rgba(255,255,255,0.08) !important; color: rgba(207,216,220,0.6) !important; }

/* ── Media library panel ── */
.edit-media-tab {
  padding: 6px 14px; border-radius: 9999px;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(144,164,174,0.5); cursor: pointer;
  border: 1px solid transparent; background: none;
  transition: all 0.2s;
}
.edit-media-tab:hover { color: rgba(207,216,220,0.7); }
.edit-media-tab--active {
  background: rgba(255,255,255,0.06);
  border-color: rgba(144,164,174,0.12);
  color: rgba(207,216,220,0.9);
}

.edit-media-card {
  position: relative; border-radius: 20px;
  overflow: hidden; cursor: grab;
  border: 1px solid rgba(144,164,174,0.08);
  background: rgba(255,255,255,0.03);
  transition: all 0.5s;
}
.edit-media-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  border-color: rgba(144,164,174,0.15);
}
.edit-media-card:active { cursor: grabbing; }
.edit-media-card img,
.edit-media-card video {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover; display: block;
  filter: grayscale(1); opacity: 0.6;
  transition: all 0.7s;
}
.edit-media-card:hover img,
.edit-media-card:hover video {
  filter: grayscale(0); opacity: 1;
}
.edit-media-card-info {
  padding: 6px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.edit-media-card-name {
  font-size: 12px; font-weight: 500;
  font-family: 'Space Grotesk', monospace;
  color: rgba(144,164,174,0.6);
  text-transform: uppercase; letter-spacing: -0.02em;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; flex: 1;
}
.edit-media-card-dur {
  font-size: 11px; font-weight: 500;
  font-family: monospace;
  color: rgba(144,164,174,0.6); flex-shrink: 0;
  margin-left: 4px;
}
.edit-media-card-delete {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5); color: #fff;
  font-size: 12px; cursor: pointer; opacity: 0;
  transition: opacity 0.15s;
}
.edit-media-card:hover .edit-media-card-delete { opacity: 1; }

/* ── Streaming wave animation ── */
@keyframes sw-cursor {
  0%, 100% { opacity: 0.1; transform: scaleY(0.7); }
  50%      { opacity: 0.85; transform: scaleY(1.1); }
}
@keyframes sw-flow {
  0%   { background-position: -50% 0; }
  100% { background-position: 150% 0; }
}
@keyframes sw-border-glow {
  0%, 100% { border-image-source: linear-gradient(90deg, transparent, rgba(124,138,255,0.15), transparent); }
  50%      { border-image-source: linear-gradient(90deg, transparent, rgba(124,138,255,0.45), transparent); }
}

.streaming-wave {
  position: relative;
}
.streaming-wave::after {
  content: '▍';
  display: inline;
  color: #7c8aff;
  font-weight: 100;
  vertical-align: baseline;
  margin-left: 1px;
  animation: sw-cursor 1.2s ease-in-out infinite;
}
.streaming-wave::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    rgba(124,138,255,0.25),
    rgba(139,157,255,0.7),
    rgba(124,138,255,0.25),
    transparent
  );
  background-size: 45% 100%;
  background-repeat: no-repeat;
  animation: sw-flow 2s ease-in-out infinite;
  pointer-events: none;
  border-radius: 2px;
}

/* ═══════════ 情绪标签可视化 ═══════════ */
.emotion-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}
.emotion-badge--1 { background: #FDE8E8; color: #7C2D2D; }
.emotion-badge--2 { background: #F9BFBF; color: #6B1E1E; }
.emotion-badge--3 { background: #F08080; color: #fff; }
.emotion-badge--4 { background: #DC3545; color: #fff; }
.emotion-badge--5 { background: #8B0000; color: #fff; }

.shot-emotion-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  font-size: 0.7rem;
  opacity: 0.85;
}

/* ─── 右侧情绪标尺 ─── */
.emotion-ruler {
  width: 54px;
  min-width: 54px;
  position: relative;
  margin-left: 6px;
  flex-shrink: 0;
}
.emotion-ruler-seg {
  position: absolute;
  right: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: opacity 0.2s;
  cursor: default;
  overflow: hidden;
}
.emotion-ruler-seg:hover {
  opacity: 0.85;
}
.emotion-ruler-seg .er-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  max-height: 100%;
  overflow: hidden;
}
.emotion-ruler-seg .er-intensity {
  font-size: 0.6rem;
  font-weight: 800;
  margin-top: 2px;
  writing-mode: horizontal-tb;
}
.emotion-ruler-seg .er-pacing {
  font-size: 0.5rem;
  font-weight: 500;
  opacity: 0.8;
  writing-mode: horizontal-tb;
}
.emotion-ruler-seg[data-intensity="1"] { background: #FDE8E8; color: #7C2D2D; }
.emotion-ruler-seg[data-intensity="2"] { background: #F9BFBF; color: #6B1E1E; }
.emotion-ruler-seg[data-intensity="3"] { background: #F08080; color: #fff; }
.emotion-ruler-seg[data-intensity="4"] { background: #DC3545; color: #fff; }
.emotion-ruler-seg[data-intensity="5"] { background: #8B0000; color: #fff; }

/* 连接线：从标尺指向文本区域 */
.emotion-ruler-seg::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  width: 6px;
  height: 1px;
  background: currentColor;
  opacity: 0.3;
}
