/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ===========================================
   TikTok Text Overlay Styles
   =========================================== */

/* Base text container */
.text-overlay-container {
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
  width: 100%;
  margin: 0 auto;
}

/* Outline style - white text with black stroke */
.text-style-outline,
.text-style-classic {
  color: white !important;
  font-family: 'TikTok Sans', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 600;
  background: transparent !important;
  padding: 0 !important;
  text-align: center;
  box-sizing: border-box;
  --outline-width: 1.2px;
  --outline-shadow:
    1.2px 0 0 #000,
    -1.2px 0 0 #000,
    0 1.2px 0 #000,
    0 -1.2px 0 #000,
    0.85px 0.85px 0 #000,
    -0.85px 0.85px 0 #000,
    0.85px -0.85px 0 #000,
    -0.85px -0.85px 0 #000;
  text-shadow: var(--outline-shadow) !important;
  -webkit-text-stroke: var(--outline-width) #000;
  --text-bg-color: #4A5FBDB8;
}

.text-style-outline.text-headline,
.text-style-classic.text-headline {
  font-size: 16px;
  line-height: 1.25;
  display:inline-block;
}

.text-style-outline.text-subtext,
.text-style-classic.text-subtext {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  display:inline-block;
}

@supports (-webkit-text-stroke: 1px black) {
  .text-style-outline,
  .text-style-classic {
    text-shadow: none !important;
  }
}

/* Safe Content Area Border - Removed as too restrictive */
.slide-preview-container {
  position: relative;
  /* Allow resize handles to extend beyond container on mobile */
  overflow: visible !important;
}

/* Keep the rounded corners and background clipping */
.slide-preview-container > div:first-child {
  overflow: hidden;
  border-radius: inherit;
}

/* Background styles */
.text-style-background-white,
.text-style-background-color,
.text-style-background-color-solid,
.text-style-highlight {
  font-family: 'TikTok Sans', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  color: black !important;
  background: white !important;
  text-shadow: none !important;
  padding: 2px 10px !important;
  border-radius: 8px !important;
  box-decoration-break: clone !important;
  -webkit-box-decoration-break: clone !important;
  display: inline !important;
  max-width: 82%;
  line-height: 1.25;
}

