:root {
  --bg-canvas: #f8a2b8;
  --bg-canvas-gradient: radial-gradient(circle at 18% 18%, #ffbed0 0%, #f79cb4 42%, #ee8ba3 100%);

  --glass-surface: rgba(255, 255, 255, 0.62);
  --glass-surface-hover: rgba(255, 255, 255, 0.78);
  --glass-surface-active: rgba(255, 255, 255, 0.9);
  --glass-card: rgba(255, 255, 255, 0.68);
  --glass-card-hover: rgba(255, 255, 255, 0.85);

  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-border-subtle: rgba(255, 255, 255, 0.45);
  --glass-border-glow: rgba(255, 94, 54, 0.45);

  --sunset-orange: #ff541e;
  --sunset-peach: #ff7b2b;
  --sunset-amber: #ffa033;
  --sunset-rose: #ff2d75;
  --sunset-violet: #7c3aed;
  --sunset-deep-purple: #4c1d95;
  --aura-lime: #a3e635;
  --gold-star: #ffd166;
  --cream-butter: #fff5cf;

  --text-primary: #380724;
  --text-secondary: #6e2248;
  --text-tertiary: #9b486d;
  --text-on-accent: #fffbee;

  --accent: #ff4820;
  --accent-gradient: linear-gradient(135deg, #ff541e 0%, #ff2d75 52%, #7c3aed 100%);
  --accent-gradient-hover: linear-gradient(135deg, #ff6a38 0%, #ff4082 52%, #8b5cf6 100%);
  --accent-glow: rgba(255, 84, 30, 0.35);

  --danger: #e11d48;
  --danger-hover: #be123c;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 6px rgba(180, 40, 80, 0.08);
  --shadow-md: 0 8px 20px rgba(180, 40, 80, 0.12);
  --shadow-lg: 0 16px 40px rgba(180, 40, 80, 0.16);
  --shadow-sunset: 0 10px 30px rgba(255, 84, 30, 0.32);

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

  --panel-width: 330px;

  --cursor-default: url('misc/cursor-default.png') 5 0, auto;
  --cursor-pointer: url('misc/cursor-pointer.png') 11 0, pointer;

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  cursor: var(--cursor-default);
}

body {
  font-family: var(--font-body);
  background: var(--bg-canvas-gradient);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: relative;
  cursor: var(--cursor-default);
}

button,
a,
input,
select,
textarea,
label,
[role="button"],
.gif-card,
.upload-zone,
.slider,
.btn-remove,
.btn-cancel,
.btn-download,
.btn-export,
.playback-btn,
.custom-checkbox-wrap,
.progress-bar-container,
.modal-backdrop,
.modal-close,
.dropdown-trigger,
.dropdown-item {
  cursor: var(--cursor-pointer) !important;
}

.slider::-webkit-slider-thumb {
  cursor: var(--cursor-pointer) !important;
}

.slider::-moz-range-thumb {
  cursor: var(--cursor-pointer) !important;
}

.water-ripple {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%) scale(0.2);
  border: 2.5px solid rgba(244, 96, 135, 0.85);
  background: radial-gradient(circle, rgba(255, 179, 203, 0.45) 0%, rgba(244, 96, 135, 0.18) 50%, transparent 75%);
  box-shadow: 0 0 14px rgba(244, 96, 135, 0.45), inset 0 0 10px rgba(255, 213, 107, 0.4);
  animation: rippleWater 0.7s cubic-bezier(0.12, 0.75, 0.35, 1) forwards;
}

.water-ripple::after {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 179, 203, 0.7);
  animation: rippleWaterSecondary 0.7s cubic-bezier(0.12, 0.75, 0.35, 1) forwards;
}

@keyframes rippleWater {
  0% {
    width: 6px;
    height: 6px;
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.1);
  }

  50% {
    opacity: 0.8;
  }

  100% {
    width: 130px;
    height: 130px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes rippleWaterSecondary {
  0% {
    opacity: 0.9;
    transform: scale(0.4);
  }

  100% {
    opacity: 0;
    transform: scale(1.15);
  }
}

.hidden {
  display: none !important;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(180, 40, 80, 0.18);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(180, 40, 80, 0.32);
}

.ambient-scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.aura-orb.orb-primary {
  position: absolute;
  top: -8%;
  right: -5%;
  width: 620px;
  height: 620px;
  border-radius: 45% 55% 50% 50% / 50% 45% 55% 50%;
  background: radial-gradient(circle at 45% 40%,
      #ff4500 0%,
      #ff6e20 28%,
      #ff8f3d 45%,
      #ff2a70 65%,
      #7928ca 85%,
      transparent 100%);
  filter: blur(45px);
  opacity: 0.92;
  animation: floatAuraPrimary 14s ease-in-out infinite alternate;
}

.orb-lime-rim {
  position: absolute;
  top: 8%;
  left: 20%;
  width: 260px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(163, 230, 53, 0.75) 0%, rgba(132, 204, 22, 0.4) 45%, transparent 70%);
  filter: blur(28px);
  mix-blend-mode: screen;
}

.orb-star {
  position: absolute;
  color: var(--gold-star);
  text-shadow: 0 0 8px rgba(255, 209, 102, 0.9), 0 0 16px rgba(255, 120, 40, 0.8);
  filter: drop-shadow(0 0 6px rgba(255, 225, 120, 0.9));
  animation: starTwinkle 3.5s ease-in-out infinite;
  user-select: none;
}

.orb-star.star-1 {
  top: 36%;
  left: 32%;
  font-size: 2.8rem;
  animation-delay: 0s;
}

.orb-star.star-2 {
  top: 24%;
  left: 54%;
  font-size: 2rem;
  animation-delay: 1.4s;
}

.aura-orb.orb-secondary {
  position: absolute;
  bottom: -15%;
  right: -2%;
  width: 580px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
      #ff6230 0%,
      #ff336f 42%,
      #9333ea 78%,
      transparent 100%);
  filter: blur(55px);
  opacity: 0.78;
  animation: floatAuraSecondary 16s ease-in-out infinite alternate;
}

