* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a1a;
  color: #fff;
  min-height: 100vh;
}

.container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: #2d2d2d;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid #3d3d3d;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.logo {
  text-align: center;
  margin-bottom: 10px;
}

.logo-img {
  max-width: 180px;
  height: auto;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 14px;
  color: #888;
}

.audio-dropzone {
  border: 1px solid #4a4a4a;
  border-radius: 4px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  height: 124px;
  min-height: 124px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.audio-dropzone:hover {
  border-color: #c41e3a;
  background: rgba(196, 30, 58, 0.1);
}

.audio-dropzone.has-file {
  border-color: #c41e3a;
  background: rgba(196, 30, 58, 0.1);
}

.audio-dropzone .audio-clear-btn {
  display: none;
  width: 28px;
  height: 28px;
  font-size: 20px;
  border-top-right-radius: inherit;
  border-bottom-left-radius: inherit;
  border-top-left-radius: 0;
  border-bottom-right-radius: 0;
}

.audio-dropzone.has-file .audio-clear-btn {
  display: flex;
}

.dropzone-text {
  color: #666;
  font-size: 13px;
  line-height: 1.5;
}

.dropzone-file {
  color: #fff;
  font-size: 13px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}

.audio-dropzone.has-file .dropzone-text {
  display: none;
}

.audio-dropzone.has-file .dropzone-file {
  display: block;
}

select, textarea {
  background: #1a1a1a;
  border: 1px solid #4a4a4a;
  border-radius: 4px;
  padding: 12px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

select:focus, textarea:focus {
  border-color: #c41e3a;
}

/* Position Selector */
.position-selector {
  display: flex;
  gap: 8px;
}

.position-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 2px solid #4a4a4a;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: #1a1a1a;
}

.position-option:hover {
  border-color: #888;
}

.position-option.selected {
  border-color: #c41e3a;
  background: rgba(196, 30, 58, 0.15);
}

.position-option img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 4px;
}

.position-option span {
  font-size: 11px;
  color: #888;
  text-align: center;
}

.position-option.selected span {
  color: #fff;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

/* Generate Modal */
.generate-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.generate-modal.active {
  display: flex;
}

.generate-modal-content {
  background: #2d2d2d;
  border-radius: 12px;
  width: fit-content;
  min-width: 30vw;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.generate-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #3d3d3d;
}

.generate-modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.generate-modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.generate-modal-close:hover {
  color: #fff;
}

/* Loader state */
.generate-modal-loader {
  padding: 60px 24px;
  text-align: center;
  display: none;
}

.generate-modal-loader.active {
  display: block;
}

.generate-modal-loader .spinner {
  margin: 0 auto 20px;
}

.generate-modal-loader .loader-text {
  font-size: 18px;
  margin-bottom: 8px;
  color: #fff;
}

.generate-modal-loader .loader-subtext {
  color: #888;
  font-size: 14px;
}

/* Preview state with horizontal scroll */
.generate-modal-preview {
  display: none;
  padding: 24px;
  overflow-x: auto;
  overflow-y: visible;
}

.generate-modal-preview.active {
  display: block;
}

.generate-modal-preview::-webkit-scrollbar {
  height: 8px;
}

.generate-modal-preview::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 4px;
}

.generate-modal-preview::-webkit-scrollbar-thumb {
  background: #4a4a4a;
  border-radius: 4px;
}

.generate-modal-preview::-webkit-scrollbar-thumb:hover {
  background: #5a5a5a;
}

/* Wrapper for synchronized scrolling of cards and waveform */
.preview-scroll-wrapper {
  display: inline-block;
  min-width: 100%;
}

.preview-scroll {
  position: relative;
  display: flex;
  gap: 16px;
  overflow: visible;
  padding: 40px 0;
  margin: -40px 0;
}

/* Preview Card - 3D Flip */
.preview-card {
  flex-shrink: 0;
  width: 220px;
  height: 500px;
  perspective: 1000px;
}

.preview-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

/* Flip to back animation */
.preview-card.flipping-to-back .preview-card-inner {
  animation: flip-to-back 0.4s ease-in-out forwards;
}

@keyframes flip-to-back {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(180deg); }
}

/* Flip to front animation */
.preview-card.flipping-to-front .preview-card-inner {
  animation: flip-to-front 0.4s ease-in-out forwards;
}

@keyframes flip-to-front {
  0% { transform: rotateY(180deg); }
  100% { transform: rotateY(360deg); }
}

/* Static states */
.preview-card.show-back .preview-card-inner {
  transform: rotateY(180deg);
}

.preview-card.show-front .preview-card-inner {
  transform: rotateY(0deg);
}

.preview-card-front,
.preview-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #1a1a1a;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #3a3a3a;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
}

.preview-card-back {
  transform: rotateY(180deg);
}

.preview-card.generating {
  opacity: 0.8;
}

.preview-card.complete .preview-card-front,
.preview-card.complete .preview-card-back {
  border-color: #4caf50;
}

.preview-card.error .preview-card-front,
.preview-card.error .preview-card-back {
  border-color: #ff6b6b;
}

/* Image wrapper for hover effects */
.preview-card-image-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}

.preview-card-image-wrapper:hover .preview-card-image {
  transform: scale(1.05);
}

.preview-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #4a4a4a;
  transition: transform 0.3s ease;
}

.preview-card.complete .preview-card-image {
  border-color: #4caf50;
}

.preview-card-loader {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.preview-card.generating .preview-card-loader {
  display: flex;
}

.preview-card-loader .card-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #333;
  border-top-color: #c41e3a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.preview-card-time {
  font-size: 12px;
  color: #888;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-card-time .time-interval {
  color: #888;
  transition: all 0.3s ease;
}

.preview-card-time .time-duration {
  color: #c41e3a;
  font-weight: 600;
  transition: all 0.3s ease;
}

/* Animated text update */
.preview-card-time.updating .time-interval,
.preview-card-time.updating .time-duration {
  animation: textPulse 0.4s ease;
}

@keyframes textPulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.05); color: #fff; }
  100% { opacity: 1; transform: scale(1); }
}

/* Duration exceeded warning */
.preview-card-time.duration-exceeded .time-duration {
  color: #ff0000;
  animation: durationExceededPulse 0.5s ease 3;
}

@keyframes durationExceededPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Global Waveform Container */
.global-waveform-container {
  position: relative;
  height: 60px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  margin-top: 38px;
  padding: 8px;
  overflow: visible;
  display: inline-block;
  min-width: 100%;
}

.global-waveform-canvas {
  width: 100%;
  height: 44px;
  display: block;
}

/* Playback progress overlay - top half by default (for chunk playback) */
.playback-progress {
  position: absolute;
  top: 0;
  left: 8px;
  right: 8px;
  height: 50%;
  pointer-events: none;
  z-index: 5;
}