.text-style-background-color {
  color: white !important;
  background: var(--text-bg-color, #4A5FBDB8) !important;
}

.text-style-background-color-solid {
  color: white !important;
  background: var(--text-bg-color, #4A5FBD) !important;
}

.text-style-background-white.text-headline,
.text-style-background-color.text-headline,
.text-style-background-color-solid.text-headline,
.text-style-highlight.text-headline {
  font-size: 16px;
  line-height: 1.25;
  margin-bottom: 12px;
  font-weight: 500;
}

.text-style-background-white.text-subtext,
.text-style-background-color.text-subtext,
.text-style-background-color-solid.text-subtext,
.text-style-highlight.text-subtext {
  font-size: 12px;
  line-height: 1.25;
  font-weight: 500;
}

/* Editor/static preview: style inner text node so wrapper sizing doesn't become a giant rectangle */
[data-draggable="true"] .text-preview-content,
.slide-static-text-element .text-preview-content {
  display: inline;
  white-space: pre-wrap;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  line-height: inherit;
  font-size: inherit;
  font-family: inherit;
  font-weight: inherit;
}

[data-draggable="true"].text-style-outline .text-preview-content,
[data-draggable="true"].text-style-classic .text-preview-content,
.slide-static-text-element.text-style-outline .text-preview-content,
.slide-static-text-element.text-style-classic .text-preview-content {
  color: white !important;
  -webkit-text-fill-color: white !important;
  background: transparent !important;
  text-shadow: var(--outline-shadow) !important;
  -webkit-text-stroke: 0 !important;
  text-rendering: geometricPrecision;
}

[data-draggable="true"].text-style-background-white,
[data-draggable="true"].text-style-background-color,
[data-draggable="true"].text-style-background-color-solid,
[data-draggable="true"].text-style-highlight,
.slide-static-text-element.text-style-background-white,
.slide-static-text-element.text-style-background-color,
.slide-static-text-element.text-style-background-color-solid,
.slide-static-text-element.text-style-highlight {
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  max-width: none !important;
}

[data-draggable="true"].text-style-background-white .text-preview-content,
[data-draggable="true"].text-style-background-color .text-preview-content,
[data-draggable="true"].text-style-background-color-solid .text-preview-content,
[data-draggable="true"].text-style-highlight .text-preview-content,
.slide-static-text-element.text-style-background-white .text-preview-content,
.slide-static-text-element.text-style-background-color .text-preview-content,
.slide-static-text-element.text-style-background-color-solid .text-preview-content,
.slide-static-text-element.text-style-highlight .text-preview-content {
  padding: 2px 10px !important;
  border-radius: 8px !important;
  text-shadow: none !important;
}

[data-draggable="true"].text-style-background-white .text-preview-content,
[data-draggable="true"].text-style-highlight .text-preview-content,
.slide-static-text-element.text-style-background-white .text-preview-content,
.slide-static-text-element.text-style-highlight .text-preview-content {
  color: black !important;
  background: white !important;
}

[data-draggable="true"].text-style-background-color .text-preview-content,
.slide-static-text-element.text-style-background-color .text-preview-content {
  color: white !important;
  background: var(--text-bg-color, #4A5FBDB8) !important;
}

[data-draggable="true"].text-style-background-color-solid .text-preview-content,
.slide-static-text-element.text-style-background-color-solid .text-preview-content {
  color: white !important;
  background: var(--text-bg-color, #4A5FBD) !important;
}

/* The magic span for line-by-line backgrounds */
.text-style-highlight .line-box {
  display: inline !important;
  background-color: white !important;
  color: black !important;
  padding: 4px 12px !important;
  border-radius: 8px !important;
  font-weight: 500 !important; /* Medium to match rendering */
  text-shadow: none !important;
  /* Critical properties for line wrapping */
  box-decoration-break: clone !important;
  -webkit-box-decoration-break: clone !important;
  -moz-box-decoration-break: clone !important;
  background-clip: padding-box !important;
  /* Ensure text stays visible */
  line-height: inherit !important;
}

.text-style-highlight.text-subtext .line-box {
  padding: 3px 10px !important;
  border-radius: 6px !important;
  font-weight: 500 !important; /* Medium to match rendering */
}

.text-center-guide {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-1px);
  background: rgba(59, 130, 246, 0.7);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 30;
}

.text-center-guide.visible {
  opacity: 1;
}

.text-vertical-guide {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(59, 130, 246, 0.7);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 30;
}

.text-vertical-guide-20 {
  top: 20%;
  transform: translateY(-1px);
}

.text-vertical-guide-50 {
  top: 50%;
  transform: translateY(-1px);
}

.text-vertical-guide.visible {
  opacity: 1;
}

/* Small screen preview styles (for content ideas) */
/* Scale: 180px wide (vs 270px edit preview), so 0.67x */
.preview-small .text-style-outline.text-headline,
.preview-small .text-style-classic.text-headline {
  font-size: 11.5px;  /* 17.5 * 0.67 */
  --outline-width: 0.9px;
}

.preview-small .text-style-outline.text-subtext,
.preview-small .text-style-classic.text-subtext {
  font-size: 7.5px;  /* 11 * 0.67 */
  --outline-width: 0.6px;
}

.preview-small .text-style-background-white.text-headline,
.preview-small .text-style-background-color.text-headline,
.preview-small .text-style-background-color-solid.text-headline,
.preview-small .text-style-highlight.text-headline {
  font-size: 11.5px;
  line-height: 1.25;
}

.preview-small .text-style-background-white.text-subtext,
.preview-small .text-style-background-color.text-subtext,
.preview-small .text-style-background-color-solid.text-subtext,
.preview-small .text-style-highlight.text-subtext {
  font-size: 7.5px;
  line-height: 1.2;
}

.preview-small .text-style-highlight .line-box {
  padding: 2px 6px !important;
  border-radius: 4px !important;
}

/* Prevent image dragging */
.slide-preview-container img {
  user-select: none !important;
  -webkit-user-drag: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  pointer-events: none !important;
}

/* Draggable Text Styles */
[data-draggable="true"],
.slide-static-text-element {
  user-select: none;
  z-index: 20;
  position: absolute !important;
  overflow: visible;
  font-family: 'TikTok Sans', -apple-system, 'Helvetica Neue', Arial, sans-serif !important;
}

[data-draggable="true"] {
  cursor: move;
}

[data-draggable="true"]:hover {
  outline: 1.5px solid #FF006E;
  outline-offset: 2px;
}

[data-draggable="true"].selected {
  outline: 1.5px solid #FF006E;
  outline-offset: 2px;
  z-index: 100;
}

[data-draggable="true"].dragging {
  outline: 2px solid #FF006E;
  outline-offset: 2px;
  z-index: 100;
  opacity: 0.9;
}

.text-control-handle,
.text-size-indicator {
  display: none !important;
}

.text-resize-handle {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border: 2px solid white;
  border-radius: 999px;
  background: #FF006E;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: ew-resize;
  opacity: 0;
  pointer-events: auto;
  z-index: 140;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.text-resize-handle.w {
  left: -12px;
}

.text-resize-handle.e {
  right: -12px;
}

.text-width-indicator {
  position: absolute;
  left: 50%;
  bottom: -30px;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.88);
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 140;
}

[data-draggable="true"]:hover .text-resize-handle,
[data-draggable="true"].selected .text-resize-handle,
[data-draggable="true"].editing .text-resize-handle,
[data-draggable="true"].resizing .text-resize-handle {
  opacity: 1;
}

[data-draggable="true"].resizing .text-width-indicator {
  opacity: 1;
}

.text-editor-editing [data-draggable="true"],
.text-editor-editing [data-draggable="true"]:hover,
.text-editor-editing [data-draggable="true"].selected,
.text-editor-editing [data-draggable="true"].dragging {
  outline: none !important;
  opacity: 1;
}

.text-edit-overlay {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
  z-index: 160;
  overflow: visible;
}

.text-edit-overlay.active {
  display: block;
}

.text-edit-header {
  position: absolute;
  top: -44px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 3;
  padding: 0 10px;
}

.text-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.46);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.text-edit-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
}

.text-edit-icon-btn svg {
  width: 16px;
  height: 16px;
}

.text-edit-style-btn[data-variant="outline"] {
  background: rgba(0, 0, 0, 0.72);
}

.text-edit-style-btn[data-variant="background_white"] {
  background: rgba(255, 255, 255, 0.95);
  color: #000;
}

.text-edit-style-btn[data-variant="background_color"] {
  background: rgba(74, 95, 189, 0.9);
}

.text-edit-style-btn[data-variant="background_color_solid"] {
  background: rgba(74, 95, 189, 1);
}

.text-edit-done-btn {
  position: absolute;
  right: 2px;
  top: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  pointer-events: auto;
}

.text-edit-size-slider {
  position: absolute;
  right: -42px;
  top: 50%;
  width: 54px;
  height: 210px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 3;
}

.text-edit-size-readout {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translate(-50%, -100%);
  min-width: 54px;
  padding: 4px 7px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.64);
  color: #fff;
  text-align: center;
  line-height: 1.05;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.text-edit-size-readout-value {
  display: block;
  font-size: 11px;
  font-weight: 700;
}

.text-edit-size-readout-percent {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  font-weight: 600;
  opacity: 0.82;
  letter-spacing: 0.03em;
}

.text-edit-size-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 170px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  transform: rotate(-90deg);
  transform-origin: center;
}

