.remix-element-btn img {
  transition: filter 0.38s;
  will-change: filter;
  margin: 0 auto;
  display: block;
}

:root {
  /* Height of the fixed bottom navigation bar */
  --bottom-bar-h: 3.25rem; /* keep in sync with .bottom-bar height */
}




/* Global rule to remove blue-ish tap highlights (Chrome/Safari mobile) */
* {
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000000;
  /* border: 5px solid rgb(0, 255, 242);  */
}

:root {
  --ui-speed: 260ms;
  --ui-ease: cubic-bezier(.22,.61,.36,1);
  --ui-press-scale: 0.97;
  --ui-top-nudge: clamp(16px, 5vmin, 32px);
}
* {
  transition: all var(--ui-speed) var(--ui-ease);
}

button {
  opacity: 1; /* default look */
  transition: opacity 0.15s ease;
}

/* Tap feedback */
button:active {
  opacity: 0.55; /* on tap */
}


/* Wrapper with 9:16 aspect ratio */
#av-wrapper {
  /* Robust 9:16 wrapper that respects safe areas + fixed bottom bar */
  /* Pick a stable viewport height: prefer 100svh when supported, else 100vh via var fallback below */
  --vh: 100vh;

  /* Available viewport minus safe-areas and the fixed bottom bar */
  --avail-w: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  --avail-h: calc(var(--vh) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--bottom-bar-h));

  /* True 9:16 sizing derived from available space (never overlaps bottom bar) */
  inline-size: min(var(--avail-w), calc(var(--avail-h) * 9 / 16));
  block-size:  min(var(--avail-h), calc(var(--avail-w) * 16 / 9));
  aspect-ratio: 9 / 16;

  position: relative; /* stays inside centered body flex; avoid fixed to keep layout predictable */
  box-sizing: border-box; /* keep borders inside the computed box */
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  contain: layout paint size; /* isolate for perf & avoid size leaks */
}

/* Prefer the stable small-viewport unit on modern mobile to avoid URL bar jumps */
@supports (height: 100svh) {
  #av-wrapper { --vh: 100svh; }
}


#scale {
  /* border: 5px solid rgb(77, 255, 0);  */
  width: 100dvh;
  height: 100dvh;
  transform-origin: center center;
  box-sizing: border-box;
}




/* Saved AVs grid container (for vertical scroll only in saves grid) */
.saved-avs-grid-scroll {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 0.5em;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 0.5em;
  box-sizing: border-box;
}

.saved-avs-grid-scroll > div {
  flex: 0 0 calc(31.33% - 1em);
  max-width: calc(31.33% - 1em);
  aspect-ratio: 9 / 16;
}

@media (max-width: 600px) {
  .saved-avs-grid-scroll > div {
    flex: 0 0 calc(31.33% - 0.6em);
    max-width: calc(31.33% - 0.6em);
  }
}

/* Top bar wrapper for animation (mobile-first, rem-based spacing, better alignment) */
#top-bar-wrapper {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  right: 1.2rem;
  width: auto;
  z-index: 10;
  transition: transform 0.18s var(--ease-back), opacity 0.16s var(--ease-smooth);
  transform: translateX(0%);
  opacity: 1;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  gap: 0.8rem;
  padding: 0.4rem 0.8rem;

}

.top-icon {
  width: 2.2rem;
  height: 2.2rem;
}

.left-section {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  top: -0.1em;
}
.right-section {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3em;
}

.title {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bolder;
  font-size: 16px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.54), 0 1px 2px rgba(0,0,0,0.42);
}



/* Bottom overlays */
.bottom-overlay {
  position: absolute;
  bottom: 33%;
  right: 7%;
  display: flex;
  gap: 8px;
  z-index: 9999;
  pointer-events: auto;
  max-width: 90%;
}



/* Remix button background (new .remix-btn-circle class) */
.remix-btn-circle {
  background-color: rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  padding: 0.6em;
  width: 2.5em;
  height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
}

.remix-btn-circle img,
.remix-btn-circle svg {
  filter: brightness(0) invert(1);
  width: 1.6em;
  height: 1.6em;
}