/* Bottom half position for full audio playback */
.playback-progress-bottom {
  top: 50%;
  height: 50%;
}

.playback-progress-bar {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(196, 30, 58, 0.3);
  transition: width 0.05s linear;
}

.playback-cursor {
  display: none;
}

.chunk-markers {
  position: absolute;
  top: -16px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  pointer-events: none;
  overflow: visible;
}

/* Draggable hit area for boundary lines (all lines are now SVG) */
.chunk-boundary-hitarea {
  z-index: 10;
  pointer-events: auto;
  cursor: ew-resize;
}

.chunk-boundary-hitarea:hover {
  background: rgba(255, 107, 107, 0.1);
}

.chunk-boundary-hitarea.dragging {
  background: rgba(255, 107, 107, 0.2);
}

/* Audio Section - at bottom of card */
.audio-section {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 0 0 8px 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Waveform visualization */
.audio-waveform {
  position: relative;
  height: 32px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
}

.waveform-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.waveform-playhead {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
  opacity: 0;
  pointer-events: none;
}

.audio-waveform.playing .waveform-playhead {
  opacity: 1;
}

/* Audio Controls */
.audio-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.edge-controls {
  display: flex;
  gap: 2px;
}

.edge-btn {
  width: 26px;
  height: 22px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #aaa;
  font-size: 9px;
  cursor: pointer;
  border-radius: var(--btn-border-radius);
  transition: all 0.2s ease;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edge-btn:hover:not(:disabled) {
  background: rgba(196, 30, 58, 0.5);
  color: #fff;
}

.edge-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.play-segment-btn {
  width: 36px;
  height: 28px;
  border: none;
  background: #c41e3a;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--btn-border-radius);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.play-segment-btn:hover {
  background: #a01830;
  transform: scale(1.05);
}

.play-segment-btn.playing {
  background: #4caf50;
}

.preview-card-text {
  font-size: 12px;
  color: #ccc;
  line-height: 1.4;
  min-height: 80px;
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(60, 60, 60, 0.8) transparent; /* Firefox */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  text-align: center;
  flex: 1;
  transition: all 0.3s ease;
}

.preview-card-text::-webkit-scrollbar {
  width: 4px; /* Chrome/Safari */
}

.preview-card-text::-webkit-scrollbar-track {
  background: transparent;
}

.preview-card-text::-webkit-scrollbar-thumb {
  background: rgba(60, 60, 60, 0.85);
  border-radius: 999px;
}

.preview-card-text::-webkit-scrollbar-thumb:hover {
  background: rgba(80, 80, 80, 0.9);
}

/* Empty placeholder styling */
.preview-card-text .word.empty-placeholder {
  color: #666;
  font-style: italic;
}

/* Word transfer buttons */
.word-transfer-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #3d3d3d;
}

.word-btn {
  width: 28px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: var(--btn-border-radius);
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.word-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.word-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.word-btn.play-btn {
  width: 32px;
  height: 28px;
  background: rgba(196, 30, 58, 0.2);
  color: #c41e3a;
  margin: 0 4px;
}

.word-btn.play-btn:hover {
  background: rgba(196, 30, 58, 0.4);
  color: #fff;
}

/* Empty card state - keep normal look (still active) */

.preview-card.empty-card .word-transfer-buttons {
  display: none;
}

/* Delete button for empty cards */
.preview-card.empty-card .delete-card-btn {
  display: flex;
}

.delete-card-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(196, 30, 58, 0.8);
  border: none;
  color: #fff;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 25;
  transition: all 0.2s ease;
}

.delete-card-btn:hover {
  background: #c41e3a;
  transform: scale(1.1);
}

.delete-card-btn svg {
  width: 14px;
  height: 14px;
}

/* Add card zone between cards */
.add-card-zone {
  flex-shrink: 0;
  width: 16px;
  height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  margin: 0 -8px;
  z-index: 5;
}

.add-card-zone-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3d3d3d;
  border: 1px solid #4a4a4a;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.25s ease;
  pointer-events: none;
}

.add-card-zone:hover .add-card-zone-btn {
  opacity: 1;
  transform: scale(1);
}

.add-card-zone:hover .add-card-zone-btn:hover {
  background: #c41e3a;
  border-color: #c41e3a;
  color: #fff;
}

.add-card-zone-btn svg {
  width: 10px;
  height: 10px;
}

/* Word highlight on button hover - animated drift towards target */
.preview-card-text .word {
  display: inline-block;
}

/* Single word drift */
.preview-card-text .word.will-transfer-left {
  animation: drift-left 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
  transform-origin: right center;
}

.preview-card-text .word.will-transfer-right {
  animation: drift-right 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
  transform-origin: left center;
}

/* All words drift - animate the container */
.preview-card-text.all-drift-left {
  animation: drift-left 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
  transform-origin: right center;
}

.preview-card-text.all-drift-right {
  animation: drift-right 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
  transform-origin: left center;
}

@keyframes drift-left {
  0%, 100% {
    transform: translateX(0) scaleX(1);
  }
  25% {
    transform: translateX(-4px) scaleX(1.07);
  }
}

@keyframes drift-right {
  0%, 100% {
    transform: translateX(0) scaleX(1);
  }
  25% {
    transform: translateX(4px) scaleX(1.07);
  }
}

/* Animated text append */
.preview-card-text.appending {
  animation: textAppend 0.5s ease;
}

@keyframes textAppend {
  0% { background: transparent; }
  50% { background: rgba(196, 30, 58, 0.2); }
  100% { background: transparent; }
}

/* Merge button between cards */
.merge-button {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #3d3d3d;
  border: 2px solid #4a4a4a;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.3s ease;
  align-self: center;
  z-index: 10;
  margin: 0 -8px;
}

.merge-button:hover {
  background: #c41e3a;
  border-color: #c41e3a;
  color: #fff;
  transform: scale(1.1);
}

.merge-button.hiding {
  opacity: 0;
  transform: scale(0);
  width: 0;
  margin: 0;
  pointer-events: none;
}

/* Merged card - slides under previous card */
.preview-card.merged-card {
  cursor: pointer;
  position: relative;
}

/* Ghost card - semi-transparent grayscale placeholder */
.preview-card-ghost {
  pointer-events: none;
  opacity: 0.35;
  filter: grayscale(100%);
  border-radius: 12px;
  overflow: visible;
  background: transparent;
  box-sizing: border-box;
  z-index: 0;
  transition: opacity 0.3s ease;
}

.preview-card-ghost img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  opacity: 0.6;
  border-radius: 6px;
  border: 2px solid #4a4a4a;
}