.aura-orb.orb-tertiary {
  position: absolute;
  bottom: 10%;
  left: -8%;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%,
      #ff6b8b 0%,
      #a855f7 50%,
      #ec4899 75%,
      transparent 100%);
  filter: blur(60px);
  opacity: 0.65;
  animation: floatAuraTertiary 18s ease-in-out infinite alternate;
}

.liquid-blob {
  position: absolute;
  pointer-events: none;
  background: radial-gradient(circle at 32% 28%,
      rgba(255, 255, 255, 0.95) 0%,
      rgba(255, 255, 255, 0.52) 20%,
      rgba(255, 140, 185, 0.38) 46%,
      rgba(147, 51, 234, 0.35) 74%,
      rgba(255, 84, 30, 0.42) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  box-shadow:
    inset -6px -6px 16px rgba(124, 58, 237, 0.28),
    inset 4px 4px 10px rgba(255, 255, 255, 0.95),
    0 14px 34px rgba(180, 40, 90, 0.18),
    0 0 25px rgba(255, 107, 74, 0.25);
  backdrop-filter: blur(8px) saturate(170%);
  -webkit-backdrop-filter: blur(8px) saturate(170%);
  filter: drop-shadow(0 10px 24px rgba(220, 38, 127, 0.25));
  will-change: transform, border-radius;
}

.blob-1 {
  width: 140px;
  height: 120px;
  top: 10%;
  left: 30%;
  animation: liquidMorph1 14s ease-in-out infinite alternate, floatDrift1 22s ease-in-out infinite;
}

.blob-2 {
  width: 100px;
  height: 90px;
  top: 60%;
  left: 23%;
  animation: liquidMorph2 16s ease-in-out infinite alternate, floatDrift2 20s ease-in-out infinite;
  animation-delay: -3s;
}

.blob-3 {
  width: 125px;
  height: 110px;
  top: 74%;
  left: 54%;
  animation: liquidMorph3 18s ease-in-out infinite alternate, floatDrift3 24s ease-in-out infinite;
  animation-delay: -6s;
}

.blob-4 {
  width: 90px;
  height: 85px;
  top: 18%;
  left: 72%;
  animation: liquidMorph2 15s ease-in-out infinite alternate, floatDrift1 19s ease-in-out infinite;
  animation-delay: -4s;
}

.blob-5 {
  width: 155px;
  height: 135px;
  top: 40%;
  right: 5%;
  animation: liquidMorph1 19s ease-in-out infinite alternate, floatDrift2 25s ease-in-out infinite;
  animation-delay: -8s;
}

.blob-6 {
  width: 80px;
  height: 75px;
  top: 78%;
  left: 17%;
  animation: liquidMorph3 13s ease-in-out infinite alternate, floatDrift3 17s ease-in-out infinite;
  animation-delay: -5s;
}

@keyframes liquidMorph1 {
  0% {
    border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%;
    transform: rotate(0deg) scale(1);
  }

  33% {
    border-radius: 70% 30% 46% 54% / 30% 29% 71% 70%;
    transform: rotate(120deg) scale(1.05);
  }

  66% {
    border-radius: 35% 65% 31% 69% / 57% 59% 41% 43%;
    transform: rotate(240deg) scale(0.96);
  }

  100% {
    border-radius: 60% 40% 65% 35% / 40% 65% 35% 60%;
    transform: rotate(360deg) scale(1.03);
  }
}

@keyframes liquidMorph2 {
  0% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    transform: rotate(0deg) scale(1);
  }

  50% {
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    transform: rotate(180deg) scale(1.08);
  }

  100% {
    border-radius: 55% 45% 40% 60% / 35% 50% 50% 65%;
    transform: rotate(360deg) scale(0.98);
  }
}