.text-edit-size-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  background: #fff;
}

.text-edit-size-slider input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  background: #fff;
}

.text-edit-swatch-strip {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -54px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 10px;
  pointer-events: auto;
  z-index: 3;
  background: rgba(0, 0, 0, 0.36);
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.text-edit-swatch {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: var(--swatch-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.text-edit-swatch.active {
  transform: scale(1.12);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 0, 110, 0.95), 0 1px 3px rgba(0, 0, 0, 0.35);
}

.text-edit-swatch.muted {
  opacity: 0.45;
}

@media (max-width: 768px) {
  .text-edit-header {
    top: -40px;
  }

  .text-edit-size-slider {
    right: -34px;
    width: 48px;
    height: 180px;
  }

  .text-edit-size-readout {
    min-width: 48px;
    padding: 4px 6px;
  }

  .text-edit-size-slider input[type="range"] {
    width: 140px;
  }

  .text-edit-swatch-strip {
    left: 8px;
    right: 8px;
    bottom: -50px;
    gap: 8px;
  }
}

.slide-preview-container.editing-text .tiktok-safe-zone-overlay {
  display: none !important;
}

.slide-preview-container.editing-text .image-position-handle,
.slide-preview-container.editing-text .image-position-indicator {
  display: none !important;
}

/* ===========================================
   Filmstrip Styles
   =========================================== */

:root {
  --filmstrip-bg: #fafafa;
  --filmstrip-border: #e5e7eb;
  --filmstrip-nav-bg: white;
  --filmstrip-nav-border: #d1d5db;
  --filmstrip-nav-color: #374151;
  --filmstrip-nav-hover-bg: #f9fafb;
}

.dark {
  --filmstrip-bg: #374151;
  --filmstrip-border: #4b5563;
  --filmstrip-nav-bg: #4b5563;
  --filmstrip-nav-border: #6b7280;
  --filmstrip-nav-color: #d1d5db;
  --filmstrip-nav-hover-bg: #6b7280;
}

.filmstrip-container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 0;
  background: var(--filmstrip-bg, #fafafa);
  border: 1px solid var(--filmstrip-border, #e5e7eb);
  border-radius: 12px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filmstrip-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  /*
   * Reserve permanent space for out-of-frame text edit controls
   * (top actions, right size slider, bottom swatches) so they do not clip.
   * Keeping this always-on avoids layout jumping when entering edit mode.
   */
  padding: 72px 44px 88px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.filmstrip-track::-webkit-scrollbar {
  height: 8px;
}

.filmstrip-track::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.filmstrip-track::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.filmstrip-track::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.filmstrip-slide {
  flex-shrink: 0;
  scroll-snap-align: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 12px;
  overflow: visible;
}

.filmstrip-slide::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 16px;
  background: transparent;
  transition: all 0.3s ease;
  pointer-events: none;
}

.filmstrip-slide:hover::before {
  background: rgba(255, 0, 110, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 0, 110, 0.3);
}

.filmstrip-slide-selected {
  transform: scale(1.03);
  z-index: 10;
}

.filmstrip-slide-selected::before {
  background: rgba(255, 0, 110, 0.2);
  box-shadow: 0 0 0 4px #FF006E, 0 12px 32px rgba(255, 0, 110, 0.6);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 4px #FF006E, 0 12px 32px rgba(255, 0, 110, 0.6);
  }
  50% {
    box-shadow: 0 0 0 4px #FF006E, 0 12px 40px rgba(255, 0, 110, 0.8);
  }
}

.filmstrip-slide-hidden {
  opacity: 0.5;
}

.filmstrip-slide-hidden:hover {
  opacity: 0.7;
}

.filmstrip-nav {
  flex-shrink: 0;
}

.filmstrip-nav-button {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--filmstrip-nav-bg, white);
  border: 1px solid var(--filmstrip-nav-border, #d1d5db);
  border-radius: 8px;
  color: var(--filmstrip-nav-color, #374151);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filmstrip-nav-button:hover:not(:disabled) {
  background: var(--filmstrip-nav-hover-bg, #f9fafb);
  border-color: #9ca3af;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filmstrip-nav-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--filmstrip-nav-hover-bg, #f9fafb);
}

/* ===========================================
   Alignment Handle Styles
   =========================================== */

.text-align-handle {
  align-items: center;
  justify-content: center;
}

.text-align-handle svg {
  width: 14px;
  height: 14px;
}

/* Style Cycle Handle */
.text-style-handle {
  align-items: center;
  justify-content: center;
}

.text-style-handle svg {
  width: 14px;
  height: 14px;
}

/* Background Color Picker Handle */
.text-color-handle {
  width: 28px !important;
  height: 28px !important;
  padding: 2px;
  -webkit-appearance: none;
  appearance: none;
}

.text-color-handle::-webkit-color-swatch-wrapper {
  padding: 0;
}

.text-color-handle::-webkit-color-swatch {
  border: 0;
  border-radius: 999px;
}

.text-color-handle::-moz-color-swatch {
  border: 0;
  border-radius: 999px;
}

/* Mobile - larger touch targets for alignment button */
@media (max-width: 768px) {
  .text-color-handle {
    width: 36px !important;
    height: 36px !important;
  }

  .text-resize-handle {
    width: 24px;
    height: 24px;
    margin-top: -12px;
  }

  .text-resize-handle.w {
    left: -16px;
  }

  .text-resize-handle.e {
    right: -16px;
  }
}

/* ===========================================
   Control Panel Styles
   =========================================== */

/* ===========================================
   TikTok Safe Zone Overlay
   =========================================== */

.tiktok-safe-zone-overlay {
  display: none;
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 5;
}

.show-safe-zones .tiktok-safe-zone-overlay {
  display: block;
}

.safe-zone-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--safe-zone-top, 11.5%);
  background: rgba(239, 68, 68, 0.4);
  border-bottom: 2px dashed rgba(239, 68, 68, 0.8);
}

.safe-zone-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--safe-zone-bottom, 17%);
  background: rgba(239, 68, 68, 0.4);
  border-top: 2px dashed rgba(239, 68, 68, 0.8);
}