/* Ghost wrapper - holds position for ghost */
.preview-card-ghost-wrapper {
  position: relative;
  flex-shrink: 0;
  width: 220px;
  height: 400px;
}

/* Empty circle between ghosts */
.merge-button.ghost-placeholder {
  background: transparent;
  border: 2px dashed #3d3d3d;
  color: transparent;
  cursor: default;
  pointer-events: none;
}

.merge-button.ghost-placeholder:hover {
  background: transparent;
  border-color: #3d3d3d;
}

/* Stack count indicator */
.preview-card .stack-indicator {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(196, 30, 58, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  display: none;
  z-index: 20;
}

.preview-card.has-stack .stack-indicator {
  display: block;
}

/* Hide stack indicator on merged (nested) cards - only show on top card */
.preview-card.merged-card .stack-indicator {
  display: none !important;
}

/* Hide old stacked-cards-container */
.stacked-cards-container {
  display: none;
}

/* Hover effect */
.preview-card:hover .preview-card-front,
.preview-card:hover .preview-card-back {
  border-color: #c41e3a;
}


/* SVG markers - default transition */
.chunk-path,
.chunk-line {
  transition: stroke 0.2s ease, opacity 0.2s ease;
}

/* Dimmed state for other chunks' lines */
.chunk-path.dimmed,
.chunk-line.dimmed {
  stroke: #444 !important;
  opacity: 0.25 !important;
}

/* Highlighted state for hovered chunk's lines */
.chunk-path.highlighted,
.chunk-line.highlighted {
  stroke: #c41e3a !important;
  opacity: 1 !important;
}


/* Modal Footer */
.generate-modal-footer {
  display: none;
  padding: 16px 24px;
  border-top: 1px solid #3d3d3d;
  gap: 12px;
  align-items: center;
}

.generate-modal-footer.active {
  display: flex;
}

.footer-spacer {
  flex: 1;
}

/* Play All Button - matches .word-btn.play-btn exactly */
.play-all-btn {
  width: 32px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--btn-border-radius);
  background: rgba(196, 30, 58, 0.2);
  color: #c41e3a;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-all-btn:hover {
  background: rgba(196, 30, 58, 0.4);
  color: #fff;
}

/* Stop state - gray */
.play-all-btn.playing {
  background: rgba(74, 74, 74, 0.4);
  color: #888;
}

.play-all-btn.playing:hover {
  background: rgba(74, 74, 74, 0.6);
  color: #fff;
}