@keyframes liquidMorph3 {
  0% {
    border-radius: 48% 52% 62% 38% / 38% 46% 54% 62%;
    transform: rotate(0deg) scale(0.97);
  }

  50% {
    border-radius: 65% 35% 40% 60% / 60% 40% 60% 40%;
    transform: rotate(-160deg) scale(1.06);
  }

  100% {
    border-radius: 40% 60% 55% 45% / 45% 55% 45% 55%;
    transform: rotate(-360deg) scale(1);
  }
}

@keyframes floatDrift1 {

  0%,
  100% {
    transform: translateY(0) translateX(0);
  }

  50% {
    transform: translateY(-26px) translateX(16px);
  }
}

@keyframes floatDrift2 {

  0%,
  100% {
    transform: translateY(0) translateX(0);
  }

  50% {
    transform: translateY(-20px) translateX(-20px);
  }
}

@keyframes floatDrift3 {

  0%,
  100% {
    transform: translateY(0) translateX(0);
  }

  50% {
    transform: translateY(-30px) translateX(12px);
  }
}

.sparkle {
  position: absolute;
  color: var(--gold-star);
  text-shadow: 0 0 8px rgba(255, 209, 102, 0.8), 0 0 16px rgba(255, 107, 74, 0.6);
  user-select: none;
  animation: starTwinkle 4s ease-in-out infinite;
}

.sp-1 {
  top: 18%;
  right: 38%;
  font-size: 1.6rem;
  animation-delay: -1s;
}

.sp-2 {
  top: 68%;
  right: 22%;
  font-size: 1.4rem;
  animation-delay: -2.5s;
}

.sp-3 {
  top: 38%;
  left: 24%;
  font-size: 1.8rem;
  animation-delay: -0.5s;
}

.sp-4 {
  top: 84%;
  left: 42%;
  font-size: 1.3rem;
  animation-delay: -3s;
}

@keyframes floatAuraPrimary {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }

  50% {
    transform: translate(-25px, 20px) scale(1.05) rotate(4deg);
  }

  100% {
    transform: translate(15px, -15px) scale(0.98) rotate(-3deg);
  }
}

@keyframes floatAuraSecondary {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(-30px, -25px) scale(1.08);
  }
}

@keyframes floatAuraTertiary {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(25px, 20px) scale(1.06);
  }
}

@keyframes starTwinkle {

  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.85) rotate(0deg);
  }

  50% {
    opacity: 1;
    transform: scale(1.15) rotate(12deg);
  }
}

#app-main {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 10;
}

#panel-left {
  width: var(--panel-width);
  min-width: var(--panel-width);
  background: var(--glass-surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1.5px solid var(--glass-border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  box-shadow: 4px 0 24px rgba(180, 40, 80, 0.08);
}

.panel-section {
  background: var(--glass-card);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.panel-section:hover {
  background: var(--glass-card-hover);
  border-color: rgba(255, 107, 74, 0.4);
  box-shadow: 0 8px 24px rgba(255, 84, 30, 0.12);
  transform: translateY(-1px);
}

.footer-credit {
  margin-top: auto;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-tertiary);
  user-select: none;
  letter-spacing: -0.01em;
  padding: var(--space-xs) 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition-fast);
}

