/* Arcana Animated Video Creator — Mobile-First (390x844+) & Desktop UI (Feature-Flagged) */
#animWorkspace {
  position: fixed;
  inset: 0;
  height: 100dvh;
  z-index: 4150;
  display: flex;
  flex-direction: column;
  background: #090a0f;
  color: #f3f4f6;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  overflow: hidden;
  box-sizing: border-box;
}
#animWorkspace *,
#animWorkspace *::before,
#animWorkspace *::after {
  box-sizing: border-box;
}
#animWorkspace.anim-hidden {
  display: none !important;
}
body.arcana-anim-active > .main,
body.arcana-anim-active > .sidebar {
  display: none !important;
}

.anim-topbar {
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 58px 0 12px;
  background: #11131a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
.anim-top-left,
.anim-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.anim-pill {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.25), rgba(0, 212, 255, 0.22));
  border: 1px solid rgba(124, 92, 255, 0.45);
  color: #ddd6fe;
  white-space: nowrap;
}
.anim-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}
.anim-card {
  background: #131620;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.anim-card-title {
  font-size: 15.5px;
  font-weight: 700;
  color: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.anim-sub {
  font-size: 13.5px;
  color: #b4bcc8;
  line-height: 1.5;
}
.anim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 10px;
}
.anim-pick-card {
  text-align: left;
  padding: 12px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #f3f4f6;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 76px;
  transition: border-color 140ms ease-out, background 140ms ease-out;
}
.anim-pick-card:hover {
  border-color: rgba(0, 212, 255, 0.45);
}
.anim-pick-card.active {
  border-color: #00d4ff;
  background: rgba(0, 212, 255, 0.11);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.35);
}
.anim-pick-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.anim-pick-desc {
  font-size: 12.5px;
  color: #9ca3af;
  line-height: 1.4;
}
.anim-swatches {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}
.anim-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.anim-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.anim-voice-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.anim-voice-row .anim-select {
  flex: 1 1 auto;
  min-width: 0;
}
.anim-voice-preview-btn {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  white-space: nowrap;
}
.anim-voice-vibe {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
  line-height: 1.35;
}
.anim-input,
.anim-select {
  width: 100%;
  min-height: 44px;
  background: #0b0d14;
  color: #f3f4f6;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.anim-input:focus,
.anim-select:focus {
  border-color: #00d4ff;
}
.anim-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #f3f4f6;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.anim-btn.primary {
  border: none;
  background: linear-gradient(135deg, #7c5cff, #4f46e5);
  color: #fff;
}
.anim-btn.green {
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}
.anim-btn.danger {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}
.anim-btn.yt {
  border: none;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}
.anim-textarea {
  width: 100%;
  min-height: 112px;
  background: #0b0d14;
  color: #f3f4f6;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.anim-textarea:focus {
  border-color: #00d4ff;
}
.anim-yt-panel {
  margin-top: 6px;
  padding: 14px;
  border-radius: 12px;
  background: #0b0d14;
  border: 1px solid rgba(239, 68, 68, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.anim-pub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.anim-pub-tab {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.anim-pub-tab:hover {
  border-color: rgba(0, 212, 255, 0.45);
  color: #fff;
}
.anim-pub-tab.active {
  border-color: #00d4ff;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.28), rgba(0, 212, 255, 0.2));
  color: #ffffff;
}
.anim-yt-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.anim-yt-chip {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}
.anim-yt-chip.warn {
  background: rgba(250, 204, 21, 0.12);
  border-color: rgba(250, 204, 21, 0.35);
  color: #fde68a;
}
.anim-yt-title-pills {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.anim-yt-title-opt {
  text-align: left;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: #e5e7eb;
  font-size: 13.5px;
  cursor: pointer;
  min-height: 40px;
}
.anim-yt-title-opt.active {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  color: #fff;
  font-weight: 600;
}
.anim-thumb-preview {
  width: 100%;
  max-width: 440px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #05070c;
  display: block;
}
.anim-yt-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: #d1d5db;
}
.anim-yt-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-height: 36px;
}
.anim-yt-done {
  padding: 12px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.anim-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.anim-est-box {
  padding: 12px 14px;
  border-radius: 11px;
  background: rgba(124, 92, 255, 0.09);
  border: 1px solid rgba(124, 92, 255, 0.32);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}
.anim-warn {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(250, 204, 21, 0.11);
  border: 1px solid rgba(250, 204, 21, 0.35);
  color: #fde68a;
  font-size: 13px;
  line-height: 1.45;
}
.anim-scene-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}
.anim-scene-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: #0b0d14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13.5px;
  line-height: 1.5;
}
.anim-prog-track {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.anim-prog-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c5cff, #00d4ff);
  transition: width 220ms ease-out;
}
.anim-video-preview {
  width: 100%;
  max-height: 380px;
  border-radius: 12px;
  background: #000;
}
.anim-actions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.anim-toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 5200;
  background: #1f2433;
  color: #fff;
  border: 1px solid rgba(0, 212, 255, 0.45);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  display: none;
  max-width: calc(100vw - 24px);
  text-align: center;
}
.anim-toast.show { display: block; }

.anim-gender-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.anim-gender-toggle .anim-btn {
  min-height: 44px;
  font-size: 13px;
  padding: 0 10px;
}
.anim-yt-channel-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.11);
}
.anim-yt-channel-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.anim-yt-channel-controls .anim-select {
  flex: 1 1 200px;
  min-width: 0;
}
.anim-yt-ch-thumb {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 768px) {
  .anim-topbar { height: 50px; padding: 0 52px 0 8px; gap: 6px; }
  .anim-topbar .anim-btn { min-height: 36px; padding: 0 10px; font-size: 12.5px; }
  .anim-pill { display: none; }
  .anim-main { padding: 12px 10px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .anim-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .anim-pick-card { min-width: 0; overflow-wrap: break-word; padding: 10px; }
  .anim-pick-title { flex-wrap: wrap; font-size: 13px; }
  .anim-row-2 { grid-template-columns: 1fr; }
  .anim-actions-wrap .anim-btn { flex: 1 1 auto; }
  .anim-yt-channel-controls .anim-btn { flex: 1 1 auto; }
}
@media (max-width: 440px) {
  #animQuotaBadge { display: none; }
}
