:root {
  --lut-icon-size: 80px;
}

.stage {
  font-family: -apple-system, "SF Pro Text", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
}

.backdrop {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.scene-layer {
  position: absolute;
  inset: 0;
  transform: scale(var(--scene-scale));
  transform-origin: center;
}

/* ---------- Folder ---------- */

.folder-item {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 124px;
  user-select: none;
  touch-action: none;
  cursor: default;
  --folder-light: #7ed2f9;
  --folder-dark: #2f9ce8;
  --folder-back: #2386d4;
}

.folder-art {
  width: 104px;
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.38));
  transition: transform 140ms ease, filter 140ms ease;
}

.folder-art svg {
  display: block;
  width: 100%;
  height: auto;
}

.folder-art img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 128px;
  object-fit: contain;
}

.folder-item:hover .folder-art {
  transform: scale(1.03);
}

.folder-item.open .folder-art {
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.38)) brightness(1.08);
}

.folder-item.dragging .folder-art {
  transform: scale(1.05);
}

.folder-item.gone {
  display: none;
}

.folder-label {
  max-width: 150px;
  padding: 1px 7px;
  border-radius: 5px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-item.label-top .folder-label {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  max-width: 92px;
  color: white;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

/* ---------- Finder window ---------- */

.finder-window {
  position: absolute;
  z-index: 6;
  width: 360px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  overflow: hidden;
  background: rgba(28, 28, 30, 0.93);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 24px 70px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(22px);
  animation: window-pop 220ms ease;
}

@keyframes window-pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

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

.finder-titlebar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.45);
  background: linear-gradient(rgba(60, 60, 64, 0.55), rgba(44, 44, 48, 0.55));
}

.traffic {
  display: flex;
  gap: 8px;
}

.t-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #5a5a5f;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

button.t-dot {
  cursor: pointer;
}

button.t-dot:hover {
  background: #ff5f57;
}

.finder-title {
  min-width: 0;
  padding: 2px 6px;
  color: #f2f2f4;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.finder-tools {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #b8b8bd;
}

.finder-glyph svg {
  display: block;
  width: 14px;
  height: 14px;
  opacity: 0.85;
}

.finder-chevrons {
  font-size: 17px;
  line-height: 1;
}

.finder-search {
  display: grid;
  justify-items: center;
  gap: 1px;
}

.finder-search svg {
  width: 14px;
  height: 14px;
}

.finder-search small {
  font-size: 9px;
}

.finder-body {
  display: grid;
  place-items: center;
  min-height: 290px;
  padding: 24px;
}

.lut-item {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 9px;
  user-select: none;
  touch-action: none;
  cursor: grab;
  transition: background 120ms ease, opacity 120ms ease;
}

.lut-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.lut-item.drag-source {
  opacity: 0.35;
}

.lut-item-icon {
  display: block;
  width: var(--lut-icon-size);
  height: var(--lut-icon-size);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

.lut-item-icon svg,
.lut-item-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lut-item-label {
  max-width: 230px;
  color: #ececef;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Release-mode corner chip (no folder/window) ---------- */

.lut-item.release-chip {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 7;
  gap: 3px;
  padding: 10px 14px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(20, 22, 24, 0.72);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px);
}

.lut-item.release-chip:hover {
  background: rgba(20, 22, 24, 0.82);
  border-color: rgba(255, 255, 255, 0.3);
}

/* A custom PNG floats without the dark card (no "black mask" around it). */
.lut-item.release-chip.bare-icon,
.lut-item.release-chip.bare-icon:hover {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

/* The chip icon is a fixed palette size; the cube slider drives the drop size. */
.release-chip .lut-item-icon {
  width: 46px;
  height: 46px;
}

.release-chip .lut-item-label {
  max-width: 140px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.release-chip .lut-item-label:empty {
  display: none;
}

/* Folder controls are meaningless without a folder. */
.stage[data-mode="release"] #folderGroup {
  display: none;
}

/* ---------- Drag ghost ---------- */

.drag-ghost {
  position: fixed;
  z-index: 999;
  width: var(--lut-icon-size);
  height: var(--lut-icon-size);
  pointer-events: none;
  opacity: 0.92;
  transform: translate(-50%, -58%) scale(var(--scene-scale));
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.5));
}

.drag-ghost svg,
.drag-ghost img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- Dropped LUT + ripple ---------- */

.lut-drop {
  --drop-life: 0.8s;
  position: absolute;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: calc(var(--lut-icon-size) * 1.45);
  margin-left: calc(var(--lut-icon-size) * -0.725);
  margin-top: calc(var(--lut-icon-size) * -0.6);
  pointer-events: none;
  transition:
    opacity calc(var(--drop-life) * 0.5) ease,
    transform calc(var(--drop-life) * 0.5) ease;
}

.lut-drop.fading {
  opacity: 0;
  transform: scale(0.85);
}