.cancel-btn {
  background: transparent;
  color: #888;
  border: 1px solid #4a4a4a;
  border-radius: var(--btn-border-radius);
  padding: 10px 24px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.cancel-btn:hover {
  border-color: #fff;
  color: #fff;
}

.run-btn {
  background: #c41e3a;
  color: #fff;
  border: none;
  border-radius: var(--btn-border-radius);
  padding: 10px 24px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.run-btn:hover:not(:disabled) {
  background: #a01830;
}

.run-btn:disabled {
  background: #666;
  cursor: not-allowed;
}

/* Save button in Timeline */
.save-btn {
  background: #c41e3a;
  color: #fff;
  border: none;
  border-radius: var(--btn-border-radius);
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.save-btn:hover {
  background: #a01830;
}


.generate-btn {
  background: #c41e3a;
  color: #fff;
  border: none;
  border-radius: var(--btn-border-radius);
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: auto;
}

.generate-btn:hover:not(:disabled) {
  background: #a01830;
}

.generate-btn:disabled {
  background: #666;
  cursor: not-allowed;
}

.powered-by {
  text-align: center;
  font-size: 12px;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.powered-by:hover {
  opacity: 0.8;
}

.vantage-logo {
  max-width: 60%;
  height: auto;
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 100vh;
}

.header {
  position: fixed;
  top: 0;
  left: 280px;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #1a1a1a;
  border-bottom: 1px solid #3d3d3d;
  z-index: 50;
}

.header-spacer {
  flex: 1;
}

.logout-btn {
  background: transparent;
  border: none;
  color: #c41e3a;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.logout-btn:hover {
  color: #ff3050;
}

.credits {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #888;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.credits:hover {
  opacity: 0.8;
}

.credits-logo-img {
  height: 40px;
  width: auto;
}

/* Gallery */
.gallery {
  display: flex;
  flex-direction: column;
  padding-top: 73px; /* header height */
}

.gallery-loading {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  height: calc(100vh - 73px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gallery-loading .spinner {
  margin-bottom: 14px;
}

.gallery-loading-text {
  font-size: 14px;
  color: #888;
}

.gallery-empty {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  height: calc(100vh - 73px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gallery-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* Video Card */
.video-card {
  background: #2d2d2d;
  min-height: calc(100vh - 73px - 48px);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  gap: 0;
  padding: 24px;
  margin: 24px;
  border-radius: 12px;
}

.video-card-content {
  grid-row: 1 / 4;
  grid-column: 1;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.video-card-actions {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 24px;
}

.video-card-actions .action-btn {
  width: 100%;
  text-align: center;
}

/* Video Quote */
.video-card-quote {
  grid-row: 2;
  grid-column: 2;
  padding: 16px 24px;
  padding-left: 40px;
  max-width: 280px;
  position: relative;
  align-self: center;
}

.video-card-quote .quote-text {
  display: block;
  font-size: 14px;
  line-height: 1.6;
  color: #aaa;
  font-style: italic;
  text-align: left;
}

.video-card-quote .quote-mark {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 36px;
  font-weight: bold;
  color: #c41e3a;
  line-height: 1;
  opacity: 0.5;
}

.video-card-quote .quote-mark-open {
  position: absolute;
  top: 10px;
  left: 12px;
}

.video-card-quote .quote-mark-close {
  position: absolute;
  bottom: 4px;
  right: 12px;
}

.video-card-date {
  grid-row: 3;
  grid-column: 2;
  color: #888;
  font-size: 12px;
  padding-left: 24px;
  align-self: end;
  text-align: right;
}

.action-btn.play-together {
  background: #c41e3a;
  border-color: #c41e3a;
  color: #fff;
}

.action-btn.play-together:hover {
  background: #a01830;
  border-color: #a01830;
}

/* ==========================================
   PENDING GENERATION CARDS
   ========================================== */

.video-card-pending .video-card-content,
.video-card-ready .video-card-content,
.video-card-saving .video-card-content,
.video-card-error .video-card-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  width: 100%;
}

.video-card-pending .video-card-content,
.video-card-saving .video-card-content {
  padding: 0;
}

/* Pending Loading State */
.pending-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
}

.pending-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #3d3d3d;
  border-top-color: #c41e3a;
  border-radius: 50%;
  animation: pending-spin 1s linear infinite;
}

@keyframes pending-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Loading Goose Animation - Full Card */
.pending-loading-animation {
  position: relative;
  width: 100%;
  height: calc(100vh - 73px - 120px);
  min-height: 400px;
  max-height: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
}

.loading-goose-img {
  width: 100%;
  height: 100%;
  object-fit: scale-down;
  border-radius: 8px;
  opacity: 0.2;
}

.pending-loading-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.pending-text {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.pending-subtext {
  font-size: 14px;
  color: #888;
}

/* Ready State - Generation Complete */
.video-card-ready,
.video-card-pending,
.video-card-saving {
  position: relative;
}

.video-card-ready .video-card-content {
  cursor: pointer;
}

.ready-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  transition: transform 0.2s;
}

.ready-content:hover {
  transform: scale(1.02);
}

.ready-btn {
  padding: 16px 32px;
  background: #c41e3a;
  border: none;
  border-radius: 2px 12px 2px 2px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ready-btn:hover {
  background: #a01830;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

.ready-delete-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 0 12px 0 12px;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ready-delete-btn:hover {
  background: #c41e3a;
}

/* Error State */
.video-card-error .video-card-content {
  background: rgba(231, 76, 60, 0.1);
  border-radius: 8px;
}

.error-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
}

.error-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #e74c3c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
}

.error-text {
  font-size: 18px;
  font-weight: 600;
  color: #e74c3c;
}

.error-message {
  font-size: 13px;
  color: #888;
  max-width: 300px;
  text-align: center;
  word-break: break-word;
}

.error-retry-btn,
.error-dismiss-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.error-retry-btn {
  background: #c41e3a;
  color: #fff;
}

.error-retry-btn:hover {
  background: #a01830;
}

.error-dismiss-btn {
  background: #3d3d3d;
  color: #ccc;
}

.error-dismiss-btn:hover {
  background: #4a4a4a;
}

.video-players {
  display: flex;
  gap: 20px;
  position: relative;
  height: calc(100vh - 73px - 48px - 48px); /* viewport - header - padding - margin */
}

.video-preview {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.video-preview-label {
  display: none;
}

.video-preview-wrapper {
  overflow: hidden;
  flex: 1;
  position: relative;
  border-radius: 8px;
}

.video-preview-wrapper.tiktok {
  aspect-ratio: 9 / 16;
  height: 100%;
  width: auto;
}

.video-preview-wrapper.instagram {
  aspect-ratio: 4 / 5;
  height: 100%;
  width: auto;
}

.video-preview-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.action-btn {
  background: transparent;
  border: 1px solid #4a4a4a;
  border-radius: var(--btn-border-radius);
  padding: 10px 24px;
  color: #888;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.action-btn:hover {
  border-color: #fff;
  color: #fff;
}

.action-btn.delete:hover {
  border-color: #c41e3a;
  color: #c41e3a;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 280px;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-overlay.active {
  display: flex;
}

.loading-content {
  text-align: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #333;
  border-top-color: #c41e3a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Button spinner for download buttons */
.btn-spinner {
  display: inline-block;
  box-sizing: border-box;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

.editor-open-spinner {
  display: none;
}

.loading .editor-open-spinner {
  display: inline-block;
}

.action-btn.loading {
  opacity: 0.8;
  cursor: wait;
}

.ready-btn.loading {
  opacity: 0.85;
  cursor: wait;
}

.loading-text {
  font-size: 18px;
  margin-bottom: 8px;
}

.loading-subtext {
  color: #888;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }

  .main-content {
    margin-left: 0;
  }

  .header {
    position: fixed;
    left: 0;
  }

  .gallery {
    padding-top: 73px;
  }

  .container {
    flex-direction: column;
  }

  .loading-overlay {
    left: 0;
  }

  .video-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto auto;
  }

  .video-card-content {
    grid-row: 2;
    grid-column: 1;
    justify-content: center;
  }

  .video-card-actions {
    grid-row: 1;
    grid-column: 1;
    flex-direction: row;
    flex-wrap: wrap;
    padding-left: 0;
    padding-bottom: 16px;
  }

  .video-card-quote {
    grid-row: 3;
    grid-column: 1;
    padding: 16px 0;
    max-width: 100%;
    text-align: center;
  }

  .video-card-quote .quote-mark-open {
    position: static;
    display: inline;
    vertical-align: top;
    font-size: 32px;
    margin-right: 4px;
  }

  .video-card-quote .quote-mark-close {
    position: static;
    display: inline;
    vertical-align: bottom;
    font-size: 32px;
    margin-left: 4px;
  }

  .video-card-quote .quote-text {
    display: inline;
    text-align: center;
  }

  .video-card-date {
    grid-row: 4;
    grid-column: 1;
    padding-left: 0;
    padding-top: 16px;
  }

  .video-players {
    flex-direction: column;
    height: auto;
    gap: 16px;
  }
}


/* Timeline Editor Modal */
.timeline-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 300;
}

.timeline-modal.active {
  display: block;
}

.timeline-modal-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #2d2d2d;
  border-bottom: 1px solid #3d3d3d;
}

.timeline-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.timeline-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.export-btn {
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: var(--btn-border-radius);
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.export-btn:hover {
  background: #45a049;
}

.timeline-close {
  background: none;
  border: none;
  color: #888;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.timeline-close:hover {
  color: #fff;
}

.timeline-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Preview Area */
.timeline-preview {
  height: 300px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #3d3d3d;
}

.timeline-preview-video {
  max-height: 100%;
  max-width: 100%;
}

/* Playback Controls */
.timeline-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: #2d2d2d;
  border-bottom: 1px solid #3d3d3d;
}

.control-btn {
  background: #c41e3a;
  color: #fff;
  border: none;
  border-radius: var(--btn-border-radius);
  padding: 8px 24px;
  font-size: 14px;
  cursor: pointer;
  min-width: 80px;
}

.control-btn:hover {
  background: #a01830;
}

.time-display {
  font-family: monospace;
  font-size: 14px;
  color: #888;
}

/* Timeline Area */
.timeline-area {
  flex: 1;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 24px 24px;
}

/* Time Ruler */
.timeline-ruler {
  height: 30px;
  background: #252525;
  border-bottom: 1px solid #3d3d3d;
  position: relative;
  margin-left: 80px;
}

.ruler-mark {
  position: absolute;
  top: 0;
  height: 100%;
  border-left: 1px solid #4a4a4a;
  padding-left: 4px;
  font-size: 10px;
  color: #666;
}

/* Playhead */
.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #c41e3a;
  z-index: 100;
  pointer-events: none;
  margin-left: 80px;
}

.timeline-playhead::before {
  content: '';
  position: absolute;
  top: 0;
  left: -5px;
  width: 12px;
  height: 12px;
  background: #c41e3a;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

/* Timeline Track */
.timeline-track {
  display: flex;
  height: 60px;
  border-bottom: 1px solid #3d3d3d;
}

.track-label {
  width: 80px;
  padding: 8px;
  background: #252525;
  font-size: 12px;
  color: #888;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.track-content {
  flex: 1;
  position: relative;
  background: #1a1a1a;
}

/* Audio Track */
.audio-track {
  height: 80px;
}

.audio-track .track-content {
  background: #1e2a1e;
}

/* Video Tracks */
.video-tracks {
  position: relative;
}

.video-track {
  display: flex;
  height: 50px;
  border-bottom: 1px solid #3d3d3d;
}

.video-track .track-label {
  font-size: 11px;
}

/* Video Clip */
.video-clip {
  position: absolute;
  height: 34px;
  top: 8px;
  background: linear-gradient(135deg, #c41e3a 0%, #8b1428 100%);
  border-radius: 4px;
  cursor: move;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
}

.video-clip:hover {
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.5);
}

.video-clip.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

/* Clip Resize Handles */
.clip-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  background: rgba(255,255,255,0.1);
}

.clip-handle:hover {
  background: rgba(255,255,255,0.3);
}

.clip-handle.left {
  left: 0;
  border-radius: 4px 0 0 4px;
}

.clip-handle.right {
  right: 0;
  border-radius: 0 4px 4px 0;
}

.clip-thumbnail {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  object-fit: cover;
  margin-right: 6px;
  flex-shrink: 0;
}

/* Test Editor Button */
.test-editor-btn {
  background: #4a4a4a;
  color: #fff;
  border: none;
  border-radius: var(--btn-border-radius);
  padding: 12px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s;
}

.test-editor-btn:hover {
  background: #5a5a5a;
}

/* ==========================================
   NEW CLIP EDITOR - Vertical Layout
   ========================================== */

.editor-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.editor-modal.active {
  display: flex;
}

.editor-content {
  background: #1a1a1a;
  border-radius: 12px;
  width: 95vw;
  height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #2d2d2d;
  border-bottom: 1px solid #3d3d3d;
  flex-shrink: 0;
}

.editor-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.editor-close {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.editor-close:hover {
  color: #fff;
}

/* Main Layout: videos left, clips right, controls bottom */
.editor-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Main Area: Videos + Clips side by side */
.editor-main-area {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* Videos Column on Left */
.editor-videos-col {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: #0a0a0a;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

/* Clips Cards Area on Right */
.editor-clips-area {
  flex: 1;
  background: #1a1a1a;
  border-left: 1px solid #3d3d3d;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Clips with flex-wrap */
.clips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  align-content: flex-start;
}

.clips-wrap::-webkit-scrollbar {
  width: 8px;
}

.clips-wrap::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 4px;
}

.clips-wrap::-webkit-scrollbar-thumb {
  background: #4a4a4a;
  border-radius: 4px;
}

/* Clip Card - compact for flex-wrap */
.clip-card {
  position: relative;
  flex-shrink: 0;
  width: 140px;
  background: #2d2d2d;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.clip-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.clip-card.selected {
  border-color: #c41e3a;
  box-shadow: 0 0 15px rgba(196, 30, 58, 0.4);
}

.clip-card.playing {
  border-color: #4caf50;
}

.clip-card-video {
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #0a0a0a;
  object-fit: cover;
}

.clip-card-info {
  padding: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clip-card-number {
  font-size: 12px;
  font-weight: 700;
  color: #c41e3a;
}

.clip-card-text {
  font-size: 11px;
  color: #888;
  line-height: 1.3;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.clip-card-regenerate {
  background: #4a4a4a;
  border: none;
  color: #fff;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--btn-border-radius);
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 6px;
}

.clip-card-regenerate:hover {
  background: #c41e3a;
}

.clip-card-regenerate:disabled {
  background: #444;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Regenerating state */
.clip-card.regenerating {
  pointer-events: none;
  opacity: 0.8;
}

.clip-card.regenerating .clip-card-video {
  filter: blur(2px);
}

.clip-card-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px 8px 0 0;
  z-index: 10;
}

.clip-card-loader .card-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #333;
  border-top-color: #c41e3a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.clip-card.error {
  border-color: #ff4444;
}

.clip-card.error .clip-card-regenerate {
  background: #ff4444;
}

/* Position colors for cards */
.clip-card[data-position="1"] .clip-card-number { color: #9b7bb8; }
.clip-card[data-position="2"] .clip-card-number { color: #7bb8b8; }
.clip-card[data-position="3"] .clip-card-number { color: #b8b87b; }

/* Logo card styles */
.clip-card.logo-card {
  border: 2px dashed #c41e3a;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d1a1a 100%);
}

.clip-card.logo-card .clip-card-number {
  color: #c41e3a;
}

.logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.logo-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-duration-control {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.logo-duration-control label {
  font-size: 11px;
  color: #888;
}

.logo-duration-input {
  width: 50px;
  padding: 4px 6px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #1a1a1a;
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.logo-duration-input:focus {
  outline: none;
  border-color: #c41e3a;
}

.logo-duration-control span {
  font-size: 11px;
  color: #888;
}

/* Video Preview Boxes */
.video-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.video-label {
  font-size: 10px;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* TikTok Video (9:16) - full height */
.tiktok-box {
  position: relative;
}

.tiktok-box .editor-video-preview {
  height: calc(90vh - 120px);
  max-height: 600px;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: #000;
  object-fit: cover;
}

/* Logo overlay for TikTok - size synced via JS */
.logo-overlay {
  position: absolute;
  border-radius: 8px;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
  background: transparent;
  display: none; /* shown via JS */
}

.logo-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Instagram logo - grayscale layer outside crop */
.insta-logo-gray {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% - 1px);
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) brightness(0.5);
  z-index: 11;
  pointer-events: none;
}

/* Instagram logo - crop frame (position set via JS to match last clip) */
.insta-logo-crop-frame {
  position: absolute;
  left: 0;
  width: calc(100% - 1px);
  height: 70.3%; /* 4:5 ratio within 9:16 */
  top: 14.85%; /* Default centered, updated via JS */
  overflow: hidden;
  z-index: 12;
  pointer-events: none;
  box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.7);
  border-radius: 4px;
}

/* Instagram logo - color layer inside crop */
.insta-logo-color {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 142.25%; /* Compensate for crop frame being 70.3% of container */
  object-fit: cover;
  transform: translateY(-14.85%); /* Default centered, updated via JS */
}

/* Instagram Crop Container (9:16 with 4:5 crop overlay) */
.insta-crop-box {
  height: 100%;
}

.insta-crop-container {
  position: relative;
  height: calc(90vh - 120px);
  max-height: 600px;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

/* Grayscale video layer (full video, desaturated) */
.insta-gray-video {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% - 1px);
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) brightness(0.5);
}

/* Crop frame - clips the color video to 4:5 area */
.insta-crop-frame {
  position: absolute;
  left: 0;
  width: calc(100% - 1px);
  /* 4:5 aspect within 9:16 = (9/16) / (4/5) = 45/64 = ~70.3% of height */
  height: 70.3%;
  top: 14.85%; /* centered by default */
  overflow: hidden;
  will-change: top;
}

/* Color video inside crop frame */
.insta-color-video {
  position: absolute;
  width: calc(100% + 1px);
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  /* Offset to align with the grayscale layer */
  top: 0;
  transform: translateY(calc(-1 * var(--crop-offset, 14.85%)));
}

/* Crop border - only horizontal handle in center */
.insta-crop-border {
  position: absolute;
  left: 0;
  width: calc(100% - 1px);
  height: 70.3%;
  top: 14.85%;
  box-sizing: border-box;
  cursor: ns-resize;
  will-change: top;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Horizontal drag handle in center - hidden by default */
.insta-crop-border::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateZ(0);
  width: 50px;
  height: 4px;
  background: rgba(196, 30, 58, 0.6);
  border-radius: 2px;
  transition: width 0.2s, background 0.2s, box-shadow 0.2s, opacity 0.2s;
  backface-visibility: hidden;
  opacity: 0;
}

/* Show handle when hovering over the crop container */
.insta-crop-container:hover .insta-crop-border::before {
  opacity: 1;
}

.insta-crop-border:hover::before {
  background: #c41e3a;
  width: 60px;
  box-shadow: 0 0 8px rgba(196, 30, 58, 0.5);
  opacity: 1;
}

/* Bottom Bar: Scrubber + Controls + Save */
.editor-bottom-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: #252525;
  border-top: 1px solid #3d3d3d;
  flex-shrink: 0;
}

/* Scrubber */
.scrubber-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.scrubber-time {
  font-family: monospace;
  font-size: 12px;
  color: #888;
  min-width: 40px;
}

.scrubber-track {
  flex: 1;
  height: 6px;
  background: #1a1a1a;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.scrubber-progress {
  height: 100%;
  background: #c41e3a;
  border-radius: 3px;
  width: 0%;
}

.scrubber-handle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  cursor: grab;
  left: 0%;
}

.scrubber-handle:active {
  cursor: grabbing;
}

/* Playback Controls - compact */
.playback-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.playback-btn {
  background: #3d3d3d;
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.playback-btn:hover {
  background: #4d4d4d;
}

.playback-btn.play-main {
  width: 44px;
  height: 44px;
  background: #c41e3a;
}

.playback-btn.play-main:hover {
  background: #a01830;
}

.playback-btn.active {
  background: #c41e3a;
}

.playback-btn svg {
  flex-shrink: 0;
}

/* Save Button - no emoji */
.save-gallery-btn {
  background: linear-gradient(135deg, #c41e3a 0%, #8b1428 100%);
  border: none;
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--btn-border-radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 10px rgba(196, 30, 58, 0.3);
  flex-shrink: 0;
  white-space: nowrap;
}

.save-gallery-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(196, 30, 58, 0.4);
}

.save-gallery-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Playhead */
.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #c41e3a;
  z-index: 10;
  pointer-events: none;
}

.timeline-playhead::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -5px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #c41e3a;
}

.timeline-clip-position {
  font-size: 12px;
  color: #c41e3a;
  background: rgba(196, 30, 58, 0.15);
  padding: 4px 10px;
  border-radius: 4px;
  margin-left: 12px;
  flex-shrink: 0;
}

.timeline-clip-status {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-left: 12px;
  flex-shrink: 0;
}

.timeline-clip-status.ready {
  background: #4caf50;
}

.timeline-clip-status.pending {
  background: #ffa726;
}

.timeline-clip-status.error {
  background: #f44336;
}

/* ==========================================
   TEST GENERATION MODAL
   ========================================== */

.test-gen-btn {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid #c41e3a;
  border-radius: var(--btn-border-radius);
  background: transparent;
  color: #c41e3a;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.test-gen-btn:hover {
  background: rgba(196, 30, 58, 0.15);
}

.test-gen-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.test-gen-modal.active {
  display: flex;
}

.test-gen-modal-content {
  background: #2d2d2d;
  border-radius: 12px;
  width: 500px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.test-gen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #3d3d3d;
}

.test-gen-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.test-gen-close {
  background: none;
  border: none;
  color: #888;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--btn-border-radius);
  transition: all 0.2s;
}

.test-gen-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.test-gen-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  min-height: 300px;
  gap: 16px;
}

.test-gen-status {
  font-size: 16px;
  font-weight: 500;
  color: #fff;
}

.test-gen-substatus {
  font-size: 13px;
  color: #888;
}

/* Result state */
.test-gen-result {
  padding: 30px;
  align-items: stretch;
}

.test-gen-video-container {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 400px;
  background: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.test-gen-video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.test-gen-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #1a1a1a;
  border-radius: 8px;
  padding: 16px;
}

.test-gen-info-row {
  display: flex;
  gap: 12px;
}

.test-gen-label {
  font-size: 13px;
  color: #888;
  flex-shrink: 0;
  min-width: 80px;
}

.test-gen-value {
  font-size: 13px;
  color: #fff;
}

.test-gen-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #3d3d3d;
}

.test-gen-btn-close {
  padding: 10px 20px;
  border: 1px solid #4a4a4a;
  border-radius: var(--btn-border-radius);
  background: transparent;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.test-gen-btn-close:hover {
  border-color: #888;
  background: rgba(255, 255, 255, 0.05);
}

.test-gen-btn-retry {
  padding: 10px 20px;
  border: none;
  border-radius: var(--btn-border-radius);
  background: #c41e3a;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.test-gen-btn-retry:hover {
  background: #a01830;
}

/* Test Gen Result Layout */
.test-gen-main-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.test-gen-start-frame {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.test-gen-start-frame img {
  width: 120px;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #3d3d3d;
}

.test-gen-frame-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.test-gen-video-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.test-gen-video-container video {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 350px;
  object-fit: contain;
  background: #1a1a1a;
  border-radius: 8px;
}

/* Prompt section */
.test-gen-prompt-section {
  margin-top: 16px;
  background: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
}

.test-gen-prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #3d3d3d;
}

.test-gen-prompt-header span {
  font-size: 13px;
  color: #888;
}

.test-gen-prompt-toggle {
  background: none;
  border: 1px solid #4a4a4a;
  color: #fff;
  padding: 4px 12px;
  border-radius: var(--btn-border-radius);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.test-gen-prompt-toggle:hover {
  border-color: #888;
  background: rgba(255, 255, 255, 0.05);
}

.test-gen-prompt-content {
  padding: 16px;
  max-height: 200px;
  overflow-y: auto;
}

.test-gen-prompt-content pre {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 11px;
  color: #ccc;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  line-height: 1.5;
}

/* Make modal wider for result */
.test-gen-modal-content {
  width: 600px;
}

/* Talking animation for preview cards */
.talking-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #4a4a4a;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

.preview-card.talking .talking-animation {
  opacity: 1;
}

.preview-card.talking .preview-card-image {
  opacity: 0;
}

/* ==========================================
   NEW EDITOR MODAL - Like Pre-Generation Modal
   ========================================== */

.editor-modal-content {
  background: #2d2d2d;
  border-radius: 12px;
  width: 96vw;
  max-width: 1800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
}

/* Full-screen editor loading overlay */
.editor-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #2d2d2d;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 12px;
}

.editor-loading-overlay.active {
  display: flex;
}

.editor-loading-close {
  position: absolute;
  top: 16px;
  right: 24px;
  background: none;
  border: none;
  color: #888;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.editor-loading-close:hover {
  color: #fff;
}

.editor-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.editor-loading-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid #3d3d3d;
  border-top-color: #c9515c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.editor-loading-progress {
  color: #888;
  font-size: 16px;
  text-align: center;
}

.editor-loading-ok-btn {
  margin-top: 12px;
  padding: 10px 40px;
  background: linear-gradient(135deg, #c41e3a 0%, #8b1428 100%);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.editor-loading-ok-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(196, 30, 58, 0.4);
}

.editor-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #3d3d3d;
  flex-shrink: 0;
}

.editor-modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.editor-modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.editor-modal-close:hover {
  color: #fff;
}

/* Main Body - videos left, cards right */
.editor-modal-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  border-bottom: 1px solid #3d3d3d;
}

/* Videos Panel (Left) - horizontal layout */
.editor-videos-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 16px;
  background: #1a1a1a;
  border-right: 1px solid #3d3d3d;
  align-items: flex-start;
  max-height: 580px;
  overflow: hidden;
}

.editor-video-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.editor-video-box .video-label {
  font-size: 10px;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.editor-video-box .editor-video-preview {
  width: auto;
  height: calc(90vh - 180px);
  max-height: 500px;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: #000;
  object-fit: cover;
}

.editor-video-box.tiktok-box {
  position: relative;
}

/* Video/Frame loading overlay */
.video-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 8px;
  z-index: 10;
}

.video-loading-overlay.active {
  display: flex;
}

.video-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #c41e3a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-progress {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.editor-video-box .insta-crop-container {
  width: auto;
  height: calc(90vh - 180px);
  max-height: 500px;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  position: relative;
}

/* Cards Panel (Right) - like pre-generation modal */
.editor-cards-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 24px 0 24px;
  overflow-x: auto;
  overflow-y: auto;
  min-width: 0;
  align-items: flex-start;
  justify-content: flex-start;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(60, 60, 60, 0.8) transparent; /* Firefox */
}

/* Custom scrollbar for editor cards panel */
/* Horizontal - thin dark scrollbar */
.editor-cards-panel::-webkit-scrollbar {
  height: 6px;
  width: 0; /* Hide vertical scrollbar visually */
}

.editor-cards-panel::-webkit-scrollbar-track {
  background: transparent;
}

.editor-cards-panel::-webkit-scrollbar-thumb {
  background: rgba(60, 60, 60, 0.8);
  border-radius: 3px;
}

.editor-cards-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(80, 80, 80, 0.9);
}