.safe-zone-right {
  position: absolute;
  top: var(--safe-zone-top, 11.5%);
  bottom: var(--safe-zone-bottom, 17%);
  right: 0;
  width: var(--safe-zone-right, 11%);
  background: rgba(239, 68, 68, 0.25);
  border-left: 2px dashed rgba(239, 68, 68, 0.6);
}

.safe-zone-left {
  position: absolute;
  top: var(--safe-zone-top, 11.5%);
  bottom: var(--safe-zone-bottom, 17%);
  left: 0;
  width: var(--safe-zone-left, 6%);
  background: rgba(239, 68, 68, 0.15);
  border-right: 1px dashed rgba(239, 68, 68, 0.4);
}

/* ===========================================
   Image Vertical Repositioning Handle
   =========================================== */

.image-position-handle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 48px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  cursor: ns-resize;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.slide-preview-container:hover .image-position-handle {
  opacity: 1;
}

.image-position-handle.dragging {
  opacity: 1;
  background: rgba(255, 0, 110, 0.9);
  border-color: rgba(255, 0, 110, 1);
}

.image-position-handle-dots {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.image-position-handle-dots span {
  width: 12px;
  height: 2px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 1px;
}

.image-position-handle.dragging .image-position-handle-dots span {
  background: white;
}

.image-position-indicator {
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 15;
}

.slide-control-panel {
  width: 100%;
}

.creative-edit-page {
  overflow-x: clip;
}

.creative-edit-main-column,
.creative-edit-sidebar,
#filmstrip_area {
  min-width: 0;
}