.footer-credit:hover {
  color: var(--text-primary);
}

.credit-author {
  font-weight: 700;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer-credit:hover .credit-author {
  color: var(--sunset-orange);
}

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  letter-spacing: -0.01em;
}

.step-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(255, 84, 30, 0.35);
}

.gif-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  max-height: 260px;
  overflow-y: auto;
  padding-right: var(--space-xs);
}

.gallery-loading,
.gallery-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 84, 30, 0.2);
  border-top-color: var(--sunset-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.gif-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-bounce);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.gif-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-base);
}

.gif-card:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(255, 84, 30, 0.45);
  box-shadow: 0 6px 18px rgba(255, 84, 30, 0.25);
}

.gif-card:hover img {
  transform: scale(1.06);
}

.gif-card.selected {
  border-color: var(--sunset-rose);
  box-shadow: 0 0 0 3px rgba(255, 45, 117, 0.3), 0 8px 24px rgba(255, 45, 117, 0.35);
}

.gif-card.selected::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  background: var(--sunset-rose);
  border: 2px solid #ffffff;
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 10px;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.gif-card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-xs) var(--space-sm);
  background: linear-gradient(transparent, rgba(56, 7, 36, 0.85));
  color: #fff8eb;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.option-row {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid rgba(180, 40, 80, 0.12);
}

.custom-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.custom-checkbox-wrap:hover {
  color: var(--sunset-orange);
}

.custom-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.checkbox-box {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.75);
  border: 1.5px solid rgba(180, 40, 80, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-bounce);
  color: transparent;
  flex-shrink: 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.custom-checkbox:hover+.checkbox-box,
.custom-checkbox-wrap:hover .checkbox-box {
  border-color: var(--sunset-orange);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 10px rgba(255, 84, 30, 0.25);
}

.custom-checkbox:checked+.checkbox-box {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(255, 84, 30, 0.4);
  transform: scale(1.05);
}

.custom-checkbox:focus-visible+.checkbox-box {
  outline: 2px solid var(--sunset-rose);
  outline-offset: 2px;
}

.checkbox-text {
  letter-spacing: -0.01em;
}

.upload-zone {
  border: 2px dashed rgba(255, 84, 30, 0.35);
  border-radius: var(--radius-md);
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.45);
  transition: all var(--transition-bounce);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.upload-zone svg {
  color: var(--sunset-orange);
  transition: transform var(--transition-bounce);
  filter: drop-shadow(0 2px 6px rgba(255, 84, 30, 0.25));
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--sunset-rose);
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 45, 117, 0.2);
}

.upload-zone:hover svg,
.upload-zone.dragover svg {
  transform: scale(1.15) translateY(-2px);
  color: var(--sunset-rose);
}

.upload-label {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: var(--space-xs);
}

.upload-hint {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.file-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
}

.btn-remove:hover {
  color: var(--danger);
  background: rgba(225, 29, 72, 0.12);
  transform: scale(1.1);
}

.controls-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.control-value {
  font-variant-numeric: tabular-nums;
  color: var(--sunset-orange);
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 84, 30, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.control-divider {
  height: 1px;
  background: rgba(180, 40, 80, 0.12);
  margin: var(--space-xs) 0;
}

.tracking-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: linear-gradient(135deg, rgba(255, 84, 30, 0.12) 0%, rgba(255, 45, 117, 0.12) 50%, rgba(124, 58, 237, 0.12) 100%);
  border: 1px solid rgba(255, 84, 30, 0.35);
  border-radius: var(--radius-md);
  color: var(--sunset-rose);
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 14px rgba(255, 84, 30, 0.1);
  animation: shimmerBadge 4s ease-in-out infinite;
}

.tracking-badge svg {
  flex-shrink: 0;
  color: var(--sunset-orange);
  animation: pulseTarget 2s ease-in-out infinite;
}

@keyframes shimmerBadge {

  0%,
  100% {
    border-color: rgba(255, 84, 30, 0.3);
  }

  50% {
    border-color: rgba(255, 45, 117, 0.6);
    box-shadow: 0 4px 18px rgba(255, 45, 117, 0.2);
  }
}