.editor-cards-scroll-wrapper {
  display: inline-block;
  min-width: 100%;
}

.editor-cards-scroll {
  position: relative;
  display: flex;
  gap: 12px;
  overflow: visible;
  padding: 40px 0;
  margin: -40px 0;
}

/* Editor Card - like preview-card but with video */
.editor-card {
  flex-shrink: 0;
  width: 180px;
  height: 516px;
  perspective: 1000px;
}

.editor-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

/* Flip animations */
.editor-card.flipping-to-back .editor-card-inner {
  animation: flip-to-back 0.4s ease-in-out forwards;
}

.editor-card.flipping-to-front .editor-card-inner {
  animation: flip-to-front 0.4s ease-in-out forwards;
}

.editor-card.show-back .editor-card-inner {
  transform: rotateY(180deg);
}

.editor-card.show-front .editor-card-inner {
  transform: rotateY(0deg);
}

.editor-card-front,
.editor-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #1a1a1a;
  border-radius: 8px;
  padding: 8px;
  border: 1px solid #3a3a3a;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
}

.editor-card-back {
  transform: rotateY(180deg);
}

/* Video wrapper in card */
.editor-card-video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
}

.editor-card-video,
.editor-card-frame {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid #4a4a4a;
}

.editor-card.selected .editor-card-video,
.editor-card.selected .editor-card-frame {
  border-color: #c41e3a;
}