#filmstrip_area {
  overflow-x: hidden;
}

.slide-editor-shell {
  display: grid;
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.slide-editor-stage-slot,
.slide-editor-panel-slot,
.slide-editor-strip {
  min-width: 0;
}

.slide-editor-stage-card,
.slide-editor-panel-card,
.slide-editor-strip {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 250, 251, 0.98));
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.dark .slide-editor-stage-card,
.dark .slide-editor-panel-card,
.dark .slide-editor-strip {
  border-color: #374151;
  background: linear-gradient(180deg, rgba(31, 41, 55, 0.96), rgba(17, 24, 39, 0.96));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.26);
}

.slide-editor-stage-card,
.slide-editor-panel-card {
  padding: 16px;
}

.slide-editor-panel-card {
  height: 100%;
}

.slide-editor-stage-header,
.slide-editor-panel-header,
.slide-editor-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.slide-editor-stage-header,
.slide-editor-panel-header {
  margin-bottom: 12px;
}

.slide-editor-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6b7280;
}

.dark .slide-editor-kicker {
  color: #9ca3af;
}

.slide-editor-stage-title,
.slide-editor-panel-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
}

.dark .slide-editor-stage-title,
.dark .slide-editor-panel-title {
  color: #f9fafb;
}

.slide-stage-canvas {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: 22px;
  background: #111827;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.24);
}

.slide-stage-shell {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
}

.slide-stage-canvas-hidden {
  overflow: hidden;
  background: linear-gradient(180deg, #f3f4f6, #e5e7eb);
}

.dark .slide-stage-canvas-hidden {
  background: linear-gradient(180deg, #1f2937, #111827);
}

.slide-stage-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

.slide-stage-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 0, 110, 0.92);
  color: white;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(255, 0, 110, 0.35);
  pointer-events: none;
}

.slide-editor-stage-empty {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-editor-panel-body {
  overflow: visible;
}

.slide-editor-strip {
  padding: 14px 16px 16px;
  overflow: hidden;
}

.slide-editor-strip-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.slide-editor-strip-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
}

.dark .slide-editor-strip-label {
  color: #f9fafb;
}

.slide-editor-strip-count {
  font-size: 0.875rem;
  color: #6b7280;
}

.dark .slide-editor-strip-count {
  color: #9ca3af;
}

.slide-editor-strip-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.slide-editor-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slide-editor-nav-button,
.slide-stage-nav {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: white;
  color: #374151;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.slide-editor-nav-button:hover:not(:disabled),
.slide-stage-nav:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #9ca3af;
}

