@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css');

@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap");

/* Instagram Story Viewer Download Styles */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            /* Instagram Color System */
            --ig-pink: #E1306C;
            --ig-orange: #F77737;
            --ig-yellow: #FCAF45;
            --ig-purple: #833AB4;
            --ig-blue: #405DE6;
            --ig-red: #C13584;
            --ig-magenta: #FD1D1D;
            --ig-teal: #5C51D6;
            --white: #ffffff;
            --gray-50: #f8f9fa;
            --gray-100: #f1f3f5;
            --gray-200: #e9ecef;
            --gray-400: #adb5bd;
            --gray-600: #6c757d;
            --gray-800: #343a40;
            --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
            --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
            --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
            --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
            --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

            /* Derived colors for components */
            --primary: var(--ig-pink);
            --secondary: var(--gray-600);
            --accent: var(--ig-purple);
            --accent-secondary: var(--ig-blue);
            --success: var(--ig-teal);
            --warning: var(--ig-yellow);
            --error: var(--ig-red);

            /* Text Colors */
            --text-primary-light: var(--gray-800);
            --text-secondary-light: var(--gray-600);
            --text-muted-light: var(--gray-400);

            /* Glow Shadows */
            --shadow-glow-primary: 0 0 15px rgba(225, 48, 108, 0.3);
            --shadow-glow-accent: 0 0 15px rgba(131, 58, 180, 0.3);

            /* Misc */
            --border-radius-sm: 8px;
            --border-radius-md: 12px;
            --border-radius-lg: 16px;
            --border-line-light: 1px solid rgba(0, 0, 0, 0.1);
            --transition-normal: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
            --backdrop-blur: blur(10px);
        }

        /* Wrapper to avoid conflicts */
     
      .instagram-story-viewer-wrapper {
	font-family: 'Outfit', sans-serif;
	background: linear-gradient(135deg, 
            rgba(252, 175, 69, 0.08) 0%, 
            rgba(247, 119, 55, 0.06) 20%, 
            rgba(225, 48, 108, 0.08) 40%, 
            rgba(131, 58, 180, 0.06) 60%, 
            rgba(64, 93, 230, 0.08) 80%, 
            rgba(252, 175, 69, 0.08) 100%);
	color: var(--text-primary-light);
	line-height: 1.5;
	width: 100%;
	padding: 2rem;
	position: relative;
	box-shadow: inset 0 0 100px rgba(225, 48, 108, 0.05), inset 0 0 100px rgba(131, 58, 180, 0.05);
	overflow: visible;
}