.editor-card.playing .editor-card-video,
.editor-card.playing .editor-card-frame {
  border-color: #4caf50;
}

/* Regenerating state */
.editor-card.regenerating {
  opacity: 0.8;
}

.editor-card.regenerating .editor-card-video-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.editor-card-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  z-index: 10;
}

.editor-card.regenerating .editor-card-loader {
  display: flex;
}

.editor-card-loader .card-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #333;
  border-top-color: #c41e3a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Version navigation */
.version-nav {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.75);
  padding: 3px 6px;
  border-radius: 12px;
  z-index: 15;
}

.version-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
  color: #fff;
}

.version-nav-btn:hover:not(.disabled) {
  background: rgba(196, 30, 58, 0.8);
}

.version-nav-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.version-nav-btn svg {
  fill: currentColor;
}

.version-indicator {
  font-size: 10px;
  color: #fff;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

/* Time display */
.editor-card-time {
  font-size: 10px;
  color: #888;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.editor-card-time .time-interval {
  color: #888;
}

.editor-card-time .time-duration {
  color: #c41e3a;
  font-weight: 600;
}

/* Text display */
.editor-card-text {
  font-size: 10px;
  color: #ccc;
  line-height: 1.4;
  text-align: center;
  flex-shrink: 0;
}

.editor-card-text .word {
  display: inline-block;
  transition: all 0.2s ease;
}

.editor-card-text .word.empty-placeholder {
  color: #666;
  font-style: italic;
}

/* Word transfer hover effects */
.editor-card-text .word.will-transfer-left {
  color: #c41e3a;
  transform: translateX(-4px);
}

.editor-card-text .word.will-transfer-right {
  color: #c41e3a;
  transform: translateX(4px);
}

.editor-card-text.all-drift-left .word {
  color: #c41e3a;
  transform: translateX(-4px);
}

.editor-card-text.all-drift-right .word {
  color: #c41e3a;
  transform: translateX(4px);
}

/* Word transfer buttons */
.editor-card .word-transfer-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid #3d3d3d;
  flex-shrink: 0;
}