@keyframes pulseTarget {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.18);
  }
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.color-input {
  width: 26px;
  height: 26px;
  border: 2px solid #ffffff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  background: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

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

.color-input::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(180, 40, 80, 0.15);
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-gradient);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(255, 84, 30, 0.5);
  transition: all var(--transition-bounce);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 4px 14px rgba(255, 84, 30, 0.7);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-gradient);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(255, 84, 30, 0.5);
}

.slider::-moz-range-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 4px 14px rgba(255, 84, 30, 0.7);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
}

.btn-micro {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: var(--cursor-pointer) !important;
  white-space: nowrap;
  transition: all var(--transition-bounce);
  flex-shrink: 0;
}

.btn-micro:hover {
  background: #ffffff;
  color: var(--sunset-orange);
  border-color: rgba(255, 84, 30, 0.4);
  box-shadow: 0 2px 8px rgba(255, 84, 30, 0.25);
  transform: translateY(-1px) scale(1.04);
}

.btn-micro:active {
  transform: translateY(0) scale(0.97);
}

.control-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(180, 40, 80, 0.16);
  position: relative;
}

.subrow-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: default;
  white-space: nowrap;
}

.custom-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(180, 40, 80, 0.08);
  outline: none;
  user-select: none;
}

.dropdown-trigger:hover,
.dropdown-trigger.open {
  background: #ffffff;
  border-color: rgba(255, 84, 30, 0.45);
  box-shadow: 0 4px 14px rgba(255, 84, 30, 0.22);
  color: var(--sunset-orange);
  transform: translateY(-1px);
}

.trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sunset-orange);
  flex-shrink: 0;
}

.trigger-label {
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.dropdown-chevron {
  color: var(--text-tertiary);
  transition: transform var(--transition-bounce);
  flex-shrink: 0;
  margin-left: 2px;
}

.dropdown-trigger.open .dropdown-chevron {
  transform: rotate(180deg);
  color: var(--sunset-orange);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 16px 36px rgba(180, 40, 80, 0.25), 0 0 1px rgba(0, 0, 0, 0.1);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: dropdownIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(-6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  background: transparent;
  user-select: none;
  border: 1px solid transparent;
}

.dropdown-item:hover {
  background: rgba(255, 84, 30, 0.1);
  border-color: rgba(255, 84, 30, 0.2);
  transform: translateX(2px);
}

.dropdown-item.selected {
  background: linear-gradient(135deg, rgba(255, 84, 30, 0.14) 0%, rgba(255, 45, 117, 0.12) 100%);
  border-color: rgba(255, 84, 30, 0.28);
}

.item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--sunset-orange);
  box-shadow: 0 1px 4px rgba(180, 40, 80, 0.1);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.dropdown-item:hover .item-icon {
  background: var(--accent-gradient);
  color: #ffffff;
  transform: scale(1.08);
}

.dropdown-item.selected .item-icon {
  background: var(--accent-gradient);
  color: #ffffff;
}

.item-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-align: left;
}

.item-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.item-desc {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-tertiary);
  line-height: 1.2;
}

.dropdown-item:hover .item-title {
  color: var(--sunset-orange);
}

.item-check {
  color: var(--sunset-rose);
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-bounce);
  transform: scale(0.6);
  flex-shrink: 0;
}

.dropdown-item.selected .item-check {
  opacity: 1;
  transform: scale(1);
}

#canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  gap: var(--space-lg);
  background: transparent;
  position: relative;
  overflow: hidden;
}

#canvas-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-surface);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(180, 40, 80, 0.16);
  min-width: 400px;
  min-height: 300px;
  max-width: 85%;
  max-height: calc(100vh - 170px);
  transition: all var(--transition-base);
}

#preview-canvas {
  display: none;
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  image-rendering: pixelated;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

#preview-canvas.active {
  display: block;
}

#empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-3xl);
  color: var(--text-secondary);
  text-align: center;
}

#empty-state svg {
  color: var(--sunset-orange);
  filter: drop-shadow(0 4px 14px rgba(255, 84, 30, 0.4));
  animation: floatEmptyIcon 4s ease-in-out infinite alternate;
}

@keyframes floatEmptyIcon {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-8px);
  }
}

#empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

#empty-state p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 300px;
  line-height: 1.5;
}