.instagram-story-viewer-wrapper::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: radial-gradient(circle at top left, rgba(225, 48, 108, 0.2) 0%, transparent 50%),
                    radial-gradient(circle at bottom right, rgba(131, 58, 180, 0.2) 0%, transparent 50%);
	pointer-events: none;
	z-index: 0;
}

        .hidden {
            display: none !important;
        }

        /* Layout */
        .instagram-story-viewer-wrapper {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2rem;
            width: 100%;
        }

        .content-container {
            width: 100%;
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2rem;
            position: relative;
            z-index: 1;
            overflow: visible;
            height: auto;
        }


        /* Title Section - No background */
        .title-section {
            text-align: center;
            padding: 1rem 0;
        }

        /* Input Component - With soft glow */
        .input-component {
            background: rgba(255, 255, 255, 0.8);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border-radius: var(--border-radius-lg);
            padding: 2rem;
            box-shadow: 0 4px 20px rgba(225, 48, 108, 0.1), 0 0 0 1px rgba(225, 48, 108, 0.1);
            width: 100%;
            max-width: 1200px;
            transition: var(--transition-normal);
            position: relative;
        }

        .input-component:hover {
            box-shadow: 0 6px 25px rgba(225, 48, 108, 0.12), 0 0 0 1px rgba(225, 48, 108, 0.15);
        }

        .app-logo {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 1rem;
            margin-bottom: 1rem;
        }

        .logo-icon {
            width: 50px;
            height: 50px;
            background: linear-gradient(45deg, var(--ig-purple), var(--ig-pink), var(--ig-orange));
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            font-size: 20px;
            box-shadow: 0 4px 15px rgba(225, 48, 108, 0.2);
        }

        .app-title {
            font-size: 3rem;
            font-weight: 800;
            background: linear-gradient(to right, var(--ig-purple), var(--ig-pink), var(--ig-orange));
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            letter-spacing: -0.5px;
        }

        /* Search Container */
        .search-container {
            padding: 0;
            position: relative;
            flex-shrink: 0;
        }

        #search-form {
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }

        .form-label {
            font-size: 1rem;
            font-weight: 600;
            color: var(--text-secondary-light);
            margin-bottom: 0.5rem;
            letter-spacing: 0.5px;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .form-label svg {
            width: 18px;
            height: 18px;
            stroke: var(--ig-purple);
        }

        .input-group {
            position: relative;
        }

        #username-input {
            width: 100%;
            padding: 1.2rem 1.5rem;
            background: rgba(255, 255, 255, 0.7);
            border: 1px solid rgba(0, 0, 0, 0.1);
            border-radius: var(--border-radius-lg);
            color: var(--text-primary-light);
            font-family: 'Outfit', sans-serif;
            font-size: 1rem;
            transition: var(--transition-normal);
        }

        #username-input:focus {
            outline: none;
            border-color: var(--ig-purple);
            box-shadow: 0 0 0 4px rgba(131, 58, 180, 0.15);
            background: rgba(255, 255, 255, 0.9);
        }

        #username-input::placeholder {
            color: var(--text-muted-light);
        }

        .input-icon {
            position: absolute;
            right: 1.5rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-muted-light);
        }

        #search-btn {
            background: linear-gradient(45deg, var(--ig-purple), var(--ig-pink), var(--ig-orange));
            color: white;
            border: none;
            border-radius: var(--border-radius-lg);
            padding: 1.2rem 1.5rem;
            font-family: 'Outfit', sans-serif;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 0.8rem;
            transition: var(--transition-normal);
            box-shadow: 0 8px 20px rgba(225, 48, 108, 0.2);
            position: relative;
            overflow: hidden;
            letter-spacing: 0.5px;
        }

        #search-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            transform: translateX(-100%);
        }

        #search-btn:hover {
            box-shadow: 0 8px 20px rgba(225, 48, 108, 0.25);
        }

        #search-btn:hover::before {
            left: 100%;
        }

        #search-btn:active {
            box-shadow: 0 4px 10px rgba(225, 48, 108, 0.15);
        }

        /* Output Component - Individual component */
        .output-component {
            background: rgba(255, 255, 255, 0.8);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border-radius: var(--border-radius-lg);
            padding: 2rem;
            box-shadow: 0 4px 20px rgba(131, 58, 180, 0.1), 0 0 0 1px rgba(131, 58, 180, 0.1);
            width: 100%;
            max-width: 1200px;
            transition: var(--transition-normal);
            overflow: visible;
            min-height: auto;
            height: auto;
        }

        .output-component:hover {
            box-shadow: 0 6px 25px rgba(131, 58, 180, 0.12), 0 0 0 1px rgba(131, 58, 180, 0.15);
        }

        .profile-section {
            padding: 0;
            position: relative;
            overflow: visible;
        }

        /* Responsive Design */
        @media (max-width: 1200px) {
            .content-container {
                padding: 0 1rem;
            }
        }

        @media (max-width: 768px) {
            .instagram-story-viewer-wrapper {
                padding: 1rem;
                gap: 1.5rem;
            }

            .input-component,
            .output-component {
                padding: 1.5rem;
            }

            .stories-grid {
                grid-template-columns: 1fr;
            }

            .app-title {
                font-size: 2rem;
            }

            .profile-header {
                flex-direction: column;
                text-align: center;
            }

            .profile-image {
                width: 60px;
                height: 60px;
            }
        }

        @media (max-width: 480px) {
            .instagram-story-viewer-wrapper {
                padding: 0.5rem;
                gap: 0.5rem;
            }

            .input-component,
            .output-component {
                padding: 0.6rem;
            }

            .stories-grid {
                grid-template-columns: 1fr;
                gap: 0.4rem;
            }

            .app-title {
                font-size: 1.4rem;
            }

            .logo-icon {
                width: 40px;
                height: 40px;
                font-size: 16px;
            }

            #search-btn {
                padding: 0.6rem;
                font-size: 0.9rem;
            }

            .profile-header {
                padding: 0.6rem;
                gap: 0.6rem;
            }

            .profile-image {
                width: 50px;
                height: 50px;
            }

            .profile-data {
                gap: 0.8rem;
            }

            .story-meta {
                padding: 0.5rem;
            }

            .story-info {
                gap: 0.3rem;
            }
        }

        /* Loading State */
        .loading-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 4rem 0;
        }

        .spinner {
            width: 60px;
            height: 60px;
            position: relative;
            margin-bottom: 2rem;
        }

        .spinner::before,
        .spinner::after {
            content: '';
            position: absolute;
            border-radius: 50%;
        }

        .spinner::before {
            width: 100%;
            height: 100%;
            background-image: linear-gradient(var(--ig-purple), var(--ig-pink), var(--ig-orange));
        }

        .spinner::after {
            top: 10%;
            left: 10%;
            right: 10%;
            bottom: 10%;
            background: var(--surface-dark);
            border-radius: 50%;
        }

        .loading-text {
            color: var(--text-secondary-light);
            font-size: 1.1rem;
            font-weight: 500;
            background: linear-gradient(to right, var(--ig-purple), var(--ig-pink));
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            background-size: 200% 100%;
        }

        /* Profile Data */
        .profile-data {
            display: flex;
            flex-direction: column;
            gap: 2rem;
            overflow: visible;
        }

        .profile-header {
            display: flex;
            align-items: center;
            gap: 1.5rem;
            padding: 1.5rem;
            background: rgba(255, 255, 255, 0.6);
            border-radius: var(--border-radius-lg);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            transition: var(--transition-normal);
            border: 1px solid rgba(0, 0, 0, 0.05);
        }

        .profile-header:hover {
            box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
        }

        .profile-image-container {
            position: relative;
        }

        .profile-image {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            object-fit: cover;
            border: 3px solid transparent;
            background:
                linear-gradient(var(--surface-dark), var(--surface-dark)) padding-box,
                linear-gradient(45deg, var(--ig-purple), var(--ig-pink), var(--ig-orange)) border-box;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            transition: var(--transition-normal);
        }

        .profile-image:hover {
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
        }

        .verified-indicator {
            position: absolute;
            bottom: 0;
            right: 0;
            width: 24px;
            height: 24px;
            background: linear-gradient(to right, var(--ig-blue), var(--ig-purple));
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 12px;
            border: 2px solid var(--surface-dark);
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }

        .profile-info {
            flex: 1;
        }

        .profile-username {
            font-size: 1.3rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
            color: var(--text-primary-light);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            letter-spacing: 0.5px;
        }

        .profile-fullname {
            font-size: 1rem;
            color: var(--text-secondary-light);
            font-weight: 500;
        }

        /* Stories Grid */
        .stories-section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
        }

        .stories-section-title {
            font-size: 1.2rem;
            font-weight: 700;
            color: var(--text-primary-light);
            display: flex;
            align-items: center;
            gap: 0.8rem;
            letter-spacing: 0.5px;
            position: relative;
        }

        .stories-section-title svg {
            width: 20px;
            height: 20px;
            stroke: var(--ig-pink);
        }


        .stories-count {
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--text-secondary-light);
            background: rgba(0, 0, 0, 0.05);
            padding: 0.4rem 0.8rem;
            border-radius: 20px;
        }

        .stories-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1.5rem;
            width: 100%;
        }

        .story-card {
            background: rgba(255, 255, 255, 0.6);
            border-radius: var(--border-radius-md);
            overflow: hidden;
            cursor: pointer;
            transition: var(--transition-normal);
            border: 1px solid rgba(0, 0, 0, 0.05);
            position: relative;
        }

        .story-card:hover {
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
            border-color: rgba(225, 48, 108, 0.15);
        }

        .story-card::before {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: var(--border-radius-md);
            padding: 2px;
            background: linear-gradient(45deg, var(--ig-purple), var(--ig-pink), var(--ig-orange));
            -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
            opacity: 0;
            transition: var(--transition-normal);
        }

        .story-card:hover::before {
            opacity: 0.5;
        }

        .story-preview {
            width: 100%;
            height: 220px;
            overflow: hidden;
            position: relative;
            min-height: 220px;
        }

        .story-preview img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: opacity 0.2s ease;
        }

        .story-card:hover .story-preview img {
            opacity: 0.9;
        }

        .story-preview::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.7));
            z-index: 1;
        }

        .story-type-overlay {
            position: absolute;
            top: 15px;
            right: 15px;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-radius: 30px;
            padding: 0.5rem 1rem;
            color: white;
            font-size: 0.8rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 1px;
            display: flex;
            align-items: center;
            gap: 6px;
            z-index: 2;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .story-type-overlay.video {
            background: rgba(25, 135, 84, 0.7);
        }

        .story-type-overlay.image {
            background: rgba(13, 110, 253, 0.7);
        }

        .story-timestamp-overlay {
            position: absolute;
            bottom: 15px;
            left: 15px;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-radius: 30px;
            padding: 0.5rem 1rem;
            color: white;
            font-size: 0.8rem;
            font-weight: 500;
            z-index: 2;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .story-meta {
            padding: 1rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(0, 0, 0, 0.03);
            border-top: 1px solid rgba(0, 0, 0, 0.05);
        }

        .story-info {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .story-info svg {
            width: 18px;
            height: 18px;
            stroke: var(--ig-pink);
        }

        .story-time {
            font-size: 0.9rem;
            color: var(--text-secondary-light);
            font-weight: 500;
        }

        /* Error Panel */
        .error-panel {
            padding: 2rem;
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            margin-top: 1rem;
            background: rgba(255, 255, 255, 0.6);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border-radius: var(--border-radius-lg);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            border: 1px solid rgba(0, 0, 0, 0.05);
        }

        .error-icon {
            width: 80px;
            height: 80px;
            background: rgba(193, 53, 132, 0.1);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.5rem;
            color: var(--error);
            margin-bottom: 2rem;
            position: relative;
        }

        .error-icon::after {
            content: '';
            position: absolute;
            inset: -8px;
            border-radius: 50%;
            border: 2px solid rgba(220, 53, 69, 0.2);
        }

        .error-message {
            color: var(--text-secondary-light);
            font-size: 1.1rem;
            max-width: 300px;
            line-height: 1.6;
            font-weight: 500;
        }

        .error-action {
            margin-top: 2rem;
            padding: 1rem 2rem;
            background: linear-gradient(45deg, var(--ig-purple), var(--ig-pink));
            color: white;
            border: none;
            border-radius: var(--border-radius-md);
            font-family: 'Outfit', sans-serif;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition-normal);
            box-shadow: 0 4px 15px rgba(225, 48, 108, 0.2);
        }

        .error-action:hover {
            box-shadow: 0 6px 15px rgba(225, 48, 108, 0.25);
        }

        /* Main Content */
        .main-content {
            flex: 1;
            position: relative;
            background-color: var(--surface-dark);
            overflow: hidden;
            max-height: 100vh;
        }

        .main-content::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background:
                radial-gradient(circle at 20% 20%, rgba(13, 110, 253, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 80% 80%, rgba(25, 135, 84, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 50% 50%, rgba(32, 201, 151, 0.03) 0%, transparent 60%);
            z-index: 0;
        }

        /* Story Player */
        .story-player {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: #000;
            z-index: 5;
        }

        .story-control-bar {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            padding: 1.5rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
            z-index: 15;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
        }

        .story-user-data {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .story-user-image {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            border: 2px solid rgba(255, 255, 255, 0.8);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        }

        .story-username {
            font-size: 1.1rem;
            color: white;
            font-weight: 600;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .story-timestamp {
            font-size: 0.9rem;
            color: rgba(255, 255, 255, 0.8);
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .story-actions {
            display: flex;
            gap: 1rem;
        }

        .control-btn {
            width: 44px;
            height: 44px;
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: var(--transition-normal);
            color: white;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        }

        .control-btn:hover {
            background-color: rgba(255, 255, 255, 0.25);
            transform: translateY(-3px) scale(1.1);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
        }

        /* Progress Track */
        .progress-track {
            position: absolute;
            top: 90px;
            left: 0;
            right: 0;
            padding: 0 1.5rem;
            display: flex;
            gap: 8px;
            z-index: 10;
        }

        .progress-indicator {
            height: 4px;
            flex: 1;
            background-color: rgba(255, 255, 255, 0.2);
            border-radius: 4px;
            overflow: hidden;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .progress-fill {
            height: 100%;
            width: 0;
            background: linear-gradient(to right, var(--primary), var(--accent-secondary), var(--accent));
            border-radius: 4px;
            transition: width 0.1s linear;
        }

        .progress-indicator.completed .progress-fill {
            width: 100%;
            background: white;
        }

        /* Media Container */
        .media-container {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #000;
        }

        .media-container img,
        .media-container video {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
        }

        /* Navigation */
        .navigation-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: flex;
            z-index: 5;
        }

        .nav-area {
            flex: 1;
            background: transparent;
            border: none;
            cursor: pointer;
            position: relative;
        }

        .nav-indicator {
            position: absolute;
            top: 50%;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            display: flex;
            align-items: center;
            justify-content: center;
            transform: translateY(-50%);
            opacity: 0;
            transition: var(--transition-normal);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: white;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        }

        .prev-area .nav-indicator {
            left: 30px;
        }

        .next-area .nav-indicator {
            right: 30px;
        }

        .nav-area:hover .nav-indicator {
            opacity: 1;
        }


        /* Responsive Styles */

        @media (max-width: 576px) {
            .stories-grid {
                grid-template-columns: 1fr;
            }

            .story-preview {
                height: 220px;
            }

            .story-control-bar {
                padding: 1.2rem;
            }

            .story-user-image {
                width: 40px;
                height: 40px;
            }

            .progress-track {
                top: 80px;
            }
        }

        /* Toast Notifications */
        .toast-container {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 1000;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .toast {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid rgba(0, 0, 0, 0.1);
            border-radius: var(--border-radius-md);
            padding: 1rem 1.5rem;
            color: var(--text-primary-light);
            font-size: 0.9rem;
            font-weight: 500;
            box-shadow: var(--shadow-lg);
            transform: translateX(100%);
            opacity: 0;
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
            display: flex;
            align-items: center;
            gap: 0.8rem;
            min-width: 300px;
        }

        .toast.show {
            transform: translateX(0);
            opacity: 1;
        }

        .toast.success {
            border-left: 4px solid var(--ig-teal);
        }

        .toast.error {
            border-left: 4px solid var(--ig-red);
        }

        .toast.info {
            border-left: 4px solid var(--ig-blue);
        }

        .toast-icon {
            width: 20px;
            height: 20px;
            flex-shrink: 0;
        }

        .toast-message {
            flex: 1;
        }

        .toast-close {
            background: none;
            border: none;
            color: var(--text-muted-light);
            cursor: pointer;
            padding: 0;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: var(--transition-normal);
        }

        .toast-close:hover {
            color: var(--text-primary-light);
        }

        /* No Stories Message */
        .no-stories-message {
            padding: 3rem;
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            margin-top: 2rem;
            background: rgba(255, 255, 255, 0.7);
            backdrop-filter: var(--backdrop-blur);
            -webkit-backdrop-filter: var(--backdrop-blur);
            border-radius: var(--border-radius-lg);
            box-shadow: var(--shadow-md);
            border: 1px solid rgba(0, 0, 0, 0.1);
            position: relative;
            overflow: hidden;
        }

        .no-stories-message::before {
            content: '';
            position: absolute;
            top: -100%;
            left: -100%;
            width: 300%;
            height: 300%;
            background: radial-gradient(circle at center, rgba(255, 193, 7, 0.1), transparent 70%);
            animation: rotate 20s linear infinite;
            z-index: -1;
        }

        .no-stories-icon {
            width: 80px;
            height: 80px;
            background: rgba(255, 193, 7, 0.1);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.5rem;
            color: var(--ig-yellow);
            margin-bottom: 2rem;
            position: relative;
        }

        .no-stories-title {
            font-size: 1.3rem;
            font-weight: 700;
            color: var(--text-primary-light);
            margin-bottom: 1rem;
        }

        .no-stories-description {
            color: var(--text-secondary-light);
            font-size: 1rem;
            max-width: 400px;
            line-height: 1.6;
            font-weight: 500;
        }

        /* Play/Pause Button */
        .play-pause-btn {
            width: 44px;
            height: 44px;
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: var(--transition-normal);
            color: white;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        }

        .play-pause-btn:hover {
            background-color: rgba(255, 255, 255, 0.25);
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
        }

        /* Download Button */
        .download-btn {
            width: 44px;
            height: 44px;
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: var(--transition-normal);
            color: white;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        }

        .download-btn:hover {
            background-color: rgba(255, 255, 255, 0.25);
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
        }

        .download-btn:active {
            background-color: rgba(255, 255, 255, 0.3);
        }

        /* Centered Close Button */
        .centered-close-btn {
            position: absolute !important;
            top: 30px !important;
            left: 50% !important;
            transform: translateX(-50%) !important;
            padding: 0.75rem 2rem !important;
            background: rgba(0, 0, 0, 0.8) !important;
            backdrop-filter: blur(10px) !important;
            -webkit-backdrop-filter: blur(10px) !important;
            border: 2px solid rgba(255, 255, 255, 0.5) !important;
            border-radius: 30px !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            cursor: pointer !important;
            z-index: 1000 !important;
            color: white !important;
            font-size: 1rem !important;
            font-weight: 700 !important;
            transition: all 0.3s ease !important;
            pointer-events: auto !important;
        }

        .centered-close-btn:hover {
            background: rgba(0, 0, 0, 0.95) !important;
            border-color: rgba(255, 255, 255, 0.8) !important;
            transform: translateX(-50%) scale(1.05) !important;
        }

        .centered-close-btn:active {
            transform: translateX(-50%) scale(0.95) !important;
        }

        @media (max-width: 768px) {
            .centered-close-btn {
                padding: 0.6rem 1.5rem !important;
                font-size: 0.9rem !important;
                top: 20px !important;
                z-index: 1000 !important;
            }
        }

        @media (max-width: 480px) {
            .centered-close-btn {
                padding: 0.5rem 1.2rem !important;
                font-size: 0.85rem !important;
                top: 15px !important;
                z-index: 1000 !important;
            }
        }

/* --- Codex CSS updates --- */
/* Instagram Story Viewer Download Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --ig-pink: #e1306c;
    --ig-orange: #f77737;
    --ig-yellow: #fcaf45;
    --ig-purple: #833ab4;
    --ig-blue: #405de6;
    --ig-red: #c13584;
    --ig-magenta: #fd1d1d;
    --ig-teal: #16a085;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-400: #94a3b8;
    --gray-600: #64748b;
    --gray-800: #1e293b;
    --surface-dark: #ffffff;
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 26px 70px rgba(15, 23, 42, 0.16);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --primary: var(--ig-pink);
    --secondary: var(--gray-600);
    --accent: var(--ig-purple);
    --accent-secondary: var(--ig-blue);
    --success: var(--ig-teal);
    --warning: var(--ig-yellow);
    --error: var(--ig-red);
    --text-primary-light: var(--gray-800);
    --text-secondary-light: var(--gray-600);
    --text-muted-light: var(--gray-400);
    --shadow-glow-primary: 0 0 24px rgba(225, 48, 108, 0.24);
    --shadow-glow-accent: 0 0 24px rgba(131, 58, 180, 0.22);
    --border-radius-sm: 10px;
    --border-radius-md: 14px;
    --border-radius-lg: 20px;
    --border-line-light: 1px solid rgba(148, 163, 184, 0.22);
    --transition-normal: all 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
    --backdrop-blur: blur(18px);
}

.instagram-story-viewer-wrapper {
    font-family: 'Outfit', sans-serif;
    background:
        radial-gradient(circle at 15% 0%, rgba(252, 175, 69, 0.18), transparent 34%),
        radial-gradient(circle at 85% 12%, rgba(131, 58, 180, 0.14), transparent 36%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 246, 249, 0.92) 45%, rgba(245, 248, 255, 0.95) 100%);
    color: var(--text-primary-light);
    line-height: 1.5;
    width: 100%;
    padding: clamp(1rem, 3vw, 2.5rem);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 2.5vw, 2rem);
    box-shadow: inset 0 0 120px rgba(225, 48, 108, 0.045), inset 0 0 120px rgba(64, 93, 230, 0.04);
    overflow: hidden;
    isolation: isolate;
    text-transform: capitalize !important;
}

.instagram-story-viewer-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.12)),
        radial-gradient(circle at top left, rgba(225, 48, 108, 0.16) 0%, transparent 44%),
        radial-gradient(circle at bottom right, rgba(64, 93, 230, 0.14) 0%, transparent 46%);
    pointer-events: none;
    z-index: 0;
}

.hidden {
    display: none !important;
}

.content-container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 2.5vw, 2rem);
    position: relative;
    z-index: 1;
    overflow: visible;
    height: auto;
}

.title-section {
    text-align: center;
    padding: 0.5rem 0 0.25rem;
    width: 100%;
}

.input-component,
.output-component {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-radius: var(--border-radius-lg);
    padding: clamp(1rem, 2.4vw, 2rem);
    width: 100%;
    max-width: 960px;
    transition: var(--transition-normal);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(225, 48, 108, 0.08);
}

.input-component:hover,
.output-component:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(225, 48, 108, 0.14);
}

.output-component {
    overflow: visible;
    min-height: auto;
    height: auto;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(131, 58, 180, 0.08);
}

.app-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.75rem, 2vw, 1rem);
    margin-bottom: 0;
    flex-wrap: wrap;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--ig-purple), var(--ig-pink) 52%, var(--ig-orange));
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 18px;
    box-shadow: 0 12px 28px rgba(225, 48, 108, 0.24);
    flex: 0 0 auto;
}

.app-title {
    font-size: clamp(1.55rem, 3vw, 2.2rem);
    line-height: 1.2;
    font-weight: 800;
    background: linear-gradient(90deg, var(--ig-purple), var(--ig-pink), var(--ig-orange));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0;
    margin: 0;
    max-width: 900px;
}

.search-container {
    padding: 0;
    position: relative;
    flex-shrink: 0;
    width: 100%;
}

#search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: end;
    width: 100%;
}

.form-label {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-secondary-light);
    margin-bottom: 0.6rem;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-label svg {
    width: 18px;
    height: 18px;
    stroke: var(--ig-purple);
    flex: 0 0 auto;
}

.input-group {
    position: relative;
    width: 100%;
}

#username-input {
    width: 100%;
    max-width: 100%;
    height: 54px;
    min-height: 54px;
    max-height: 54px;
    padding: 0 3.25rem 0 1.1rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: var(--border-radius-md);
    color: var(--text-primary-light);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    line-height: 54px;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-sm);
    resize: none;
    overflow: hidden;
}

#username-input:focus {
    outline: none;
    border-color: rgba(131, 58, 180, 0.72);
    box-shadow: 0 0 0 4px rgba(131, 58, 180, 0.13), var(--shadow-md);
    background: var(--white);
}

#username-input::placeholder {
    color: var(--text-muted-light);
}

.input-icon {
    position: absolute;
    right: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted-light);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-btn,
.error-action {
    min-height: 54px;
    background: linear-gradient(135deg, var(--ig-purple), var(--ig-pink) 50%, var(--ig-orange));
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    padding: 0 1.5rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.7rem;
    transition: var(--transition-normal);
    box-shadow: 0 14px 30px rgba(225, 48, 108, 0.22);
    position: relative;
    overflow: hidden;
    letter-spacing: 0;
    white-space: nowrap;
}

#search-btn::before,
.error-action::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
    transform: translateX(-110%);
    transition: transform 0.55s ease;
}

#search-btn:hover,
.error-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(225, 48, 108, 0.28);
}

#search-btn:hover::before,
.error-action:hover::before {
    transform: translateX(110%);
}

#search-btn:active,
.error-action:active {
    transform: translateY(0);
    box-shadow: 0 8px 18px rgba(225, 48, 108, 0.2);
}

#search-btn:focus-visible,
.error-action:focus-visible,
.control-btn:focus-visible,
.nav-area:focus-visible,
.toast-close:focus-visible,
.centered-close-btn:focus-visible {
    outline: 3px solid rgba(131, 58, 180, 0.25);
    outline-offset: 3px;
}

.profile-section {
    padding: 0;
    position: relative;
    overflow: visible;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(2.5rem, 6vw, 4rem) 0;
}

.spinner {
    width: 58px;
    height: 58px;
    position: relative;
    margin-bottom: 1.5rem;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner::before,
.spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.spinner::before {
    inset: 0;
    background-image: conic-gradient(var(--ig-purple), var(--ig-pink), var(--ig-orange), var(--ig-purple));
}

.spinner::after {
    inset: 8px;
    background: var(--surface-dark);
    border-radius: 50%;
}

.loading-text {
    color: var(--text-secondary-light);
    font-size: 1.05rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--ig-purple), var(--ig-pink), var(--ig-orange));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 100%;
}

.profile-data {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow: visible;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.72);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    border: var(--border-line-light);
}

.profile-header:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.profile-image-container {
    position: relative;
    flex: 0 0 auto;
}

.profile-image-aura {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ig-purple), var(--ig-pink), var(--ig-orange));
    opacity: 0.24;
    filter: blur(8px);
    z-index: 0;
}

.profile-image {
    position: relative;
    z-index: 1;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid transparent;
    background:
        linear-gradient(var(--surface-dark), var(--surface-dark)) padding-box,
        linear-gradient(135deg, var(--ig-purple), var(--ig-pink), var(--ig-orange)) border-box;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    transition: var(--transition-normal);
}

.profile-image:hover {
    transform: scale(1.03);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
}

.verified-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 2;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--ig-blue), var(--ig-purple));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    border: 2px solid var(--surface-dark);
    box-shadow: var(--shadow-md);
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-username {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    color: var(--text-primary-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.profile-fullname {
    font-size: 1rem;
    color: var(--text-secondary-light);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.stories-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stories-section-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary-light);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    letter-spacing: 0;
    position: relative;
}

.stories-section-title svg {
    width: 20px;
    height: 20px;
    stroke: var(--ig-pink);
    flex: 0 0 auto;
}

.stories-count {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ig-purple);
    background: rgba(131, 58, 180, 0.08);
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(131, 58, 180, 0.12);
    white-space: nowrap;
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    width: 100%;
}

.story-card {
    background: rgba(255, 255, 255, 0.78);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-normal);
    border: var(--border-line-light);
    position: relative;
    box-shadow: var(--shadow-md);
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(225, 48, 108, 0.2);
}

.story-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--border-radius-md);
    padding: 2px;
    background: linear-gradient(135deg, var(--ig-purple), var(--ig-pink), var(--ig-orange));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: var(--transition-normal);
    pointer-events: none;
}

.story-card:hover::before {
    opacity: 0.75;
}

.story-preview {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
    min-height: 220px;
    background: linear-gradient(135deg, rgba(131, 58, 180, 0.08), rgba(225, 48, 108, 0.08));
}

.story-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease, transform 0.35s ease;
}

.story-card:hover .story-preview img {
    opacity: 0.94;
    transform: scale(1.035);
}

.story-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 48%, rgba(15, 23, 42, 0.72));
    z-index: 1;
}

.story-type-overlay {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    color: white;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 2;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.story-type-overlay.video,
.story.is_video,
.\$\{story\.is_video {
    background: rgba(22, 160, 133, 0.82);
}

.story-type-overlay.image {
    background: rgba(64, 93, 230, 0.82);
}

.\? {
    display: inline;
}

.story-timestamp-overlay {
    position: absolute;
    bottom: 14px;
    left: 14px;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.story-meta {
    padding: 0.95rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(248, 250, 252, 0.72);
    border-top: var(--border-line-light);
}

.story-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.story-info svg {
    width: 18px;
    height: 18px;
    stroke: var(--ig-pink);
    flex: 0 0 auto;
}

.story-time {
    font-size: 0.9rem;
    color: var(--text-secondary-light);
    font-weight: 700;
}

.error-panel,
.no-stories-message {
    padding: clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: var(--border-line-light);
}

.error-icon,
.no-stories-icon {
    width: 74px;
    height: 74px;
    background: rgba(193, 53, 132, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    color: var(--error);
    margin-bottom: 1.5rem;
    position: relative;
}

.error-icon::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(193, 53, 132, 0.16);
}

.error-message,
.no-stories-description {
    color: var(--text-secondary-light);
    font-size: 1rem;
    max-width: 420px;
    line-height: 1.65;
    font-weight: 600;
}

.error-action {
    margin-top: 1.5rem;
    width: auto;
}

.main-content {
    flex: 1;
    position: relative;
    background-color: var(--surface-dark);
    overflow: hidden;
    max-height: 100vh;
}

.main-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(64, 93, 230, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(22, 160, 133, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(225, 48, 108, 0.04) 0%, transparent 60%);
    z-index: 0;
}

.story-player {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 5;
}

.story-control-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: clamp(1rem, 2.5vw, 1.5rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.84), transparent);
    z-index: 15;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.story-user-data {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.story-user-image {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    object-fit: cover;
    flex: 0 0 auto;
}

.story-username {
    font-size: 1.05rem;
    color: white;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
    overflow-wrap: anywhere;
}

.story-timestamp {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.82);
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.story-actions {
    display: flex;
    gap: 0.75rem;
    flex: 0 0 auto;
}

.control-btn,
.play-pause-btn,
.download-btn,
.mute-btn,
.close-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    color: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
    padding: 0;
}

.control-btn:hover,
.play-pause-btn:hover,
.download-btn:hover,
.mute-btn:hover,
.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.26);
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.26);
}

.download-btn:active,
.close-btn:active,
.mute-btn:active,
.play-pause-btn:active,
.control-btn:active {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(0.96);
}

.progress-track {
    position: absolute;
    top: 88px;
    left: 0;
    right: 0;
    padding: 0 clamp(1rem, 2.5vw, 1.5rem);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.progress-indicator {
    height: 4px;
    flex: 1;
    background-color: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), var(--accent-secondary), var(--accent));
    border-radius: 999px;
    transition: width 0.1s linear;
}

.progress-indicator.completed .progress-fill {
    width: 100%;
    background: white;
}

.media-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

.media-container img,
.media-container video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.navigation-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    z-index: 5;
}

.nav-area {
    flex: 1;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
}

.nav-indicator {
    position: absolute;
    top: 50%;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    opacity: 0;
    transition: var(--transition-normal);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: white;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

.prev-area .nav-indicator {
    left: 30px;
}

.next-area .nav-indicator {
    right: 30px;
}

.nav-area:hover .nav-indicator {
    opacity: 1;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: calc(100vw - 40px);
}

.toast {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--border-line-light);
    border-radius: var(--border-radius-md);
    padding: 1rem 1.25rem;
    color: var(--text-primary-light);
    font-size: 0.92rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: min(300px, calc(100vw - 40px));
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid var(--ig-teal);
}

.toast.error {
    border-left: 4px solid var(--ig-red);
}

.toast.info {
    border-left: 4px solid var(--ig-blue);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted-light);
    cursor: pointer;
    padding: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
}

.toast-close:hover {
    color: var(--text-primary-light);
}

.no-stories-message {
    margin-top: 1.5rem;
    position: relative;
    overflow: hidden;
}

.no-stories-message::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: radial-gradient(circle at center, rgba(252, 175, 69, 0.1), transparent 70%);
    animation: rotate 20s linear infinite;
    z-index: -1;
}

.no-stories-icon {
    background: rgba(252, 175, 69, 0.13);
    color: var(--ig-yellow);
}

.no-stories-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary-light);
    margin-bottom: 0.8rem;
}

.centered-close-btn {
    position: absolute !important;
    top: 30px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    min-height: 44px !important;
    padding: 0.7rem 1.6rem !important;
    background: rgba(0, 0, 0, 0.78) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    border-radius: 999px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 1000 !important;
    color: white !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    transition: all 0.3s ease !important;
    pointer-events: auto !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28) !important;
}

.centered-close-btn:hover {
    background: rgba(0, 0, 0, 0.92) !important;
    border-color: rgba(255, 255, 255, 0.82) !important;
    transform: translateX(-50%) translateY(-1px) scale(1.03) !important;
}

.centered-close-btn:active {
    transform: translateX(-50%) scale(0.96) !important;
}

.instagram-story-viewer-wrapper .fa,
.instagram-story-viewer-wrapper .fas,
.instagram-story-viewer-wrapper .far,
.instagram-story-viewer-wrapper .fab,
.instagram-story-viewer-wrapper [class^="fa-"],
.instagram-story-viewer-wrapper [class*=" fa-"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: currentColor;
    font-style: normal;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

@media (max-width: 1200px) {
    .content-container {
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    .instagram-story-viewer-wrapper {
        padding: 1rem;
        gap: 1.25rem;
    }

    .content-container {
        padding: 0;
        gap: 1rem;
    }

    .input-component,
    .output-component {
        padding: 1rem;
        border-radius: 16px;
    }

    .app-logo {
        flex-direction: column;
        gap: 0.7rem;
    }

    .app-title {
        font-size: clamp(1.35rem, 6vw, 1.75rem);
        max-width: 100%;
    }

    #search-form {
        grid-template-columns: 1fr;
        gap: 0.9rem;
    }

    #username-input {
        width: 100%;
        height: 52px;
        min-height: 52px;
        max-height: 52px;
        line-height: 52px;
        font-size: 1rem;
    }

    #search-btn {
        width: 100%;
        min-height: 52px;
        padding: 0 1rem;
    }

    .stories-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .profile-info {
        width: 100%;
    }

    .profile-username {
        justify-content: center;
        font-size: 1.15rem;
    }

    .profile-image {
        width: 64px;
        height: 64px;
    }

    .stories-section-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.7rem;
    }

    .story-control-bar {
        padding: 1rem;
    }

    .story-actions {
        gap: 0.5rem;
    }

    .control-btn,
    .play-pause-btn,
    .download-btn,
    .mute-btn,
    .close-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .progress-track {
        top: 78px;
    }

    .centered-close-btn {
        padding: 0.6rem 1.35rem !important;
        font-size: 0.9rem !important;
        top: 20px !important;
        z-index: 1000 !important;
    }
}

@media (max-width: 576px) {
    .stories-grid {
        grid-template-columns: 1fr;
    }

    .story-preview {
        height: 220px;
    }

    .story-user-image {
        width: 40px;
        height: 40px;
    }

    .story-username {
        font-size: 0.95rem;
    }

    .story-timestamp {
        font-size: 0.78rem;
    }

    .nav-indicator {
        width: 42px;
        height: 42px;
    }

    .prev-area .nav-indicator {
        left: 14px;
    }

    .next-area .nav-indicator {
        right: 14px;
    }
}

@media (max-width: 480px) {
    .instagram-story-viewer-wrapper {
        padding: 0.75rem;
        gap: 0.85rem;
    }

    .input-component,
    .output-component {
        padding: 0.85rem;
    }

    .stories-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .app-title {
        font-size: 1.28rem;
        line-height: 1.25;
    }

    .logo-icon {
        width: 42px;
        height: 42px;
        font-size: 15px;
        border-radius: 13px;
    }

    .form-label {
        font-size: 0.92rem;
        margin-bottom: 0.5rem;
    }

    #username-input {
        height: 50px;
        min-height: 50px;
        max-height: 50px;
        line-height: 50px;
        padding-left: 1rem;
        padding-right: 3rem;
    }

    #search-btn {
        min-height: 50px;
        font-size: 0.95rem;
        padding: 0 0.9rem;
    }

    .profile-header {
        padding: 0.85rem;
        gap: 0.75rem;
    }

    .profile-image {
        width: 56px;
        height: 56px;
    }

    .profile-data {
        gap: 1rem;
    }

    .story-meta {
        padding: 0.75rem;
    }

    .story-info {
        gap: 0.35rem;
    }

    .story-control-bar {
        gap: 0.65rem;
    }

    .story-actions {
        gap: 0.35rem;
    }

    .control-btn,
    .play-pause-btn,
    .download-btn,
    .mute-btn,
    .close-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        max-width: calc(100vw - 24px);
    }

    .toast {
        min-width: min(280px, calc(100vw - 24px));
        padding: 0.85rem 1rem;
    }

    .centered-close-btn {
        padding: 0.5rem 1.1rem !important;
        font-size: 0.85rem !important;
        top: 15px !important;
        z-index: 1000 !important;
    }
}