.editor-card .word-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2d2d2d;
  border: 1px solid #4a4a4a;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.editor-card .word-btn:hover:not(:disabled) {
  background: #3d3d3d;
  border-color: #c41e3a;
  color: #c41e3a;
}

.editor-card .word-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.editor-card .word-btn.play-btn {
  background: rgba(196, 30, 58, 0.2);
  border-color: rgba(196, 30, 58, 0.4);
  color: #c41e3a;
}

.editor-card .word-btn.play-btn:hover {
  background: rgba(196, 30, 58, 0.4);
}

/* Gestures display - takes all remaining height, editable */
.editor-card-gestures {
  font-size: 9px;
  color: #aaa;
  line-height: 1.3;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 6px 8px;
  overflow-y: auto;
  white-space: pre-wrap;
  flex: 1;
  min-height: 0;
  cursor: text;
  outline: none;
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.editor-card-gestures:hover {
  background: rgba(255, 255, 255, 0.08);
}

.editor-card-gestures:focus {
  border-color: #c41e3a;
  background: rgba(255, 255, 255, 0.1);
  color: #ccc;
}

.editor-card-gestures:empty::before {
  content: attr(placeholder);
  color: #555;
  font-style: italic;
}

.editor-card-gestures::-webkit-scrollbar {
  width: 3px;
}

.editor-card-gestures::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 2px;
}