.dark .slide-editor-nav-button,
.dark .slide-stage-nav {
  border-color: #4b5563;
  background: #1f2937;
  color: #e5e7eb;
}

.dark .slide-editor-nav-button:hover:not(:disabled),
.dark .slide-stage-nav:hover:not(:disabled) {
  background: #374151;
  border-color: #6b7280;
}

.slide-stage-nav {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.slide-thumbnail-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-top: 12px;
  scrollbar-width: thin;
}

.slide-thumbnail {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.slide-thumbnail-frame {
  --slide-thumbnail-frame-width: 92px;
  position: relative;
  width: var(--slide-thumbnail-frame-width);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 16px;
  background: #111827;
  border: 2px solid transparent;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.slide-thumbnail:hover .slide-thumbnail-frame {
  transform: translateY(-2px);
  border-color: rgba(255, 0, 110, 0.25);
}

.slide-thumbnail.is-selected .slide-thumbnail-frame {
  border-color: #ff006e;
  box-shadow: 0 0 0 4px rgba(255, 0, 110, 0.14), 0 20px 36px rgba(255, 0, 110, 0.2);
}

.slide-thumbnail.is-hidden .slide-thumbnail-frame {
  opacity: 0.74;
}

.slide-thumbnail-meta {
  display: flex;
  justify-content: center;
}

.slide-thumbnail-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4b5563;
}

.dark .slide-thumbnail-number {
  color: #d1d5db;
}

.slide-thumbnail-text-preview {
  overflow: hidden;
}

.slide-thumbnail-preview-scaler {
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  height: 640px;
  transform-origin: top left;
  transform: scale(calc(var(--slide-thumbnail-frame-width) / 360px));
}

.slide-thumbnail-text-preview .text-preview-content {
  display: inline;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (min-width: 1024px) {
  .slide-editor-shell {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 336px);
    grid-template-areas:
      "stage panel"
      "strip strip";
  }

  .slide-editor-stage-slot {
    grid-area: stage;
  }

  .slide-editor-panel-slot {
    grid-area: panel;
  }

  .slide-editor-strip {
    grid-area: strip;
  }
}

@media (max-width: 1023px) {
  .slide-editor-stage-card,
  .slide-editor-panel-card,
  .slide-editor-strip {
    border-radius: 18px;
    padding: 14px;
  }

  .slide-editor-stage-header,
  .slide-editor-panel-header,
  .slide-editor-strip-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .slide-editor-strip-actions {
    width: 100%;
    justify-content: space-between;
  }

  .slide-stage-shell {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .slide-stage-canvas {
    grid-column: 1 / -1;
    width: min(100%, 320px);
  }

  .slide-stage-nav {
    width: 100%;
    height: 42px;
    border-radius: 12px;
    box-shadow: none;
  }

  .slide-editor-panel-header > [data-controller="undo-redo"] {
    width: 100%;
  }
}

@media (max-height: 900px) {
  .slide-editor-shell {
    gap: 12px;
  }

  .slide-editor-stage-card,
  .slide-editor-panel-card {
    padding: 14px;
  }

  .slide-editor-stage-header,
  .slide-editor-panel-header {
    margin-bottom: 10px;
  }

  .slide-stage-canvas {
    width: min(100%, 340px);
  }

  .slide-editor-strip {
    padding: 12px 14px 14px;
  }

  .slide-thumbnail-track {
    padding-top: 10px;
  }

  .slide-thumbnail-frame {
    --slide-thumbnail-frame-width: 84px;
  }
}

@media (max-width: 640px) {
  .slide-editor-stage-card,
  .slide-editor-panel-card,
  .slide-editor-strip {
    padding: 12px;
  }

  .slide-editor-stage-header,
  .slide-editor-panel-header,
  .slide-editor-strip-header {
    align-items: stretch;
  }

  .slide-editor-strip-actions > * {
    width: 100%;
  }

  .slide-stage-canvas {
    order: 1;
    width: min(100%, 300px);
    border-radius: 18px;
  }

  .slide-stage-nav-prev {
    order: 2;
  }

  .slide-stage-nav-next {
    order: 3;
  }

  .slide-editor-strip {
    padding: 12px;
  }

  .slide-thumbnail-track {
    gap: 8px;
  }

  .slide-thumbnail-frame {
    --slide-thumbnail-frame-width: 74px;
    border-radius: 14px;
  }
}