/* Reduce remix button icon size and ensure alignment */
.remix-btn-circle .bottom-icon,
.remix-btn-circle img.bottom-icon,
.remix-btn-circle svg.bottom-icon {
  width: 1.4em;
  height: 1.4em;
  min-width: 1.4em;
  min-height: 1.4em;
  max-width: 1.4em;
  max-height: 1.4em;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.bottom-icon {
  width: 3rem;
  height: 3rem;
  cursor: pointer;
}

/* Timer circle (optional) */
.timer-circle {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 1.25rem;
  z-index: 9999;
  gap: 0.625rem;
}

.timer-circle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.circle-bg {
  fill: none;
  stroke: #444;
  stroke-width: 2.5;
}

.circle-progress {
  fill: none;
  stroke: #0f0;
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.3s linear;
}

/* Bottom navigation */
.bottom-bar {
  /* border: 5px solid rgb(30, 0, 255);  */
  border-top: 1px solid rgba(255,255,255,0.1); /* faint thin line */
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 3.25em;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: #100c0c;
  z-index: 10;
  pointer-events: none;
}

.bottom-bar button {
  background: none;
  border: none;
  cursor: pointer;
  pointer-events: auto;
}

.bottom-bar button img {
  width: 3rem;
  height: 3rem;
}

.bottom-bar img[src="me.png"] {
  width: 2rem;
  height: 2rem;
}


.nav-left-controls,
.nav-right-controls {
  position: absolute;
  bottom: 23%;
  width: 3rem;
  height: 3rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-left-controls {
  left: 1.25rem;
}
.nav-right-controls {
  right: 1.25rem;
}

.nav-btn {
  width: 3rem;
  height: 3rem;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: white;
  font-size: 1.75rem;
}

#iframe-wrapper {
  position: relative;
  overflow: hidden;
}

#iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  transition: opacity 0.32s var(--ease-smooth); /* Smooth, quicker fade */
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
#iframe-wrapper iframe {
  transition: none;
}
}

.music-info-box {
  border: 0.11rem solid white;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  width: 1.75rem;
  height: 1.75rem;
  margin-left: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-info-box img {
  width: 1.125rem;
  height: 1.125rem;
  filter: brightness(0) invert(1);
}



#audio-icon {
  background: rgba(0, 0, 0, 0.4); /* darker background */
  border: 0.8rem solid #383838;         /* white border for contrast */
  border-radius: 50%;
  padding: 0.5rem;                  /* slightly larger padding */
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4); /* stronger shadow */
  opacity: 1;
  filter: invert(1);
}


#more-icon {
  width: 1.4rem;
  height: 1.4rem;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.65); /* new background added */
  border-radius: 25%; /* optional: makes it circular like others */
  padding: 4px; /* optional: adds some internal spacing */
}



#more-popup {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #100c0c;
  border-top-left-radius: 1.25em;
  border-top-right-radius: 1.25em;
  padding: 1rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(100%);
  transition: transform 0.12s var(--ease-back), opacity 0.12s var(--ease-smooth);
  will-change: transform;
  box-sizing: border-box;
}


#more-popup.popup-visible {
  transform: translateY(0%);
}


.popup-icon {
  width: 2.2rem;
  height: 2.2rem;
  filter: brightness(0) invert(1);
  max-width: 100%;
  height: auto;
}

/* Overlay layer for more-popup */
#overlay-layer {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0);
  z-index: 9998;
  cursor: default;
}

/* Overlay layer for remix/edit popup - now with blur effect */


/* ========== REMIX BOX & OVERLAY STYLES ========== */
/* === Remix Overlay and Box Animation Enhancements === */
#remix-overlay-layer {
  transition: opacity 0.28s var(--ease-smooth);
}

#remix-overlay-layer.remix-visible {
  opacity: 1;
}