/* Card action buttons */
.editor-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding-top: 6px;
  flex-shrink: 0;
}

.editor-card-play {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(196, 30, 58, 0.2);
  border: 1px solid rgba(196, 30, 58, 0.4);
  color: #c41e3a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding-left: 2px; /* Optical centering for play triangle */
}

.editor-card-play:hover {
  background: rgba(196, 30, 58, 0.4);
}

/* Regenerate button */
.editor-card-regenerate {
  background: rgba(196, 30, 58, 0.2);
  border: 1px solid rgba(196, 30, 58, 0.4);
  color: #c41e3a;
  font-size: 9px;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px 8px 4px 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}

.editor-card-regenerate:hover {
  background: rgba(196, 30, 58, 0.3);
  border-color: #c41e3a;
}

.editor-card-regenerate:disabled {
  background: #333;
  border-color: #444;
  color: #666;
  cursor: not-allowed;
}

/* Card selection and hover */
.editor-card:hover .editor-card-front,
.editor-card:hover .editor-card-back {
  border-color: rgba(196, 30, 58, 0.5);
}

.editor-card.selected .editor-card-front,
.editor-card.selected .editor-card-back {
  border-color: #c41e3a;
  box-shadow: 0 0 15px rgba(196, 30, 58, 0.3);
}

/* Delete button */
.editor-card .delete-card-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(196, 30, 58, 0.8);
  border: none;
  color: #fff;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 25;
  transition: all 0.2s ease;
}

.editor-card .delete-card-btn:hover {
  background: #c41e3a;
  transform: scale(1.1);
}

/* Logo card */
.editor-card.logo-card {
  flex-shrink: 0;
}

.editor-card.logo-card .editor-card-front {
  border-color: rgba(196, 30, 58, 0.5);
  background: linear-gradient(135deg, rgba(196, 30, 58, 0.1), rgba(30, 30, 30, 0.95));
}

.editor-card.logo-card .logo-preview-wrapper {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.editor-card.logo-card .editor-card-frame {
  object-fit: contain;
  background: transparent;
}

.editor-card.logo-card .logo-card-title {
  font-weight: 600;
  color: #c41e3a;
  text-align: center;
}

.logo-duration-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  margin-top: 4px;
}

.logo-duration-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-duration-row label {
  font-size: 9px;
  color: #888;
  width: 45px;
}

.logo-duration-input {
  width: 45px;
  padding: 3px 4px;
  font-size: 11px;
  background: #222;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  text-align: center;
}

/* Hide native number input spinners (use our own UI/keyboard input) */
.logo-duration-input::-webkit-outer-spin-button,
.logo-duration-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.logo-duration-input {
  appearance: textfield;
  -moz-appearance: textfield;
}

.logo-duration-input:focus {
  outline: none;
  border-color: #c41e3a;
}

.logo-duration-row span {
  font-size: 9px;
  color: #666;
}

/* Waveform in editor - now in footer */

/* Footer with waveform */
.editor-modal-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 16px 24px;
  gap: 16px;
  flex-shrink: 0;
}

.editor-modal-footer .play-all-btn {
  flex-shrink: 0;
  width: 39px;
  height: 39px;
  border-radius: 4px 8px 4px 4px;
  background: rgba(196, 30, 58, 0.2);
  border: 1px solid rgba(196, 30, 58, 0.4);
  color: #c41e3a;
  padding-left: 2px; /* Optical centering for play triangle */
}

.editor-modal-footer .play-all-btn:hover {
  background: rgba(196, 30, 58, 0.4);
}

.editor-footer-waveform {
  position: relative;
  height: 39px;
  background: #1a1a1a;
  border-radius: 4px;
  flex: 1;
  cursor: pointer;
  overflow: hidden;
}

.editor-footer-waveform .global-waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 2;
}

.editor-footer-waveform .waveform-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: rgba(196, 30, 58, 0.35);
  pointer-events: none;
  z-index: 1;
}

.editor-footer-waveform:hover {
  background: #222;
}

/* Playhead/scrubber indicator */
.waveform-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  pointer-events: none;
  z-index: 10;
  left: 0;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.waveform-playhead::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.editor-footer-waveform.scrubbing {
  cursor: ew-resize;
}

.editor-footer-waveform.scrubbing .waveform-playhead::before {
  background: #c41e3a;
}

.editor-footer-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

/* Add card zone in editor */
.editor-cards-scroll .add-card-zone {
  flex-shrink: 0;
  width: 16px;
  height: 516px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  margin: 0 -6px;
  z-index: 5;
}

/* Merge button in editor */
.editor-cards-scroll .merge-button {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #3d3d3d;
  border: 2px solid #4a4a4a;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s ease;
  align-self: center;
  z-index: 10;
  margin: 0 -6px;
}

.editor-cards-scroll .merge-button:hover {
  background: #c41e3a;
  border-color: #c41e3a;
  color: #fff;
  transform: scale(1.1);
}