#playback-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--glass-surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: var(--space-sm) var(--space-xl);
  min-width: 420px;
  z-index: 10;
  box-shadow: 0 12px 32px rgba(180, 40, 80, 0.15);
}

.playback-btn {
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-bounce);
  box-shadow: 0 4px 12px rgba(255, 84, 30, 0.35);
  flex-shrink: 0;
}

.playback-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 18px rgba(255, 84, 30, 0.5);
}

.playback-btn svg {
  width: 18px;
  height: 18px;
}

.frame-info {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  min-width: 65px;
}

.progress-bar-container {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-full);
  border: 1px solid rgba(180, 40, 80, 0.15);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.05s linear;
  box-shadow: 0 0 10px rgba(255, 84, 30, 0.5);
}

#export-area {
  z-index: 10;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--accent-gradient);
  color: var(--text-on-accent);
  border: 2px solid rgba(255, 255, 255, 0.65);
  padding: var(--space-md) var(--space-2xl);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all var(--transition-bounce);
  box-shadow: var(--shadow-sunset), 0 0 20px rgba(255, 45, 117, 0.25);
}

.btn-export:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 36px rgba(255, 84, 30, 0.45), 0 0 28px rgba(255, 45, 117, 0.4);
}

.btn-export:active {
  transform: translateY(0) scale(0.98);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(56, 7, 36, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.modal-content {
  position: relative;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-3xl) var(--space-3xl);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  min-width: 380px;
  box-shadow: 0 28px 70px rgba(180, 40, 80, 0.28);
  animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(18px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-icon {
  color: var(--sunset-orange);
  animation: spin 2s linear infinite;
  filter: drop-shadow(0 2px 10px rgba(255, 84, 30, 0.4));
}

.modal-icon.done {
  animation: none;
  color: #10b981;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.modal-content h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.export-progress-track {
  width: 100%;
  height: 8px;
  background: rgba(180, 40, 80, 0.12);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-sm);
}

.export-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.2s ease;
  box-shadow: 0 0 12px rgba(255, 84, 30, 0.6);
}

.export-percent {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--sunset-orange);
  font-variant-numeric: tabular-nums;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-xl);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: var(--space-sm);
}

.btn-cancel:hover {
  background: #ffffff;
  color: var(--danger);
  border-color: rgba(225, 29, 72, 0.3);
}

.btn-download {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--accent-gradient);
  color: #fff9ea;
  padding: var(--space-md) var(--space-2xl);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-bounce);
  box-shadow: var(--shadow-sunset);
  margin-top: var(--space-sm);
}

.btn-download:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 36px rgba(255, 84, 30, 0.5);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-secondary);
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-bounce);
  padding: 0;
  z-index: 10;
}

.modal-close:hover {
  background: #ffffff;
  color: var(--danger);
  transform: scale(1.12);
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.28);
  border-color: rgba(225, 29, 72, 0.35);
}

.modal-close:active {
  transform: scale(0.95);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  margin-top: var(--space-sm);
}

.modal-actions .btn-download {
  margin-top: 0;
  width: 100%;
  justify-content: center;
}

.modal-actions .btn-cancel {
  margin-top: 0;
  padding: var(--space-xs) var(--space-xl);
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  #app-main {
    flex-direction: column;
    height: auto;
    overflow-y: auto;
  }

  #panel-left {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1.5px solid var(--glass-border);
  }

  #canvas-container {
    min-width: 300px;
    max-width: 95%;
  }

  #playback-bar {
    min-width: 320px;
    max-width: 95%;
  }
}

/* =============================================
   FRAME STRIP PANEL
   ============================================= */

#section-frames {
  padding-bottom: var(--space-lg);
}

.frames-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  padding: var(--space-xs) 0;
}

.frames-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.45);
  border: 1px solid var(--glass-border-subtle);
  border-radius: var(--radius-full);
  padding: 2px 10px;
}

.frames-bulk-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.frames-bulk-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.frame-delay-input {
  width: 58px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--glass-border);
  background: rgba(255,255,255,0.7);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 600;
  text-align: center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}

.frame-delay-input::-webkit-inner-spin-button,
.frame-delay-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.frame-delay-input:focus {
  border-color: var(--sunset-orange);
  box-shadow: 0 0 0 3px rgba(255, 84, 30, 0.15);
}