#remix-box {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background:#100c0c;
  border-top-left-radius: 1.25em;
  border-top-right-radius: 1.25em;
  padding: 1rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.38s var(--ease-pop);
  transform: translateY(100%);
  will-change: transform;
  box-sizing: border-box;
}
#remix-box.remix-popup-visible {
  transform: translateY(0%);
}
.remix-popup-drag,
.popup-drag {
  width: 3rem;
  height: 0px;
  border-radius: 3px;
  background: rgba(255,255,255,0.4);
  margin-bottom: 15em;
}
.remix-popup-content,
.popup-content {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.remix-popup-item,
.popup-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
  transform: translateY(-350%);
  touch-action: manipulation;
  user-select: none;
  border-radius: 16px;
  padding: 0.5rem;
}
#remix-overlay-layer {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: 9998;
  cursor: default;
  /* backdrop-filter: blur(0.45em);
  -webkit-backdrop-filter: blur(0.45em); */
}
.remix-popup-hidden {
  display: none !important;
}
/* Floating remix controls (Save, Back, Aspect Border) */
.remix-save-label {
  position: fixed;
  top: 4.2%;
  right: 4.5%;
  color: white;
  font-family: Arial, sans-serif;
  font-size: 1.13em;
  background: #0760D4;
  padding: 0.4em 1.2em;
  border-radius: 0.7em;
  user-select: none;
  z-index: 100020;
  box-shadow: 0 4px 18px rgba(20,48,180,0.07);
  letter-spacing: 0.01em;
  min-width: 52px;
  text-align: center;
}
@media (max-width: 600px) {
  .remix-save-label {
    top: 2.5%;
    right: 4.5%;
    font-size: .9em;
    padding: 0.36em 1em;
    border-radius: 0.65em;
  }
}

#aspectBorderBox {
  position: fixed;
  top: -22.5%;
  left: 50%;
  transform: translateX(-50%);
  height: 64vw;
  max-height: 58vh;
  width: calc(64vw * 9 / 16);
  max-width: 98vw;
  /* border: 4px solid rgba(255,255,255,0.83);
  border-radius: 24px;
  box-shadow: 0 0 42px rgba(255,255,255,0.20); */
  z-index: 100020;
  transition: transform 0.45s;
  pointer-events: none;
  background: none;
}
@media (max-width: 600px) {
  #aspectBorderBox {
    top: 8%;
    height: 33vh;
    width: calc(40vh * 9 / 16);
    border-width: 3px;
    border-radius: 18px;
  }
}


.remix-save-label {
  position: fixed;
  top: 4.2%;
  right: 4.5%;
  color: white;
  font-family: Arial, sans-serif;
  font-size: 1.13em;
  background: #0760D4;
  padding: 0.4em 1.2em;
  border-radius: 0.7em;
  user-select: none;
  z-index: 100020;
  letter-spacing: 0.01em;
  min-width: 52px;
  text-align: center;
}
@media (max-width: 600px) {
  .remix-save-label {
    top: 2.5%;
    right: 4.5%;
    font-size: .9em;
    padding: 0.36em 1em;
    border-radius: 0.65em;
  }
}


.remix-cancel-btn {
  position: fixed;
  top: 4.2%;
  left: 4.5%;
  color: hsla(350, 77%, 46%, 0.8);
  background: transparent;
  font-family: Arial, sans-serif;
  font-weight: 500;
  font-size: 1.13em;
  padding: 0.4em 1.2em;
  border: 1.6px solid rgba(255,255,255,0.7);
  border-radius: 0.7em;
  cursor: pointer;
  z-index: 100020;
  min-width: 52px;
  text-align: center;
  letter-spacing: 0.01em;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.remix-cancel-btn:hover,
.remix-cancel-btn:active {
  background: rgba(255,255,255,0.16);
  border-color: #fff;
  color: hsl(350, 84%, 45%);
}

@media (max-width: 600px) {
  .remix-cancel-btn {
    top: 2.5%;
    left: 4.5%;
    font-size: .98em;
    padding: 0.36em 1em;
    border-radius: 0.65em;
  }
}

/* Hide floating remix controls by default */
.remix-floating-hidden {
  display: none !important;
}
/* ========== END REMIX BOX & OVERLAY STYLES ========== */

@media (max-width: 600px) {
  #remix-controls-container {
    gap: 1.1rem;
    background: rgba(255 255 255 / 0.1);
    backdrop-filter: saturate(180%) blur(8px);
    border-radius: 24px;
    padding: 0.4em 1.2em;
    transition: opacity 0.3s ease;
  }

  .remix-back-btn {
    width: 3em;
    height: 3em;
  }

  .remix-save-label {
    font-size: 1.1em;
    padding: 0.4em 1.1em;
  }

  #remix-controls-container.remix-floating-hidden {
    opacity: 0;
  }
  #remix-controls-container:not(.remix-floating-hidden) {
    opacity: 1;
  }
}
/* --- Remix Elements Section Styles --- */
.remix-elements-section {
  width: 100%;
  margin-bottom: 0.2em;
}