.lut-drop .drop-icon {
  width: var(--lut-icon-size);
  height: var(--lut-icon-size);
  filter: drop-shadow(0 7px 16px rgba(0, 0, 0, 0.45));
  animation: drop-pop 320ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.lut-drop .drop-icon svg,
.lut-drop .drop-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lut-drop .drop-label {
  max-width: 190px;
  color: white;
  font-size: 13px;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes drop-pop {
  0% {
    transform: scale(1.18);
  }

  62% {
    transform: scale(0.94);
  }

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

.lut-drop .ripple {
  position: absolute;
  left: 50%;
  top: calc(var(--lut-icon-size) * 0.6);
  width: 0;
  height: 0;
}

.lut-drop .ring {
  position: absolute;
  left: -16px;
  top: -16px;
  width: 32px;
  height: 32px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  filter: blur(1px);
  backdrop-filter: blur(2px) brightness(1.06);
  opacity: 0;
  animation: drop-ring calc(var(--drop-life) * 0.95) ease-out forwards;
}

.lut-drop .ring.r2 {
  border-color: rgba(255, 255, 255, 0.14);
  animation-delay: calc(var(--drop-life) * 0.14);
}

.lut-drop .ring.r3 {
  border-color: rgba(255, 255, 255, 0.09);
  animation-delay: calc(var(--drop-life) * 0.28);
}

@keyframes drop-ring {
  0% {
    opacity: 0.55;
    transform: scale(0.25);
  }

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

.lut-drop .glow {
  position: absolute;
  left: -80px;
  top: -80px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0.05) 45%,
    transparent 65%
  );
  opacity: 0;
  animation: drop-glow calc(var(--drop-life) * 0.9) ease-out forwards;
}

@keyframes drop-glow {
  0% {
    opacity: 0.8;
    transform: scale(0.25);
  }

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

/* ---------- Release drop (image pulses, then fades) ---------- */

.release-drop {
  --drop-life: 1s;
  position: absolute;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: calc(var(--lut-icon-size) * 1.6);
  margin-left: calc(var(--lut-icon-size) * -0.8);
  margin-top: calc(var(--lut-icon-size) * -0.62);
  pointer-events: none;
  transform-origin: center;
  animation: release-pop var(--drop-life) cubic-bezier(0.2, 0.85, 0.3, 1) forwards;
}

.release-drop .drop-icon {
  width: var(--lut-icon-size);
  height: var(--lut-icon-size);
  animation: release-glow var(--drop-life) ease-out forwards;
}

.release-drop .drop-icon svg,
.release-drop .drop-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.release-drop .drop-label {
  max-width: 200px;
  color: white;
  font-size: 13px;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes release-pop {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }

  18% {
    opacity: 1;
    transform: scale(var(--pulse-bounce, 1.16));
  }

  34% {
    transform: scale(var(--pulse-under, 0.94));
  }

  50% {
    transform: scale(calc(1 + (var(--pulse-bounce, 1.16) - 1) * 0.3));
  }

  66% {
    opacity: 1;
    transform: scale(1);
  }

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

@keyframes release-glow {
  0% {
    filter: drop-shadow(0 7px 16px rgba(0, 0, 0, 0.45));
  }

  16% {
    filter: drop-shadow(0 7px 16px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 30px rgba(255, 255, 255, 0.65));
  }

  42% {
    filter: drop-shadow(0 7px 16px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 12px rgba(255, 255, 255, 0.2));
  }

  100% {
    filter: drop-shadow(0 7px 16px rgba(0, 0, 0, 0.45));
  }
}

/* ---------- Clapperboard icon ---------- */

.clapper-icon {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.clapper-icon i {
  position: absolute;
  display: block;
}

.clapper-icon .clap-stick {
  left: 2%;
  right: 5%;
  top: 1%;
  height: 14%;
  border-radius: 10% / 42%;
  background: repeating-linear-gradient(112deg, #f0f0f4 0 12%, #1a1a20 12% 24%);
  box-shadow: inset 0 0 0 1.5px #1a1a20, 0 1px 2px rgba(0, 0, 0, 0.4);
  transform: rotate(-9deg);
  transform-origin: 5% 100%;
}

.clapper-icon .clap-body {
  left: 0;
  right: 0;
  bottom: 0;
  height: 81%;
  border-radius: 14%;
  background: linear-gradient(#54545f, #2e2e37);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.clapper-icon .clap-stripes {
  left: 0;
  right: 0;
  top: 0;
  height: 26%;
  background: repeating-linear-gradient(112deg, #f0f0f4 0 12%, #1a1a20 12% 24%);
  border-bottom: 2px solid #17171c;
}

.clapper-icon .clap-screen {
  left: 6.5%;
  right: 6.5%;
  top: 30%;
  bottom: 7%;
  border-radius: 12% / 16%;
  border: 3px solid #17171c;
  background:
    radial-gradient(circle at 60% 70%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 52%),
    conic-gradient(
      from 0deg at 60% 70%,
      #ffe14d,
      #ff9500 12%,
      #ff4040 25%,
      #ff2db0 38%,
      #b14cf0 52%,
      #2f7df6 64%,
      #00d1ff 74%,
      #5be06b 86%,
      #b6e34a 94%,
      #ffe14d
    );
}