.frame-delay-input.bulk {
  width: 64px;
}

.frames-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px 2px 4px 2px;
}

.frame-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.55);
  border: 1.5px solid var(--glass-border-subtle);
  border-radius: var(--radius-md);
  padding: 6px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  position: relative;
  cursor: default;
}

.frame-card:hover {
  border-color: rgba(255, 84, 30, 0.4);
  box-shadow: 0 4px 14px rgba(255, 84, 30, 0.12);
  transform: translateY(-1px);
}

.frame-card.active-frame {
  border-color: var(--sunset-orange);
  box-shadow: 0 0 0 2px rgba(255, 84, 30, 0.25), 0 4px 14px rgba(255, 84, 30, 0.18);
}

.frame-num {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-tertiary);
  position: absolute;
  top: 3px;
  left: 5px;
  line-height: 1;
}

.frame-thumb {
  border-radius: 6px;
  display: block;
  background: #000;
  image-rendering: pixelated;
}

.frame-delay-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  justify-content: center;
}

.frame-delay-label {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.frame-card .frame-delay-input {
  width: 52px;
  font-size: 0.72rem;
  padding: 3px 4px;
}

/* =============================================
   FRAME ACTIONS (duplicate / disable)
   ============================================= */

.frame-actions {
  display: flex;
  gap: 4px;
  width: 100%;
  justify-content: center;
}

.frame-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-secondary);
  cursor: var(--cursor-pointer) !important;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.frame-btn:hover {
  background: var(--sunset-orange);
  border-color: var(--sunset-orange);
  color: #fff;
}

.frame-btn-delete:hover {
  background: var(--danger);
  border-color: var(--danger);
}

.frame-thumb {
  cursor: var(--cursor-pointer) !important;
}

.frame-card.disabled {
  opacity: 0.5;
  filter: grayscale(1);
  background: rgba(120, 120, 120, 0.2);
}

/* =============================================
   RENDER BUTTON (bottom of the left bar)
   ============================================= */

.panel-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.panel-bottom .footer-credit {
  margin-top: 0;
}

.btn-render {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  background: var(--accent-gradient);
  color: var(--text-on-accent);
  border: 2px solid rgba(255, 255, 255, 0.65);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  cursor: var(--cursor-pointer) !important;
  transition: all var(--transition-bounce);
  box-shadow: var(--shadow-sunset);
}

.btn-render:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px) scale(1.02);
}

.btn-render:active {
  transform: translateY(0) scale(0.98);
}

.btn-adjust-pos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(255, 84, 30, 0.45);
  background: rgba(255, 255, 255, 0.7);
  color: var(--sunset-orange);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: var(--cursor-pointer) !important;
  transition: all var(--transition-fast);
}

.btn-adjust-pos:hover {
  background: var(--accent-gradient);
  border-color: transparent;
  color: var(--text-on-accent);
}

/* =============================================
   POSITION EDITOR
   ============================================= */

.pe-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(56, 7, 36, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  padding: var(--space-lg);
}

.pe-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 245, 250, 0.96);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.pe-topbar,
.pe-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  flex-wrap: wrap;
}

.pe-topbar { border-bottom: 1.5px solid var(--glass-border-subtle); }
.pe-footer { border-top: 1.5px solid var(--glass-border-subtle); }

.pe-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--sunset-orange);
}

.pe-title-group h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-primary);
}

.pe-topbar-actions,
.pe-footer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.pe-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.pe-canvas-area {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  overflow: hidden;
  background: repeating-conic-gradient(#d9c5d0 0% 25%, #eadbe3 0% 50%) 50% / 20px 20px;
}

#pe-canvas {
  display: block;
  flex-shrink: 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  background: #000;
  user-select: none;
}

#pe-overlay {
  position: absolute;
  pointer-events: none;
}

#pe-box {
  position: absolute;
  transform-origin: center center;
  cursor: move !important;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.pe-border {
  position: absolute;
  inset: 0;
  border: 2px solid #ff3030;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.pe-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid #ff3030;
  border-radius: 3px;
  box-shadow: 0 1px 6px rgba(255, 48, 48, 0.45);
  touch-action: none;
}