.remix-elements-title {
  font-family: Arial, sans-serif;
  font-weight: 400;
  font-size: 1.11em;
  margin-bottom: 0.55em;
  color: hsla(0, 0%, 100%, 0.7);
  letter-spacing: 0.02em;
  text-align: left;
  padding-left: 0.2em;
}

.remix-elements-scroll-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4em;
  width: 100%;
  overflow: hidden;
}

.remix-elements-row {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  gap: 0.6em; /* Reduced gap for closer boxes */
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

.remix-elements-row::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}


.remix-element-btn {
  background: hsl(0, 0%, 100%);
  border-radius: 8px;
  padding: 0.5em 1em 0.5em 0.7em;
  display: flex;
  align-items: center;
  gap: 0.6em;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 1em;
  min-width: 92px;
  transition: background 0.18s var(--ease-smooth), box-shadow 0.18s var(--ease-smooth), border-color 0.18s var(--ease-smooth);
  border: 2.5px solid transparent;
  box-sizing: border-box;
}

.remix-element-btn:hover,
.remix-element-btn:focus-visible {
  border-color: #0760D4; /* subtle light bluish background on hover */
  outline: none;
}

.remix-element-btn:active {
transform: scale(0.98);
transition: transform 0.14s var(--ease-pop);
}

/* Active remix element button styling */
.remix-element-btn.active {
  border: 2.5px solid #3b82f6; /* solid bluish border */
  box-shadow: none; /* remove shadows if any */
}

.remix-element-btn img {
  width: 1.5em;
  height: 1.5em;
  object-fit: contain;
}
.remix-element-btn span {
  color: #222;
  font-size: 1em;
  font-weight: 500;
  font-family: Arial, sans-serif;
}


@media (max-width: 600px) {
  .remix-elements-row {
    gap: 0.8em;
  }
  .remix-element-btn {
    min-width: 94px;
    padding: 0.4em 0.7em 0.4em 0.5em;
    font-size: 0.95em;
  }
  .remix-elements-title {
    font-size: 1em;
  }
}
/* Explicitly set size for blank .remix-element-btn boxes in All images and Upload on sections */
#all-images-row .remix-element-btn,
#upload-on-row .remix-element-btn {
  min-width: 92px;
  height: 40px;
  background: hsl(0, 0%, 100%);
  border-radius: 8px;
  padding: 0.5em 1em 0.5em 0.7em;
  display: flex;
  align-items: center;
  gap: 0.6em;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 1em;
  transition: background 0.18s, box-shadow 0.18s;
  box-sizing: border-box;
}
@media (prefers-reduced-motion: reduce) {
#top-bar-wrapper,
#remix-box,
#more-popup,
#iframe-wrapper iframe {
  transition: none !important;
}
}

#coming-soon-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
#coming-soon-popup.popup-hidden {
  display: none;
}
.coming-soon-box {
  background: #fff;
  border-radius: 1em;
  padding: 2em;
  width: 80%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  animation: fadeInUp 0.3s ease;
}
.coming-soon-box h2 {
  margin: 0 0 0.5em;
  font-size: 1.4em;
  color: #333;
}
.coming-soon-box p {
  margin: 0 0 1.2em;
  font-size: 1em;
  color: #555;
}
.coming-soon-box button {
  padding: 0.6em 1.2em;
  border: none;
  border-radius: 0.5em;
  background: #333;
  color: #fff;
  font-size: 0.95em;
  cursor: pointer;
}
.coming-soon-box button:hover {
  background: #000;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
