/* --- Main Container --- */
.rts-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Helvetica', 'Arial', sans-serif;
    overflow: visible; 
}

/* --- Center Image --- */
.rts-center-image {
    position: absolute;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: width 0.3s ease;
}
.rts-center-image img {
    width: 100%;
    height: auto;
    display: block;
    animation: rts-float 6s ease-in-out infinite;
}

@keyframes rts-float {
	0% { transform: translateY(0px); }
	50% { transform: translateY(-8px); }
	100% { transform: translateY(0px); }
}

/* --- Wrapper --- */
.rts-items-wrapper {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* --- Item Structure --- */
.rts-item {
    position: absolute;
    z-index: 2;
    transition: all 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* CRITICAL CHANGE: ALLOW WIDTH TO GROW */
    max-width: none; /* No limit */
    width: fit-content; /* Hug the text */
}

/* --- Bubble Defaults --- */
.rts-bubble {
    background: #fff;
    padding: 10px 18px;
    border-radius: 40px;
    box-shadow: 0 8px 25px rgba(37, 37, 80, 0.1);
    font-size: 14px;
    color: #2c2c66;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    transition: all 0.8s ease; 
    
    /* CRITICAL CHANGE: STRICTLY FOLLOW TEXT WIDTH */
    white-space: nowrap; 
}

/* ========================================================================
   VERSION 1: ORBIT MODE
   ========================================================================
*/
.rts-container[data-mode="v1"] .rts-item.rts-pos-0 {
    top: 10%; left: -10%; 
    transform: translateX(0); z-index: 10;
}
.rts-container[data-mode="v1"] .rts-item.rts-pos-0 .rts-bubble {
    font-size: 20px; font-weight: 800; padding: 15px 25px;
}
/* Positions */
.rts-container[data-mode="v1"] .rts-item.rts-pos-1 { top: 15%; right: -10%; transform: translateX(0) scale(0.9); }
.rts-container[data-mode="v1"] .rts-item.rts-pos-2 { top: 48%; right: -12%; transform: translateX(0) scale(0.9); }
.rts-container[data-mode="v1"] .rts-item.rts-pos-3 { top: 78%; right: -10%; transform: translateX(0) scale(0.9); }
.rts-container[data-mode="v1"] .rts-item.rts-pos-4 { top: 78%; left: -10%; transform: translateX(0) scale(0.9); }
.rts-container[data-mode="v1"] .rts-item.rts-pos-5 { top: 48%; left: -12%; transform: translateX(0) scale(0.9); }
/* V1 4-Item Override */
.rts-container[data-mode="v1"][data-count="4"] .rts-item.rts-pos-0 { top: 15%; left: -10%; }
.rts-container[data-mode="v1"][data-count="4"] .rts-item.rts-pos-1 { top: 20%; right: -10%; transform: scale(0.9); }
.rts-container[data-mode="v1"][data-count="4"] .rts-item.rts-pos-2 { top: 75%; right: -10%; transform: scale(0.9); }
.rts-container[data-mode="v1"][data-count="4"] .rts-item.rts-pos-3 { top: 75%; left: -10%; transform: scale(0.9); }


/* ========================================================================
   VERSION 2: LEFT STACK (Vertical List)
   ========================================================================
*/
.rts-container[data-mode="v2"] .rts-center-image {
    right: -5%;
    left: auto;
    top: 45%;
    transform: translateY(-50%);
    z-index: 1;
    justify-content: flex-end;
    max-width: 800px; 
}

.rts-container[data-mode="v2"] .rts-item {
    z-index: 10; 
    justify-content: flex-start; 
}

/* V2 Pos 0: Active */
.rts-container[data-mode="v2"] .rts-item.rts-pos-0 {
    top: 5%;
    left: 0;
    transform: translateX(0);
    text-align: left;
}
.rts-container[data-mode="v2"] .rts-item.rts-pos-0 .rts-bubble {
    font-size: 22px; font-weight: 800; padding: 18px 32px; text-align: left;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

/* V2 Inactive Stack */
.rts-container[data-mode="v2"] .rts-item.rts-pos-1 {
    top: 30%; left: 0; transform: scale(0.95); opacity: 0.95; z-index: 5;
}
.rts-container[data-mode="v2"] .rts-item.rts-pos-2 {
    top: 50%; left: 0; transform: scale(0.95); opacity: 0.85; z-index: 4;
}
.rts-container[data-mode="v2"] .rts-item.rts-pos-3 {
    top: 70%; left: 0; transform: scale(0.95); opacity: 0.75; z-index: 3;
}

.rts-container[data-mode="v2"] .rts-item:not(.rts-pos-0):not(.rts-pos-1):not(.rts-pos-2):not(.rts-pos-3) {
    top: 90%; left: 0; opacity: 0; transform: scale(0.5);
}


/* =========================================
   RESPONSIVE
========================================= */
.rts-item.rts-pos-hidden {
    opacity: 0 !important; transform: scale(0.5); top: 50%; left: 50%;
}

@media (max-width: 1024px) {
    .rts-container { aspect-ratio: 1 / 1; max-width: 600px; }
    
    /* Tablet V1 */
    .rts-container[data-mode="v1"] .rts-item.rts-pos-0 { top: 8%; left: 0; }
    .rts-container[data-mode="v1"] .rts-item.rts-pos-1 { top: 12%; right: 0; }
    
    /* Tablet V2 */
    .rts-container[data-mode="v2"] .rts-center-image { width: 60% !important; right: -5%; }
    .rts-container[data-mode="v2"] .rts-item.rts-pos-0 { top: 10%; }
    .rts-container[data-mode="v2"] .rts-item.rts-pos-1 { top: 35%; }
    .rts-container[data-mode="v2"] .rts-item.rts-pos-2 { top: 55%; }
    .rts-container[data-mode="v2"] .rts-item.rts-pos-3 { top: 75%; }
}

@media (max-width: 767px) {
    .rts-container {
        aspect-ratio: auto; height: auto; flex-direction: column; padding: 50px 0;
    }
    .rts-center-image {
        position: relative; width: 70% !important; right: auto !important; left: auto !important;
        margin-bottom: 40px; transform: none !important; top: auto !important;
    }
    .rts-items-wrapper { position: relative; }
    
    .rts-item {
        position: relative; top: auto !important; bottom: auto !important; 
        left: auto !important; right: auto !important;
        transform: none !important; margin-bottom: 15px; opacity: 0.6;
        width: 100%; 
        /* Reset fit-content on mobile to prevent overflow if text is massive */
        max-width: 100%; 
        justify-content: center !important;
    }
    .rts-bubble { 
        width: 100%; 
        box-sizing: border-box; 
        text-align: center !important; 
        /* Allow wrapping on mobile to prevent horizontal scrolling */
        white-space: normal; 
    }
    .rts-item.rts-pos-0 { opacity: 1; order: -1; transform: none !important; }
}