.pe-handle:hover { background: #ff3030; }

.pe-nw { top: -7px; left: -7px; cursor: nwse-resize !important; }
.pe-ne { top: -7px; right: -7px; cursor: nesw-resize !important; }
.pe-sw { bottom: -7px; left: -7px; cursor: nesw-resize !important; }
.pe-se { bottom: -7px; right: -7px; cursor: nwse-resize !important; }
.pe-n { top: -7px; left: calc(50% - 6px); cursor: ns-resize !important; }
.pe-s { bottom: -7px; left: calc(50% - 6px); cursor: ns-resize !important; }
.pe-w { left: -7px; top: calc(50% - 6px); cursor: ew-resize !important; }
.pe-e { right: -7px; top: calc(50% - 6px); cursor: ew-resize !important; }

.pe-rotate-arm {
  position: absolute;
  top: -42px;
  left: 50%;
  width: 0;
  height: 42px;
  pointer-events: none;
}

.pe-rotate-arm::before {
  content: '';
  position: absolute;
  left: -0.75px;
  top: 24px;
  width: 1.5px;
  height: 18px;
  background: #ff3030;
}

.pe-rotate-handle {
  position: absolute;
  left: -12px;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #ff3030;
  color: #ff3030;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
  cursor: grab !important;
  box-shadow: 0 2px 8px rgba(255, 48, 48, 0.4);
}

.pe-rotate-handle:hover { background: #ff3030; color: #fff; }

.pe-controls {
  width: 230px;
  flex-shrink: 0;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  border-left: 1.5px solid var(--glass-border-subtle);
  overflow-y: auto;
}

.pe-ctrl-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.pe-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pe-ctrl-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pe-num-input {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--glass-border);
  background: #fff;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
}

.pe-num-input:focus {
  border-color: var(--sunset-orange);
  box-shadow: 0 0 0 3px rgba(255, 84, 30, 0.15);
}

.pe-ctrl-divider {
  height: 1px;
  background: var(--glass-border-subtle);
}

.pe-strip-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-top: 1.5px solid var(--glass-border-subtle);
}

.pe-strip-nav {
  flex-shrink: 0;
  width: 32px;
  height: 56px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: var(--cursor-pointer) !important;
}

.pe-strip-nav:hover { background: var(--sunset-orange); color: #fff; }

.pe-strip {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 4px;
}

.pe-thumb {
  flex-shrink: 0;
  position: relative;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: #000;
  cursor: var(--cursor-pointer) !important;
  overflow: hidden;
  transition: border-color var(--transition-fast), opacity var(--transition-fast);
}

.pe-thumb canvas { display: block; }

.pe-thumb span {
  position: absolute;
  left: 4px;
  top: 2px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.pe-thumb:hover { border-color: rgba(255, 84, 30, 0.5); }
.pe-thumb.active { border-color: var(--sunset-orange); box-shadow: 0 0 0 2px rgba(255, 84, 30, 0.35); }
.pe-thumb.edited::after {
  content: '';
  position: absolute;
  right: 4px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3030;
  box-shadow: 0 0 0 1.5px #fff;
}
.pe-thumb.disabled { opacity: 0.35; filter: grayscale(1); }

.pe-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-pe-primary,
.btn-pe-secondary,
.btn-pe-ghost,
.btn-pe-accent,
.btn-pe-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1.5px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-secondary);
  cursor: var(--cursor-pointer) !important;
  transition: all var(--transition-fast);
}

.btn-pe-secondary:hover,
.btn-pe-ghost:hover,
.btn-pe-close:hover {
  background: #fff;
  border-color: var(--sunset-orange);
  color: var(--sunset-orange);
}

.btn-pe-primary {
  border-color: var(--sunset-orange);
  color: var(--sunset-orange);
}

.btn-pe-primary:hover,
.btn-pe-accent {
  background: var(--accent-gradient);
  border-color: transparent;
  color: var(--text-on-accent);
}

.btn-pe-accent {
  padding: 9px 22px;
  font-size: 0.92rem;
  box-shadow: var(--shadow-sunset);
}

.btn-pe-accent:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
}

.btn-pe-close { padding: 6px; border-radius: 50%; }

@media (max-width: 900px) {
  .pe-body { flex-direction: column; }
  .pe-controls { width: auto; border-left: 0; border-top: 1.5px solid var(--glass-border-subtle); flex-direction: row; flex-wrap: wrap; }
}

.pe-hint {
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--text-tertiary);
}
