/* Jaspercotton Animate — episode & video studio */
:root {
  --animate-accent: #ff6b9d;
  --animate-accent-2: #ffb347;
  --animate-glow: rgba(255, 107, 157, 0.35);
}

body.view-animate {
  --page-accent: var(--animate-accent);
}

.site-tab[data-view="animate"].active {
  background: linear-gradient(135deg, var(--animate-accent), var(--animate-accent-2));
  color: #1a0a10;
  box-shadow: 0 0 18px var(--animate-glow);
}

.animate-top-bar {
  position: sticky;
  top: var(--site-nav-h);
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: -24px -20px 20px;
  padding: 12px 20px;
  background: rgba(10, 14, 20, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.animate-bar-logo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.animate-bar-logo span {
  background: linear-gradient(90deg, var(--animate-accent), var(--animate-accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.animate-bar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.animate-bar-link {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.animate-bar-link:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}

.animate-bar-link.active {
  background: linear-gradient(135deg, var(--animate-accent), var(--animate-accent-2));
  border-color: transparent;
  color: #1a0a10;
}

.animate-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  width: 100%;
}

@media (min-width: 720px) {
  .animate-bar-actions {
    width: auto;
  }
}

.animate-bar-actions #animateEpisodeTitle {
  flex: 1;
  min-width: 140px;
  max-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9rem;
}

.animate-bar-actions .animate-btn {
  padding: 8px 14px;
  font-size: 0.82rem;
  white-space: nowrap;
}

#animateStudio,
#animateFeatures,
#animateAiPanel {
  scroll-margin-top: calc(var(--site-nav-h) + 60px);
}

.animate-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.animate-hero {
  text-align: center;
  padding: 8px 0 28px;
}

.animate-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 800;
  background: linear-gradient(90deg, var(--animate-accent), var(--animate-accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.animate-hero p {
  margin: 0 auto;
  max-width: 560px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.animate-eyebrow {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--animate-accent);
}

.animate-studio {
  display: grid;
  grid-template-columns: 200px 1fr 220px;
  gap: 16px;
  align-items: start;
  min-width: 0;
}

@media (max-width: 960px) {
  .animate-studio {
    grid-template-columns: 1fr;
  }
}

.animate-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.animate-panel h2 {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.animate-scene-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.animate-scene-list button {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.animate-scene-list button.active {
  border-color: var(--animate-accent);
  background: rgba(255, 107, 157, 0.12);
}

.animate-scene-list button:hover {
  background: var(--bg-card-hover);
}

.animate-stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.animate-stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.animate-stage-toolbar input[type="text"] {
  flex: 1;
  min-width: 140px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
}

.animate-btn {
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.animate-btn:hover {
  background: var(--bg-card-hover);
}

.animate-btn.primary {
  background: linear-gradient(135deg, var(--animate-accent), #e84a7a);
  color: #fff;
}

.animate-btn.primary:hover {
  transform: translateY(-1px);
}

.animate-btn.playing,
.animate-btn.is-playing {
  background: var(--accent);
  color: var(--bg-deep);
}

.animate-canvas-shell {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  background: #2a1f4a;
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
  width: 100%;
  max-width: 100%;
  max-height: min(56vh, 420px);
  min-height: 160px;
  contain: paint;
  isolation: isolate;
}

.animate-canvas-shell canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block;
  touch-action: none;
}

#animateCanvas {
  z-index: 1;
  cursor: crosshair;
  touch-action: none;
}

#animateCanvas.tool-move {
  cursor: grab;
}

#animateCanvas.tool-eraser {
  cursor: cell;
}

#animateCanvas.tool-fill,
#animateCanvas.tool-eyedropper {
  cursor: crosshair;
}

#animateCanvas.tool-text {
  cursor: text;
}

.animate-ai-work {
  margin-top: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 20, 0.85);
}

.animate-ai-work-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.animate-ai-work-head span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--animate-accent);
}

.animate-ai-work-eta {
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  color: var(--text-muted) !important;
}

.animate-ai-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-card);
  overflow: hidden;
}

.animate-ai-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--animate-accent), var(--animate-accent-2));
  transition: width 0.25s ease;
}

.animate-ai-frame-preview {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scroll-snap-type: x mandatory;
}

.animate-ai-thumb {
  flex: 0 0 96px;
  scroll-snap-align: end;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
  animation: animate-ai-pop 0.35s ease;
}

.animate-ai-thumb.active {
  border-color: var(--animate-accent);
  box-shadow: 0 0 12px var(--animate-glow);
}

.animate-ai-thumb canvas {
  display: block;
  width: 96px;
  height: 54px;
  max-width: 96px;
  max-height: 54px;
}

.animate-ai-thumb span {
  display: block;
  padding: 3px 6px;
  font-size: 0.68rem;
  text-align: center;
  color: var(--text-muted);
}

@keyframes animate-ai-pop {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-tools-panel {
  max-height: none;
}

.animate-tools-panel h2 {
  margin-top: 16px;
}

.animate-tools-panel h2:first-of-type {
  margin-top: 0;
}

.animate-edit-panel {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.animate-edit-panel h2 {
  margin-top: 0;
  color: var(--animate-accent);
}

.animate-edit-hint {
  margin: 0 0 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.animate-edit-sub {
  margin: 14px 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.animate-edit-import {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.animate-edit-import .animate-btn {
  flex: 1 1 auto;
  min-width: 72px;
  font-size: 0.78rem;
  padding: 7px 8px;
}

.animate-btn-sm {
  font-size: 0.78rem !important;
  padding: 6px 10px !important;
}

.animate-media-label {
  margin: 4px 0 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-word;
}

.animate-edit-panel select {
  width: 100%;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
}

.animate-edit-panel input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
}

.animate-text-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 100px;
  overflow-y: auto;
}

.animate-text-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  margin-bottom: 4px;
  border-radius: 6px;
  background: var(--bg-card);
  font-size: 0.8rem;
}

.animate-text-list button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.animate-thumb-badge {
  display: block;
  margin-top: 2px;
  font-size: 0.62rem;
  color: var(--animate-accent);
  text-align: center;
  line-height: 1.2;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.animate-ai-panel {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.animate-ai-panel h2 {
  margin-top: 0;
  color: var(--animate-accent);
}

.animate-ai-hint {
  margin: 0 0 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.animate-file-banner {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #ffb347;
  background: rgba(255, 179, 71, 0.12);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text);
}

.animate-file-banner code {
  font-size: 0.75rem;
}

.animate-ai-panel textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.animate-ai-panel textarea:focus {
  outline: none;
  border-color: var(--animate-accent);
  box-shadow: 0 0 0 2px var(--animate-glow);
}

.animate-ai-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.animate-ai-actions .animate-btn {
  width: 100%;
  justify-content: center;
}

.animate-ai-status {
  margin: 10px 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.animate-tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.animate-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.animate-tool-btn .animate-tool-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.animate-tool-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.animate-tool-btn.active {
  border-color: var(--animate-accent);
  background: rgba(255, 107, 157, 0.15);
  color: var(--text);
  box-shadow: 0 0 10px var(--animate-glow);
}

.animate-color-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.animate-color-row input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
}

.animate-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.animate-palette button {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.animate-palette button.active {
  border-color: #fff;
  box-shadow: 0 0 0 1px var(--animate-accent);
}

.animate-prop-row input[type="range"] {
  width: 100%;
  accent-color: var(--animate-accent);
}

.animate-draw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.animate-draw-actions .animate-btn {
  flex: 1;
  min-width: 70px;
  font-size: 0.78rem;
  padding: 7px 8px;
}

.animate-studio {
  grid-template-columns: 180px 1fr 240px;
}

.animate-caption-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 12px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  min-height: 44px;
}

.animate-timeline {
  margin-top: 8px;
}

.animate-frame-thumb.drop-target {
  border-color: #4d96ff;
  box-shadow: 0 0 14px rgba(77, 150, 255, 0.55);
  transform: scale(1.04);
}

.animate-media-bin {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.animate-media-bin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.animate-media-bin-head h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.animate-media-bin-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.animate-media-bin-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 4px 10px;
  min-height: 78px;
  scroll-snap-type: x mandatory;
  border-radius: var(--radius-sm);
  border: 2px dashed transparent;
  transition: border-color 0.15s, background 0.15s;
}

.animate-media-bin-track.drag-over {
  border-color: var(--animate-accent);
  background: rgba(255, 107, 157, 0.08);
}

.animate-media-bin-add {
  flex: 0 0 72px;
  height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.68rem;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 0.15s, color 0.15s;
}

.animate-media-bin-add:hover {
  border-color: var(--animate-accent);
  color: var(--text);
}

.animate-media-bin-add-icon {
  font-size: 1.4rem;
  line-height: 1;
  color: var(--animate-accent);
}

.animate-media-item {
  flex: 0 0 72px;
  height: 72px;
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0a0e14;
  overflow: hidden;
  cursor: grab;
  scroll-snap-align: start;
  transition: border-color 0.15s, transform 0.12s;
}

.animate-media-item:active {
  cursor: grabbing;
}

.animate-media-item.dragging {
  opacity: 0.45;
}

.animate-media-item img,
.animate-media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.animate-media-item-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 4px;
  font-size: 0.58rem;
  line-height: 1.2;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.animate-media-item-type {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 0.55rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  pointer-events: none;
}

.animate-media-item-remove {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}

.animate-media-item:hover .animate-media-item-remove {
  opacity: 1;
}

.animate-frame-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 4px 12px;
  scroll-snap-type: x mandatory;
  align-items: stretch;
}

.animate-frame-add {
  flex: 0 0 88px;
  min-height: 74px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px dashed rgba(255, 107, 157, 0.55);
  border-radius: var(--radius-sm);
  background: rgba(255, 107, 157, 0.08);
  color: var(--animate-accent);
  cursor: pointer;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.animate-frame-add span {
  font-size: 1.6rem;
  line-height: 1;
}

.animate-frame-add small {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.animate-frame-add:hover {
  background: rgba(255, 107, 157, 0.18);
  border-color: var(--animate-accent);
  transform: translateY(-1px);
}

.animate-frame-thumb {
  flex: 0 0 88px;
  scroll-snap-align: start;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s;
}

.animate-frame-thumb.active {
  border-color: var(--animate-accent);
  box-shadow: 0 0 12px var(--animate-glow);
}

.animate-frame-thumb canvas {
  display: block;
  width: 100%;
  height: auto;
}

.animate-frame-thumb span {
  display: block;
  padding: 4px 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

.animate-prop-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.animate-prop-row label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.animate-prop-row input,
.animate-prop-row select,
.animate-prop-row textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.animate-prop-row textarea {
  min-height: 64px;
  resize: vertical;
}

.animate-actor-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.animate-actor-picks button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 1.25rem;
  cursor: pointer;
}

.animate-actor-picks button:hover {
  border-color: var(--animate-accent);
}

.animate-actor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.animate-actor-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.85rem;
}

.animate-actor-list li button {
  margin-left: auto;
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  background: #3d2020;
  color: #ffb4b4;
  font-size: 0.75rem;
  cursor: pointer;
}

.animate-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 2.5em;
}

.animate-status strong {
  color: var(--animate-accent);
}

.animate-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 36px;
}

.animate-feature {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.animate-feature h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--animate-accent);
}

.animate-feature p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}
